Mercurial > pidgin
changeset 28546: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 |
files | pidgin/gtkprefs.c |
diffstat | 1 files changed, 126 insertions(+), 108 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/gtkprefs.c Wed Nov 11 15:17:28 2009 +0000 +++ b/pidgin/gtkprefs.c Wed Nov 11 15:19:10 2009 +0000 @@ -1971,113 +1971,8 @@ G_CALLBACK(browser_button_clicked_cb), NULL); gtk_box_pack_start(GTK_BOX(hbox), browser_button, FALSE, FALSE, 0); gtk_widget_show(browser_button); - } else { - vbox = pidgin_make_frame(ret, _("Proxy Server")); - prefs_proxy_frame = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); - prefs_proxy_subframe = gtk_vbox_new(FALSE, 0); - - /* This is a global option that affects SOCKS4 usage even with account-specific proxy settings */ - pidgin_prefs_checkbox(_("Use remote _DNS with SOCKS4 proxies"), - "/purple/proxy/socks4_remotedns", prefs_proxy_frame); - gtk_box_pack_start(GTK_BOX(vbox), prefs_proxy_frame, 0, 0, 0); - - pidgin_prefs_dropdown(prefs_proxy_frame, _("Proxy t_ype:"), PURPLE_PREF_STRING, - "/purple/proxy/type", - _("No proxy"), "none", - "SOCKS 4", "socks4", - "SOCKS 5", "socks5", - "HTTP", "http", - _("Use Environmental Settings"), "envvar", - NULL); - gtk_box_pack_start(GTK_BOX(prefs_proxy_frame), prefs_proxy_subframe, 0, 0, 0); - proxy_info = purple_global_proxy_get_info(); - - purple_prefs_connect_callback(prefs, "/purple/proxy/type", - proxy_changed_cb, prefs_proxy_subframe); - - table = gtk_table_new(4, 2, FALSE); - gtk_container_set_border_width(GTK_CONTAINER(table), 0); - gtk_table_set_col_spacings(GTK_TABLE(table), 5); - gtk_table_set_row_spacings(GTK_TABLE(table), 10); - gtk_container_add(GTK_CONTAINER(prefs_proxy_subframe), table); - - - label = gtk_label_new_with_mnemonic(_("_Host:")); - gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); - - entry = gtk_entry_new(); - gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); - gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 0, 1, GTK_FILL, 0, 0, 0); - g_signal_connect(G_OBJECT(entry), "changed", - G_CALLBACK(proxy_print_option), (void *)PROXYHOST); - - if (proxy_info != NULL && purple_proxy_info_get_host(proxy_info)) - gtk_entry_set_text(GTK_ENTRY(entry), - purple_proxy_info_get_host(proxy_info)); - - hbox = gtk_hbox_new(TRUE, 5); - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - pidgin_set_accessible_label (entry, label); - - label = gtk_label_new_with_mnemonic(_("P_ort:")); - gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 2, 3, 0, 1, GTK_FILL, 0, 0, 0); - - entry = gtk_spin_button_new_with_range(0, 65535, 1); - gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); - gtk_table_attach(GTK_TABLE(table), entry, 3, 4, 0, 1, GTK_FILL, 0, 0, 0); - g_signal_connect(G_OBJECT(entry), "changed", - G_CALLBACK(proxy_print_option), (void *)PROXYPORT); - - if (proxy_info != NULL && purple_proxy_info_get_port(proxy_info) != 0) { - char buf[128]; - g_snprintf(buf, sizeof(buf), "%d", - purple_proxy_info_get_port(proxy_info)); - - gtk_entry_set_text(GTK_ENTRY(entry), buf); - } - pidgin_set_accessible_label (entry, label); - - label = gtk_label_new_with_mnemonic(_("User_name:")); - gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0); - - entry = gtk_entry_new(); - gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); - gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 1, 2, GTK_FILL, 0, 0, 0); - g_signal_connect(G_OBJECT(entry), "changed", - G_CALLBACK(proxy_print_option), (void *)PROXYUSER); - - if (proxy_info != NULL && purple_proxy_info_get_username(proxy_info) != NULL) - gtk_entry_set_text(GTK_ENTRY(entry), - purple_proxy_info_get_username(proxy_info)); - - hbox = gtk_hbox_new(TRUE, 5); - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - pidgin_set_accessible_label (entry, label); - - label = gtk_label_new_with_mnemonic(_("Pa_ssword:")); - gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 2, 3, 1, 2, GTK_FILL, 0, 0, 0); - - entry = gtk_entry_new(); - gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); - gtk_table_attach(GTK_TABLE(table), entry, 3, 4, 1, 2, GTK_FILL , 0, 0, 0); - gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); -#if !GTK_CHECK_VERSION(2,16,0) - if (gtk_entry_get_invisible_char(GTK_ENTRY(entry)) == '*') - gtk_entry_set_invisible_char(GTK_ENTRY(entry), PIDGIN_INVISIBLE_CHAR); -#endif /* Less than GTK+ 2.16 */ - g_signal_connect(G_OBJECT(entry), "changed", - G_CALLBACK(proxy_print_option), (void *)PROXYPASS); - - if (proxy_info != NULL && purple_proxy_info_get_password(proxy_info) != NULL) - gtk_entry_set_text(GTK_ENTRY(entry), - purple_proxy_info_get_password(proxy_info)); - pidgin_set_accessible_label (entry, label); } - + gtk_widget_show_all(ret); g_object_unref(sg); /* Only hide table if not running gnome otherwise we hide the IP address table! */ @@ -2259,6 +2154,125 @@ #endif /*_WIN32*/ static GtkWidget * +proxy_page(void) +{ + GtkWidget *ret = NULL, *vbox = NULL, *hbox = NULL; + GtkWidget *table = NULL, *entry = NULL, *label = NULL; + PurpleProxyInfo *proxy_info; + + ret = gtk_vbox_new(FALSE, PIDGIN_HIG_CAT_SPACE); + + vbox = pidgin_make_frame(ret, _("Proxy Server")); + prefs_proxy_frame = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); + prefs_proxy_subframe = gtk_vbox_new(FALSE, 0); + + /* This is a global option that affects SOCKS4 usage even with account-specific proxy settings */ + pidgin_prefs_checkbox(_("Use remote _DNS with SOCKS4 proxies"), + "/purple/proxy/socks4_remotedns", prefs_proxy_frame); + gtk_box_pack_start(GTK_BOX(vbox), prefs_proxy_frame, 0, 0, 0); + + pidgin_prefs_dropdown(prefs_proxy_frame, _("Proxy t_ype:"), PURPLE_PREF_STRING, + "/purple/proxy/type", + _("No proxy"), "none", + "SOCKS 4", "socks4", + "SOCKS 5", "socks5", + "HTTP", "http", + _("Use Environmental Settings"), "envvar", + NULL); + gtk_box_pack_start(GTK_BOX(prefs_proxy_frame), prefs_proxy_subframe, 0, 0, 0); + proxy_info = purple_global_proxy_get_info(); + + gtk_widget_show_all(ret); + + purple_prefs_connect_callback(prefs, "/purple/proxy/type", + proxy_changed_cb, prefs_proxy_subframe); + + table = gtk_table_new(4, 2, FALSE); + gtk_container_set_border_width(GTK_CONTAINER(table), 0); + gtk_table_set_col_spacings(GTK_TABLE(table), 5); + gtk_table_set_row_spacings(GTK_TABLE(table), 10); + gtk_container_add(GTK_CONTAINER(prefs_proxy_subframe), table); + + + label = gtk_label_new_with_mnemonic(_("_Host:")); + gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); + gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); + + entry = gtk_entry_new(); + gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); + gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 0, 1, GTK_FILL, 0, 0, 0); + g_signal_connect(G_OBJECT(entry), "changed", + G_CALLBACK(proxy_print_option), (void *)PROXYHOST); + + if (proxy_info != NULL && purple_proxy_info_get_host(proxy_info)) + gtk_entry_set_text(GTK_ENTRY(entry), + purple_proxy_info_get_host(proxy_info)); + + hbox = gtk_hbox_new(TRUE, 5); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + pidgin_set_accessible_label (entry, label); + + label = gtk_label_new_with_mnemonic(_("P_ort:")); + gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); + gtk_table_attach(GTK_TABLE(table), label, 2, 3, 0, 1, GTK_FILL, 0, 0, 0); + + entry = gtk_spin_button_new_with_range(0, 65535, 1); + gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); + gtk_table_attach(GTK_TABLE(table), entry, 3, 4, 0, 1, GTK_FILL, 0, 0, 0); + g_signal_connect(G_OBJECT(entry), "changed", + G_CALLBACK(proxy_print_option), (void *)PROXYPORT); + + if (proxy_info != NULL && purple_proxy_info_get_port(proxy_info) != 0) { + char buf[128]; + g_snprintf(buf, sizeof(buf), "%d", + purple_proxy_info_get_port(proxy_info)); + + gtk_entry_set_text(GTK_ENTRY(entry), buf); + } + pidgin_set_accessible_label (entry, label); + + label = gtk_label_new_with_mnemonic(_("User_name:")); + gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); + gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0); + + entry = gtk_entry_new(); + gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); + gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 1, 2, GTK_FILL, 0, 0, 0); + g_signal_connect(G_OBJECT(entry), "changed", + G_CALLBACK(proxy_print_option), (void *)PROXYUSER); + + if (proxy_info != NULL && purple_proxy_info_get_username(proxy_info) != NULL) + gtk_entry_set_text(GTK_ENTRY(entry), + purple_proxy_info_get_username(proxy_info)); + + hbox = gtk_hbox_new(TRUE, 5); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + pidgin_set_accessible_label (entry, label); + + label = gtk_label_new_with_mnemonic(_("Pa_ssword:")); + gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); + gtk_table_attach(GTK_TABLE(table), label, 2, 3, 1, 2, GTK_FILL, 0, 0, 0); + + entry = gtk_entry_new(); + gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); + gtk_table_attach(GTK_TABLE(table), entry, 3, 4, 1, 2, GTK_FILL , 0, 0, 0); + gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); +#if !GTK_CHECK_VERSION(2,16,0) + if (gtk_entry_get_invisible_char(GTK_ENTRY(entry)) == '*') + gtk_entry_set_invisible_char(GTK_ENTRY(entry), PIDGIN_INVISIBLE_CHAR); +#endif /* Less than GTK+ 2.16 */ + g_signal_connect(G_OBJECT(entry), "changed", + G_CALLBACK(proxy_print_option), (void *)PROXYPASS); + + if (proxy_info != NULL && purple_proxy_info_get_password(proxy_info) != NULL) + gtk_entry_set_text(GTK_ENTRY(entry), + purple_proxy_info_get_password(proxy_info)); + pidgin_set_accessible_label (entry, label); + + return ret; +} + +static GtkWidget * logging_page(void) { GtkWidget *ret; @@ -2845,13 +2859,17 @@ prefs_notebook_add_page(_("Smiley Themes"), theme_page(), notebook_page++); prefs_notebook_add_page(_("Sounds"), sound_page(), notebook_page++); prefs_notebook_add_page(_("Network"), network_page(), notebook_page++); + #ifndef _WIN32 /* We use the registered default browser in windows */ /* if the user is running gnome 2.x or Mac OS X, hide the browsers tab */ - if ((purple_running_gnome() == FALSE) && (purple_running_osx() == FALSE)) { + if((purple_running_gnome() == FALSE) && (purple_running_osx() == FALSE)) prefs_notebook_add_page(_("Browser"), browser_page(), notebook_page++); - } #endif + + if(purple_running_gnome() == FALSE) + prefs_notebook_add_page(_("Proxy"), proxy_page(), notebook_page++); + prefs_notebook_add_page(_("Logging"), logging_page(), notebook_page++); prefs_notebook_add_page(_("Status / Idle"), away_page(), notebook_page++); }