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

Marc-André Lureau mlureau at redhat.com
Wed Jan 28 05:11:36 PST 2015


looks good, ack

----- Original Message -----
> 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 at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
> 


More information about the Spice-devel mailing list