Mercurial > pidgin
comparison finch/gntplugin.c @ 16942:2d2c2913548b
merge of '6c5cdf9bfd5c1acf1c24c55338915947e844d91d'
and 'b7ac78b8beb039f7545d74bbc3075947bb5d27e5'
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Tue, 08 May 2007 03:38:21 +0000 |
parents | beb960114f7d |
children | a924c94ce5da |
comparison
equal
deleted
inserted
replaced
16931:dd768c576ab2 | 16942:2d2c2913548b |
---|---|
103 static void | 103 static void |
104 selection_changed(GntWidget *widget, gpointer old, gpointer current, gpointer null) | 104 selection_changed(GntWidget *widget, gpointer old, gpointer current, gpointer null) |
105 { | 105 { |
106 PurplePlugin *plugin = current; | 106 PurplePlugin *plugin = current; |
107 char *text; | 107 char *text; |
108 GList *list = NULL, *iter = NULL; | |
109 | |
110 /* If the selected plugin was unseen before, mark it as seen. But save the list | |
111 * only when the plugin list is closed. So if the user enables a plugin, and it | |
112 * crashes, it won't get marked as seen so the user can fix the bug and still | |
113 * quickly find the plugin in the list. | |
114 * I probably mean 'plugin developers' by 'users' here. */ | |
115 list = g_object_get_data(G_OBJECT(widget), "seen-list"); | |
116 if (list) | |
117 iter = g_list_find_custom(list, plugin->path, (GCompareFunc)strcmp); | |
118 if (!iter) { | |
119 list = g_list_prepend(list, g_strdup(plugin->path)); | |
120 g_object_set_data(G_OBJECT(widget), "seen-list", list); | |
121 } | |
108 | 122 |
109 /* XXX: Use formatting and stuff */ | 123 /* XXX: Use formatting and stuff */ |
110 gnt_text_view_clear(GNT_TEXT_VIEW(plugins.aboot)); | 124 gnt_text_view_clear(GNT_TEXT_VIEW(plugins.aboot)); |
111 text = g_strdup_printf(_("Name: %s\nVersion: %s\nDescription: %s\nAuthor: %s\nWebsite: %s\nFilename: %s\n"), | 125 text = g_strdup_printf(_("Name: %s\nVersion: %s\nDescription: %s\nAuthor: %s\nWebsite: %s\nFilename: %s\n"), |
112 SAFE(plugin->info->name), SAFE(plugin->info->version), SAFE(plugin->info->description), | 126 SAFE(plugin->info->name), SAFE(plugin->info->version), SAFE(plugin->info->description), |
119 } | 133 } |
120 | 134 |
121 static void | 135 static void |
122 reset_plugin_window(GntWidget *window, gpointer null) | 136 reset_plugin_window(GntWidget *window, gpointer null) |
123 { | 137 { |
138 GList *list = g_object_get_data(G_OBJECT(plugins.tree), "seen-list"); | |
139 purple_prefs_set_path_list("/finch/plugins/seen", list); | |
140 g_list_foreach(list, (GFunc)g_free, NULL); | |
141 g_list_free(list); | |
142 | |
124 plugins.window = NULL; | 143 plugins.window = NULL; |
125 plugins.tree = NULL; | 144 plugins.tree = NULL; |
126 plugins.aboot = NULL; | 145 plugins.aboot = NULL; |
127 } | 146 } |
128 | 147 |
212 | 231 |
213 void finch_plugins_show_all() | 232 void finch_plugins_show_all() |
214 { | 233 { |
215 GntWidget *window, *tree, *box, *aboot, *button; | 234 GntWidget *window, *tree, *box, *aboot, *button; |
216 GList *iter; | 235 GList *iter; |
236 GList *seen; | |
237 | |
217 if (plugins.window) | 238 if (plugins.window) |
218 return; | 239 return; |
219 | 240 |
220 purple_plugins_probe(G_MODULE_SUFFIX); | 241 purple_plugins_probe(G_MODULE_SUFFIX); |
221 | 242 |
242 | 263 |
243 plugins.aboot = aboot = gnt_text_view_new(); | 264 plugins.aboot = aboot = gnt_text_view_new(); |
244 gnt_widget_set_size(aboot, 40, 20); | 265 gnt_widget_set_size(aboot, 40, 20); |
245 gnt_box_add_widget(GNT_BOX(box), aboot); | 266 gnt_box_add_widget(GNT_BOX(box), aboot); |
246 | 267 |
268 seen = purple_prefs_get_path_list("/finch/plugins/seen"); | |
247 for (iter = purple_plugins_get_all(); iter; iter = iter->next) | 269 for (iter = purple_plugins_get_all(); iter; iter = iter->next) |
248 { | 270 { |
249 PurplePlugin *plug = iter->data; | 271 PurplePlugin *plug = iter->data; |
250 | 272 |
251 if (plug->info->type != PURPLE_PLUGIN_STANDARD || | 273 if (plug->info->type != PURPLE_PLUGIN_STANDARD || |
254 continue; | 276 continue; |
255 | 277 |
256 gnt_tree_add_choice(GNT_TREE(tree), plug, | 278 gnt_tree_add_choice(GNT_TREE(tree), plug, |
257 gnt_tree_create_row(GNT_TREE(tree), plug->info->name), NULL, NULL); | 279 gnt_tree_create_row(GNT_TREE(tree), plug->info->name), NULL, NULL); |
258 gnt_tree_set_choice(GNT_TREE(tree), plug, purple_plugin_is_loaded(plug)); | 280 gnt_tree_set_choice(GNT_TREE(tree), plug, purple_plugin_is_loaded(plug)); |
281 if (!g_list_find_custom(seen, plug->path, (GCompareFunc)strcmp)) | |
282 gnt_tree_set_row_flags(GNT_TREE(tree), plug, GNT_TEXT_FLAG_BOLD); | |
259 } | 283 } |
260 gnt_tree_set_col_width(GNT_TREE(tree), 0, 30); | 284 gnt_tree_set_col_width(GNT_TREE(tree), 0, 30); |
261 g_signal_connect(G_OBJECT(tree), "toggled", G_CALLBACK(plugin_toggled_cb), NULL); | 285 g_signal_connect(G_OBJECT(tree), "toggled", G_CALLBACK(plugin_toggled_cb), NULL); |
262 g_signal_connect(G_OBJECT(tree), "selection_changed", G_CALLBACK(selection_changed), NULL); | 286 g_signal_connect(G_OBJECT(tree), "selection_changed", G_CALLBACK(selection_changed), NULL); |
287 g_object_set_data(G_OBJECT(tree), "seen-list", seen); | |
263 | 288 |
264 box = gnt_hbox_new(FALSE); | 289 box = gnt_hbox_new(FALSE); |
265 gnt_box_add_widget(GNT_BOX(window), box); | 290 gnt_box_add_widget(GNT_BOX(window), box); |
266 | 291 |
267 button = gnt_button_new(_("Close")); | 292 button = gnt_button_new(_("Close")); |