DBusConnection
Object Hierarchy:
GLib.DBusConnection
GLib.DBusConnection
GLib.DBusConnection
GLib.Object
GLib.Object
GLib.Object->GLib.DBusConnection
GLib.AsyncInitable
GLib.AsyncInitable
GLib.AsyncInitable->GLib.DBusConnection
GLib.Initable
GLib.Initable
GLib.Initable->GLib.DBusConnection
Description:
[
CCode ( type_id =
"g_dbus_connection_get_type ()" ) ]
[
Version ( since =
"2.26" ) ]
public class DBusConnection :
Object ,
AsyncInitable ,
Initable
Example: Using extra D-Bus hooks with a GLib.Application::
public class MyApplication : Application { private MyApplication () { Object (application_id: "org.example.application" , flags: 0 ); set_inactivity_timeout (10000 ); } public override void activate () { // NOTE: when doing a longer-lasting action here that returns // to the mainloop, you should use g_application_hold() and // g_application_release() to keep the application alive until // the action is completed. print ("Activated \n " ); } public override bool dbus_register (DBusConnection connection, string object_path) throws Error { // We must chain up to the parent class: base .dbus_register (connection, object_path); // Now we can do our own stuff here. For example, we could export some D-Bus objects return true ; } public override void dbus_unregister (DBusConnection connection, string object_path) { // Do our own stuff here, e.g. unexport any D-Bus objects we exported in the dbus_register // hook above. Be sure to check that we actually did export them, since the hook // above might have returned early due to the parent class' hook returning false! base .dbus_unregister (connection, object_path); } public static int main (string [] args) { MyApplication app = new MyApplication (); int status = app.run (args); return status; } }
valac --pkg gio-2.0 GLib.Application.3 .vala
Content:
Properties:
Static methods:
Creation methods:
public async DBusConnection (IOStream stream, string ? guid, DBusConnectionFlags flags, DBusAuthObserver ? observer = null , Cancellable ? cancellable = null ) throws Error
public async DBusConnection.for_address (string address, DBusConnectionFlags flags, DBusAuthObserver ? observer = null , Cancellable ? cancellable = null ) throws Error
public DBusConnection.for_address_sync (string address, DBusConnectionFlags flags, DBusAuthObserver ? observer = null , Cancellable ? cancellable = null ) throws Error
public DBusConnection.sync (IOStream stream, string ? guid, DBusConnectionFlags flags, DBusAuthObserver ? observer = null , Cancellable ? cancellable = null ) throws Error
Methods:
public uint add_filter (owned DBusMessageFilterFunction filter_function)
public async Variant call (string ? bus_name, string object_path, string interface_name, string method_name, Variant ? parameters, VariantType ? reply_type, DBusCallFlags flags, int timeout_msec, Cancellable ? cancellable = null ) throws Error
public Variant call_sync (string ? bus_name, string object_path, string interface_name, string method_name, Variant ? parameters, VariantType ? reply_type, DBusCallFlags flags, int timeout_msec, Cancellable ? cancellable = null ) throws Error
public async Variant call_with_unix_fd_list (string ? bus_name, string object_path, string interface_name, string method_name, Variant ? parameters, VariantType ? reply_type, DBusCallFlags flags, int timeout_msec, UnixFDList ? fd_list = null , Cancellable ? cancellable = null , out UnixFDList ? out_fd_list = null ) throws Error
public Variant call_with_unix_fd_list_sync (string ? bus_name, string object_path, string interface_name, string method_name, Variant ? parameters, VariantType ? reply_type, DBusCallFlags flags, int timeout_msec, UnixFDList ? fd_list = null , out UnixFDList ? out_fd_list = null , Cancellable ? cancellable = null ) throws Error
public async bool close (Cancellable ? cancellable = null ) throws Error
public bool close_sync (Cancellable ? cancellable = null ) throws Error
public bool emit_signal (string ? destination_bus_name, string object_path, string interface_name, string signal_name, Variant ? parameters) throws Error
public uint export_action_group (string object_path, ActionGroup action_group) throws Error
public uint export_menu_model (string object_path, MenuModel menu) throws Error
public async bool flush (Cancellable ? cancellable = null ) throws Error
public bool flush_sync (Cancellable ? cancellable = null ) throws Error
public DBusCapabilityFlags get_capabilities ()
public bool get_exit_on_close ()
public DBusConnectionFlags get_flags ()
public unowned string get_guid ()
public uint32 get_last_serial ()
public unowned Credentials ? get_peer_credentials ()
public async T get_proxy <T > (string ? name, string object_path, DBusProxyFlags flags = 0 , Cancellable ? cancellable = null ) throws IOError
public T get_proxy_sync <T > (string ? name, string object_path, DBusProxyFlags flags = 0 , Cancellable ? cancellable = null ) throws IOError
public unowned IOStream get_stream ()
public unowned string ? get_unique_name ()
public bool is_closed ()
public uint register_object <T > (string object_path, T object) throws IOError
public uint register_object_with_closures (string object_path, DBusInterfaceInfo interface_info, Closure ? method_call_closure, Closure ? get_property_closure, Closure ? set_property_closure) throws Error
public uint register_subtree (string object_path, DBusSubtreeVTable vtable, DBusSubtreeFlags flags, void * user_data, DestroyNotify user_data_free_func) throws Error
public void remove_filter (uint filter_id)
public bool send_message (DBusMessage message, DBusSendMessageFlags flags, out uint32 out_serial) throws Error
public async DBusMessage send_message_with_reply (DBusMessage message, DBusSendMessageFlags flags, int timeout_msec, uint32 * out_serial = null , Cancellable ? cancellable = null ) throws IOError
public DBusMessage send_message_with_reply_sync (DBusMessage message, DBusSendMessageFlags flags, int timeout_msec, out uint32 out_serial = null , Cancellable ? cancellable = null ) throws IOError
public void set_exit_on_close (bool exit_on_close)
public uint signal_subscribe (string ? sender, string ? interface_name, string ? member, string ? object_path, string ? arg0, DBusSignalFlags flags, owned DBusSignalCallback callback)
public void signal_unsubscribe (uint subscription_id)
public void start_message_processing ()
public void unexport_action_group (uint export_id)
public void unexport_menu_model (uint export_id)
public bool unregister_object (uint registration_id)
public bool unregister_subtree (uint registration_id)
Signals:
Inherited Members:
All known members inherited from class GLib.Object
All known members inherited from interface GLib.AsyncInitable
All known members inherited from interface GLib.Initable