pidgin/gtkthemes.c

changeset 28075
2d472ed937db
parent 25888
d0fdd378a635
child 28077
c2b493e058f1
equal deleted inserted replaced
28074:0f75cd31966a 28075:2d472ed937db
227 char *i; 227 char *i;
228 struct smiley_theme *theme=NULL; 228 struct smiley_theme *theme=NULL;
229 struct smiley_list *list = NULL; 229 struct smiley_list *list = NULL;
230 GSList *lst = smiley_themes; 230 GSList *lst = smiley_themes;
231 char *dirname; 231 char *dirname;
232 gboolean new_theme = FALSE;
233 232
234 if (!f) 233 if (!f)
235 return; 234 return;
236 235
237 while (lst) { 236 while (lst) {
241 break; 240 break;
242 } 241 }
243 lst = lst->next; 242 lst = lst->next;
244 } 243 }
245 244
246 if (!theme) { 245 if (theme == current_smiley_theme) {
247 new_theme = TRUE;
248 theme = g_new0(struct smiley_theme, 1);
249 theme->path = g_strdup(file);
250 } else if (theme == current_smiley_theme) {
251 /* Don't reload the theme if it is already loaded */ 246 /* Don't reload the theme if it is already loaded */
252 fclose(f); 247 fclose(f);
253 return; 248 return;
249 }
250
251 if (theme == NULL) {
252 theme = g_new0(struct smiley_theme, 1);
253 theme->path = g_strdup(file);
254 smiley_themes = g_slist_prepend(smiley_themes, theme);
254 } 255 }
255 256
256 dirname = g_path_get_dirname(file); 257 dirname = g_path_get_dirname(file);
257 258
258 while (!feof(f)) { 259 while (!feof(f)) {
339 fclose(f); 340 fclose(f);
340 341
341 if (!theme->name || !theme->desc || !theme->author) { 342 if (!theme->name || !theme->desc || !theme->author) {
342 purple_debug_error("gtkthemes", "Invalid file format, not loading smiley theme from '%s'\n", file); 343 purple_debug_error("gtkthemes", "Invalid file format, not loading smiley theme from '%s'\n", file);
343 344
345 smiley_themes = g_slist_remove(smiley_themes, theme);
344 pidgin_themes_destroy_smiley_theme(theme); 346 pidgin_themes_destroy_smiley_theme(theme);
345 return; 347 return;
346 }
347
348 if (new_theme) {
349 smiley_themes = g_slist_prepend(smiley_themes, theme);
350 } 348 }
351 349
352 if (load) { 350 if (load) {
353 GList *cnv; 351 GList *cnv;
354 352

mercurial