Skip to content

Commit 2cd342d

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 2cd342d

17 files changed

+3134
-0
lines changed

gio/Gir.toml

+37
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,23 @@ 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.DtlsClientConnection",
65+
"Gio.DtlsServerConnection",
5866
"Gio.Emblem",
5967
"Gio.EmblemedIcon",
6068
"Gio.EmblemOrigin",
@@ -70,10 +78,12 @@ generate = [
7078
"Gio.FileMonitorEvent",
7179
"Gio.FileMonitorFlags",
7280
"Gio.FilenameCompleter",
81+
"Gio.FilesystemPreviewType",
7382
"Gio.FileOutputStream",
7483
"Gio.FileQueryInfoFlags",
7584
"Gio.FileType",
7685
"Gio.FilterInputStream",
86+
"Gio.IOModuleScopeFlags",
7787
"Gio.IOStreamSpliceFlags",
7888
"Gio.LoadableIcon",
7989
"Gio.MemoryMonitor",
@@ -85,6 +95,8 @@ generate = [
8595
"Gio.MountOperation",
8696
"Gio.MountOperationResult",
8797
"Gio.MountUnmountFlags",
98+
"Gio.NativeSocketAddress",
99+
"Gio.NativeVolumeMonitor",
88100
"Gio.NetworkConnectivity",
89101
"Gio.NetworkMonitor",
90102
"Gio.NetworkService",
@@ -96,11 +108,13 @@ generate = [
96108
"Gio.PollableReturn",
97109
"Gio.PropertyAction",
98110
"Gio.Proxy",
111+
"Gio.ProxyAddressEnumerator",
99112
"Gio.ProxyResolver",
100113
"Gio.RemoteActionGroup",
101114
"Gio.ResolverError",
102115
"Gio.ResolverNameLookupFlags",
103116
"Gio.ResourceError",
117+
"Gio.ResourceFlags",
104118
"Gio.ResourceLookupFlags",
105119
"Gio.Seekable",
106120
"Gio.SettingsBackend",
@@ -124,10 +138,14 @@ generate = [
124138
"Gio.SocketType",
125139
"Gio.SrvTarget",
126140
"Gio.TcpConnection",
141+
"Gio.TcpWrapperConnection",
142+
"Gio.TestDBus",
143+
"Gio.TestDBusFlags",
127144
"Gio.TlsAuthenticationMode",
128145
"Gio.TlsBackend",
129146
"Gio.TlsCertificate",
130147
"Gio.TlsCertificateRequestFlags",
148+
"Gio.TlsChannelBindingError",
131149
"Gio.TlsClientConnection",
132150
"Gio.TlsDatabase",
133151
"Gio.TlsDatabaseLookupFlags",
@@ -146,6 +164,7 @@ generate = [
146164
]
147165

148166
ignore = [
167+
"Gio.ThreadedResolver", # Same as sys class, not sure if this needs to be exposed
149168
]
150169

151170
manual = [
@@ -155,6 +174,7 @@ manual = [
155174
"Gio.IOExtension",
156175
"Gio.IOExtensionPoint",
157176
"Gio.OutputMessage",
177+
"Gio.SocketMsgFlags",
158178
"Gio.Task",
159179
"GLib.ByteArray",
160180
"GLib.Bytes",
@@ -708,6 +728,13 @@ cfg_condition = "all(not(windows),not(target_os = \"macos\"))"
708728
# has to use RawFd / SOCKET
709729
manual = true
710730

731+
[[object]]
732+
name = "Gio.DtlsConnection"
733+
status = "generate"
734+
[[object.function]]
735+
name = "get_channel_binding_data"
736+
ignore = true # needs manual implementation
737+
711738
[[object]]
712739
name = "Gio.File"
713740
status = "generate"
@@ -1480,6 +1507,11 @@ status = "generate"
14801507
name = "set_value"
14811508
ignore = true
14821509

1510+
[[object]]
1511+
name = "Gio.UnixConnection"
1512+
status = "generate"
1513+
cfg_condition = "unix"
1514+
14831515
[[object]]
14841516
name = "Gio.UnixCredentialsMessage"
14851517
status = "generate"
@@ -1601,6 +1633,11 @@ cfg_condition = "unix"
16011633
version = "2.0"
16021634
rename = "for_file_path"
16031635

1636+
[[object]]
1637+
name = "Gio.UnixMountMonitor"
1638+
status = "generate"
1639+
cfg_condition = "unix"
1640+
16041641
[[object]]
16051642
name = "Gio.UnixMountPoint"
16061643
status = "generate"
+124
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

+53
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)