| 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 | #[cfg (feature = "v2_72" )] |
| 6 | #[cfg_attr (docsrs, doc(cfg(feature = "v2_72" )))] |
| 7 | use crate::MainContextFlags; |
| 8 | use crate::{ffi, translate::*}; |
| 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 | //#[cfg(feature = "v2_64")] |
| 89 | //#[cfg_attr(docsrs, doc(cfg(feature = "v2_64")))] |
| 90 | //#[doc(alias = "g_main_context_pusher_new")] |
| 91 | //pub fn pusher_new(&self) -> /*Unknown conversion*//*Unimplemented*/MainContextPusher { |
| 92 | // unsafe { TODO: call ffi:g_main_context_pusher_new() } |
| 93 | //} |
| 94 | |
| 95 | //#[doc(alias = "g_main_context_query")] |
| 96 | //pub fn query(&self, max_priority: i32, fds: /*Ignored*/Vec<PollFD>) -> (i32, i32) { |
| 97 | // unsafe { TODO: call ffi:g_main_context_query() } |
| 98 | //} |
| 99 | |
| 100 | //#[doc(alias = "g_main_context_remove_poll")] |
| 101 | //pub fn remove_poll(&self, fd: /*Ignored*/&mut PollFD) { |
| 102 | // unsafe { TODO: call ffi:g_main_context_remove_poll() } |
| 103 | //} |
| 104 | |
| 105 | //#[doc(alias = "g_main_context_set_poll_func")] |
| 106 | //pub fn set_poll_func(&self, func: /*Unimplemented*/Fn(/*Ignored*/PollFD, u32) -> i32) { |
| 107 | // unsafe { TODO: call ffi:g_main_context_set_poll_func() } |
| 108 | //} |
| 109 | |
| 110 | //#[cfg_attr(feature = "v2_58", deprecated = "Since 2.58")] |
| 111 | //#[allow(deprecated)] |
| 112 | //#[doc(alias = "g_main_context_wait")] |
| 113 | //pub fn wait(&self, cond: /*Ignored*/&mut Cond, mutex: /*Ignored*/&mut Mutex) -> bool { |
| 114 | // unsafe { TODO: call ffi:g_main_context_wait() } |
| 115 | //} |
| 116 | |
| 117 | #[doc (alias = "g_main_context_wakeup" )] |
| 118 | pub fn wakeup(&self) { |
| 119 | unsafe { |
| 120 | ffi::g_main_context_wakeup(self.to_glib_none().0); |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | #[doc (alias = "g_main_context_default" )] |
| 125 | #[allow (clippy::should_implement_trait)] |
| 126 | pub fn default() -> MainContext { |
| 127 | unsafe { from_glib_none(ffi::g_main_context_default()) } |
| 128 | } |
| 129 | |
| 130 | #[doc (alias = "g_main_context_get_thread_default" )] |
| 131 | #[doc (alias = "get_thread_default" )] |
| 132 | pub fn thread_default() -> Option<MainContext> { |
| 133 | unsafe { from_glib_none(ffi::g_main_context_get_thread_default()) } |
| 134 | } |
| 135 | |
| 136 | //#[cfg(feature = "v2_64")] |
| 137 | //#[cfg_attr(docsrs, doc(cfg(feature = "v2_64")))] |
| 138 | //#[doc(alias = "g_main_context_pusher_free")] |
| 139 | //pub fn pusher_free(pusher: /*Unknown conversion*//*Unimplemented*/MainContextPusher) { |
| 140 | // unsafe { TODO: call ffi:g_main_context_pusher_free() } |
| 141 | //} |
| 142 | |
| 143 | #[doc (alias = "g_main_context_ref_thread_default" )] |
| 144 | pub fn ref_thread_default() -> MainContext { |
| 145 | unsafe { from_glib_full(ffi::g_main_context_ref_thread_default()) } |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | impl Default for MainContext { |
| 150 | fn default() -> Self { |
| 151 | Self::new() |
| 152 | } |
| 153 | } |
| 154 | |
| 155 | unsafe impl Send for MainContext {} |
| 156 | unsafe impl Sync for MainContext {} |
| 157 | |