Mercurial > pidgin
comparison src/plugins.c @ 2056:5028a07250c7
[gaim-migrate @ 2066]
sourceforge seems to be having problems. thanks Mike Heffner.
committer: Tailor Script <tailor@pidgin.im>
| author | Eric Warmenhoven <eric@warmenhoven.org> |
|---|---|
| date | Mon, 18 Jun 2001 01:49:16 +0000 |
| parents | db3104dda736 |
| children | 424a40f12a6c |
comparison
equal
deleted
inserted
replaced
| 2055:94e4580095e0 | 2056:5028a07250c7 |
|---|---|
| 75 | 75 |
| 76 static GtkTooltips *tooltips = NULL; | 76 static GtkTooltips *tooltips = NULL; |
| 77 | 77 |
| 78 static GtkWidget *config = NULL; | 78 static GtkWidget *config = NULL; |
| 79 static guint confighandle = 0; | 79 static guint confighandle = 0; |
| 80 static GtkWidget *reload = NULL; | |
| 81 static GtkWidget *unload = NULL; | |
| 80 static char *last_dir = NULL; | 82 static char *last_dir = NULL; |
| 81 | 83 |
| 82 /* --------------- Function Declarations --------------------- */ | 84 /* --------------- Function Declarations --------------------- */ |
| 83 | 85 |
| 84 void show_plugins(GtkWidget *, gpointer); | 86 void show_plugins(GtkWidget *, gpointer); |
| 97 static void plugin_reload(struct gaim_plugin *p); | 99 static void plugin_reload(struct gaim_plugin *p); |
| 98 | 100 |
| 99 static void destroy_plugins(GtkWidget *, gpointer); | 101 static void destroy_plugins(GtkWidget *, gpointer); |
| 100 static void load_file(GtkWidget *, gpointer); | 102 static void load_file(GtkWidget *, gpointer); |
| 101 static void load_which_plugin(GtkWidget *, gpointer); | 103 static void load_which_plugin(GtkWidget *, gpointer); |
| 102 static void unload(GtkWidget *, gpointer); | 104 static void unload_plugin(GtkWidget *, gpointer); |
| 103 static void unload_immediate(GModule *); | 105 static void unload_immediate(GModule *); |
| 104 static void list_clicked(GtkWidget *, struct gaim_plugin *); | 106 static void list_clicked(GtkWidget *, struct gaim_plugin *); |
| 105 static void update_show_plugins(); | 107 static void update_show_plugins(); |
| 106 static void hide_plugins(GtkWidget *, gpointer); | 108 static void hide_plugins(GtkWidget *, gpointer); |
| 107 | 109 |
| 259 GtkWidget *vbox; | 261 GtkWidget *vbox; |
| 260 GtkWidget *frame; | 262 GtkWidget *frame; |
| 261 GtkWidget *scrolledwindow; | 263 GtkWidget *scrolledwindow; |
| 262 GtkWidget *label; | 264 GtkWidget *label; |
| 263 GtkWidget *add; | 265 GtkWidget *add; |
| 264 GtkWidget *reload; | |
| 265 GtkWidget *remove; | |
| 266 GtkWidget *close; | 266 GtkWidget *close; |
| 267 | 267 |
| 268 if (plugwindow) | 268 if (plugwindow) |
| 269 return; | 269 return; |
| 270 | 270 |
| 359 gtk_widget_set_sensitive(config, FALSE); | 359 gtk_widget_set_sensitive(config, FALSE); |
| 360 gtk_box_pack_start(GTK_BOX(bothbox), config, TRUE, TRUE, 0); | 360 gtk_box_pack_start(GTK_BOX(bothbox), config, TRUE, TRUE, 0); |
| 361 gtk_tooltips_set_tip(tooltips, config, _("Configure settings of the selected plugin"), ""); | 361 gtk_tooltips_set_tip(tooltips, config, _("Configure settings of the selected plugin"), ""); |
| 362 | 362 |
| 363 reload = picture_button(plugwindow, _("Reload"), refresh_xpm); | 363 reload = picture_button(plugwindow, _("Reload"), refresh_xpm); |
| 364 gtk_widget_set_sensitive(reload, FALSE); | |
| 364 gtk_signal_connect(GTK_OBJECT(reload), "clicked", GTK_SIGNAL_FUNC(plugin_reload_cb), NULL); | 365 gtk_signal_connect(GTK_OBJECT(reload), "clicked", GTK_SIGNAL_FUNC(plugin_reload_cb), NULL); |
| 365 gtk_box_pack_start(GTK_BOX(bothbox), reload, TRUE, TRUE, 0); | 366 gtk_box_pack_start(GTK_BOX(bothbox), reload, TRUE, TRUE, 0); |
| 366 gtk_tooltips_set_tip(tooltips, reload, _("Reload the selected plugin"), ""); | 367 gtk_tooltips_set_tip(tooltips, reload, _("Reload the selected plugin"), ""); |
| 367 | 368 |
| 368 remove = picture_button(plugwindow, _("Unload"), gnome_remove_xpm); | 369 unload = picture_button(plugwindow, _("Unload"), gnome_remove_xpm); |
| 369 gtk_signal_connect(GTK_OBJECT(remove), "clicked", GTK_SIGNAL_FUNC(unload), pluglist); | 370 gtk_signal_connect(GTK_OBJECT(unload), "clicked", GTK_SIGNAL_FUNC(unload_plugin), pluglist); |
| 370 gtk_box_pack_start(GTK_BOX(bothbox), remove, TRUE, TRUE, 0); | 371 gtk_box_pack_start(GTK_BOX(bothbox), unload, TRUE, TRUE, 0); |
| 371 gtk_tooltips_set_tip(tooltips, remove, _("Unload the selected plugin"), ""); | 372 gtk_tooltips_set_tip(tooltips, unload, _("Unload the selected plugin"), ""); |
| 372 | 373 |
| 373 close = picture_button(plugwindow, _("Close"), cancel_xpm); | 374 close = picture_button(plugwindow, _("Close"), cancel_xpm); |
| 374 gtk_signal_connect(GTK_OBJECT(close), "clicked", GTK_SIGNAL_FUNC(hide_plugins), NULL); | 375 gtk_signal_connect(GTK_OBJECT(close), "clicked", GTK_SIGNAL_FUNC(hide_plugins), NULL); |
| 375 gtk_box_pack_start(GTK_BOX(bothbox), close, TRUE, TRUE, 0); | 376 gtk_box_pack_start(GTK_BOX(bothbox), close, TRUE, TRUE, 0); |
| 376 gtk_tooltips_set_tip(tooltips, close, _("Close this window"), ""); | 377 gtk_tooltips_set_tip(tooltips, close, _("Close this window"), ""); |
| 377 | 378 |
| 378 update_show_plugins(); | 379 update_show_plugins(); |
| 379 gtk_widget_show(plugwindow); | 380 gtk_widget_show(plugwindow); |
| 380 } | 381 } |
| 381 | 382 |
| 382 void update_show_plugins() | 383 static void update_show_plugins() |
| 383 { | 384 { |
| 384 GList *plugs = plugins; | 385 GList *plugs = plugins; |
| 385 struct gaim_plugin *p; | 386 struct gaim_plugin *p; |
| 386 GtkWidget *label; | 387 GtkWidget *label; |
| 387 GtkWidget *list_item; | 388 GtkWidget *list_item; |
| 407 gtk_container_add(GTK_CONTAINER(pluglist), list_item); | 408 gtk_container_add(GTK_CONTAINER(pluglist), list_item); |
| 408 gtk_widget_show(list_item); | 409 gtk_widget_show(list_item); |
| 409 | 410 |
| 410 plugs = g_list_next(plugs); | 411 plugs = g_list_next(plugs); |
| 411 } | 412 } |
| 412 } | 413 |
| 413 | 414 /* Clear the display if nothing's selected */ |
| 414 void unload(GtkWidget *w, gpointer data) | 415 if (GTK_LIST(pluglist)->selection == NULL) { |
| 416 guint text_len = gtk_text_get_length(GTK_TEXT(plugtext)); | |
| 417 gtk_text_set_point(GTK_TEXT(plugtext), 0); | |
| 418 gtk_text_forward_delete(GTK_TEXT(plugtext), text_len); | |
| 419 gtk_entry_set_text(GTK_ENTRY(plugentry), ""); | |
| 420 | |
| 421 gtk_widget_set_sensitive(config, FALSE); | |
| 422 gtk_widget_set_sensitive(reload, FALSE); | |
| 423 gtk_widget_set_sensitive(unload, FALSE); | |
| 424 } | |
| 425 } | |
| 426 | |
| 427 static void unload_plugin(GtkWidget *w, gpointer data) | |
| 415 { | 428 { |
| 416 GList *i; | 429 GList *i; |
| 417 struct gaim_plugin *p; | 430 struct gaim_plugin *p; |
| 418 void (*gaim_plugin_remove)(); | 431 void (*gaim_plugin_remove)(); |
| 419 | 432 |
| 457 g_free(p); | 470 g_free(p); |
| 458 update_show_plugins(); | 471 update_show_plugins(); |
| 459 save_prefs(); | 472 save_prefs(); |
| 460 } | 473 } |
| 461 | 474 |
| 462 void unload_immediate(GModule *handle) | 475 static void unload_immediate(GModule *handle) |
| 463 { | 476 { |
| 464 unload_for_real(handle); | 477 unload_for_real(handle); |
| 465 g_module_close(handle); | 478 g_module_close(handle); |
| 466 } | 479 } |
| 467 | 480 |
| 521 } | 534 } |
| 522 plugs = plugs->next; | 535 plugs = plugs->next; |
| 523 } | 536 } |
| 524 } | 537 } |
| 525 | 538 |
| 526 void list_clicked(GtkWidget *w, struct gaim_plugin *p) | 539 static void list_clicked(GtkWidget *w, struct gaim_plugin *p) |
| 527 { | 540 { |
| 528 gchar *temp; | 541 gchar *temp; |
| 529 guint text_len; | 542 guint text_len; |
| 530 void (*gaim_plugin_config)(); | 543 void (*gaim_plugin_config)(); |
| 531 | 544 |
| 550 gtk_widget_set_sensitive(config, TRUE); | 563 gtk_widget_set_sensitive(config, TRUE); |
| 551 } else { | 564 } else { |
| 552 confighandle = 0; | 565 confighandle = 0; |
| 553 gtk_widget_set_sensitive(config, FALSE); | 566 gtk_widget_set_sensitive(config, FALSE); |
| 554 } | 567 } |
| 555 } | 568 |
| 556 | 569 gtk_widget_set_sensitive(reload, TRUE); |
| 557 void hide_plugins(GtkWidget *w, gpointer data) | 570 gtk_widget_set_sensitive(unload, TRUE); |
| 571 } | |
| 572 | |
| 573 static void hide_plugins(GtkWidget *w, gpointer data) | |
| 558 { | 574 { |
| 559 if (plugwindow) | 575 if (plugwindow) |
| 560 gtk_widget_destroy(plugwindow); | 576 gtk_widget_destroy(plugwindow); |
| 561 plugwindow = NULL; | 577 plugwindow = NULL; |
| 562 config = NULL; | 578 config = NULL; |
