From d707a8758d3e52e43864636da6b90e4f0a3e56ff Mon Sep 17 00:00:00 2001 From: Peter Hatina Date: Mon, 24 Oct 2011 19:53:37 +0200 Subject: [PATCH] Split proxy server and port options into two fields Fixes: https://bugs.launchpad.net/midori/+bug/699986 --- midori/main.c | 9 ++++++--- midori/midori-preferences.c | 8 ++++++++ midori/midori-websettings.c | 25 +++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 3 deletions(-) diff --git a/midori/main.c b/midori/main.c index b46ba2da..79e93d2e 100644 --- a/midori/main.c +++ b/midori/main.c @@ -918,9 +918,12 @@ soup_session_settings_notify_http_proxy_cb (MidoriWebSettings* settings, } else if (proxy_type == MIDORI_PROXY_HTTP) { - gchar* http_proxy = katze_object_get_string (settings, "http-proxy"); - midori_soup_session_set_proxy_uri (session, http_proxy); - g_free (http_proxy); + gchar* proxy = katze_object_get_string (settings, "http-proxy"); + GString *http_proxy = g_string_new (proxy); + g_string_append_printf (http_proxy, ":%d", katze_object_get_int (settings, "http-proxy-port")); + midori_soup_session_set_proxy_uri (session, http_proxy->str); + g_string_free (http_proxy, TRUE); + g_free (proxy); } else midori_soup_session_set_proxy_uri (session, NULL); diff --git a/midori/midori-preferences.c b/midori/midori-preferences.c index 59ade73c..682e91c7 100644 --- a/midori/midori-preferences.c +++ b/midori/midori-preferences.c @@ -461,6 +461,14 @@ midori_preferences_set_settings (MidoriPreferences* preferences, g_signal_connect (settings, "notify::proxy-type", G_CALLBACK (midori_preferences_notify_proxy_type_cb), entry); midori_preferences_notify_proxy_type_cb (settings, NULL, entry); + label = katze_property_label (settings, "http-proxy-port"); + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); + INDENTED_ADD (label); + entry = katze_property_proxy (settings, "http-proxy-port", NULL); + SPANNED_ADD (entry); + g_signal_connect (settings, "notify::proxy-type", + G_CALLBACK (midori_preferences_notify_proxy_type_cb), entry); + midori_preferences_notify_proxy_type_cb (settings, NULL, entry); #endif #if WEBKIT_CHECK_VERSION (1, 3, 11) if (soup_session_get_feature (webkit_get_default_session (), SOUP_TYPE_CACHE)) diff --git a/midori/midori-websettings.c b/midori/midori-websettings.c index e34b546f..b2e29a11 100644 --- a/midori/midori-websettings.c +++ b/midori/midori-websettings.c @@ -78,6 +78,7 @@ struct _MidoriWebSettings gchar* news_aggregator; gchar* location_entry_search; gchar* http_proxy; + gint http_proxy_port; #if WEBKIT_CHECK_VERSION (1, 3, 11) gint maximum_cache_size; #endif @@ -162,6 +163,7 @@ enum PROP_PROXY_TYPE, PROP_HTTP_PROXY, + PROP_HTTP_PROXY_PORT, PROP_MAXIMUM_CACHE_SIZE, PROP_IDENTIFY_AS, PROP_USER_AGENT, @@ -896,6 +898,23 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class) NULL, flags)); + /** + * MidoriWebSettings:http-proxy-port: + * + * The proxy server port used for HTTP connections + * + * Since: 0.4.2 + */ + g_object_class_install_property (gobject_class, + PROP_HTTP_PROXY_PORT, + g_param_spec_int ( + "http-proxy-port", + _("Port"), + _("The proxy server port used for HTTP connections"), + 1, 65535, 8080, + flags + )); + #if WEBKIT_CHECK_VERSION (1, 3, 11) /** * MidoriWebSettings:maximum-cache-size: @@ -1387,6 +1406,9 @@ midori_web_settings_set_property (GObject* object, case PROP_HTTP_PROXY: katze_assign (web_settings->http_proxy, g_value_dup_string (value)); break; + case PROP_HTTP_PROXY_PORT: + web_settings->http_proxy_port = g_value_get_int (value); + break; #if WEBKIT_CHECK_VERSION (1, 3, 11) case PROP_MAXIMUM_CACHE_SIZE: web_settings->maximum_cache_size = g_value_get_int (value); @@ -1648,6 +1670,9 @@ midori_web_settings_get_property (GObject* object, case PROP_HTTP_PROXY: g_value_set_string (value, web_settings->http_proxy); break; + case PROP_HTTP_PROXY_PORT: + g_value_set_int (value, web_settings->http_proxy_port); + break; #if WEBKIT_CHECK_VERSION (1, 3, 11) case PROP_MAXIMUM_CACHE_SIZE: g_value_set_int (value, web_settings->maximum_cache_size);