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
use Display;
use Screen;
use ffi;
use gio;
use glib::StaticType;
use glib::Value;
use glib::object::IsA;
use glib::object::ObjectType;
use glib::translate::*;
use gobject_ffi;
use std::fmt;
glib_wrapper! {
pub struct AppLaunchContext(Object<ffi::GdkAppLaunchContext, AppLaunchContextClass>) @extends gio::AppLaunchContext;
match fn {
get_type => || ffi::gdk_app_launch_context_get_type(),
}
}
impl AppLaunchContext {
pub fn set_desktop(&self, desktop: i32) {
unsafe {
ffi::gdk_app_launch_context_set_desktop(self.to_glib_none().0, desktop);
}
}
pub fn set_icon<'a, P: IsA<gio::Icon> + 'a, Q: Into<Option<&'a P>>>(&self, icon: Q) {
let icon = icon.into();
unsafe {
ffi::gdk_app_launch_context_set_icon(self.to_glib_none().0, icon.map(|p| p.as_ref()).to_glib_none().0);
}
}
pub fn set_icon_name<'a, P: Into<Option<&'a str>>>(&self, icon_name: P) {
let icon_name = icon_name.into();
unsafe {
ffi::gdk_app_launch_context_set_icon_name(self.to_glib_none().0, icon_name.to_glib_none().0);
}
}
pub fn set_screen(&self, screen: &Screen) {
unsafe {
ffi::gdk_app_launch_context_set_screen(self.to_glib_none().0, screen.to_glib_none().0);
}
}
pub fn set_timestamp(&self, timestamp: u32) {
unsafe {
ffi::gdk_app_launch_context_set_timestamp(self.to_glib_none().0, timestamp);
}
}
pub fn get_property_display(&self) -> Option<Display> {
unsafe {
let mut value = Value::from_type(<Display as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"display\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get()
}
}
}
impl fmt::Display for AppLaunchContext {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "AppLaunchContext")
}
}