]> spindle.queued.net Git - midori/commitdiff
Let MidoriApp be a normal instance
authorChristian Dywan <christian@twotoasts.de>
Thu, 20 Nov 2008 00:49:04 +0000 (01:49 +0100)
committerChristian Dywan <christian@twotoasts.de>
Thu, 20 Nov 2008 00:49:04 +0000 (01:49 +0100)
There is hardly a practical need for the application
to be a singleton, it's cleaner and it prevents
extensions from reaching out for it before activation.

midori/midori-app.c

index 5e754e1ed20af0510a300c2a16cdfb692e001a3d..2b875b1a2805f45d170687247fd03fe435d5bedc 100644 (file)
@@ -43,8 +43,6 @@ struct _MidoriApp
 
 G_DEFINE_TYPE (MidoriApp, midori_app, G_TYPE_OBJECT)
 
-static MidoriApp* _midori_app_singleton = NULL;
-
 enum
 {
     PROP_0,
@@ -68,11 +66,6 @@ enum {
 
 static guint signals[LAST_SIGNAL];
 
-static GObject*
-midori_app_constructor (GType                  type,
-                        guint                  n_construct_properties,
-                        GObjectConstructParam* construct_properties);
-
 static void
 midori_app_finalize (GObject* object);
 
@@ -193,7 +186,6 @@ midori_app_class_init (MidoriAppClass* class)
         G_TYPE_NONE, 0);
 
     gobject_class = G_OBJECT_CLASS (class);
-    gobject_class->constructor = midori_app_constructor;
     gobject_class->finalize = midori_app_finalize;
     gobject_class->set_property = midori_app_set_property;
     gobject_class->get_property = midori_app_get_property;
@@ -274,18 +266,6 @@ midori_app_class_init (MidoriAppClass* class)
                                      G_PARAM_READABLE));
 }
 
-static GObject*
-midori_app_constructor (GType                  type,
-                        guint                  n_construct_properties,
-                        GObjectConstructParam* construct_properties)
-{
-    if (_midori_app_singleton)
-        return g_object_ref (_midori_app_singleton);
-    else
-        return G_OBJECT_CLASS (midori_app_parent_class)->constructor (
-            type, n_construct_properties, construct_properties);
-}
-
 #if HAVE_UNIQUE
 static UniqueResponse
 midori_browser_message_received_cb (UniqueApp*         instance,
@@ -387,10 +367,6 @@ midori_app_init (MidoriApp* app)
     guint i, n;
     #endif
 
-    g_assert (!_midori_app_singleton);
-
-    _midori_app_singleton = app;
-
     app->accel_group = gtk_accel_group_new ();
 
     app->settings = midori_web_settings_new ();