-
-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1587 from gtk-rs/bilelmoussaoui/gio-bindings
Generate all the missing Gio bindings
- Loading branch information
Showing
17 changed files
with
3,134 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 {} |
Oops, something went wrong.