Mercurial > pidgin.yaz
comparison src/gtkplugin.c @ 12246:b7a51e68d0b8
[gaim-migrate @ 14548]
Make some things static and namespace session_init and session_end
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 28 Nov 2005 06:20:06 +0000 |
parents | 1c0fd404e07e |
children | b3652193d359 |
comparison
equal
deleted
inserted
replaced
12245:465ddcb3e9e8 | 12246:b7a51e68d0b8 |
---|---|
29 #include "debug.h" | 29 #include "debug.h" |
30 #include "prefs.h" | 30 #include "prefs.h" |
31 | 31 |
32 #include <string.h> | 32 #include <string.h> |
33 | 33 |
34 #define GAIM_RESPONSE_CONFIGURE 98121 | |
35 | |
34 static GtkWidget *plugin_dialog = NULL; | 36 static GtkWidget *plugin_dialog = NULL; |
35 static GtkWidget *plugin_details = NULL; | 37 static GtkWidget *plugin_details = NULL; |
36 static GtkWidget *pref_button = NULL; | 38 static GtkWidget *pref_button = NULL; |
37 static GHashTable *plugin_pref_dialogs = NULL; | 39 static GHashTable *plugin_pref_dialogs = NULL; |
38 | 40 |
204 } | 206 } |
205 g_free(name); | 207 g_free(name); |
206 g_free(description); | 208 g_free(description); |
207 | 209 |
208 | 210 |
209 gtk_list_store_set (GTK_LIST_STORE (model), &iter, | 211 gtk_list_store_set (GTK_LIST_STORE (model), &iter, |
210 0, gaim_plugin_is_loaded(plug), | 212 0, gaim_plugin_is_loaded(plug), |
211 -1); | 213 -1); |
212 | 214 |
213 gtk_tree_path_free(path); | 215 gtk_tree_path_free(path); |
214 gaim_gtk_plugins_save(); | 216 gaim_gtk_plugins_save(); |
215 } | 217 } |
216 | 218 |
217 static gboolean ensure_plugin_visible(void *data) | 219 static gboolean ensure_plugin_visible(void *data) |
218 { | 220 { |
219 GtkTreeSelection *sel = GTK_TREE_SELECTION(data); | 221 GtkTreeSelection *sel = GTK_TREE_SELECTION(data); |
220 GtkTreeView *tv = gtk_tree_selection_get_tree_view(sel); | 222 GtkTreeView *tv = gtk_tree_selection_get_tree_view(sel); |
221 GtkTreeModel *model = gtk_tree_view_get_model(tv); | 223 GtkTreeModel *model = gtk_tree_view_get_model(tv); |
222 GtkTreePath *path; | 224 GtkTreePath *path; |
223 GtkTreeIter iter; | 225 GtkTreeIter iter; |
224 if (!gtk_tree_selection_get_selected (sel, &model, &iter)) | 226 if (!gtk_tree_selection_get_selected (sel, &model, &iter)) |
225 return FALSE; | 227 return FALSE; |
299 g_hash_table_destroy(plugin_pref_dialogs); | 301 g_hash_table_destroy(plugin_pref_dialogs); |
300 plugin_pref_dialogs = NULL; | 302 plugin_pref_dialogs = NULL; |
301 } | 303 } |
302 plugin_dialog = NULL; | 304 plugin_dialog = NULL; |
303 break; | 305 break; |
304 case 98121: | 306 case GAIM_RESPONSE_CONFIGURE: |
305 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) | 307 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) |
306 return; | 308 return; |
307 gtk_tree_model_get_value (model, &iter, 2, &val); | 309 gtk_tree_model_get_value (model, &iter, 2, &val); |
308 plug = g_value_get_pointer(&val); | 310 plug = g_value_get_pointer(&val); |
309 if (plug == NULL) | 311 if (plug == NULL) |
344 | 346 |
345 sel = gtk_tree_view_get_selection(view); | 347 sel = gtk_tree_view_get_selection(view); |
346 | 348 |
347 if (!gtk_tree_selection_get_selected(sel, &model, &iter)) | 349 if (!gtk_tree_selection_get_selected(sel, &model, &iter)) |
348 return; | 350 return; |
349 | 351 |
350 gtk_tree_model_get(model, &iter, 2, &plugin, -1); | 352 gtk_tree_model_get(model, &iter, 2, &plugin, -1); |
351 | 353 |
352 if (!gaim_plugin_is_loaded(plugin)) | 354 if (!gaim_plugin_is_loaded(plugin)) |
353 return; | 355 return; |
354 | 356 |
355 /* Now show the pref-dialog for the plugin */ | 357 /* Now show the pref-dialog for the plugin */ |
356 plugin_dialog_response_cb(NULL, 98121, sel); | 358 plugin_dialog_response_cb(NULL, GAIM_RESPONSE_CONFIGURE, sel); |
357 } | 359 } |
358 | 360 |
359 void gaim_gtk_plugin_dialog_show() | 361 void gaim_gtk_plugin_dialog_show() |
360 { | 362 { |
361 GtkWidget *sw; | 363 GtkWidget *sw; |
373 | 375 |
374 plugin_dialog = gtk_dialog_new_with_buttons(_("Plugins"), | 376 plugin_dialog = gtk_dialog_new_with_buttons(_("Plugins"), |
375 NULL, | 377 NULL, |
376 GTK_DIALOG_NO_SEPARATOR, | 378 GTK_DIALOG_NO_SEPARATOR, |
377 NULL); | 379 NULL); |
378 pref_button = gtk_dialog_add_button(GTK_DIALOG(plugin_dialog), GTK_STOCK_PREFERENCES, 98121); | 380 pref_button = gtk_dialog_add_button(GTK_DIALOG(plugin_dialog), |
379 gtk_dialog_add_button(GTK_DIALOG(plugin_dialog), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE); | 381 _("_Configure Plugin"), GAIM_RESPONSE_CONFIGURE); |
382 gtk_dialog_add_button(GTK_DIALOG(plugin_dialog), | |
383 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE); | |
380 gtk_widget_set_sensitive(pref_button, FALSE); | 384 gtk_widget_set_sensitive(pref_button, FALSE); |
381 gtk_window_set_role(GTK_WINDOW(plugin_dialog), "plugins"); | 385 gtk_window_set_role(GTK_WINDOW(plugin_dialog), "plugins"); |
382 | 386 |
383 sw = gtk_scrolled_window_new(NULL,NULL); | 387 sw = gtk_scrolled_window_new(NULL,NULL); |
384 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); | 388 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
406 NULL); | 410 NULL); |
407 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | 411 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); |
408 gtk_tree_view_column_set_sort_column_id(col, 0); | 412 gtk_tree_view_column_set_sort_column_id(col, 0); |
409 g_signal_connect (G_OBJECT(rend), "toggled", | 413 g_signal_connect (G_OBJECT(rend), "toggled", |
410 G_CALLBACK(plugin_load), ls); | 414 G_CALLBACK(plugin_load), ls); |
411 | 415 |
412 rendt = gtk_cell_renderer_text_new(); | 416 rendt = gtk_cell_renderer_text_new(); |
413 col = gtk_tree_view_column_new_with_attributes (_("Name"), | 417 col = gtk_tree_view_column_new_with_attributes (_("Name"), |
414 rendt, | 418 rendt, |
415 "markup", 1, | 419 "markup", 1, |
416 NULL); | 420 NULL); |
420 #endif | 424 #endif |
421 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | 425 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); |
422 gtk_tree_view_column_set_sort_column_id(col, 1); | 426 gtk_tree_view_column_set_sort_column_id(col, 1); |
423 g_object_unref(G_OBJECT(ls)); | 427 g_object_unref(G_OBJECT(ls)); |
424 gtk_container_add(GTK_CONTAINER(sw), event_view); | 428 gtk_container_add(GTK_CONTAINER(sw), event_view); |
425 | 429 |
426 expander = gtk_expander_new(_("<b>Plugin Details</b>")); | 430 expander = gtk_expander_new(_("<b>Plugin Details</b>")); |
427 gtk_expander_set_use_markup(GTK_EXPANDER(expander), TRUE); | 431 gtk_expander_set_use_markup(GTK_EXPANDER(expander), TRUE); |
428 plugin_details = gtk_label_new(NULL); | 432 plugin_details = gtk_label_new(NULL); |
429 gtk_label_set_line_wrap(GTK_LABEL(plugin_details), TRUE); | 433 gtk_label_set_line_wrap(GTK_LABEL(plugin_details), TRUE); |
430 gtk_container_add(GTK_CONTAINER(expander), plugin_details); | 434 gtk_container_add(GTK_CONTAINER(expander), plugin_details); |