1use crate::{ffi, Bin, Tab, TabSwitcherTabBarBehavior};
7use glib::{
8 object::ObjectType as _,
9 prelude::*,
10 signal::{connect_raw, SignalHandlerId},
11 translate::*,
12};
13use std::boxed::Box as Box_;
14
15glib::wrapper! {
16 #[doc(alias = "HeTabSwitcher")]
17 pub struct TabSwitcher(Object<ffi::HeTabSwitcher, ffi::HeTabSwitcherClass>) @extends Bin, gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget;
18
19 match fn {
20 type_ => || ffi::he_tab_switcher_get_type(),
21 }
22}
23
24impl TabSwitcher {
25 pub const NONE: Option<&'static TabSwitcher> = None;
26
27 #[doc(alias = "he_tab_switcher_new")]
28 pub fn new() -> TabSwitcher {
29 assert_initialized_main_thread!();
30 unsafe { from_glib_none(ffi::he_tab_switcher_new()) }
31 }
32
33 pub fn builder() -> TabSwitcherBuilder {
38 TabSwitcherBuilder::new()
39 }
40}
41
42impl Default for TabSwitcher {
43 fn default() -> Self {
44 Self::new()
45 }
46}
47
48#[must_use = "The builder must be built to be used"]
53pub struct TabSwitcherBuilder {
54 builder: glib::object::ObjectBuilder<'static, TabSwitcher>,
55}
56
57impl TabSwitcherBuilder {
58 fn new() -> Self {
59 Self {
60 builder: glib::object::Object::builder(),
61 }
62 }
63
64 pub fn tab_bar_behavior(self, tab_bar_behavior: TabSwitcherTabBarBehavior) -> Self {
65 Self {
66 builder: self.builder.property("tab-bar-behavior", tab_bar_behavior),
67 }
68 }
69
70 pub fn allow_duplicate_tabs(self, allow_duplicate_tabs: bool) -> Self {
71 Self {
72 builder: self
73 .builder
74 .property("allow-duplicate-tabs", allow_duplicate_tabs),
75 }
76 }
77
78 pub fn allow_drag(self, allow_drag: bool) -> Self {
79 Self {
80 builder: self.builder.property("allow-drag", allow_drag),
81 }
82 }
83
84 pub fn allow_pinning(self, allow_pinning: bool) -> Self {
85 Self {
86 builder: self.builder.property("allow-pinning", allow_pinning),
87 }
88 }
89
90 pub fn allow_closing(self, allow_closing: bool) -> Self {
91 Self {
92 builder: self.builder.property("allow-closing", allow_closing),
93 }
94 }
95
96 pub fn allow_new_window(self, allow_new_window: bool) -> Self {
97 Self {
98 builder: self.builder.property("allow-new-window", allow_new_window),
99 }
100 }
101
102 pub fn current(self, current: &impl IsA<Tab>) -> Self {
103 Self {
104 builder: self.builder.property("current", current.clone().upcast()),
105 }
106 }
107
108 pub fn menu(self, menu: &gio::Menu) -> Self {
109 Self {
110 builder: self.builder.property("menu", menu.clone()),
111 }
112 }
113
114 pub fn actions(self, actions: &impl IsA<gio::SimpleActionGroup>) -> Self {
115 Self {
116 builder: self.builder.property("actions", actions.clone().upcast()),
117 }
118 }
119
120 pub fn child(self, child: &impl IsA<gtk::Widget>) -> Self {
121 Self {
122 builder: self.builder.property("child", child.clone().upcast()),
123 }
124 }
125
126 pub fn can_focus(self, can_focus: bool) -> Self {
127 Self {
128 builder: self.builder.property("can-focus", can_focus),
129 }
130 }
131
132 pub fn can_target(self, can_target: bool) -> Self {
133 Self {
134 builder: self.builder.property("can-target", can_target),
135 }
136 }
137
138 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
139 Self {
140 builder: self.builder.property("css-classes", css_classes.into()),
141 }
142 }
143
144 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
145 Self {
146 builder: self.builder.property("css-name", css_name.into()),
147 }
148 }
149
150 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
155 Self {
156 builder: self.builder.property("focus-on-click", focus_on_click),
157 }
158 }
159
160 pub fn focusable(self, focusable: bool) -> Self {
161 Self {
162 builder: self.builder.property("focusable", focusable),
163 }
164 }
165
166 pub fn halign(self, halign: gtk::Align) -> Self {
167 Self {
168 builder: self.builder.property("halign", halign),
169 }
170 }
171
172 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
173 Self {
174 builder: self.builder.property("has-tooltip", has_tooltip),
175 }
176 }
177
178 pub fn height_request(self, height_request: i32) -> Self {
179 Self {
180 builder: self.builder.property("height-request", height_request),
181 }
182 }
183
184 pub fn hexpand(self, hexpand: bool) -> Self {
185 Self {
186 builder: self.builder.property("hexpand", hexpand),
187 }
188 }
189
190 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
191 Self {
192 builder: self.builder.property("hexpand-set", hexpand_set),
193 }
194 }
195
196 #[cfg(feature = "gtk_v4_18")]
201 #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))]
202 pub fn limit_events(self, limit_events: bool) -> Self {
203 Self {
204 builder: self.builder.property("limit-events", limit_events),
205 }
206 }
207
208 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
209 Self {
210 builder: self.builder.property("margin-bottom", margin_bottom),
211 }
212 }
213
214 pub fn margin_end(self, margin_end: i32) -> Self {
215 Self {
216 builder: self.builder.property("margin-end", margin_end),
217 }
218 }
219
220 pub fn margin_start(self, margin_start: i32) -> Self {
221 Self {
222 builder: self.builder.property("margin-start", margin_start),
223 }
224 }
225
226 pub fn margin_top(self, margin_top: i32) -> Self {
227 Self {
228 builder: self.builder.property("margin-top", margin_top),
229 }
230 }
231
232 pub fn name(self, name: impl Into<glib::GString>) -> Self {
233 Self {
234 builder: self.builder.property("name", name.into()),
235 }
236 }
237
238 pub fn opacity(self, opacity: f64) -> Self {
239 Self {
240 builder: self.builder.property("opacity", opacity),
241 }
242 }
243
244 pub fn receives_default(self, receives_default: bool) -> Self {
249 Self {
250 builder: self.builder.property("receives-default", receives_default),
251 }
252 }
253
254 pub fn sensitive(self, sensitive: bool) -> Self {
255 Self {
256 builder: self.builder.property("sensitive", sensitive),
257 }
258 }
259
260 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
261 Self {
262 builder: self
263 .builder
264 .property("tooltip-markup", tooltip_markup.into()),
265 }
266 }
267
268 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
269 Self {
270 builder: self.builder.property("tooltip-text", tooltip_text.into()),
271 }
272 }
273
274 pub fn valign(self, valign: gtk::Align) -> Self {
275 Self {
276 builder: self.builder.property("valign", valign),
277 }
278 }
279
280 pub fn vexpand(self, vexpand: bool) -> Self {
281 Self {
282 builder: self.builder.property("vexpand", vexpand),
283 }
284 }
285
286 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
287 Self {
288 builder: self.builder.property("vexpand-set", vexpand_set),
289 }
290 }
291
292 pub fn visible(self, visible: bool) -> Self {
293 Self {
294 builder: self.builder.property("visible", visible),
295 }
296 }
297
298 pub fn width_request(self, width_request: i32) -> Self {
299 Self {
300 builder: self.builder.property("width-request", width_request),
301 }
302 }
303
304 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
311 pub fn build(self) -> TabSwitcher {
312 assert_initialized_main_thread!();
313 self.builder.build()
314 }
315}
316
317pub trait TabSwitcherExt: IsA<TabSwitcher> + 'static {
318 #[doc(alias = "he_tab_switcher_get_tab_position")]
319 #[doc(alias = "get_tab_position")]
320 fn tab_position(&self, tab: &impl IsA<Tab>) -> i32 {
321 unsafe {
322 ffi::he_tab_switcher_get_tab_position(
323 self.as_ref().to_glib_none().0,
324 tab.as_ref().to_glib_none().0,
325 )
326 }
327 }
328
329 #[doc(alias = "he_tab_switcher_insert_tab")]
330 fn insert_tab(&self, tab: &impl IsA<Tab>, index: i32) -> u32 {
331 unsafe {
332 ffi::he_tab_switcher_insert_tab(
333 self.as_ref().to_glib_none().0,
334 tab.as_ref().to_glib_none().0,
335 index,
336 )
337 }
338 }
339
340 #[doc(alias = "he_tab_switcher_remove_tab")]
341 fn remove_tab(&self, tab: &impl IsA<Tab>) {
342 unsafe {
343 ffi::he_tab_switcher_remove_tab(
344 self.as_ref().to_glib_none().0,
345 tab.as_ref().to_glib_none().0,
346 );
347 }
348 }
349
350 #[doc(alias = "he_tab_switcher_get_n_tabs")]
351 #[doc(alias = "get_n_tabs")]
352 fn n_tabs(&self) -> i32 {
353 unsafe { ffi::he_tab_switcher_get_n_tabs(self.as_ref().to_glib_none().0) }
354 }
355
356 #[doc(alias = "he_tab_switcher_get_tabs")]
357 #[doc(alias = "get_tabs")]
358 fn tabs(&self) -> Vec<Tab> {
359 unsafe {
360 FromGlibPtrContainer::from_glib_none(ffi::he_tab_switcher_get_tabs(
361 self.as_ref().to_glib_none().0,
362 ))
363 }
364 }
365
366 #[doc(alias = "he_tab_switcher_get_tab_bar_behavior")]
367 #[doc(alias = "get_tab_bar_behavior")]
368 fn tab_bar_behavior(&self) -> TabSwitcherTabBarBehavior {
369 unsafe {
370 from_glib(ffi::he_tab_switcher_get_tab_bar_behavior(
371 self.as_ref().to_glib_none().0,
372 ))
373 }
374 }
375
376 #[doc(alias = "he_tab_switcher_set_tab_bar_behavior")]
377 fn set_tab_bar_behavior(&self, value: TabSwitcherTabBarBehavior) {
378 unsafe {
379 ffi::he_tab_switcher_set_tab_bar_behavior(
380 self.as_ref().to_glib_none().0,
381 value.into_glib(),
382 );
383 }
384 }
385
386 #[doc(alias = "he_tab_switcher_get_allow_duplicate_tabs")]
387 #[doc(alias = "get_allow_duplicate_tabs")]
388 fn allows_duplicate_tabs(&self) -> bool {
389 unsafe {
390 from_glib(ffi::he_tab_switcher_get_allow_duplicate_tabs(
391 self.as_ref().to_glib_none().0,
392 ))
393 }
394 }
395
396 #[doc(alias = "he_tab_switcher_set_allow_duplicate_tabs")]
397 fn set_allow_duplicate_tabs(&self, value: bool) {
398 unsafe {
399 ffi::he_tab_switcher_set_allow_duplicate_tabs(
400 self.as_ref().to_glib_none().0,
401 value.into_glib(),
402 );
403 }
404 }
405
406 #[doc(alias = "he_tab_switcher_get_allow_drag")]
407 #[doc(alias = "get_allow_drag")]
408 fn allows_drag(&self) -> bool {
409 unsafe {
410 from_glib(ffi::he_tab_switcher_get_allow_drag(
411 self.as_ref().to_glib_none().0,
412 ))
413 }
414 }
415
416 #[doc(alias = "he_tab_switcher_set_allow_drag")]
417 fn set_allow_drag(&self, value: bool) {
418 unsafe {
419 ffi::he_tab_switcher_set_allow_drag(self.as_ref().to_glib_none().0, value.into_glib());
420 }
421 }
422
423 #[doc(alias = "he_tab_switcher_get_allow_pinning")]
424 #[doc(alias = "get_allow_pinning")]
425 fn allows_pinning(&self) -> bool {
426 unsafe {
427 from_glib(ffi::he_tab_switcher_get_allow_pinning(
428 self.as_ref().to_glib_none().0,
429 ))
430 }
431 }
432
433 #[doc(alias = "he_tab_switcher_set_allow_pinning")]
434 fn set_allow_pinning(&self, value: bool) {
435 unsafe {
436 ffi::he_tab_switcher_set_allow_pinning(
437 self.as_ref().to_glib_none().0,
438 value.into_glib(),
439 );
440 }
441 }
442
443 #[doc(alias = "he_tab_switcher_get_allow_closing")]
444 #[doc(alias = "get_allow_closing")]
445 fn allows_closing(&self) -> bool {
446 unsafe {
447 from_glib(ffi::he_tab_switcher_get_allow_closing(
448 self.as_ref().to_glib_none().0,
449 ))
450 }
451 }
452
453 #[doc(alias = "he_tab_switcher_set_allow_closing")]
454 fn set_allow_closing(&self, value: bool) {
455 unsafe {
456 ffi::he_tab_switcher_set_allow_closing(
457 self.as_ref().to_glib_none().0,
458 value.into_glib(),
459 );
460 }
461 }
462
463 #[doc(alias = "he_tab_switcher_get_allow_new_window")]
464 #[doc(alias = "get_allow_new_window")]
465 fn allows_new_window(&self) -> bool {
466 unsafe {
467 from_glib(ffi::he_tab_switcher_get_allow_new_window(
468 self.as_ref().to_glib_none().0,
469 ))
470 }
471 }
472
473 #[doc(alias = "he_tab_switcher_set_allow_new_window")]
474 fn set_allow_new_window(&self, value: bool) {
475 unsafe {
476 ffi::he_tab_switcher_set_allow_new_window(
477 self.as_ref().to_glib_none().0,
478 value.into_glib(),
479 );
480 }
481 }
482
483 #[doc(alias = "he_tab_switcher_get_current")]
484 #[doc(alias = "get_current")]
485 fn current(&self) -> Tab {
486 unsafe {
487 from_glib_none(ffi::he_tab_switcher_get_current(
488 self.as_ref().to_glib_none().0,
489 ))
490 }
491 }
492
493 #[doc(alias = "he_tab_switcher_set_current")]
494 fn set_current(&self, value: &impl IsA<Tab>) {
495 unsafe {
496 ffi::he_tab_switcher_set_current(
497 self.as_ref().to_glib_none().0,
498 value.as_ref().to_glib_none().0,
499 );
500 }
501 }
502
503 #[doc(alias = "he_tab_switcher_get_menu")]
504 #[doc(alias = "get_menu")]
505 fn menu(&self) -> gio::Menu {
506 unsafe {
507 from_glib_none(ffi::he_tab_switcher_get_menu(
508 self.as_ref().to_glib_none().0,
509 ))
510 }
511 }
512
513 #[doc(alias = "he_tab_switcher_get_actions")]
514 #[doc(alias = "get_actions")]
515 fn actions(&self) -> gio::SimpleActionGroup {
516 unsafe {
517 from_glib_none(ffi::he_tab_switcher_get_actions(
518 self.as_ref().to_glib_none().0,
519 ))
520 }
521 }
522
523 fn set_menu(&self, menu: Option<&gio::Menu>) {
524 ObjectExt::set_property(self.as_ref(), "menu", menu)
525 }
526
527 #[doc(alias = "tab-added")]
528 fn connect_tab_added<F: Fn(&Self, &Tab) + 'static>(&self, f: F) -> SignalHandlerId {
529 unsafe extern "C" fn tab_added_trampoline<
530 P: IsA<TabSwitcher>,
531 F: Fn(&P, &Tab) + 'static,
532 >(
533 this: *mut ffi::HeTabSwitcher,
534 tab: *mut ffi::HeTab,
535 f: glib::ffi::gpointer,
536 ) {
537 let f: &F = &*(f as *const F);
538 f(
539 TabSwitcher::from_glib_borrow(this).unsafe_cast_ref(),
540 &from_glib_borrow(tab),
541 )
542 }
543 unsafe {
544 let f: Box_<F> = Box_::new(f);
545 connect_raw(
546 self.as_ptr() as *mut _,
547 c"tab-added".as_ptr() as *const _,
548 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
549 tab_added_trampoline::<Self, F> as *const (),
550 )),
551 Box_::into_raw(f),
552 )
553 }
554 }
555
556 #[doc(alias = "tab-removed")]
557 fn connect_tab_removed<F: Fn(&Self, &Tab) + 'static>(&self, f: F) -> SignalHandlerId {
558 unsafe extern "C" fn tab_removed_trampoline<
559 P: IsA<TabSwitcher>,
560 F: Fn(&P, &Tab) + 'static,
561 >(
562 this: *mut ffi::HeTabSwitcher,
563 tab: *mut ffi::HeTab,
564 f: glib::ffi::gpointer,
565 ) {
566 let f: &F = &*(f as *const F);
567 f(
568 TabSwitcher::from_glib_borrow(this).unsafe_cast_ref(),
569 &from_glib_borrow(tab),
570 )
571 }
572 unsafe {
573 let f: Box_<F> = Box_::new(f);
574 connect_raw(
575 self.as_ptr() as *mut _,
576 c"tab-removed".as_ptr() as *const _,
577 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
578 tab_removed_trampoline::<Self, F> as *const (),
579 )),
580 Box_::into_raw(f),
581 )
582 }
583 }
584
585 #[doc(alias = "tab-switched")]
586 fn connect_tab_switched<F: Fn(&Self, Option<&Tab>, &Tab) + 'static>(
587 &self,
588 f: F,
589 ) -> SignalHandlerId {
590 unsafe extern "C" fn tab_switched_trampoline<
591 P: IsA<TabSwitcher>,
592 F: Fn(&P, Option<&Tab>, &Tab) + 'static,
593 >(
594 this: *mut ffi::HeTabSwitcher,
595 old_tab: *mut ffi::HeTab,
596 new_tab: *mut ffi::HeTab,
597 f: glib::ffi::gpointer,
598 ) {
599 let f: &F = &*(f as *const F);
600 f(
601 TabSwitcher::from_glib_borrow(this).unsafe_cast_ref(),
602 Option::<Tab>::from_glib_borrow(old_tab).as_ref().as_ref(),
603 &from_glib_borrow(new_tab),
604 )
605 }
606 unsafe {
607 let f: Box_<F> = Box_::new(f);
608 connect_raw(
609 self.as_ptr() as *mut _,
610 c"tab-switched".as_ptr() as *const _,
611 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
612 tab_switched_trampoline::<Self, F> as *const (),
613 )),
614 Box_::into_raw(f),
615 )
616 }
617 }
618
619 #[doc(alias = "tab-moved")]
620 fn connect_tab_moved<F: Fn(&Self, &Tab) + 'static>(&self, f: F) -> SignalHandlerId {
621 unsafe extern "C" fn tab_moved_trampoline<
622 P: IsA<TabSwitcher>,
623 F: Fn(&P, &Tab) + 'static,
624 >(
625 this: *mut ffi::HeTabSwitcher,
626 tab: *mut ffi::HeTab,
627 f: glib::ffi::gpointer,
628 ) {
629 let f: &F = &*(f as *const F);
630 f(
631 TabSwitcher::from_glib_borrow(this).unsafe_cast_ref(),
632 &from_glib_borrow(tab),
633 )
634 }
635 unsafe {
636 let f: Box_<F> = Box_::new(f);
637 connect_raw(
638 self.as_ptr() as *mut _,
639 c"tab-moved".as_ptr() as *const _,
640 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
641 tab_moved_trampoline::<Self, F> as *const (),
642 )),
643 Box_::into_raw(f),
644 )
645 }
646 }
647
648 #[doc(alias = "tab-duplicated")]
649 fn connect_tab_duplicated<F: Fn(&Self, &Tab) + 'static>(&self, f: F) -> SignalHandlerId {
650 unsafe extern "C" fn tab_duplicated_trampoline<
651 P: IsA<TabSwitcher>,
652 F: Fn(&P, &Tab) + 'static,
653 >(
654 this: *mut ffi::HeTabSwitcher,
655 duplicated_tab: *mut ffi::HeTab,
656 f: glib::ffi::gpointer,
657 ) {
658 let f: &F = &*(f as *const F);
659 f(
660 TabSwitcher::from_glib_borrow(this).unsafe_cast_ref(),
661 &from_glib_borrow(duplicated_tab),
662 )
663 }
664 unsafe {
665 let f: Box_<F> = Box_::new(f);
666 connect_raw(
667 self.as_ptr() as *mut _,
668 c"tab-duplicated".as_ptr() as *const _,
669 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
670 tab_duplicated_trampoline::<Self, F> as *const (),
671 )),
672 Box_::into_raw(f),
673 )
674 }
675 }
676
677 #[doc(alias = "new-tab-requested")]
678 fn connect_new_tab_requested<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
679 unsafe extern "C" fn new_tab_requested_trampoline<
680 P: IsA<TabSwitcher>,
681 F: Fn(&P) + 'static,
682 >(
683 this: *mut ffi::HeTabSwitcher,
684 f: glib::ffi::gpointer,
685 ) {
686 let f: &F = &*(f as *const F);
687 f(TabSwitcher::from_glib_borrow(this).unsafe_cast_ref())
688 }
689 unsafe {
690 let f: Box_<F> = Box_::new(f);
691 connect_raw(
692 self.as_ptr() as *mut _,
693 c"new-tab-requested".as_ptr() as *const _,
694 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
695 new_tab_requested_trampoline::<Self, F> as *const (),
696 )),
697 Box_::into_raw(f),
698 )
699 }
700 }
701
702 #[doc(alias = "close-tab-requested")]
703 fn connect_close_tab_requested<F: Fn(&Self, &Tab) -> bool + 'static>(
704 &self,
705 f: F,
706 ) -> SignalHandlerId {
707 unsafe extern "C" fn close_tab_requested_trampoline<
708 P: IsA<TabSwitcher>,
709 F: Fn(&P, &Tab) -> bool + 'static,
710 >(
711 this: *mut ffi::HeTabSwitcher,
712 tab: *mut ffi::HeTab,
713 f: glib::ffi::gpointer,
714 ) -> glib::ffi::gboolean {
715 let f: &F = &*(f as *const F);
716 f(
717 TabSwitcher::from_glib_borrow(this).unsafe_cast_ref(),
718 &from_glib_borrow(tab),
719 )
720 .into_glib()
721 }
722 unsafe {
723 let f: Box_<F> = Box_::new(f);
724 connect_raw(
725 self.as_ptr() as *mut _,
726 c"close-tab-requested".as_ptr() as *const _,
727 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
728 close_tab_requested_trampoline::<Self, F> as *const (),
729 )),
730 Box_::into_raw(f),
731 )
732 }
733 }
734
735 #[doc(alias = "n-tabs")]
736 fn connect_n_tabs_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
737 unsafe extern "C" fn notify_n_tabs_trampoline<P: IsA<TabSwitcher>, F: Fn(&P) + 'static>(
738 this: *mut ffi::HeTabSwitcher,
739 _param_spec: glib::ffi::gpointer,
740 f: glib::ffi::gpointer,
741 ) {
742 let f: &F = &*(f as *const F);
743 f(TabSwitcher::from_glib_borrow(this).unsafe_cast_ref())
744 }
745 unsafe {
746 let f: Box_<F> = Box_::new(f);
747 connect_raw(
748 self.as_ptr() as *mut _,
749 c"notify::n-tabs".as_ptr() as *const _,
750 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
751 notify_n_tabs_trampoline::<Self, F> as *const (),
752 )),
753 Box_::into_raw(f),
754 )
755 }
756 }
757
758 #[doc(alias = "tabs")]
759 fn connect_tabs_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
760 unsafe extern "C" fn notify_tabs_trampoline<P: IsA<TabSwitcher>, F: Fn(&P) + 'static>(
761 this: *mut ffi::HeTabSwitcher,
762 _param_spec: glib::ffi::gpointer,
763 f: glib::ffi::gpointer,
764 ) {
765 let f: &F = &*(f as *const F);
766 f(TabSwitcher::from_glib_borrow(this).unsafe_cast_ref())
767 }
768 unsafe {
769 let f: Box_<F> = Box_::new(f);
770 connect_raw(
771 self.as_ptr() as *mut _,
772 c"notify::tabs".as_ptr() as *const _,
773 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
774 notify_tabs_trampoline::<Self, F> as *const (),
775 )),
776 Box_::into_raw(f),
777 )
778 }
779 }
780
781 #[doc(alias = "tab-bar-behavior")]
782 fn connect_tab_bar_behavior_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
783 unsafe extern "C" fn notify_tab_bar_behavior_trampoline<
784 P: IsA<TabSwitcher>,
785 F: Fn(&P) + 'static,
786 >(
787 this: *mut ffi::HeTabSwitcher,
788 _param_spec: glib::ffi::gpointer,
789 f: glib::ffi::gpointer,
790 ) {
791 let f: &F = &*(f as *const F);
792 f(TabSwitcher::from_glib_borrow(this).unsafe_cast_ref())
793 }
794 unsafe {
795 let f: Box_<F> = Box_::new(f);
796 connect_raw(
797 self.as_ptr() as *mut _,
798 c"notify::tab-bar-behavior".as_ptr() as *const _,
799 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
800 notify_tab_bar_behavior_trampoline::<Self, F> as *const (),
801 )),
802 Box_::into_raw(f),
803 )
804 }
805 }
806
807 #[doc(alias = "allow-duplicate-tabs")]
808 fn connect_allow_duplicate_tabs_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
809 unsafe extern "C" fn notify_allow_duplicate_tabs_trampoline<
810 P: IsA<TabSwitcher>,
811 F: Fn(&P) + 'static,
812 >(
813 this: *mut ffi::HeTabSwitcher,
814 _param_spec: glib::ffi::gpointer,
815 f: glib::ffi::gpointer,
816 ) {
817 let f: &F = &*(f as *const F);
818 f(TabSwitcher::from_glib_borrow(this).unsafe_cast_ref())
819 }
820 unsafe {
821 let f: Box_<F> = Box_::new(f);
822 connect_raw(
823 self.as_ptr() as *mut _,
824 c"notify::allow-duplicate-tabs".as_ptr() as *const _,
825 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
826 notify_allow_duplicate_tabs_trampoline::<Self, F> as *const (),
827 )),
828 Box_::into_raw(f),
829 )
830 }
831 }
832
833 #[doc(alias = "allow-drag")]
834 fn connect_allow_drag_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
835 unsafe extern "C" fn notify_allow_drag_trampoline<
836 P: IsA<TabSwitcher>,
837 F: Fn(&P) + 'static,
838 >(
839 this: *mut ffi::HeTabSwitcher,
840 _param_spec: glib::ffi::gpointer,
841 f: glib::ffi::gpointer,
842 ) {
843 let f: &F = &*(f as *const F);
844 f(TabSwitcher::from_glib_borrow(this).unsafe_cast_ref())
845 }
846 unsafe {
847 let f: Box_<F> = Box_::new(f);
848 connect_raw(
849 self.as_ptr() as *mut _,
850 c"notify::allow-drag".as_ptr() as *const _,
851 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
852 notify_allow_drag_trampoline::<Self, F> as *const (),
853 )),
854 Box_::into_raw(f),
855 )
856 }
857 }
858
859 #[doc(alias = "allow-pinning")]
860 fn connect_allow_pinning_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
861 unsafe extern "C" fn notify_allow_pinning_trampoline<
862 P: IsA<TabSwitcher>,
863 F: Fn(&P) + 'static,
864 >(
865 this: *mut ffi::HeTabSwitcher,
866 _param_spec: glib::ffi::gpointer,
867 f: glib::ffi::gpointer,
868 ) {
869 let f: &F = &*(f as *const F);
870 f(TabSwitcher::from_glib_borrow(this).unsafe_cast_ref())
871 }
872 unsafe {
873 let f: Box_<F> = Box_::new(f);
874 connect_raw(
875 self.as_ptr() as *mut _,
876 c"notify::allow-pinning".as_ptr() as *const _,
877 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
878 notify_allow_pinning_trampoline::<Self, F> as *const (),
879 )),
880 Box_::into_raw(f),
881 )
882 }
883 }
884
885 #[doc(alias = "allow-closing")]
886 fn connect_allow_closing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
887 unsafe extern "C" fn notify_allow_closing_trampoline<
888 P: IsA<TabSwitcher>,
889 F: Fn(&P) + 'static,
890 >(
891 this: *mut ffi::HeTabSwitcher,
892 _param_spec: glib::ffi::gpointer,
893 f: glib::ffi::gpointer,
894 ) {
895 let f: &F = &*(f as *const F);
896 f(TabSwitcher::from_glib_borrow(this).unsafe_cast_ref())
897 }
898 unsafe {
899 let f: Box_<F> = Box_::new(f);
900 connect_raw(
901 self.as_ptr() as *mut _,
902 c"notify::allow-closing".as_ptr() as *const _,
903 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
904 notify_allow_closing_trampoline::<Self, F> as *const (),
905 )),
906 Box_::into_raw(f),
907 )
908 }
909 }
910
911 #[doc(alias = "allow-new-window")]
912 fn connect_allow_new_window_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
913 unsafe extern "C" fn notify_allow_new_window_trampoline<
914 P: IsA<TabSwitcher>,
915 F: Fn(&P) + 'static,
916 >(
917 this: *mut ffi::HeTabSwitcher,
918 _param_spec: glib::ffi::gpointer,
919 f: glib::ffi::gpointer,
920 ) {
921 let f: &F = &*(f as *const F);
922 f(TabSwitcher::from_glib_borrow(this).unsafe_cast_ref())
923 }
924 unsafe {
925 let f: Box_<F> = Box_::new(f);
926 connect_raw(
927 self.as_ptr() as *mut _,
928 c"notify::allow-new-window".as_ptr() as *const _,
929 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
930 notify_allow_new_window_trampoline::<Self, F> as *const (),
931 )),
932 Box_::into_raw(f),
933 )
934 }
935 }
936
937 #[doc(alias = "current")]
938 fn connect_current_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
939 unsafe extern "C" fn notify_current_trampoline<P: IsA<TabSwitcher>, F: Fn(&P) + 'static>(
940 this: *mut ffi::HeTabSwitcher,
941 _param_spec: glib::ffi::gpointer,
942 f: glib::ffi::gpointer,
943 ) {
944 let f: &F = &*(f as *const F);
945 f(TabSwitcher::from_glib_borrow(this).unsafe_cast_ref())
946 }
947 unsafe {
948 let f: Box_<F> = Box_::new(f);
949 connect_raw(
950 self.as_ptr() as *mut _,
951 c"notify::current".as_ptr() as *const _,
952 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
953 notify_current_trampoline::<Self, F> as *const (),
954 )),
955 Box_::into_raw(f),
956 )
957 }
958 }
959
960 #[doc(alias = "menu")]
961 fn connect_menu_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
962 unsafe extern "C" fn notify_menu_trampoline<P: IsA<TabSwitcher>, F: Fn(&P) + 'static>(
963 this: *mut ffi::HeTabSwitcher,
964 _param_spec: glib::ffi::gpointer,
965 f: glib::ffi::gpointer,
966 ) {
967 let f: &F = &*(f as *const F);
968 f(TabSwitcher::from_glib_borrow(this).unsafe_cast_ref())
969 }
970 unsafe {
971 let f: Box_<F> = Box_::new(f);
972 connect_raw(
973 self.as_ptr() as *mut _,
974 c"notify::menu".as_ptr() as *const _,
975 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
976 notify_menu_trampoline::<Self, F> as *const (),
977 )),
978 Box_::into_raw(f),
979 )
980 }
981 }
982}
983
984impl<O: IsA<TabSwitcher>> TabSwitcherExt for O {}