appindicator3/auto/
indicator.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from /home/rene/git/gir-files
3// DO NOT EDIT
4
5use 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")]
21/// A application indicator type
22/// 
23///  
24/// A application indicator represents the values that are needed to show a
25/// unique status in the panel for an application. In general, applications
26/// should try to fit in the other indicators that are available on the
27/// panel before using this. But, sometimes it is necissary.
28/// 
29/// # Implements
30/// 
31/// [`AppIndicatorExt`][trait@crate::prelude::AppIndicatorExt], [`AppIndicatorBuilderExt`][trait@crate::prelude::AppIndicatorBuilderExt]
32    pub 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    /// Creates a new [`Indicator`][crate::Indicator] setting the properties:
44    /// `property::Indicator::id` with `id`, `property::Indicator::category` with `category`
45    /// and `property::Indicator::icon-name` with `icon_name`.
46    /// ## `id`
47    /// The unique id of the indicator to create.
48    /// ## `icon_name`
49    /// The icon name for this indicator
50    /// ## `category`
51    /// The category of indicator.
52    ///
53    /// # Returns
54    ///
55    /// A pointer to a new [`Indicator`][crate::Indicator] object.
56    #[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    /// Creates a new [`Indicator`][crate::Indicator] setting the properties:
64    /// `property::Indicator::id` with `id`, `property::Indicator::category` with `category`,
65    /// `property::Indicator::icon-name` with `icon_name` and `property::Indicator::icon-theme-path`
66    /// with `icon_theme_path`.
67    /// ## `id`
68    /// The unique id of the indicator to create.
69    /// ## `icon_name`
70    /// The icon name for this indicator
71    /// ## `category`
72    /// The category of indicator.
73    /// ## `icon_theme_path`
74    /// A custom path for finding icons.
75    ///
76    /// # Returns
77    ///
78    /// A pointer to a new [`Indicator`][crate::Indicator] object.
79    #[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
88/// Trait containing all [`struct@Indicator`] methods.
89///
90/// # Implementors
91///
92/// [`Indicator`][struct@crate::Indicator]
93pub trait AppIndicatorExt: 'static {
94    /// This function allows for building the Application Indicator menu
95    /// from a static desktop file.
96    /// ## `desktop_file`
97    /// A path to the desktop file to build the menu from
98    /// ## `desktop_profile`
99    /// Which entries should be used from the desktop file
100    #[doc(alias = "app_indicator_build_menu_from_desktop")]
101    fn build_menu_from_desktop(&self, desktop_file: &str, desktop_profile: &str);
102
103    /// Wrapper function for property `property::Indicator::attention-icon-name`.
104    ///
105    /// # Returns
106    ///
107    /// The current attention icon name.
108    #[doc(alias = "app_indicator_get_attention_icon")]
109    #[doc(alias = "get_attention_icon")]
110    fn attention_icon(&self) -> Option<glib::GString>;
111
112    /// Wrapper function for property `property::Indicator::attention-icon-desc`.
113    ///
114    /// # Returns
115    ///
116    /// The current attention icon description.
117    #[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    /// Wrapper function for property `property::Indicator::category`.
122    ///
123    /// # Returns
124    ///
125    /// The current category.
126    #[doc(alias = "app_indicator_get_category")]
127    #[doc(alias = "get_category")]
128    fn category(&self) -> IndicatorCategory;
129
130    /// Wrapper function for property `property::Indicator::icon-name`.
131    ///
132    /// # Returns
133    ///
134    /// The current icon name.
135    #[doc(alias = "app_indicator_get_icon")]
136    #[doc(alias = "get_icon")]
137    fn icon(&self) -> Option<glib::GString>;
138
139    /// Wrapper function for property `property::Indicator::icon-desc`.
140    ///
141    /// # Returns
142    ///
143    /// The current icon description.
144    #[doc(alias = "app_indicator_get_icon_desc")]
145    #[doc(alias = "get_icon_desc")]
146    fn icon_desc(&self) -> Option<glib::GString>;
147
148    /// Wrapper function for property `property::Indicator::icon-theme-path`.
149    ///
150    /// # Returns
151    ///
152    /// The current icon theme path.
153    #[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    /// Wrapper function for property `property::Indicator::id`.
158    ///
159    /// # Returns
160    ///
161    /// The current ID
162    #[doc(alias = "app_indicator_get_id")]
163    #[doc(alias = "get_id")]
164    fn id(&self) -> Option<glib::GString>;
165
166    /// Wrapper function for property `property::Indicator::label`.
167    ///
168    /// # Returns
169    ///
170    /// The current label.
171    #[doc(alias = "app_indicator_get_label")]
172    #[doc(alias = "get_label")]
173    fn label(&self) -> Option<glib::GString>;
174
175    /// Wrapper function for property `property::Indicator::label-guide`.
176    ///
177    /// # Returns
178    ///
179    /// The current label guide.
180    #[doc(alias = "app_indicator_get_label_guide")]
181    #[doc(alias = "get_label_guide")]
182    fn label_guide(&self) -> Option<glib::GString>;
183
184    /// Gets the menu being used for this application indicator.
185    /// Wrapper function for property `property::Indicator::menu`.
186    ///
187    /// # Returns
188    ///
189    /// A [`gtk::Menu`][crate::gtk::Menu] object or [`None`] if one hasn't been set.
190    #[doc(alias = "app_indicator_get_menu")]
191    #[doc(alias = "get_menu")]
192    fn menu(&self) -> Option<gtk::Menu>;
193
194    /// Wrapper function for property `property::Indicator::ordering-index`.
195    ///
196    /// # Returns
197    ///
198    /// The current ordering index.
199    #[doc(alias = "app_indicator_get_ordering_index")]
200    #[doc(alias = "get_ordering_index")]
201    fn ordering_index(&self) -> u32;
202
203    /// Gets the menuitem being called on secondary-activate event.
204    ///
205    /// # Returns
206    ///
207    /// A [`gtk::Widget`][crate::gtk::Widget] object or [`None`] if none has been set.
208    #[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    /// Wrapper function for property `property::Indicator::status`.
213    ///
214    /// # Returns
215    ///
216    /// The current status.
217    #[doc(alias = "app_indicator_get_status")]
218    #[doc(alias = "get_status")]
219    fn status(&self) -> IndicatorStatus;
220
221    /// Gets the title of the application indicator. See the function
222    /// [`set_title()`][Self::set_title()] for information on the title.
223    ///
224    /// # Returns
225    ///
226    /// The current title.
227    #[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    /// Wrapper for [`set_attention_icon_full()`][Self::set_attention_icon_full()] with a NULL
234    /// description.
235    ///
236    /// # Deprecated
237    ///
238    /// Use [`set_attention_icon_full()`][Self::set_attention_icon_full()] instead.
239    /// ## `icon_name`
240    /// The name of the attention icon to set for this indicator
241    #[doc(alias = "app_indicator_set_attention_icon")]
242    fn set_attention_icon(&self, icon_name: &str);
243
244    /// Wrapper function for property `property::Indicator::attention-icon-name`.
245    /// ## `icon_name`
246    /// The name of the attention icon to set for this indicator
247    /// ## `icon_desc`
248    /// A textual description of the icon
249    #[doc(alias = "app_indicator_set_attention_icon_full")]
250    fn set_attention_icon_full(&self, icon_name: &str, icon_desc: &str);
251
252    /// Wrapper function for [`set_icon_full()`][Self::set_icon_full()] with a NULL
253    /// description.
254    ///
255    /// # Deprecated
256    ///
257    /// Use [`set_icon_full()`][Self::set_icon_full()]
258    /// ## `icon_name`
259    /// The icon name to set.
260    #[doc(alias = "app_indicator_set_icon")]
261    fn set_icon(&self, icon_name: &str);
262
263    /// Sets the default icon to use when the status is active but
264    /// not set to attention. In most cases, this should be the
265    /// application icon for the program.
266    ///
267    /// Wrapper function for property `property::Indicator::icon-name` and
268    /// `signal::Indicator::icon-desc`.
269    /// ## `icon_name`
270    /// The icon name to set.
271    /// ## `icon_desc`
272    /// A textual description of the icon for accessibility
273    #[doc(alias = "app_indicator_set_icon_full")]
274    fn set_icon_full(&self, icon_name: &str, icon_desc: &str);
275
276    /// Sets the path to use when searching for icons.
277    /// ## `icon_theme_path`
278    /// The icon theme path to set.
279    #[doc(alias = "app_indicator_set_icon_theme_path")]
280    fn set_icon_theme_path(&self, icon_theme_path: &str);
281
282    /// This is a wrapper function for the `property::Indicator::label` and
283    /// `property::Indicator::guide` properties. This function can take [`None`]
284    /// as either `label` or `guide` and will clear the entries.
285    /// ## `label`
286    /// The label to show next to the icon.
287    /// ## `guide`
288    /// A guide to size the label correctly.
289    #[doc(alias = "app_indicator_set_label")]
290    fn set_label(&self, label: &str, guide: &str);
291
292    /// Sets the menu that should be shown when the Application Indicator
293    /// is clicked on in the panel. An application indicator will not
294    /// be rendered unless it has a menu.
295    ///
296    /// Wrapper function for property `property::Indicator::menu`.
297    /// ## `menu`
298    /// A [`gtk::Menu`][crate::gtk::Menu] to set
299    #[doc(alias = "app_indicator_set_menu")]
300    fn set_menu(&self, menu: Option<&impl IsA<gtk::Menu>>);
301
302    /// Sets the ordering index for the app indicator which effects the
303    /// placement of it on the panel. For almost all app indicator
304    /// this is not the function you're looking for.
305    ///
306    /// Wrapper function for property `property::Indicator::ordering-index`.
307    /// ## `ordering_index`
308    /// A value for the ordering of this app indicator
309    #[doc(alias = "app_indicator_set_ordering_index")]
310    fn set_ordering_index(&self, ordering_index: u32);
311
312    /// Set the `menuitem` to be activated when a secondary activation event (i.e. a
313    /// middle-click) is emitted over the [`Indicator`][crate::Indicator] icon/label.
314    ///
315    /// The `menuitem` can be also a complex [`gtk::Widget`][crate::gtk::Widget], but to get activated when
316    /// a secondary activation occurs in the `Appindicator`, it must be a visible and
317    /// active child (or inner-child) of the `property::Indicator::menu`.
318    ///
319    /// Setting `menuitem` to [`None`] causes to disable this feature.
320    /// ## `menuitem`
321    /// A [`gtk::Widget`][crate::gtk::Widget] to be activated on secondary activation
322    #[doc(alias = "app_indicator_set_secondary_activate_target")]
323    fn set_secondary_activate_target(&self, menuitem: Option<&impl IsA<gtk::Widget>>);
324
325    /// Wrapper function for property `property::Indicator::status`.
326    /// ## `status`
327    /// The status to set for this indicator
328    #[doc(alias = "app_indicator_set_status")]
329    fn set_status(&self, status: IndicatorStatus);
330
331    /// Sets the title of the application indicator, or how it should be referred
332    /// in a human readable form. This string should be UTF-8 and localized as it
333    /// expected that users will set it.
334    ///
335    /// In the Unity desktop the most prominent place that this is show will be
336    /// in the HUD. HUD listings for this application indicator will start with
337    /// the title as the first part of the line for the menu items.
338    ///
339    /// Setting `title` to [`None`] removes the title.
340    /// ## `title`
341    /// Title of the app indicator
342    #[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    /// If the indicator sets it's status to [`IndicatorStatus::Attention`][crate::IndicatorStatus::Attention]
348    /// then this textual description of the icon shown.
349    #[doc(alias = "attention-icon-desc")]
350    fn set_attention_icon_desc(&self, attention_icon_desc: Option<&str>);
351
352    /// If the indicator sets it's status to [`IndicatorStatus::Attention`][crate::IndicatorStatus::Attention]
353    /// then this icon is shown.
354    #[doc(alias = "attention-icon-name")]
355    fn attention_icon_name(&self) -> Option<glib::GString>;
356
357    /// If the indicator sets it's status to [`IndicatorStatus::Attention`][crate::IndicatorStatus::Attention]
358    /// then this icon is shown.
359    #[doc(alias = "attention-icon-name")]
360    fn set_attention_icon_name(&self, attention_icon_name: Option<&str>);
361
362    /// Pretty simple, [`true`] if we have a reasonable expectation of being
363    /// displayed through this object. You should hide your TrayIcon if so.
364    fn is_connected(&self) -> bool;
365
366    /// The description of the regular icon that is shown for the indicator.
367    #[doc(alias = "icon-desc")]
368    fn set_icon_desc(&self, icon_desc: Option<&str>);
369
370    /// The name of the regular icon that is shown for the indicator.
371    #[doc(alias = "icon-name")]
372    fn icon_name(&self) -> Option<glib::GString>;
373
374    /// The name of the regular icon that is shown for the indicator.
375    #[doc(alias = "icon-name")]
376    fn set_icon_name(&self, icon_name: Option<&str>);
377
378    /// An optional string to provide guidance to the panel on how big
379    /// the `property::Indicator::label` string could get. If this is set correctly
380    /// then the panel should never 'jiggle' as the string adjusts through
381    /// out the range of options. For instance, if you were providing a
382    /// percentage like "54% thrust" in `property::Indicator::label` you'd want to
383    /// set this string to "100% thrust" to ensure space when Scotty can
384    /// get you enough power.
385    #[doc(alias = "label-guide")]
386    fn set_label_guide(&self, label_guide: Option<&str>);
387
388    /// Provides a way to refer to this application indicator in a human
389    /// readable form. This is used in the Unity desktop in the HUD as
390    /// the first part of the menu entries to distinguish them from the
391    /// focused application's entries.
392    fn get_property_title(&self) -> Option<glib::GString>;
393
394    /// Provides a way to refer to this application indicator in a human
395    /// readable form. This is used in the Unity desktop in the HUD as
396    /// the first part of the menu entries to distinguish them from the
397    /// focused application's entries.
398    fn set_property_title(&self, title: Option<&str>);
399
400    /// Signaled when we connect to a watcher, or when it drops away.
401    /// ## `arg1`
402    /// Whether we're connected or not
403    #[doc(alias = "connection-changed")]
404    fn connect_connection_changed<F: Fn(&Self, bool) + 'static>(&self, f: F) -> SignalHandlerId;
405
406    /// Emitted when `property::Indicator::attention-icon-name` is changed
407    #[doc(alias = "new-attention-icon")]
408    fn connect_new_attention_icon<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
409
410    /// when `property::Indicator::icon-name` is changed
411    #[doc(alias = "new-icon")]
412    fn connect_new_icon<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
413
414    /// Signaled when there is a new icon set for the
415    /// object.
416    #[doc(alias = "new-icon-theme-path")]
417    fn connect_new_icon_theme_path<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId;
418
419    /// Emitted when either `property::Indicator::label` or `property::Indicator::label-guide` are
420    /// changed.
421    #[doc(alias = "new-label")]
422    fn connect_new_label<F: Fn(&Self, &str, &str) + 'static>(&self, f: F) -> SignalHandlerId;
423
424    /// Emitted when `property::Indicator::status` is changed
425    /// ## `arg1`
426    /// The string value of the [`IndicatorStatus`][crate::IndicatorStatus] enum.
427    #[doc(alias = "new-status")]
428    fn connect_new_status<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId;
429
430    /// Signaled when the [`Indicator`][crate::Indicator] receives a scroll event.
431    /// ## `arg1`
432    /// How many steps the scroll wheel has taken
433    /// ## `arg2`
434    /// Which direction the wheel went in
435    #[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}