pidgin: 13c74d7b: Use GObject's instance private data for ...

qulogic at pidgin.im qulogic at pidgin.im
Sat Sep 17 01:45:46 EDT 2011


----------------------------------------------------------------------
Revision: 13c74d7b26fd20cac3caa1d147efa68eda82fd81
Parent:   f2299a6fb7c17874bba50dc4014e3b272d27f6d2
Author:   qulogic at pidgin.im
Date:     09/17/11 00:51:57
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/13c74d7b26fd20cac3caa1d147efa68eda82fd81

Changelog: 

Use GObject's instance private data for all the theme GObjects.

Changes against parent f2299a6fb7c17874bba50dc4014e3b272d27f6d2

  patched  libpurple/sound-theme.c
  patched  libpurple/sound-theme.h
  patched  libpurple/theme-loader.c
  patched  libpurple/theme-loader.h
  patched  libpurple/theme.c
  patched  libpurple/theme.h
  patched  pidgin/gtkblist-theme.c
  patched  pidgin/gtkblist-theme.h
  patched  pidgin/gtkicon-theme.c
  patched  pidgin/gtkicon-theme.h

-------------- next part --------------
============================================================
--- libpurple/theme.c	562727889d220926e36d1282c0ae82e921a4dc2a
+++ libpurple/theme.c	19bf04d61cf3caebb06c9f00976ae7deb1c4fbc7
@@ -25,7 +25,7 @@
 #include "util.h"
 
 #define PURPLE_THEME_GET_PRIVATE(PurpleTheme) \
-	((PurpleThemePrivate *) ((PurpleTheme)->priv))
+	(G_TYPE_INSTANCE_GET_PRIVATE((PurpleTheme), PURPLE_TYPE_THEME, PurpleThemePrivate))
 
 void purple_theme_set_type_string(PurpleTheme *theme, const gchar *type);
 
@@ -129,14 +129,6 @@ static void
 }
 
 static void
