soc.2008.themes: f87d3e37: theme loader cleanup, and remove a few w...

ffdragon at soc.pidgin.im ffdragon at soc.pidgin.im
Wed Aug 27 01:41:23 EDT 2008


-----------------------------------------------------------------
Revision: f87d3e3728f76b7782100b61b955bc030cc4e1ae
Ancestor: b49d95f44169eb347061907f1842d56d9c3c826c
Author: ffdragon at soc.pidgin.im
Date: 2008-08-26T08:28:25
Branch: im.pidgin.soc.2008.themes
URL: http://d.pidgin.im/viewmtn/revision/info/f87d3e3728f76b7782100b61b955bc030cc4e1ae

Modified files:
        libpurple/sound-loader.c libpurple/theme-manager.c
        libpurple/xmlnode.c pidgin/gtkblist-loader.c
        pidgin/gtkblist-theme.c pidgin/gtkblist-theme.h
        pidgin/gtkicon-loader.c pidgin/gtkicon-theme.c
        pidgin/gtkicon-theme.h pidgin/gtkprefs.c pidgin/gtksound.c
        pidgin/pidginstock.c

ChangeLog: 

theme loader cleanup, and remove a few warnings

-------------- next part --------------
============================================================
--- libpurple/sound-loader.c	d828d70c595f59102d0db384dd635970d634f26d
+++ libpurple/sound-loader.c	1e3be53464c970b5257fc413143ed8ce8fc46076
@@ -26,9 +26,6 @@
 #include "util.h"
 #include "xmlnode.h"
 
-/******************************************************************************
- * Globals
- *****************************************************************************/
 /*****************************************************************************
  * Sound Theme Builder                                                      
  *****************************************************************************/
