[Spice-commits] gtk/desktop-integration.c

Pavel Grunt pgrunt at kemper.freedesktop.org
Wed Jan 28 22:46:45 PST 2015


 gtk/desktop-integration.c |    7 +++++++
 1 file changed, 7 insertions(+)

New commits:
commit 6e86378ec9de4ca1610e1a47a099e8f772cdb3b5
Author: Pavel Grunt <pgrunt at redhat.com>
Date:   Wed Jan 28 12:47:32 2015 +0100

    desktop-integration: check owner of bus name
    
    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

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


More information about the Spice-commits mailing list