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 | |
5 | use crate::translate::*; |
6 | #[cfg (feature = "v2_72" )] |
7 | #[cfg_attr (docsrs, doc(cfg(feature = "v2_72" )))] |
8 | use crate::MainContextFlags; |
9 | |
10 | crate::wrapper! { |
11 | #[derive (Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] |
12 | pub struct MainContext(Shared<ffi::GMainContext>); |
13 | |
14 | match fn { |
15 | ref => |ptr| ffi::g_main_context_ref(ptr), |
16 | unref => |ptr| ffi::g_main_context_unref(ptr), |
17 | type_ => || ffi::g_main_context_get_type(), |
18 | } |
19 | } |
20 | |
21 | impl MainContext { |
22 | #[doc (alias = "g_main_context_new" )] |
23 | pub fn new() -> MainContext { |
24 | unsafe { from_glib_full(ffi::g_main_context_new()) } |
25 | } |
26 | |
27 | #[cfg (feature = "v2_72" )] |
28 | #[cfg_attr (docsrs, doc(cfg(feature = "v2_72" )))] |
29 | #[doc (alias = "g_main_context_new_with_flags" )] |
30 | #[doc (alias = "new_with_flags" )] |
31 | pub fn with_flags(flags: MainContextFlags) -> MainContext { |
32 | unsafe { from_glib_full(ffi::g_main_context_new_with_flags(flags.into_glib())) } |
33 | } |
34 | |
35 | //#[doc(alias = "g_main_context_add_poll")] |
36 | //pub fn add_poll(&self, fd: /*Ignored*/&mut PollFD, priority: i32) { |
37 | // unsafe { TODO: call ffi:g_main_context_add_poll() } |
38 | //} |
39 | |
40 | //#[doc(alias = "g_main_context_check")] |
41 | //pub fn check(&self, max_priority: i32, fds: /*Ignored*/&[PollFD]) -> bool { |
42 | // unsafe { TODO: call ffi:g_main_context_check() } |
43 | //} |
44 | |
45 | #[doc (alias = "g_main_context_dispatch" )] |
46 | pub fn dispatch(&self) { |
47 | unsafe { |
48 | ffi::g_main_context_dispatch(self.to_glib_none().0); |
49 | } |
50 | } |
51 | |
52 | //#[doc(alias = "g_main_context_find_source_by_funcs_user_data")] |
53 | //pub fn find_source_by_funcs_user_data(&self, funcs: /*Ignored*/&mut SourceFuncs, user_data: /*Unimplemented*/Option<Basic: Pointer>) -> Source { |
54 | // unsafe { TODO: call ffi:g_main_context_find_source_by_funcs_user_data() } |
55 | //} |
56 | |
57 | //#[doc(alias = "g_main_context_find_source_by_user_data")] |
58 | //pub fn find_source_by_user_data(&self, user_data: /*Unimplemented*/Option<Basic: Pointer>) -> Source { |
59 | // unsafe { TODO: call ffi:g_main_context_find_source_by_user_data() } |
60 | //} |
61 | |
62 | //#[doc(alias = "g_main_context_get_poll_func")] |
63 | //#[doc(alias = "get_poll_func")] |
64 | //pub fn poll_func(&self) -> /*Unimplemented*/Fn(/*Ignored*/PollFD, u32) -> i32 { |
65 | // unsafe { TODO: call ffi:g_main_context_get_poll_func() } |
66 | //} |
67 | |
68 | #[doc (alias = "g_main_context_is_owner" )] |
69 | pub fn is_owner(&self) -> bool { |
70 | unsafe { from_glib(ffi::g_main_context_is_owner(self.to_glib_none().0)) } |
71 | } |
72 | |
73 | #[doc (alias = "g_main_context_iteration" )] |
74 | pub fn iteration(&self, may_block: bool) -> bool { |
75 | unsafe { |
76 | from_glib(ffi::g_main_context_iteration( |
77 | self.to_glib_none().0, |
78 | may_block.into_glib(), |
79 | )) |
80 | } |
81 | } |
82 | |
83 | #[doc (alias = "g_main_context_pending" )] |
84 | pub fn pending(&self) -> bool { |
85 | unsafe { from_glib(ffi::g_main_context_pending(self.to_glib_none().0)) } |
86 | } |
87 | |
88 | //#[doc(alias = "g_main_context_query")] |
89 | //pub fn query(&self, max_priority: i32, fds: /*Ignored*/Vec<PollFD>) -> (i32, i32) { |
90 | // unsafe { TODO: call ffi:g_main_context_query() } |
91 | //} |
92 | |
93 | //#[doc(alias = "g_main_context_remove_poll")] |
94 | //pub fn remove_poll(&self, fd: /*Ignored*/&mut PollFD) { |
95 | // unsafe { TODO: call ffi:g_main_context_remove_poll() } |
96 | //} |
97 | |
98 | //#[doc(alias = "g_main_context_set_poll_func")] |
99 | //pub fn set_poll_func(&self, func: /*Unimplemented*/Fn(/*Ignored*/PollFD, u32) -> i32) { |
100 | // unsafe { TODO: call ffi:g_main_context_set_poll_func() } |
101 | //} |
102 | |
103 | //#[cfg_attr(feature = "v2_58", deprecated = "Since 2.58")] |
104 | //#[allow(deprecated)] |
105 | //#[doc(alias = "g_main_context_wait")] |
106 | //pub fn wait(&self, cond: /*Ignored*/&mut Cond, mutex: /*Ignored*/&mut Mutex) -> bool { |
107 | // unsafe { TODO: call ffi:g_main_context_wait() } |
108 | //} |
109 | |
110 | #[doc (alias = "g_main_context_wakeup" )] |
111 | pub fn wakeup(&self) { |
112 | unsafe { |
113 | ffi::g_main_context_wakeup(self.to_glib_none().0); |
114 | } |
115 | } |
116 | |
117 | #[doc (alias = "g_main_context_default" )] |
118 | #[allow (clippy::should_implement_trait)] |
119 | pub fn default() -> MainContext { |
120 | unsafe { from_glib_none(ffi::g_main_context_default()) } |
121 | } |
122 | |
123 | #[doc (alias = "g_main_context_get_thread_default" )] |
124 | #[doc (alias = "get_thread_default" )] |
125 | pub fn thread_default() -> Option<MainContext> { |
126 | unsafe { from_glib_none(ffi::g_main_context_get_thread_default()) } |
127 | } |
128 | |
129 | #[doc (alias = "g_main_context_ref_thread_default" )] |
130 | pub fn ref_thread_default() -> MainContext { |
131 | unsafe { from_glib_full(ffi::g_main_context_ref_thread_default()) } |
132 | } |
133 | } |
134 | |
135 | impl Default for MainContext { |
136 | fn default() -> Self { |
137 | Self::new() |
138 | } |
139 | } |
140 | |
141 | unsafe impl Send for MainContext {} |
142 | unsafe impl Sync for MainContext {} |
143 | |