glib/auto/source.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 glib_sys;
6use translate::*;
7use GString;
8use MainContext;
9
10glib_wrapper! {
11 #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
12 pub struct Source(Shared<glib_sys::GSource>);
13
14 match fn {
15 ref => |ptr| glib_sys::g_source_ref(ptr),
16 unref => |ptr| glib_sys::g_source_unref(ptr),
17 get_type => || glib_sys::g_source_get_type(),
18 }
19}
20
21impl Source {
22 //pub fn new(source_funcs: /*Ignored*/&mut SourceFuncs, struct_size: u32) -> Source {
23 // unsafe { TODO: call glib_sys:g_source_new() }
24 //}
25
26 pub fn add_child_source(&self, child_source: &Source) {
27 unsafe {
28 glib_sys::g_source_add_child_source(
29 self.to_glib_none().0,
30 child_source.to_glib_none().0,
31 );
32 }
33 }
34
35 //pub fn add_poll(&self, fd: /*Ignored*/&mut PollFD) {
36 // unsafe { TODO: call glib_sys:g_source_add_poll() }
37 //}
38
39 //pub fn add_unix_fd(&self, fd: i32, events: IOCondition) -> /*Unimplemented*/Option<Fundamental: Pointer> {
40 // unsafe { TODO: call glib_sys:g_source_add_unix_fd() }
41 //}
42
43 pub fn destroy(&self) {
44 unsafe {
45 glib_sys::g_source_destroy(self.to_glib_none().0);
46 }
47 }
48
49 pub fn get_can_recurse(&self) -> bool {
50 unsafe { from_glib(glib_sys::g_source_get_can_recurse(self.to_glib_none().0)) }
51 }
52
53 pub fn get_context(&self) -> Option<MainContext> {
54 unsafe { from_glib_none(glib_sys::g_source_get_context(self.to_glib_none().0)) }
55 }
56
57 pub fn get_name(&self) -> Option<GString> {
58 unsafe { from_glib_none(glib_sys::g_source_get_name(self.to_glib_none().0)) }
59 }
60
61 pub fn get_priority(&self) -> i32 {
62 unsafe { glib_sys::g_source_get_priority(self.to_glib_none().0) }
63 }
64
65 pub fn get_ready_time(&self) -> i64 {
66 unsafe { glib_sys::g_source_get_ready_time(self.to_glib_none().0) }
67 }
68
69 pub fn get_time(&self) -> i64 {
70 unsafe { glib_sys::g_source_get_time(self.to_glib_none().0) }
71 }
72
73 pub fn is_destroyed(&self) -> bool {
74 unsafe { from_glib(glib_sys::g_source_is_destroyed(self.to_glib_none().0)) }
75 }
76
77 //pub fn modify_unix_fd(&self, tag: /*Unimplemented*/Fundamental: Pointer, new_events: IOCondition) {
78 // unsafe { TODO: call glib_sys:g_source_modify_unix_fd() }
79 //}
80
81 //pub fn query_unix_fd(&self, tag: /*Unimplemented*/Fundamental: Pointer) -> IOCondition {
82 // unsafe { TODO: call glib_sys:g_source_query_unix_fd() }
83 //}
84
85 pub fn remove_child_source(&self, child_source: &Source) {
86 unsafe {
87 glib_sys::g_source_remove_child_source(
88 self.to_glib_none().0,
89 child_source.to_glib_none().0,
90 );
91 }
92 }
93
94 //pub fn remove_poll(&self, fd: /*Ignored*/&mut PollFD) {
95 // unsafe { TODO: call glib_sys:g_source_remove_poll() }
96 //}
97
98 //pub fn remove_unix_fd(&self, tag: /*Unimplemented*/Fundamental: Pointer) {
99 // unsafe { TODO: call glib_sys:g_source_remove_unix_fd() }
100 //}
101
102 //pub fn remove_by_funcs_user_data(funcs: /*Ignored*/&mut SourceFuncs, user_data: /*Unimplemented*/Option<Fundamental: Pointer>) -> bool {
103 // unsafe { TODO: call glib_sys:g_source_remove_by_funcs_user_data() }
104 //}
105
106 //pub fn remove_by_user_data(user_data: /*Unimplemented*/Option<Fundamental: Pointer>) -> bool {
107 // unsafe { TODO: call glib_sys:g_source_remove_by_user_data() }
108 //}
109}
110
111unsafe impl Send for Source {}
112unsafe impl Sync for Source {}