GParamSpec* pspec,
SoupSession* session)
{
+ gboolean auto_detect_proxy;
gchar* http_proxy;
SoupURI* proxy_uri;
- http_proxy = katze_object_get_string (settings, "http-proxy");
+ auto_detect_proxy = katze_object_get_boolean (settings, "auto-detect-proxy");
+ if (auto_detect_proxy)
+ http_proxy = g_strdup (g_getenv ("http_proxy"));
+ else
+ http_proxy = katze_object_get_string (settings, "http-proxy");
+ g_debug (http_proxy);
/* soup_uri_new expects a non-NULL string */
proxy_uri = soup_uri_new (http_proxy ? http_proxy : "");
g_free (http_proxy);
g_object_set (session, "proxy-uri", proxy_uri, NULL);
+ if (proxy_uri)
+ soup_uri_free (proxy_uri);
}
static void
soup_session_settings_notify_ident_string_cb (settings, NULL, session);
g_signal_connect (settings, "notify::http-proxy",
G_CALLBACK (soup_session_settings_notify_http_proxy_cb), object);
+ g_signal_connect (settings, "notify::auto-detect-proxy",
+ G_CALLBACK (soup_session_settings_notify_http_proxy_cb), object);
g_signal_connect (settings, "notify::ident-string",
G_CALLBACK (soup_session_settings_notify_ident_string_cb), object);
}
#if HAVE_LIBSOUP
+static void
+midori_preferences_notify_auto_detect_proxy_cb (MidoriWebSettings* settings,
+ GParamSpec* pspec,
+ GtkWidget* entry)
+{
+ MidoriIdentity auto_detect_proxy = katze_object_get_enum (settings,
+ "auto-detect-proxy");
+
+ gtk_widget_set_sensitive (entry, !auto_detect_proxy);
+}
+
static void
midori_preferences_notify_identify_as_cb (MidoriWebSettings* settings,
GParamSpec* pspec,
{
PAGE_NEW (GTK_STOCK_NETWORK, _("Network"));
FRAME_NEW (_("Network"));
- TABLE_NEW (4, 2);
+ TABLE_NEW (5, 2);
label = katze_property_label (settings, "http-proxy");
INDENTED_ADD (label, 0, 1, 0, 1);
- button = katze_property_proxy (settings, "http-proxy", NULL);
- FILLED_ADD (button, 1, 2, 0, 1);
+ entry = katze_property_proxy (settings, "http-proxy", NULL);
+ FILLED_ADD (entry, 1, 2, 0, 1);
+ button = katze_property_proxy (settings, "auto-detect-proxy", NULL);
+ FILLED_ADD (button, 1, 2, 1, 2);
+ g_signal_connect (settings, "notify::auto-detect-proxy",
+ G_CALLBACK (midori_preferences_notify_auto_detect_proxy_cb), entry);
+ midori_preferences_notify_auto_detect_proxy_cb (settings, NULL, entry);
label = katze_property_label (settings, "identify-as");
- INDENTED_ADD (label, 0, 1, 1, 2);
+ INDENTED_ADD (label, 0, 1, 2, 3);
button = katze_property_proxy (settings, "identify-as", NULL);
- FILLED_ADD (button, 1, 2, 1, 2);
+ FILLED_ADD (button, 1, 2, 2, 3);
label = katze_property_label (settings, "ident-string");
- INDENTED_ADD (label, 0, 1, 2, 3);
+ INDENTED_ADD (label, 0, 1, 3, 4);
entry = katze_property_proxy (settings, "ident-string", NULL);
g_signal_connect (settings, "notify::identify-as",
G_CALLBACK (midori_preferences_notify_identify_as_cb), entry);
midori_preferences_notify_identify_as_cb (settings, NULL, entry);
- FILLED_ADD (entry, 1, 2, 2, 3);
+ FILLED_ADD (entry, 1, 2, 3, 4);
label = katze_property_label (settings, "cache-size");
- INDENTED_ADD (label, 0, 1, 3, 4);
+ INDENTED_ADD (label, 0, 1, 4, 5);
hbox = gtk_hbox_new (FALSE, 4);
entry = katze_property_proxy (settings, "cache-size", NULL);
gtk_box_pack_start (GTK_BOX (hbox), entry, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), gtk_label_new (_("MB")),
FALSE, FALSE, 0);
- FILLED_ADD (hbox, 1, 2, 3, 4);
+ FILLED_ADD (hbox, 1, 2, 4, 5);
}
#endif
gboolean remember_last_downloaded_files;
gchar* http_proxy;
+ gboolean auto_detect_proxy;
MidoriIdentity identify_as;
gchar* ident_string;
gint cache_size;
PROP_REMEMBER_LAST_DOWNLOADED_FILES,
PROP_HTTP_PROXY,
+ PROP_AUTO_DETECT_PROXY,
PROP_IDENTIFY_AS,
PROP_IDENT_STRING,
PROP_CACHE_SIZE
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
#endif
+ /**
+ * MidoriWebSettings:auto-detect-proxy:
+ *
+ * Whether to detect the proxy server automatically from the environment
+ *
+ * Since: 0.1.3
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_AUTO_DETECT_PROXY,
+ g_param_spec_boolean (
+ "auto-detect-proxy",
+ _("Detect proxy server automatically"),
+ _("Whether to detect the proxy server automatically from the environment"),
+ TRUE,
+ #if HAVE_LIBSOUP
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ #else
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+ #endif
+
/**
* MidoriWebSettings:identify-as:
*
case PROP_HTTP_PROXY:
katze_assign (web_settings->http_proxy, g_value_dup_string (value));
break;
+ case PROP_AUTO_DETECT_PROXY:
+ web_settings->auto_detect_proxy = g_value_get_boolean (value);
+ break;
case PROP_IDENTIFY_AS:
web_settings->identify_as = g_value_get_enum (value);
if (web_settings->identify_as != MIDORI_IDENT_CUSTOM)
case PROP_HTTP_PROXY:
g_value_set_string (value, web_settings->http_proxy);
break;
+ case PROP_AUTO_DETECT_PROXY:
+ g_value_set_boolean (value, web_settings->auto_detect_proxy);
+ break;
case PROP_IDENTIFY_AS:
g_value_set_enum (value, web_settings->identify_as);
break;