comparison pidgin/gtkblist-theme-loader.c @ 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 a8cc50c2279f
children
comparison
equal deleted inserted replaced
32729:b276701931d9 32730:f7be1e356a23
71 return NULL; 71 return NULL;
72 } 72 }
73 } 73 }
74 74
75 static PurpleTheme * 75 static PurpleTheme *
76 pidgin_blist_loader_build(const gchar *dir) 76 pidgin_blist_loader_build(const gchar *theme_dir)
77 { 77 {
78 xmlnode *root_node = NULL, *sub_node, *sub_sub_node; 78 xmlnode *root_node = NULL, *sub_node, *sub_sub_node;
79 gchar *filename_full, *data = NULL; 79 gchar *dir, *filename_full, *data = NULL;
80 const gchar *temp, *name; 80 const gchar *temp, *name;
81 gboolean success = TRUE; 81 gboolean success = TRUE;
82 GdkColor *bgcolor, *expanded_bgcolor, *collapsed_bgcolor, *contact_color; 82 GdkColor *bgcolor, *expanded_bgcolor, *collapsed_bgcolor, *contact_color;
83 PidginThemeFont *expanded, *collapsed, *contact, *online, *away, *offline, *idle, *message, *message_nick_said, *status; 83 PidginThemeFont *expanded, *collapsed, *contact, *online, *away, *offline, *idle, *message, *message_nick_said, *status;
84 PidginBlistLayout layout; 84 PidginBlistLayout layout;
110 message = NULL; 110 message = NULL;
111 message_nick_said = NULL; 111 message_nick_said = NULL;
112 status = NULL; 112 status = NULL;
113 113
114 /* Find the theme file */ 114 /* Find the theme file */
115 g_return_val_if_fail(dir != NULL, NULL); 115 g_return_val_if_fail(theme_dir != NULL, NULL);
116 dir = g_build_filename(theme_dir, "purple", "blist", NULL);
116 filename_full = g_build_filename(dir, "theme.xml", NULL); 117 filename_full = g_build_filename(dir, "theme.xml", NULL);
117 118
118 if (g_file_test(filename_full, G_FILE_TEST_IS_REGULAR)) 119 if (g_file_test(filename_full, G_FILE_TEST_IS_REGULAR))
119 root_node = xmlnode_from_file(dir, "theme.xml", "buddy list themes", "blist-loader"); 120 root_node = xmlnode_from_file(dir, "theme.xml", "buddy list themes", "blist-loader");
120 121
121 g_free(filename_full); 122 g_free(filename_full);
122 if (root_node == NULL) 123 if (root_node == NULL) {
124 g_free(dir);
123 return NULL; 125 return NULL;
126 }
124 127
125 sub_node = xmlnode_get_child(root_node, "description"); 128 sub_node = xmlnode_get_child(root_node, "description");
126 data = xmlnode_get_data(sub_node); 129 data = xmlnode_get_data(sub_node);
127 130
128 name = xmlnode_get_attrib(root_node, "name"); 131 name = xmlnode_get_attrib(root_node, "name");
225 pidgin_theme_font_free(expanded); 228 pidgin_theme_font_free(expanded);
226 pidgin_theme_font_free(collapsed); 229 pidgin_theme_font_free(collapsed);
227 230
228 xmlnode_free(root_node); 231 xmlnode_free(root_node);
229 g_free(data); 232 g_free(data);
233 g_free(dir);
230 234
231 /* malformed xml file - also frees all partial data*/ 235 /* malformed xml file - also frees all partial data*/
232 if (!success) { 236 if (!success) {
233 g_object_unref(theme); 237 g_object_unref(theme);
234 theme = NULL; 238 theme = NULL;