soc.2008.themes: 433e0b3c: more gobject fixed

ffdragon at soc.pidgin.im ffdragon at soc.pidgin.im
Sat Jun 21 23:10:40 EDT 2008


-----------------------------------------------------------------
Revision: 433e0b3c65aead850f53278b185580a1318780f8
Ancestor: 333b935659c04f8e1232ea5508036d1f9e38fe0d
Author: ffdragon at soc.pidgin.im
Date: 2008-06-22T03:07:07
Branch: im.pidgin.soc.2008.themes
URL: http://d.pidgin.im/viewmtn/revision/info/433e0b3c65aead850f53278b185580a1318780f8

Modified files:
        libpurple/core.c libpurple/sound-loader.c
        libpurple/sound-theme.c libpurple/theme-loader.c
        libpurple/theme-manager.c libpurple/theme.c

ChangeLog: 

more gobject fixed

-------------- next part --------------
============================================================
--- libpurple/core.c	dc66294968e929eb4b1942c33e7b672f894f75e5
+++ libpurple/core.c	afe679fd9db56229ca84533e2929afd9afd7e6c9
@@ -149,7 +149,7 @@ purple_core_init(const char *ui)
 	/* Accounts use status, buddy icons and connection signals, so
 	 * initialize these before accounts
 	 */
-	purple_theme_manager_init(g_object_new(PURPLE_TYPE_SOUND_THEME_LOADER, NULL), NULL);
+	purple_theme_manager_init(g_object_new(PURPLE_TYPE_SOUND_THEME_LOADER, "type", "sound", NULL), NULL);
 	purple_status_init();
 	purple_buddy_icons_init();
 	purple_connections_init();
============================================================
--- libpurple/sound-loader.c	cc6520f079a60e7c3d39469fe683acf6ca28269d
+++ libpurple/sound-loader.c	94a8f37d733a4b99981dbec558abacb7b894c452
@@ -29,9 +29,6 @@
 /******************************************************************************
  * Globals
  *****************************************************************************/
-
-static PurpleThemeLoaderClass *parent_class = NULL;
-
 /*****************************************************************************
  * Sound Theme Builder                                                      
  *****************************************************************************/
@@ -126,7 +123,7 @@ purple_sound_theme_loader_get_type (void
       NULL,    /* instance_init */
       NULL,   /* value table */
     };
-    type = g_type_register_static (G_TYPE_OBJECT,
+    type = g_type_register_static (PURPLE_TYPE_THEME_LOADER,
                                    "PurpleSoundThemeLoader",
                                    &info, 0);
   }
============================================================
--- libpurple/sound-theme.c	81485a6031117d364f34c667712a6c1a72149e1d
+++ libpurple/sound-theme.c	0d7ce076ad8f8973ed1180bbd2e1a5d122ef4c7b
@@ -54,10 +54,11 @@ purple_sound_theme_init(GTypeInstance *i
 			gpointer klass)
 {
 	PurpleSoundThemePrivate *priv;
-	GObject *obj = (GObject *)instance;
 
-	priv = PURPLE_SOUND_THEME_GET_PRIVATE(obj);
+	(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,
 						   g_str_equal,
 						   g_free,
============================================================
--- libpurple/theme-loader.c	a1b5e2074d219508fa707fba70b7b8adbf5d1c69
+++ libpurple/theme-loader.c	726a2fb4b5571ff1330bdfcfacfff4dd92c021f5
@@ -85,6 +85,13 @@ static void
 }
 
 static void
+purple_theme_loader_init(GTypeInstance *instance,
+			gpointer klass)
+{
+	(PURPLE_THEME_LOADER(instance))->priv = g_new0(PurpleThemeLoaderPrivate, 1);
+}
+
+static void
 purple_theme_loader_finalize(GObject *obj)
 {
 	PurpleThemeLoader *loader = PURPLE_THEME_LOADER(obj);	
@@ -130,11 +137,11 @@ purple_theme_loader_get_type (void)
       NULL,   /* class_data */
       sizeof (PurpleThemeLoader),
       0,      /* n_preallocs */
-      NULL,    /* instance_init */
+      purple_theme_loader_init,    /* instance_init */
       NULL,   /* value table */
     };
     type = g_type_register_static (G_TYPE_OBJECT,
-                                   "PurpleThemeLoaderType",
+                                   "PurpleThemeLoader",
                                    &info, G_TYPE_FLAG_ABSTRACT);
   }
   return type;
