1use crate::IndicatorCategory;
6use crate::IndicatorStatus;
7use gdk::cairo::ffi::FORMAT_A_RGB32;
8use glib::object::Cast;
9use glib::object::IsA;
10use glib::signal::connect_raw;
11use glib::signal::SignalHandlerId;
12use glib::translate::*;
13use glib::StaticType;
14use glib::ToValue;
15use std::boxed::Box as Box_;
16use std::fmt;
17use std::mem::transmute;
18
19glib::wrapper! {
20 #[doc(alias = "AppIndicator")]
21pub struct Indicator(Object<ffi::AppIndicator, ffi::AppIndicatorClass>);
33
34 match fn {
35 type_ => || ffi::app_indicator_get_type(),
36 }
37}
38
39impl Indicator {
40 pub const NONE: Option<&'static Indicator> = None;
41
42
43 #[doc(alias = "app_indicator_new")]
57 pub fn new(id: &str, icon_name: &str, category: IndicatorCategory) -> Indicator {
58 unsafe {
59 from_glib_full(ffi::app_indicator_new(id.to_glib_none().0, icon_name.to_glib_none().0, category.into_glib()))
60 }
61 }
62
63 #[doc(alias = "app_indicator_new_with_path")]
80 #[doc(alias = "new_with_path")]
81 pub fn with_path(id: &str, icon_name: &str, category: IndicatorCategory, icon_theme_path: &str) -> Indicator {
82 unsafe {
83 from_glib_full(ffi::app_indicator_new_with_path(id.to_glib_none().0, icon_name.to_glib_none().0, category.into_glib(), icon_theme_path.to_glib_none().0))
84 }
85 }
86}
87
88pub trait AppIndicatorExt: 'static {
94 #[doc(alias = "app_indicator_build_menu_from_desktop")]
101 fn build_menu_from_desktop(&self, desktop_file: &str, desktop_profile: &str);
102
103 #[doc(alias = "app_indicator_get_attention_icon")]
109 #[doc(alias = "get_attention_icon")]
110 fn attention_icon(&self) -> Option<glib::GString>;
111
112 #[doc(alias = "app_indicator_get_attention_icon_desc")]
118 #[doc(alias = "get_attention_icon_desc")]
119 fn attention_icon_desc(&self) -> Option<glib::GString>;
120
121 #[doc(alias = "app_indicator_get_category")]
127 #[doc(alias = "get_category")]
128 fn category(&self) -> IndicatorCategory;
129
130 #[doc(alias = "app_indicator_get_icon")]
136 #[doc(alias = "get_icon")]
137 fn icon(&self) -> Option<glib::GString>;
138
139 #[doc(alias = "app_indicator_get_icon_desc")]
145 #[doc(alias = "get_icon_desc")]
146 fn icon_desc(&self) -> Option<glib::GString>;
147
148 #[doc(alias = "app_indicator_get_icon_theme_path")]
154 #[doc(alias = "get_icon_theme_path")]
155 fn icon_theme_path(&self) -> Option<glib::GString>;
156
157 #[doc(alias = "app_indicator_get_id")]
163 #[doc(alias = "get_id")]
164 fn id(&self) -> Option<glib::GString>;
165
166 #[doc(alias = "app_indicator_get_label")]
172 #[doc(alias = "get_label")]
173 fn label(&self) -> Option<glib::GString>;
174
175 #[doc(alias = "app_indicator_get_label_guide")]
181 #[doc(alias = "get_label_guide")]
182 fn label_guide(&self) -> Option<glib::GString>;
183
184 #[doc(alias = "app_indicator_get_menu")]
191 #[doc(alias = "get_menu")]
192 fn menu(&self) -> Option<gtk::Menu>;
193
194 #[doc(alias = "app_indicator_get_ordering_index")]
200 #[doc(alias = "get_ordering_index")]
201 fn ordering_index(&self) -> u32;
202
203 #[doc(alias = "app_indicator_get_secondary_activate_target")]
209 #[doc(alias = "get_secondary_activate_target")]
210 fn secondary_activate_target(&self) -> Option<gtk::Widget>;
211
212 #[doc(alias = "app_indicator_get_status")]
218 #[doc(alias = "get_status")]
219 fn status(&self) -> IndicatorStatus;
220
221 #[cfg(any(feature = "v0_5", feature = "dox"))]
228 #[cfg_attr(feature = "dox", doc(cfg(feature = "v0_5")))]
229 #[doc(alias = "app_indicator_get_title")]
230 #[doc(alias = "get_title")]
231 fn title(&self) -> Option<glib::GString>;
232
233 #[doc(alias = "app_indicator_set_attention_icon")]
242 fn set_attention_icon(&self, icon_name: &str);
243
244 #[doc(alias = "app_indicator_set_attention_icon_full")]
250 fn set_attention_icon_full(&self, icon_name: &str, icon_desc: &str);
251
252 #[doc(alias = "app_indicator_set_icon")]
261 fn set_icon(&self, icon_name: &str);
262
263 #[doc(alias = "app_indicator_set_icon_full")]
274 fn set_icon_full(&self, icon_name: &str, icon_desc: &str);
275
276 #[doc(alias = "app_indicator_set_icon_theme_path")]
280 fn set_icon_theme_path(&self, icon_theme_path: &str);
281
282 #[doc(alias = "app_indicator_set_label")]
290 fn set_label(&self, label: &str, guide: &str);
291
292 #[doc(alias = "app_indicator_set_menu")]
300 fn set_menu(&self, menu: Option<&impl IsA<gtk::Menu>>);
301
302 #[doc(alias = "app_indicator_set_ordering_index")]
310 fn set_ordering_index(&self, ordering_index: u32);
311
312 #[doc(alias = "app_indicator_set_secondary_activate_target")]
323 fn set_secondary_activate_target(&self, menuitem: Option<&impl IsA<gtk::Widget>>);
324
325 #[doc(alias = "app_indicator_set_status")]
329 fn set_status(&self, status: IndicatorStatus);
330
331 #[cfg(any(feature = "v0_5", feature = "dox"))]
343 #[cfg_attr(feature = "dox", doc(cfg(feature = "v0_5")))]
344 #[doc(alias = "app_indicator_set_title")]
345 fn set_title(&self, title: Option<&str>);
346
347 #[doc(alias = "attention-icon-desc")]
350 fn set_attention_icon_desc(&self, attention_icon_desc: Option<&str>);
351
352 #[doc(alias = "attention-icon-name")]
355 fn attention_icon_name(&self) -> Option<glib::GString>;
356
357 #[doc(alias = "attention-icon-name")]
360 fn set_attention_icon_name(&self, attention_icon_name: Option<&str>);
361
362 fn is_connected(&self) -> bool;
365
366 #[doc(alias = "icon-desc")]
368 fn set_icon_desc(&self, icon_desc: Option<&str>);
369
370 #[doc(alias = "icon-name")]
372 fn icon_name(&self) -> Option<glib::GString>;
373
374 #[doc(alias = "icon-name")]
376 fn set_icon_name(&self, icon_name: Option<&str>);
377
378 #[doc(alias = "label-guide")]
386 fn set_label_guide(&self, label_guide: Option<&str>);
387
388 fn get_property_title(&self) -> Option<glib::GString>;
393
394 fn set_property_title(&self, title: Option<&str>);
399
400 #[doc(alias = "connection-changed")]
404 fn connect_connection_changed<F: Fn(&Self, bool) + 'static>(&self, f: F) -> SignalHandlerId;
405
406 #[doc(alias = "new-attention-icon")]
408 fn connect_new_attention_icon<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
409
410 #[doc(alias = "new-icon")]
412 fn connect_new_icon<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
413
414 #[doc(alias = "new-icon-theme-path")]
417 fn connect_new_icon_theme_path<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId;
418
419 #[doc(alias = "new-label")]
422 fn connect_new_label<F: Fn(&Self, &str, &str) + 'static>(&self, f: F) -> SignalHandlerId;
423
424 #[doc(alias = "new-status")]
428 fn connect_new_status<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId;
429
430 #[doc(alias = "scroll-event")]
436 fn connect_scroll_event<F: Fn(&Self, i32, gdk::ScrollDirection) + 'static>(&self, f: F) -> SignalHandlerId;
437
438 #[doc(alias = "attention-icon-desc")]
439 fn connect_attention_icon_desc_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
440
441 #[doc(alias = "attention-icon-name")]
442 fn connect_attention_icon_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
443
444 #[doc(alias = "connected")]
445 fn connect_connected_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
446
447 #[doc(alias = "icon-desc")]
448 fn connect_icon_desc_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
449
450 #[doc(alias = "icon-name")]
451 fn connect_icon_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
452
453 #[doc(alias = "icon-theme-path")]
454 fn connect_icon_theme_path_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
455
456 #[doc(alias = "label")]
457 fn connect_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
458
459 #[doc(alias = "label-guide")]
460 fn connect_label_guide_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
461
462 #[doc(alias = "ordering-index")]
463 fn connect_ordering_index_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
464
465 #[doc(alias = "status")]
466 fn connect_status_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
467
468 #[doc(alias = "title")]
469 fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
470}
471
472impl<O: IsA<Indicator>> AppIndicatorExt for O {
473 fn build_menu_from_desktop(&self, desktop_file: &str, desktop_profile: &str) {
474 unsafe {
475 ffi::app_indicator_build_menu_from_desktop(self.as_ref().to_glib_none().0, desktop_file.to_glib_none().0, desktop_profile.to_glib_none().0);
476 }
477 }
478
479 fn attention_icon(&self) -> Option<glib::GString> {
480 unsafe {
481 from_glib_none(ffi::app_indicator_get_attention_icon(self.as_ref().to_glib_none().0))
482 }
483 }
484
485 fn attention_icon_desc(&self) -> Option<glib::GString> {
486 unsafe {
487 from_glib_none(ffi::app_indicator_get_attention_icon_desc(self.as_ref().to_glib_none().0))
488 }
489 }
490
491 fn category(&self) -> IndicatorCategory {
492 unsafe {
493 from_glib(ffi::app_indicator_get_category(self.as_ref().to_glib_none().0))
494 }
495 }
496
497 fn icon(&self) -> Option<glib::GString> {
498 unsafe {
499 from_glib_none(ffi::app_indicator_get_icon(self.as_ref().to_glib_none().0))
500 }
501 }
502
503 fn icon_desc(&self) -> Option<glib::GString> {
504 unsafe {
505 from_glib_none(ffi::app_indicator_get_icon_desc(self.as_ref().to_glib_none().0))
506 }
507 }
508
509 fn icon_theme_path(&self) -> Option<glib::GString> {
510 unsafe {
511 from_glib_none(ffi::app_indicator_get_icon_theme_path(self.as_ref().to_glib_none().0))
512 }
513 }
514
515 fn id(&self) -> Option<glib::GString> {
516 unsafe {
517 from_glib_none(ffi::app_indicator_get_id(self.as_ref().to_glib_none().0))
518 }
519 }
520
521 fn label(&self) -> Option<glib::GString> {
522 unsafe {
523 from_glib_none(ffi::app_indicator_get_label(self.as_ref().to_glib_none().0))
524 }
525 }
526
527 fn label_guide(&self) -> Option<glib::GString> {
528 unsafe {
529 from_glib_none(ffi::app_indicator_get_label_guide(self.as_ref().to_glib_none().0))
530 }
531 }
532
533 fn menu(&self) -> Option<gtk::Menu> {
534 unsafe {
535 from_glib_none(ffi::app_indicator_get_menu(self.as_ref().to_glib_none().0))
536 }
537 }
538
539 fn ordering_index(&self) -> u32 {
540 unsafe {
541 ffi::app_indicator_get_ordering_index(self.as_ref().to_glib_none().0)
542 }
543 }
544
545 fn secondary_activate_target(&self) -> Option<gtk::Widget> {
546 unsafe {
547 from_glib_none(ffi::app_indicator_get_secondary_activate_target(self.as_ref().to_glib_none().0))
548 }
549 }
550
551 fn status(&self) -> IndicatorStatus {
552 unsafe {
553 from_glib(ffi::app_indicator_get_status(self.as_ref().to_glib_none().0))
554 }
555 }
556
557 #[cfg(any(feature = "v0_5", feature = "dox"))]
558 #[cfg_attr(feature = "dox", doc(cfg(feature = "v0_5")))]
559 fn title(&self) -> Option<glib::GString> {
560 unsafe {
561 from_glib_none(ffi::app_indicator_get_title(self.as_ref().to_glib_none().0))
562 }
563 }
564
565 fn set_attention_icon(&self, icon_name: &str) {
566 unsafe {
567 ffi::app_indicator_set_attention_icon(self.as_ref().to_glib_none().0, icon_name.to_glib_none().0);
568 }
569 }
570
571 fn set_attention_icon_full(&self, icon_name: &str, icon_desc: &str) {
572 unsafe {
573 ffi::app_indicator_set_attention_icon_full(self.as_ref().to_glib_none().0, icon_name.to_glib_none().0, icon_desc.to_glib_none().0);
574 }
575 }
576
577 fn set_icon(&self, icon_name: &str) {
578 unsafe {
579 ffi::app_indicator_set_icon(self.as_ref().to_glib_none().0, icon_name.to_glib_none().0);
580 }
581 }
582
583 fn set_icon_full(&self, icon_name: &str, icon_desc: &str) {
584 unsafe {
585 ffi::app_indicator_set_icon_full(self.as_ref().to_glib_none().0, icon_name.to_glib_none().0, icon_desc.to_glib_none().0);
586 }
587 }
588
589 fn set_icon_theme_path(&self, icon_theme_path: &str) {
590 unsafe {
591 ffi::app_indicator_set_icon_theme_path(self.as_ref().to_glib_none().0, icon_theme_path.to_glib_none().0);
592 }
593 }
594
595 fn set_label(&self, label: &str, guide: &str) {
596 unsafe {
597 ffi::app_indicator_set_label(self.as_ref().to_glib_none().0, label.to_glib_none().0, guide.to_glib_none().0);
598 }
599 }
600
601 fn set_menu(&self, menu: Option<&impl IsA<gtk::Menu>>) {
602 unsafe {
603 ffi::app_indicator_set_menu(self.as_ref().to_glib_none().0, menu.map(|p| p.as_ref()).to_glib_none().0);
604 }
605 }
606
607 fn set_ordering_index(&self, ordering_index: u32) {
608 unsafe {
609 ffi::app_indicator_set_ordering_index(self.as_ref().to_glib_none().0, ordering_index);
610 }
611 }
612
613 fn set_secondary_activate_target(&self, menuitem: Option<&impl IsA<gtk::Widget>>) {
614 unsafe {
615 ffi::app_indicator_set_secondary_activate_target(self.as_ref().to_glib_none().0, menuitem.map(|p| p.as_ref()).to_glib_none().0);
616 }
617 }
618
619 fn set_status(&self, status: IndicatorStatus) {
620 unsafe {
621 ffi::app_indicator_set_status(self.as_ref().to_glib_none().0, status.into_glib());
622 }
623 }
624
625 #[cfg(any(feature = "v0_5", feature = "dox"))]
626 #[cfg_attr(feature = "dox", doc(cfg(feature = "v0_5")))]
627 fn set_title(&self, title: Option<&str>) {
628 unsafe {
629 ffi::app_indicator_set_title(self.as_ref().to_glib_none().0, title.to_glib_none().0);
630 }
631 }
632
633 fn set_attention_icon_desc(&self, attention_icon_desc: Option<&str>) {
634 glib::ObjectExt::set_property(self.as_ref(),"attention-icon-desc", &attention_icon_desc)
635 }
636
637 fn attention_icon_name(&self) -> Option<glib::GString> {
638 glib::ObjectExt::property(self.as_ref(), "attention-icon-name")
639 }
640
641 fn set_attention_icon_name(&self, attention_icon_name: Option<&str>) {
642 glib::ObjectExt::set_property(self.as_ref(),"attention-icon-name", &attention_icon_name)
643 }
644
645 fn is_connected(&self) -> bool {
646 glib::ObjectExt::property(self.as_ref(), "connected")
647 }
648
649 fn set_icon_desc(&self, icon_desc: Option<&str>) {
650 glib::ObjectExt::set_property(self.as_ref(),"icon-desc", &icon_desc)
651 }
652
653 fn icon_name(&self) -> Option<glib::GString> {
654 glib::ObjectExt::property(self.as_ref(), "icon-name")
655 }
656
657 fn set_icon_name(&self, icon_name: Option<&str>) {
658 glib::ObjectExt::set_property(self.as_ref(),"icon-name", &icon_name)
659 }
660
661 fn set_label_guide(&self, label_guide: Option<&str>) {
662 glib::ObjectExt::set_property(self.as_ref(),"label-guide", &label_guide)
663 }
664
665 fn get_property_title(&self) -> Option<glib::GString> {
666 glib::ObjectExt::property(self.as_ref(), "title")
667 }
668
669 fn set_property_title(&self, title: Option<&str>) {
670 glib::ObjectExt::set_property(self.as_ref(),"title", &title)
671 }
672
673 fn connect_connection_changed<F: Fn(&Self, bool) + 'static>(&self, f: F) -> SignalHandlerId {
674 unsafe extern "C" fn connection_changed_trampoline<P: IsA<Indicator>, F: Fn(&P, bool) + 'static>(this: *mut ffi::AppIndicator, arg1: glib::ffi::gboolean, f: glib::ffi::gpointer) {
675 let f: &F = &*(f as *const F);
676 f(Indicator::from_glib_borrow(this).unsafe_cast_ref(), from_glib(arg1))
677 }
678 unsafe {
679 let f: Box_<F> = Box_::new(f);
680 connect_raw(self.as_ptr() as *mut _, b"connection-changed\0".as_ptr() as *const _,
681 Some(transmute::<_, unsafe extern "C" fn()>(connection_changed_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
682 }
683 }
684
685 fn connect_new_attention_icon<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
686 unsafe extern "C" fn new_attention_icon_trampoline<P: IsA<Indicator>, F: Fn(&P) + 'static>(this: *mut ffi::AppIndicator, f: glib::ffi::gpointer) {
687 let f: &F = &*(f as *const F);
688 f(Indicator::from_glib_borrow(this).unsafe_cast_ref())
689 }
690 unsafe {
691 let f: Box_<F> = Box_::new(f);
692 connect_raw(self.as_ptr() as *mut _, b"new-attention-icon\0".as_ptr() as *const _,
693 Some(transmute::<_, unsafe extern "C" fn()>(new_attention_icon_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
694 }
695 }
696
697 fn connect_new_icon<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
698 unsafe extern "C" fn new_icon_trampoline<P: IsA<Indicator>, F: Fn(&P) + 'static>(this: *mut ffi::AppIndicator, f: glib::ffi::gpointer) {
699 let f: &F = &*(f as *const F);
700 f(Indicator::from_glib_borrow(this).unsafe_cast_ref())
701 }
702 unsafe {
703 let f: Box_<F> = Box_::new(f);
704 connect_raw(self.as_ptr() as *mut _, b"new-icon\0".as_ptr() as *const _,
705 Some(transmute::<_, unsafe extern "C" fn()>(new_icon_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
706 }
707 }
708
709 fn connect_new_icon_theme_path<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId {
710 unsafe extern "C" fn new_icon_theme_path_trampoline<P: IsA<Indicator>, F: Fn(&P, &str) + 'static>(this: *mut ffi::AppIndicator, object: *mut libc::c_char, f: glib::ffi::gpointer) {
711 let f: &F = &*(f as *const F);
712 f(Indicator::from_glib_borrow(this).unsafe_cast_ref(), &glib::GString::from_glib_borrow(object))
713 }
714 unsafe {
715 let f: Box_<F> = Box_::new(f);
716 connect_raw(self.as_ptr() as *mut _, b"new-icon-theme-path\0".as_ptr() as *const _,
717 Some(transmute::<_, unsafe extern "C" fn()>(new_icon_theme_path_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
718 }
719 }
720
721 fn connect_new_label<F: Fn(&Self, &str, &str) + 'static>(&self, f: F) -> SignalHandlerId {
722 unsafe extern "C" fn new_label_trampoline<P: IsA<Indicator>, F: Fn(&P, &str, &str) + 'static>(this: *mut ffi::AppIndicator, object: *mut libc::c_char, p0: *mut libc::c_char, f: glib::ffi::gpointer) {
723 let f: &F = &*(f as *const F);
724 f(Indicator::from_glib_borrow(this).unsafe_cast_ref(), &glib::GString::from_glib_borrow(object), &glib::GString::from_glib_borrow(p0))
725 }
726 unsafe {
727 let f: Box_<F> = Box_::new(f);
728 connect_raw(self.as_ptr() as *mut _, b"new-label\0".as_ptr() as *const _,
729 Some(transmute::<_, unsafe extern "C" fn()>(new_label_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
730 }
731 }
732
733 fn connect_new_status<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId {
734 unsafe extern "C" fn new_status_trampoline<P: IsA<Indicator>, F: Fn(&P, &str) + 'static>(this: *mut ffi::AppIndicator, arg1: *mut libc::c_char, f: glib::ffi::gpointer) {
735 let f: &F = &*(f as *const F);
736 f(Indicator::from_glib_borrow(this).unsafe_cast_ref(), &glib::GString::from_glib_borrow(arg1))
737 }
738 unsafe {
739 let f: Box_<F> = Box_::new(f);
740 connect_raw(self.as_ptr() as *mut _, b"new-status\0".as_ptr() as *const _,
741 Some(transmute::<_, unsafe extern "C" fn()>(new_status_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
742 }
743 }
744
745 fn connect_scroll_event<F: Fn(&Self, i32, gdk::ScrollDirection) + 'static>(&self, f: F) -> SignalHandlerId {
746 unsafe extern "C" fn scroll_event_trampoline<P: IsA<Indicator>, F: Fn(&P, i32, gdk::ScrollDirection) + 'static>(this: *mut ffi::AppIndicator, arg1: libc::c_int, arg2: libc::c_uint, f: glib::ffi::gpointer) {
747 let f: &F = &*(f as *const F);
748 let direction = match arg2 as i32 {
749 gdk_sys::GDK_SCROLL_UP => gdk::ScrollDirection::Up,
750 gdk_sys::GDK_SCROLL_DOWN => gdk::ScrollDirection::Down,
751 gdk_sys::GDK_SCROLL_LEFT => gdk::ScrollDirection::Left,
752 gdk_sys::GDK_SCROLL_RIGHT => gdk::ScrollDirection::Right,
753 gdk_sys::GDK_SCROLL_SMOOTH => gdk::ScrollDirection::Smooth,
754 arg2 => gdk::ScrollDirection::__Unknown(arg2),
755 };
756 f(Indicator::from_glib_borrow(this).unsafe_cast_ref(), arg1, direction)
757 }
758 unsafe {
759 let f: Box_<F> = Box_::new(f);
760 connect_raw(self.as_ptr() as *mut _, b"scroll-event\0".as_ptr() as *const _,
761 Some(transmute::<_, unsafe extern "C" fn()>(scroll_event_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
762 }
763 }
764
765 fn connect_attention_icon_desc_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
766 unsafe extern "C" fn notify_attention_icon_desc_trampoline<P: IsA<Indicator>, F: Fn(&P) + 'static>(this: *mut ffi::AppIndicator, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
767 let f: &F = &*(f as *const F);
768 f(Indicator::from_glib_borrow(this).unsafe_cast_ref())
769 }
770 unsafe {
771 let f: Box_<F> = Box_::new(f);
772 connect_raw(self.as_ptr() as *mut _, b"notify::attention-icon-desc\0".as_ptr() as *const _,
773 Some(transmute::<_, unsafe extern "C" fn()>(notify_attention_icon_desc_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
774 }
775 }
776
777 fn connect_attention_icon_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
778 unsafe extern "C" fn notify_attention_icon_name_trampoline<P: IsA<Indicator>, F: Fn(&P) + 'static>(this: *mut ffi::AppIndicator, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
779 let f: &F = &*(f as *const F);
780 f(Indicator::from_glib_borrow(this).unsafe_cast_ref())
781 }
782 unsafe {
783 let f: Box_<F> = Box_::new(f);
784 connect_raw(self.as_ptr() as *mut _, b"notify::attention-icon-name\0".as_ptr() as *const _,
785 Some(transmute::<_, unsafe extern "C" fn()>(notify_attention_icon_name_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
786 }
787 }
788
789 fn connect_connected_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
790 unsafe extern "C" fn notify_connected_trampoline<P: IsA<Indicator>, F: Fn(&P) + 'static>(this: *mut ffi::AppIndicator, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
791 let f: &F = &*(f as *const F);
792 f(Indicator::from_glib_borrow(this).unsafe_cast_ref())
793 }
794 unsafe {
795 let f: Box_<F> = Box_::new(f);
796 connect_raw(self.as_ptr() as *mut _, b"notify::connected\0".as_ptr() as *const _,
797 Some(transmute::<_, unsafe extern "C" fn()>(notify_connected_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
798 }
799 }
800
801 fn connect_icon_desc_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
802 unsafe extern "C" fn notify_icon_desc_trampoline<P: IsA<Indicator>, F: Fn(&P) + 'static>(this: *mut ffi::AppIndicator, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
803 let f: &F = &*(f as *const F);
804 f(Indicator::from_glib_borrow(this).unsafe_cast_ref())
805 }
806 unsafe {
807 let f: Box_<F> = Box_::new(f);
808 connect_raw(self.as_ptr() as *mut _, b"notify::icon-desc\0".as_ptr() as *const _,
809 Some(transmute::<_, unsafe extern "C" fn()>(notify_icon_desc_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
810 }
811 }
812
813 fn connect_icon_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
814 unsafe extern "C" fn notify_icon_name_trampoline<P: IsA<Indicator>, F: Fn(&P) + 'static>(this: *mut ffi::AppIndicator, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
815 let f: &F = &*(f as *const F);
816 f(Indicator::from_glib_borrow(this).unsafe_cast_ref())
817 }
818 unsafe {
819 let f: Box_<F> = Box_::new(f);
820 connect_raw(self.as_ptr() as *mut _, b"notify::icon-name\0".as_ptr() as *const _,
821 Some(transmute::<_, unsafe extern "C" fn()>(notify_icon_name_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
822 }
823 }
824
825 fn connect_icon_theme_path_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
826 unsafe extern "C" fn notify_icon_theme_path_trampoline<P: IsA<Indicator>, F: Fn(&P) + 'static>(this: *mut ffi::AppIndicator, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
827 let f: &F = &*(f as *const F);
828 f(Indicator::from_glib_borrow(this).unsafe_cast_ref())
829 }
830 unsafe {
831 let f: Box_<F> = Box_::new(f);
832 connect_raw(self.as_ptr() as *mut _, b"notify::icon-theme-path\0".as_ptr() as *const _,
833 Some(transmute::<_, unsafe extern "C" fn()>(notify_icon_theme_path_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
834 }
835 }
836
837 fn connect_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
838 unsafe extern "C" fn notify_label_trampoline<P: IsA<Indicator>, F: Fn(&P) + 'static>(this: *mut ffi::AppIndicator, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
839 let f: &F = &*(f as *const F);
840 f(Indicator::from_glib_borrow(this).unsafe_cast_ref())
841 }
842 unsafe {
843 let f: Box_<F> = Box_::new(f);
844 connect_raw(self.as_ptr() as *mut _, b"notify::label\0".as_ptr() as *const _,
845 Some(transmute::<_, unsafe extern "C" fn()>(notify_label_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
846 }
847 }
848
849 fn connect_label_guide_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
850 unsafe extern "C" fn notify_label_guide_trampoline<P: IsA<Indicator>, F: Fn(&P) + 'static>(this: *mut ffi::AppIndicator, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
851 let f: &F = &*(f as *const F);
852 f(Indicator::from_glib_borrow(this).unsafe_cast_ref())
853 }
854 unsafe {
855 let f: Box_<F> = Box_::new(f);
856 connect_raw(self.as_ptr() as *mut _, b"notify::label-guide\0".as_ptr() as *const _,
857 Some(transmute::<_, unsafe extern "C" fn()>(notify_label_guide_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
858 }
859 }
860
861 fn connect_ordering_index_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
862 unsafe extern "C" fn notify_ordering_index_trampoline<P: IsA<Indicator>, F: Fn(&P) + 'static>(this: *mut ffi::AppIndicator, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
863 let f: &F = &*(f as *const F);
864 f(Indicator::from_glib_borrow(this).unsafe_cast_ref())
865 }
866 unsafe {
867 let f: Box_<F> = Box_::new(f);
868 connect_raw(self.as_ptr() as *mut _, b"notify::ordering-index\0".as_ptr() as *const _,
869 Some(transmute::<_, unsafe extern "C" fn()>(notify_ordering_index_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
870 }
871 }
872
873 fn connect_status_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
874 unsafe extern "C" fn notify_status_trampoline<P: IsA<Indicator>, F: Fn(&P) + 'static>(this: *mut ffi::AppIndicator, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
875 let f: &F = &*(f as *const F);
876 f(Indicator::from_glib_borrow(this).unsafe_cast_ref())
877 }
878 unsafe {
879 let f: Box_<F> = Box_::new(f);
880 connect_raw(self.as_ptr() as *mut _, b"notify::status\0".as_ptr() as *const _,
881 Some(transmute::<_, unsafe extern "C" fn()>(notify_status_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
882 }
883 }
884
885 fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
886 unsafe extern "C" fn notify_title_trampoline<P: IsA<Indicator>, F: Fn(&P) + 'static>(this: *mut ffi::AppIndicator, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
887 let f: &F = &*(f as *const F);
888 f(Indicator::from_glib_borrow(this).unsafe_cast_ref())
889 }
890 unsafe {
891 let f: Box_<F> = Box_::new(f);
892 connect_raw(self.as_ptr() as *mut _, b"notify::title\0".as_ptr() as *const _,
893 Some(transmute::<_, unsafe extern "C" fn()>(notify_title_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
894 }
895 }
896}
897
898impl fmt::Display for Indicator {
899 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
900 f.write_str("Indicator")
901 }
902}