Mercurial > pidgin.yaz
comparison src/prefs.c @ 5205:fefad67de2c7
[gaim-migrate @ 5573]
I had a damn good commit message, but it was eaten. Let's try it again.
Announcing, Gaim Plugin API version 2.0, or GPAPIV2.0 for short.
There are lots'a cool thingies here.
Okay now, this isn't as cool as the previous message, but:
1) There's now a single entry function for all plugin types. It returns a
detailed information structure on the plugin. This removes a lot of the
ugliness from old plugins. Oh yeah, libicq wasn't converted to this, so
if you use it, well, you shouldn't have used it anyway, but now you
can't! bwahahaha. Use AIM/ICQ.
2) There are now 3 types of plugins: Standard, Loader, and Protocol
plugins.
Standard plugins are, well, standard, compiled plugins.
Loader plugins load other plugins. For example, the perl support is now
a loader plugin. It loads perl scripts. In the future, we'll have
Ruby and Python loader plugins.
Protocol plugins are, well, protocol plugins... yeah...
3) Plugins have unique IDs, so they can be referred to or automatically
updated from a plugin database in the future. Neat, huh?
4) Plugins will have dependency support in the future, and can be hidden,
so if you have, say, a logging core plugin, it won't have to show up,
but then you load the GTK+ logging plugin and it'll auto-load the core
plugin. Core/UI split plugins!
5) There will eventually be custom plugin signals and RPC of some sort, for
the core/ui split plugins.
So, okay, back up .gaimrc.
I'd like to thank my parents for their support, javabsp for helping convert
a bunch of protocol plugins, and Etan for helping convert a bunch of
standard plugins.
Have fun. If you have any problems, please let me know, but you probably
won't have anything major happen. You will have to convert your plugins,
though, and I'm not guaranteeing that all perl scripts will still work.
I'll end up changing the perl script API eventually, so I know they won't
down the road. Don't worry, though. It'll be mass cool.
faceprint wants me to just commit the damn code already. So, here we go!!!
..
..
I need a massage. From a young, cute girl. Are there any young, cute girls
in the audience? IM me plz k thx.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Fri, 25 Apr 2003 06:47:33 +0000 |
parents | 4cfc49e31c2e |
children | 0241d6b6702d |
comparison
equal
deleted
inserted
replaced
5204:44de70702205 | 5205:fefad67de2c7 |
---|---|
35 #include <ctype.h> | 35 #include <ctype.h> |
36 #include <gtk/gtk.h> | 36 #include <gtk/gtk.h> |
37 #include "gtkimhtml.h" | 37 #include "gtkimhtml.h" |
38 #include "gaim.h" | 38 #include "gaim.h" |
39 #include "gtklist.h" | 39 #include "gtklist.h" |
40 #include "gtkplugin.h" | |
40 #include "prpl.h" | 41 #include "prpl.h" |
41 #include "proxy.h" | 42 #include "proxy.h" |
42 #include "sound.h" | 43 #include "sound.h" |
43 | 44 |
44 #ifdef _WIN32 | 45 #ifdef _WIN32 |
78 static GtkTreeIter plugin_iter; | 79 static GtkTreeIter plugin_iter; |
79 | 80 |
80 /* | 81 /* |
81 * PROTOTYPES | 82 * PROTOTYPES |
82 */ | 83 */ |
83 GtkTreeIter *prefs_notebook_add_page(char*, GdkPixbuf*, GtkWidget*, GtkTreeIter*, GtkTreeIter*, int); | 84 GtkTreeIter *prefs_notebook_add_page(const char*, GdkPixbuf*, GtkWidget*, GtkTreeIter*, GtkTreeIter*, int); |
85 | |
86 static void update_plugin_list(void *data); | |
84 | 87 |
85 void delete_prefs(GtkWidget *asdf, void *gdsa) { | 88 void delete_prefs(GtkWidget *asdf, void *gdsa) { |
86 GList *l = plugins; | 89 GList *l; |
87 struct gaim_plugin *plug; | 90 GaimPlugin *plug; |
88 | 91 |
92 gaim_plugins_unregister_probe_notify_cb(update_plugin_list); | |
93 | |
89 save_prefs(); | 94 save_prefs(); |
90 prefs = NULL; | 95 prefs = NULL; |
91 tree_v = NULL; | 96 tree_v = NULL; |
92 sound_entry = NULL; | 97 sound_entry = NULL; |
93 browser_entry = NULL; | 98 browser_entry = NULL; |
97 smiley_theme_store = NULL; | 102 smiley_theme_store = NULL; |
98 if(sounddialog) | 103 if(sounddialog) |
99 gtk_widget_destroy(sounddialog); | 104 gtk_widget_destroy(sounddialog); |
100 g_object_unref(G_OBJECT(prefs_away_store)); | 105 g_object_unref(G_OBJECT(prefs_away_store)); |
101 prefs_away_store = NULL; | 106 prefs_away_store = NULL; |
102 while(l) { | 107 |
108 for (l = gaim_plugins_get_loaded(); l != NULL; l = l->next) { | |
103 plug = l->data; | 109 plug = l->data; |
104 if(plug->iter) { | 110 |
105 g_free(plug->iter); | 111 if (GAIM_IS_GTK_PLUGIN(plug)) { |
106 plug->iter = NULL; | 112 GaimGtkPluginUiInfo *ui_info; |
113 | |
114 ui_info = GAIM_GTK_PLUGIN_UI_INFO(plug); | |
115 | |
116 if (ui_info->iter != NULL) { | |
117 g_free(ui_info->iter); | |
118 ui_info->iter = NULL; | |
119 } | |
107 } | 120 } |
108 l = l->next; | |
109 } | 121 } |
110 } | 122 } |
111 | 123 |
112 GtkWidget *preflabel; | 124 GtkWidget *preflabel; |
113 GtkWidget *prefsnotebook; | 125 GtkWidget *prefsnotebook; |
1111 | 1123 |
1112 gtk_widget_show_all(ret); | 1124 gtk_widget_show_all(ret); |
1113 return ret; | 1125 return ret; |
1114 } | 1126 } |
1115 | 1127 |
1116 #if USE_PLUGINS | 1128 static GtkWidget *plugin_description=NULL, *plugin_details=NULL; |
1117 GtkWidget *plugin_description=NULL, *plugin_details=NULL; | 1129 |
1118 static void prefs_plugin_sel (GtkTreeSelection *sel, GtkTreeModel *model) | 1130 static void prefs_plugin_sel (GtkTreeSelection *sel, GtkTreeModel *model) |
1119 { | 1131 { |
1120 gchar buf[1024]; | 1132 gchar buf[1024]; |
1121 GtkTreeIter iter; | 1133 GtkTreeIter iter; |
1122 GValue val = { 0, }; | 1134 GValue val = { 0, }; |
1123 struct gaim_plugin *plug; | 1135 GaimPlugin *plug; |
1124 | 1136 |
1125 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) | 1137 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) |
1126 return; | 1138 return; |
1127 gtk_tree_model_get_value (model, &iter, 2, &val); | 1139 gtk_tree_model_get_value (model, &iter, 2, &val); |
1128 plug = g_value_get_pointer(&val); | 1140 plug = g_value_get_pointer(&val); |
1129 | 1141 |
1130 if (plug->error[0]) | 1142 if (plug->error != NULL) { |
1131 g_snprintf(buf, sizeof(buf), "<span size=\"larger\">%s %s</span>\n\n" | 1143 g_snprintf(buf, sizeof(buf), |
1132 "<span weight=\"bold\" color=\"red\">%s</span>\n\n" | 1144 "<span size=\"larger\">%s %s</span>\n\n" |
1133 "%s", plug->desc.name, plug->desc.version, plug->error, plug->desc.description); | 1145 "<span weight=\"bold\" color=\"red\">%s</span>\n\n" |
1134 else | 1146 "%s", |
1135 g_snprintf(buf, sizeof(buf), "<span size=\"larger\">%s %s</span>\n\n" | 1147 g_markup_escape_text(_(plug->info->name), -1), |
1136 "%s", plug->desc.name, plug->desc.version, plug->desc.description); | 1148 plug->info->version, |
1149 g_markup_escape_text(plug->error, -1), | |
1150 g_markup_escape_text(_(plug->info->description), -1)); | |
1151 } | |
1152 else { | |
1153 g_snprintf(buf, sizeof(buf), | |
1154 "<span size=\"larger\">%s %s</span>\n\n%s", | |
1155 g_markup_escape_text(_(plug->info->name), -1), | |
1156 plug->info->version, | |
1157 g_markup_escape_text(_(plug->info->description), -1)); | |
1158 } | |
1159 | |
1137 gtk_label_set_markup(GTK_LABEL(plugin_description), buf); | 1160 gtk_label_set_markup(GTK_LABEL(plugin_description), buf); |
1138 g_snprintf(buf, sizeof(buf), | 1161 g_snprintf(buf, sizeof(buf), |
1139 #ifndef _WIN32 | 1162 #ifndef _WIN32 |
1140 _("<span size=\"larger\">%s %s</span>\n\n" | 1163 _("<span size=\"larger\">%s %s</span>\n\n" |
1141 "<span weight=\"bold\">Written by:</span>\t%s\n" | 1164 "<span weight=\"bold\">Written by:</span>\t%s\n" |
1145 _("<span size=\"larger\">%s %s</span>\n\n" | 1168 _("<span size=\"larger\">%s %s</span>\n\n" |
1146 "<span weight=\"bold\">Written by:</span> %s\n" | 1169 "<span weight=\"bold\">Written by:</span> %s\n" |
1147 "<span weight=\"bold\">URL:</span> %s\n" | 1170 "<span weight=\"bold\">URL:</span> %s\n" |
1148 "<span weight=\"bold\">File name:</span> %s"), | 1171 "<span weight=\"bold\">File name:</span> %s"), |
1149 #endif | 1172 #endif |
1150 plug->desc.name, plug->desc.version, plug->desc.authors, plug->desc.url, plug->path); | 1173 g_markup_escape_text(_(plug->info->name), -1), |
1174 plug->info->version, | |
1175 g_markup_escape_text(_(plug->info->author), -1), | |
1176 g_markup_escape_text(plug->info->homepage, -1), | |
1177 plug->path); | |
1178 | |
1151 gtk_label_set_markup(GTK_LABEL(plugin_details), buf); | 1179 gtk_label_set_markup(GTK_LABEL(plugin_details), buf); |
1152 g_value_unset (&val); | 1180 g_value_unset (&val); |
1153 } | 1181 } |
1154 | 1182 |
1155 static void plugin_load (GtkCellRendererToggle *cell, gchar *pth, gpointer data) | 1183 static void plugin_load (GtkCellRendererToggle *cell, gchar *pth, gpointer data) |
1156 { | 1184 { |
1157 GtkTreeModel *model = (GtkTreeModel *)data; | 1185 GtkTreeModel *model = (GtkTreeModel *)data; |
1158 GtkTreeIter iter; | 1186 GtkTreeIter iter; |
1159 GtkTreePath *path = gtk_tree_path_new_from_string(pth); | 1187 GtkTreePath *path = gtk_tree_path_new_from_string(pth); |
1160 struct gaim_plugin *plug; | 1188 GaimPlugin *plug; |
1161 gchar buf[1024]; | 1189 gchar buf[1024]; |
1162 GtkWidget *(*config)(); | |
1163 | 1190 |
1164 GdkCursor *wait = gdk_cursor_new (GDK_WATCH); | 1191 GdkCursor *wait = gdk_cursor_new (GDK_WATCH); |
1165 gdk_window_set_cursor(prefs->window, wait); | 1192 gdk_window_set_cursor(prefs->window, wait); |
1166 gdk_cursor_unref(wait); | 1193 gdk_cursor_unref(wait); |
1167 | 1194 |
1168 gtk_tree_model_get_iter (model, &iter, path); | 1195 gtk_tree_model_get_iter (model, &iter, path); |
1169 gtk_tree_model_get (model, &iter, 2, &plug, -1); | 1196 gtk_tree_model_get (model, &iter, 2, &plug, -1); |
1170 | 1197 |
1171 if (!plug->handle) | 1198 if (!gaim_plugin_is_loaded(plug)) { |
1172 | 1199 gaim_plugin_load(plug); |
1173 if (plug->type == plugin) | 1200 |
1174 #ifdef GAIM_PLUGINS | 1201 /* |
1175 { | 1202 * NOTE: This is basically the same check as before |
1176 load_plugin(plug->path); | 1203 * (plug->type == plugin), but now there aren't plugin types. |
1177 if (g_module_symbol(plug->handle, "gaim_plugin_config_gtk", (gpointer *)&config)) { | 1204 * Not yet, anyway. I want to do a V2 of the plugin API. |
1178 plug->iter = g_new0(GtkTreeIter, 1); | 1205 * The thing is, we should have a flag specifying the UI type, |
1179 prefs_notebook_add_page(plug->desc.name, NULL, config(), plug->iter, &plugin_iter, notebook_page++); | 1206 * or just whether it's a general plugin or a UI-specific |
1180 if (gtk_tree_model_iter_n_children(GTK_TREE_MODEL(prefstree), &plugin_iter) == 1) { | 1207 * plugin. We should only load this if it's UI-specific. |
1181 /* Expand the tree for the first plugin added */ | 1208 * |
1182 GtkTreePath *path2 = gtk_tree_model_get_path(GTK_TREE_MODEL(prefstree), &plugin_iter); | 1209 * -- ChipX86 |
1183 gtk_tree_view_expand_row(GTK_TREE_VIEW(tree_v), path2, TRUE); | 1210 */ |
1184 gtk_tree_path_free (path2); | 1211 if (GAIM_IS_GTK_PLUGIN(plug)) |
1185 } | 1212 { |
1213 GtkWidget *config_frame; | |
1214 GaimGtkPluginUiInfo *ui_info; | |
1215 | |
1216 ui_info = GAIM_GTK_PLUGIN_UI_INFO(plug); | |
1217 config_frame = gaim_gtk_plugin_get_config_frame(plug); | |
1218 | |
1219 if (config_frame != NULL) { | |
1220 ui_info->iter = g_new0(GtkTreeIter, 1); | |
1221 prefs_notebook_add_page(_(plug->info->name), NULL, | |
1222 config_frame, ui_info->iter, | |
1223 &plugin_iter, notebook_page++); | |
1224 | |
1225 if (gtk_tree_model_iter_n_children(GTK_TREE_MODEL(prefstree), | |
1226 &plugin_iter) == 1) { | |
1227 | |
1228 /* Expand the tree for the first plugin added */ | |
1229 GtkTreePath *path2; | |
1230 | |
1231 path2 = gtk_tree_model_get_path(GTK_TREE_MODEL(prefstree), | |
1232 &plugin_iter); | |
1233 gtk_tree_view_expand_row(GTK_TREE_VIEW(tree_v), | |
1234 path2, TRUE); | |
1235 gtk_tree_path_free(path2); | |
1186 } | 1236 } |
1187 } | 1237 } |
1188 #else | 1238 } |
1189 {} | 1239 } |
1190 #endif | 1240 else { |
1191 else | 1241 if (GAIM_IS_GTK_PLUGIN(plug)) { |
1192 #ifdef USE_PERL | 1242 GaimGtkPluginUiInfo *ui_info; |
1193 perl_load_file(plug->path); | 1243 |
1194 #else | 1244 ui_info = GAIM_GTK_PLUGIN_UI_INFO(plug); |
1195 {} | 1245 |
1196 #endif | 1246 if (ui_info != NULL && ui_info->iter != NULL) { |
1197 else | 1247 gtk_tree_store_remove(GTK_TREE_STORE(prefstree), ui_info->iter); |
1198 if (plug->type == plugin) | 1248 g_free(ui_info->iter); |
1199 #ifdef GAIM_PLUGINS | 1249 ui_info->iter = NULL; |
1200 { | |
1201 unload_plugin(plug); | |
1202 if (plug->iter) { | |
1203 gtk_tree_store_remove(GTK_TREE_STORE(prefstree), plug->iter); | |
1204 g_free(plug->iter); | |
1205 plug->iter = NULL; | |
1206 } | |
1207 } | 1250 } |
1208 #else | 1251 } |
1209 {} | 1252 |
1210 #endif | 1253 gaim_plugin_unload(plug); |
1211 else | 1254 } |
1212 #ifdef USE_PERL | 1255 |
1213 perl_unload_file(plug); | |
1214 #else | |
1215 {} | |
1216 #endif | |
1217 gdk_window_set_cursor(prefs->window, NULL); | 1256 gdk_window_set_cursor(prefs->window, NULL); |
1218 if (plug->error[0]) | 1257 |
1219 g_snprintf(buf, sizeof(buf), "<span size=\"larger\">%s %s</span>\n\n" | 1258 if (plug->error != NULL) { |
1220 "<span weight=\"bold\" color=\"red\">%s</span>\n\n" | 1259 g_snprintf(buf, sizeof(buf), |
1221 "%s", plug->desc.name, plug->desc.version, plug->error, plug->desc.description); | 1260 "<span size=\"larger\">%s %s</span>\n\n" |
1222 else | 1261 "<span weight=\"bold\" color=\"red\">%s</span>\n\n" |
1223 g_snprintf(buf, sizeof(buf), "<span size=\"larger\">%s %s</span>\n\n" | 1262 "%s", |
1224 "%s", plug->desc.name, plug->desc.version, plug->desc.description); | 1263 g_markup_escape_text(_(plug->info->name), -1), |
1264 plug->info->version, | |
1265 g_markup_escape_text(plug->error, -1), | |
1266 g_markup_escape_text(_(plug->info->description), -1)); | |
1267 } | |
1268 else { | |
1269 g_snprintf(buf, sizeof(buf), | |
1270 "<span size=\"larger\">%s %s</span>\n\n%s", | |
1271 g_markup_escape_text(_(plug->info->name), -1), | |
1272 plug->info->version, | |
1273 g_markup_escape_text(_(plug->info->description), -1)); | |
1274 } | |
1275 | |
1225 gtk_label_set_markup(GTK_LABEL(plugin_description), buf); | 1276 gtk_label_set_markup(GTK_LABEL(plugin_description), buf); |
1226 gtk_list_store_set (GTK_LIST_STORE (model), &iter, 0, plug->handle, -1); | 1277 gtk_list_store_set (GTK_LIST_STORE (model), &iter, 0, |
1278 gaim_plugin_is_loaded(plug), -1); | |
1227 | 1279 |
1228 gtk_label_set_markup(GTK_LABEL(plugin_description), buf); | 1280 gtk_label_set_markup(GTK_LABEL(plugin_description), buf); |
1229 gtk_tree_path_free(path); | 1281 gtk_tree_path_free(path); |
1230 } | 1282 } |
1231 | 1283 |
1284 static void | |
1285 update_plugin_list(void *data) | |
1286 { | |
1287 GtkListStore *ls = GTK_LIST_STORE(data); | |
1288 GtkTreeIter iter; | |
1289 GList *probes; | |
1290 GaimPlugin *plug; | |
1291 | |
1292 gtk_list_store_clear(ls); | |
1293 | |
1294 for (probes = gaim_plugins_get_all(); | |
1295 probes != NULL; | |
1296 probes = probes->next) { | |
1297 | |
1298 plug = probes->data; | |
1299 | |
1300 if (plug->info->type != GAIM_PLUGIN_STANDARD) | |
1301 continue; | |
1302 | |
1303 gtk_list_store_append (ls, &iter); | |
1304 gtk_list_store_set(ls, &iter, | |
1305 0, gaim_plugin_is_loaded(plug), | |
1306 1, plug->info->name ? _(plug->info->name) : plug->path, | |
1307 2, plug, -1); | |
1308 } | |
1309 } | |
1310 | |
1232 static GtkWidget *plugin_page () | 1311 static GtkWidget *plugin_page () |
1233 { | 1312 { |
1234 GtkWidget *ret; | 1313 GtkWidget *ret; |
1235 | |
1236 GtkWidget *sw, *vp; | 1314 GtkWidget *sw, *vp; |
1237 GtkTreeIter iter; | |
1238 GtkWidget *event_view; | 1315 GtkWidget *event_view; |
1239 GtkListStore *ls; | 1316 GtkListStore *ls; |
1240 GtkCellRenderer *rend, *rendt; | 1317 GtkCellRenderer *rend, *rendt; |
1241 GtkTreeViewColumn *col; | 1318 GtkTreeViewColumn *col; |
1242 GtkTreeSelection *sel; | 1319 GtkTreeSelection *sel; |
1243 GtkTreePath *path; | 1320 GtkTreePath *path; |
1244 | |
1245 GtkWidget *nb; | 1321 GtkWidget *nb; |
1246 | 1322 |
1247 GList *probes = probed_plugins; | |
1248 struct gaim_plugin *plug; | |
1249 | |
1250 ret = gtk_vbox_new(FALSE, 18); | 1323 ret = gtk_vbox_new(FALSE, 18); |
1251 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | 1324 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); |
1252 | 1325 |
1253 sw = gtk_scrolled_window_new(NULL,NULL); | 1326 sw = gtk_scrolled_window_new(NULL,NULL); |
1254 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); | 1327 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); |
1255 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); | 1328 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); |
1256 | 1329 |
1257 gtk_box_pack_start(GTK_BOX(ret), sw, TRUE, TRUE, 0); | 1330 gtk_box_pack_start(GTK_BOX(ret), sw, TRUE, TRUE, 0); |
1258 | 1331 |
1259 ls = gtk_list_store_new (3, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_POINTER); | 1332 ls = gtk_list_store_new (3, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_POINTER); |
1260 while (probes) { | 1333 |
1261 plug = probes->data; | 1334 update_plugin_list(ls); |
1262 gtk_list_store_append (ls, &iter); | 1335 |
1263 gtk_list_store_set(ls, &iter, | |
1264 0, plug->handle, | |
1265 1, plug->desc.name ? plug->desc.name : plug->path, | |
1266 2, plug, -1); | |
1267 probes = probes->next; | |
1268 } | |
1269 | |
1270 event_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(ls)); | 1336 event_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(ls)); |
1271 | 1337 |
1272 rend = gtk_cell_renderer_toggle_new(); | 1338 rend = gtk_cell_renderer_toggle_new(); |
1273 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view)); | 1339 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view)); |
1274 | 1340 |
1338 | 1404 |
1339 path = gtk_tree_path_new_first(); | 1405 path = gtk_tree_path_new_first(); |
1340 gtk_tree_selection_select_path(sel, path); | 1406 gtk_tree_selection_select_path(sel, path); |
1341 gtk_tree_path_free(path); | 1407 gtk_tree_path_free(path); |
1342 | 1408 |
1409 gaim_plugins_register_probe_notify_cb(update_plugin_list, ls); | |
1410 | |
1343 gtk_widget_show_all(ret); | 1411 gtk_widget_show_all(ret); |
1344 return ret; | 1412 return ret; |
1345 } | 1413 } |
1346 #endif | |
1347 | 1414 |
1348 static void event_toggled (GtkCellRendererToggle *cell, gchar *pth, gpointer data) | 1415 static void event_toggled (GtkCellRendererToggle *cell, gchar *pth, gpointer data) |
1349 { | 1416 { |
1350 GtkTreeModel *model = (GtkTreeModel *)data; | 1417 GtkTreeModel *model = (GtkTreeModel *)data; |
1351 GtkTreeIter iter; | 1418 GtkTreeIter iter; |
1676 | 1743 |
1677 gtk_widget_show_all(ret); | 1744 gtk_widget_show_all(ret); |
1678 return ret; | 1745 return ret; |
1679 } | 1746 } |
1680 | 1747 |
1681 GtkTreeIter *prefs_notebook_add_page(char *text, | 1748 GtkTreeIter *prefs_notebook_add_page(const char *text, |
1682 GdkPixbuf *pixbuf, | 1749 GdkPixbuf *pixbuf, |
1683 GtkWidget *page, | 1750 GtkWidget *page, |
1684 GtkTreeIter *iter, | 1751 GtkTreeIter *iter, |
1685 GtkTreeIter *parent, | 1752 GtkTreeIter *parent, |
1686 int ind) { | 1753 int ind) { |
1700 return iter; | 1767 return iter; |
1701 } | 1768 } |
1702 | 1769 |
1703 void prefs_notebook_init() { | 1770 void prefs_notebook_init() { |
1704 GtkTreeIter p, p2, c; | 1771 GtkTreeIter p, p2, c; |
1705 #if USE_PLUGINS | 1772 GList *l; |
1706 GtkWidget *(*config)(); | 1773 GaimPlugin *plug; |
1707 GList *l = plugins; | |
1708 struct gaim_plugin *plug; | |
1709 #endif | |
1710 prefs_notebook_add_page(_("Interface"), NULL, interface_page(), &p, NULL, notebook_page++); | 1774 prefs_notebook_add_page(_("Interface"), NULL, interface_page(), &p, NULL, notebook_page++); |
1711 prefs_notebook_add_page(_("Smiley Themes"), NULL, theme_page(), &c, &p, notebook_page++); | 1775 prefs_notebook_add_page(_("Smiley Themes"), NULL, theme_page(), &c, &p, notebook_page++); |
1712 prefs_notebook_add_page(_("Fonts"), NULL, font_page(), &c, &p, notebook_page++); | 1776 prefs_notebook_add_page(_("Fonts"), NULL, font_page(), &c, &p, notebook_page++); |
1713 prefs_notebook_add_page(_("Message Text"), NULL, messages_page(), &c, &p, notebook_page++); | 1777 prefs_notebook_add_page(_("Message Text"), NULL, messages_page(), &c, &p, notebook_page++); |
1714 prefs_notebook_add_page(_("Shortcuts"), NULL, hotkeys_page(), &c, &p, notebook_page++); | 1778 prefs_notebook_add_page(_("Shortcuts"), NULL, hotkeys_page(), &c, &p, notebook_page++); |
1725 prefs_notebook_add_page(_("Logging"), NULL, logging_page(), &p, NULL, notebook_page++); | 1789 prefs_notebook_add_page(_("Logging"), NULL, logging_page(), &p, NULL, notebook_page++); |
1726 prefs_notebook_add_page(_("Sounds"), NULL, sound_page(), &p, NULL, notebook_page++); | 1790 prefs_notebook_add_page(_("Sounds"), NULL, sound_page(), &p, NULL, notebook_page++); |
1727 prefs_notebook_add_page(_("Sound Events"), NULL, sound_events_page(), &c, &p, notebook_page++); | 1791 prefs_notebook_add_page(_("Sound Events"), NULL, sound_events_page(), &c, &p, notebook_page++); |
1728 prefs_notebook_add_page(_("Away / Idle"), NULL, away_page(), &p, NULL, notebook_page++); | 1792 prefs_notebook_add_page(_("Away / Idle"), NULL, away_page(), &p, NULL, notebook_page++); |
1729 prefs_notebook_add_page(_("Away Messages"), NULL, away_message_page(), &c, &p, notebook_page++); | 1793 prefs_notebook_add_page(_("Away Messages"), NULL, away_message_page(), &c, &p, notebook_page++); |
1730 #if USE_PLUGINS | 1794 |
1731 prefs_notebook_add_page(_("Plugins"), NULL, plugin_page(), &plugin_iter, NULL, notebook_page++); | 1795 if (gaim_plugins_enabled()) { |
1732 while (l) { | 1796 prefs_notebook_add_page(_("Plugins"), NULL, plugin_page(), &plugin_iter, NULL, notebook_page++); |
1733 plug = l->data; | 1797 |
1734 if (plug->type == plugin && g_module_symbol(plug->handle, "gaim_plugin_config_gtk", (gpointer *)&config)) { | 1798 for (l = gaim_plugins_get_loaded(); l != NULL; l = l->next) { |
1735 plug->iter = g_new0(GtkTreeIter, 1); | 1799 plug = l->data; |
1736 prefs_notebook_add_page(plug->desc.name, NULL, config(), plug->iter, &plugin_iter, notebook_page++); | 1800 |
1801 if (GAIM_IS_GTK_PLUGIN(plug)) { | |
1802 GtkWidget *config_frame; | |
1803 GaimGtkPluginUiInfo *ui_info; | |
1804 | |
1805 ui_info = GAIM_GTK_PLUGIN_UI_INFO(plug); | |
1806 config_frame = gaim_gtk_plugin_get_config_frame(plug); | |
1807 | |
1808 if (config_frame != NULL) { | |
1809 ui_info->iter = g_new0(GtkTreeIter, 1); | |
1810 prefs_notebook_add_page(_(plug->info->name), NULL, | |
1811 config_frame, ui_info->iter, | |
1812 &plugin_iter, notebook_page++); | |
1813 } | |
1814 } | |
1737 } | 1815 } |
1738 l = l->next; | 1816 } |
1739 } | |
1740 #endif | |
1741 } | 1817 } |
1742 | 1818 |
1743 void show_prefs() | 1819 void show_prefs() |
1744 { | 1820 { |
1745 GtkWidget *vbox, *vbox2; | 1821 GtkWidget *vbox, *vbox2; |