Skip to content

Commit

Permalink
Generate all the missing Gio bindings
Browse files Browse the repository at this point in the history
Only the ones that can be generated now without requiring any manual implementations.
  • Loading branch information
bilelmoussaoui committed Dec 1, 2024
1 parent 8e2f4d0 commit 39c9136
Show file tree
Hide file tree
Showing 19 changed files with 3,213 additions and 7 deletions.
32 changes: 32 additions & 0 deletions gio/Gir.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ generate = [
"Gio.DBusAuthObserver",
"Gio.DBusCallFlags",
"Gio.DBusCapabilityFlags",
"Gio.DBusError",
"Gio.DBusInterfaceGetPropertyFunc",
"Gio.DBusInterfaceMethodCallFunc",
"Gio.DBusInterfaceSetPropertyFunc",
Expand All @@ -45,16 +46,24 @@ generate = [
"Gio.DBusObject",
"Gio.DBusObjectManager",
"Gio.DBusObjectManagerClientFlags",
"Gio.DBusObjectManagerServer",
"Gio.DBusObjectProxy",
"Gio.DBusObjectSkeleton",
"Gio.DBusPropertyInfo",
"Gio.DBusPropertyInfoFlags",
"Gio.DBusSendMessageFlags",
"Gio.DBusServer",
"Gio.DBusServerFlags",
"Gio.DBusSignalFlags",
"Gio.DBusSignalInfo",
"Gio.DBusSubtreeFlags",
"Gio.DebugController",
"Gio.Drive",
"Gio.DriveStartFlags",
"Gio.DriveStartStopType",
"Gio.DtlsConnection",
"Gio.DtlsClientConnection",
"Gio.DtlsServerConnection",
"Gio.Emblem",
"Gio.EmblemedIcon",
"Gio.EmblemOrigin",
Expand All @@ -70,10 +79,13 @@ generate = [
"Gio.FileMonitorEvent",
"Gio.FileMonitorFlags",
"Gio.FilenameCompleter",
"Gio.FilesystemPreviewType",
"Gio.FileOutputStream",
"Gio.FileQueryInfoFlags",
"Gio.FileType",
"Gio.FilterInputStream",
"Gio.IOModule",
"Gio.IOModuleScopeFlags",
"Gio.IOStreamSpliceFlags",
"Gio.LoadableIcon",
"Gio.MemoryMonitor",
Expand All @@ -85,6 +97,8 @@ generate = [
"Gio.MountOperation",
"Gio.MountOperationResult",
"Gio.MountUnmountFlags",
"Gio.NativeSocketAddress",
"Gio.NativeVolumeMonitor",
"Gio.NetworkConnectivity",
"Gio.NetworkMonitor",
"Gio.NetworkService",
Expand All @@ -96,11 +110,13 @@ generate = [
"Gio.PollableReturn",
"Gio.PropertyAction",
"Gio.Proxy",
"Gio.ProxyAddressEnumerator",
"Gio.ProxyResolver",
"Gio.RemoteActionGroup",
"Gio.ResolverError",
"Gio.ResolverNameLookupFlags",
"Gio.ResourceError",
"Gio.ResourceFlags",
"Gio.ResourceLookupFlags",
"Gio.Seekable",
"Gio.SettingsBackend",
Expand All @@ -124,10 +140,14 @@ generate = [
"Gio.SocketType",
"Gio.SrvTarget",
"Gio.TcpConnection",
"Gio.TcpWrapperConnection",
"Gio.TestDBus",
"Gio.TestDBusFlags",
"Gio.TlsAuthenticationMode",
"Gio.TlsBackend",
"Gio.TlsCertificate",
"Gio.TlsCertificateRequestFlags",
"Gio.TlsChannelBindingError",
"Gio.TlsClientConnection",
"Gio.TlsDatabase",
"Gio.TlsDatabaseLookupFlags",
Expand All @@ -146,6 +166,7 @@ generate = [
]

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

manual = [
Expand All @@ -155,6 +176,7 @@ manual = [
"Gio.IOExtension",
"Gio.IOExtensionPoint",
"Gio.OutputMessage",
"Gio.SocketMsgFlags",
"Gio.Task",
"GLib.ByteArray",
"GLib.Bytes",
Expand Down Expand Up @@ -1480,6 +1502,11 @@ status = "generate"
name = "set_value"
ignore = true

[[object]]
name = "Gio.UnixConnection"
status = "generate"
cfg_condition = "unix"

[[object]]
name = "Gio.UnixCredentialsMessage"
status = "generate"
Expand Down Expand Up @@ -1601,6 +1628,11 @@ cfg_condition = "unix"
version = "2.0"
rename = "for_file_path"

[[object]]
name = "Gio.UnixMountMonitor"
status = "generate"
cfg_condition = "unix"

[[object]]
name = "Gio.UnixMountPoint"
status = "generate"
Expand Down
124 changes: 124 additions & 0 deletions gio/src/auto/dbus_object_manager_server.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use crate::{ffi, DBusConnection, DBusObjectManager, DBusObjectSkeleton};
use glib::{
prelude::*,
signal::{connect_raw, SignalHandlerId},
translate::*,
};
use std::boxed::Box as Box_;

glib::wrapper! {
#[doc(alias = "GDBusObjectManagerServer")]
pub struct DBusObjectManagerServer(Object<ffi::GDBusObjectManagerServer, ffi::GDBusObjectManagerServerClass>) @implements DBusObjectManager;

match fn {
type_ => || ffi::g_dbus_object_manager_server_get_type(),
}
}

impl DBusObjectManagerServer {
pub const NONE: Option<&'static DBusObjectManagerServer> = None;

#[doc(alias = "g_dbus_object_manager_server_new")]
pub fn new(object_path: &str) -> DBusObjectManagerServer {
unsafe {
from_glib_full(ffi::g_dbus_object_manager_server_new(
object_path.to_glib_none().0,
))
}
}
}

pub trait DBusObjectManagerServerExt: IsA<DBusObjectManagerServer> + 'static {
#[doc(alias = "g_dbus_object_manager_server_export")]
fn export(&self, object: &impl IsA<DBusObjectSkeleton>) {
unsafe {
ffi::g_dbus_object_manager_server_export(
self.as_ref().to_glib_none().0,
object.as_ref().to_glib_none().0,
);
}
}

#[doc(alias = "g_dbus_object_manager_server_export_uniquely")]
fn export_uniquely(&self, object: &impl IsA<DBusObjectSkeleton>) {
unsafe {
ffi::g_dbus_object_manager_server_export_uniquely(
self.as_ref().to_glib_none().0,
object.as_ref().to_glib_none().0,
);
}
}

#[doc(alias = "g_dbus_object_manager_server_get_connection")]
#[doc(alias = "get_connection")]
fn connection(&self) -> Option<DBusConnection> {
unsafe {
from_glib_full(ffi::g_dbus_object_manager_server_get_connection(
self.as_ref().to_glib_none().0,
))
}
}

#[doc(alias = "g_dbus_object_manager_server_is_exported")]
fn is_exported(&self, object: &impl IsA<DBusObjectSkeleton>) -> bool {
unsafe {
from_glib(ffi::g_dbus_object_manager_server_is_exported(
self.as_ref().to_glib_none().0,
object.as_ref().to_glib_none().0,
))
}
}

#[doc(alias = "g_dbus_object_manager_server_set_connection")]
#[doc(alias = "connection")]
fn set_connection(&self, connection: Option<&DBusConnection>) {
unsafe {
ffi::g_dbus_object_manager_server_set_connection(
self.as_ref().to_glib_none().0,
connection.to_glib_none().0,
);
}
}

#[doc(alias = "g_dbus_object_manager_server_unexport")]
fn unexport(&self, object_path: &str) -> bool {
unsafe {
from_glib(ffi::g_dbus_object_manager_server_unexport(
self.as_ref().to_glib_none().0,
object_path.to_glib_none().0,
))
}
}

#[doc(alias = "connection")]
fn connect_connection_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_connection_trampoline<
P: IsA<DBusObjectManagerServer>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::GDBusObjectManagerServer,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(DBusObjectManagerServer::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::connection\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_connection_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
}

impl<O: IsA<DBusObjectManagerServer>> DBusObjectManagerServerExt for O {}
53 changes: 53 additions & 0 deletions gio/src/auto/dbus_object_proxy.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use crate::{ffi, DBusConnection, DBusObject};
use glib::{prelude::*, translate::*};

glib::wrapper! {
#[doc(alias = "GDBusObjectProxy")]
pub struct DBusObjectProxy(Object<ffi::GDBusObjectProxy, ffi::GDBusObjectProxyClass>) @implements DBusObject;

match fn {
type_ => || ffi::g_dbus_object_proxy_get_type(),
}
}

impl DBusObjectProxy {
pub const NONE: Option<&'static DBusObjectProxy> = None;

#[doc(alias = "g_dbus_object_proxy_new")]
pub fn new(connection: &DBusConnection, object_path: &str) -> DBusObjectProxy {
unsafe {
from_glib_full(ffi::g_dbus_object_proxy_new(
connection.to_glib_none().0,
object_path.to_glib_none().0,
))
}
}
}

pub trait DBusObjectProxyExt: IsA<DBusObjectProxy> + 'static {
#[doc(alias = "g_dbus_object_proxy_get_connection")]
#[doc(alias = "get_connection")]
fn connection(&self) -> DBusConnection {
unsafe {
from_glib_none(ffi::g_dbus_object_proxy_get_connection(
self.as_ref().to_glib_none().0,
))
}
}

#[doc(alias = "g-connection")]
fn g_connection(&self) -> Option<DBusConnection> {
ObjectExt::property(self.as_ref(), "g-connection")
}

#[doc(alias = "g-object-path")]
fn g_object_path(&self) -> Option<glib::GString> {
ObjectExt::property(self.as_ref(), "g-object-path")
}
}

impl<O: IsA<DBusObjectProxy>> DBusObjectProxyExt for O {}
Loading

0 comments on commit 39c9136

Please sign in to comment.