[gedit] Revert "Simplify app and command-line singletons"
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] Revert "Simplify app and command-line singletons"
- Date: Sat, 9 Apr 2011 12:41:33 +0000 (UTC)
commit cf3eaa0c3475e223bde1fc807afe7f9b73c012b8
Author: Paolo Borelli <pborelli gnome org>
Date: Sat Apr 9 14:43:57 2011 +0200
Revert "Simplify app and command-line singletons"
This reverts commit 6868673dfc1236cf4d711ab7f3f9f38a56585f02.
gedit/gedit-app.c | 19 ++++++++++++++++---
gedit/gedit-app.h | 2 +-
gedit/gedit-command-line.c | 21 +++++++++++++++++----
gedit/gedit-command-line.h | 4 ++--
4 files changed, 36 insertions(+), 10 deletions(-)
---
diff --git a/gedit/gedit-app.c b/gedit/gedit-app.c
index 78cdb5f..b18de86 100644
--- a/gedit/gedit-app.c
+++ b/gedit/gedit-app.c
@@ -87,7 +87,7 @@ struct _GeditAppPrivate
PeasExtensionSet *extensions;
};
-G_DEFINE_ABSTRACT_TYPE(GeditApp, gedit_app, G_TYPE_OBJECT)
+G_DEFINE_ABSTRACT_TYPE(GeditApp, gedit_app, G_TYPE_INITIALLY_UNOWNED)
static void
gedit_app_finalize (GObject *object)
@@ -165,9 +165,11 @@ gedit_app_constructor (GType gtype,
construct_params);
g_object_add_weak_pointer (app, (gpointer *) &app);
+
+ return app;
}
- return app;
+ return g_object_ref (app);
}
static gboolean
@@ -558,7 +560,18 @@ gedit_app_get_default (void)
#endif
#endif
- return GEDIT_APP (g_object_new (type, NULL));
+ app = GEDIT_APP (g_object_new (type, NULL));
+
+ if (g_object_is_floating (app))
+ {
+ g_object_ref_sink (app);
+ }
+ else
+ {
+ g_object_unref (app);
+ }
+
+ return app;
}
static void
diff --git a/gedit/gedit-app.h b/gedit/gedit-app.h
index 87cad87..03f0c53 100644
--- a/gedit/gedit-app.h
+++ b/gedit/gedit-app.h
@@ -57,7 +57,7 @@ typedef struct _GeditApp GeditApp;
struct _GeditApp
{
- GObject parent;
+ GInitiallyUnowned parent;
/*< private > */
GeditAppPrivate *priv;
diff --git a/gedit/gedit-command-line.c b/gedit/gedit-command-line.c
index 6ecf2f7..60fdb30 100644
--- a/gedit/gedit-command-line.c
+++ b/gedit/gedit-command-line.c
@@ -62,7 +62,7 @@ struct _GeditCommandLinePrivate
const GeditEncoding *encoding;
};
-G_DEFINE_TYPE (GeditCommandLine, gedit_command_line, G_TYPE_OBJECT)
+G_DEFINE_TYPE (GeditCommandLine, gedit_command_line, G_TYPE_INITIALLY_UNOWNED)
static void
gedit_command_line_finalize (GObject *object)
@@ -92,11 +92,11 @@ gedit_command_line_constructor (GType gtype,
construct_params);
g_object_add_weak_pointer (command_line, (gpointer *) &command_line);
+ return command_line;
}
- return command_line;
+ return g_object_ref (command_line);
}
-
static void
gedit_command_line_class_init (GeditCommandLineClass *klass)
{
@@ -117,7 +117,20 @@ gedit_command_line_init (GeditCommandLine *self)
GeditCommandLine *
gedit_command_line_get_default (void)
{
- return g_object_new (GEDIT_TYPE_COMMAND_LINE, NULL);
+ GeditCommandLine *command_line;
+
+ command_line = g_object_new (GEDIT_TYPE_COMMAND_LINE, NULL);
+
+ if (g_object_is_floating (command_line))
+ {
+ g_object_ref_sink (command_line);
+ }
+ else
+ {
+ g_object_unref (command_line);
+ }
+
+ return command_line;
}
static void
diff --git a/gedit/gedit-command-line.h b/gedit/gedit-command-line.h
index 057f804..a5c3b31 100644
--- a/gedit/gedit-command-line.h
+++ b/gedit/gedit-command-line.h
@@ -44,14 +44,14 @@ typedef struct _GeditCommandLineGeometry GeditCommandLineGeometry;
struct _GeditCommandLine
{
- GObject parent;
+ GInitiallyUnowned parent;
GeditCommandLinePrivate *priv;
};
struct _GeditCommandLineClass
{
- GObjectClass parent_class;
+ GInitiallyUnownedClass parent_class;
};
GType gedit_command_line_get_type (void) G_GNUC_CONST;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]