comparison src/prefs.c @ 3565:154c4a9d9b6d

[gaim-migrate @ 3660] Now you can configure your plugins. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Sat, 28 Sep 2002 21:39:45 +0000
parents e120097bbd72
children ec86e76d0427
comparison
equal deleted inserted replaced
3564:83a54877f1ae 3565:154c4a9d9b6d
88 static void delete_prefs(GtkWidget *, void *); 88 static void delete_prefs(GtkWidget *, void *);
89 void set_default_away(GtkWidget *, gpointer); 89 void set_default_away(GtkWidget *, gpointer);
90 static void apply_prefs(); 90 static void apply_prefs();
91 91
92 struct debug_window *dw = NULL; 92 struct debug_window *dw = NULL;
93 static GtkWidget *prefs = NULL; 93 GtkWidget *prefs = NULL;
94 GtkWidget *debugbutton = NULL; 94 GtkWidget *debugbutton = NULL;
95 static int notebook_page = 0;
96 static GtkTreeIter plugin_iter;
95 97
96 void delete_prefs(GtkWidget *asdf, void *gdsa) { 98 void delete_prefs(GtkWidget *asdf, void *gdsa) {
97 int v; 99 int v;
98 100
99 prefs = NULL; 101 prefs = NULL;
105 } 107 }
106 sound_entry = NULL; 108 sound_entry = NULL;
107 browser_entry = NULL; 109 browser_entry = NULL;
108 debugbutton = NULL; 110 debugbutton = NULL;
109 prefs_away_menu = NULL; 111 prefs_away_menu = NULL;
112 notebook_page = 0;
110 if(sounddialog) 113 if(sounddialog)
111 gtk_widget_destroy(sounddialog); 114 gtk_widget_destroy(sounddialog);
112 g_object_unref(G_OBJECT(prefs_away_store)); 115 g_object_unref(G_OBJECT(prefs_away_store));
113 } 116 }
114 117
143 g_snprintf(proxypass, sizeof(proxypass), "%s", gtk_entry_get_text(entry)); 146 g_snprintf(proxypass, sizeof(proxypass), "%s", gtk_entry_get_text(entry));
144 apply_prefs(); 147 apply_prefs();
145 } 148 }
146 149
147 150
148 static GtkWidget *make_frame(GtkWidget *ret, char *text) { 151 GtkWidget *make_frame(GtkWidget *ret, char *text) {
149 GtkWidget *vbox, *label, *hbox; 152 GtkWidget *vbox, *label, *hbox;
150 char labeltext[256]; 153 char labeltext[256];
151 154
152 vbox = gtk_vbox_new(FALSE, 6); 155 vbox = gtk_vbox_new(FALSE, 6);
153 gtk_box_pack_start(GTK_BOX(ret), vbox, FALSE, FALSE, 0); 156 gtk_box_pack_start(GTK_BOX(ret), vbox, FALSE, FALSE, 0);
883 GtkTreeModel *model = (GtkTreeModel *)data; 886 GtkTreeModel *model = (GtkTreeModel *)data;
884 GtkTreeIter iter; 887 GtkTreeIter iter;
885 GtkTreePath *path = gtk_tree_path_new_from_string(pth); 888 GtkTreePath *path = gtk_tree_path_new_from_string(pth);
886 struct gaim_plugin *plug; 889 struct gaim_plugin *plug;
887 gchar buf[1024]; 890 gchar buf[1024];
891 GtkWidget *(*config)();
892
888 GdkCursor *wait = gdk_cursor_new (GDK_WATCH); 893 GdkCursor *wait = gdk_cursor_new (GDK_WATCH);
889 gdk_window_set_cursor(prefs->window, wait); 894 gdk_window_set_cursor(prefs->window, wait);
890 gdk_cursor_unref(wait); 895 gdk_cursor_unref(wait);
891 896
892 gtk_tree_model_get_iter (model, &iter, path); 897 gtk_tree_model_get_iter (model, &iter, path);
894 899
895 if (!plug->handle) 900 if (!plug->handle)
896 901
897 if (plug->type == plugin) 902 if (plug->type == plugin)
898 #ifdef GAIM_PLUGINS 903 #ifdef GAIM_PLUGINS
899 load_plugin(plug->path); 904 {
905 load_plugin(plug->path);
906 if (g_module_symbol(plug->handle, "gaim_plugin_config_gtk", (gpointer *)&config)) {
907 plug->iter = g_new0(GtkTreeIter, 1);
908 prefs_notebook_add_page(plug->desc.name, NULL, config(), plug->iter, &plugin_iter, notebook_page++);
909 }
910 }
900 #else 911 #else
901 {} 912 {}
902 #endif 913 #endif
903 else 914 else
904 #ifdef USE_PERL 915 #ifdef USE_PERL
907 {} 918 {}
908 #endif 919 #endif
909 else 920 else
910 if (plug->type == plugin) 921 if (plug->type == plugin)
911 #ifdef GAIM_PLUGINS 922 #ifdef GAIM_PLUGINS
912 unload_plugin(plug); 923 {
924 unload_plugin(plug);
925 if (plug->iter) {
926 gtk_tree_store_remove(GTK_TREE_STORE(prefstree), plug->iter);
927 g_free(plug->iter);
928 plug->iter = NULL;
929 }
930 }
913 #else 931 #else
914 {} 932 {}
915 #endif 933 #endif
916 else 934 else
917 #ifdef USE_PERL 935 #ifdef USE_PERL
1416 gtk_notebook_append_page(GTK_NOTEBOOK(prefsnotebook), page, gtk_label_new(text)); 1434 gtk_notebook_append_page(GTK_NOTEBOOK(prefsnotebook), page, gtk_label_new(text));
1417 return iter; 1435 return iter;
1418 } 1436 }
1419 1437
1420 void prefs_notebook_init() { 1438 void prefs_notebook_init() {
1421 int a = 0;
1422 GtkTreeIter p, c; 1439 GtkTreeIter p, c;
1423 prefs_notebook_add_page(_("Interface"), NULL, interface_page(), &p, NULL, a++);
1424 prefs_notebook_add_page(_("Fonts"), NULL, font_page(), &c, &p, a++);
1425 prefs_notebook_add_page(_("Message Text"), NULL, messages_page(), &c, &p, a++);
1426 prefs_notebook_add_page(_("Shortcuts"), NULL, hotkeys_page(), &c, &p, a++);
1427 prefs_notebook_add_page(_("Buddy List"), NULL, list_page(), &c, &p, a++);
1428 prefs_notebook_add_page(_("IM Window"), NULL, im_page(), &c, &p, a++);
1429 prefs_notebook_add_page(_("Chat Window"), NULL, chat_page(), &c, &p, a++);
1430 prefs_notebook_add_page(_("Tabs"), NULL, tab_page(), &c, &p, a++);
1431 prefs_notebook_add_page(_("Proxy"), NULL, proxy_page(), &p, NULL, a++);
1432 prefs_notebook_add_page(_("Browser"), NULL, browser_page(), &p, NULL, a++);
1433
1434 prefs_notebook_add_page(_("Logging"), NULL, logging_page(), &p, NULL, a++);
1435 prefs_notebook_add_page(_("Sounds"), NULL, sound_page(), &p, NULL, a++);
1436 prefs_notebook_add_page(_("Sound Events"), NULL, sound_events_page(), &c, &p, a++);
1437 prefs_notebook_add_page(_("Away / Idle"), NULL, away_page(), &p, NULL, a++);
1438 prefs_notebook_add_page(_("Away Messages"), NULL, away_message_page(), &c, &p, a++);
1439 #if USE_PLUGINS 1440 #if USE_PLUGINS
1440 prefs_notebook_add_page(_("Plugins"), NULL, plugin_page(), &p, NULL, a++); 1441 GtkWidget *(*config)();
1442 GList *l = plugins;
1443 struct gaim_plugin *plug;
1444 #endif
1445 prefs_notebook_add_page(_("Interface"), NULL, interface_page(), &p, NULL, notebook_page++);
1446 prefs_notebook_add_page(_("Fonts"), NULL, font_page(), &c, &p, notebook_page++);
1447 prefs_notebook_add_page(_("Message Text"), NULL, messages_page(), &c, &p, notebook_page++);
1448 prefs_notebook_add_page(_("Shortcuts"), NULL, hotkeys_page(), &c, &p, notebook_page++);
1449 prefs_notebook_add_page(_("Buddy List"), NULL, list_page(), &c, &p, notebook_page++);
1450 prefs_notebook_add_page(_("IM Window"), NULL, im_page(), &c, &p, notebook_page++);
1451 prefs_notebook_add_page(_("Chat Window"), NULL, chat_page(), &c, &p, notebook_page++);
1452 prefs_notebook_add_page(_("Tabs"), NULL, tab_page(), &c, &p, notebook_page++);
1453 prefs_notebook_add_page(_("Proxy"), NULL, proxy_page(), &p, NULL, notebook_page++);
1454 prefs_notebook_add_page(_("Browser"), NULL, browser_page(), &p, NULL, notebook_page++);
1455
1456 prefs_notebook_add_page(_("Logging"), NULL, logging_page(), &p, NULL, notebook_page++);
1457 prefs_notebook_add_page(_("Sounds"), NULL, sound_page(), &p, NULL, notebook_page++);
1458 prefs_notebook_add_page(_("Sound Events"), NULL, sound_events_page(), &c, &p, notebook_page++);
1459 prefs_notebook_add_page(_("Away / Idle"), NULL, away_page(), &p, NULL, notebook_page++);
1460 prefs_notebook_add_page(_("Away Messages"), NULL, away_message_page(), &c, &p, notebook_page++);
1461 #if USE_PLUGINS
1462 prefs_notebook_add_page(_("Plugins"), NULL, plugin_page(), &plugin_iter, NULL, notebook_page++);
1463 while (l) {
1464 plug = l->data;
1465 if (plug->type == plugin && g_module_symbol(plug->handle, "gaim_plugin_config_gtk", (gpointer *)&config)) {
1466 plug->iter = g_new0(GtkTreeIter, 1);
1467 prefs_notebook_add_page(plug->desc.name, NULL, config(), plug->iter, &plugin_iter, notebook_page++);
1468 }
1469 l = l->next;
1470 }
1441 #endif 1471 #endif
1442 } 1472 }
1443 1473
1444 void show_prefs() 1474 void show_prefs()
1445 { 1475 {