-purple_theme_init(GTypeInstance *instance,
-		gpointer klass)
-{
-	PurpleTheme *theme = PURPLE_THEME(instance);
-	theme->priv = g_new0(PurpleThemePrivate, 1);
-}
-
-static void
 purple_theme_finalize(GObject *obj)
 {
 	PurpleTheme *theme = PURPLE_THEME(obj);
@@ -160,6 +152,8 @@ purple_theme_class_init(PurpleThemeClass
 
 	parent_class = g_type_class_peek_parent(klass);
 
+	g_type_class_add_private(klass, sizeof(PurpleThemePrivate));
+
 	obj_class->get_property = purple_theme_get_property;
 	obj_class->set_property = purple_theme_set_property;
 	obj_class->finalize = purple_theme_finalize;
@@ -222,7 +216,7 @@ purple_theme_get_type(void)
 			NULL, /* class_data */
 			sizeof(PurpleTheme),
 			0, /* n_preallocs */
-			purple_theme_init, /* instance_init */
+			NULL, /* instance_init */
 			NULL, /* value table */
 		};
 		type = g_type_register_static (G_TYPE_OBJECT,
============================================================
--- libpurple/theme.h	5b185ced6cfecfcf6a5c7b59d346add4c85833a8
+++ libpurple/theme.h	f19f99fbbca849b3ed39f56209104eef9255f132
@@ -49,7 +49,6 @@ struct _PurpleTheme
 struct _PurpleTheme
 {
 	GObject parent;
-	gpointer priv;
 };
 
 struct _PurpleThemeClass
============================================================
--- libpurple/theme-loader.c	d640ec7a4cfc5b9b5e06e75e2a30554967d7aaee
+++ libpurple/theme-loader.c	2d3bb6af1b849f019ff0921b3e9b0ec42f1463ae
@@ -24,7 +24,7 @@
 #include "theme-loader.h"
 
 #define PURPLE_THEME_LOADER_GET_PRIVATE(PurpleThemeLoader) \
-	((PurpleThemeLoaderPrivate *) ((PurpleThemeLoader)->priv))
+	(G_TYPE_INSTANCE_GET_PRIVATE((PurpleThemeLoader), PURPLE_TYPE_THEME_LOADER, PurpleThemeLoaderPrivate))
 
 void purple_theme_loader_set_type_string(PurpleThemeLoader *loader, const gchar *type);
 
@@ -86,21 +86,12 @@ static void
 }
 
 static void
-purple_theme_loader_init(GTypeInstance *instance,
-			gpointer klass)
-{
-	PurpleThemeLoader *loader = PURPLE_THEME_LOADER(instance);
-	loader->priv = g_new0(PurpleThemeLoaderPrivate, 1);
-}
-
-static void
 purple_theme_loader_finalize(GObject *obj)
 {
 	PurpleThemeLoader *loader = PURPLE_THEME_LOADER(obj);
 	PurpleThemeLoaderPrivate *priv = PURPLE_THEME_LOADER_GET_PRIVATE(loader);
 
 	g_free(priv->type);
-	g_free(priv);
 
 	parent_class->finalize(obj);
 }
@@ -113,6 +104,8 @@ purple_theme_loader_class_init(PurpleThe
 
 	parent_class = g_type_class_peek_parent(klass);
 
+	g_type_class_add_private(klass, sizeof(PurpleThemeLoaderPrivate));
+
 	obj_class->get_property = purple_theme_loader_get_property;
 	obj_class->set_property = purple_theme_loader_set_property;
 	obj_class->finalize = purple_theme_loader_finalize;
@@ -139,7 +132,7 @@ purple_theme_loader_get_type(void)
 			NULL, /* class_data */
 			sizeof(PurpleThemeLoader),
 			0, /* n_preallocs */
-			purple_theme_loader_init, /* instance_init */
+			NULL, /* instance_init */
 			NULL, /* value table */
 		};
 		type = g_type_register_static(G_TYPE_OBJECT,
============================================================
--- libpurple/theme-loader.h	bbb30ed76a7b4a55a568e6364ac48ecac3fc6c62
+++ libpurple/theme-loader.h	eb80046e3c0c90a69f86f073bdfe6841a14cf654
@@ -50,7 +50,6 @@ struct _PurpleThemeLoader
 struct _PurpleThemeLoader
 {
 	GObject parent;
-	gpointer priv;
 };
 
 struct _PurpleThemeLoaderClass
============================================================
--- libpurple/sound-theme.c	832cad835b20e8d5bcd36e680644b90ef67f7cc0
+++ libpurple/sound-theme.c	843b91c36cf336bd74ee0bdbf13c3778eeb90ab3
@@ -24,7 +24,7 @@
 #include "sound-theme.h"
 
 #define PURPLE_SOUND_THEME_GET_PRIVATE(Gobject) \
-	((PurpleSoundThemePrivate *) ((PURPLE_SOUND_THEME(Gobject))->priv))
+	(G_TYPE_INSTANCE_GET_PRIVATE((Gobject), PURPLE_TYPE_SOUND_THEME, PurpleSoundThemePrivate))
 
 /******************************************************************************
  * Structs
@@ -55,8 +55,6 @@ purple_sound_theme_init(GTypeInstance *i
 {
 	PurpleSoundThemePrivate *priv;
 
-	(PURPLE_SOUND_THEME(instance))->priv = g_new0(PurpleSoundThemePrivate, 1);
-
 	priv = PURPLE_SOUND_THEME_GET_PRIVATE(instance);
 
 	priv->sound_files = g_hash_table_new_full(g_str_hash,
@@ -82,6 +80,8 @@ purple_sound_theme_class_init(PurpleSoun
 
 	parent_class = g_type_class_peek_parent(klass);
 
+	g_type_class_add_private(klass, sizeof(PurpleSoundThemePrivate));
+
 	obj_class->finalize = purple_sound_theme_finalize;
 }
 
============================================================
--- libpurple/sound-theme.h	d6e1850e4cd92ead2ac39ab8dca7ce6874f4bb60
+++ libpurple/sound-theme.h	6caadf8daa0a32eaef6fc9db533e5c02ec48f751
@@ -51,7 +51,6 @@ struct _PurpleSoundTheme
 struct _PurpleSoundTheme
 {
 	PurpleTheme parent;
-	gpointer priv;
 };
 
 struct _PurpleSoundThemeClass
============================================================
--- pidgin/gtkblist-theme.c	e85dd470934bc3638f1f66a5889b17f5fcc66ffc
+++ pidgin/gtkblist-theme.c	8f6ed828c6a55a28fd3340b29ecaba8b12dd5974
@@ -24,7 +24,7 @@
 #include "gtkblist-theme.h"
 
 #define PIDGIN_BLIST_THEME_GET_PRIVATE(Gobject) \
-	((PidginBlistThemePrivate *) ((PIDGIN_BLIST_THEME(Gobject))->priv))
+	(G_TYPE_INSTANCE_GET_PRIVATE((Gobject), PIDGIN_TYPE_BLIST_THEME, PidginBlistThemePrivate))
 
 /******************************************************************************
  * Structs
@@ -189,13 +189,6 @@ static void
  *****************************************************************************/
 
 static void
-pidgin_blist_theme_init(GTypeInstance *instance,
-		gpointer klass)
-{
-	(PIDGIN_BLIST_THEME(instance))->priv = g_new0(PidginBlistThemePrivate, 1);
-}
-
-static void
 pidgin_blist_theme_get_property(GObject *obj, guint param_id, GValue *value,
 		GParamSpec *psec)
 {
@@ -349,8 +342,6 @@ pidgin_blist_theme_finalize(GObject *obj
 	pidgin_theme_font_free(priv->message_nick_said);
 	pidgin_theme_font_free(priv->status);
 
-	g_free(priv);
-
 	parent_class->finalize (obj);
 }
 
@@ -362,6 +353,8 @@ pidgin_blist_theme_class_init(PidginBlis
 
 	parent_class = g_type_class_peek_parent (klass);
 
+	g_type_class_add_private(klass, sizeof(PidginBlistThemePrivate));
+
 	obj_class->get_property = pidgin_blist_theme_get_property;
 	obj_class->set_property = pidgin_blist_theme_set_property;
 	obj_class->finalize = pidgin_blist_theme_finalize;
@@ -484,7 +477,7 @@ pidgin_blist_theme_get_type (void)
 			NULL, /* class_data */
 			sizeof(PidginBlistTheme),
 			0, /* n_preallocs */
-			pidgin_blist_theme_init, /* instance_init */
+			NULL, /* instance_init */
 			NULL, /* value table */
 		};
 		type = g_type_register_static (PURPLE_TYPE_THEME,
============================================================
--- pidgin/gtkblist-theme.h	98d3b7bd44ecde9eff6333d9660947c733c18d25
+++ pidgin/gtkblist-theme.h	93a721824df4dad64ff3a0902767838da1b303a0
@@ -51,7 +51,6 @@ struct _PidginBlistTheme
 struct _PidginBlistTheme
 {
 	PurpleTheme parent;
-	gpointer priv;
 };
 
 struct _PidginBlistThemeClass
============================================================
--- pidgin/gtkicon-theme.c	d9320ee233f882d990857fa54b118c27e5c3b7ee
+++ pidgin/gtkicon-theme.c	f8986faa22506d1f49207f6b53dab54d549119a3
@@ -26,7 +26,7 @@
 #include <gtk/gtk.h>
 
 #define PIDGIN_ICON_THEME_GET_PRIVATE(Gobject) \
-	((PidginIconThemePrivate *) ((PIDGIN_ICON_THEME(Gobject))->priv))
+	(G_TYPE_INSTANCE_GET_PRIVATE((Gobject), PIDGIN_TYPE_ICON_THEME, PidginIconThemePrivate))
 
 /******************************************************************************
  * Structs
@@ -53,8 +53,6 @@ pidgin_icon_theme_init(GTypeInstance *in
 {
 	PidginIconThemePrivate *priv;
 
-	(PIDGIN_ICON_THEME(instance))->priv = g_new0(PidginIconThemePrivate, 1);
-
 	priv = PIDGIN_ICON_THEME_GET_PRIVATE(instance);
 
 	priv->icon_files = g_hash_table_new_full(g_str_hash,
@@ -69,7 +67,6 @@ pidgin_icon_theme_finalize(GObject *obj)
 	priv = PIDGIN_ICON_THEME_GET_PRIVATE(obj);
 
 	g_hash_table_destroy(priv->icon_files);
-	g_free(priv);
 
 	parent_class->finalize(obj);
 }
@@ -82,6 +79,8 @@ pidgin_icon_theme_class_init(PidginIconT
 	parent_class = g_type_class_peek_parent(klass);
 
 	obj_class->finalize = pidgin_icon_theme_finalize;
+
+	g_type_class_add_private(klass, sizeof(PidginIconThemePrivate));
 }
 
 GType
============================================================
--- pidgin/gtkicon-theme.h	2c92e56d150c04b73756b3884ea931c9a82eda5b
+++ pidgin/gtkicon-theme.h	b71df80971dc2e29edee14c80d031c7cd7392661
@@ -50,7 +50,6 @@ struct _PidginIconTheme
 struct _PidginIconTheme
 {
 	PurpleTheme parent;
-	gpointer priv;
 };
 
 struct _PidginIconThemeClass


More information about the Commits mailing list