Split proxy server and port options into two fields

Fixes: https://bugs.launchpad.net/midori/+bug/699986
This commit is contained in:
Peter Hatina 2011-10-24 19:53:37 +02:00 committed by Christian Dywan
parent 990b6b77bd
commit d707a8758d
3 changed files with 39 additions and 3 deletions

View file

@ -918,9 +918,12 @@ soup_session_settings_notify_http_proxy_cb (MidoriWebSettings* settings,
} }
else if (proxy_type == MIDORI_PROXY_HTTP) else if (proxy_type == MIDORI_PROXY_HTTP)
{ {
gchar* http_proxy = katze_object_get_string (settings, "http-proxy"); gchar* proxy = katze_object_get_string (settings, "http-proxy");
midori_soup_session_set_proxy_uri (session, http_proxy); GString *http_proxy = g_string_new (proxy);
g_free (http_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 else
midori_soup_session_set_proxy_uri (session, NULL); midori_soup_session_set_proxy_uri (session, NULL);

View file

@ -461,6 +461,14 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
g_signal_connect (settings, "notify::proxy-type", g_signal_connect (settings, "notify::proxy-type",
G_CALLBACK (midori_preferences_notify_proxy_type_cb), entry); G_CALLBACK (midori_preferences_notify_proxy_type_cb), entry);
midori_preferences_notify_proxy_type_cb (settings, NULL, 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 #endif
#if WEBKIT_CHECK_VERSION (1, 3, 11) #if WEBKIT_CHECK_VERSION (1, 3, 11)
if (soup_session_get_feature (webkit_get_default_session (), SOUP_TYPE_CACHE)) if (soup_session_get_feature (webkit_get_default_session (), SOUP_TYPE_CACHE))

View file

@ -78,6 +78,7 @@ struct _MidoriWebSettings
gchar* news_aggregator; gchar* news_aggregator;
gchar* location_entry_search; gchar* location_entry_search;
gchar* http_proxy; gchar* http_proxy;
gint http_proxy_port;
#if WEBKIT_CHECK_VERSION (1, 3, 11) #if WEBKIT_CHECK_VERSION (1, 3, 11)
gint maximum_cache_size; gint maximum_cache_size;
#endif #endif
@ -162,6 +163,7 @@ enum
PROP_PROXY_TYPE, PROP_PROXY_TYPE,
PROP_HTTP_PROXY, PROP_HTTP_PROXY,
PROP_HTTP_PROXY_PORT,
PROP_MAXIMUM_CACHE_SIZE, PROP_MAXIMUM_CACHE_SIZE,
PROP_IDENTIFY_AS, PROP_IDENTIFY_AS,
PROP_USER_AGENT, PROP_USER_AGENT,
@ -896,6 +898,23 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
NULL, NULL,
flags)); 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) #if WEBKIT_CHECK_VERSION (1, 3, 11)
/** /**
* MidoriWebSettings:maximum-cache-size: * MidoriWebSettings:maximum-cache-size:
@ -1387,6 +1406,9 @@ midori_web_settings_set_property (GObject* object,
case PROP_HTTP_PROXY: case PROP_HTTP_PROXY:
katze_assign (web_settings->http_proxy, g_value_dup_string (value)); katze_assign (web_settings->http_proxy, g_value_dup_string (value));
break; break;
case PROP_HTTP_PROXY_PORT:
web_settings->http_proxy_port = g_value_get_int (value);
break;
#if WEBKIT_CHECK_VERSION (1, 3, 11) #if WEBKIT_CHECK_VERSION (1, 3, 11)
case PROP_MAXIMUM_CACHE_SIZE: case PROP_MAXIMUM_CACHE_SIZE:
web_settings->maximum_cache_size = g_value_get_int (value); 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: case PROP_HTTP_PROXY:
g_value_set_string (value, web_settings->http_proxy); g_value_set_string (value, web_settings->http_proxy);
break; break;
case PROP_HTTP_PROXY_PORT:
g_value_set_int (value, web_settings->http_proxy_port);
break;
#if WEBKIT_CHECK_VERSION (1, 3, 11) #if WEBKIT_CHECK_VERSION (1, 3, 11)
case PROP_MAXIMUM_CACHE_SIZE: case PROP_MAXIMUM_CACHE_SIZE:
g_value_set_int (value, web_settings->maximum_cache_size); g_value_set_int (value, web_settings->maximum_cache_size);