@@ -36,24 +33,18 @@ purple_sound_loader_build(const gchar *d
 static PurpleTheme *
 purple_sound_loader_build(const gchar *dir)
 {
-	xmlnode *root_node, *sub_node;
-	gchar *filename, *filename_full, *data;
-	GDir *gdir;
+	xmlnode *root_node = NULL, *sub_node;
+	gchar *filename_full, *data;
 	PurpleSoundTheme *theme = NULL;
 
 	/* Find the theme file */
-	gdir = g_dir_open(dir, 0, NULL);
-	g_return_val_if_fail(gdir != NULL, NULL);
+	g_return_val_if_fail(dir != NULL, NULL);
+	filename_full = g_build_filename(dir, "theme.xml", NULL);
 
-	while ((filename = g_strdup(g_dir_read_name(gdir))) != NULL && ! g_str_has_suffix(filename, ".xml"))
-		g_free(filename);
-	
-	g_return_val_if_fail(filename != NULL, NULL);
-	
-	/* Build the xml tree */
-	filename_full = g_build_filename(dir, filename, NULL);
+	if (g_file_test(filename_full, G_FILE_TEST_IS_REGULAR))
+		root_node = xmlnode_from_file(dir, "theme.xml", "sound themes", "sound-loader");
 
-	root_node = xmlnode_from_file(dir, filename, "sound themes", "sound-loader");
+	g_free(filename_full);
 	g_return_val_if_fail(root_node != NULL, NULL);
 
 	/* Parse the tree */	
@@ -68,20 +59,18 @@ purple_sound_loader_build(const gchar *d
 				    "image", xmlnode_get_attrib(root_node, "image"),
 				    "directory", dir,
 				    "description", data, NULL);
-	
-		xmlnode_free(sub_node);
 
-		while ((sub_node = xmlnode_get_child(root_node, "event")) != NULL){
+		sub_node = xmlnode_get_child(root_node, "event");
+
+		while (sub_node) {
 			purple_sound_theme_set_file(theme,
 						    xmlnode_get_attrib(sub_node, "name"),
 						    xmlnode_get_attrib(sub_node, "file"));
-			xmlnode_free(sub_node);
+			sub_node = xmlnode_get_next_twin(sub_node);
 		}
 	}
 
 	xmlnode_free(root_node);	
-	g_dir_close(gdir);
-	g_free(filename_full);
 	g_free(data);
 	return PURPLE_THEME(theme);
 }
@@ -91,7 +80,7 @@ static void
  *****************************************************************************/
 
 static void
-purple_sound_theme_loader_class_init (PurpleSoundThemeLoaderClass *klass)
+purple_sound_theme_loader_class_init(PurpleSoundThemeLoaderClass *klass)
 {
 	PurpleThemeLoaderClass *loader_klass = PURPLE_THEME_LOADER_CLASS(klass);
 
@@ -100,7 +89,7 @@ GType 
 
 
 GType 
-purple_sound_theme_loader_get_type (void)
+purple_sound_theme_loader_get_type(void)
 {
   static GType type = 0;
   if (type == 0) {
@@ -116,7 +105,7 @@ purple_sound_theme_loader_get_type (void
       NULL,    /* instance_init */
       NULL,   /* value table */
     };
-    type = g_type_register_static (PURPLE_TYPE_THEME_LOADER,
+    type = g_type_register_static(PURPLE_TYPE_THEME_LOADER,
                                    "PurpleSoundThemeLoader",
                                    &info, 0);
   }
============================================================
--- libpurple/theme-manager.c	ba2ca99f83e494a0c2775e268fc4906b46fd6374
+++ libpurple/theme-manager.c	52db96e411e6fbee8e5b057dbea4609879ff27a2
@@ -36,7 +36,7 @@ GType 
  ****************************************************************************/
 
 GType 
-purple_theme_manager_get_type (void)
+purple_theme_manager_get_type(void)
 {
   static GType type = 0;
   if (type == 0) {
@@ -52,7 +52,7 @@ purple_theme_manager_get_type (void)
       NULL,    /* instance_init */
       NULL,   /* Value Table */
     };
-    type = g_type_register_static (G_TYPE_OBJECT,
+    type = g_type_register_static(G_TYPE_OBJECT,
                                    "PurpleThemeManager",
                                    &info, 0);
   }
@@ -94,7 +94,7 @@ purple_theme_manager_function_wrapper(gc
                 		      PTFunc user_data)
 {
 	if (PURPLE_IS_THEME(value))
-		(* user_data) (value);
+		(* user_data)(value);
 }
 
 static void
@@ -106,19 +106,19 @@ purple_theme_manager_build_dir(const gch
 	GDir *dir;
 	PurpleThemeLoader *loader;
 
-	rdir =  g_dir_open(root, 0, NULL);
+	rdir = g_dir_open(root, 0, NULL);
 
 	g_return_if_fail(rdir);
 
 	/* Parses directory by root/name/purple/type */
-	while ((name = g_strdup(g_dir_read_name (rdir)))){
+	while ((name = g_strdup(g_dir_read_name(rdir)))){
 		
 		purple_dir = g_build_filename(root, name, "purple", NULL);
 		dir =  g_dir_open(purple_dir, 0, NULL);	
 	
 		if (dir) {
-			while ((type = g_strdup(g_dir_read_name (dir)))) {
-				if ((loader = g_hash_table_lookup (theme_table, type))){
+			while ((type = g_strdup(g_dir_read_name(dir)))) {
+				if ((loader = g_hash_table_lookup(theme_table, type))){
 
 					theme_dir = g_build_filename(purple_dir, type, NULL);
 					purple_theme_manager_add_theme(purple_theme_loader_build(loader, theme_dir));
@@ -143,9 +143,9 @@ void
  *****************************************************************************/
 
 void
-purple_theme_manager_init (void)
+purple_theme_manager_init(void)
 {
-	theme_table = g_hash_table_new_full (g_str_hash,
+	theme_table = g_hash_table_new_full(g_str_hash,
                	                             g_str_equal,
                	                             g_free,
                	                             g_object_unref);
@@ -154,8 +154,8 @@ purple_theme_manager_refresh()
 void 
 purple_theme_manager_refresh()
 {
-	g_hash_table_foreach_remove (theme_table,
-                	             (GHRFunc) purple_theme_manager_is_theme,
+	g_hash_table_foreach_remove(theme_table,
+                	            (GHRFunc) purple_theme_manager_is_theme,
                 	             NULL);	
 	
 	/* TODO: add correct directories to parse */
@@ -164,7 +164,7 @@ void 
 }
 
 void 
-purple_theme_manager_uninit ()
+purple_theme_manager_uninit()
 {
 	g_hash_table_destroy(theme_table);
 }
@@ -181,7 +181,7 @@ purple_theme_manager_register_type(Purpl
 	g_return_if_fail(type);
 
 	/* if something is already there do nothing */
-	if (! g_hash_table_lookup (theme_table, type)) 
+	if (! g_hash_table_lookup(theme_table, type)) 
 		g_hash_table_insert(theme_table, type, loader);
 }
 
@@ -195,13 +195,13 @@ purple_theme_manager_unregister_type(Pur
 	type = purple_theme_loader_get_type_string(loader);
 	g_return_if_fail(type);
 
-	if (g_hash_table_lookup (theme_table, type) == loader){
+	if (g_hash_table_lookup(theme_table, type) == loader){
 
-		g_hash_table_remove (theme_table, type);
+		g_hash_table_remove(theme_table, type);
 
-		g_hash_table_foreach_remove (theme_table,
-                	                     (GHRFunc) purple_theme_manager_is_theme_type,
-                	                     type);		
+		g_hash_table_foreach_remove(theme_table,
+                	                    (GHRFunc)purple_theme_manager_is_theme_type,
+                	                    (gpointer)type);		
 	}/* only free if given registered loader */
 }
 
============================================================
--- libpurple/xmlnode.c	17d829e13d473340730a04931cfff539fa2ba475
+++ libpurple/xmlnode.c	0438a9cc827b5b26456bd7e12225617a68e34c92
@@ -729,7 +729,7 @@ xmlnode *
 }
 
 xmlnode *
-xmlnode_from_file(const char *dir, const char *filename, const char *description, const char *process)
+xmlnode_from_file(const char *dir,const char *filename, const char *description, const char *process)
 {
 	gchar *filename_full;
 	GError *error = NULL;
============================================================
--- pidgin/gtkblist-loader.c	592dfecb2afe1b76a0019d8dace07c9fdbe1b8d3
+++ pidgin/gtkblist-loader.c	51058b1cba134625afdfe904802419c10089ff05
@@ -39,35 +39,29 @@ pidgin_blist_loader_build(const gchar *d
 static PurpleTheme *
 pidgin_blist_loader_build(const gchar *dir)
 {
-	xmlnode *root_node, *sub_node, *sub_sub_node;
-	gchar *filename, *filename_full, *data;
-	const gchar *icon_theme = NULL, *temp;
+	xmlnode *root_node = NULL, *sub_node, *sub_sub_node;
+	gchar *filename_full, *data;
+	const gchar *temp;
 	gboolean sucess = TRUE;
 	GdkColor *bgcolor, *expanded_bgcolor, *collapsed_bgcolor, *contact_color;
 	GdkColor color;
 	FontColorPair *expanded, *collapsed, *contact, *online, *away, *offline, *idle, *message, *status;
 	PidginBlistLayout *layout;
-	GDir *gdir;
 	PidginBlistTheme *theme;
 
 	/* Find the theme file */
-	gdir = g_dir_open(dir, 0, NULL);
-	g_return_val_if_fail(gdir != NULL, NULL);
+	g_return_val_if_fail(dir != NULL, NULL);
+	filename_full = g_build_filename(dir, "theme.xml", NULL);
 
-	while ((filename = g_strdup(g_dir_read_name(gdir))) != NULL && ! g_str_has_suffix(filename, ".xml"))
-		g_free(filename);
-	
-	if (filename == NULL){
-		g_dir_close(gdir);
-		return NULL;
-	}
-	
-	/* Build the xml tree */
-	filename_full = g_build_filename(dir, filename, NULL);
+	if (g_file_test(filename_full, G_FILE_TEST_IS_REGULAR))
+		root_node = xmlnode_from_file(dir, "theme.xml", "buddy list themes", "blist-loader");
 
-	root_node = xmlnode_from_file(dir, filename, "blist themes", "blist-loader");
+	g_free(filename_full);
 	g_return_val_if_fail(root_node != NULL, NULL);
 
+	sub_node = xmlnode_get_child(root_node, "description");
+	data = xmlnode_get_data(sub_node);
+
 	/* init all structs and colors */
 	bgcolor = g_new0(GdkColor, 1);
 	expanded_bgcolor = g_new0(GdkColor, 1);
@@ -87,16 +81,8 @@ pidgin_blist_loader_build(const gchar *d
 	message = g_new0(FontColorPair, 1); 
 	status = g_new0(FontColorPair, 1);
 
-	/* Parse the tree */	
-	sub_node = xmlnode_get_child(root_node, "description");
-	data = xmlnode_get_data(sub_node);
-
-	/* <icon_theme> */
-	if ((sucess = (sub_node = xmlnode_get_child(root_node, "icon_theme")) != NULL))
-		icon_theme = xmlnode_get_attrib(sub_node, "name");
-
 	/* <blist> */
-	if ((sucess = sucess && (sub_node = xmlnode_get_child(root_node, "blist")) != NULL)) {
+	if ((sucess = (sub_node = xmlnode_get_child(root_node, "blist")) != NULL)) {
 		if ((temp = xmlnode_get_attrib(sub_node, "color")) != NULL && gdk_color_parse(temp, bgcolor))
 			gdk_colormap_alloc_color(gdk_colormap_get_system(), bgcolor, FALSE, TRUE);
 		else {
@@ -221,7 +207,6 @@ pidgin_blist_loader_build(const gchar *d
 			    "image", xmlnode_get_attrib(root_node, "image"),
 			    "directory", dir,
 			    "description", data,
-			    "icon-theme", icon_theme,
 			    "background-color", bgcolor,
 			    "layout", layout,
 			    "expanded-color", expanded_bgcolor,
@@ -237,17 +222,15 @@ pidgin_blist_loader_build(const gchar *d
 			    "message", message,
 			    "status", status, NULL);
 
-	/* malformed xml file */
+	xmlnode_free(root_node);	
+	g_free(data);
+
+	/* malformed xml file - also frees all partial data*/
 	if (!sucess) {
 		g_object_unref(theme);
 		theme = NULL;
 	}
 
-	xmlnode_free(sub_node);
-	xmlnode_free(root_node);	
-	g_dir_close(gdir);
-	g_free(filename_full);
-	g_free(data);
 	return PURPLE_THEME(theme);
 }
 
@@ -256,7 +239,7 @@ static void
  *****************************************************************************/
 
 static void
-pidgin_blist_theme_loader_class_init (PidginBlistThemeLoaderClass *klass)
+pidgin_blist_theme_loader_class_init(PidginBlistThemeLoaderClass *klass)
 {
 	PurpleThemeLoaderClass *loader_klass = PURPLE_THEME_LOADER_CLASS(klass);
 
@@ -265,7 +248,7 @@ GType 
 
 
 GType 
-pidgin_blist_theme_loader_get_type (void)
+pidgin_blist_theme_loader_get_type(void)
 {
   static GType type = 0;
   if (type == 0) {
@@ -281,7 +264,7 @@ pidgin_blist_theme_loader_get_type (void
       NULL,    /* instance_init */
       NULL,   /* value table */
     };
-    type = g_type_register_static (PURPLE_TYPE_THEME_LOADER,
+    type = g_type_register_static(PURPLE_TYPE_THEME_LOADER,
                                    "PidginBlistThemeLoader",
                                    &info, 0);
   }
============================================================
--- pidgin/gtkblist-theme.c	128984f92e1acb62b29726e2e54745d7dee9fff9
+++ pidgin/gtkblist-theme.c	53bd3b6cddc0ab792bb5a2c47461fb4a37e7fcd9
@@ -30,11 +30,9 @@ typedef struct {
  * Structs
  *****************************************************************************/
 typedef struct {
-	gchar *icon_theme;
-
 	/* Buddy list */
-	GdkColor *bgcolor;
 	gdouble opacity;
+	GdkColor *bgcolor;
 	PidginBlistLayout *layout;
 	
 	/* groups */
@@ -70,7 +68,6 @@ enum {
  *****************************************************************************/
 enum {
 	PROP_ZERO = 0,
-	PROP_ICON_THEME,
 	PROP_BACKGROUND_COLOR,
 	PROP_OPACITY,
 	PROP_LAYOUT,
@@ -122,9 +119,6 @@ pidgin_blist_theme_get_property(GObject 
 	PidginBlistTheme *theme = PIDGIN_BLIST_THEME(obj);
 
 	switch(param_id) {
-		case PROP_ICON_THEME:
-			g_value_set_string(value, pidgin_blist_theme_get_icon_theme(theme));
-			break;
 		case PROP_BACKGROUND_COLOR:
 			g_value_set_pointer(value, pidgin_blist_theme_get_background_color(theme));
 			break;
@@ -177,15 +171,12 @@ static void
 }
 
 static void
-pidgin_blist_theme_set_property(GObject *obj, guint param_id, GValue *value,
+pidgin_blist_theme_set_property(GObject *obj, guint param_id, const GValue *value,
 						 GParamSpec *psec)
 {
 	PidginBlistTheme *theme = PIDGIN_BLIST_THEME(obj);
 
 	switch(param_id) {
-		case PROP_ICON_THEME:
-			pidgin_blist_theme_set_icon_theme(theme, g_value_get_string(value));
-			break;
 		case PROP_BACKGROUND_COLOR:
 			pidgin_blist_theme_set_background_color(theme, g_value_get_pointer(value));
 			break;
@@ -244,7 +235,6 @@ pidgin_blist_theme_finalize (GObject *ob
 	priv = PIDGIN_BLIST_THEME_GET_PRIVATE(obj);
 
 	/* Buddy List */
-	g_free(priv->icon_theme);
 	g_free(priv->layout);
 	
 	/* Group */
@@ -276,13 +266,6 @@ pidgin_blist_theme_class_init (PidginBli
 	obj_class->set_property = pidgin_blist_theme_set_property;
 	obj_class->finalize = pidgin_blist_theme_finalize;
 
-	/* Icon Theme */
-	pspec = g_param_spec_string("icon-theme", "Icon Theme",
-				    "The icon theme to go with this buddy list theme",
-				    NULL,
-				    G_PARAM_READWRITE);
-	g_object_class_install_property(obj_class, PROP_ICON_THEME, pspec);
-
 	/* Buddy List */
 	pspec = g_param_spec_pointer("background-color", "Background Color",
 				    "The background color for the buddy list",
@@ -388,18 +371,6 @@ pidgin_blist_theme_get_type (void)
  *****************************************************************************/
 
 /* get methods */
-gchar *
-pidgin_blist_theme_get_icon_theme(PidginBlistTheme *theme)
-{
-	PidginBlistThemePrivate *priv;
-
-	g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
-
-	priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
-
-	return priv->icon_theme;
-}
-
 GdkColor *
 pidgin_blist_theme_get_background_color(PidginBlistTheme *theme)
 {
@@ -582,19 +553,6 @@ void
 
 /* Set Methods */
 void
-pidgin_blist_theme_set_icon_theme(PidginBlistTheme *theme, const gchar *icon_theme)
-{
-	PidginBlistThemePrivate *priv;
-
-	g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
-
-	priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
-
-	g_free(priv->icon_theme);
-	priv->icon_theme = g_strdup(icon_theme);
-}
-
-void
 pidgin_blist_theme_set_background_color(PidginBlistTheme *theme, GdkColor *color)
 {
 	PidginBlistThemePrivate *priv;
============================================================
--- pidgin/gtkblist-theme.h	1a42726bb8ffd7a72c09791780066272aa97eb3d
+++ pidgin/gtkblist-theme.h	366b6aa2766e60f6d56da44efcbae255b4796e99
@@ -35,7 +35,7 @@
 /**
  * extends PurpleTheme (theme.h)
  * A pidgin buddy list theme.
- * This is an object for Purple to represent a sound theme.
+ * This is an object for Purple to represent a buddy list theme.
  *
  * PidginBlistTheme is a PurpleTheme Object.
  */
@@ -99,12 +99,6 @@ GType pidgin_blist_theme_get_type(void);
 GType pidgin_blist_theme_get_type(void);
 
 /* get methods */
-/**
- * Returns the icon theme to be used with the buddy list theme
- *
- * @returns 	the icon theme
- */
-gchar *pidgin_blist_theme_get_icon_theme(PidginBlistTheme *theme);
 
 /**
  * Returns the background color of the buddy list
@@ -215,13 +209,6 @@ gdouble pidgin_blist_theme_get_opacity(P
 /* Set Methods */
 
 /**
- * Sets the icon theme to be used for this buddy list theme
- *
- * @param icon_theme	the new icon theme name
- */
-void pidgin_blist_theme_set_icon_theme(PidginBlistTheme *theme, const gchar *icon_theme);
-
-/**
  * Sets the background color to be used for this buddy list theme
  *
  * @param color		the new background color
============================================================
--- pidgin/gtkicon-loader.c	8a13620254b05de91a4314531e17793fa1154c8f
+++ pidgin/gtkicon-loader.c	83ec83d751457cea6b4a2a88649775b72377de8e
@@ -26,35 +26,25 @@
 
 #include "xmlnode.h"
 
-
-/******************************************************************************
- * Globals
- *****************************************************************************/
 /*****************************************************************************
- * Sound Theme Builder                                                      
+ * Icon Theme Builder                                                      
  *****************************************************************************/
 
 static PurpleTheme *
 pidgin_icon_loader_build(const gchar *dir)
 {
-	xmlnode *root_node, *sub_node;
-	gchar *filename, *filename_full, *data;
-	GDir *gdir;
+	xmlnode *root_node = NULL, *sub_node;
+	gchar *filename_full, *data;
 	PidginIconTheme *theme = NULL;
 
 	/* Find the theme file */
-	gdir = g_dir_open(dir, 0, NULL);
-	g_return_val_if_fail(gdir != NULL, NULL);
+	g_return_val_if_fail(dir != NULL, NULL);
+	filename_full = g_build_filename(dir, "theme.xml", NULL);
 
-	while ((filename = g_strdup(g_dir_read_name(gdir))) != NULL && ! g_str_has_suffix(filename, ".xml"))
-		g_free(filename);
-	
-	g_return_val_if_fail(filename != NULL, NULL);
-	
-	/* Build the xml tree */
-	filename_full = g_build_filename(dir, filename, NULL);
+	if (g_file_test(filename_full, G_FILE_TEST_IS_REGULAR))
+		root_node = xmlnode_from_file(dir, "theme.xml", "sound themes", "sound-loader");
 
-	root_node = xmlnode_from_file(dir, filename, "status icon themes", "icon-loader");
+	g_free(filename_full);
 	g_return_val_if_fail(root_node != NULL, NULL);
 
 	/* Parse the tree */	
@@ -70,19 +60,17 @@ pidgin_icon_loader_build(const gchar *di
 				    "directory", dir,
 				    "description", data, NULL);
 	
-		xmlnode_free(sub_node);
-	
-		while ((sub_node = xmlnode_get_child(root_node, "icon")) != NULL){
-			pidgin_icon_theme_set_file(theme,
+		sub_node = xmlnode_get_child(root_node, "icon");
+
+		while (sub_node){
+			pidgin_icon_theme_set_icon(theme,
 						   xmlnode_get_attrib(sub_node, "id"),
 						   xmlnode_get_attrib(sub_node, "file"));
-			xmlnode_free(sub_node);
+			sub_node = xmlnode_get_next_twin(sub_node);
 		}
 	}
 
 	xmlnode_free(root_node);	
-	g_dir_close(gdir);
-	g_free(filename_full);
 	g_free(data);
 	return PURPLE_THEME(theme);
 }
============================================================
--- pidgin/gtkicon-theme.c	9c720dba52aae6fa984d624671a886c519d37323
+++ pidgin/gtkicon-theme.c	e3caaa468606d2223bd41140a2f4a5648e84285c
@@ -45,9 +45,6 @@ static GObjectClass *parent_class = NULL
 static GObjectClass *parent_class = NULL;
 
 /******************************************************************************
- * Enums
- *****************************************************************************/
-/******************************************************************************
  * GObject Stuff                                                              
  *****************************************************************************/
 
@@ -61,14 +58,14 @@ pidgin_icon_theme_init(GTypeInstance *in
 
 	priv = PIDGIN_ICON_THEME_GET_PRIVATE(instance);
 
-	priv->icon_files = g_hash_table_new_full (g_str_hash,
+	priv->icon_files = g_hash_table_new_full(g_str_hash,
 						   g_str_equal,
 						   g_free,
 						   g_free);
 }
 
 static void 
-pidgin_icon_theme_finalize (GObject *obj)
+pidgin_icon_theme_finalize(GObject *obj)
 {
 	PidginIconThemePrivate *priv;
 
@@ -76,21 +73,21 @@ pidgin_icon_theme_finalize (GObject *obj
 	
 	g_hash_table_destroy(priv->icon_files);
 
-	parent_class->finalize (obj);
+	parent_class->finalize(obj);
 }
 
 static void
-pidgin_icon_theme_class_init (PidginIconThemeClass *klass)
+pidgin_icon_theme_class_init(PidginIconThemeClass *klass)
 {
 	GObjectClass *obj_class = G_OBJECT_CLASS(klass);
 
-	parent_class = g_type_class_peek_parent (klass);
+	parent_class = g_type_class_peek_parent(klass);
 
         obj_class->finalize = pidgin_icon_theme_finalize;
 }
 
 GType 
-pidgin_icon_theme_get_type (void)
+pidgin_icon_theme_get_type(void)
 {
   static GType type = 0;
   if (type == 0) {
@@ -106,7 +103,7 @@ pidgin_icon_theme_get_type (void)
       pidgin_icon_theme_init,    /* instance_init */
       NULL,   /* value table */
     };
-    type = g_type_register_static (PURPLE_TYPE_THEME,
+    type = g_type_register_static(PURPLE_TYPE_THEME,
                                    "PidginIconTheme",
                                    &info, G_TYPE_FLAG_ABSTRACT);
   }
@@ -119,7 +116,7 @@ const gchar *
  *****************************************************************************/
 
 const gchar *
-pidgin_icon_theme_get_file(PidginIconTheme *theme,
+pidgin_icon_theme_get_icon(PidginIconTheme *theme,
 			    const gchar *id)
 {
 	PidginIconThemePrivate *priv;
@@ -132,7 +129,7 @@ void 
 }
 
 void 
-pidgin_icon_theme_set_file(PidginIconTheme *theme,
+pidgin_icon_theme_set_icon(PidginIconTheme *theme,
 			    const gchar *id, 
 			    const gchar *filename)
 {
@@ -141,7 +138,8 @@ pidgin_icon_theme_set_file(PidginIconThe
 	
 	priv = PIDGIN_ICON_THEME_GET_PRIVATE(theme);
 
-	if (filename != NULL)g_hash_table_replace(priv->icon_files,
+	if (filename != NULL)
+		g_hash_table_replace(priv->icon_files,
                  	             g_strdup(id),
                         	     g_strdup(filename));
 	else g_hash_table_remove(priv->icon_files, id);
============================================================
--- pidgin/gtkicon-theme.h	49534470033dd427bf810af0a6a92a52560259d4
+++ pidgin/gtkicon-theme.h	8fc71b8d3a7dfee4e39e0ba46e951feec8316c43
@@ -70,21 +70,21 @@ GType pidgin_icon_theme_get_type(void);
 GType pidgin_icon_theme_get_type(void);
 
 /**
- * Returns a copy of the filename for the icon event
+ * Returns a copy of the filename for the icon event or NULL if it is not set
  *
  * @param event		the pidgin icon event to look up
  *
  * @returns the filename of the icon event
  */
-const gchar *pidgin_icon_theme_get_file(PidginIconTheme *theme,
-				   const gchar *event);
+const gchar *pidgin_icon_theme_get_icon(PidginIconTheme *theme,
+				  	const gchar *event);
 /**
- * Sets the filename for a given icon id
+ * Sets the filename for a given icon id, setting the icon to NULL will remove the icon from the theme
  *
  * @param icon_id		a string representing what the icon is to be used for
  * @param filename		the name of the file to be used for the given id
  */
-void pidgin_icon_theme_set_file(PidginIconTheme *theme,
+void pidgin_icon_theme_set_icon(PidginIconTheme *theme,
 				const gchar *icon_id, 
 			    	const gchar *filename);
 
============================================================
--- pidgin/gtkprefs.c	88b663a13af79d4029f5bd2eb6575c95e67df45c
+++ pidgin/gtkprefs.c	12169b9cffcacf24cb8e7914a7fd92b0930402ba
@@ -693,6 +693,7 @@ prefs_build_theme_combo_box(GtkListStore
 	GtkCellRenderer *cell_rend;
 	GtkTreeIter iter;
 	gchar *theme = NULL;
+	gboolean unset = TRUE;
 
 	g_return_val_if_fail(store != NULL && current_theme != NULL, NULL);
 
@@ -714,13 +715,18 @@ prefs_build_theme_combo_box(GtkListStore
 		do {
 			gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, 2, &theme, -1);
 
-			if (g_str_equal(current_theme, theme))
+			if (g_str_equal(current_theme, theme)) {
 				gtk_combo_box_set_active_iter(GTK_COMBO_BOX(combo_box), &iter);
-			
+				unset = FALSE;
+			}
+
 			g_free(theme);
 		} while (gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter));
 	}
 
+	if (unset)
+		gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box), 0);
+
 	return combo_box;
 }
 
============================================================
--- pidgin/gtksound.c	5f3bf7c7f8c93566015fd57c83a037dd6ac6dfe1
+++ pidgin/gtksound.c	7ebdf399c7588652eb3dce3467dd16985bbd137c
@@ -560,7 +560,7 @@ pidgin_sound_play_event(PurpleSoundEvent
 {
 	char *enable_pref;
 	char *file_pref;
-	char *theme_name;
+	const char *theme_name;
 	PurpleSoundTheme *theme;
 
 	if ((event == PURPLE_SOUND_BUDDY_ARRIVE) && mute_login_sounds)
@@ -607,7 +607,6 @@ pidgin_sound_play_event(PurpleSoundEvent
 		g_free(filename);
 	}
 
-
 	g_free(enable_pref);
 	g_free(file_pref);
 }
============================================================
--- pidgin/pidginstock.c	5a47e942bd5fd9b8c304a591381a7b0788bf4326
+++ pidgin/pidginstock.c	30ff01ae2582ce4eed25af2bb762f6f5abdb5c6e
@@ -269,7 +269,7 @@ find_icon_file(PidginStatusIconTheme *th
 	gchar *file_full = NULL;
 
 	if (theme != NULL) {
-		file = pidgin_icon_theme_get_file(PIDGIN_ICON_THEME(theme), sized_icon.name);
+		file = pidgin_icon_theme_get_icon(PIDGIN_ICON_THEME(theme), sized_icon.name);
 		dir = purple_theme_get_dir(PURPLE_THEME(theme));
 
 		if (rtl)
@@ -505,11 +505,11 @@ pidgin_stock_init(void)
 	gtk_widget_destroy(win);
 	g_object_unref(G_OBJECT(icon_factory));
 
-	/* Pre-load Status icon theme*/
+	/* Pre-load Status icon theme - this avoids a bug with displaying the correct icon in the tray */
 	if (purple_prefs_get_string(PIDGIN_PREFS_ROOT "/icon/status/theme") && 
 	   (path = purple_prefs_get_path(PIDGIN_PREFS_ROOT "/status/icon-theme-dir"))) {
 		
-		PidginStatusIconTheme *theme = purple_theme_loader_build(PURPLE_THEME_LOADER(loader), path);
+		PidginStatusIconTheme *theme = PIDGIN_STATUS_ICON_THEME(purple_theme_loader_build(PURPLE_THEME_LOADER(loader), path));
 		pidgin_stock_load_status_icon_theme(theme);
 		g_object_unref(G_OBJECT(theme));
 


More information about the Commits mailing list