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 crate::Buildable;
6 use crate::IconSize;
7 use crate::ImageType;
8 use crate::Misc;
9 use crate::Widget;
10 use glib::object::Cast;
11 use glib::object::IsA;
12 use glib::signal::connect_raw;
13 use glib::signal::SignalHandlerId;
14 use glib::translate::*;
15 use glib::StaticType;
16 use glib::ToValue;
17 use std::boxed::Box as Box_;
18 use std::fmt;
19 use std::mem;
20 use std::mem::transmute;
21 use std::ptr;
22 
23 glib::wrapper! {
24     #[doc(alias = "GtkImage")]
25     pub struct Image(Object<ffi::GtkImage, ffi::GtkImageClass>) @extends Misc, Widget, @implements Buildable;
26 
27     match fn {
28         type_ => || ffi::gtk_image_get_type(),
29     }
30 }
31 
32 impl Image {
33     #[doc(alias = "gtk_image_new")]
new() -> Image34     pub fn new() -> Image {
35         assert_initialized_main_thread!();
36         unsafe { Widget::from_glib_none(ffi::gtk_image_new()).unsafe_cast() }
37     }
38 
39     #[doc(alias = "gtk_image_new_from_animation")]
40     #[doc(alias = "new_from_animation")]
from_animation<P: IsA<gdk_pixbuf::PixbufAnimation>>(animation: &P) -> Image41     pub fn from_animation<P: IsA<gdk_pixbuf::PixbufAnimation>>(animation: &P) -> Image {
42         assert_initialized_main_thread!();
43         unsafe {
44             Widget::from_glib_none(ffi::gtk_image_new_from_animation(
45                 animation.as_ref().to_glib_none().0,
46             ))
47             .unsafe_cast()
48         }
49     }
50 
51     #[doc(alias = "gtk_image_new_from_file")]
52     #[doc(alias = "new_from_file")]
from_file<P: AsRef<std::path::Path>>(filename: P) -> Image53     pub fn from_file<P: AsRef<std::path::Path>>(filename: P) -> Image {
54         assert_initialized_main_thread!();
55         unsafe {
56             Widget::from_glib_none(ffi::gtk_image_new_from_file(
57                 filename.as_ref().to_glib_none().0,
58             ))
59             .unsafe_cast()
60         }
61     }
62 
63     #[doc(alias = "gtk_image_new_from_gicon")]
64     #[doc(alias = "new_from_gicon")]
from_gicon<P: IsA<gio::Icon>>(icon: &P, size: IconSize) -> Image65     pub fn from_gicon<P: IsA<gio::Icon>>(icon: &P, size: IconSize) -> Image {
66         assert_initialized_main_thread!();
67         unsafe {
68             Widget::from_glib_none(ffi::gtk_image_new_from_gicon(
69                 icon.as_ref().to_glib_none().0,
70                 size.into_glib(),
71             ))
72             .unsafe_cast()
73         }
74     }
75 
76     #[doc(alias = "gtk_image_new_from_icon_name")]
77     #[doc(alias = "new_from_icon_name")]
from_icon_name(icon_name: Option<&str>, size: IconSize) -> Image78     pub fn from_icon_name(icon_name: Option<&str>, size: IconSize) -> Image {
79         assert_initialized_main_thread!();
80         unsafe {
81             Widget::from_glib_none(ffi::gtk_image_new_from_icon_name(
82                 icon_name.to_glib_none().0,
83                 size.into_glib(),
84             ))
85             .unsafe_cast()
86         }
87     }
88 
89     #[doc(alias = "gtk_image_new_from_pixbuf")]
90     #[doc(alias = "new_from_pixbuf")]
from_pixbuf(pixbuf: Option<&gdk_pixbuf::Pixbuf>) -> Image91     pub fn from_pixbuf(pixbuf: Option<&gdk_pixbuf::Pixbuf>) -> Image {
92         assert_initialized_main_thread!();
93         unsafe {
94             Widget::from_glib_none(ffi::gtk_image_new_from_pixbuf(pixbuf.to_glib_none().0))
95                 .unsafe_cast()
96         }
97     }
98 
99     #[doc(alias = "gtk_image_new_from_resource")]
100     #[doc(alias = "new_from_resource")]
from_resource(resource_path: &str) -> Image101     pub fn from_resource(resource_path: &str) -> Image {
102         assert_initialized_main_thread!();
103         unsafe {
104             Widget::from_glib_none(ffi::gtk_image_new_from_resource(
105                 resource_path.to_glib_none().0,
106             ))
107             .unsafe_cast()
108         }
109     }
110 
111     #[doc(alias = "gtk_image_new_from_surface")]
112     #[doc(alias = "new_from_surface")]
from_surface(surface: Option<&cairo::Surface>) -> Image113     pub fn from_surface(surface: Option<&cairo::Surface>) -> Image {
114         assert_initialized_main_thread!();
115         unsafe {
116             Widget::from_glib_none(ffi::gtk_image_new_from_surface(mut_override(
117                 surface.to_glib_none().0,
118             )))
119             .unsafe_cast()
120         }
121     }
122 }
123 
124 impl Default for Image {
default() -> Self125     fn default() -> Self {
126         Self::new()
127     }
128 }
129 
130 pub const NONE_IMAGE: Option<&Image> = None;
131 
132 pub trait ImageExt: 'static {
133     #[doc(alias = "gtk_image_clear")]
clear(&self)134     fn clear(&self);
135 
136     #[doc(alias = "gtk_image_get_animation")]
137     #[doc(alias = "get_animation")]
animation(&self) -> Option<gdk_pixbuf::PixbufAnimation>138     fn animation(&self) -> Option<gdk_pixbuf::PixbufAnimation>;
139 
140     #[doc(alias = "gtk_image_get_gicon")]
141     #[doc(alias = "get_gicon")]
gicon(&self) -> (gio::Icon, IconSize)142     fn gicon(&self) -> (gio::Icon, IconSize);
143 
144     #[doc(alias = "gtk_image_get_pixbuf")]
145     #[doc(alias = "get_pixbuf")]
pixbuf(&self) -> Option<gdk_pixbuf::Pixbuf>146     fn pixbuf(&self) -> Option<gdk_pixbuf::Pixbuf>;
147 
148     #[doc(alias = "gtk_image_get_pixel_size")]
149     #[doc(alias = "get_pixel_size")]
pixel_size(&self) -> i32150     fn pixel_size(&self) -> i32;
151 
152     #[doc(alias = "gtk_image_get_storage_type")]
153     #[doc(alias = "get_storage_type")]
storage_type(&self) -> ImageType154     fn storage_type(&self) -> ImageType;
155 
156     #[doc(alias = "gtk_image_set_from_animation")]
set_from_animation<P: IsA<gdk_pixbuf::PixbufAnimation>>(&self, animation: &P)157     fn set_from_animation<P: IsA<gdk_pixbuf::PixbufAnimation>>(&self, animation: &P);
158 
159     #[doc(alias = "gtk_image_set_from_file")]
set_from_file<P: AsRef<std::path::Path>>(&self, filename: P)160     fn set_from_file<P: AsRef<std::path::Path>>(&self, filename: P);
161 
162     #[doc(alias = "gtk_image_set_from_gicon")]
set_from_gicon<P: IsA<gio::Icon>>(&self, icon: &P, size: IconSize)163     fn set_from_gicon<P: IsA<gio::Icon>>(&self, icon: &P, size: IconSize);
164 
165     #[doc(alias = "gtk_image_set_from_icon_name")]
set_from_icon_name(&self, icon_name: Option<&str>, size: IconSize)166     fn set_from_icon_name(&self, icon_name: Option<&str>, size: IconSize);
167 
168     #[doc(alias = "gtk_image_set_from_pixbuf")]
set_from_pixbuf(&self, pixbuf: Option<&gdk_pixbuf::Pixbuf>)169     fn set_from_pixbuf(&self, pixbuf: Option<&gdk_pixbuf::Pixbuf>);
170 
171     #[doc(alias = "gtk_image_set_from_resource")]
set_from_resource(&self, resource_path: Option<&str>)172     fn set_from_resource(&self, resource_path: Option<&str>);
173 
174     #[doc(alias = "gtk_image_set_from_surface")]
set_from_surface(&self, surface: Option<&cairo::Surface>)175     fn set_from_surface(&self, surface: Option<&cairo::Surface>);
176 
177     #[doc(alias = "gtk_image_set_pixel_size")]
set_pixel_size(&self, pixel_size: i32)178     fn set_pixel_size(&self, pixel_size: i32);
179 
file(&self) -> Option<glib::GString>180     fn file(&self) -> Option<glib::GString>;
181 
set_file(&self, file: Option<&str>)182     fn set_file(&self, file: Option<&str>);
183 
set_gicon<P: IsA<gio::Icon>>(&self, gicon: Option<&P>)184     fn set_gicon<P: IsA<gio::Icon>>(&self, gicon: Option<&P>);
185 
186     #[doc(alias = "icon-name")]
icon_name(&self) -> Option<glib::GString>187     fn icon_name(&self) -> Option<glib::GString>;
188 
189     #[doc(alias = "icon-name")]
set_icon_name(&self, icon_name: Option<&str>)190     fn set_icon_name(&self, icon_name: Option<&str>);
191 
set_pixbuf(&self, pixbuf: Option<&gdk_pixbuf::Pixbuf>)192     fn set_pixbuf(&self, pixbuf: Option<&gdk_pixbuf::Pixbuf>);
193 
194     #[doc(alias = "pixbuf-animation")]
pixbuf_animation(&self) -> Option<gdk_pixbuf::PixbufAnimation>195     fn pixbuf_animation(&self) -> Option<gdk_pixbuf::PixbufAnimation>;
196 
197     #[doc(alias = "pixbuf-animation")]
set_pixbuf_animation<P: IsA<gdk_pixbuf::PixbufAnimation>>( &self, pixbuf_animation: Option<&P>, )198     fn set_pixbuf_animation<P: IsA<gdk_pixbuf::PixbufAnimation>>(
199         &self,
200         pixbuf_animation: Option<&P>,
201     );
202 
resource(&self) -> Option<glib::GString>203     fn resource(&self) -> Option<glib::GString>;
204 
set_resource(&self, resource: Option<&str>)205     fn set_resource(&self, resource: Option<&str>);
206 
surface(&self) -> Option<cairo::Surface>207     fn surface(&self) -> Option<cairo::Surface>;
208 
set_surface(&self, surface: Option<&cairo::Surface>)209     fn set_surface(&self, surface: Option<&cairo::Surface>);
210 
211     #[doc(alias = "use-fallback")]
uses_fallback(&self) -> bool212     fn uses_fallback(&self) -> bool;
213 
214     #[doc(alias = "use-fallback")]
set_use_fallback(&self, use_fallback: bool)215     fn set_use_fallback(&self, use_fallback: bool);
216 
217     #[doc(alias = "file")]
connect_file_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId218     fn connect_file_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
219 
220     #[doc(alias = "gicon")]
connect_gicon_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId221     fn connect_gicon_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
222 
223     #[doc(alias = "icon-name")]
connect_icon_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId224     fn connect_icon_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
225 
226     #[doc(alias = "pixbuf")]
connect_pixbuf_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId227     fn connect_pixbuf_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
228 
229     #[doc(alias = "pixbuf-animation")]
connect_pixbuf_animation_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId230     fn connect_pixbuf_animation_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
231 
232     #[doc(alias = "pixel-size")]
connect_pixel_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId233     fn connect_pixel_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
234 
235     #[doc(alias = "resource")]
connect_resource_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId236     fn connect_resource_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
237 
238     #[doc(alias = "storage-type")]
connect_storage_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId239     fn connect_storage_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
240 
241     #[doc(alias = "surface")]
connect_surface_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId242     fn connect_surface_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
243 
244     #[doc(alias = "use-fallback")]
connect_use_fallback_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId245     fn connect_use_fallback_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
246 }
247 
248 impl<O: IsA<Image>> ImageExt for O {
clear(&self)249     fn clear(&self) {
250         unsafe {
251             ffi::gtk_image_clear(self.as_ref().to_glib_none().0);
252         }
253     }
254 
animation(&self) -> Option<gdk_pixbuf::PixbufAnimation>255     fn animation(&self) -> Option<gdk_pixbuf::PixbufAnimation> {
256         unsafe { from_glib_none(ffi::gtk_image_get_animation(self.as_ref().to_glib_none().0)) }
257     }
258 
gicon(&self) -> (gio::Icon, IconSize)259     fn gicon(&self) -> (gio::Icon, IconSize) {
260         unsafe {
261             let mut gicon = ptr::null_mut();
262             let mut size = mem::MaybeUninit::uninit();
263             ffi::gtk_image_get_gicon(
264                 self.as_ref().to_glib_none().0,
265                 &mut gicon,
266                 size.as_mut_ptr(),
267             );
268             let size = size.assume_init();
269             (from_glib_none(gicon), from_glib(size))
270         }
271     }
272 
pixbuf(&self) -> Option<gdk_pixbuf::Pixbuf>273     fn pixbuf(&self) -> Option<gdk_pixbuf::Pixbuf> {
274         unsafe { from_glib_none(ffi::gtk_image_get_pixbuf(self.as_ref().to_glib_none().0)) }
275     }
276 
pixel_size(&self) -> i32277     fn pixel_size(&self) -> i32 {
278         unsafe { ffi::gtk_image_get_pixel_size(self.as_ref().to_glib_none().0) }
279     }
280 
storage_type(&self) -> ImageType281     fn storage_type(&self) -> ImageType {
282         unsafe {
283             from_glib(ffi::gtk_image_get_storage_type(
284                 self.as_ref().to_glib_none().0,
285             ))
286         }
287     }
288 
set_from_animation<P: IsA<gdk_pixbuf::PixbufAnimation>>(&self, animation: &P)289     fn set_from_animation<P: IsA<gdk_pixbuf::PixbufAnimation>>(&self, animation: &P) {
290         unsafe {
291             ffi::gtk_image_set_from_animation(
292                 self.as_ref().to_glib_none().0,
293                 animation.as_ref().to_glib_none().0,
294             );
295         }
296     }
297 
set_from_file<P: AsRef<std::path::Path>>(&self, filename: P)298     fn set_from_file<P: AsRef<std::path::Path>>(&self, filename: P) {
299         unsafe {
300             ffi::gtk_image_set_from_file(
301                 self.as_ref().to_glib_none().0,
302                 filename.as_ref().to_glib_none().0,
303             );
304         }
305     }
306 
set_from_gicon<P: IsA<gio::Icon>>(&self, icon: &P, size: IconSize)307     fn set_from_gicon<P: IsA<gio::Icon>>(&self, icon: &P, size: IconSize) {
308         unsafe {
309             ffi::gtk_image_set_from_gicon(
310                 self.as_ref().to_glib_none().0,
311                 icon.as_ref().to_glib_none().0,
312                 size.into_glib(),
313             );
314         }
315     }
316 
set_from_icon_name(&self, icon_name: Option<&str>, size: IconSize)317     fn set_from_icon_name(&self, icon_name: Option<&str>, size: IconSize) {
318         unsafe {
319             ffi::gtk_image_set_from_icon_name(
320                 self.as_ref().to_glib_none().0,
321                 icon_name.to_glib_none().0,
322                 size.into_glib(),
323             );
324         }
325     }
326 
set_from_pixbuf(&self, pixbuf: Option<&gdk_pixbuf::Pixbuf>)327     fn set_from_pixbuf(&self, pixbuf: Option<&gdk_pixbuf::Pixbuf>) {
328         unsafe {
329             ffi::gtk_image_set_from_pixbuf(self.as_ref().to_glib_none().0, pixbuf.to_glib_none().0);
330         }
331     }
332 
set_from_resource(&self, resource_path: Option<&str>)333     fn set_from_resource(&self, resource_path: Option<&str>) {
334         unsafe {
335             ffi::gtk_image_set_from_resource(
336                 self.as_ref().to_glib_none().0,
337                 resource_path.to_glib_none().0,
338             );
339         }
340     }
341 
set_from_surface(&self, surface: Option<&cairo::Surface>)342     fn set_from_surface(&self, surface: Option<&cairo::Surface>) {
343         unsafe {
344             ffi::gtk_image_set_from_surface(
345                 self.as_ref().to_glib_none().0,
346                 mut_override(surface.to_glib_none().0),
347             );
348         }
349     }
350 
set_pixel_size(&self, pixel_size: i32)351     fn set_pixel_size(&self, pixel_size: i32) {
352         unsafe {
353             ffi::gtk_image_set_pixel_size(self.as_ref().to_glib_none().0, pixel_size);
354         }
355     }
356 
file(&self) -> Option<glib::GString>357     fn file(&self) -> Option<glib::GString> {
358         unsafe {
359             let mut value = glib::Value::from_type(<glib::GString as StaticType>::static_type());
360             glib::gobject_ffi::g_object_get_property(
361                 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
362                 b"file\0".as_ptr() as *const _,
363                 value.to_glib_none_mut().0,
364             );
365             value
366                 .get()
367                 .expect("Return Value for property `file` getter")
368         }
369     }
370 
set_file(&self, file: Option<&str>)371     fn set_file(&self, file: Option<&str>) {
372         unsafe {
373             glib::gobject_ffi::g_object_set_property(
374                 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
375                 b"file\0".as_ptr() as *const _,
376                 file.to_value().to_glib_none().0,
377             );
378         }
379     }
380 
set_gicon<P: IsA<gio::Icon>>(&self, gicon: Option<&P>)381     fn set_gicon<P: IsA<gio::Icon>>(&self, gicon: Option<&P>) {
382         unsafe {
383             glib::gobject_ffi::g_object_set_property(
384                 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
385                 b"gicon\0".as_ptr() as *const _,
386                 gicon.to_value().to_glib_none().0,
387             );
388         }
389     }
390 
icon_name(&self) -> Option<glib::GString>391     fn icon_name(&self) -> Option<glib::GString> {
392         unsafe {
393             let mut value = glib::Value::from_type(<glib::GString as StaticType>::static_type());
394             glib::gobject_ffi::g_object_get_property(
395                 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
396                 b"icon-name\0".as_ptr() as *const _,
397                 value.to_glib_none_mut().0,
398             );
399             value
400                 .get()
401                 .expect("Return Value for property `icon-name` getter")
402         }
403     }
404 
set_icon_name(&self, icon_name: Option<&str>)405     fn set_icon_name(&self, icon_name: Option<&str>) {
406         unsafe {
407             glib::gobject_ffi::g_object_set_property(
408                 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
409                 b"icon-name\0".as_ptr() as *const _,
410                 icon_name.to_value().to_glib_none().0,
411             );
412         }
413     }
414 
set_pixbuf(&self, pixbuf: Option<&gdk_pixbuf::Pixbuf>)415     fn set_pixbuf(&self, pixbuf: Option<&gdk_pixbuf::Pixbuf>) {
416         unsafe {
417             glib::gobject_ffi::g_object_set_property(
418                 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
419                 b"pixbuf\0".as_ptr() as *const _,
420                 pixbuf.to_value().to_glib_none().0,
421             );
422         }
423     }
424 
pixbuf_animation(&self) -> Option<gdk_pixbuf::PixbufAnimation>425     fn pixbuf_animation(&self) -> Option<gdk_pixbuf::PixbufAnimation> {
426         unsafe {
427             let mut value =
428                 glib::Value::from_type(<gdk_pixbuf::PixbufAnimation as StaticType>::static_type());
429             glib::gobject_ffi::g_object_get_property(
430                 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
431                 b"pixbuf-animation\0".as_ptr() as *const _,
432                 value.to_glib_none_mut().0,
433             );
434             value
435                 .get()
436                 .expect("Return Value for property `pixbuf-animation` getter")
437         }
438     }
439 
set_pixbuf_animation<P: IsA<gdk_pixbuf::PixbufAnimation>>( &self, pixbuf_animation: Option<&P>, )440     fn set_pixbuf_animation<P: IsA<gdk_pixbuf::PixbufAnimation>>(
441         &self,
442         pixbuf_animation: Option<&P>,
443     ) {
444         unsafe {
445             glib::gobject_ffi::g_object_set_property(
446                 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
447                 b"pixbuf-animation\0".as_ptr() as *const _,
448                 pixbuf_animation.to_value().to_glib_none().0,
449             );
450         }
451     }
452 
resource(&self) -> Option<glib::GString>453     fn resource(&self) -> Option<glib::GString> {
454         unsafe {
455             let mut value = glib::Value::from_type(<glib::GString as StaticType>::static_type());
456             glib::gobject_ffi::g_object_get_property(
457                 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
458                 b"resource\0".as_ptr() as *const _,
459                 value.to_glib_none_mut().0,
460             );
461             value
462                 .get()
463                 .expect("Return Value for property `resource` getter")
464         }
465     }
466 
set_resource(&self, resource: Option<&str>)467     fn set_resource(&self, resource: Option<&str>) {
468         unsafe {
469             glib::gobject_ffi::g_object_set_property(
470                 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
471                 b"resource\0".as_ptr() as *const _,
472                 resource.to_value().to_glib_none().0,
473             );
474         }
475     }
476 
surface(&self) -> Option<cairo::Surface>477     fn surface(&self) -> Option<cairo::Surface> {
478         unsafe {
479             let mut value = glib::Value::from_type(<cairo::Surface as StaticType>::static_type());
480             glib::gobject_ffi::g_object_get_property(
481                 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
482                 b"surface\0".as_ptr() as *const _,
483                 value.to_glib_none_mut().0,
484             );
485             value
486                 .get()
487                 .expect("Return Value for property `surface` getter")
488         }
489     }
490 
set_surface(&self, surface: Option<&cairo::Surface>)491     fn set_surface(&self, surface: Option<&cairo::Surface>) {
492         unsafe {
493             glib::gobject_ffi::g_object_set_property(
494                 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
495                 b"surface\0".as_ptr() as *const _,
496                 surface.to_value().to_glib_none().0,
497             );
498         }
499     }
500 
uses_fallback(&self) -> bool501     fn uses_fallback(&self) -> bool {
502         unsafe {
503             let mut value = glib::Value::from_type(<bool as StaticType>::static_type());
504             glib::gobject_ffi::g_object_get_property(
505                 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
506                 b"use-fallback\0".as_ptr() as *const _,
507                 value.to_glib_none_mut().0,
508             );
509             value
510                 .get()
511                 .expect("Return Value for property `use-fallback` getter")
512         }
513     }
514 
set_use_fallback(&self, use_fallback: bool)515     fn set_use_fallback(&self, use_fallback: bool) {
516         unsafe {
517             glib::gobject_ffi::g_object_set_property(
518                 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
519                 b"use-fallback\0".as_ptr() as *const _,
520                 use_fallback.to_value().to_glib_none().0,
521             );
522         }
523     }
524 
connect_file_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId525     fn connect_file_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
526         unsafe extern "C" fn notify_file_trampoline<P: IsA<Image>, F: Fn(&P) + 'static>(
527             this: *mut ffi::GtkImage,
528             _param_spec: glib::ffi::gpointer,
529             f: glib::ffi::gpointer,
530         ) {
531             let f: &F = &*(f as *const F);
532             f(Image::from_glib_borrow(this).unsafe_cast_ref())
533         }
534         unsafe {
535             let f: Box_<F> = Box_::new(f);
536             connect_raw(
537                 self.as_ptr() as *mut _,
538                 b"notify::file\0".as_ptr() as *const _,
539                 Some(transmute::<_, unsafe extern "C" fn()>(
540                     notify_file_trampoline::<Self, F> as *const (),
541                 )),
542                 Box_::into_raw(f),
543             )
544         }
545     }
546 
connect_gicon_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId547     fn connect_gicon_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
548         unsafe extern "C" fn notify_gicon_trampoline<P: IsA<Image>, F: Fn(&P) + 'static>(
549             this: *mut ffi::GtkImage,
550             _param_spec: glib::ffi::gpointer,
551             f: glib::ffi::gpointer,
552         ) {
553             let f: &F = &*(f as *const F);
554             f(Image::from_glib_borrow(this).unsafe_cast_ref())
555         }
556         unsafe {
557             let f: Box_<F> = Box_::new(f);
558             connect_raw(
559                 self.as_ptr() as *mut _,
560                 b"notify::gicon\0".as_ptr() as *const _,
561                 Some(transmute::<_, unsafe extern "C" fn()>(
562                     notify_gicon_trampoline::<Self, F> as *const (),
563                 )),
564                 Box_::into_raw(f),
565             )
566         }
567     }
568 
connect_icon_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId569     fn connect_icon_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
570         unsafe extern "C" fn notify_icon_name_trampoline<P: IsA<Image>, F: Fn(&P) + 'static>(
571             this: *mut ffi::GtkImage,
572             _param_spec: glib::ffi::gpointer,
573             f: glib::ffi::gpointer,
574         ) {
575             let f: &F = &*(f as *const F);
576             f(Image::from_glib_borrow(this).unsafe_cast_ref())
577         }
578         unsafe {
579             let f: Box_<F> = Box_::new(f);
580             connect_raw(
581                 self.as_ptr() as *mut _,
582                 b"notify::icon-name\0".as_ptr() as *const _,
583                 Some(transmute::<_, unsafe extern "C" fn()>(
584                     notify_icon_name_trampoline::<Self, F> as *const (),
585                 )),
586                 Box_::into_raw(f),
587             )
588         }
589     }
590 
connect_pixbuf_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId591     fn connect_pixbuf_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
592         unsafe extern "C" fn notify_pixbuf_trampoline<P: IsA<Image>, F: Fn(&P) + 'static>(
593             this: *mut ffi::GtkImage,
594             _param_spec: glib::ffi::gpointer,
595             f: glib::ffi::gpointer,
596         ) {
597             let f: &F = &*(f as *const F);
598             f(Image::from_glib_borrow(this).unsafe_cast_ref())
599         }
600         unsafe {
601             let f: Box_<F> = Box_::new(f);
602             connect_raw(
603                 self.as_ptr() as *mut _,
604                 b"notify::pixbuf\0".as_ptr() as *const _,
605                 Some(transmute::<_, unsafe extern "C" fn()>(
606                     notify_pixbuf_trampoline::<Self, F> as *const (),
607                 )),
608                 Box_::into_raw(f),
609             )
610         }
611     }
612 
connect_pixbuf_animation_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId613     fn connect_pixbuf_animation_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
614         unsafe extern "C" fn notify_pixbuf_animation_trampoline<
615             P: IsA<Image>,
616             F: Fn(&P) + 'static,
617         >(
618             this: *mut ffi::GtkImage,
619             _param_spec: glib::ffi::gpointer,
620             f: glib::ffi::gpointer,
621         ) {
622             let f: &F = &*(f as *const F);
623             f(Image::from_glib_borrow(this).unsafe_cast_ref())
624         }
625         unsafe {
626             let f: Box_<F> = Box_::new(f);
627             connect_raw(
628                 self.as_ptr() as *mut _,
629                 b"notify::pixbuf-animation\0".as_ptr() as *const _,
630                 Some(transmute::<_, unsafe extern "C" fn()>(
631                     notify_pixbuf_animation_trampoline::<Self, F> as *const (),
632                 )),
633                 Box_::into_raw(f),
634             )
635         }
636     }
637 
connect_pixel_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId638     fn connect_pixel_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
639         unsafe extern "C" fn notify_pixel_size_trampoline<P: IsA<Image>, F: Fn(&P) + 'static>(
640             this: *mut ffi::GtkImage,
641             _param_spec: glib::ffi::gpointer,
642             f: glib::ffi::gpointer,
643         ) {
644             let f: &F = &*(f as *const F);
645             f(Image::from_glib_borrow(this).unsafe_cast_ref())
646         }
647         unsafe {
648             let f: Box_<F> = Box_::new(f);
649             connect_raw(
650                 self.as_ptr() as *mut _,
651                 b"notify::pixel-size\0".as_ptr() as *const _,
652                 Some(transmute::<_, unsafe extern "C" fn()>(
653                     notify_pixel_size_trampoline::<Self, F> as *const (),
654                 )),
655                 Box_::into_raw(f),
656             )
657         }
658     }
659 
connect_resource_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId660     fn connect_resource_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
661         unsafe extern "C" fn notify_resource_trampoline<P: IsA<Image>, F: Fn(&P) + 'static>(
662             this: *mut ffi::GtkImage,
663             _param_spec: glib::ffi::gpointer,
664             f: glib::ffi::gpointer,
665         ) {
666             let f: &F = &*(f as *const F);
667             f(Image::from_glib_borrow(this).unsafe_cast_ref())
668         }
669         unsafe {
670             let f: Box_<F> = Box_::new(f);
671             connect_raw(
672                 self.as_ptr() as *mut _,
673                 b"notify::resource\0".as_ptr() as *const _,
674                 Some(transmute::<_, unsafe extern "C" fn()>(
675                     notify_resource_trampoline::<Self, F> as *const (),
676                 )),
677                 Box_::into_raw(f),
678             )
679         }
680     }
681 
connect_storage_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId682     fn connect_storage_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
683         unsafe extern "C" fn notify_storage_type_trampoline<P: IsA<Image>, F: Fn(&P) + 'static>(
684             this: *mut ffi::GtkImage,
685             _param_spec: glib::ffi::gpointer,
686             f: glib::ffi::gpointer,
687         ) {
688             let f: &F = &*(f as *const F);
689             f(Image::from_glib_borrow(this).unsafe_cast_ref())
690         }
691         unsafe {
692             let f: Box_<F> = Box_::new(f);
693             connect_raw(
694                 self.as_ptr() as *mut _,
695                 b"notify::storage-type\0".as_ptr() as *const _,
696                 Some(transmute::<_, unsafe extern "C" fn()>(
697                     notify_storage_type_trampoline::<Self, F> as *const (),
698                 )),
699                 Box_::into_raw(f),
700             )
701         }
702     }
703 
connect_surface_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId704     fn connect_surface_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
705         unsafe extern "C" fn notify_surface_trampoline<P: IsA<Image>, F: Fn(&P) + 'static>(
706             this: *mut ffi::GtkImage,
707             _param_spec: glib::ffi::gpointer,
708             f: glib::ffi::gpointer,
709         ) {
710             let f: &F = &*(f as *const F);
711             f(Image::from_glib_borrow(this).unsafe_cast_ref())
712         }
713         unsafe {
714             let f: Box_<F> = Box_::new(f);
715             connect_raw(
716                 self.as_ptr() as *mut _,
717                 b"notify::surface\0".as_ptr() as *const _,
718                 Some(transmute::<_, unsafe extern "C" fn()>(
719                     notify_surface_trampoline::<Self, F> as *const (),
720                 )),
721                 Box_::into_raw(f),
722             )
723         }
724     }
725 
connect_use_fallback_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId726     fn connect_use_fallback_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
727         unsafe extern "C" fn notify_use_fallback_trampoline<P: IsA<Image>, F: Fn(&P) + 'static>(
728             this: *mut ffi::GtkImage,
729             _param_spec: glib::ffi::gpointer,
730             f: glib::ffi::gpointer,
731         ) {
732             let f: &F = &*(f as *const F);
733             f(Image::from_glib_borrow(this).unsafe_cast_ref())
734         }
735         unsafe {
736             let f: Box_<F> = Box_::new(f);
737             connect_raw(
738                 self.as_ptr() as *mut _,
739                 b"notify::use-fallback\0".as_ptr() as *const _,
740                 Some(transmute::<_, unsafe extern "C" fn()>(
741                     notify_use_fallback_trampoline::<Self, F> as *const (),
742                 )),
743                 Box_::into_raw(f),
744             )
745         }
746     }
747 }
748 
749 impl fmt::Display for Image {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result750     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
751         f.write_str("Image")
752     }
753 }
754