bindings: Generate HdyDialog, HdyComboRow, and HdyHeaderGroup

Bindings for these were missing during the upgrade to 0.0.7.

This adds them to the right Gir files and generates them.

Closes https://gitlab.gnome.org/World/Rust/libhandy-rs/issues/2
This commit is contained in:
Christopher Davis 2019-01-25 19:24:16 -05:00
parent b0e55aecea
commit f3d8347283
9 changed files with 317 additions and 6 deletions

View file

@ -10,7 +10,3 @@ external_libraries = [
"Gtk",
"Gdk",
]
ignore = [
"Handy.Dialog",
]

View file

@ -326,6 +326,20 @@ impl ::std::fmt::Debug for HdyDialerCycleButton {
}
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct HdyDialog {
pub parent_instance: gtk::GtkDialog,
}
impl ::std::fmt::Debug for HdyDialog {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("HdyDialog @ {:?}", self as *const _))
.field("parent_instance", &self.parent_instance)
.finish()
}
}
#[repr(C)]
pub struct HdyEnumValueObject(c_void);

View file

@ -239,6 +239,7 @@ const RUST_LAYOUTS: &[(&str, Layout)] = &[
("HdyDialer", Layout {size: size_of::<HdyDialer>(), alignment: align_of::<HdyDialer>()}),
("HdyDialerButton", Layout {size: size_of::<HdyDialerButton>(), alignment: align_of::<HdyDialerButton>()}),
("HdyDialerCycleButton", Layout {size: size_of::<HdyDialerCycleButton>(), alignment: align_of::<HdyDialerCycleButton>()}),
("HdyDialog", Layout {size: size_of::<HdyDialog>(), alignment: align_of::<HdyDialog>()}),
("HdyEnumValueObjectClass", Layout {size: size_of::<HdyEnumValueObjectClass>(), alignment: align_of::<HdyEnumValueObjectClass>()}),
("HdyExpanderRow", Layout {size: size_of::<HdyExpanderRow>(), alignment: align_of::<HdyExpanderRow>()}),
("HdyFold", Layout {size: size_of::<HdyFold>(), alignment: align_of::<HdyFold>()}),

View file

@ -17,7 +17,6 @@ bitflags = "1.0.4"
lazy_static = "1.2.0"
glib-sys = "0.7.0"
glib = "0.6.1"
gtk = "0.5.0"
gtk-sys = "0.7.0"
gobject-sys = "0.7.0"
gio = "0.5.1"
@ -25,6 +24,10 @@ gdk = "0.9.0"
gio-sys = "0.7.0"
gdk-sys = "0.7.0"
[dependencies.gtk]
version = "0.5.0"
features = [ "v3_22" ]
[dependencies.libhandy-sys]
version = "0.2.0"
path = "../libhandy-sys"

View file

@ -22,6 +22,7 @@ generate = ["Handy.Column",
"Handy.DialerButton",
"Handy.Dialer",
"Handy.DialerCycleButton",
"Handy.Dialog",
"Handy.ExpanderRow",
"Handy.SearchBar",
"Handy.TitleBar",
@ -32,10 +33,16 @@ generate = ["Handy.Column",
"Handy.ArrowsDirection",
"Handy.Arrows",
"Handy.ActionRow",
"Handy.ComboRow",
"Handy.HeaderGroup",
]
manual = ["Gtk.Widget",
"Gtk.HeaderBar",
"Gtk.Window",
"Gtk.Dialog",
"Gtk.Orientation",
"Gtk.Entry",
"Gdk.Event"
"Gdk.Event",
"Gio.ListModel",
]

View file

@ -0,0 +1,132 @@
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use ActionRow;
use ffi;
#[cfg(any(feature = "v0_0_6", feature = "dox"))]
use gio;
use glib;
#[cfg(any(feature = "v0_0_7", feature = "dox"))]
use glib::object::Downcast;
use glib::object::IsA;
#[cfg(any(feature = "v0_0_7", feature = "dox"))]
use glib::signal::SignalHandlerId;
#[cfg(any(feature = "v0_0_7", feature = "dox"))]
use glib::signal::connect;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use gtk;
use gtk_ffi;
#[cfg(any(feature = "v0_0_7", feature = "dox"))]
use std::boxed::Box as Box_;
use std::mem;
#[cfg(any(feature = "v0_0_7", feature = "dox"))]
use std::mem::transmute;
use std::ptr;
glib_wrapper! {
pub struct ComboRow(Object<ffi::HdyComboRow, ffi::HdyComboRowClass>): [
ActionRow,
gtk::Widget => gtk_ffi::GtkWidget,
];
match fn {
get_type => || ffi::hdy_combo_row_get_type(),
}
}
impl ComboRow {
#[cfg(any(feature = "v0_0_6", feature = "dox"))]
pub fn new() -> ComboRow {
assert_initialized_main_thread!();
unsafe {
from_glib_none(ffi::hdy_combo_row_new())
}
}
}
#[cfg(any(feature = "v0_0_6", feature = "dox"))]
impl Default for ComboRow {
fn default() -> Self {
Self::new()
}
}
pub trait ComboRowExt {
//#[cfg(any(feature = "v0_0_6", feature = "dox"))]
//fn bind_model<'a, 'b, 'c, P: IsA<gio::ListModel> + 'a, Q: Into<Option<&'a P>>, R: Into<Option<&'b /*Ignored*/gtk::ListBoxCreateWidgetFunc>>, S: Into<Option<&'c /*Ignored*/gtk::ListBoxCreateWidgetFunc>>>(&self, model: Q, create_list_widget_func: R, create_current_widget_func: S, user_data_free_func: /*Unknown conversion*//*Unimplemented*/DestroyNotify);
//#[cfg(any(feature = "v0_0_6", feature = "dox"))]
//fn bind_name_model<'a, 'b, P: IsA<gio::ListModel> + 'a, Q: Into<Option<&'a P>>, R: Into<Option<&'b /*Unimplemented*/ComboRowGetNameFunc>>>(&self, model: Q, get_name_func: R, user_data_free_func: /*Unknown conversion*//*Unimplemented*/DestroyNotify);
#[cfg(any(feature = "v0_0_6", feature = "dox"))]
fn get_model(&self) -> Option<gio::ListModel>;
#[cfg(any(feature = "v0_0_7", feature = "dox"))]
fn get_selected_index(&self) -> i32;
//#[cfg(any(feature = "v0_0_6", feature = "dox"))]
//fn set_for_enum<'a, P: Into<Option<&'a /*Unimplemented*/ComboRowGetEnumValueNameFunc>>>(&self, enum_type: glib::types::Type, get_name_func: P, user_data_free_func: /*Unknown conversion*//*Unimplemented*/DestroyNotify);
#[cfg(any(feature = "v0_0_7", feature = "dox"))]
fn set_selected_index(&self, selected_index: i32);
#[cfg(any(feature = "v0_0_7", feature = "dox"))]
fn connect_property_selected_index_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
}
impl<O: IsA<ComboRow> + IsA<glib::object::Object>> ComboRowExt for O {
//#[cfg(any(feature = "v0_0_6", feature = "dox"))]
//fn bind_model<'a, 'b, 'c, P: IsA<gio::ListModel> + 'a, Q: Into<Option<&'a P>>, R: Into<Option<&'b /*Ignored*/gtk::ListBoxCreateWidgetFunc>>, S: Into<Option<&'c /*Ignored*/gtk::ListBoxCreateWidgetFunc>>>(&self, model: Q, create_list_widget_func: R, create_current_widget_func: S, user_data_free_func: /*Unknown conversion*//*Unimplemented*/DestroyNotify) {
// unsafe { TODO: call ffi::hdy_combo_row_bind_model() }
//}
//#[cfg(any(feature = "v0_0_6", feature = "dox"))]
//fn bind_name_model<'a, 'b, P: IsA<gio::ListModel> + 'a, Q: Into<Option<&'a P>>, R: Into<Option<&'b /*Unimplemented*/ComboRowGetNameFunc>>>(&self, model: Q, get_name_func: R, user_data_free_func: /*Unknown conversion*//*Unimplemented*/DestroyNotify) {
// unsafe { TODO: call ffi::hdy_combo_row_bind_name_model() }
//}
#[cfg(any(feature = "v0_0_6", feature = "dox"))]
fn get_model(&self) -> Option<gio::ListModel> {
unsafe {
from_glib_none(ffi::hdy_combo_row_get_model(self.to_glib_none().0))
}
}
#[cfg(any(feature = "v0_0_7", feature = "dox"))]
fn get_selected_index(&self) -> i32 {
unsafe {
ffi::hdy_combo_row_get_selected_index(self.to_glib_none().0)
}
}
//#[cfg(any(feature = "v0_0_6", feature = "dox"))]
//fn set_for_enum<'a, P: Into<Option<&'a /*Unimplemented*/ComboRowGetEnumValueNameFunc>>>(&self, enum_type: glib::types::Type, get_name_func: P, user_data_free_func: /*Unknown conversion*//*Unimplemented*/DestroyNotify) {
// unsafe { TODO: call ffi::hdy_combo_row_set_for_enum() }
//}
#[cfg(any(feature = "v0_0_7", feature = "dox"))]
fn set_selected_index(&self, selected_index: i32) {
unsafe {
ffi::hdy_combo_row_set_selected_index(self.to_glib_none().0, selected_index);
}
}
#[cfg(any(feature = "v0_0_7", feature = "dox"))]
fn connect_property_selected_index_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::selected-index",
transmute(notify_selected_index_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
}
#[cfg(any(feature = "v0_0_7", feature = "dox"))]
unsafe extern "C" fn notify_selected_index_trampoline<P>(this: *mut ffi::HdyComboRow, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<ComboRow> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&ComboRow::from_glib_borrow(this).downcast_unchecked())
}

View file

@ -0,0 +1,36 @@
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use ffi;
use glib::object::Downcast;
use glib::object::IsA;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use gtk;
use gtk_ffi;
use std::mem;
use std::ptr;
glib_wrapper! {
pub struct Dialog(Object<ffi::HdyDialog, ffi::HdyDialogClass>): [
gtk::Dialog => gtk_ffi::GtkDialog,
gtk::Window => gtk_ffi::GtkWindow,
gtk::Widget => gtk_ffi::GtkWidget,
];
match fn {
get_type => || ffi::hdy_dialog_get_type(),
}
}
impl Dialog {
#[cfg(any(feature = "v0_0_7", feature = "dox"))]
pub fn new<P: IsA<gtk::Window>>(parent: &P) -> Dialog {
assert_initialized_main_thread!();
unsafe {
gtk::Widget::from_glib_none(ffi::hdy_dialog_new(parent.to_glib_none().0)).downcast_unchecked()
}
}
}

View file

@ -0,0 +1,103 @@
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use ffi;
use glib;
use glib::object::Downcast;
use glib::object::IsA;
use glib::signal::SignalHandlerId;
use glib::signal::connect;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use gtk;
use std::boxed::Box as Box_;
use std::mem;
use std::mem::transmute;
use std::ptr;
glib_wrapper! {
pub struct HeaderGroup(Object<ffi::HdyHeaderGroup, ffi::HdyHeaderGroupClass>);
match fn {
get_type => || ffi::hdy_header_group_get_type(),
}
}
impl HeaderGroup {
pub fn new() -> HeaderGroup {
assert_initialized_main_thread!();
unsafe {
from_glib_full(ffi::hdy_header_group_new())
}
}
}
impl Default for HeaderGroup {
fn default() -> Self {
Self::new()
}
}
pub trait HeaderGroupExt {
fn add_header_bar(&self, header_bar: &gtk::HeaderBar);
fn get_focus(&self) -> Option<gtk::HeaderBar>;
fn get_header_bars(&self) -> Vec<gtk::HeaderBar>;
fn remove_header_bar(&self, header_bar: &gtk::HeaderBar);
fn set_focus<'a, P: Into<Option<&'a gtk::HeaderBar>>>(&self, header_bar: P);
fn connect_property_focus_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
}
impl<O: IsA<HeaderGroup> + IsA<glib::object::Object>> HeaderGroupExt for O {
fn add_header_bar(&self, header_bar: &gtk::HeaderBar) {
unsafe {
ffi::hdy_header_group_add_header_bar(self.to_glib_none().0, header_bar.to_glib_none().0);
}
}
fn get_focus(&self) -> Option<gtk::HeaderBar> {
unsafe {
from_glib_none(ffi::hdy_header_group_get_focus(self.to_glib_none().0))
}
}
fn get_header_bars(&self) -> Vec<gtk::HeaderBar> {
unsafe {
FromGlibPtrContainer::from_glib_none(ffi::hdy_header_group_get_header_bars(self.to_glib_none().0))
}
}
fn remove_header_bar(&self, header_bar: &gtk::HeaderBar) {
unsafe {
ffi::hdy_header_group_remove_header_bar(self.to_glib_none().0, header_bar.to_glib_none().0);
}
}
fn set_focus<'a, P: Into<Option<&'a gtk::HeaderBar>>>(&self, header_bar: P) {
let header_bar = header_bar.into();
let header_bar = header_bar.to_glib_none();
unsafe {
ffi::hdy_header_group_set_focus(self.to_glib_none().0, header_bar.0);
}
}
fn connect_property_focus_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::focus",
transmute(notify_focus_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
}
unsafe extern "C" fn notify_focus_trampoline<P>(this: *mut ffi::HdyHeaderGroup, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<HeaderGroup> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&HeaderGroup::from_glib_borrow(this).downcast_unchecked())
}

View file

@ -14,6 +14,13 @@ mod column;
pub use self::column::Column;
pub use self::column::ColumnExt;
#[cfg(any(feature = "v0_0_6", feature = "dox"))]
mod combo_row;
#[cfg(any(feature = "v0_0_6", feature = "dox"))]
pub use self::combo_row::ComboRow;
#[cfg(any(feature = "v0_0_6", feature = "dox"))]
pub use self::combo_row::ComboRowExt;
mod dialer;
pub use self::dialer::Dialer;
pub use self::dialer::DialerExt;
@ -26,6 +33,11 @@ mod dialer_cycle_button;
pub use self::dialer_cycle_button::DialerCycleButton;
pub use self::dialer_cycle_button::DialerCycleButtonExt;
#[cfg(any(feature = "v0_0_7", feature = "dox"))]
mod dialog;
#[cfg(any(feature = "v0_0_7", feature = "dox"))]
pub use self::dialog::Dialog;
#[cfg(any(feature = "v0_0_6", feature = "dox"))]
mod expander_row;
#[cfg(any(feature = "v0_0_6", feature = "dox"))]
@ -33,6 +45,10 @@ pub use self::expander_row::ExpanderRow;
#[cfg(any(feature = "v0_0_6", feature = "dox"))]
pub use self::expander_row::ExpanderRowExt;
mod header_group;
pub use self::header_group::HeaderGroup;
pub use self::header_group::HeaderGroupExt;
mod leaflet;
pub use self::leaflet::Leaflet;
pub use self::leaflet::LeafletExt;
@ -59,11 +75,14 @@ pub mod traits {
pub use super::ActionRowExt;
pub use super::ArrowsExt;
pub use super::ColumnExt;
#[cfg(any(feature = "v0_0_6", feature = "dox"))]
pub use super::ComboRowExt;
pub use super::DialerExt;
pub use super::DialerButtonExt;
pub use super::DialerCycleButtonExt;
#[cfg(any(feature = "v0_0_6", feature = "dox"))]
pub use super::ExpanderRowExt;
pub use super::HeaderGroupExt;
pub use super::LeafletExt;
#[cfg(any(feature = "v0_0_6", feature = "dox"))]
pub use super::SearchBarExt;