Skip to content

Commit c869b0b

Browse files
bilelmoussaouisdroege
authored andcommitted
Generate all the missing Gio bindings
Only the ones that can be generated now without requiring any manual implementations.
1 parent 0fcb436 commit c869b0b

17 files changed

+3183
-0
lines changed

gio/Gir.toml

Lines changed: 37 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,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",
@@ -72,8 +80,10 @@ generate = [
7280
"Gio.FilenameCompleter",
7381
"Gio.FileOutputStream",
7482
"Gio.FileQueryInfoFlags",
83+
"Gio.FilesystemPreviewType",
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"
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
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+
mod sealed {
36+
pub trait Sealed {}
37+
impl<T: super::IsA<super::DBusObjectManagerServer>> Sealed for T {}
38+
}
39+
40+
pub trait DBusObjectManagerServerExt:
41+
IsA<DBusObjectManagerServer> + sealed::Sealed + 'static
42+
{
43+
#[doc(alias = "g_dbus_object_manager_server_export")]
44+
fn export(&self, object: &impl IsA<DBusObjectSkeleton>) {
45+
unsafe {
46+
ffi::g_dbus_object_manager_server_export(
47+
self.as_ref().to_glib_none().0,
48+
object.as_ref().to_glib_none().0,
49+
);
50+
}
51+
}
52+
53+
#[doc(alias = "g_dbus_object_manager_server_export_uniquely")]
54+
fn export_uniquely(&self, object: &impl IsA<DBusObjectSkeleton>) {
55+
unsafe {
56+
ffi::g_dbus_object_manager_server_export_uniquely(
57+
self.as_ref().to_glib_none().0,
58+
object.as_ref().to_glib_none().0,
59+
);
60+
}
61+
}
62+
63+
#[doc(alias = "g_dbus_object_manager_server_get_connection")]
64+
#[doc(alias = "get_connection")]
65+
fn connection(&self) -> Option<DBusConnection> {
66+
unsafe {
67+
from_glib_full(ffi::g_dbus_object_manager_server_get_connection(
68+
self.as_ref().to_glib_none().0,
69+
))
70+
}
71+
}
72+
73+
#[doc(alias = "g_dbus_object_manager_server_is_exported")]
74+
fn is_exported(&self, object: &impl IsA<DBusObjectSkeleton>) -> bool {
75+
unsafe {
76+
from_glib(ffi::g_dbus_object_manager_server_is_exported(
77+
self.as_ref().to_glib_none().0,
78+
object.as_ref().to_glib_none().0,
79+
))
80+
}
81+
}
82+
83+
#[doc(alias = "g_dbus_object_manager_server_set_connection")]
84+
#[doc(alias = "connection")]
85+
fn set_connection(&self, connection: Option<&DBusConnection>) {
86+
unsafe {
87+
ffi::g_dbus_object_manager_server_set_connection(
88+
self.as_ref().to_glib_none().0,
89+
connection.to_glib_none().0,
90+
);
91+
}
92+
}
93+
94+
#[doc(alias = "g_dbus_object_manager_server_unexport")]
95+
fn unexport(&self, object_path: &str) -> bool {
96+
unsafe {
97+
from_glib(ffi::g_dbus_object_manager_server_unexport(
98+
self.as_ref().to_glib_none().0,
99+
object_path.to_glib_none().0,
100+
))
101+
}
102+
}
103+
104+
#[doc(alias = "connection")]
105+
fn connect_connection_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
106+
unsafe extern "C" fn notify_connection_trampoline<
107+
P: IsA<DBusObjectManagerServer>,
108+
F: Fn(&P) + 'static,
109+
>(
110+
this: *mut ffi::GDBusObjectManagerServer,
111+
_param_spec: glib::ffi::gpointer,
112+
f: glib::ffi::gpointer,
113+
) {
114+
let f: &F = &*(f as *const F);
115+
f(DBusObjectManagerServer::from_glib_borrow(this).unsafe_cast_ref())
116+
}
117+
unsafe {
118+
let f: Box_<F> = Box_::new(f);
119+
connect_raw(
120+
self.as_ptr() as *mut _,
121+
b"notify::connection\0".as_ptr() as *const _,
122+
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
123+
notify_connection_trampoline::<Self, F> as *const (),
124+
)),
125+
Box_::into_raw(f),
126+
)
127+
}
128+
}
129+
}
130+
131+
impl<O: IsA<DBusObjectManagerServer>> DBusObjectManagerServerExt for O {}

gio/src/auto/dbus_object_proxy.rs

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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+
mod sealed {
32+
pub trait Sealed {}
33+
impl<T: super::IsA<super::DBusObjectProxy>> Sealed for T {}
34+
}
35+
36+
pub trait DBusObjectProxyExt: IsA<DBusObjectProxy> + sealed::Sealed + 'static {
37+
#[doc(alias = "g_dbus_object_proxy_get_connection")]
38+
#[doc(alias = "get_connection")]
39+
fn connection(&self) -> DBusConnection {
40+
unsafe {
41+
from_glib_none(ffi::g_dbus_object_proxy_get_connection(
42+
self.as_ref().to_glib_none().0,
43+
))
44+
}
45+
}
46+
47+
#[doc(alias = "g-connection")]
48+
fn g_connection(&self) -> Option<DBusConnection> {
49+
ObjectExt::property(self.as_ref(), "g-connection")
50+
}
51+
52+
#[doc(alias = "g-object-path")]
53+
fn g_object_path(&self) -> Option<glib::GString> {
54+
ObjectExt::property(self.as_ref(), "g-object-path")
55+
}
56+
}
57+
58+
impl<O: IsA<DBusObjectProxy>> DBusObjectProxyExt for O {}

0 commit comments

Comments
 (0)