use crate::{ffi, Bin, Tab, TabSwitcherTabBarBehavior};
use glib::{
prelude::*,
signal::{connect_raw, SignalHandlerId},
translate::*,
};
use std::boxed::Box as Box_;
glib::wrapper! {
#[doc(alias = "HeTabSwitcher")]
pub struct TabSwitcher(Object<ffi::HeTabSwitcher, ffi::HeTabSwitcherClass>) @extends Bin, gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget;
match fn {
type_ => || ffi::he_tab_switcher_get_type(),
}
}
impl TabSwitcher {
pub const NONE: Option<&'static TabSwitcher> = None;
#[doc(alias = "he_tab_switcher_new")]
pub fn new() -> TabSwitcher {
assert_initialized_main_thread!();
unsafe { from_glib_none(ffi::he_tab_switcher_new()) }
}
pub fn builder() -> TabSwitcherBuilder {
TabSwitcherBuilder::new()
}
}
impl Default for TabSwitcher {
fn default() -> Self {
Self::new()
}
}
#[must_use = "The builder must be built to be used"]
pub struct TabSwitcherBuilder {
builder: glib::object::ObjectBuilder<'static, TabSwitcher>,
}
impl TabSwitcherBuilder {
fn new() -> Self {
Self {
builder: glib::object::Object::builder(),
}
}
pub fn tab_bar_behavior(self, tab_bar_behavior: TabSwitcherTabBarBehavior) -> Self {
Self {
builder: self.builder.property("tab-bar-behavior", tab_bar_behavior),
}
}
pub fn allow_duplicate_tabs(self, allow_duplicate_tabs: bool) -> Self {
Self {
builder: self
.builder
.property("allow-duplicate-tabs", allow_duplicate_tabs),
}
}
pub fn allow_drag(self, allow_drag: bool) -> Self {
Self {
builder: self.builder.property("allow-drag", allow_drag),
}
}
pub fn allow_pinning(self, allow_pinning: bool) -> Self {
Self {
builder: self.builder.property("allow-pinning", allow_pinning),
}
}
pub fn allow_closing(self, allow_closing: bool) -> Self {
Self {
builder: self.builder.property("allow-closing", allow_closing),
}
}
pub fn allow_new_window(self, allow_new_window: bool) -> Self {
Self {
builder: self.builder.property("allow-new-window", allow_new_window),
}
}
pub fn current(self, current: &impl IsA<Tab>) -> Self {
Self {
builder: self.builder.property("current", current.clone().upcast()),
}
}
pub fn menu(self, menu: &gio::Menu) -> Self {
Self {
builder: self.builder.property("menu", menu.clone()),
}
}
pub fn actions(self, actions: &impl IsA<gio::SimpleActionGroup>) -> Self {
Self {
builder: self.builder.property("actions", actions.clone().upcast()),
}
}
pub fn child(self, child: &impl IsA<gtk::Widget>) -> Self {
Self {
builder: self.builder.property("child", child.clone().upcast()),
}
}
pub fn can_focus(self, can_focus: bool) -> Self {
Self {
builder: self.builder.property("can-focus", can_focus),
}
}
pub fn can_target(self, can_target: bool) -> Self {
Self {
builder: self.builder.property("can-target", can_target),
}
}
pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
Self {
builder: self.builder.property("css-classes", css_classes.into()),
}
}
pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
Self {
builder: self.builder.property("css-name", css_name.into()),
}
}
pub fn focus_on_click(self, focus_on_click: bool) -> Self {
Self {
builder: self.builder.property("focus-on-click", focus_on_click),
}
}
pub fn focusable(self, focusable: bool) -> Self {
Self {
builder: self.builder.property("focusable", focusable),
}
}
pub fn halign(self, halign: gtk::Align) -> Self {
Self {
builder: self.builder.property("halign", halign),
}
}
pub fn has_tooltip(self, has_tooltip: bool) -> Self {
Self {
builder: self.builder.property("has-tooltip", has_tooltip),
}
}
pub fn height_request(self, height_request: i32) -> Self {
Self {
builder: self.builder.property("height-request", height_request),
}
}
pub fn hexpand(self, hexpand: bool) -> Self {
Self {
builder: self.builder.property("hexpand", hexpand),
}
}
pub fn hexpand_set(self, hexpand_set: bool) -> Self {
Self {
builder: self.builder.property("hexpand-set", hexpand_set),
}
}
pub fn margin_bottom(self, margin_bottom: i32) -> Self {
Self {
builder: self.builder.property("margin-bottom", margin_bottom),
}
}
pub fn margin_end(self, margin_end: i32) -> Self {
Self {
builder: self.builder.property("margin-end", margin_end),
}
}
pub fn margin_start(self, margin_start: i32) -> Self {
Self {
builder: self.builder.property("margin-start", margin_start),
}
}
pub fn margin_top(self, margin_top: i32) -> Self {
Self {
builder: self.builder.property("margin-top", margin_top),
}
}
pub fn name(self, name: impl Into<glib::GString>) -> Self {
Self {
builder: self.builder.property("name", name.into()),
}
}
pub fn opacity(self, opacity: f64) -> Self {
Self {
builder: self.builder.property("opacity", opacity),
}
}
pub fn receives_default(self, receives_default: bool) -> Self {
Self {
builder: self.builder.property("receives-default", receives_default),
}
}
pub fn sensitive(self, sensitive: bool) -> Self {
Self {
builder: self.builder.property("sensitive", sensitive),
}
}
pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
Self {
builder: self
.builder
.property("tooltip-markup", tooltip_markup.into()),
}
}
pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
Self {
builder: self.builder.property("tooltip-text", tooltip_text.into()),
}
}
pub fn valign(self, valign: gtk::Align) -> Self {
Self {
builder: self.builder.property("valign", valign),
}
}
pub fn vexpand(self, vexpand: bool) -> Self {
Self {
builder: self.builder.property("vexpand", vexpand),
}
}
pub fn vexpand_set(self, vexpand_set: bool) -> Self {
Self {
builder: self.builder.property("vexpand-set", vexpand_set),
}
}
pub fn visible(self, visible: bool) -> Self {
Self {
builder: self.builder.property("visible", visible),
}
}
pub fn width_request(self, width_request: i32) -> Self {
Self {
builder: self.builder.property("width-request", width_request),
}
}
#[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
pub fn build(self) -> TabSwitcher {
self.builder.build()
}
}
mod sealed {
pub trait Sealed {}
impl<T: super::IsA<super::TabSwitcher>> Sealed for T {}
}
pub trait TabSwitcherExt: IsA<TabSwitcher> + sealed::Sealed + 'static {
#[doc(alias = "he_tab_switcher_get_tab_position")]
#[doc(alias = "get_tab_position")]
fn tab_position(&self, tab: &impl IsA<Tab>) -> i32 {
unsafe {
ffi::he_tab_switcher_get_tab_position(
self.as_ref().to_glib_none().0,
tab.as_ref().to_glib_none().0,
)
}
}
#[doc(alias = "he_tab_switcher_insert_tab")]
fn insert_tab(&self, tab: &impl IsA<Tab>, index: i32) -> u32 {
unsafe {
ffi::he_tab_switcher_insert_tab(
self.as_ref().to_glib_none().0,
tab.as_ref().to_glib_none().0,
index,
)
}
}
#[doc(alias = "he_tab_switcher_remove_tab")]
fn remove_tab(&self, tab: &impl IsA<Tab>) {
unsafe {
ffi::he_tab_switcher_remove_tab(
self.as_ref().to_glib_none().0,
tab.as_ref().to_glib_none().0,
);
}
}
#[doc(alias = "he_tab_switcher_get_n_tabs")]
#[doc(alias = "get_n_tabs")]
fn n_tabs(&self) -> i32 {
unsafe { ffi::he_tab_switcher_get_n_tabs(self.as_ref().to_glib_none().0) }
}
#[doc(alias = "he_tab_switcher_get_tabs")]
#[doc(alias = "get_tabs")]
fn tabs(&self) -> Vec<Tab> {
unsafe {
FromGlibPtrContainer::from_glib_none(ffi::he_tab_switcher_get_tabs(
self.as_ref().to_glib_none().0,
))
}
}
#[doc(alias = "he_tab_switcher_get_tab_bar_behavior")]
#[doc(alias = "get_tab_bar_behavior")]
fn tab_bar_behavior(&self) -> TabSwitcherTabBarBehavior {
unsafe {
from_glib(ffi::he_tab_switcher_get_tab_bar_behavior(
self.as_ref().to_glib_none().0,
))
}
}
#[doc(alias = "he_tab_switcher_set_tab_bar_behavior")]
fn set_tab_bar_behavior(&self, value: TabSwitcherTabBarBehavior) {
unsafe {
ffi::he_tab_switcher_set_tab_bar_behavior(
self.as_ref().to_glib_none().0,
value.into_glib(),
);
}
}
#[doc(alias = "he_tab_switcher_get_allow_duplicate_tabs")]
#[doc(alias = "get_allow_duplicate_tabs")]
fn allows_duplicate_tabs(&self) -> bool {
unsafe {
from_glib(ffi::he_tab_switcher_get_allow_duplicate_tabs(
self.as_ref().to_glib_none().0,
))
}
}
#[doc(alias = "he_tab_switcher_set_allow_duplicate_tabs")]
fn set_allow_duplicate_tabs(&self, value: bool) {
unsafe {
ffi::he_tab_switcher_set_allow_duplicate_tabs(
self.as_ref().to_glib_none().0,
value.into_glib(),
);
}
}
#[doc(alias = "he_tab_switcher_get_allow_drag")]
#[doc(alias = "get_allow_drag")]
fn allows_drag(&self) -> bool {
unsafe {
from_glib(ffi::he_tab_switcher_get_allow_drag(
self.as_ref().to_glib_none().0,
))
}
}
#[doc(alias = "he_tab_switcher_set_allow_drag")]
fn set_allow_drag(&self, value: bool) {
unsafe {
ffi::he_tab_switcher_set_allow_drag(self.as_ref().to_glib_none().0, value.into_glib());
}
}
#[doc(alias = "he_tab_switcher_get_allow_pinning")]
#[doc(alias = "get_allow_pinning")]
fn allows_pinning(&self) -> bool {
unsafe {
from_glib(ffi::he_tab_switcher_get_allow_pinning(
self.as_ref().to_glib_none().0,
))
}
}
#[doc(alias = "he_tab_switcher_set_allow_pinning")]
fn set_allow_pinning(&self, value: bool) {
unsafe {
ffi::he_tab_switcher_set_allow_pinning(
self.as_ref().to_glib_none().0,
value.into_glib(),
);
}
}
#[doc(alias = "he_tab_switcher_get_allow_closing")]
#[doc(alias = "get_allow_closing")]
fn allows_closing(&self) -> bool {
unsafe {
from_glib(ffi::he_tab_switcher_get_allow_closing(
self.as_ref().to_glib_none().0,
))
}
}
#[doc(alias = "he_tab_switcher_set_allow_closing")]
fn set_allow_closing(&self, value: bool) {
unsafe {
ffi::he_tab_switcher_set_allow_closing(
self.as_ref().to_glib_none().0,
value.into_glib(),
);
}
}
#[doc(alias = "he_tab_switcher_get_allow_new_window")]
#[doc(alias = "get_allow_new_window")]
fn allows_new_window(&self) -> bool {
unsafe {
from_glib(ffi::he_tab_switcher_get_allow_new_window(
self.as_ref().to_glib_none().0,
))
}
}
#[doc(alias = "he_tab_switcher_set_allow_new_window")]
fn set_allow_new_window(&self, value: bool) {
unsafe {
ffi::he_tab_switcher_set_allow_new_window(
self.as_ref().to_glib_none().0,
value.into_glib(),
);
}
}
#[doc(alias = "he_tab_switcher_get_current")]
#[doc(alias = "get_current")]
fn current(&self) -> Tab {
unsafe {
from_glib_none(ffi::he_tab_switcher_get_current(
self.as_ref().to_glib_none().0,
))
}
}
#[doc(alias = "he_tab_switcher_set_current")]
fn set_current(&self, value: &impl IsA<Tab>) {
unsafe {
ffi::he_tab_switcher_set_current(
self.as_ref().to_glib_none().0,
value.as_ref().to_glib_none().0,
);
}
}
#[doc(alias = "he_tab_switcher_get_menu")]
#[doc(alias = "get_menu")]
fn menu(&self) -> gio::Menu {
unsafe {
from_glib_none(ffi::he_tab_switcher_get_menu(
self.as_ref().to_glib_none().0,
))
}
}
#[doc(alias = "he_tab_switcher_get_actions")]
#[doc(alias = "get_actions")]
fn actions(&self) -> gio::SimpleActionGroup {
unsafe {
from_glib_none(ffi::he_tab_switcher_get_actions(
self.as_ref().to_glib_none().0,
))
}
}
fn set_menu(&self, menu: Option<&gio::Menu>) {
ObjectExt::set_property(self.as_ref(), "menu", menu)
}
#[doc(alias = "tab-added")]
fn connect_tab_added<F: Fn(&Self, &Tab) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn tab_added_trampoline<
P: IsA<TabSwitcher>,
F: Fn(&P, &Tab) + 'static,
>(
this: *mut ffi::HeTabSwitcher,
tab: *mut ffi::HeTab,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(
TabSwitcher::from_glib_borrow(this).unsafe_cast_ref(),
&from_glib_borrow(tab),
)
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"tab-added\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
tab_added_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "tab-removed")]
fn connect_tab_removed<F: Fn(&Self, &Tab) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn tab_removed_trampoline<
P: IsA<TabSwitcher>,
F: Fn(&P, &Tab) + 'static,
>(
this: *mut ffi::HeTabSwitcher,
tab: *mut ffi::HeTab,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(
TabSwitcher::from_glib_borrow(this).unsafe_cast_ref(),
&from_glib_borrow(tab),
)
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"tab-removed\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
tab_removed_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "tab-switched")]
fn connect_tab_switched<F: Fn(&Self, Option<&Tab>, &Tab) + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn tab_switched_trampoline<
P: IsA<TabSwitcher>,
F: Fn(&P, Option<&Tab>, &Tab) + 'static,
>(
this: *mut ffi::HeTabSwitcher,
old_tab: *mut ffi::HeTab,
new_tab: *mut ffi::HeTab,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(
TabSwitcher::from_glib_borrow(this).unsafe_cast_ref(),
Option::<Tab>::from_glib_borrow(old_tab).as_ref().as_ref(),
&from_glib_borrow(new_tab),
)
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"tab-switched\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
tab_switched_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "tab-moved")]
fn connect_tab_moved<F: Fn(&Self, &Tab) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn tab_moved_trampoline<
P: IsA<TabSwitcher>,
F: Fn(&P, &Tab) + 'static,
>(
this: *mut ffi::HeTabSwitcher,
tab: *mut ffi::HeTab,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(
TabSwitcher::from_glib_borrow(this).unsafe_cast_ref(),
&from_glib_borrow(tab),
)
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"tab-moved\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
tab_moved_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "tab-duplicated")]
fn connect_tab_duplicated<F: Fn(&Self, &Tab) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn tab_duplicated_trampoline<
P: IsA<TabSwitcher>,
F: Fn(&P, &Tab) + 'static,
>(
this: *mut ffi::HeTabSwitcher,
duplicated_tab: *mut ffi::HeTab,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(
TabSwitcher::from_glib_borrow(this).unsafe_cast_ref(),
&from_glib_borrow(duplicated_tab),
)
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"tab-duplicated\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
tab_duplicated_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "new-tab-requested")]
fn connect_new_tab_requested<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn new_tab_requested_trampoline<
P: IsA<TabSwitcher>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::HeTabSwitcher,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(TabSwitcher::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"new-tab-requested\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
new_tab_requested_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "close-tab-requested")]
fn connect_close_tab_requested<F: Fn(&Self, &Tab) -> bool + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn close_tab_requested_trampoline<
P: IsA<TabSwitcher>,
F: Fn(&P, &Tab) -> bool + 'static,
>(
this: *mut ffi::HeTabSwitcher,
tab: *mut ffi::HeTab,
f: glib::ffi::gpointer,
) -> glib::ffi::gboolean {
let f: &F = &*(f as *const F);
f(
TabSwitcher::from_glib_borrow(this).unsafe_cast_ref(),
&from_glib_borrow(tab),
)
.into_glib()
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"close-tab-requested\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
close_tab_requested_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "n-tabs")]
fn connect_n_tabs_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_n_tabs_trampoline<P: IsA<TabSwitcher>, F: Fn(&P) + 'static>(
this: *mut ffi::HeTabSwitcher,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(TabSwitcher::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::n-tabs\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_n_tabs_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "tabs")]
fn connect_tabs_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_tabs_trampoline<P: IsA<TabSwitcher>, F: Fn(&P) + 'static>(
this: *mut ffi::HeTabSwitcher,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(TabSwitcher::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::tabs\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_tabs_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "tab-bar-behavior")]
fn connect_tab_bar_behavior_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_tab_bar_behavior_trampoline<
P: IsA<TabSwitcher>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::HeTabSwitcher,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(TabSwitcher::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::tab-bar-behavior\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_tab_bar_behavior_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "allow-duplicate-tabs")]
fn connect_allow_duplicate_tabs_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_allow_duplicate_tabs_trampoline<
P: IsA<TabSwitcher>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::HeTabSwitcher,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(TabSwitcher::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::allow-duplicate-tabs\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_allow_duplicate_tabs_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "allow-drag")]
fn connect_allow_drag_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_allow_drag_trampoline<
P: IsA<TabSwitcher>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::HeTabSwitcher,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(TabSwitcher::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::allow-drag\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_allow_drag_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "allow-pinning")]
fn connect_allow_pinning_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_allow_pinning_trampoline<
P: IsA<TabSwitcher>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::HeTabSwitcher,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(TabSwitcher::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::allow-pinning\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_allow_pinning_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "allow-closing")]
fn connect_allow_closing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_allow_closing_trampoline<
P: IsA<TabSwitcher>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::HeTabSwitcher,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(TabSwitcher::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::allow-closing\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_allow_closing_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "allow-new-window")]
fn connect_allow_new_window_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_allow_new_window_trampoline<
P: IsA<TabSwitcher>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::HeTabSwitcher,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(TabSwitcher::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::allow-new-window\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_allow_new_window_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "current")]
fn connect_current_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_current_trampoline<P: IsA<TabSwitcher>, F: Fn(&P) + 'static>(
this: *mut ffi::HeTabSwitcher,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(TabSwitcher::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::current\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_current_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "menu")]
fn connect_menu_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_menu_trampoline<P: IsA<TabSwitcher>, F: Fn(&P) + 'static>(
this: *mut ffi::HeTabSwitcher,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(TabSwitcher::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::menu\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_menu_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
}
impl<O: IsA<TabSwitcher>> TabSwitcherExt for O {}