gdk/auto/
app_launch_context.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 gdk_sys;
6use gio;
7use glib::object::IsA;
8use glib::object::ObjectType as ObjectType_;
9use glib::translate::*;
10use glib::StaticType;
11use glib::Value;
12use gobject_sys;
13use std::fmt;
14use Display;
15use Screen;
16
17glib_wrapper! {
18    pub struct AppLaunchContext(Object<gdk_sys::GdkAppLaunchContext, AppLaunchContextClass>) @extends gio::AppLaunchContext;
19
20    match fn {
21        get_type => || gdk_sys::gdk_app_launch_context_get_type(),
22    }
23}
24
25impl AppLaunchContext {
26    pub fn set_desktop(&self, desktop: i32) {
27        unsafe {
28            gdk_sys::gdk_app_launch_context_set_desktop(self.to_glib_none().0, desktop);
29        }
30    }
31
32    pub fn set_icon<P: IsA<gio::Icon>>(&self, icon: Option<&P>) {
33        unsafe {
34            gdk_sys::gdk_app_launch_context_set_icon(
35                self.to_glib_none().0,
36                icon.map(|p| p.as_ref()).to_glib_none().0,
37            );
38        }
39    }
40
41    pub fn set_icon_name(&self, icon_name: Option<&str>) {
42        unsafe {
43            gdk_sys::gdk_app_launch_context_set_icon_name(
44                self.to_glib_none().0,
45                icon_name.to_glib_none().0,
46            );
47        }
48    }
49
50    pub fn set_screen(&self, screen: &Screen) {
51        unsafe {
52            gdk_sys::gdk_app_launch_context_set_screen(
53                self.to_glib_none().0,
54                screen.to_glib_none().0,
55            );
56        }
57    }
58
59    pub fn set_timestamp(&self, timestamp: u32) {
60        unsafe {
61            gdk_sys::gdk_app_launch_context_set_timestamp(self.to_glib_none().0, timestamp);
62        }
63    }
64
65    pub fn get_property_display(&self) -> Option<Display> {
66        unsafe {
67            let mut value = Value::from_type(<Display as StaticType>::static_type());
68            gobject_sys::g_object_get_property(
69                self.as_ptr() as *mut gobject_sys::GObject,
70                b"display\0".as_ptr() as *const _,
71                value.to_glib_none_mut().0,
72            );
73            value.get()
74        }
75    }
76}
77
78impl fmt::Display for AppLaunchContext {
79    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
80        write!(f, "AppLaunchContext")
81    }
82}