1 // This file was generated by gir (https://github.com/gtk-rs/gir)
2 // from gir-files (https://github.com/gtk-rs/gir-files)
3 // DO NOT EDIT
4 
5 use gio_sys;
6 use glib::object::IsA;
7 use glib::translate::*;
8 use glib::StaticType;
9 use glib::Value;
10 use gobject_sys;
11 use std::fmt;
12 use Emblem;
13 use Icon;
14 
15 glib_wrapper! {
16     pub struct EmblemedIcon(Object<gio_sys::GEmblemedIcon, gio_sys::GEmblemedIconClass, EmblemedIconClass>) @implements Icon;
17 
18     match fn {
19         get_type => || gio_sys::g_emblemed_icon_get_type(),
20     }
21 }
22 
23 impl EmblemedIcon {
new<P: IsA<Icon>>(icon: &P, emblem: Option<&Emblem>) -> EmblemedIcon24     pub fn new<P: IsA<Icon>>(icon: &P, emblem: Option<&Emblem>) -> EmblemedIcon {
25         unsafe {
26             from_glib_full(gio_sys::g_emblemed_icon_new(
27                 icon.as_ref().to_glib_none().0,
28                 emblem.to_glib_none().0,
29             ))
30         }
31     }
32 }
33 
34 pub const NONE_EMBLEMED_ICON: Option<&EmblemedIcon> = None;
35 
36 pub trait EmblemedIconExt: 'static {
add_emblem(&self, emblem: &Emblem)37     fn add_emblem(&self, emblem: &Emblem);
38 
clear_emblems(&self)39     fn clear_emblems(&self);
40 
get_emblems(&self) -> Vec<Emblem>41     fn get_emblems(&self) -> Vec<Emblem>;
42 
get_icon(&self) -> Option<Icon>43     fn get_icon(&self) -> Option<Icon>;
44 
get_property_gicon(&self) -> Option<Icon>45     fn get_property_gicon(&self) -> Option<Icon>;
46 }
47 
48 impl<O: IsA<EmblemedIcon>> EmblemedIconExt for O {
add_emblem(&self, emblem: &Emblem)49     fn add_emblem(&self, emblem: &Emblem) {
50         unsafe {
51             gio_sys::g_emblemed_icon_add_emblem(
52                 self.as_ref().to_glib_none().0,
53                 emblem.to_glib_none().0,
54             );
55         }
56     }
57 
clear_emblems(&self)58     fn clear_emblems(&self) {
59         unsafe {
60             gio_sys::g_emblemed_icon_clear_emblems(self.as_ref().to_glib_none().0);
61         }
62     }
63 
get_emblems(&self) -> Vec<Emblem>64     fn get_emblems(&self) -> Vec<Emblem> {
65         unsafe {
66             FromGlibPtrContainer::from_glib_none(gio_sys::g_emblemed_icon_get_emblems(
67                 self.as_ref().to_glib_none().0,
68             ))
69         }
70     }
71 
get_icon(&self) -> Option<Icon>72     fn get_icon(&self) -> Option<Icon> {
73         unsafe {
74             from_glib_none(gio_sys::g_emblemed_icon_get_icon(
75                 self.as_ref().to_glib_none().0,
76             ))
77         }
78     }
79 
get_property_gicon(&self) -> Option<Icon>80     fn get_property_gicon(&self) -> Option<Icon> {
81         unsafe {
82             let mut value = Value::from_type(<Icon as StaticType>::static_type());
83             gobject_sys::g_object_get_property(
84                 self.to_glib_none().0 as *mut gobject_sys::GObject,
85                 b"gicon\0".as_ptr() as *const _,
86                 value.to_glib_none_mut().0,
87             );
88             value
89                 .get()
90                 .expect("Return Value for property `gicon` getter")
91         }
92     }
93 }
94 
95 impl fmt::Display for EmblemedIcon {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result96     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
97         write!(f, "EmblemedIcon")
98     }
99 }
100