Generate HandyActionRow

This commit is contained in:
Jordan Petridis 2018-12-27 09:36:23 +02:00 committed by Julian Sparber
parent a63aa5ef37
commit c0c3e62e97
3 changed files with 211 additions and 1 deletions

View file

@ -25,7 +25,8 @@ generate = ["Handy.Column",
"Handy.LeafletChildTransitionType",
"Handy.LeafletModeTransitionType",
"Handy.ArrowsDirection",
"Handy.Arrows"
"Handy.Arrows",
"Handy.ActionRow",
]
manual = ["Gtk.Widget",

View file

@ -0,0 +1,204 @@
// 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 gtk_ffi;
use std::boxed::Box as Box_;
use std::mem;
use std::mem::transmute;
use std::ptr;
glib_wrapper! {
pub struct ActionRow(Object<ffi::HdyActionRow, ffi::HdyActionRowClass>): [
gtk::Widget => gtk_ffi::GtkWidget,
];
match fn {
get_type => || ffi::hdy_action_row_get_type(),
}
}
impl ActionRow {
pub fn new() -> ActionRow {
assert_initialized_main_thread!();
unsafe {
from_glib_none(ffi::hdy_action_row_new())
}
}
}
impl Default for ActionRow {
fn default() -> Self {
Self::new()
}
}
pub trait ActionRowExt {
fn activate(&self);
fn add_action<'a, P: IsA<gtk::Widget> + 'a, Q: Into<Option<&'a P>>>(&self, widget: Q);
fn add_prefix<'a, P: IsA<gtk::Widget> + 'a, Q: Into<Option<&'a P>>>(&self, widget: Q);
fn get_icon_name(&self) -> Option<String>;
fn get_subtitle(&self) -> Option<String>;
fn get_title(&self) -> Option<String>;
fn get_use_underline(&self) -> bool;
fn set_icon_name(&self, icon_name: &str);
fn set_subtitle(&self, subtitle: &str);
fn set_title(&self, title: &str);
fn set_use_underline(&self, use_underline: bool);
fn connect_property_icon_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_subtitle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_use_underline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
}
impl<O: IsA<ActionRow> + IsA<glib::object::Object>> ActionRowExt for O {
fn activate(&self) {
unsafe {
ffi::hdy_action_row_activate(self.to_glib_none().0);
}
}
fn add_action<'a, P: IsA<gtk::Widget> + 'a, Q: Into<Option<&'a P>>>(&self, widget: Q) {
let widget = widget.into();
let widget = widget.to_glib_none();
unsafe {
ffi::hdy_action_row_add_action(self.to_glib_none().0, widget.0);
}
}
fn add_prefix<'a, P: IsA<gtk::Widget> + 'a, Q: Into<Option<&'a P>>>(&self, widget: Q) {
let widget = widget.into();
let widget = widget.to_glib_none();
unsafe {
ffi::hdy_action_row_add_prefix(self.to_glib_none().0, widget.0);
}
}
fn get_icon_name(&self) -> Option<String> {
unsafe {
from_glib_none(ffi::hdy_action_row_get_icon_name(self.to_glib_none().0))
}
}
fn get_subtitle(&self) -> Option<String> {
unsafe {
from_glib_none(ffi::hdy_action_row_get_subtitle(self.to_glib_none().0))
}
}
fn get_title(&self) -> Option<String> {
unsafe {
from_glib_none(ffi::hdy_action_row_get_title(self.to_glib_none().0))
}
}
fn get_use_underline(&self) -> bool {
unsafe {
from_glib(ffi::hdy_action_row_get_use_underline(self.to_glib_none().0))
}
}
fn set_icon_name(&self, icon_name: &str) {
unsafe {
ffi::hdy_action_row_set_icon_name(self.to_glib_none().0, icon_name.to_glib_none().0);
}
}
fn set_subtitle(&self, subtitle: &str) {
unsafe {
ffi::hdy_action_row_set_subtitle(self.to_glib_none().0, subtitle.to_glib_none().0);
}
}
fn set_title(&self, title: &str) {
unsafe {
ffi::hdy_action_row_set_title(self.to_glib_none().0, title.to_glib_none().0);
}
}
fn set_use_underline(&self, use_underline: bool) {
unsafe {
ffi::hdy_action_row_set_use_underline(self.to_glib_none().0, use_underline.to_glib());
}
}
fn connect_property_icon_name_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::icon-name",
transmute(notify_icon_name_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_subtitle_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::subtitle",
transmute(notify_subtitle_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_title_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::title",
transmute(notify_title_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_use_underline_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::use-underline",
transmute(notify_use_underline_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
}
unsafe extern "C" fn notify_icon_name_trampoline<P>(this: *mut ffi::HdyActionRow, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<ActionRow> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&ActionRow::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_subtitle_trampoline<P>(this: *mut ffi::HdyActionRow, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<ActionRow> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&ActionRow::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_title_trampoline<P>(this: *mut ffi::HdyActionRow, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<ActionRow> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&ActionRow::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_use_underline_trampoline<P>(this: *mut ffi::HdyActionRow, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<ActionRow> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&ActionRow::from_glib_borrow(this).downcast_unchecked())
}

View file

@ -2,6 +2,10 @@
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
mod action_row;
pub use self::action_row::ActionRow;
pub use self::action_row::ActionRowExt;
mod arrows;
pub use self::arrows::Arrows;
pub use self::arrows::ArrowsExt;
@ -34,6 +38,7 @@ pub use self::enums::LeafletModeTransitionType;
#[doc(hidden)]
pub mod traits {
pub use super::ActionRowExt;
pub use super::ArrowsExt;
pub use super::ColumnExt;
pub use super::DialerExt;