comparison pidgin/gtkthemes.c @ 17484:7055885b1b70

Figured out how to keep reflecting current smiley theme after remove.
author Gabriel Schulhof <nix@go-nix.ca>
date Sat, 02 Jun 2007 07:30:43 +0000
parents cf6b7aeae062
children 76066eb86611
comparison
equal deleted inserted replaced
17483:cf6b7aeae062 17484:7055885b1b70
85 if (!g_file_test(file, G_FILE_TEST_EXISTS)) return; 85 if (!g_file_test(file, G_FILE_TEST_EXISTS)) return;
86 if ((theme_dir = g_strdup(file)) == NULL) return ; 86 if ((theme_dir = g_strdup(file)) == NULL) return ;
87 87
88 if ((last_slash = g_strrstr(theme_dir, G_DIR_SEPARATOR_S)) != NULL) { 88 if ((last_slash = g_strrstr(theme_dir, G_DIR_SEPARATOR_S)) != NULL) {
89 GSList *iter = NULL; 89 GSList *iter = NULL;
90 struct smiley_theme *theme = NULL; 90 struct smiley_theme *theme = NULL, *new_theme = NULL;
91 91
92 *last_slash = 0; 92 *last_slash = 0;
93 93
94 /* Delete files on disk */ 94 /* Delete files on disk */
95 pidgin_themes_remove_theme_dir(theme_dir); 95 pidgin_themes_remove_theme_dir(theme_dir);
99 theme = ((struct smiley_theme *)(iter->data)); 99 theme = ((struct smiley_theme *)(iter->data));
100 if (!strcmp(theme->path, file)) 100 if (!strcmp(theme->path, file))
101 break ; 101 break ;
102 } 102 }
103 if (iter) { 103 if (iter) {
104 if (theme == current_smiley_theme) 104 if (theme == current_smiley_theme) {
105 current_smiley_theme = ((struct smiley_theme *)(NULL == iter->next ? (smiley_themes == iter ? NULL : smiley_themes->data) : iter->next->data)); 105 new_theme = ((struct smiley_theme *)(NULL == iter->next ? (smiley_themes == iter ? NULL : smiley_themes->data) : iter->next->data));
106 if (new_theme)
107 purple_prefs_set_string(PIDGIN_PREFS_ROOT "/smileys/theme", new_theme->name);
108 else
109 current_smiley_theme = NULL;
110 }
106 smiley_themes = g_slist_delete_link(smiley_themes, iter); 111 smiley_themes = g_slist_delete_link(smiley_themes, iter);
107 112
108 /* Destroy theme structure */ 113 /* Destroy theme structure */
109 pidgin_themes_destroy_smiley_theme(theme); 114 pidgin_themes_destroy_smiley_theme(theme);
110 } 115 }