atk/auto/misc.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 crate::ffi;
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9 /// A set of ATK utility functions for thread locking
10 ///
11 /// A set of utility functions for thread locking. This interface and
12 /// all his related methods are deprecated since 2.12.
13 ///
14 /// # Implements
15 ///
16 /// [`AtkMiscExt`][trait@crate::prelude::AtkMiscExt], [`trait@glib::ObjectExt`]
17 #[doc(alias = "AtkMisc")]
18 pub struct Misc(Object<ffi::AtkMisc, ffi::AtkMiscClass>);
19
20 match fn {
21 type_ => || ffi::atk_misc_get_type(),
22 }
23}
24
25impl Misc {
26 pub const NONE: Option<&'static Misc> = None;
27
28 /// Obtain the singleton instance of AtkMisc for this application.
29 ///
30 /// # Deprecated
31 ///
32 /// Since 2.12.
33 ///
34 /// # Returns
35 ///
36 /// The singleton instance of AtkMisc for this application.
37 #[doc(alias = "atk_misc_get_instance")]
38 #[doc(alias = "get_instance")]
39 pub fn instance() -> Option<Misc> {
40 assert_initialized_main_thread!();
41 unsafe { from_glib_none(ffi::atk_misc_get_instance()) }
42 }
43}
44
45/// Trait containing all [`struct@Misc`] methods.
46///
47/// # Implementors
48///
49/// [`Misc`][struct@crate::Misc]
50pub trait AtkMiscExt: IsA<Misc> + 'static {
51 /// Take the thread mutex for the GUI toolkit,
52 /// if one exists.
53 /// (This method is implemented by the toolkit ATK implementation layer;
54 /// for instance, for GTK+, GAIL implements this via GDK_THREADS_ENTER).
55 ///
56 /// # Deprecated
57 ///
58 /// Since 2.12.
59 #[doc(alias = "atk_misc_threads_enter")]
60 fn threads_enter(&self) {
61 unsafe {
62 ffi::atk_misc_threads_enter(self.as_ref().to_glib_none().0);
63 }
64 }
65
66 /// Release the thread mutex for the GUI toolkit,
67 /// if one exists. This method, and atk_misc_threads_enter,
68 /// are needed in some situations by threaded application code which
69 /// services ATK requests, since fulfilling ATK requests often
70 /// requires calling into the GUI toolkit. If a long-running or
71 /// potentially blocking call takes place inside such a block, it should
72 /// be bracketed by atk_misc_threads_leave/atk_misc_threads_enter calls.
73 /// (This method is implemented by the toolkit ATK implementation layer;
74 /// for instance, for GTK+, GAIL implements this via GDK_THREADS_LEAVE).
75 ///
76 /// # Deprecated
77 ///
78 /// Since 2.12.
79 #[doc(alias = "atk_misc_threads_leave")]
80 fn threads_leave(&self) {
81 unsafe {
82 ffi::atk_misc_threads_leave(self.as_ref().to_glib_none().0);
83 }
84 }
85}
86
87impl<O: IsA<Misc>> AtkMiscExt for O {}