============================================================
--- libpurple/theme-manager.c	c7a7cb58dec46f981510096fc9dec88781fa0a3e
+++ libpurple/theme-manager.c	00151c44c19305b8bffb43ea5abc0e36e7f46de5
@@ -65,9 +65,9 @@ purple_theme_manager_make_key(const gcha
 static gchar *
 purple_theme_manager_make_key(const gchar *name, const gchar *type)
 {
-	g_return_val_if_fail(name, NULL);	
+	g_return_val_if_fail(name, NULL);
 	g_return_val_if_fail(type, NULL);		
-	return g_strconcat(type, '/', name, NULL);
+	return g_strconcat(type, "/", name, NULL);
 }
 
 /* returns TRUE if theme is of type "user_data" */ 
@@ -76,7 +76,7 @@ purple_theme_manager_is_theme_type(gchar
                   gpointer value,
                   gchar *user_data)
 {
-	return g_str_has_prefix (key, g_strconcat(user_data, '/', NULL));
+	return g_str_has_prefix (key, g_strconcat(user_data, "/", NULL));
 }
 
 static gboolean
@@ -244,7 +244,7 @@ purple_theme_manager_add_theme(PurpleThe
 	g_return_if_fail(key);
 	
 	/* if something is already there do nothing */
-	if (! g_hash_table_lookup (theme_table, key)) 
+	if (g_hash_table_lookup (theme_table, key) == NULL) 
 		g_hash_table_insert(theme_table, key, theme);
 	
 	g_free(key);	
============================================================
--- libpurple/theme.c	8a6f8248a782485c81adf47df79431c573be9b3a
+++ libpurple/theme.c	cec9ed7125f02bc4d6920bc15c2cf5ee52293bff
@@ -49,12 +49,6 @@ static GObjectClass *parent_class = NULL
 /******************************************************************************
  * Enums
  *****************************************************************************/
-#define PROP_NAME_S "name"
-#define PROP_DESCRIPION_S "description"
-#define PROP_AUTHOR_S "author"
-#define PROP_TYPE_S "type"
-#define PROP_DIR_S "dir"
-#define PROP_IMAGE_S "image"
 
 enum {
 	PROP_ZERO = 0,
@@ -66,7 +60,6 @@ enum {
 	PROP_IMAGE
 };
 
-
 /******************************************************************************
  * GObject Stuff                                                              *
  *****************************************************************************/
@@ -134,6 +127,13 @@ static void
 }
 
 static void
+purple_theme_init(GTypeInstance *instance,
+			gpointer klass)
+{
+	(PURPLE_THEME(instance))->priv = g_new0(PurpleThemePrivate, 1);
+}
+
+static void
 purple_theme_finalize(GObject *obj)
 {
 	PurpleTheme *theme = PURPLE_THEME(obj);	
@@ -162,37 +162,37 @@ purple_theme_class_init (PurpleThemeClas
 	obj_class->finalize = purple_theme_finalize;
 	
 	/* NAME */
-	pspec = g_param_spec_string(PROP_NAME_S, "Name",
+	pspec = g_param_spec_string("name", "Name",
 				    "The name of the theme",
 				    NULL,
 				    G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
 	g_object_class_install_property(obj_class, PROP_NAME, pspec);
 	/* DESCRIPION */
-	pspec = g_param_spec_string(PROP_DESCRIPION_S, "Description",
+	pspec = g_param_spec_string("description", "Description",
 				    "The description of the theme",
 				    NULL,
 				    G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
 	g_object_class_install_property(obj_class, PROP_DESCRIPION, pspec);
 	/* AUTHOR */
-	pspec = g_param_spec_string(PROP_AUTHOR_S, "Author",
+	pspec = g_param_spec_string("author", "Author",
 				    "The author of the theme",
 				    NULL,
 				    G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
 	g_object_class_install_property(obj_class, PROP_AUTHOR, pspec);
 	/* TYPE STRING (read only) */
-	pspec = g_param_spec_string(PROP_TYPE_S, "Type",
+	pspec = g_param_spec_string("type", "Type",
 				    "The string represtenting the type of the theme",
 				    NULL,
-				    G_PARAM_READABLE | G_PARAM_CONSTRUCT_ONLY);
+				    G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
 	g_object_class_install_property(obj_class, PROP_TYPE, pspec);
 	/* DIRECTORY */
-	pspec = g_param_spec_string(PROP_DIR_S, "Directory",
+	pspec = g_param_spec_string("directory", "Directory",
 				    "The directory that contains the theme and all its files",
 				    NULL,
 				    G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
 	g_object_class_install_property(obj_class, PROP_DIR, pspec);
 	/* PREVIEW IMAGE */
-	pspec = g_param_spec_pointer(PROP_IMAGE_S, "Image",
+	pspec = g_param_spec_pointer("image", "Image",
 				    "A preview image of the theme",
 				    G_PARAM_READWRITE);
 	g_object_class_install_property(obj_class, PROP_IMAGE, pspec);
@@ -213,7 +213,7 @@ purple_theme_get_type (void)
       NULL,   /* class_data */
       sizeof (PurpleTheme),
       0,      /* n_preallocs */
-      NULL,    /* instance_init */
+      purple_theme_init,    /* instance_init */
       NULL,   /* value table */
     };
     type = g_type_register_static (G_TYPE_OBJECT,


More information about the Commits mailing list