Skip to content

Commit 59e891f

Browse files
authored
Merge pull request #1156 from pentamassiv/dbusObjectMgr
Added bindings for Gio.DBusObjectManager, Gio.DBusObjectManagerClientFlags
2 parents 04bddc0 + fea34b5 commit 59e891f

File tree

4 files changed

+303
-0
lines changed

4 files changed

+303
-0
lines changed

gio/Gir.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ generate = [
4242
"Gio.DBusMethodInfo",
4343
"Gio.DBusNodeInfo",
4444
"Gio.DBusObject",
45+
"Gio.DBusObjectManager",
46+
"Gio.DBusObjectManagerClientFlags",
4547
"Gio.DBusPropertyInfo",
4648
"Gio.DBusSendMessageFlags",
4749
"Gio.DBusServer",

gio/src/auto/dbus_object_manager.rs

Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
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::{DBusInterface, DBusObject};
6+
use glib::{
7+
prelude::*,
8+
signal::{connect_raw, SignalHandlerId},
9+
translate::*,
10+
};
11+
use std::{boxed::Box as Box_, fmt, mem::transmute};
12+
13+
glib::wrapper! {
14+
#[doc(alias = "GDBusObjectManager")]
15+
pub struct DBusObjectManager(Interface<ffi::GDBusObjectManager, ffi::GDBusObjectManagerIface>);
16+
17+
match fn {
18+
type_ => || ffi::g_dbus_object_manager_get_type(),
19+
}
20+
}
21+
22+
impl DBusObjectManager {
23+
pub const NONE: Option<&'static DBusObjectManager> = None;
24+
}
25+
26+
mod sealed {
27+
pub trait Sealed {}
28+
impl<T: super::IsA<super::DBusObjectManager>> Sealed for T {}
29+
}
30+
31+
pub trait DBusObjectManagerExt: IsA<DBusObjectManager> + sealed::Sealed + 'static {
32+
#[doc(alias = "g_dbus_object_manager_get_interface")]
33+
#[doc(alias = "get_interface")]
34+
fn interface(&self, object_path: &str, interface_name: &str) -> Option<DBusInterface> {
35+
unsafe {
36+
from_glib_full(ffi::g_dbus_object_manager_get_interface(
37+
self.as_ref().to_glib_none().0,
38+
object_path.to_glib_none().0,
39+
interface_name.to_glib_none().0,
40+
))
41+
}
42+
}
43+
44+
#[doc(alias = "g_dbus_object_manager_get_object")]
45+
#[doc(alias = "get_object")]
46+
fn object(&self, object_path: &str) -> Option<DBusObject> {
47+
unsafe {
48+
from_glib_full(ffi::g_dbus_object_manager_get_object(
49+
self.as_ref().to_glib_none().0,
50+
object_path.to_glib_none().0,
51+
))
52+
}
53+
}
54+
55+
#[doc(alias = "g_dbus_object_manager_get_object_path")]
56+
#[doc(alias = "get_object_path")]
57+
fn object_path(&self) -> glib::GString {
58+
unsafe {
59+
from_glib_none(ffi::g_dbus_object_manager_get_object_path(
60+
self.as_ref().to_glib_none().0,
61+
))
62+
}
63+
}
64+
65+
#[doc(alias = "g_dbus_object_manager_get_objects")]
66+
#[doc(alias = "get_objects")]
67+
fn objects(&self) -> Vec<DBusObject> {
68+
unsafe {
69+
FromGlibPtrContainer::from_glib_full(ffi::g_dbus_object_manager_get_objects(
70+
self.as_ref().to_glib_none().0,
71+
))
72+
}
73+
}
74+
75+
#[doc(alias = "interface-added")]
76+
fn connect_interface_added<F: Fn(&Self, &DBusObject, &DBusInterface) + 'static>(
77+
&self,
78+
f: F,
79+
) -> SignalHandlerId {
80+
unsafe extern "C" fn interface_added_trampoline<
81+
P: IsA<DBusObjectManager>,
82+
F: Fn(&P, &DBusObject, &DBusInterface) + 'static,
83+
>(
84+
this: *mut ffi::GDBusObjectManager,
85+
object: *mut ffi::GDBusObject,
86+
interface: *mut ffi::GDBusInterface,
87+
f: glib::ffi::gpointer,
88+
) {
89+
let f: &F = &*(f as *const F);
90+
f(
91+
DBusObjectManager::from_glib_borrow(this).unsafe_cast_ref(),
92+
&from_glib_borrow(object),
93+
&from_glib_borrow(interface),
94+
)
95+
}
96+
unsafe {
97+
let f: Box_<F> = Box_::new(f);
98+
connect_raw(
99+
self.as_ptr() as *mut _,
100+
b"interface-added\0".as_ptr() as *const _,
101+
Some(transmute::<_, unsafe extern "C" fn()>(
102+
interface_added_trampoline::<Self, F> as *const (),
103+
)),
104+
Box_::into_raw(f),
105+
)
106+
}
107+
}
108+
109+
#[doc(alias = "interface-removed")]
110+
fn connect_interface_removed<F: Fn(&Self, &DBusObject, &DBusInterface) + 'static>(
111+
&self,
112+
f: F,
113+
) -> SignalHandlerId {
114+
unsafe extern "C" fn interface_removed_trampoline<
115+
P: IsA<DBusObjectManager>,
116+
F: Fn(&P, &DBusObject, &DBusInterface) + 'static,
117+
>(
118+
this: *mut ffi::GDBusObjectManager,
119+
object: *mut ffi::GDBusObject,
120+
interface: *mut ffi::GDBusInterface,
121+
f: glib::ffi::gpointer,
122+
) {
123+
let f: &F = &*(f as *const F);
124+
f(
125+
DBusObjectManager::from_glib_borrow(this).unsafe_cast_ref(),
126+
&from_glib_borrow(object),
127+
&from_glib_borrow(interface),
128+
)
129+
}
130+
unsafe {
131+
let f: Box_<F> = Box_::new(f);
132+
connect_raw(
133+
self.as_ptr() as *mut _,
134+
b"interface-removed\0".as_ptr() as *const _,
135+
Some(transmute::<_, unsafe extern "C" fn()>(
136+
interface_removed_trampoline::<Self, F> as *const (),
137+
)),
138+
Box_::into_raw(f),
139+
)
140+
}
141+
}
142+
143+
#[doc(alias = "object-added")]
144+
fn connect_object_added<F: Fn(&Self, &DBusObject) + 'static>(&self, f: F) -> SignalHandlerId {
145+
unsafe extern "C" fn object_added_trampoline<
146+
P: IsA<DBusObjectManager>,
147+
F: Fn(&P, &DBusObject) + 'static,
148+
>(
149+
this: *mut ffi::GDBusObjectManager,
150+
object: *mut ffi::GDBusObject,
151+
f: glib::ffi::gpointer,
152+
) {
153+
let f: &F = &*(f as *const F);
154+
f(
155+
DBusObjectManager::from_glib_borrow(this).unsafe_cast_ref(),
156+
&from_glib_borrow(object),
157+
)
158+
}
159+
unsafe {
160+
let f: Box_<F> = Box_::new(f);
161+
connect_raw(
162+
self.as_ptr() as *mut _,
163+
b"object-added\0".as_ptr() as *const _,
164+
Some(transmute::<_, unsafe extern "C" fn()>(
165+
object_added_trampoline::<Self, F> as *const (),
166+
)),
167+
Box_::into_raw(f),
168+
)
169+
}
170+
}
171+
172+
#[doc(alias = "object-removed")]
173+
fn connect_object_removed<F: Fn(&Self, &DBusObject) + 'static>(&self, f: F) -> SignalHandlerId {
174+
unsafe extern "C" fn object_removed_trampoline<
175+
P: IsA<DBusObjectManager>,
176+
F: Fn(&P, &DBusObject) + 'static,
177+
>(
178+
this: *mut ffi::GDBusObjectManager,
179+
object: *mut ffi::GDBusObject,
180+
f: glib::ffi::gpointer,
181+
) {
182+
let f: &F = &*(f as *const F);
183+
f(
184+
DBusObjectManager::from_glib_borrow(this).unsafe_cast_ref(),
185+
&from_glib_borrow(object),
186+
)
187+
}
188+
unsafe {
189+
let f: Box_<F> = Box_::new(f);
190+
connect_raw(
191+
self.as_ptr() as *mut _,
192+
b"object-removed\0".as_ptr() as *const _,
193+
Some(transmute::<_, unsafe extern "C" fn()>(
194+
object_removed_trampoline::<Self, F> as *const (),
195+
)),
196+
Box_::into_raw(f),
197+
)
198+
}
199+
}
200+
}
201+
202+
impl<O: IsA<DBusObjectManager>> DBusObjectManagerExt for O {}
203+
204+
impl fmt::Display for DBusObjectManager {
205+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
206+
f.write_str("DBusObjectManager")
207+
}
208+
}

