[nautilus] previewer: don't return a new ref to the singleton



commit a8f2c97e5f67fa1c309cf694f8ca00f5dc38abb9
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Sun May 1 17:50:15 2011 -0400

    previewer: don't return a new ref to the singleton
    
    It's easier to use this way, and we don't have to create a new DBus
    proxy every time.

 src/nautilus-previewer.c |    4 ++--
 src/nautilus-previewer.h |    2 +-
 src/nautilus-view.c      |    4 +---
 3 files changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/src/nautilus-previewer.c b/src/nautilus-previewer.c
index f5358fd..d0562e8 100644
--- a/src/nautilus-previewer.c
+++ b/src/nautilus-previewer.c
@@ -62,7 +62,7 @@ nautilus_previewer_constructor (GType type,
   GObject *retval;
 
   if (singleton != NULL)
-    return g_object_ref (singleton);
+    return G_OBJECT (singleton);
 
   retval = G_OBJECT_CLASS (nautilus_previewer_parent_class)->constructor
     (type, n_construct_params, construct_params);
@@ -168,7 +168,7 @@ previewer_proxy_async_ready_cb (GObject *source,
 }
 
 NautilusPreviewer *
-nautilus_previewer_dup_singleton (void)
+nautilus_previewer_get_singleton (void)
 {
   return g_object_new (NAUTILUS_TYPE_PREVIEWER, NULL);
 }
diff --git a/src/nautilus-previewer.h b/src/nautilus-previewer.h
index 82ab2f5..30fa652 100644
--- a/src/nautilus-previewer.h
+++ b/src/nautilus-previewer.h
@@ -55,7 +55,7 @@ typedef struct {
 
 GType nautilus_previewer_get_type (void);
 
-NautilusPreviewer *nautilus_previewer_dup_singleton (void);
+NautilusPreviewer *nautilus_previewer_get_singleton (void);
 void nautilus_previewer_call_show_file (NautilusPreviewer *previewer,
                                         const gchar *uri,
                                         guint xid,
diff --git a/src/nautilus-view.c b/src/nautilus-view.c
index 38fa7f7..12bc534 100644
--- a/src/nautilus-view.c
+++ b/src/nautilus-view.c
@@ -1121,14 +1121,12 @@ nautilus_view_preview_files (NautilusView *view,
 	guint xid;
 	GtkWidget *toplevel;
 
-	previewer = nautilus_previewer_dup_singleton ();
+	previewer = nautilus_previewer_get_singleton ();
 	uri = nautilus_file_get_uri (files->data);
 	toplevel = gtk_widget_get_toplevel (GTK_WIDGET (view));
 
 	xid = gdk_x11_window_get_xid (gtk_widget_get_window (toplevel));
 	nautilus_previewer_call_show_file (previewer, uri, xid, TRUE);
-
-	g_object_unref (previewer);
 }
 
 void



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