diff --git a/docs/reference/gio/migrating-gdbus.xml b/docs/reference/gio/migrating-gdbus.xml index 70e6f2d5b..1f33e0229 100644 --- a/docs/reference/gio/migrating-gdbus.xml +++ b/docs/reference/gio/migrating-gdbus.xml @@ -42,9 +42,9 @@ dbus-glibGDBus - #DBusGConnection#GDBusConnection - #DBusGProxy#GDBusProxy - #DBusGMethodInvocation#GDBusMethodInvocatoin + #DBusGConnection#GDBusConnection + #DBusGProxy#GDBusProxy + #DBusGMethodInvocation#GDBusMethodInvocatoin dbus_g_bus_get()g_bus_get_sync(), also see g_bus_get() dbus_g_proxy_new_for_name()g_dbus_proxy_new_sync(), also see @@ -67,4 +67,87 @@ + +
+ Owning bus names + + Using dbus-glib, you typically call RequestName manually + to own a name, like in the following excerpt: + message); + g_error_free (error); + } + else { + g_warning ("Failed to acquire %s", NAME_TO_CLAIM); + } + goto out; + } + + if (result != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { + if (error != NULL) { + g_warning ("Failed to acquire %s: %s", + NAME_TO_CLAIM, error->message); + g_error_free (error); + } + else { + g_warning ("Failed to acquire %s", NAME_TO_CLAIM); + } + goto out; + } + + dbus_g_proxy_add_signal (system_bus_proxy, "NameLost", + G_TYPE_STRING, G_TYPE_INVALID); + dbus_g_proxy_connect_signal (system_bus_proxy, "NameLost", + G_CALLBACK (name_lost), NULL, NULL); + ret = TRUE; +out: + return ret; +} +]]> + + + + While you can do things this way with GDBus too, it is much nicer + to use the high-level API for this: + + ...insert example here... + +
+ +
+ Creating proxies for well-known names + + +