[nautilus] previewer: avoid creating the dbus proxy more than once



commit ab6436cfa60a7f5088dd92f3d6dec74e0527b086
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon May 9 15:08:26 2011 -0400

    previewer: avoid creating the dbus proxy more than once

 src/nautilus-previewer.c |   23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)
---
diff --git a/src/nautilus-previewer.c b/src/nautilus-previewer.c
index a57d81e..834cc08 100644
--- a/src/nautilus-previewer.c
+++ b/src/nautilus-previewer.c
@@ -186,19 +186,24 @@ nautilus_previewer_call_show_file (NautilusPreviewer *self,
   g_object_ref (self);
 
   if (self->priv->proxy == NULL) {
+    /* if we already have a variant, don't call
+     * g_dbus_proxy_new_for_bus() again, but just change the pending
+     * argument to the new variant.
+     */
     if (self->priv->pending_variant != NULL)
       g_variant_unref (self->priv->pending_variant);
+    else
+      g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION,
+                                G_DBUS_PROXY_FLAGS_NONE,
+                                NULL,
+                                PREVIEWER_DBUS_NAME,
+                                PREVIEWER_DBUS_PATH,
+                                PREVIEWER_DBUS_IFACE,
+                                NULL,
+                                previewer_proxy_async_ready_cb,
+                                self);
 
     self->priv->pending_variant = g_variant_ref_sink (variant);
-    g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION,
-                              G_DBUS_PROXY_FLAGS_NONE,
-                              NULL,
-                              PREVIEWER_DBUS_NAME,
-                              PREVIEWER_DBUS_PATH,
-                              PREVIEWER_DBUS_IFACE,
-                              NULL,
-                              previewer_proxy_async_ready_cb,
-                              self);
   } else {
     real_call_show_file (self, variant);
   }



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