1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
use Display;
use Screen;
use ffi;
use gio;
use glib;
use glib::Value;
use glib::object::IsA;
use glib::translate::*;
use gobject_ffi;
glib_wrapper! {
pub struct AppLaunchContext(Object<ffi::GdkAppLaunchContext>);
match fn {
get_type => || ffi::gdk_app_launch_context_get_type(),
}
}
impl AppLaunchContext {
pub fn new() -> AppLaunchContext {
assert_initialized_main_thread!();
unsafe {
from_glib_full(ffi::gdk_app_launch_context_new())
}
}
}
pub trait AppLaunchContextExt {
fn set_desktop(&self, desktop: i32);
fn set_display(&self, display: &Display);
fn set_icon<'a, P: IsA<gio::Icon> + 'a, Q: Into<Option<&'a P>>>(&self, icon: Q);
fn set_icon_name<'a, P: Into<Option<&'a str>>>(&self, icon_name: P);
fn set_screen(&self, screen: &Screen);
fn set_timestamp(&self, timestamp: u32);
fn get_property_display(&self) -> Option<Display>;
}
impl<O: IsA<AppLaunchContext> + IsA<glib::object::Object>> AppLaunchContextExt for O {
fn set_desktop(&self, desktop: i32) {
unsafe {
ffi::gdk_app_launch_context_set_desktop(self.to_glib_none().0, desktop);
}
}
fn set_display(&self, display: &Display) {
unsafe {
ffi::gdk_app_launch_context_set_display(self.to_glib_none().0, display.to_glib_none().0);
}
}
fn set_icon<'a, P: IsA<gio::Icon> + 'a, Q: Into<Option<&'a P>>>(&self, icon: Q) {
let icon = icon.into();
let icon = icon.to_glib_none();
unsafe {
ffi::gdk_app_launch_context_set_icon(self.to_glib_none().0, icon.0);
}
}
fn set_icon_name<'a, P: Into<Option<&'a str>>>(&self, icon_name: P) {
let icon_name = icon_name.into();
let icon_name = icon_name.to_glib_none();
unsafe {
ffi::gdk_app_launch_context_set_icon_name(self.to_glib_none().0, icon_name.0);
}
}
fn set_screen(&self, screen: &Screen) {
unsafe {
ffi::gdk_app_launch_context_set_screen(self.to_glib_none().0, screen.to_glib_none().0);
}
}
fn set_timestamp(&self, timestamp: u32) {
unsafe {
ffi::gdk_app_launch_context_set_timestamp(self.to_glib_none().0, timestamp);
}
}
fn get_property_display(&self) -> Option<Display> {
let mut value = Value::from(None::<&Display>);
unsafe {
gobject_ffi::g_object_get_property(self.to_glib_none().0, "display".to_glib_none().0, value.to_glib_none_mut().0);
}
value.get()
}
}