Skip to main content

gtk/auto/
icon_info.rs

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
5use crate::{IconTheme, StyleContext};
6use glib::{prelude::*, translate::*};
7use std::{boxed::Box as Box_, fmt, mem, pin::Pin, ptr};
8
9glib::wrapper! {
10    /// Contains information found when looking up an icon in
11    /// an icon theme.
12    ///
13    /// # Implements
14    ///
15    /// [`trait@glib::ObjectExt`]
16    #[doc(alias = "GtkIconInfo")]
17    pub struct IconInfo(Object<ffi::GtkIconInfo, ffi::GtkIconInfoClass>);
18
19    match fn {
20        type_ => || ffi::gtk_icon_info_get_type(),
21    }
22}
23
24impl IconInfo {
25    /// Creates a [`IconInfo`][crate::IconInfo] for a [`gdk_pixbuf::Pixbuf`][crate::gdk_pixbuf::Pixbuf].
26    /// ## `icon_theme`
27    /// a [`IconTheme`][crate::IconTheme]
28    /// ## `pixbuf`
29    /// the pixbuf to wrap in a [`IconInfo`][crate::IconInfo]
30    ///
31    /// # Returns
32    ///
33    /// a [`IconInfo`][crate::IconInfo]
34    #[doc(alias = "gtk_icon_info_new_for_pixbuf")]
35    #[doc(alias = "new_for_pixbuf")]
36    pub fn for_pixbuf(icon_theme: &impl IsA<IconTheme>, pixbuf: &gdk_pixbuf::Pixbuf) -> IconInfo {
37        skip_assert_initialized!();
38        unsafe {
39            from_glib_full(ffi::gtk_icon_info_new_for_pixbuf(
40                icon_theme.as_ref().to_glib_none().0,
41                pixbuf.to_glib_none().0,
42            ))
43        }
44    }
45
46    /// Gets the base scale for the icon. The base scale is a scale
47    /// for the icon that was specified by the icon theme creator.
48    /// For instance an icon drawn for a high-dpi screen with window
49    /// scale 2 for a base size of 32 will be 64 pixels tall and have
50    /// a base scale of 2.
51    ///
52    /// # Returns
53    ///
54    /// the base scale
55    #[doc(alias = "gtk_icon_info_get_base_scale")]
56    #[doc(alias = "get_base_scale")]
57    pub fn base_scale(&self) -> i32 {
58        unsafe { ffi::gtk_icon_info_get_base_scale(self.to_glib_none().0) }
59    }
60
61    /// Gets the base size for the icon. The base size
62    /// is a size for the icon that was specified by
63    /// the icon theme creator. This may be different
64    /// than the actual size of image; an example of
65    /// this is small emblem icons that can be attached
66    /// to a larger icon. These icons will be given
67    /// the same base size as the larger icons to which
68    /// they are attached.
69    ///
70    /// Note that for scaled icons the base size does
71    /// not include the base scale.
72    ///
73    /// # Returns
74    ///
75    /// the base size, or 0, if no base
76    ///  size is known for the icon.
77    #[doc(alias = "gtk_icon_info_get_base_size")]
78    #[doc(alias = "get_base_size")]
79    pub fn base_size(&self) -> i32 {
80        unsafe { ffi::gtk_icon_info_get_base_size(self.to_glib_none().0) }
81    }
82
83    /// Gets the filename for the icon. If the [`IconLookupFlags::USE_BUILTIN`][crate::IconLookupFlags::USE_BUILTIN]
84    /// flag was passed to [`IconThemeExt::lookup_icon()`][crate::prelude::IconThemeExt::lookup_icon()], there may be no
85    /// filename if a builtin icon is returned; in this case, you should
86    /// use `gtk_icon_info_get_builtin_pixbuf()`.
87    ///
88    /// # Returns
89    ///
90    /// the filename for the icon, or [`None`]
91    ///  if `gtk_icon_info_get_builtin_pixbuf()` should be used instead.
92    ///  The return value is owned by GTK+ and should not be modified
93    ///  or freed.
94    #[doc(alias = "gtk_icon_info_get_filename")]
95    #[doc(alias = "get_filename")]
96    pub fn filename(&self) -> Option<std::path::PathBuf> {
97        unsafe { from_glib_none(ffi::gtk_icon_info_get_filename(self.to_glib_none().0)) }
98    }
99
100    /// Checks if the icon is symbolic or not. This currently uses only
101    /// the file name and not the file contents for determining this.
102    /// This behaviour may change in the future.
103    ///
104    /// # Returns
105    ///
106    /// [`true`] if the icon is symbolic, [`false`] otherwise
107    #[doc(alias = "gtk_icon_info_is_symbolic")]
108    pub fn is_symbolic(&self) -> bool {
109        unsafe { from_glib(ffi::gtk_icon_info_is_symbolic(self.to_glib_none().0)) }
110    }
111
112    /// Renders an icon previously looked up in an icon theme using
113    /// [`IconThemeExt::lookup_icon()`][crate::prelude::IconThemeExt::lookup_icon()]; the size will be based on the size
114    /// passed to [`IconThemeExt::lookup_icon()`][crate::prelude::IconThemeExt::lookup_icon()]. Note that the resulting
115    /// pixbuf may not be exactly this size; an icon theme may have icons
116    /// that differ slightly from their nominal sizes, and in addition GTK+
117    /// will avoid scaling icons that it considers sufficiently close to the
118    /// requested size or for which the source image would have to be scaled
119    /// up too far. (This maintains sharpness.). This behaviour can be changed
120    /// by passing the [`IconLookupFlags::FORCE_SIZE`][crate::IconLookupFlags::FORCE_SIZE] flag when obtaining
121    /// the [`IconInfo`][crate::IconInfo]. If this flag has been specified, the pixbuf
122    /// returned by this function will be scaled to the exact size.
123    ///
124    /// # Returns
125    ///
126    /// the rendered icon; this may be a newly
127    ///  created icon or a new reference to an internal icon, so you must
128    ///  not modify the icon. Use `g_object_unref()` to release your reference
129    ///  to the icon.
130    #[doc(alias = "gtk_icon_info_load_icon")]
131    pub fn load_icon(&self) -> Result<gdk_pixbuf::Pixbuf, glib::Error> {
132        unsafe {
133            let mut error = ptr::null_mut();
134            let ret = ffi::gtk_icon_info_load_icon(self.to_glib_none().0, &mut error);
135            if error.is_null() {
136                Ok(from_glib_full(ret))
137            } else {
138                Err(from_glib_full(error))
139            }
140        }
141    }
142
143    /// Asynchronously load, render and scale an icon previously looked up
144    /// from the icon theme using [`IconThemeExt::lookup_icon()`][crate::prelude::IconThemeExt::lookup_icon()].
145    ///
146    /// For more details, see [`load_icon()`][Self::load_icon()] which is the synchronous
147    /// version of this call.
148    /// ## `cancellable`
149    /// optional [`gio::Cancellable`][crate::gio::Cancellable] object, [`None`] to ignore
150    /// ## `callback`
151    /// a `GAsyncReadyCallback` to call when the
152    ///  request is satisfied
153    #[doc(alias = "gtk_icon_info_load_icon_async")]
154    pub fn load_icon_async<P: FnOnce(Result<gdk_pixbuf::Pixbuf, glib::Error>) + 'static>(
155        &self,
156        cancellable: Option<&impl IsA<gio::Cancellable>>,
157        callback: P,
158    ) {
159        let main_context = glib::MainContext::ref_thread_default();
160        let is_main_context_owner = main_context.is_owner();
161        let has_acquired_main_context = (!is_main_context_owner)
162            .then(|| main_context.acquire().ok())
163            .flatten();
164        assert!(
165            is_main_context_owner || has_acquired_main_context.is_some(),
166            "Async operations only allowed if the thread is owning the MainContext"
167        );
168
169        let user_data: Box_<glib::thread_guard::ThreadGuard<P>> =
170            Box_::new(glib::thread_guard::ThreadGuard::new(callback));
171        unsafe extern "C" fn load_icon_async_trampoline<
172            P: FnOnce(Result<gdk_pixbuf::Pixbuf, glib::Error>) + 'static,
173        >(
174            _source_object: *mut glib::gobject_ffi::GObject,
175            res: *mut gio::ffi::GAsyncResult,
176            user_data: glib::ffi::gpointer,
177        ) {
178            let mut error = ptr::null_mut();
179            let ret =
180                ffi::gtk_icon_info_load_icon_finish(_source_object as *mut _, res, &mut error);
181            let result = if error.is_null() {
182                Ok(from_glib_full(ret))
183            } else {
184                Err(from_glib_full(error))
185            };
186            let callback: Box_<glib::thread_guard::ThreadGuard<P>> =
187                Box_::from_raw(user_data as *mut _);
188            let callback: P = callback.into_inner();
189            callback(result);
190        }
191        let callback = load_icon_async_trampoline::<P>;
192        unsafe {
193            ffi::gtk_icon_info_load_icon_async(
194                self.to_glib_none().0,
195                cancellable.map(|p| p.as_ref()).to_glib_none().0,
196                Some(callback),
197                Box_::into_raw(user_data) as *mut _,
198            );
199        }
200    }
201
202    pub fn load_icon_future(
203        &self,
204    ) -> Pin<
205        Box_<dyn std::future::Future<Output = Result<gdk_pixbuf::Pixbuf, glib::Error>> + 'static>,
206    > {
207        Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| {
208            obj.load_icon_async(Some(cancellable), move |res| {
209                send.resolve(res);
210            });
211        }))
212    }
213
214    /// Renders an icon previously looked up in an icon theme using
215    /// [`IconThemeExt::lookup_icon()`][crate::prelude::IconThemeExt::lookup_icon()]; the size will be based on the size
216    /// passed to [`IconThemeExt::lookup_icon()`][crate::prelude::IconThemeExt::lookup_icon()]. Note that the resulting
217    /// surface may not be exactly this size; an icon theme may have icons
218    /// that differ slightly from their nominal sizes, and in addition GTK+
219    /// will avoid scaling icons that it considers sufficiently close to the
220    /// requested size or for which the source image would have to be scaled
221    /// up too far. (This maintains sharpness.). This behaviour can be changed
222    /// by passing the [`IconLookupFlags::FORCE_SIZE`][crate::IconLookupFlags::FORCE_SIZE] flag when obtaining
223    /// the [`IconInfo`][crate::IconInfo]. If this flag has been specified, the pixbuf
224    /// returned by this function will be scaled to the exact size.
225    /// ## `for_window`
226    /// [`gdk::Window`][crate::gdk::Window] to optimize drawing for, or [`None`]
227    ///
228    /// # Returns
229    ///
230    /// the rendered icon; this may be a newly
231    ///  created icon or a new reference to an internal icon, so you must
232    ///  not modify the icon. Use `cairo_surface_destroy()` to release your
233    ///  reference to the icon.
234    #[doc(alias = "gtk_icon_info_load_surface")]
235    pub fn load_surface(
236        &self,
237        for_window: Option<&gdk::Window>,
238    ) -> Result<cairo::Surface, glib::Error> {
239        unsafe {
240            let mut error = ptr::null_mut();
241            let ret = ffi::gtk_icon_info_load_surface(
242                self.to_glib_none().0,
243                for_window.to_glib_none().0,
244                &mut error,
245            );
246            if error.is_null() {
247                Ok(from_glib_full(ret))
248            } else {
249                Err(from_glib_full(error))
250            }
251        }
252    }
253
254    /// Loads an icon, modifying it to match the system colours for the foreground,
255    /// success, warning and error colors provided. If the icon is not a symbolic
256    /// one, the function will return the result from [`load_icon()`][Self::load_icon()].
257    ///
258    /// This allows loading symbolic icons that will match the system theme.
259    ///
260    /// Unless you are implementing a widget, you will want to use
261    /// `g_themed_icon_new_with_default_fallbacks()` to load the icon.
262    ///
263    /// As implementation details, the icon loaded needs to be of SVG type,
264    /// contain the “symbolic” term as the last component of the icon name,
265    /// and use the “fg”, “success”, “warning” and “error” CSS styles in the
266    /// SVG file itself.
267    ///
268    /// See the [Symbolic Icons Specification](http://www.freedesktop.org/wiki/SymbolicIcons)
269    /// for more information about symbolic icons.
270    /// ## `fg`
271    /// a [`gdk::RGBA`][crate::gdk::RGBA] representing the foreground color of the icon
272    /// ## `success_color`
273    /// a [`gdk::RGBA`][crate::gdk::RGBA] representing the warning color
274    ///  of the icon or [`None`] to use the default color
275    /// ## `warning_color`
276    /// a [`gdk::RGBA`][crate::gdk::RGBA] representing the warning color
277    ///  of the icon or [`None`] to use the default color
278    /// ## `error_color`
279    /// a [`gdk::RGBA`][crate::gdk::RGBA] representing the error color
280    ///  of the icon or [`None`] to use the default color (allow-none)
281    ///
282    /// # Returns
283    ///
284    /// a [`gdk_pixbuf::Pixbuf`][crate::gdk_pixbuf::Pixbuf] representing the loaded icon
285    ///
286    /// ## `was_symbolic`
287    /// a `gboolean`, returns whether the
288    ///  loaded icon was a symbolic one and whether the `fg` color was
289    ///  applied to it.
290    #[doc(alias = "gtk_icon_info_load_symbolic")]
291    pub fn load_symbolic(
292        &self,
293        fg: &gdk::RGBA,
294        success_color: Option<&gdk::RGBA>,
295        warning_color: Option<&gdk::RGBA>,
296        error_color: Option<&gdk::RGBA>,
297    ) -> Result<(gdk_pixbuf::Pixbuf, bool), glib::Error> {
298        unsafe {
299            let mut was_symbolic = mem::MaybeUninit::uninit();
300            let mut error = ptr::null_mut();
301            let ret = ffi::gtk_icon_info_load_symbolic(
302                self.to_glib_none().0,
303                fg.to_glib_none().0,
304                success_color.to_glib_none().0,
305                warning_color.to_glib_none().0,
306                error_color.to_glib_none().0,
307                was_symbolic.as_mut_ptr(),
308                &mut error,
309            );
310            if error.is_null() {
311                Ok((from_glib_full(ret), from_glib(was_symbolic.assume_init())))
312            } else {
313                Err(from_glib_full(error))
314            }
315        }
316    }
317
318    /// Asynchronously load, render and scale a symbolic icon previously looked up
319    /// from the icon theme using [`IconThemeExt::lookup_icon()`][crate::prelude::IconThemeExt::lookup_icon()].
320    ///
321    /// For more details, see [`load_symbolic()`][Self::load_symbolic()] which is the synchronous
322    /// version of this call.
323    /// ## `fg`
324    /// a [`gdk::RGBA`][crate::gdk::RGBA] representing the foreground color of the icon
325    /// ## `success_color`
326    /// a [`gdk::RGBA`][crate::gdk::RGBA] representing the warning color
327    ///  of the icon or [`None`] to use the default color
328    /// ## `warning_color`
329    /// a [`gdk::RGBA`][crate::gdk::RGBA] representing the warning color
330    ///  of the icon or [`None`] to use the default color
331    /// ## `error_color`
332    /// a [`gdk::RGBA`][crate::gdk::RGBA] representing the error color
333    ///  of the icon or [`None`] to use the default color (allow-none)
334    /// ## `cancellable`
335    /// optional [`gio::Cancellable`][crate::gio::Cancellable] object,
336    ///  [`None`] to ignore
337    /// ## `callback`
338    /// a `GAsyncReadyCallback` to call when the
339    ///  request is satisfied
340    #[doc(alias = "gtk_icon_info_load_symbolic_async")]
341    pub fn load_symbolic_async<
342        P: FnOnce(Result<(gdk_pixbuf::Pixbuf, bool), glib::Error>) + 'static,
343    >(
344        &self,
345        fg: &gdk::RGBA,
346        success_color: Option<&gdk::RGBA>,
347        warning_color: Option<&gdk::RGBA>,
348        error_color: Option<&gdk::RGBA>,
349        cancellable: Option<&impl IsA<gio::Cancellable>>,
350        callback: P,
351    ) {
352        let main_context = glib::MainContext::ref_thread_default();
353        let is_main_context_owner = main_context.is_owner();
354        let has_acquired_main_context = (!is_main_context_owner)
355            .then(|| main_context.acquire().ok())
356            .flatten();
357        assert!(
358            is_main_context_owner || has_acquired_main_context.is_some(),
359            "Async operations only allowed if the thread is owning the MainContext"
360        );
361
362        let user_data: Box_<glib::thread_guard::ThreadGuard<P>> =
363            Box_::new(glib::thread_guard::ThreadGuard::new(callback));
364        unsafe extern "C" fn load_symbolic_async_trampoline<
365            P: FnOnce(Result<(gdk_pixbuf::Pixbuf, bool), glib::Error>) + 'static,
366        >(
367            _source_object: *mut glib::gobject_ffi::GObject,
368            res: *mut gio::ffi::GAsyncResult,
369            user_data: glib::ffi::gpointer,
370        ) {
371            let mut error = ptr::null_mut();
372            let mut was_symbolic = mem::MaybeUninit::uninit();
373            let ret = ffi::gtk_icon_info_load_symbolic_finish(
374                _source_object as *mut _,
375                res,
376                was_symbolic.as_mut_ptr(),
377                &mut error,
378            );
379            let result = if error.is_null() {
380                Ok((from_glib_full(ret), from_glib(was_symbolic.assume_init())))
381            } else {
382                Err(from_glib_full(error))
383            };
384            let callback: Box_<glib::thread_guard::ThreadGuard<P>> =
385                Box_::from_raw(user_data as *mut _);
386            let callback: P = callback.into_inner();
387            callback(result);
388        }
389        let callback = load_symbolic_async_trampoline::<P>;
390        unsafe {
391            ffi::gtk_icon_info_load_symbolic_async(
392                self.to_glib_none().0,
393                fg.to_glib_none().0,
394                success_color.to_glib_none().0,
395                warning_color.to_glib_none().0,
396                error_color.to_glib_none().0,
397                cancellable.map(|p| p.as_ref()).to_glib_none().0,
398                Some(callback),
399                Box_::into_raw(user_data) as *mut _,
400            );
401        }
402    }
403
404    pub fn load_symbolic_future(
405        &self,
406        fg: &gdk::RGBA,
407        success_color: Option<&gdk::RGBA>,
408        warning_color: Option<&gdk::RGBA>,
409        error_color: Option<&gdk::RGBA>,
410    ) -> Pin<
411        Box_<
412            dyn std::future::Future<Output = Result<(gdk_pixbuf::Pixbuf, bool), glib::Error>>
413                + 'static,
414        >,
415    > {
416        let fg = fg.clone();
417        let success_color = success_color.map(ToOwned::to_owned);
418        let warning_color = warning_color.map(ToOwned::to_owned);
419        let error_color = error_color.map(ToOwned::to_owned);
420        Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| {
421            obj.load_symbolic_async(
422                &fg,
423                success_color.as_ref().map(::std::borrow::Borrow::borrow),
424                warning_color.as_ref().map(::std::borrow::Borrow::borrow),
425                error_color.as_ref().map(::std::borrow::Borrow::borrow),
426                Some(cancellable),
427                move |res| {
428                    send.resolve(res);
429                },
430            );
431        }))
432    }
433
434    /// Loads an icon, modifying it to match the system colors for the foreground,
435    /// success, warning and error colors provided. If the icon is not a symbolic
436    /// one, the function will return the result from [`load_icon()`][Self::load_icon()].
437    /// This function uses the regular foreground color and the symbolic colors
438    /// with the names “success_color”, “warning_color” and “error_color” from
439    /// the context.
440    ///
441    /// This allows loading symbolic icons that will match the system theme.
442    ///
443    /// See [`load_symbolic()`][Self::load_symbolic()] for more details.
444    /// ## `context`
445    /// a [`StyleContext`][crate::StyleContext]
446    ///
447    /// # Returns
448    ///
449    /// a [`gdk_pixbuf::Pixbuf`][crate::gdk_pixbuf::Pixbuf] representing the loaded icon
450    ///
451    /// ## `was_symbolic`
452    /// a `gboolean`, returns whether the
453    ///  loaded icon was a symbolic one and whether the `fg` color was
454    ///  applied to it.
455    #[doc(alias = "gtk_icon_info_load_symbolic_for_context")]
456    pub fn load_symbolic_for_context(
457        &self,
458        context: &impl IsA<StyleContext>,
459    ) -> Result<(gdk_pixbuf::Pixbuf, bool), glib::Error> {
460        unsafe {
461            let mut was_symbolic = mem::MaybeUninit::uninit();
462            let mut error = ptr::null_mut();
463            let ret = ffi::gtk_icon_info_load_symbolic_for_context(
464                self.to_glib_none().0,
465                context.as_ref().to_glib_none().0,
466                was_symbolic.as_mut_ptr(),
467                &mut error,
468            );
469            if error.is_null() {
470                Ok((from_glib_full(ret), from_glib(was_symbolic.assume_init())))
471            } else {
472                Err(from_glib_full(error))
473            }
474        }
475    }
476
477    /// Asynchronously load, render and scale a symbolic icon previously
478    /// looked up from the icon theme using [`IconThemeExt::lookup_icon()`][crate::prelude::IconThemeExt::lookup_icon()].
479    ///
480    /// For more details, see [`load_symbolic_for_context()`][Self::load_symbolic_for_context()]
481    /// which is the synchronous version of this call.
482    /// ## `context`
483    /// a [`StyleContext`][crate::StyleContext]
484    /// ## `cancellable`
485    /// optional [`gio::Cancellable`][crate::gio::Cancellable] object,
486    ///  [`None`] to ignore
487    /// ## `callback`
488    /// a `GAsyncReadyCallback` to call when the
489    ///  request is satisfied
490    #[doc(alias = "gtk_icon_info_load_symbolic_for_context_async")]
491    pub fn load_symbolic_for_context_async<
492        P: FnOnce(Result<(gdk_pixbuf::Pixbuf, bool), glib::Error>) + 'static,
493    >(
494        &self,
495        context: &impl IsA<StyleContext>,
496        cancellable: Option<&impl IsA<gio::Cancellable>>,
497        callback: P,
498    ) {
499        let main_context = glib::MainContext::ref_thread_default();
500        let is_main_context_owner = main_context.is_owner();
501        let has_acquired_main_context = (!is_main_context_owner)
502            .then(|| main_context.acquire().ok())
503            .flatten();
504        assert!(
505            is_main_context_owner || has_acquired_main_context.is_some(),
506            "Async operations only allowed if the thread is owning the MainContext"
507        );
508
509        let user_data: Box_<glib::thread_guard::ThreadGuard<P>> =
510            Box_::new(glib::thread_guard::ThreadGuard::new(callback));
511        unsafe extern "C" fn load_symbolic_for_context_async_trampoline<
512            P: FnOnce(Result<(gdk_pixbuf::Pixbuf, bool), glib::Error>) + 'static,
513        >(
514            _source_object: *mut glib::gobject_ffi::GObject,
515            res: *mut gio::ffi::GAsyncResult,
516            user_data: glib::ffi::gpointer,
517        ) {
518            let mut error = ptr::null_mut();
519            let mut was_symbolic = mem::MaybeUninit::uninit();
520            let ret = ffi::gtk_icon_info_load_symbolic_for_context_finish(
521                _source_object as *mut _,
522                res,
523                was_symbolic.as_mut_ptr(),
524                &mut error,
525            );
526            let result = if error.is_null() {
527                Ok((from_glib_full(ret), from_glib(was_symbolic.assume_init())))
528            } else {
529                Err(from_glib_full(error))
530            };
531            let callback: Box_<glib::thread_guard::ThreadGuard<P>> =
532                Box_::from_raw(user_data as *mut _);
533            let callback: P = callback.into_inner();
534            callback(result);
535        }
536        let callback = load_symbolic_for_context_async_trampoline::<P>;
537        unsafe {
538            ffi::gtk_icon_info_load_symbolic_for_context_async(
539                self.to_glib_none().0,
540                context.as_ref().to_glib_none().0,
541                cancellable.map(|p| p.as_ref()).to_glib_none().0,
542                Some(callback),
543                Box_::into_raw(user_data) as *mut _,
544            );
545        }
546    }
547
548    pub fn load_symbolic_for_context_future(
549        &self,
550        context: &(impl IsA<StyleContext> + Clone + 'static),
551    ) -> Pin<
552        Box_<
553            dyn std::future::Future<Output = Result<(gdk_pixbuf::Pixbuf, bool), glib::Error>>
554                + 'static,
555        >,
556    > {
557        let context = context.clone();
558        Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| {
559            obj.load_symbolic_for_context_async(&context, Some(cancellable), move |res| {
560                send.resolve(res);
561            });
562        }))
563    }
564}
565
566impl fmt::Display for IconInfo {
567    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
568        f.write_str("IconInfo")
569    }
570}