Re: [PATCH spice-gtk 3/5] dbus: remove priv->dbus_conn

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

 



On Thu, Feb 06, 2014 at 01:55:53PM +0100, Marc-André Lureau wrote:
> From: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>
> 
> It's only needed once, and it is better to group with rest of dbus-glib
> code.

Patch looks good, any idea if conn should be dbus_g_connection_unref()
after use?
ACK.

Christophe

> ---
>  gtk/desktop-integration.c | 18 ++++++------------
>  1 file changed, 6 insertions(+), 12 deletions(-)
> 
> diff --git a/gtk/desktop-integration.c b/gtk/desktop-integration.c
> index dd63b17..06712d9 100644
> --- a/gtk/desktop-integration.c
> +++ b/gtk/desktop-integration.c
> @@ -42,7 +42,6 @@
>  
>  struct _SpiceDesktopIntegrationPrivate {
>  #ifdef USE_DBUS_GLIB
> -    DBusGConnection *dbus_conn;
>      DBusGProxy *gnome_session_proxy;
>      guint gnome_automount_inhibit_cookie;
>  #else
> @@ -73,18 +72,21 @@ static gboolean gnome_integration_init(SpiceDesktopIntegration *self)
>  {
>      SpiceDesktopIntegrationPrivate *priv = self->priv;
>      GError *error = NULL;
> +    DBusGConnection *conn;
>  
> -    if (!priv->dbus_conn)
> -        return FALSE;
> +    conn = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
> +    if (!conn)
> +        goto end;
>  
>      /* We use for_name_owner, to resolve the name now, as we may not be
>         running under gnome-session manager at all! */
>      priv->gnome_session_proxy = dbus_g_proxy_new_for_name_owner(
> -                                            priv->dbus_conn,
> +                                            conn,
>                                              "org.gnome.SessionManager",
>                                              "/org/gnome/SessionManager",
>                                              "org.gnome.SessionManager",
>                                              &error);
> +end:
>      if (error) {
>          g_debug("Could not create org.gnome.SessionManager dbus proxy: %s",
>                  error->message);
> @@ -155,19 +157,11 @@ static void gnome_integration_dispose(SpiceDesktopIntegration *self)
>  static void spice_desktop_integration_init(SpiceDesktopIntegration *self)
>  {
>      SpiceDesktopIntegrationPrivate *priv;
> -#ifdef USE_DBUS_GLIB
> -    GError *error = NULL;
> -#endif
>  
>      priv = SPICE_DESKTOP_INTEGRATION_GET_PRIVATE(self);
>      self->priv = priv;
>  
>  #ifdef USE_DBUS_GLIB
> -    priv->dbus_conn = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
> -    if (!priv->dbus_conn) {
> -       g_warning("Error connecting to session dbus: %s", error->message);
> -       g_clear_error(&error);
> -    }
>      if (!gnome_integration_init(self))
>  #endif
>         g_warning("Warning no automount-inhibiting implementation available");
> -- 
> 1.8.4.2
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> http://lists.freedesktop.org/mailman/listinfo/spice-devel

Attachment: pgpypHYICmEXv.pgp
Description: PGP signature

_______________________________________________
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]