gio/src/auto/flags.rs

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,6 +1027,94 @@ impl From<DBusMessageFlags> for glib::Value {
10271027
}
10281028
}
10291029

1030+
bitflags! {
1031+
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
1032+
#[doc(alias = "GDBusObjectManagerClientFlags")]
1033+
pub struct DBusObjectManagerClientFlags: u32 {
1034+
#[doc(alias = "G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE")]
1035+
const NONE = ffi::G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE as _;
1036+
#[doc(alias = "G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_DO_NOT_AUTO_START")]
1037+
const DO_NOT_AUTO_START = ffi::G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_DO_NOT_AUTO_START as _;
1038+
}
1039+
}
1040+
1041+
impl fmt::Display for DBusObjectManagerClientFlags {
1042+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1043+
<Self as fmt::Debug>::fmt(self, f)
1044+
}
1045+
}
1046+
1047+
#[doc(hidden)]
1048+
impl IntoGlib for DBusObjectManagerClientFlags {
1049+
type GlibType = ffi::GDBusObjectManagerClientFlags;
1050+
1051+
#[inline]
1052+
fn into_glib(self) -> ffi::GDBusObjectManagerClientFlags {
1053+
self.bits()
1054+
}
1055+
}
1056+
1057+
#[doc(hidden)]
1058+
impl FromGlib<ffi::GDBusObjectManagerClientFlags> for DBusObjectManagerClientFlags {
1059+
#[inline]
1060+
unsafe fn from_glib(value: ffi::GDBusObjectManagerClientFlags) -> Self {
1061+
Self::from_bits_truncate(value)
1062+
}
1063+
}
1064+
1065+
impl StaticType for DBusObjectManagerClientFlags {
1066+
#[inline]
1067+
fn static_type() -> glib::Type {
1068+
unsafe { from_glib(ffi::g_dbus_object_manager_client_flags_get_type()) }
1069+
}
1070+
}
1071+
1072+
impl glib::HasParamSpec for DBusObjectManagerClientFlags {
1073+
type ParamSpec = glib::ParamSpecFlags;
1074+
type SetValue = Self;
1075+
type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;
1076+
1077+
fn param_spec_builder() -> Self::BuilderFn {
1078+
|name| Self::ParamSpec::builder(name)
1079+
}
1080+
}
1081+
1082+
impl glib::value::ValueType for DBusObjectManagerClientFlags {
1083+
type Type = Self;
1084+
}
1085+
1086+
unsafe impl<'a> glib::value::FromValue<'a> for DBusObjectManagerClientFlags {
1087+
type Checker = glib::value::GenericValueTypeChecker<Self>;
1088+
1089+
#[inline]
1090+
unsafe fn from_value(value: &'a glib::Value) -> Self {
1091+
from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
1092+
}
1093+
}
1094+
1095+
impl ToValue for DBusObjectManagerClientFlags {
1096+
#[inline]
1097+
fn to_value(&self) -> glib::Value {
1098+
let mut value = glib::Value::for_value_type::<Self>();
1099+
unsafe {
1100+
glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
1101+
}
1102+
value
1103+
}
1104+
1105+
#[inline]
1106+
fn value_type(&self) -> glib::Type {
1107+
Self::static_type()
1108+
}
1109+
}
1110+
1111+
impl From<DBusObjectManagerClientFlags> for glib::Value {
1112+
#[inline]
1113+
fn from(v: DBusObjectManagerClientFlags) -> Self {
1114+
ToValue::to_value(&v)
1115+
}
1116+
}
1117+
10301118
bitflags! {
10311119
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
10321120
#[doc(alias = "GDBusProxyFlags")]

gio/src/auto/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ pub use self::dbus_method_invocation::DBusMethodInvocation;
8686
mod dbus_object;
8787
pub use self::dbus_object::DBusObject;
8888

89+
mod dbus_object_manager;
90+
pub use self::dbus_object_manager::DBusObjectManager;
91+
8992
mod dbus_proxy;
9093
pub use self::dbus_proxy::DBusProxy;
9194

@@ -544,6 +547,7 @@ pub use self::flags::DBusCapabilityFlags;
544547
pub use self::flags::DBusConnectionFlags;
545548
pub use self::flags::DBusInterfaceSkeletonFlags;
546549
pub use self::flags::DBusMessageFlags;
550+
pub use self::flags::DBusObjectManagerClientFlags;
547551
pub use self::flags::DBusProxyFlags;
548552
pub use self::flags::DBusSendMessageFlags;
549553
pub use self::flags::DBusServerFlags;
@@ -767,6 +771,7 @@ pub mod traits {
767771
pub use super::dbus_interface::DBusInterfaceExt;
768772
pub use super::dbus_interface_skeleton::DBusInterfaceSkeletonExt;
769773
pub use super::dbus_object::DBusObjectExt;
774+
pub use super::dbus_object_manager::DBusObjectManagerExt;
770775
pub use super::dbus_proxy::DBusProxyExt;
771776
#[cfg(feature = "v2_72")]
772777
#[cfg_attr(docsrs, doc(cfg(feature = "v2_72")))]

0 commit comments

Comments
 (0)