Mercurial > pidgin
comparison src/gtkprefs.c @ 11740:7e0ad3b6882a
[gaim-migrate @ 14031]
Moved Plugins to Tools > Plugins
Made iChat Timestamp plugin instant apply
Made Proxy options visible only when needed.
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Sun, 23 Oct 2005 07:12:12 +0000 |
parents | cae2fb7e8594 |
children | 8d5ea84440ca |
comparison
equal
deleted
inserted
replaced
11739:a25be0e70a67 | 11740:7e0ad3b6882a |
---|---|
40 #include "gtkconv.h" | 40 #include "gtkconv.h" |
41 #include "gtkdebug.h" | 41 #include "gtkdebug.h" |
42 #include "gtkdialogs.h" | 42 #include "gtkdialogs.h" |
43 #include "gtkimhtml.h" | 43 #include "gtkimhtml.h" |
44 #include "gtkimhtmltoolbar.h" | 44 #include "gtkimhtmltoolbar.h" |
45 #include "gtkplugin.h" | |
46 #include "gtkpluginpref.h" | |
47 #include "gtkprefs.h" | 45 #include "gtkprefs.h" |
48 #include "gtksound.h" | 46 #include "gtksound.h" |
49 #include "gtkthemes.h" | 47 #include "gtkthemes.h" |
50 #include "gtkutils.h" | 48 #include "gtkutils.h" |
51 #include "gtkstock.h" | 49 #include "gtkstock.h" |
63 static GtkWidget *prefs_proxy_frame = NULL; | 61 static GtkWidget *prefs_proxy_frame = NULL; |
64 | 62 |
65 static GtkWidget *prefs = NULL; | 63 static GtkWidget *prefs = NULL; |
66 static GtkWidget *debugbutton = NULL; | 64 static GtkWidget *debugbutton = NULL; |
67 static int notebook_page = 0; | 65 static int notebook_page = 0; |
68 static GtkTreeIter plugin_iter; | |
69 static GtkTreeRowReference *previous_smiley_row = NULL; | 66 static GtkTreeRowReference *previous_smiley_row = NULL; |
70 | 67 |
71 /* | 68 /* |
72 * PROTOTYPES | 69 * PROTOTYPES |
73 */ | 70 */ |
74 static int prefs_notebook_add_page(const char*, GdkPixbuf*, | 71 static int prefs_notebook_add_page(const char*, GdkPixbuf*, |
75 GtkWidget*, GtkTreeIter*, | 72 GtkWidget*, GtkTreeIter*, |
76 GtkTreeIter*, int); | 73 GtkTreeIter*, int); |
77 static void delete_prefs(GtkWidget *, void *); | 74 static void delete_prefs(GtkWidget *, void *); |
78 static void update_plugin_list(void *data); | |
79 | 75 |
80 static void | 76 static void |
81 update_spin_value(GtkWidget *w, GtkWidget *spin) | 77 update_spin_value(GtkWidget *w, GtkWidget *spin) |
82 { | 78 { |
83 const char *key = g_object_get_data(G_OBJECT(spin), "val"); | 79 const char *key = g_object_get_data(G_OBJECT(spin), "val"); |
343 | 339 |
344 return dropdown; | 340 return dropdown; |
345 } | 341 } |
346 | 342 |
347 static void | 343 static void |
348 add_plugin_prefs(GaimPlugin *plugin) | |
349 { | |
350 /* | |
351 * NOTE: This is basically the same check as before | |
352 * (plug->type == plugin), but now there aren't plugin types. | |
353 * Not yet, anyway. I want to do a V2 of the plugin API. | |
354 * The thing is, we should have a flag specifying the UI type, | |
355 * or just whether it's a general plugin or a UI-specific | |
356 * plugin. We should only load this if it's UI-specific. | |
357 * | |
358 * -- ChipX86 | |
359 */ | |
360 if (GAIM_IS_GTK_PLUGIN(plugin)) | |
361 { | |
362 GtkWidget *config_frame; | |
363 GaimGtkPluginUiInfo *ui_info; | |
364 | |
365 ui_info = GAIM_GTK_PLUGIN_UI_INFO(plugin); | |
366 config_frame = gaim_gtk_plugin_get_config_frame(plugin); | |
367 | |
368 if (config_frame != NULL) | |
369 { | |
370 ui_info->page_num = | |
371 prefs_notebook_add_page(_(plugin->info->name), NULL, | |
372 config_frame, NULL, | |
373 &plugin_iter, notebook_page++); | |
374 } | |
375 } | |
376 | |
377 if (GAIM_PLUGIN_HAS_PREF_FRAME(plugin)) | |
378 { | |
379 GtkWidget *gtk_frame; | |
380 GaimPluginUiInfo *prefs_info; | |
381 | |
382 prefs_info = GAIM_PLUGIN_UI_INFO(plugin); | |
383 prefs_info->frame = prefs_info->get_plugin_pref_frame(plugin); | |
384 gtk_frame = gaim_gtk_plugin_pref_create_frame(prefs_info->frame); | |
385 | |
386 if (GTK_IS_WIDGET(gtk_frame)) | |
387 { | |
388 prefs_info->page_num = | |
389 prefs_notebook_add_page(_(plugin->info->name), NULL, | |
390 gtk_frame, NULL, | |
391 (plugin->info->type == GAIM_PLUGIN_PROTOCOL) ? NULL : &plugin_iter, | |
392 notebook_page++); | |
393 } else if(prefs_info->frame) { | |
394 /* in the event that there is a pref frame and we can | |
395 * not make a widget out of it, we free the | |
396 * pluginpref frame --Gary | |
397 */ | |
398 gaim_plugin_pref_frame_destroy(prefs_info->frame); | |
399 } | |
400 } | |
401 } | |
402 | |
403 static void | |
404 delete_plugin_prefs(GaimPlugin *plugin) | |
405 { | |
406 if (GAIM_IS_GTK_PLUGIN(plugin)) | |
407 { | |
408 GaimGtkPluginUiInfo *ui_info; | |
409 | |
410 ui_info = GAIM_GTK_PLUGIN_UI_INFO(plugin); | |
411 | |
412 if (ui_info != NULL && ui_info->page_num > 0) { | |
413 gtk_notebook_remove_page(GTK_NOTEBOOK(prefsnotebook), | |
414 ui_info->page_num); | |
415 } | |
416 } | |
417 | |
418 if (GAIM_PLUGIN_HAS_PREF_FRAME(plugin)) | |
419 { | |
420 GaimPluginUiInfo *prefs_info; | |
421 | |
422 prefs_info = GAIM_PLUGIN_UI_INFO(plugin); | |
423 | |
424 if (prefs_info->frame != NULL) { | |
425 gaim_plugin_pref_frame_destroy(prefs_info->frame); | |
426 prefs_info->frame = NULL; | |
427 } | |
428 | |
429 if (prefs_info->page_num > 0) { | |
430 gtk_notebook_remove_page(GTK_NOTEBOOK(prefsnotebook), | |
431 prefs_info->page_num); | |
432 } | |
433 } | |
434 } | |
435 | |
436 static void | |
437 delete_prefs(GtkWidget *asdf, void *gdsa) | 344 delete_prefs(GtkWidget *asdf, void *gdsa) |
438 { | 345 { |
439 GList *l; | |
440 | |
441 /* Close any "select sound" request dialogs */ | 346 /* Close any "select sound" request dialogs */ |
442 gaim_request_close_with_handle(prefs); | 347 gaim_request_close_with_handle(prefs); |
443 | |
444 gaim_plugins_unregister_probe_notify_cb(update_plugin_list); | |
445 | 348 |
446 /* Unregister callbacks. */ | 349 /* Unregister callbacks. */ |
447 gaim_prefs_disconnect_by_handle(prefs); | 350 gaim_prefs_disconnect_by_handle(prefs); |
448 | 351 |
449 prefs = NULL; | 352 prefs = NULL; |
453 smiley_theme_store = NULL; | 356 smiley_theme_store = NULL; |
454 if (previous_smiley_row) | 357 if (previous_smiley_row) |
455 gtk_tree_row_reference_free(previous_smiley_row); | 358 gtk_tree_row_reference_free(previous_smiley_row); |
456 previous_smiley_row = NULL; | 359 previous_smiley_row = NULL; |
457 | 360 |
458 for (l = gaim_plugins_get_loaded(); l != NULL; l = l->next) | |
459 { | |
460 delete_plugin_prefs(l->data); | |
461 } | |
462 } | 361 } |
463 | 362 |
464 static void smiley_sel(GtkTreeSelection *sel, GtkTreeModel *model) { | 363 static void smiley_sel(GtkTreeSelection *sel, GtkTreeModel *model) { |
465 GtkTreeIter iter; | 364 GtkTreeIter iter; |
466 const char *themename; | 365 const char *themename; |
1043 { | 942 { |
1044 GtkWidget *frame = data; | 943 GtkWidget *frame = data; |
1045 const char *proxy = value; | 944 const char *proxy = value; |
1046 | 945 |
1047 if (strcmp(proxy, "none") && strcmp(proxy, "envvar")) | 946 if (strcmp(proxy, "none") && strcmp(proxy, "envvar")) |
1048 gtk_widget_set_sensitive(frame, TRUE); | 947 gtk_widget_show(frame); |
1049 else | 948 else |
1050 gtk_widget_set_sensitive(frame, FALSE); | 949 gtk_widget_hide(frame); |
1051 } | 950 } |
1052 | 951 |
1053 static void proxy_print_option(GtkEntry *entry, int entrynum) | 952 static void proxy_print_option(GtkEntry *entry, int entrynum) |
1054 { | 953 { |
1055 if (entrynum == PROXYHOST) | 954 if (entrynum == PROXYHOST) |
1142 _("Use Environmental Settings"), "envvar", | 1041 _("Use Environmental Settings"), "envvar", |
1143 NULL); | 1042 NULL); |
1144 gtk_box_pack_start(GTK_BOX(vbox), prefs_proxy_frame, 0, 0, 0); | 1043 gtk_box_pack_start(GTK_BOX(vbox), prefs_proxy_frame, 0, 0, 0); |
1145 proxy_info = gaim_global_proxy_get_info(); | 1044 proxy_info = gaim_global_proxy_get_info(); |
1146 | 1045 |
1147 if (proxy_info == NULL || | |
1148 gaim_proxy_info_get_type(proxy_info) == GAIM_PROXY_NONE || | |
1149 gaim_proxy_info_get_type(proxy_info) == GAIM_PROXY_USE_ENVVAR) { | |
1150 | |
1151 gtk_widget_set_sensitive(GTK_WIDGET(prefs_proxy_frame), FALSE); | |
1152 } | |
1153 gaim_prefs_connect_callback(prefs, "/core/proxy/type", | 1046 gaim_prefs_connect_callback(prefs, "/core/proxy/type", |
1154 proxy_changed_cb, prefs_proxy_frame); | 1047 proxy_changed_cb, prefs_proxy_frame); |
1155 | 1048 |
1156 table = gtk_table_new(4, 2, FALSE); | 1049 table = gtk_table_new(4, 2, FALSE); |
1157 gtk_container_set_border_width(GTK_CONTAINER(table), 0); | 1050 gtk_container_set_border_width(GTK_CONTAINER(table), 0); |
1158 gtk_table_set_col_spacings(GTK_TABLE(table), 5); | 1051 gtk_table_set_col_spacings(GTK_TABLE(table), 5); |
1159 gtk_table_set_row_spacings(GTK_TABLE(table), 10); | 1052 gtk_table_set_row_spacings(GTK_TABLE(table), 10); |
1230 gtk_entry_set_text(GTK_ENTRY(entry), | 1123 gtk_entry_set_text(GTK_ENTRY(entry), |
1231 gaim_proxy_info_get_password(proxy_info)); | 1124 gaim_proxy_info_get_password(proxy_info)); |
1232 gaim_set_accessible_label (entry, label); | 1125 gaim_set_accessible_label (entry, label); |
1233 | 1126 |
1234 gtk_widget_show_all(ret); | 1127 gtk_widget_show_all(ret); |
1128 if (proxy_info == NULL || | |
1129 gaim_proxy_info_get_type(proxy_info) == GAIM_PROXY_NONE || | |
1130 gaim_proxy_info_get_type(proxy_info) == GAIM_PROXY_USE_ENVVAR) | |
1131 gtk_widget_hide(table); | |
1235 return ret; | 1132 return ret; |
1236 } | 1133 } |
1237 | 1134 |
1238 #ifndef _WIN32 | 1135 #ifndef _WIN32 |
1239 static gboolean manual_browser_set(GtkWidget *entry, GdkEventFocus *event, gpointer data) { | 1136 static gboolean manual_browser_set(GtkWidget *entry, GdkEventFocus *event, gpointer data) { |
1827 gtk_widget_show_all(ret); | 1724 gtk_widget_show_all(ret); |
1828 | 1725 |
1829 return ret; | 1726 return ret; |
1830 } | 1727 } |
1831 | 1728 |
1832 static GtkWidget *plugin_description=NULL, *plugin_details=NULL; | |
1833 | |
1834 static void prefs_plugin_sel (GtkTreeSelection *sel, GtkTreeModel *model) | |
1835 { | |
1836 gchar *buf, *pname, *perr, *pdesc, *pauth, *pweb; | |
1837 GtkTreeIter iter; | |
1838 GValue val = { 0, }; | |
1839 GaimPlugin *plug; | |
1840 | |
1841 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) | |
1842 return; | |
1843 gtk_tree_model_get_value (model, &iter, 3, &val); | |
1844 plug = g_value_get_pointer(&val); | |
1845 | |
1846 pname = g_markup_escape_text(_(plug->info->name), -1); | |
1847 pdesc = (plug->info->description) ? | |
1848 g_markup_escape_text(_(plug->info->description), -1) : NULL; | |
1849 pauth = (plug->info->author) ? | |
1850 g_markup_escape_text(_(plug->info->author), -1) : NULL; | |
1851 pweb = (plug->info->homepage) ? | |
1852 g_markup_escape_text(_(plug->info->homepage), -1) : NULL; | |
1853 | |
1854 if (plug->error != NULL) { | |
1855 perr = g_markup_escape_text(_(plug->error), -1); | |
1856 buf = g_strdup_printf( | |
1857 "<span size=\"larger\">%s %s</span>\n\n" | |
1858 "<span weight=\"bold\" color=\"red\">%s</span>\n\n" | |
1859 "%s", | |
1860 pname, plug->info->version, perr, pdesc ? pdesc : ""); | |
1861 g_free(perr); | |
1862 } | |
1863 else { | |
1864 buf = g_strdup_printf( | |
1865 "<span size=\"larger\">%s %s</span>\n\n%s", | |
1866 pname, plug->info->version, pdesc ? pdesc : ""); | |
1867 } | |
1868 gtk_label_set_markup(GTK_LABEL(plugin_description), buf); | |
1869 g_free(buf); | |
1870 | |
1871 buf = g_strdup_printf( | |
1872 #ifndef _WIN32 | |
1873 _("<span size=\"larger\">%s %s</span>\n\n" | |
1874 "<span weight=\"bold\">Written by:</span>\t%s\n" | |
1875 "<span weight=\"bold\">Web site:</span>\t\t%s\n" | |
1876 "<span weight=\"bold\">File name:</span>\t%s"), | |
1877 #else | |
1878 _("<span size=\"larger\">%s %s</span>\n\n" | |
1879 "<span weight=\"bold\">Written by:</span> %s\n" | |
1880 "<span weight=\"bold\">URL:</span> %s\n" | |
1881 "<span weight=\"bold\">File name:</span> %s"), | |
1882 #endif | |
1883 pname, plug->info->version, pauth ? pauth : "", pweb ? pweb : "", plug->path); | |
1884 | |
1885 gtk_label_set_markup(GTK_LABEL(plugin_details), buf); | |
1886 g_value_unset(&val); | |
1887 g_free(buf); | |
1888 g_free(pname); | |
1889 g_free(pdesc); | |
1890 g_free(pauth); | |
1891 g_free(pweb); | |
1892 } | |
1893 | |
1894 static void plugin_load (GtkCellRendererToggle *cell, gchar *pth, gpointer data) | |
1895 { | |
1896 GtkTreeModel *model = (GtkTreeModel *)data; | |
1897 GtkTreeIter iter; | |
1898 GtkTreePath *path = gtk_tree_path_new_from_string(pth); | |
1899 GaimPlugin *plug; | |
1900 gchar buf[1024]; | |
1901 gchar *name = NULL, *description = NULL; | |
1902 | |
1903 GdkCursor *wait = gdk_cursor_new (GDK_WATCH); | |
1904 gdk_window_set_cursor(prefs->window, wait); | |
1905 gdk_cursor_unref(wait); | |
1906 | |
1907 gtk_tree_model_get_iter (model, &iter, path); | |
1908 gtk_tree_model_get (model, &iter, 3, &plug, -1); | |
1909 | |
1910 if (!gaim_plugin_is_loaded(plug)) { | |
1911 gaim_plugin_load(plug); | |
1912 add_plugin_prefs(plug); | |
1913 } | |
1914 else { | |
1915 delete_plugin_prefs(plug); | |
1916 gaim_plugin_unload(plug); | |
1917 } | |
1918 | |
1919 gdk_window_set_cursor(prefs->window, NULL); | |
1920 | |
1921 name = g_markup_escape_text(_(plug->info->name), -1); | |
1922 description = g_markup_escape_text(_(plug->info->description), -1); | |
1923 if (plug->error != NULL) { | |
1924 gchar *error = g_markup_escape_text(plug->error, -1); | |
1925 g_snprintf(buf, sizeof(buf), | |
1926 "<span size=\"larger\">%s %s</span>\n\n" | |
1927 "<span weight=\"bold\" color=\"red\">%s</span>\n\n" | |
1928 "%s", | |
1929 name, plug->info->version, error, description); | |
1930 g_free(error); | |
1931 } else { | |
1932 g_snprintf(buf, sizeof(buf), | |
1933 "<span size=\"larger\">%s %s</span>\n\n%s", | |
1934 name, plug->info->version, description); | |
1935 } | |
1936 g_free(name); | |
1937 g_free(description); | |
1938 | |
1939 gtk_label_set_markup(GTK_LABEL(plugin_description), buf); | |
1940 gtk_list_store_set (GTK_LIST_STORE (model), &iter, 0, | |
1941 gaim_plugin_is_loaded(plug), -1); | |
1942 | |
1943 gtk_label_set_markup(GTK_LABEL(plugin_description), buf); | |
1944 gtk_tree_path_free(path); | |
1945 | |
1946 gaim_gtk_plugins_save(); | |
1947 } | |
1948 | |
1949 static void | |
1950 update_plugin_list(void *data) | |
1951 { | |
1952 GtkListStore *ls = GTK_LIST_STORE(data); | |
1953 GtkTreeIter iter; | |
1954 GList *probes; | |
1955 GaimPlugin *plug; | |
1956 | |
1957 gtk_list_store_clear(ls); | |
1958 gaim_plugins_probe(GAIM_PLUGIN_EXT); | |
1959 | |
1960 for (probes = gaim_plugins_get_all(); | |
1961 probes != NULL; | |
1962 probes = probes->next) | |
1963 { | |
1964 plug = probes->data; | |
1965 | |
1966 if (plug->info->type != GAIM_PLUGIN_STANDARD || | |
1967 (plug->info->flags & GAIM_PLUGIN_FLAG_INVISIBLE)) | |
1968 { | |
1969 continue; | |
1970 } | |
1971 | |
1972 gtk_list_store_append (ls, &iter); | |
1973 gtk_list_store_set(ls, &iter, | |
1974 0, gaim_plugin_is_loaded(plug), | |
1975 1, plug->info->name ? _(plug->info->name) : plug->path, | |
1976 2, _(plug->info->summary), | |
1977 3, plug, -1); | |
1978 } | |
1979 } | |
1980 | |
1981 static GtkWidget *plugin_page () | |
1982 { | |
1983 GtkWidget *ret; | |
1984 GtkWidget *sw, *vp; | |
1985 GtkWidget *event_view; | |
1986 GtkListStore *ls; | |
1987 GtkCellRenderer *rend, *rendt; | |
1988 GtkTreeViewColumn *col; | |
1989 GtkTreeSelection *sel; | |
1990 GtkTreePath *path; | |
1991 GtkWidget *nb; | |
1992 | |
1993 ret = gtk_vbox_new(FALSE, GAIM_HIG_CAT_SPACE); | |
1994 gtk_container_set_border_width (GTK_CONTAINER (ret), GAIM_HIG_BORDER); | |
1995 | |
1996 sw = gtk_scrolled_window_new(NULL,NULL); | |
1997 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); | |
1998 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); | |
1999 | |
2000 gtk_box_pack_start(GTK_BOX(ret), sw, TRUE, TRUE, 0); | |
2001 | |
2002 ls = gtk_list_store_new (4, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER); | |
2003 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), | |
2004 1, GTK_SORT_ASCENDING); | |
2005 | |
2006 update_plugin_list(ls); | |
2007 | |
2008 event_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(ls)); | |
2009 | |
2010 rend = gtk_cell_renderer_toggle_new(); | |
2011 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view)); | |
2012 | |
2013 col = gtk_tree_view_column_new_with_attributes (_("Load"), | |
2014 rend, | |
2015 "active", 0, | |
2016 NULL); | |
2017 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
2018 | |
2019 rendt = gtk_cell_renderer_text_new(); | |
2020 col = gtk_tree_view_column_new_with_attributes (_("Name"), | |
2021 rendt, | |
2022 "text", 1, | |
2023 NULL); | |
2024 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
2025 | |
2026 rendt = gtk_cell_renderer_text_new(); | |
2027 col = gtk_tree_view_column_new_with_attributes(_("Summary"), | |
2028 rendt, | |
2029 "text", 2, | |
2030 NULL); | |
2031 gtk_tree_view_append_column(GTK_TREE_VIEW(event_view), col); | |
2032 | |
2033 g_object_unref(G_OBJECT(ls)); | |
2034 gtk_container_add(GTK_CONTAINER(sw), event_view); | |
2035 | |
2036 | |
2037 nb = gtk_notebook_new(); | |
2038 gtk_notebook_set_tab_pos (GTK_NOTEBOOK(nb), GTK_POS_BOTTOM); | |
2039 gtk_notebook_popup_disable(GTK_NOTEBOOK(nb)); | |
2040 | |
2041 /* Description */ | |
2042 sw = gtk_scrolled_window_new(NULL, NULL); | |
2043 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); | |
2044 plugin_description = gtk_label_new(NULL); | |
2045 | |
2046 vp = gtk_viewport_new(NULL, NULL); | |
2047 gtk_viewport_set_shadow_type(GTK_VIEWPORT(vp), GTK_SHADOW_NONE); | |
2048 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_NONE); | |
2049 | |
2050 gtk_container_add(GTK_CONTAINER(vp), plugin_description); | |
2051 gtk_container_add(GTK_CONTAINER(sw), vp); | |
2052 | |
2053 gtk_label_set_selectable(GTK_LABEL(plugin_description), TRUE); | |
2054 gtk_label_set_line_wrap(GTK_LABEL(plugin_description), TRUE); | |
2055 gtk_misc_set_alignment(GTK_MISC(plugin_description), 0, 0); | |
2056 gtk_misc_set_padding(GTK_MISC(plugin_description), GAIM_HIG_BOX_SPACE, GAIM_HIG_BOX_SPACE); | |
2057 gtk_notebook_append_page(GTK_NOTEBOOK(nb), sw, gtk_label_new(_("Description"))); | |
2058 | |
2059 /* Details */ | |
2060 sw = gtk_scrolled_window_new(NULL, NULL); | |
2061 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); | |
2062 plugin_details = gtk_label_new(NULL); | |
2063 | |
2064 vp = gtk_viewport_new(NULL, NULL); | |
2065 gtk_viewport_set_shadow_type(GTK_VIEWPORT(vp), GTK_SHADOW_NONE); | |
2066 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_NONE); | |
2067 | |
2068 gtk_container_add(GTK_CONTAINER(vp), plugin_details); | |
2069 gtk_container_add(GTK_CONTAINER(sw), vp); | |
2070 | |
2071 gtk_label_set_selectable(GTK_LABEL(plugin_details), TRUE); | |
2072 gtk_label_set_line_wrap(GTK_LABEL(plugin_details), TRUE); | |
2073 gtk_misc_set_alignment(GTK_MISC(plugin_details), 0, 0); | |
2074 gtk_misc_set_padding(GTK_MISC(plugin_details), GAIM_HIG_BOX_SPACE, GAIM_HIG_BOX_SPACE); | |
2075 gtk_notebook_append_page(GTK_NOTEBOOK(nb), sw, gtk_label_new(_("Details"))); | |
2076 gtk_box_pack_start(GTK_BOX(ret), nb, TRUE, TRUE, 0); | |
2077 | |
2078 g_signal_connect (G_OBJECT (sel), "changed", | |
2079 G_CALLBACK (prefs_plugin_sel), | |
2080 NULL); | |
2081 g_signal_connect (G_OBJECT(rend), "toggled", | |
2082 G_CALLBACK(plugin_load), ls); | |
2083 | |
2084 path = gtk_tree_path_new_first(); | |
2085 gtk_tree_selection_select_path(sel, path); | |
2086 gtk_tree_path_free(path); | |
2087 | |
2088 gaim_plugins_register_probe_notify_cb(update_plugin_list, ls); | |
2089 | |
2090 gtk_widget_show_all(ret); | |
2091 return ret; | |
2092 } | |
2093 | |
2094 int prefs_notebook_add_page(const char *text, | 1729 int prefs_notebook_add_page(const char *text, |
2095 GdkPixbuf *pixbuf, | 1730 GdkPixbuf *pixbuf, |
2096 GtkWidget *page, | 1731 GtkWidget *page, |
2097 GtkTreeIter *iter, | 1732 GtkTreeIter *iter, |
2098 GtkTreeIter *parent, | 1733 GtkTreeIter *parent, |
2115 #endif | 1750 #endif |
2116 } | 1751 } |
2117 | 1752 |
2118 static void prefs_notebook_init() { | 1753 static void prefs_notebook_init() { |
2119 GtkTreeIter p, c, c2; | 1754 GtkTreeIter p, c, c2; |
2120 GList *l; | |
2121 prefs_notebook_add_page(_("Buddy List"), NULL, list_page(), &c, &p, notebook_page++); | 1755 prefs_notebook_add_page(_("Buddy List"), NULL, list_page(), &c, &p, notebook_page++); |
2122 prefs_notebook_add_page(_("Conversations"), NULL, conv_page(), &c, &p, notebook_page++); | 1756 prefs_notebook_add_page(_("Conversations"), NULL, conv_page(), &c, &p, notebook_page++); |
2123 prefs_notebook_add_page(_("Smiley Themes"), NULL, theme_page(), &c2, &c, notebook_page++); | 1757 prefs_notebook_add_page(_("Smiley Themes"), NULL, theme_page(), &c2, &c, notebook_page++); |
2124 prefs_notebook_add_page(_("Sounds"), NULL, sound_page(), &c, &p, notebook_page++); | 1758 prefs_notebook_add_page(_("Sounds"), NULL, sound_page(), &c, &p, notebook_page++); |
2125 prefs_notebook_add_page(_("Network"), NULL, network_page(), &p, NULL, notebook_page++); | 1759 prefs_notebook_add_page(_("Network"), NULL, network_page(), &p, NULL, notebook_page++); |
2130 prefs_notebook_add_page(_("Browser"), NULL, browser_page(), &p, NULL, notebook_page++); | 1764 prefs_notebook_add_page(_("Browser"), NULL, browser_page(), &p, NULL, notebook_page++); |
2131 } | 1765 } |
2132 #endif | 1766 #endif |
2133 prefs_notebook_add_page(_("Logging"), NULL, logging_page(), &p, NULL, notebook_page++); | 1767 prefs_notebook_add_page(_("Logging"), NULL, logging_page(), &p, NULL, notebook_page++); |
2134 prefs_notebook_add_page(_("Away / Idle"), NULL, away_page(), &p, NULL, notebook_page++); | 1768 prefs_notebook_add_page(_("Away / Idle"), NULL, away_page(), &p, NULL, notebook_page++); |
2135 | |
2136 if (gaim_plugins_enabled()) { | |
2137 prefs_notebook_add_page(_("Plugins"), NULL, plugin_page(), &plugin_iter, NULL, notebook_page++); | |
2138 | |
2139 for (l = gaim_plugins_get_loaded(); l != NULL; l = l->next) { | |
2140 add_plugin_prefs(l->data); | |
2141 } | |
2142 } | |
2143 } | 1769 } |
2144 | 1770 |
2145 void gaim_gtk_prefs_show(void) | 1771 void gaim_gtk_prefs_show(void) |
2146 { | 1772 { |
2147 GtkWidget *vbox; | 1773 GtkWidget *vbox; |
2174 gtk_widget_show(vbox); | 1800 gtk_widget_show(vbox); |
2175 | 1801 |
2176 /* The notebook */ | 1802 /* The notebook */ |
2177 prefsnotebook = notebook = gtk_notebook_new (); | 1803 prefsnotebook = notebook = gtk_notebook_new (); |
2178 gtk_box_pack_start (GTK_BOX (vbox), notebook, FALSE, FALSE, 0); | 1804 gtk_box_pack_start (GTK_BOX (vbox), notebook, FALSE, FALSE, 0); |
2179 | 1805 gtk_widget_show(prefsnotebook); |
2180 | 1806 |
2181 /* The buttons to press! */ | 1807 /* The buttons to press! */ |
2182 bbox = gtk_hbutton_box_new(); | 1808 bbox = gtk_hbutton_box_new(); |
2183 gtk_box_set_spacing(GTK_BOX(bbox), GAIM_HIG_BOX_SPACE); | 1809 gtk_box_set_spacing(GTK_BOX(bbox), GAIM_HIG_BOX_SPACE); |
2184 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); | 1810 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); |
2192 gtk_widget_show(button); | 1818 gtk_widget_show(button); |
2193 | 1819 |
2194 prefs_notebook_init(); | 1820 prefs_notebook_init(); |
2195 | 1821 |
2196 /* Show everything. */ | 1822 /* Show everything. */ |
2197 gtk_widget_show_all(prefs); | 1823 gtk_widget_show(prefs); |
2198 } | 1824 } |
2199 | 1825 |
2200 static void | 1826 static void |
2201 set_bool_pref(GtkWidget *w, const char *key) | 1827 set_bool_pref(GtkWidget *w, const char *key) |
2202 { | 1828 { |