|
| 1 | +// This file was generated by gir (7504fb6) from gir-files (71d73f0) |
| 2 | +// DO NOT EDIT |
| 3 | + |
| 4 | +use ffi; |
| 5 | +use translate::*; |
| 6 | + |
| 7 | +glib_wrapper! { |
| 8 | + pub struct MainContext(Shared<ffi::GMainContext>); |
| 9 | + |
| 10 | + match fn { |
| 11 | + ref => |ptr| ffi::g_main_context_ref(ptr), |
| 12 | + unref => |ptr| ffi::g_main_context_unref(ptr), |
| 13 | + } |
| 14 | +} |
| 15 | + |
| 16 | +impl MainContext { |
| 17 | + pub fn new() -> MainContext { |
| 18 | + unsafe { |
| 19 | + from_glib_full(ffi::g_main_context_new()) |
| 20 | + } |
| 21 | + } |
| 22 | + |
| 23 | + pub fn acquire(&self) -> bool { |
| 24 | + unsafe { |
| 25 | + from_glib(ffi::g_main_context_acquire(self.to_glib_none().0)) |
| 26 | + } |
| 27 | + } |
| 28 | + |
| 29 | + //pub fn add_poll(&self, fd: /*Ignored*/&mut PollFD, priority: i32) { |
| 30 | + // unsafe { TODO: call ffi::g_main_context_add_poll() } |
| 31 | + //} |
| 32 | + |
| 33 | + //pub fn check(&self, max_priority: i32, fds: /*Ignored*/&[&PollFD]) -> i32 { |
| 34 | + // unsafe { TODO: call ffi::g_main_context_check() } |
| 35 | + //} |
| 36 | + |
| 37 | + pub fn dispatch(&self) { |
| 38 | + unsafe { |
| 39 | + ffi::g_main_context_dispatch(self.to_glib_none().0); |
| 40 | + } |
| 41 | + } |
| 42 | + |
| 43 | + //pub fn find_source_by_funcs_user_data<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, funcs: /*Ignored*/&mut SourceFuncs, user_data: P) -> Option<Source> { |
| 44 | + // unsafe { TODO: call ffi::g_main_context_find_source_by_funcs_user_data() } |
| 45 | + //} |
| 46 | + |
| 47 | + //pub fn find_source_by_user_data<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, user_data: P) -> Option<Source> { |
| 48 | + // unsafe { TODO: call ffi::g_main_context_find_source_by_user_data() } |
| 49 | + //} |
| 50 | + |
| 51 | + //pub fn get_poll_func(&self) -> /*Unknown conversion*//*Unimplemented*/PollFunc { |
| 52 | + // unsafe { TODO: call ffi::g_main_context_get_poll_func() } |
| 53 | + //} |
| 54 | + |
| 55 | + //pub fn invoke<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, function: /*Unknown conversion*//*Unimplemented*/SourceFunc, data: P) { |
| 56 | + // unsafe { TODO: call ffi::g_main_context_invoke() } |
| 57 | + //} |
| 58 | + |
| 59 | + //pub fn invoke_full<'a, P: Into<Option</*Unimplemented*/Fundamental: Pointer>>, Q: Into<Option<&'a /*Unimplemented*/DestroyNotify>>>(&self, priority: i32, function: /*Unknown conversion*//*Unimplemented*/SourceFunc, data: P, notify: Q) { |
| 60 | + // unsafe { TODO: call ffi::g_main_context_invoke_full() } |
| 61 | + //} |
| 62 | + |
| 63 | + pub fn is_owner(&self) -> bool { |
| 64 | + unsafe { |
| 65 | + from_glib(ffi::g_main_context_is_owner(self.to_glib_none().0)) |
| 66 | + } |
| 67 | + } |
| 68 | + |
| 69 | + pub fn iteration(&self, may_block: bool) -> bool { |
| 70 | + unsafe { |
| 71 | + from_glib(ffi::g_main_context_iteration(self.to_glib_none().0, may_block.to_glib())) |
| 72 | + } |
| 73 | + } |
| 74 | + |
| 75 | + pub fn pending(&self) -> bool { |
| 76 | + unsafe { |
| 77 | + from_glib(ffi::g_main_context_pending(self.to_glib_none().0)) |
| 78 | + } |
| 79 | + } |
| 80 | + |
| 81 | + pub fn pop_thread_default(&self) { |
| 82 | + unsafe { |
| 83 | + ffi::g_main_context_pop_thread_default(self.to_glib_none().0); |
| 84 | + } |
| 85 | + } |
| 86 | + |
| 87 | + pub fn push_thread_default(&self) { |
| 88 | + unsafe { |
| 89 | + ffi::g_main_context_push_thread_default(self.to_glib_none().0); |
| 90 | + } |
| 91 | + } |
| 92 | + |
| 93 | + //pub fn query(&self, max_priority: i32, fds: /*Unimplemented*/Vec<PollFD>) -> (i32, i32) { |
| 94 | + // unsafe { TODO: call ffi::g_main_context_query() } |
| 95 | + //} |
| 96 | + |
| 97 | + pub fn release(&self) { |
| 98 | + unsafe { |
| 99 | + ffi::g_main_context_release(self.to_glib_none().0); |
| 100 | + } |
| 101 | + } |
| 102 | + |
| 103 | + //pub fn remove_poll(&self, fd: /*Ignored*/&mut PollFD) { |
| 104 | + // unsafe { TODO: call ffi::g_main_context_remove_poll() } |
| 105 | + //} |
| 106 | + |
| 107 | + //pub fn set_poll_func(&self, func: /*Unknown conversion*//*Unimplemented*/PollFunc) { |
| 108 | + // unsafe { TODO: call ffi::g_main_context_set_poll_func() } |
| 109 | + //} |
| 110 | + |
| 111 | + //pub fn wait(&self, cond: /*Ignored*/&mut Cond, mutex: /*Ignored*/&mut Mutex) -> bool { |
| 112 | + // unsafe { TODO: call ffi::g_main_context_wait() } |
| 113 | + //} |
| 114 | + |
| 115 | + pub fn wakeup(&self) { |
| 116 | + unsafe { |
| 117 | + ffi::g_main_context_wakeup(self.to_glib_none().0); |
| 118 | + } |
| 119 | + } |
| 120 | + |
| 121 | + pub fn default() -> Option<MainContext> { |
| 122 | + unsafe { |
| 123 | + from_glib_none(ffi::g_main_context_default()) |
| 124 | + } |
| 125 | + } |
| 126 | + |
| 127 | + pub fn get_thread_default() -> Option<MainContext> { |
| 128 | + unsafe { |
| 129 | + from_glib_none(ffi::g_main_context_get_thread_default()) |
| 130 | + } |
| 131 | + } |
| 132 | + |
| 133 | + pub fn ref_thread_default() -> Option<MainContext> { |
| 134 | + unsafe { |
| 135 | + from_glib_full(ffi::g_main_context_ref_thread_default()) |
| 136 | + } |
| 137 | + } |
| 138 | +} |
| 139 | + |
| 140 | +unsafe impl Send for MainContext {} |
| 141 | +unsafe impl Sync for MainContext {} |
0 commit comments