]> spindle.queued.net Git - midori/commitdiff
Split proxy server and port options into two fields
authorPeter Hatina <phatina@redhat.com>
Mon, 24 Oct 2011 17:53:37 +0000 (19:53 +0200)
committerChristian Dywan <christian@twotoasts.de>
Mon, 24 Oct 2011 23:22:29 +0000 (01:22 +0200)
Fixes: https://bugs.launchpad.net/midori/+bug/699986
midori/main.c
midori/midori-preferences.c
midori/midori-websettings.c

index b46ba2da411d70d75dd65dea033a836629815ea3..79e93d2eefd5b5e4524e64327e4f42851f3ede06 100644 (file)
@@ -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);
index 59ade73c45f9fa69ce1d3fa2374fbb3c9f0da2ed..682e91c719b66899e62c4ab2015aad39cf705e8b 100644 (file)
@@ -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))
index e34b546fbb06ff6b08704ac2607638e714046cfe..b2e29a1114bab4d347eff2a99547aa699eb56742 100644 (file)
@@ -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);