Let MidoriApp be a normal instance

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.
This commit is contained in:
Christian Dywan 2008-11-20 01:49:04 +01:00
parent 03ffd05e0a
commit ab747a427f

View file

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