Mercurial > pidgin.yaz
comparison pidgin/gtkprefs.c @ 28925:a8e0ad5a7ada
Move the proxy stuff to a separate tab, per deryni's suggestion.
author | John Bailey <rekkanoryo@rekkanoryo.org> |
---|---|
date | Wed, 11 Nov 2009 15:19:10 +0000 |
parents | 0c8fe27c6dd8 |
children | 45100d41c9ff |
comparison
equal
deleted
inserted
replaced
28924:0c8fe27c6dd8 | 28925:a8e0ad5a7ada |
---|---|
1969 browser_button = gtk_button_new_with_mnemonic(_("Configure _Browser")); | 1969 browser_button = gtk_button_new_with_mnemonic(_("Configure _Browser")); |
1970 g_signal_connect(G_OBJECT(browser_button), "clicked", | 1970 g_signal_connect(G_OBJECT(browser_button), "clicked", |
1971 G_CALLBACK(browser_button_clicked_cb), NULL); | 1971 G_CALLBACK(browser_button_clicked_cb), NULL); |
1972 gtk_box_pack_start(GTK_BOX(hbox), browser_button, FALSE, FALSE, 0); | 1972 gtk_box_pack_start(GTK_BOX(hbox), browser_button, FALSE, FALSE, 0); |
1973 gtk_widget_show(browser_button); | 1973 gtk_widget_show(browser_button); |
1974 } else { | 1974 } |
1975 vbox = pidgin_make_frame(ret, _("Proxy Server")); | 1975 |
1976 prefs_proxy_frame = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); | |
1977 prefs_proxy_subframe = gtk_vbox_new(FALSE, 0); | |
1978 | |
1979 /* This is a global option that affects SOCKS4 usage even with account-specific proxy settings */ | |
1980 pidgin_prefs_checkbox(_("Use remote _DNS with SOCKS4 proxies"), | |
1981 "/purple/proxy/socks4_remotedns", prefs_proxy_frame); | |
1982 gtk_box_pack_start(GTK_BOX(vbox), prefs_proxy_frame, 0, 0, 0); | |
1983 | |
1984 pidgin_prefs_dropdown(prefs_proxy_frame, _("Proxy t_ype:"), PURPLE_PREF_STRING, | |
1985 "/purple/proxy/type", | |
1986 _("No proxy"), "none", | |
1987 "SOCKS 4", "socks4", | |
1988 "SOCKS 5", "socks5", | |
1989 "HTTP", "http", | |
1990 _("Use Environmental Settings"), "envvar", | |
1991 NULL); | |
1992 gtk_box_pack_start(GTK_BOX(prefs_proxy_frame), prefs_proxy_subframe, 0, 0, 0); | |
1993 proxy_info = purple_global_proxy_get_info(); | |
1994 | |
1995 purple_prefs_connect_callback(prefs, "/purple/proxy/type", | |
1996 proxy_changed_cb, prefs_proxy_subframe); | |
1997 | |
1998 table = gtk_table_new(4, 2, FALSE); | |
1999 gtk_container_set_border_width(GTK_CONTAINER(table), 0); | |
2000 gtk_table_set_col_spacings(GTK_TABLE(table), 5); | |
2001 gtk_table_set_row_spacings(GTK_TABLE(table), 10); | |
2002 gtk_container_add(GTK_CONTAINER(prefs_proxy_subframe), table); | |
2003 | |
2004 | |
2005 label = gtk_label_new_with_mnemonic(_("_Host:")); | |
2006 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); | |
2007 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); | |
2008 | |
2009 entry = gtk_entry_new(); | |
2010 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
2011 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 0, 1, GTK_FILL, 0, 0, 0); | |
2012 g_signal_connect(G_OBJECT(entry), "changed", | |
2013 G_CALLBACK(proxy_print_option), (void *)PROXYHOST); | |
2014 | |
2015 if (proxy_info != NULL && purple_proxy_info_get_host(proxy_info)) | |
2016 gtk_entry_set_text(GTK_ENTRY(entry), | |
2017 purple_proxy_info_get_host(proxy_info)); | |
2018 | |
2019 hbox = gtk_hbox_new(TRUE, 5); | |
2020 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
2021 pidgin_set_accessible_label (entry, label); | |
2022 | |
2023 label = gtk_label_new_with_mnemonic(_("P_ort:")); | |
2024 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); | |
2025 gtk_table_attach(GTK_TABLE(table), label, 2, 3, 0, 1, GTK_FILL, 0, 0, 0); | |
2026 | |
2027 entry = gtk_spin_button_new_with_range(0, 65535, 1); | |
2028 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
2029 gtk_table_attach(GTK_TABLE(table), entry, 3, 4, 0, 1, GTK_FILL, 0, 0, 0); | |
2030 g_signal_connect(G_OBJECT(entry), "changed", | |
2031 G_CALLBACK(proxy_print_option), (void *)PROXYPORT); | |
2032 | |
2033 if (proxy_info != NULL && purple_proxy_info_get_port(proxy_info) != 0) { | |
2034 char buf[128]; | |
2035 g_snprintf(buf, sizeof(buf), "%d", | |
2036 purple_proxy_info_get_port(proxy_info)); | |
2037 | |
2038 gtk_entry_set_text(GTK_ENTRY(entry), buf); | |
2039 } | |
2040 pidgin_set_accessible_label (entry, label); | |
2041 | |
2042 label = gtk_label_new_with_mnemonic(_("User_name:")); | |
2043 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); | |
2044 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0); | |
2045 | |
2046 entry = gtk_entry_new(); | |
2047 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
2048 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 1, 2, GTK_FILL, 0, 0, 0); | |
2049 g_signal_connect(G_OBJECT(entry), "changed", | |
2050 G_CALLBACK(proxy_print_option), (void *)PROXYUSER); | |
2051 | |
2052 if (proxy_info != NULL && purple_proxy_info_get_username(proxy_info) != NULL) | |
2053 gtk_entry_set_text(GTK_ENTRY(entry), | |
2054 purple_proxy_info_get_username(proxy_info)); | |
2055 | |
2056 hbox = gtk_hbox_new(TRUE, 5); | |
2057 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
2058 pidgin_set_accessible_label (entry, label); | |
2059 | |
2060 label = gtk_label_new_with_mnemonic(_("Pa_ssword:")); | |
2061 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); | |
2062 gtk_table_attach(GTK_TABLE(table), label, 2, 3, 1, 2, GTK_FILL, 0, 0, 0); | |
2063 | |
2064 entry = gtk_entry_new(); | |
2065 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
2066 gtk_table_attach(GTK_TABLE(table), entry, 3, 4, 1, 2, GTK_FILL , 0, 0, 0); | |
2067 gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); | |
2068 #if !GTK_CHECK_VERSION(2,16,0) | |
2069 if (gtk_entry_get_invisible_char(GTK_ENTRY(entry)) == '*') | |
2070 gtk_entry_set_invisible_char(GTK_ENTRY(entry), PIDGIN_INVISIBLE_CHAR); | |
2071 #endif /* Less than GTK+ 2.16 */ | |
2072 g_signal_connect(G_OBJECT(entry), "changed", | |
2073 G_CALLBACK(proxy_print_option), (void *)PROXYPASS); | |
2074 | |
2075 if (proxy_info != NULL && purple_proxy_info_get_password(proxy_info) != NULL) | |
2076 gtk_entry_set_text(GTK_ENTRY(entry), | |
2077 purple_proxy_info_get_password(proxy_info)); | |
2078 pidgin_set_accessible_label (entry, label); | |
2079 } | |
2080 | |
2081 gtk_widget_show_all(ret); | 1976 gtk_widget_show_all(ret); |
2082 g_object_unref(sg); | 1977 g_object_unref(sg); |
2083 /* Only hide table if not running gnome otherwise we hide the IP address table! */ | 1978 /* Only hide table if not running gnome otherwise we hide the IP address table! */ |
2084 if (!purple_running_gnome() && (proxy_info == NULL || | 1979 if (!purple_running_gnome() && (proxy_info == NULL || |
2085 purple_proxy_info_get_type(proxy_info) == PURPLE_PROXY_NONE || | 1980 purple_proxy_info_get_type(proxy_info) == PURPLE_PROXY_NONE || |
2257 return ret; | 2152 return ret; |
2258 } | 2153 } |
2259 #endif /*_WIN32*/ | 2154 #endif /*_WIN32*/ |
2260 | 2155 |
2261 static GtkWidget * | 2156 static GtkWidget * |
2157 proxy_page(void) | |
2158 { | |
2159 GtkWidget *ret = NULL, *vbox = NULL, *hbox = NULL; | |
2160 GtkWidget *table = NULL, *entry = NULL, *label = NULL; | |
2161 PurpleProxyInfo *proxy_info; | |
2162 | |
2163 ret = gtk_vbox_new(FALSE, PIDGIN_HIG_CAT_SPACE); | |
2164 | |
2165 vbox = pidgin_make_frame(ret, _("Proxy Server")); | |
2166 prefs_proxy_frame = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); | |
2167 prefs_proxy_subframe = gtk_vbox_new(FALSE, 0); | |
2168 | |
2169 /* This is a global option that affects SOCKS4 usage even with account-specific proxy settings */ | |
2170 pidgin_prefs_checkbox(_("Use remote _DNS with SOCKS4 proxies"), | |
2171 "/purple/proxy/socks4_remotedns", prefs_proxy_frame); | |
2172 gtk_box_pack_start(GTK_BOX(vbox), prefs_proxy_frame, 0, 0, 0); | |
2173 | |
2174 pidgin_prefs_dropdown(prefs_proxy_frame, _("Proxy t_ype:"), PURPLE_PREF_STRING, | |
2175 "/purple/proxy/type", | |
2176 _("No proxy"), "none", | |
2177 "SOCKS 4", "socks4", | |
2178 "SOCKS 5", "socks5", | |
2179 "HTTP", "http", | |
2180 _("Use Environmental Settings"), "envvar", | |
2181 NULL); | |
2182 gtk_box_pack_start(GTK_BOX(prefs_proxy_frame), prefs_proxy_subframe, 0, 0, 0); | |
2183 proxy_info = purple_global_proxy_get_info(); | |
2184 | |
2185 gtk_widget_show_all(ret); | |
2186 | |
2187 purple_prefs_connect_callback(prefs, "/purple/proxy/type", | |
2188 proxy_changed_cb, prefs_proxy_subframe); | |
2189 | |
2190 table = gtk_table_new(4, 2, FALSE); | |
2191 gtk_container_set_border_width(GTK_CONTAINER(table), 0); | |
2192 gtk_table_set_col_spacings(GTK_TABLE(table), 5); | |
2193 gtk_table_set_row_spacings(GTK_TABLE(table), 10); | |
2194 gtk_container_add(GTK_CONTAINER(prefs_proxy_subframe), table); | |
2195 | |
2196 | |
2197 label = gtk_label_new_with_mnemonic(_("_Host:")); | |
2198 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); | |
2199 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); | |
2200 | |
2201 entry = gtk_entry_new(); | |
2202 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
2203 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 0, 1, GTK_FILL, 0, 0, 0); | |
2204 g_signal_connect(G_OBJECT(entry), "changed", | |
2205 G_CALLBACK(proxy_print_option), (void *)PROXYHOST); | |
2206 | |
2207 if (proxy_info != NULL && purple_proxy_info_get_host(proxy_info)) | |
2208 gtk_entry_set_text(GTK_ENTRY(entry), | |
2209 purple_proxy_info_get_host(proxy_info)); | |
2210 | |
2211 hbox = gtk_hbox_new(TRUE, 5); | |
2212 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
2213 pidgin_set_accessible_label (entry, label); | |
2214 | |
2215 label = gtk_label_new_with_mnemonic(_("P_ort:")); | |
2216 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); | |
2217 gtk_table_attach(GTK_TABLE(table), label, 2, 3, 0, 1, GTK_FILL, 0, 0, 0); | |
2218 | |
2219 entry = gtk_spin_button_new_with_range(0, 65535, 1); | |
2220 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
2221 gtk_table_attach(GTK_TABLE(table), entry, 3, 4, 0, 1, GTK_FILL, 0, 0, 0); | |
2222 g_signal_connect(G_OBJECT(entry), "changed", | |
2223 G_CALLBACK(proxy_print_option), (void *)PROXYPORT); | |
2224 | |
2225 if (proxy_info != NULL && purple_proxy_info_get_port(proxy_info) != 0) { | |
2226 char buf[128]; | |
2227 g_snprintf(buf, sizeof(buf), "%d", | |
2228 purple_proxy_info_get_port(proxy_info)); | |
2229 | |
2230 gtk_entry_set_text(GTK_ENTRY(entry), buf); | |
2231 } | |
2232 pidgin_set_accessible_label (entry, label); | |
2233 | |
2234 label = gtk_label_new_with_mnemonic(_("User_name:")); | |
2235 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); | |
2236 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0); | |
2237 | |
2238 entry = gtk_entry_new(); | |
2239 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
2240 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 1, 2, GTK_FILL, 0, 0, 0); | |
2241 g_signal_connect(G_OBJECT(entry), "changed", | |
2242 G_CALLBACK(proxy_print_option), (void *)PROXYUSER); | |
2243 | |
2244 if (proxy_info != NULL && purple_proxy_info_get_username(proxy_info) != NULL) | |
2245 gtk_entry_set_text(GTK_ENTRY(entry), | |
2246 purple_proxy_info_get_username(proxy_info)); | |
2247 | |
2248 hbox = gtk_hbox_new(TRUE, 5); | |
2249 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
2250 pidgin_set_accessible_label (entry, label); | |
2251 | |
2252 label = gtk_label_new_with_mnemonic(_("Pa_ssword:")); | |
2253 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); | |
2254 gtk_table_attach(GTK_TABLE(table), label, 2, 3, 1, 2, GTK_FILL, 0, 0, 0); | |
2255 | |
2256 entry = gtk_entry_new(); | |
2257 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
2258 gtk_table_attach(GTK_TABLE(table), entry, 3, 4, 1, 2, GTK_FILL , 0, 0, 0); | |
2259 gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); | |
2260 #if !GTK_CHECK_VERSION(2,16,0) | |
2261 if (gtk_entry_get_invisible_char(GTK_ENTRY(entry)) == '*') | |
2262 gtk_entry_set_invisible_char(GTK_ENTRY(entry), PIDGIN_INVISIBLE_CHAR); | |
2263 #endif /* Less than GTK+ 2.16 */ | |
2264 g_signal_connect(G_OBJECT(entry), "changed", | |
2265 G_CALLBACK(proxy_print_option), (void *)PROXYPASS); | |
2266 | |
2267 if (proxy_info != NULL && purple_proxy_info_get_password(proxy_info) != NULL) | |
2268 gtk_entry_set_text(GTK_ENTRY(entry), | |
2269 purple_proxy_info_get_password(proxy_info)); | |
2270 pidgin_set_accessible_label (entry, label); | |
2271 | |
2272 return ret; | |
2273 } | |
2274 | |
2275 static GtkWidget * | |
2262 logging_page(void) | 2276 logging_page(void) |
2263 { | 2277 { |
2264 GtkWidget *ret; | 2278 GtkWidget *ret; |
2265 GtkWidget *vbox; | 2279 GtkWidget *vbox; |
2266 GList *names; | 2280 GList *names; |
2843 prefs_notebook_add_page(_("Interface"), interface_page(), notebook_page++); | 2857 prefs_notebook_add_page(_("Interface"), interface_page(), notebook_page++); |
2844 prefs_notebook_add_page(_("Conversations"), conv_page(), notebook_page++); | 2858 prefs_notebook_add_page(_("Conversations"), conv_page(), notebook_page++); |
2845 prefs_notebook_add_page(_("Smiley Themes"), theme_page(), notebook_page++); | 2859 prefs_notebook_add_page(_("Smiley Themes"), theme_page(), notebook_page++); |
2846 prefs_notebook_add_page(_("Sounds"), sound_page(), notebook_page++); | 2860 prefs_notebook_add_page(_("Sounds"), sound_page(), notebook_page++); |
2847 prefs_notebook_add_page(_("Network"), network_page(), notebook_page++); | 2861 prefs_notebook_add_page(_("Network"), network_page(), notebook_page++); |
2862 | |
2848 #ifndef _WIN32 | 2863 #ifndef _WIN32 |
2849 /* We use the registered default browser in windows */ | 2864 /* We use the registered default browser in windows */ |
2850 /* if the user is running gnome 2.x or Mac OS X, hide the browsers tab */ | 2865 /* if the user is running gnome 2.x or Mac OS X, hide the browsers tab */ |
2851 if ((purple_running_gnome() == FALSE) && (purple_running_osx() == FALSE)) { | 2866 if((purple_running_gnome() == FALSE) && (purple_running_osx() == FALSE)) |
2852 prefs_notebook_add_page(_("Browser"), browser_page(), notebook_page++); | 2867 prefs_notebook_add_page(_("Browser"), browser_page(), notebook_page++); |
2853 } | |
2854 #endif | 2868 #endif |
2869 | |
2870 if(purple_running_gnome() == FALSE) | |
2871 prefs_notebook_add_page(_("Proxy"), proxy_page(), notebook_page++); | |
2872 | |
2855 prefs_notebook_add_page(_("Logging"), logging_page(), notebook_page++); | 2873 prefs_notebook_add_page(_("Logging"), logging_page(), notebook_page++); |
2856 prefs_notebook_add_page(_("Status / Idle"), away_page(), notebook_page++); | 2874 prefs_notebook_add_page(_("Status / Idle"), away_page(), notebook_page++); |
2857 } | 2875 } |
2858 | 2876 |
2859 void | 2877 void |