From ab6436cfa60a7f5088dd92f3d6dec74e0527b086 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Mon, 9 May 2011 15:08:26 -0400 Subject: previewer: avoid creating the dbus proxy more than once --- src/nautilus-previewer.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'src/nautilus-previewer.c') 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); } -- cgit v1.2.1