Skip to content

Commit 39c9136

Browse files
Generate all the missing Gio bindings
Only the ones that can be generated now without requiring any manual implementations.
1 parent 8e2f4d0 commit 39c9136

19 files changed

+3213
-7
lines changed

gio/Gir.toml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ generate = [
2929
"Gio.DBusAuthObserver",
3030
"Gio.DBusCallFlags",
3131
"Gio.DBusCapabilityFlags",
32+
"Gio.DBusError",
3233
"Gio.DBusInterfaceGetPropertyFunc",
3334
"Gio.DBusInterfaceMethodCallFunc",
3435
"Gio.DBusInterfaceSetPropertyFunc",
@@ -45,16 +46,24 @@ generate = [
4546
"Gio.DBusObject",
4647
"Gio.DBusObjectManager",
4748
"Gio.DBusObjectManagerClientFlags",
49+
"Gio.DBusObjectManagerServer",
50+
"Gio.DBusObjectProxy",
51+
"Gio.DBusObjectSkeleton",
4852
"Gio.DBusPropertyInfo",
53+
"Gio.DBusPropertyInfoFlags",
4954
"Gio.DBusSendMessageFlags",
5055
"Gio.DBusServer",
5156
"Gio.DBusServerFlags",
5257
"Gio.DBusSignalFlags",
5358
"Gio.DBusSignalInfo",
59+
"Gio.DBusSubtreeFlags",
5460
"Gio.DebugController",
5561
"Gio.Drive",
5662
"Gio.DriveStartFlags",
5763
"Gio.DriveStartStopType",
64+
"Gio.DtlsConnection",
65+
"Gio.DtlsClientConnection",
66+
"Gio.DtlsServerConnection",
5867
"Gio.Emblem",
5968
"Gio.EmblemedIcon",
6069
"Gio.EmblemOrigin",
@@ -70,10 +79,13 @@ generate = [
7079
"Gio.FileMonitorEvent",
7180
"Gio.FileMonitorFlags",
7281
"Gio.FilenameCompleter",
82+
"Gio.FilesystemPreviewType",
7383
"Gio.FileOutputStream",
7484
"Gio.FileQueryInfoFlags",
7585
"Gio.FileType",
7686
"Gio.FilterInputStream",
87+
"Gio.IOModule",
88+
"Gio.IOModuleScopeFlags",
7789
"Gio.IOStreamSpliceFlags",
7890
"Gio.LoadableIcon",
7991
"Gio.MemoryMonitor",
@@ -85,6 +97,8 @@ generate = [
8597
"Gio.MountOperation",
8698
"Gio.MountOperationResult",
8799
"Gio.MountUnmountFlags",
100+
"Gio.NativeSocketAddress",
101+
"Gio.NativeVolumeMonitor",
88102
"Gio.NetworkConnectivity",
89103
"Gio.NetworkMonitor",
90104
"Gio.NetworkService",
@@ -96,11 +110,13 @@ generate = [
96110
"Gio.PollableReturn",
97111
"Gio.PropertyAction",
98112
"Gio.Proxy",
113+
"Gio.ProxyAddressEnumerator",
99114
"Gio.ProxyResolver",
100115
"Gio.RemoteActionGroup",
101116
"Gio.ResolverError",
102117
"Gio.ResolverNameLookupFlags",
103118
"Gio.ResourceError",
119+
"Gio.ResourceFlags",
104120
"Gio.ResourceLookupFlags",
105121
"Gio.Seekable",
106122
"Gio.SettingsBackend",
@@ -124,10 +140,14 @@ generate = [
124140
"Gio.SocketType",
125141
"Gio.SrvTarget",
126142
"Gio.TcpConnection",
143+
"Gio.TcpWrapperConnection",
144+
"Gio.TestDBus",
145+
"Gio.TestDBusFlags",
127146
"Gio.TlsAuthenticationMode",
128147
"Gio.TlsBackend",
129148
"Gio.TlsCertificate",
130149
"Gio.TlsCertificateRequestFlags",
150+
"Gio.TlsChannelBindingError",
131151
"Gio.TlsClientConnection",
132152
"Gio.TlsDatabase",
133153
"Gio.TlsDatabaseLookupFlags",
@@ -146,6 +166,7 @@ generate = [
146166
]
147167

148168
ignore = [
169+
"Gio.ThreadedResolver", # Same as sys class, not sure if this needs to be exposed
149170
]
150171

151172
manual = [
@@ -155,6 +176,7 @@ manual = [
155176
"Gio.IOExtension",
156177
"Gio.IOExtensionPoint",
157178
"Gio.OutputMessage",
179+
"Gio.SocketMsgFlags",
158180
"Gio.Task",
159181
"GLib.ByteArray",
160182
"GLib.Bytes",
@@ -1480,6 +1502,11 @@ status = "generate"
14801502
name = "set_value"
14811503
ignore = true
14821504

1505+
[[object]]
1506+
name = "Gio.UnixConnection"
1507+
status = "generate"
1508+
cfg_condition = "unix"
1509+
14831510
[[object]]
14841511
name = "Gio.UnixCredentialsMessage"
14851512
status = "generate"
@@ -1601,6 +1628,11 @@ cfg_condition = "unix"
16011628
version = "2.0"
16021629
rename = "for_file_path"
16031630

1631+
[[object]]
1632+
name = "Gio.UnixMountMonitor"
1633+
status = "generate"
1634+
cfg_condition = "unix"
1635+
16041636
[[object]]
16051637
name = "Gio.UnixMountPoint"
16061638
status = "generate"
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
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::{ffi, DBusConnection, DBusObjectManager, DBusObjectSkeleton};
6+
use glib::{
7+
prelude::*,
8+
signal::{connect_raw, SignalHandlerId},
9+
translate::*,
10+
};
11+
use std::boxed::Box as Box_;
12+
13+
glib::wrapper! {
14+
#[doc(alias = "GDBusObjectManagerServer")]
15+
pub struct DBusObjectManagerServer(Object<ffi::GDBusObjectManagerServer, ffi::GDBusObjectManagerServerClass>) @implements DBusObjectManager;
16+
17+
match fn {
18+
type_ => || ffi::g_dbus_object_manager_server_get_type(),
19+
}
20+
}
21+
22+
impl DBusObjectManagerServer {
23+
pub const NONE: Option<&'static DBusObjectManagerServer> = None;
24+
25+
#[doc(alias = "g_dbus_object_manager_server_new")]
26+
pub fn new(object_path: &str) -> DBusObjectManagerServer {
27+
unsafe {
28+
from_glib_full(ffi::g_dbus_object_manager_server_new(
29+
object_path.to_glib_none().0,
30+
))
31+
}
32+
}
33+
}
34+
35+
pub trait DBusObjectManagerServerExt: IsA<DBusObjectManagerServer> + 'static {
36+
#[doc(alias = "g_dbus_object_manager_server_export")]
37+
fn export(&self, object: &impl IsA<DBusObjectSkeleton>) {
38+
unsafe {
39+
ffi::g_dbus_object_manager_server_export(
40+
self.as_ref().to_glib_none().0,
41+
object.as_ref().to_glib_none().0,
42+
);
43+
}
44+
}
45+
46+
#[doc(alias = "g_dbus_object_manager_server_export_uniquely")]
47+
fn export_uniquely(&self, object: &impl IsA<DBusObjectSkeleton>) {
48+
unsafe {
49+
ffi::g_dbus_object_manager_server_export_uniquely(
50+
self.as_ref().to_glib_none().0,
51+
object.as_ref().to_glib_none().0,
52+
);
53+
}
54+
}
55+
56+
#[doc(alias = "g_dbus_object_manager_server_get_connection")]
57+
#[doc(alias = "get_connection")]
58+
fn connection(&self) -> Option<DBusConnection> {
59+
unsafe {
60+
from_glib_full(ffi::g_dbus_object_manager_server_get_connection(
61+
self.as_ref().to_glib_none().0,
62+
))
63+
}
64+
}
65+
66+
#[doc(alias = "g_dbus_object_manager_server_is_exported")]
67+
fn is_exported(&self, object: &impl IsA<DBusObjectSkeleton>) -> bool {
68+
unsafe {
69+
from_glib(ffi::g_dbus_object_manager_server_is_exported(
70+
self.as_ref().to_glib_none().0,
71+
object.as_ref().to_glib_none().0,
72+
))
73+
}
74+
}
75+
76+
#[doc(alias = "g_dbus_object_manager_server_set_connection")]
77+
#[doc(alias = "connection")]
78+
fn set_connection(&self, connection: Option<&DBusConnection>) {
79+
unsafe {
80+
ffi::g_dbus_object_manager_server_set_connection(
81+
self.as_ref().to_glib_none().0,
82+
connection.to_glib_none().0,
83+
);
84+
}
85+
}
86+
87+
#[doc(alias = "g_dbus_object_manager_server_unexport")]
88+
fn unexport(&self, object_path: &str) -> bool {
89+
unsafe {
90+
from_glib(ffi::g_dbus_object_manager_server_unexport(
91+
self.as_ref().to_glib_none().0,
92+
object_path.to_glib_none().0,
93+
))
94+
}
95+
}
96+
97+
#[doc(alias = "connection")]
98+
fn connect_connection_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
99+
unsafe extern "C" fn notify_connection_trampoline<
100+
P: IsA<DBusObjectManagerServer>,
101+
F: Fn(&P) + 'static,
102+
>(
103+
this: *mut ffi::GDBusObjectManagerServer,
104+
_param_spec: glib::ffi::gpointer,
105+
f: glib::ffi::gpointer,
106+
) {
107+
let f: &F = &*(f as *const F);
108+
f(DBusObjectManagerServer::from_glib_borrow(this).unsafe_cast_ref())
109+
}
110+
unsafe {
111+
let f: Box_<F> = Box_::new(f);
112+
connect_raw(
113+
self.as_ptr() as *mut _,
114+
b"notify::connection\0".as_ptr() as *const _,
115+
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
116+
notify_connection_trampoline::<Self, F> as *const (),
117+
)),
118+
Box_::into_raw(f),
119+
)
120+
}
121+
}
122+
}
123+
124+
impl<O: IsA<DBusObjectManagerServer>> DBusObjectManagerServerExt for O {}

gio/src/auto/dbus_object_proxy.rs

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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::{ffi, DBusConnection, DBusObject};
6+
use glib::{prelude::*, translate::*};
7+
8+
glib::wrapper! {
9+
#[doc(alias = "GDBusObjectProxy")]
10+
pub struct DBusObjectProxy(Object<ffi::GDBusObjectProxy, ffi::GDBusObjectProxyClass>) @implements DBusObject;
11+
12+
match fn {
13+
type_ => || ffi::g_dbus_object_proxy_get_type(),
14+
}
15+
}
16+
17+
impl DBusObjectProxy {
18+
pub const NONE: Option<&'static DBusObjectProxy> = None;
19+
20+
#[doc(alias = "g_dbus_object_proxy_new")]
21+
pub fn new(connection: &DBusConnection, object_path: &str) -> DBusObjectProxy {
22+
unsafe {
23+
from_glib_full(ffi::g_dbus_object_proxy_new(
24+
connection.to_glib_none().0,
25+
object_path.to_glib_none().0,
26+
))
27+
}
28+
}
29+
}
30+
31+
pub trait DBusObjectProxyExt: IsA<DBusObjectProxy> + 'static {
32+
#[doc(alias = "g_dbus_object_proxy_get_connection")]
33+
#[doc(alias = "get_connection")]
34+
fn connection(&self) -> DBusConnection {
35+
unsafe {
36+
from_glib_none(ffi::g_dbus_object_proxy_get_connection(
37+
self.as_ref().to_glib_none().0,
38+
))
39+
}
40+
}
41+
42+
#[doc(alias = "g-connection")]
43+
fn g_connection(&self) -> Option<DBusConnection> {
44+
ObjectExt::property(self.as_ref(), "g-connection")
45+
}
46+
47+
#[doc(alias = "g-object-path")]
48+
fn g_object_path(&self) -> Option<glib::GString> {
49+
ObjectExt::property(self.as_ref(), "g-object-path")
50+
}
51+
}
52+
53+
impl<O: IsA<DBusObjectProxy>> DBusObjectProxyExt for O {}

0 commit comments

Comments
 (0)