[nautilus] application: don't handle the singleton ourselves



commit 65bb4c9fb1d3a72ca4773a8b002ca3be09eed7d7
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Wed Apr 25 13:21:47 2012 -0400

    application: don't handle the singleton ourselves
    
    Since GIO has g_application_get_default() now, there's no need to keep
    track of the singleton ourselves.
    Remove the _get_singleton() method from NautilusApplication.

 src/nautilus-application.c |   32 --------------------------------
 src/nautilus-application.h |    2 --
 src/nautilus-main.c        |    6 ++++--
 3 files changed, 4 insertions(+), 36 deletions(-)
---
diff --git a/src/nautilus-application.c b/src/nautilus-application.c
index 6ae188d..f98700f 100644
--- a/src/nautilus-application.c
+++ b/src/nautilus-application.c
@@ -86,8 +86,6 @@
 
 #define NAUTILUS_ACCEL_MAP_SAVE_DELAY 30
 
-static NautilusApplication *singleton = NULL;
-
 /* Keeps track of all the desktop windows. */
 static GList *nautilus_application_desktop_windows;
 
@@ -699,26 +697,6 @@ nautilus_application_open (GApplication *app,
 		      self->priv->geometry);
 }
 
-static GObject *
-nautilus_application_constructor (GType type,
-				  guint n_construct_params,
-				  GObjectConstructParam *construct_params)
-{
-        GObject *retval;
-
-        if (singleton != NULL) {
-                return G_OBJECT (singleton);
-        }
-
-        retval = G_OBJECT_CLASS (nautilus_application_parent_class)->constructor
-                (type, n_construct_params, construct_params);
-
-        singleton = NAUTILUS_APPLICATION (retval);
-        g_object_add_weak_pointer (retval, (gpointer) &singleton);
-
-        return retval;
-}
-
 static GtkWindow *
 get_focus_window (GtkApplication *application)
 {
@@ -1274,7 +1252,6 @@ nautilus_application_class_init (NautilusApplicationClass *class)
 	GtkApplicationClass *gtkapp_class;
 
         object_class = G_OBJECT_CLASS (class);
-	object_class->constructor = nautilus_application_constructor;
         object_class->finalize = nautilus_application_finalize;
 
 	application_class = G_APPLICATION_CLASS (class);
@@ -1288,12 +1265,3 @@ nautilus_application_class_init (NautilusApplicationClass *class)
 
 	g_type_class_add_private (class, sizeof (NautilusApplicationPriv));
 }
-
-NautilusApplication *
-nautilus_application_get_singleton (void)
-{
-	return g_object_new (NAUTILUS_TYPE_APPLICATION,
-			     "application-id", "org.gnome.NautilusApplication",
-			     "flags", G_APPLICATION_HANDLES_OPEN,
-			     NULL);
-}
diff --git a/src/nautilus-application.h b/src/nautilus-application.h
index 7a979df..12846e4 100644
--- a/src/nautilus-application.h
+++ b/src/nautilus-application.h
@@ -63,8 +63,6 @@ typedef struct {
 
 GType nautilus_application_get_type (void);
 
-NautilusApplication *nautilus_application_get_singleton (void);
-
 NautilusWindow *     nautilus_application_create_window (NautilusApplication *application,
 							 GdkScreen           *screen);
 
diff --git a/src/nautilus-main.c b/src/nautilus-main.c
index f174e5c..bcab09b 100644
--- a/src/nautilus-main.c
+++ b/src/nautilus-main.c
@@ -96,8 +96,10 @@ main (int argc, char *argv[])
 #endif
 
 	/* Run the nautilus application. */
-	application = nautilus_application_get_singleton ();
-
+	application = g_object_new (NAUTILUS_TYPE_APPLICATION,
+				    "application-id", "org.gnome.NautilusApplication",
+				    "flags", G_APPLICATION_HANDLES_OPEN,
+				    NULL);
 	retval = g_application_run (G_APPLICATION (application),
 				    argc, argv);
 



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