summaryrefslogtreecommitdiff
path: root/src/nautilus-previewer.c
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@gnome.org>2011-05-09 15:08:26 -0400
committerCosimo Cecchi <cosimoc@gnome.org>2011-05-09 15:08:26 -0400
commitab6436cfa60a7f5088dd92f3d6dec74e0527b086 (patch)
tree99bb1341445eb3c2d0898bbebff1f40ff9d81a91 /src/nautilus-previewer.c
parent16b76b5f97dda14e2c3397345965a07ecc1cd377 (diff)
downloadnautilus-ab6436cfa60a7f5088dd92f3d6dec74e0527b086.tar.gz
previewer: avoid creating the dbus proxy more than once
Diffstat (limited to 'src/nautilus-previewer.c')
-rw-r--r--src/nautilus-previewer.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/nautilus-previewer.c b/src/nautilus-previewer.c
index a57d81e21..834cc0887 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);
}