GParamSpec* pspec,
SoupSession* session)
{
- gboolean auto_detect_proxy;
+ MidoriProxy proxy_type;
- auto_detect_proxy = katze_object_get_boolean (settings, "auto-detect-proxy");
- if (auto_detect_proxy)
+ proxy_type = katze_object_get_enum (settings, "proxy-type");
+ if (proxy_type == MIDORI_PROXY_AUTOMATIC)
{
gboolean gnome_supported = FALSE;
GModule* module;
if (!gnome_supported)
midori_soup_session_set_proxy_uri (session, g_getenv ("http_proxy"));
}
- else
+ 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);
}
+ else
+ midori_soup_session_set_proxy_uri (session, NULL);
}
#if !WEBKIT_CHECK_VERSION (1, 1, 11)
#if !HAVE_HILDON
static void
-midori_preferences_notify_auto_detect_proxy_cb (MidoriWebSettings* settings,
- GParamSpec* pspec,
- GtkWidget* entry)
+midori_preferences_notify_proxy_type_cb (MidoriWebSettings* settings,
+ GParamSpec* pspec,
+ GtkWidget* entry)
{
- MidoriIdentity auto_detect_proxy = katze_object_get_enum (settings,
- "auto-detect-proxy");
+ MidoriProxy proxy_type = katze_object_get_enum (settings, "proxy-type");
- gtk_widget_set_sensitive (entry, !auto_detect_proxy);
+ gtk_widget_set_sensitive (entry, proxy_type == MIDORI_PROXY_HTTP);
}
#endif
PAGE_NEW (GTK_STOCK_NETWORK, _("Network"));
FRAME_NEW (_("Network"));
#if !HAVE_HILDON
- label = katze_property_label (settings, "http-proxy");
+ label = katze_property_label (settings, "proxy-type");
+ INDENTED_ADD (label);
+ button = katze_property_proxy (settings, "proxy-type", NULL);
+ SPANNED_ADD (button);
+ label = gtk_label_new (_("Hostname"));
INDENTED_ADD (label);
entry = katze_property_proxy (settings, "http-proxy", NULL);
SPANNED_ADD (entry);
- INDENTED_ADD (gtk_event_box_new ());
- button = katze_property_proxy (settings, "auto-detect-proxy", NULL);
- SPANNED_ADD (button);
- 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);
+ 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
label = katze_property_label (settings, "identify-as");
INDENTED_ADD (label);
/*
- Copyright (C) 2008-2009 Christian Dywan <christian@twotoasts.de>
+ Copyright (C) 2008-2010 Christian Dywan <christian@twotoasts.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
gint maximum_history_age;
gboolean remember_last_downloaded_files;
+ MidoriProxy proxy_type;
gchar* http_proxy;
gchar* http_accept_language;
gboolean auto_detect_proxy;
PROP_MAXIMUM_HISTORY_AGE,
PROP_REMEMBER_LAST_DOWNLOADED_FILES,
+ PROP_PROXY_TYPE,
PROP_HTTP_PROXY,
PROP_AUTO_DETECT_PROXY,
PROP_IDENTIFY_AS,
return type;
}
+GType
+midori_proxy_get_type (void)
+{
+ static GType type = 0;
+ if (!type)
+ {
+ static const GEnumValue values[] = {
+ { MIDORI_PROXY_AUTOMATIC, "MIDORI_PROXY_AUTOMATIC", N_("Automatic (GNOME or environment)") },
+ { MIDORI_PROXY_HTTP, "MIDORI_PROXY_HTTP", N_("HTTP proxy server") },
+ { MIDORI_PROXY_NONE, "MIDORI_PROXY_NONE", N_("No proxy server") },
+ { 0, NULL, NULL }
+ };
+ type = g_enum_register_static ("MidoriProxy", values);
+ }
+ return type;
+}
+
GType
midori_accept_cookies_get_type (void)
{
+ /**
+ * MidoriWebSettings:proxy-type:
+ *
+ * The type of proxy server to use.
+ *
+ * Since: 0.2.5
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_PROXY_TYPE,
+ g_param_spec_enum (
+ "proxy-type",
+ _("Proxy server"),
+ _("The type of proxy server to use"),
+ MIDORI_TYPE_PROXY,
+ MIDORI_PROXY_AUTOMATIC,
+ flags));
+
g_object_class_install_property (gobject_class,
PROP_HTTP_PROXY,
g_param_spec_string (
"http-proxy",
- _("Proxy Server"),
+ _("HTTP Proxy Server"),
_("The proxy server used for HTTP connections"),
NULL,
flags));
/**
- * MidoriWebSettings:auto-detect-proxy:
- *
- * Whether to detect the proxy server automatically from the environment
- *
- * Since: 0.1.3
- */
+ * MidoriWebSettings:auto-detect-proxy:
+ *
+ * Whether to detect the proxy server automatically from the environment
+ *
+ * Deprecated: 0.2.5
+ */
g_object_class_install_property (gobject_class,
PROP_AUTO_DETECT_PROXY,
g_param_spec_boolean (
web_settings->remember_last_downloaded_files = g_value_get_boolean (value);
break;
+ case PROP_PROXY_TYPE:
+ web_settings->proxy_type = g_value_get_enum (value);
+ web_settings->auto_detect_proxy =
+ web_settings->proxy_type == MIDORI_PROXY_AUTOMATIC
+ ? TRUE : FALSE;
+ g_object_notify (object, "auto-detect-proxy");
+ break;
case PROP_HTTP_PROXY:
katze_assign (web_settings->http_proxy, g_value_dup_string (value));
break;
g_value_set_boolean (value, web_settings->remember_last_downloaded_files);
break;
+ case PROP_PROXY_TYPE:
+ g_value_set_enum (value, web_settings->proxy_type);
+ break;
case PROP_HTTP_PROXY:
g_value_set_string (value, web_settings->http_proxy);
break;
/*
- Copyright (C) 2008 Christian Dywan <christian@twotoasts.de>
+ Copyright (C) 2008-2010 Christian Dywan <christian@twotoasts.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
#define MIDORI_TYPE_TOOLBAR_STYLE \
(midori_toolbar_style_get_type ())
+typedef enum
+{
+ MIDORI_PROXY_AUTOMATIC,
+ MIDORI_PROXY_HTTP,
+ MIDORI_PROXY_NONE
+} MidoriProxy;
+
+GType
+midori_proxy_get_type (void) G_GNUC_CONST;
+
+#define MIDORI_TYPE_PROXY \
+ (midori_proxy_get_type ())
+
typedef enum
{
MIDORI_ACCEPT_COOKIES_ALL,