changeset 32730:f7be1e356a23

Change theme loaders to use the correct subdirectory now that the theme manager only gives them the root directory.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sat, 03 Mar 2012 08:19:33 +0000
parents b276701931d9
children f2478fe32c79
files libpurple/sound-theme-loader.c pidgin/gtkblist-theme-loader.c pidgin/gtkicon-theme-loader.c
diffstat 3 files changed, 23 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/sound-theme-loader.c	Sat Mar 03 07:47:07 2012 +0000
+++ b/libpurple/sound-theme-loader.c	Sat Mar 03 08:19:33 2012 +0000
@@ -32,23 +32,26 @@
  *****************************************************************************/
 
 static PurpleTheme *
-purple_sound_loader_build(const gchar *dir)
+purple_sound_loader_build(const gchar *theme_dir)
 {
 	xmlnode *root_node = NULL, *sub_node;
-	gchar *filename_full, *data = NULL;
+	gchar *dir, *filename_full, *data = NULL;
 	PurpleSoundTheme *theme = NULL;
 	const gchar *name;
 
 	/* Find the theme file */
-	g_return_val_if_fail(dir != NULL, NULL);
+	g_return_val_if_fail(theme_dir != NULL, NULL);
+	dir = g_build_filename(theme_dir, "purple", "sound", 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");
 
 	g_free(filename_full);
-	if (root_node == NULL)
+	if (root_node == NULL) {
+		g_free(dir);
 		return NULL;
+	}
 
 	name = xmlnode_get_attrib(root_node, "name");
 
@@ -79,6 +82,7 @@
 
 	xmlnode_free(root_node);
 	g_free(data);
+	g_free(dir);
 	return PURPLE_THEME(theme);
 }
 
--- a/pidgin/gtkblist-theme-loader.c	Sat Mar 03 07:47:07 2012 +0000
+++ b/pidgin/gtkblist-theme-loader.c	Sat Mar 03 08:19:33 2012 +0000
@@ -73,10 +73,10 @@
 }
 
 static PurpleTheme *
-pidgin_blist_loader_build(const gchar *dir)
+pidgin_blist_loader_build(const gchar *theme_dir)
 {
 	xmlnode *root_node = NULL, *sub_node, *sub_sub_node;
-	gchar *filename_full, *data = NULL;
+	gchar *dir, *filename_full, *data = NULL;
 	const gchar *temp, *name;
 	gboolean success = TRUE;
 	GdkColor *bgcolor, *expanded_bgcolor, *collapsed_bgcolor, *contact_color;
@@ -112,15 +112,18 @@
 	status            = NULL;
 
 	/* Find the theme file */
-	g_return_val_if_fail(dir != NULL, NULL);
+	g_return_val_if_fail(theme_dir != NULL, NULL);
+	dir = g_build_filename(theme_dir, "purple", "blist", 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", "buddy list themes", "blist-loader");
 
 	g_free(filename_full);
-	if (root_node == NULL)
+	if (root_node == NULL) {
+		g_free(dir);
 		return NULL;
+	}
 
 	sub_node = xmlnode_get_child(root_node, "description");
 	data = xmlnode_get_data(sub_node);
@@ -227,6 +230,7 @@
 
 	xmlnode_free(root_node);
 	g_free(data);
+	g_free(dir);
 
 	/* malformed xml file - also frees all partial data*/
 	if (!success) {
--- a/pidgin/gtkicon-theme-loader.c	Sat Mar 03 07:47:07 2012 +0000
+++ b/pidgin/gtkicon-theme-loader.c	Sat Mar 03 08:19:33 2012 +0000
@@ -31,23 +31,26 @@
  *****************************************************************************/
 
 static PurpleTheme *
-pidgin_icon_loader_build(const gchar *dir)
+pidgin_icon_loader_build(const gchar *theme_dir)
 {
 	xmlnode *root_node = NULL, *sub_node;
-	gchar *filename_full, *data = NULL;
+	gchar *dir, *filename_full, *data = NULL;
 	PidginIconTheme *theme = NULL;
 	const gchar *name;
 
 	/* Find the theme file */
-	g_return_val_if_fail(dir != NULL, NULL);
+	g_return_val_if_fail(theme_dir != NULL, NULL);
+	dir = g_build_filename(theme_dir, "purple", "status-icon", 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", "icon themes", "icon-theme-loader");
 
 	g_free(filename_full);
-	if (root_node == NULL)
+	if (root_node == NULL) {
+		g_free(dir);
 		return NULL;
+	}
 
 	name = xmlnode_get_attrib(root_node, "name");