[PATCH spice-gtk] desktop-integration: check owner of bus name

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It avoids calling D-Bus methods when the bus name
"org.gnome.SessionManager" does not exist.

Silences:
GSpice-WARNING **: Error calling 'org.gnome.SessionManager.Inhibit': GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files
---
 gtk/desktop-integration.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/gtk/desktop-integration.c b/gtk/desktop-integration.c
index c366fd0..5868d48 100644
--- a/gtk/desktop-integration.c
+++ b/gtk/desktop-integration.c
@@ -67,6 +67,7 @@ static gboolean gnome_integration_init(SpiceDesktopIntegration *self)
     gboolean success = TRUE;
 
 #if defined(USE_GDBUS)
+    gchar *name_owner = NULL;
     priv->gnome_session_proxy =
         g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SESSION,
                                       G_DBUS_PROXY_FLAGS_NONE,
@@ -76,6 +77,12 @@ static gboolean gnome_integration_init(SpiceDesktopIntegration *self)
                                       "org.gnome.SessionManager",
                                       NULL,
                                       &error);
+    if (!error &&
+        (name_owner = g_dbus_proxy_get_name_owner(priv->gnome_session_proxy)) == NULL) {
+        g_clear_object(&priv->gnome_session_proxy);
+        success = FALSE;
+    }
+    g_free(name_owner);
 #else
     success = FALSE;
 #endif
-- 
1.9.3

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]