diff pidgin/gtkicon-theme-loader.c @ 29471:d83ee160ffb6

propagate from branch 'im.pidgin.pidgin' (head eb9385f349a20856b9d3f9911dbc8024caa44052) to branch 'im.pidgin.pidgin.next.minor' (head 439fb2dd7a285d9ca645f65f36ef0f037abe7311)
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Wed, 19 Aug 2009 00:46:04 +0000
parents 9ad4b5200f24
children
line wrap: on
line diff
--- a/pidgin/gtkicon-theme-loader.c	Mon Mar 02 06:51:50 2009 +0000
+++ b/pidgin/gtkicon-theme-loader.c	Wed Aug 19 00:46:04 2009 +0000
@@ -24,6 +24,7 @@
 #include "gtkstatus-icon-theme.h"
 
 #include "xmlnode.h"
+#include "debug.h"
 
 /*****************************************************************************
  * Icon Theme Builder
@@ -33,39 +34,45 @@
 pidgin_icon_loader_build(const gchar *dir)
 {
 	xmlnode *root_node = NULL, *sub_node;
-	gchar *filename_full, *data;
+	gchar *filename_full, *data = NULL;
 	PidginIconTheme *theme = NULL;
+	const gchar *name;
 
 	/* Find the theme file */
 	g_return_val_if_fail(dir != NULL, NULL);
 	filename_full = g_build_filename(dir, "theme.xml", NULL);
 
 	if (g_file_test(filename_full, G_FILE_TEST_IS_REGULAR))
-		root_node = xmlnode_from_file(dir, "theme.xml", "sound themes", "sound-theme-loader");
+		root_node = xmlnode_from_file(dir, "theme.xml", "icon themes", "icon-theme-loader");
 
 	g_free(filename_full);
-	g_return_val_if_fail(root_node != NULL, NULL);
+	if (root_node == NULL)
+		return NULL;
+
+	name = xmlnode_get_attrib(root_node, "name");
 
-	/* Parse the tree */
-	sub_node = xmlnode_get_child(root_node, "description");
-	data = xmlnode_get_data(sub_node);
+	if (name) {
+		/* Parse the tree */
+		sub_node = xmlnode_get_child(root_node, "description");
+		data = xmlnode_get_data(sub_node);
 
-	if (xmlnode_get_attrib(root_node, "name") != NULL) {
-		theme = g_object_new(PIDGIN_TYPE_STATUS_ICON_THEME,
-				"type", "status-icon",
-				"name", xmlnode_get_attrib(root_node, "name"),
-				"author", xmlnode_get_attrib(root_node, "author"),
-				"image", xmlnode_get_attrib(root_node, "image"),
-				"directory", dir,
-				"description", data, NULL);
+		if (xmlnode_get_attrib(root_node, "name") != NULL) {
+			theme = g_object_new(PIDGIN_TYPE_STATUS_ICON_THEME,
+					"type", "status-icon",
+					"name", name,
+					"author", xmlnode_get_attrib(root_node, "author"),
+					"image", xmlnode_get_attrib(root_node, "image"),
+					"directory", dir,
+					"description", data, NULL);
 
-		sub_node = xmlnode_get_child(root_node, "icon");
+			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"));
-			sub_node = xmlnode_get_next_twin(sub_node);
+			while (sub_node) {
+				pidgin_icon_theme_set_icon(theme,
+						xmlnode_get_attrib(sub_node, "id"),
+						xmlnode_get_attrib(sub_node, "file"));
+				sub_node = xmlnode_get_next_twin(sub_node);
+			}
 		}
 	}