| 1 /** |
1 /** |
| 2 * @file gtkplugin.c GTK+ Plugins support |
2 * @file gtkplugin.c GTK+ Plugins support |
| 3 * @ingroup gtkui |
3 * @ingroup gtkui |
| 4 * |
4 * |
| 5 * gaim |
5 * purple |
| 6 * |
6 * |
| 7 * Gaim is the legal property of its developers, whose names are too numerous |
7 * Purple is the legal property of its developers, whose names are too numerous |
| 8 * to list here. Please refer to the COPYRIGHT file distributed with this |
8 * to list here. Please refer to the COPYRIGHT file distributed with this |
| 9 * source distribution. |
9 * source distribution. |
| 10 * |
10 * |
| 11 * This program is free software; you can redistribute it and/or modify |
11 * This program is free software; you can redistribute it and/or modify |
| 12 * it under the terms of the GNU General Public License as published by |
12 * it under the terms of the GNU General Public License as published by |
| 33 |
33 |
| 34 #include <string.h> |
34 #include <string.h> |
| 35 |
35 |
| 36 #define PIDGIN_RESPONSE_CONFIGURE 98121 |
36 #define PIDGIN_RESPONSE_CONFIGURE 98121 |
| 37 |
37 |
| 38 static void plugin_toggled_stage_two(GaimPlugin *plug, GtkTreeModel *model, |
38 static void plugin_toggled_stage_two(PurplePlugin *plug, GtkTreeModel *model, |
| 39 GtkTreeIter *iter, gboolean unload); |
39 GtkTreeIter *iter, gboolean unload); |
| 40 |
40 |
| 41 static GtkWidget *expander = NULL; |
41 static GtkWidget *expander = NULL; |
| 42 static GtkWidget *plugin_dialog = NULL; |
42 static GtkWidget *plugin_dialog = NULL; |
| 43 static GtkWidget *plugin_details = NULL; |
43 static GtkWidget *plugin_details = NULL; |
| 44 static GtkWidget *pref_button = NULL; |
44 static GtkWidget *pref_button = NULL; |
| 45 static GHashTable *plugin_pref_dialogs = NULL; |
45 static GHashTable *plugin_pref_dialogs = NULL; |
| 46 |
46 |
| 47 GtkWidget * |
47 GtkWidget * |
| 48 pidgin_plugin_get_config_frame(GaimPlugin *plugin) |
48 pidgin_plugin_get_config_frame(PurplePlugin *plugin) |
| 49 { |
49 { |
| 50 GtkWidget *config = NULL; |
50 GtkWidget *config = NULL; |
| 51 |
51 |
| 52 g_return_val_if_fail(plugin != NULL, NULL); |
52 g_return_val_if_fail(plugin != NULL, NULL); |
| 53 |
53 |
| 61 config = ui_info->get_config_frame(plugin); |
61 config = ui_info->get_config_frame(plugin); |
| 62 |
62 |
| 63 if (plugin->info->prefs_info |
63 if (plugin->info->prefs_info |
| 64 && plugin->info->prefs_info->get_plugin_pref_frame) |
64 && plugin->info->prefs_info->get_plugin_pref_frame) |
| 65 { |
65 { |
| 66 gaim_debug_warning("gtkplugin", |
66 purple_debug_warning("gtkplugin", |
| 67 "Plugin %s contains both, ui_info and " |
67 "Plugin %s contains both, ui_info and " |
| 68 "prefs_info preferences; prefs_info will be " |
68 "prefs_info preferences; prefs_info will be " |
| 69 "ignored.", plugin->info->name); |
69 "ignored.", plugin->info->name); |
| 70 } |
70 } |
| 71 } |
71 } |
| 72 |
72 |
| 73 if (config == NULL && plugin->info->prefs_info |
73 if (config == NULL && plugin->info->prefs_info |
| 74 && plugin->info->prefs_info->get_plugin_pref_frame) |
74 && plugin->info->prefs_info->get_plugin_pref_frame) |
| 75 { |
75 { |
| 76 GaimPluginPrefFrame *frame; |
76 PurplePluginPrefFrame *frame; |
| 77 |
77 |
| 78 frame = plugin->info->prefs_info->get_plugin_pref_frame(plugin); |
78 frame = plugin->info->prefs_info->get_plugin_pref_frame(plugin); |
| 79 |
79 |
| 80 config = pidgin_plugin_pref_create_frame(frame); |
80 config = pidgin_plugin_pref_create_frame(frame); |
| 81 |
81 |
| 82 /* XXX According to bug #1407047 this broke saving pluging preferences, I'll look at fixing it correctly later. |
82 /* XXX According to bug #1407047 this broke saving pluging preferences, I'll look at fixing it correctly later. |
| 83 gaim_plugin_pref_frame_destroy(frame); |
83 purple_plugin_pref_frame_destroy(frame); |
| 84 */ |
84 */ |
| 85 } |
85 } |
| 86 |
86 |
| 87 return config; |
87 return config; |
| 88 } |
88 } |
| 89 |
89 |
| 90 void |
90 void |
| 91 pidgin_plugins_save(void) |
91 pidgin_plugins_save(void) |
| 92 { |
92 { |
| 93 gaim_plugins_save_loaded("/gaim/gtk/plugins/loaded"); |
93 purple_plugins_save_loaded("/purple/gtk/plugins/loaded"); |
| 94 } |
94 } |
| 95 |
95 |
| 96 static void |
96 static void |
| 97 update_plugin_list(void *data) |
97 update_plugin_list(void *data) |
| 98 { |
98 { |
| 99 GtkListStore *ls = GTK_LIST_STORE(data); |
99 GtkListStore *ls = GTK_LIST_STORE(data); |
| 100 GtkTreeIter iter; |
100 GtkTreeIter iter; |
| 101 GList *probes; |
101 GList *probes; |
| 102 GaimPlugin *plug; |
102 PurplePlugin *plug; |
| 103 |
103 |
| 104 gtk_list_store_clear(ls); |
104 gtk_list_store_clear(ls); |
| 105 gaim_plugins_probe(G_MODULE_SUFFIX); |
105 purple_plugins_probe(G_MODULE_SUFFIX); |
| 106 |
106 |
| 107 for (probes = gaim_plugins_get_all(); |
107 for (probes = purple_plugins_get_all(); |
| 108 probes != NULL; |
108 probes != NULL; |
| 109 probes = probes->next) |
109 probes = probes->next) |
| 110 { |
110 { |
| 111 char *name; |
111 char *name; |
| 112 char *version; |
112 char *version; |
| 113 char *summary; |
113 char *summary; |
| 114 char *desc; |
114 char *desc; |
| 115 plug = probes->data; |
115 plug = probes->data; |
| 116 |
116 |
| 117 if (plug->info->type == GAIM_PLUGIN_LOADER) { |
117 if (plug->info->type == PURPLE_PLUGIN_LOADER) { |
| 118 GList *cur; |
118 GList *cur; |
| 119 for (cur = GAIM_PLUGIN_LOADER_INFO(plug)->exts; cur != NULL; |
119 for (cur = PURPLE_PLUGIN_LOADER_INFO(plug)->exts; cur != NULL; |
| 120 cur = cur->next) |
120 cur = cur->next) |
| 121 gaim_plugins_probe(cur->data); |
121 purple_plugins_probe(cur->data); |
| 122 continue; |
122 continue; |
| 123 } else if (plug->info->type != GAIM_PLUGIN_STANDARD || |
123 } else if (plug->info->type != PURPLE_PLUGIN_STANDARD || |
| 124 (plug->info->flags & GAIM_PLUGIN_FLAG_INVISIBLE)) { |
124 (plug->info->flags & PURPLE_PLUGIN_FLAG_INVISIBLE)) { |
| 125 continue; |
125 continue; |
| 126 } |
126 } |
| 127 |
127 |
| 128 gtk_list_store_append (ls, &iter); |
128 gtk_list_store_append (ls, &iter); |
| 129 |
129 |
| 137 g_free(name); |
137 g_free(name); |
| 138 g_free(version); |
138 g_free(version); |
| 139 g_free(summary); |
139 g_free(summary); |
| 140 |
140 |
| 141 gtk_list_store_set(ls, &iter, |
141 gtk_list_store_set(ls, &iter, |
| 142 0, gaim_plugin_is_loaded(plug), |
142 0, purple_plugin_is_loaded(plug), |
| 143 1, desc, |
143 1, desc, |
| 144 2, plug, |
144 2, plug, |
| 145 3, gaim_plugin_is_unloadable(plug), |
145 3, purple_plugin_is_unloadable(plug), |
| 146 -1); |
146 -1); |
| 147 g_free(desc); |
147 g_free(desc); |
| 148 } |
148 } |
| 149 } |
149 } |
| 150 |
150 |
| 151 static void plugin_loading_common(GaimPlugin *plugin, GtkTreeView *view, gboolean loaded) |
151 static void plugin_loading_common(PurplePlugin *plugin, GtkTreeView *view, gboolean loaded) |
| 152 { |
152 { |
| 153 GtkTreeIter iter; |
153 GtkTreeIter iter; |
| 154 GtkTreeModel *model = gtk_tree_view_get_model(view); |
154 GtkTreeModel *model = gtk_tree_view_get_model(view); |
| 155 |
155 |
| 156 if (gtk_tree_model_get_iter_first(model, &iter)) { |
156 if (gtk_tree_model_get_iter_first(model, &iter)) { |
| 157 do { |
157 do { |
| 158 GaimPlugin *plug; |
158 PurplePlugin *plug; |
| 159 GtkTreeSelection *sel; |
159 GtkTreeSelection *sel; |
| 160 |
160 |
| 161 gtk_tree_model_get(model, &iter, 2, &plug, -1); |
161 gtk_tree_model_get(model, &iter, 2, &plug, -1); |
| 162 |
162 |
| 163 if (plug != plugin) |
163 if (plug != plugin) |
| 185 break; |
185 break; |
| 186 } while (gtk_tree_model_iter_next(model, &iter)); |
186 } while (gtk_tree_model_iter_next(model, &iter)); |
| 187 } |
187 } |
| 188 } |
188 } |
| 189 |
189 |
| 190 static void plugin_load_cb(GaimPlugin *plugin, gpointer data) |
190 static void plugin_load_cb(PurplePlugin *plugin, gpointer data) |
| 191 { |
191 { |
| 192 GtkTreeView *view = (GtkTreeView *)data; |
192 GtkTreeView *view = (GtkTreeView *)data; |
| 193 plugin_loading_common(plugin, view, TRUE); |
193 plugin_loading_common(plugin, view, TRUE); |
| 194 } |
194 } |
| 195 |
195 |
| 196 static void plugin_unload_cb(GaimPlugin *plugin, gpointer data) |
196 static void plugin_unload_cb(PurplePlugin *plugin, gpointer data) |
| 197 { |
197 { |
| 198 GtkTreeView *view = (GtkTreeView *)data; |
198 GtkTreeView *view = (GtkTreeView *)data; |
| 199 plugin_loading_common(plugin, view, FALSE); |
199 plugin_loading_common(plugin, view, FALSE); |
| 200 } |
200 } |
| 201 |
201 |
| 202 static void pref_dialog_response_cb(GtkWidget *d, int response, GaimPlugin *plug) |
202 static void pref_dialog_response_cb(GtkWidget *d, int response, PurplePlugin *plug) |
| 203 { |
203 { |
| 204 switch (response) { |
204 switch (response) { |
| 205 case GTK_RESPONSE_CLOSE: |
205 case GTK_RESPONSE_CLOSE: |
| 206 case GTK_RESPONSE_DELETE_EVENT: |
206 case GTK_RESPONSE_DELETE_EVENT: |
| 207 g_hash_table_remove(plugin_pref_dialogs, plug); |
207 g_hash_table_remove(plugin_pref_dialogs, plug); |
| 214 } |
214 } |
| 215 } |
215 } |
| 216 |
216 |
| 217 static void plugin_unload_confirm_cb(gpointer *data) |
217 static void plugin_unload_confirm_cb(gpointer *data) |
| 218 { |
218 { |
| 219 GaimPlugin *plugin = (GaimPlugin *)data[0]; |
219 PurplePlugin *plugin = (PurplePlugin *)data[0]; |
| 220 GtkTreeModel *model = (GtkTreeModel *)data[1]; |
220 GtkTreeModel *model = (GtkTreeModel *)data[1]; |
| 221 GtkTreeIter *iter = (GtkTreeIter *)data[2]; |
221 GtkTreeIter *iter = (GtkTreeIter *)data[2]; |
| 222 |
222 |
| 223 plugin_toggled_stage_two(plugin, model, iter, TRUE); |
223 plugin_toggled_stage_two(plugin, model, iter, TRUE); |
| 224 |
224 |
| 228 static void plugin_toggled(GtkCellRendererToggle *cell, gchar *pth, gpointer data) |
228 static void plugin_toggled(GtkCellRendererToggle *cell, gchar *pth, gpointer data) |
| 229 { |
229 { |
| 230 GtkTreeModel *model = (GtkTreeModel *)data; |
230 GtkTreeModel *model = (GtkTreeModel *)data; |
| 231 GtkTreeIter *iter = g_new(GtkTreeIter, 1); |
231 GtkTreeIter *iter = g_new(GtkTreeIter, 1); |
| 232 GtkTreePath *path = gtk_tree_path_new_from_string(pth); |
232 GtkTreePath *path = gtk_tree_path_new_from_string(pth); |
| 233 GaimPlugin *plug; |
233 PurplePlugin *plug; |
| 234 GtkWidget *dialog = NULL; |
234 GtkWidget *dialog = NULL; |
| 235 |
235 |
| 236 gtk_tree_model_get_iter(model, iter, path); |
236 gtk_tree_model_get_iter(model, iter, path); |
| 237 gtk_tree_path_free(path); |
237 gtk_tree_path_free(path); |
| 238 gtk_tree_model_get(model, iter, 2, &plug, -1); |
238 gtk_tree_model_get(model, iter, 2, &plug, -1); |
| 239 |
239 |
| 240 /* Apparently, GTK+ won't honor the sensitive flag on cell renderers for booleans. */ |
240 /* Apparently, GTK+ won't honor the sensitive flag on cell renderers for booleans. */ |
| 241 if (gaim_plugin_is_unloadable(plug)) |
241 if (purple_plugin_is_unloadable(plug)) |
| 242 { |
242 { |
| 243 g_free(iter); |
243 g_free(iter); |
| 244 return; |
244 return; |
| 245 } |
245 } |
| 246 |
246 |
| 247 if (!gaim_plugin_is_loaded(plug)) |
247 if (!purple_plugin_is_loaded(plug)) |
| 248 { |
248 { |
| 249 pidgin_set_cursor(plugin_dialog, GDK_WATCH); |
249 pidgin_set_cursor(plugin_dialog, GDK_WATCH); |
| 250 |
250 |
| 251 gaim_plugin_load(plug); |
251 purple_plugin_load(plug); |
| 252 plugin_toggled_stage_two(plug, model, iter, FALSE); |
252 plugin_toggled_stage_two(plug, model, iter, FALSE); |
| 253 |
253 |
| 254 pidgin_clear_cursor(plugin_dialog); |
254 pidgin_clear_cursor(plugin_dialog); |
| 255 } |
255 } |
| 256 else |
256 else |
| 266 gpointer *cb_data; |
266 gpointer *cb_data; |
| 267 |
267 |
| 268 for (l = plug->dependent_plugins ; l != NULL ; l = l->next) |
268 for (l = plug->dependent_plugins ; l != NULL ; l = l->next) |
| 269 { |
269 { |
| 270 const char *dep_name = (const char *)l->data; |
270 const char *dep_name = (const char *)l->data; |
| 271 GaimPlugin *dep_plugin = gaim_plugins_find_with_id(dep_name); |
271 PurplePlugin *dep_plugin = purple_plugins_find_with_id(dep_name); |
| 272 g_return_if_fail(dep_plugin != NULL); |
272 g_return_if_fail(dep_plugin != NULL); |
| 273 |
273 |
| 274 g_string_append_printf(tmp, "\n\t%s\n", _(dep_plugin->info->name)); |
274 g_string_append_printf(tmp, "\n\t%s\n", _(dep_plugin->info->name)); |
| 275 } |
275 } |
| 276 |
276 |
| 277 cb_data = g_new(gpointer, 3); |
277 cb_data = g_new(gpointer, 3); |
| 278 cb_data[0] = plug; |
278 cb_data[0] = plug; |
| 279 cb_data[1] = model; |
279 cb_data[1] = model; |
| 280 cb_data[2] = iter; |
280 cb_data[2] = iter; |
| 281 |
281 |
| 282 gaim_request_action(plugin_dialog, NULL, |
282 purple_request_action(plugin_dialog, NULL, |
| 283 _("Multiple plugins will be unloaded."), |
283 _("Multiple plugins will be unloaded."), |
| 284 tmp->str, 0, cb_data, 2, |
284 tmp->str, 0, cb_data, 2, |
| 285 _("Unload Plugins"), G_CALLBACK(plugin_unload_confirm_cb), |
285 _("Unload Plugins"), G_CALLBACK(plugin_unload_confirm_cb), |
| 286 _("Cancel"), g_free); |
286 _("Cancel"), g_free); |
| 287 g_string_free(tmp, TRUE); |
287 g_string_free(tmp, TRUE); |
| 289 else |
289 else |
| 290 plugin_toggled_stage_two(plug, model, iter, TRUE); |
290 plugin_toggled_stage_two(plug, model, iter, TRUE); |
| 291 } |
291 } |
| 292 } |
292 } |
| 293 |
293 |
| 294 static void plugin_toggled_stage_two(GaimPlugin *plug, GtkTreeModel *model, GtkTreeIter *iter, gboolean unload) |
294 static void plugin_toggled_stage_two(PurplePlugin *plug, GtkTreeModel *model, GtkTreeIter *iter, gboolean unload) |
| 295 { |
295 { |
| 296 gchar *name = NULL; |
296 gchar *name = NULL; |
| 297 gchar *description = NULL; |
297 gchar *description = NULL; |
| 298 |
298 |
| 299 if (unload) |
299 if (unload) |
| 300 { |
300 { |
| 301 pidgin_set_cursor(plugin_dialog, GDK_WATCH); |
301 pidgin_set_cursor(plugin_dialog, GDK_WATCH); |
| 302 |
302 |
| 303 gaim_plugin_unload(plug); |
303 purple_plugin_unload(plug); |
| 304 |
304 |
| 305 pidgin_clear_cursor(plugin_dialog); |
305 pidgin_clear_cursor(plugin_dialog); |
| 306 } |
306 } |
| 307 |
307 |
| 308 gtk_widget_set_sensitive(pref_button, |
308 gtk_widget_set_sensitive(pref_button, |
| 309 gaim_plugin_is_loaded(plug) |
309 purple_plugin_is_loaded(plug) |
| 310 && ((PIDGIN_IS_PIDGIN_PLUGIN(plug) && plug->info->ui_info |
310 && ((PIDGIN_IS_PIDGIN_PLUGIN(plug) && plug->info->ui_info |
| 311 && PIDGIN_PLUGIN_UI_INFO(plug)->get_config_frame) |
311 && PIDGIN_PLUGIN_UI_INFO(plug)->get_config_frame) |
| 312 || (plug->info->prefs_info |
312 || (plug->info->prefs_info |
| 313 && plug->info->prefs_info->get_plugin_pref_frame))); |
313 && plug->info->prefs_info->get_plugin_pref_frame))); |
| 314 |
314 |
| 363 static void prefs_plugin_sel (GtkTreeSelection *sel, GtkTreeModel *model) |
363 static void prefs_plugin_sel (GtkTreeSelection *sel, GtkTreeModel *model) |
| 364 { |
364 { |
| 365 gchar *buf, *pname, *pdesc, *pauth, *pweb; |
365 gchar *buf, *pname, *pdesc, *pauth, *pweb; |
| 366 GtkTreeIter iter; |
366 GtkTreeIter iter; |
| 367 GValue val; |
367 GValue val; |
| 368 GaimPlugin *plug; |
368 PurplePlugin *plug; |
| 369 |
369 |
| 370 if (!gtk_tree_selection_get_selected (sel, &model, &iter)) |
370 if (!gtk_tree_selection_get_selected (sel, &model, &iter)) |
| 371 { |
371 { |
| 372 /* Clear the old plugin details */ |
372 /* Clear the old plugin details */ |
| 373 gtk_label_set_markup(GTK_LABEL(plugin_details), ""); |
373 gtk_label_set_markup(GTK_LABEL(plugin_details), ""); |
| 413 g_free(buf); |
413 g_free(buf); |
| 414 buf = tmp; |
414 buf = tmp; |
| 415 } |
415 } |
| 416 |
416 |
| 417 gtk_widget_set_sensitive(pref_button, |
417 gtk_widget_set_sensitive(pref_button, |
| 418 gaim_plugin_is_loaded(plug) |
418 purple_plugin_is_loaded(plug) |
| 419 && ((PIDGIN_IS_PIDGIN_PLUGIN(plug) && plug->info->ui_info |
419 && ((PIDGIN_IS_PIDGIN_PLUGIN(plug) && plug->info->ui_info |
| 420 && PIDGIN_PLUGIN_UI_INFO(plug)->get_config_frame) |
420 && PIDGIN_PLUGIN_UI_INFO(plug)->get_config_frame) |
| 421 || (plug->info->prefs_info |
421 || (plug->info->prefs_info |
| 422 && plug->info->prefs_info->get_plugin_pref_frame))); |
422 && plug->info->prefs_info->get_plugin_pref_frame))); |
| 423 |
423 |
| 435 g_free(pweb); |
435 g_free(pweb); |
| 436 } |
436 } |
| 437 |
437 |
| 438 static void plugin_dialog_response_cb(GtkWidget *d, int response, GtkTreeSelection *sel) |
438 static void plugin_dialog_response_cb(GtkWidget *d, int response, GtkTreeSelection *sel) |
| 439 { |
439 { |
| 440 GaimPlugin *plug; |
440 PurplePlugin *plug; |
| 441 GtkWidget *dialog, *box; |
441 GtkWidget *dialog, *box; |
| 442 GtkTreeModel *model; |
442 GtkTreeModel *model; |
| 443 GValue val; |
443 GValue val; |
| 444 GtkTreeIter iter; |
444 GtkTreeIter iter; |
| 445 |
445 |
| 446 switch (response) { |
446 switch (response) { |
| 447 case GTK_RESPONSE_CLOSE: |
447 case GTK_RESPONSE_CLOSE: |
| 448 case GTK_RESPONSE_DELETE_EVENT: |
448 case GTK_RESPONSE_DELETE_EVENT: |
| 449 gaim_request_close_with_handle(plugin_dialog); |
449 purple_request_close_with_handle(plugin_dialog); |
| 450 gaim_signals_disconnect_by_handle(plugin_dialog); |
450 purple_signals_disconnect_by_handle(plugin_dialog); |
| 451 gtk_widget_destroy(d); |
451 gtk_widget_destroy(d); |
| 452 if (plugin_pref_dialogs != NULL) { |
452 if (plugin_pref_dialogs != NULL) { |
| 453 g_hash_table_destroy(plugin_pref_dialogs); |
453 g_hash_table_destroy(plugin_pref_dialogs); |
| 454 plugin_pref_dialogs = NULL; |
454 plugin_pref_dialogs = NULL; |
| 455 } |
455 } |
| 480 g_hash_table_insert(plugin_pref_dialogs, plug, dialog); |
480 g_hash_table_insert(plugin_pref_dialogs, plug, dialog); |
| 481 |
481 |
| 482 g_signal_connect(G_OBJECT(dialog), "response", G_CALLBACK(pref_dialog_response_cb), plug); |
482 g_signal_connect(G_OBJECT(dialog), "response", G_CALLBACK(pref_dialog_response_cb), plug); |
| 483 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), box); |
483 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), box); |
| 484 gtk_window_set_role(GTK_WINDOW(dialog), "plugin_config"); |
484 gtk_window_set_role(GTK_WINDOW(dialog), "plugin_config"); |
| 485 gtk_window_set_title(GTK_WINDOW(dialog), _(gaim_plugin_get_name(plug))); |
485 gtk_window_set_title(GTK_WINDOW(dialog), _(purple_plugin_get_name(plug))); |
| 486 gtk_widget_show_all(dialog); |
486 gtk_widget_show_all(dialog); |
| 487 g_value_unset(&val); |
487 g_value_unset(&val); |
| 488 break; |
488 break; |
| 489 } |
489 } |
| 490 } |
490 } |
| 492 static void |
492 static void |
| 493 show_plugin_prefs_cb(GtkTreeView *view, GtkTreePath *path, GtkTreeViewColumn *column, GtkWidget *dialog) |
493 show_plugin_prefs_cb(GtkTreeView *view, GtkTreePath *path, GtkTreeViewColumn *column, GtkWidget *dialog) |
| 494 { |
494 { |
| 495 GtkTreeSelection *sel; |
495 GtkTreeSelection *sel; |
| 496 GtkTreeIter iter; |
496 GtkTreeIter iter; |
| 497 GaimPlugin *plugin; |
497 PurplePlugin *plugin; |
| 498 GtkTreeModel *model; |
498 GtkTreeModel *model; |
| 499 |
499 |
| 500 sel = gtk_tree_view_get_selection(view); |
500 sel = gtk_tree_view_get_selection(view); |
| 501 |
501 |
| 502 if (!gtk_tree_selection_get_selected(sel, &model, &iter)) |
502 if (!gtk_tree_selection_get_selected(sel, &model, &iter)) |
| 503 return; |
503 return; |
| 504 |
504 |
| 505 gtk_tree_model_get(model, &iter, 2, &plugin, -1); |
505 gtk_tree_model_get(model, &iter, 2, &plugin, -1); |
| 506 |
506 |
| 507 if (!gaim_plugin_is_loaded(plugin)) |
507 if (!purple_plugin_is_loaded(plugin)) |
| 508 return; |
508 return; |
| 509 |
509 |
| 510 /* Now show the pref-dialog for the plugin */ |
510 /* Now show the pref-dialog for the plugin */ |
| 511 plugin_dialog_response_cb(dialog, PIDGIN_RESPONSE_CONFIGURE, sel); |
511 plugin_dialog_response_cb(dialog, PIDGIN_RESPONSE_CONFIGURE, sel); |
| 512 } |
512 } |
| 553 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(event_view), TRUE); |
553 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(event_view), TRUE); |
| 554 |
554 |
| 555 g_signal_connect(G_OBJECT(event_view), "row-activated", |
555 g_signal_connect(G_OBJECT(event_view), "row-activated", |
| 556 G_CALLBACK(show_plugin_prefs_cb), plugin_dialog); |
556 G_CALLBACK(show_plugin_prefs_cb), plugin_dialog); |
| 557 |
557 |
| 558 gaim_signal_connect(gaim_plugins_get_handle(), "plugin-load", plugin_dialog, |
558 purple_signal_connect(purple_plugins_get_handle(), "plugin-load", plugin_dialog, |
| 559 GAIM_CALLBACK(plugin_load_cb), event_view); |
559 PURPLE_CALLBACK(plugin_load_cb), event_view); |
| 560 gaim_signal_connect(gaim_plugins_get_handle(), "plugin-unload", plugin_dialog, |
560 purple_signal_connect(purple_plugins_get_handle(), "plugin-unload", plugin_dialog, |
| 561 GAIM_CALLBACK(plugin_unload_cb), event_view); |
561 PURPLE_CALLBACK(plugin_unload_cb), event_view); |
| 562 |
562 |
| 563 rend = gtk_cell_renderer_toggle_new(); |
563 rend = gtk_cell_renderer_toggle_new(); |
| 564 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view)); |
564 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view)); |
| 565 |
565 |
| 566 col = gtk_tree_view_column_new_with_attributes (_("Enabled"), |
566 col = gtk_tree_view_column_new_with_attributes (_("Enabled"), |