aboutsummaryrefslogtreecommitdiffstats
path: root/embed/mozilla/mozilla-notifiers.cpp
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@it.gnome.org>2003-06-13 20:46:09 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-06-13 20:46:09 +0800
commitb47075448a59c1419cc21ac8104a58d549962ce6 (patch)
tree4a27993881f98b9f97559982b78721b364495566 /embed/mozilla/mozilla-notifiers.cpp
parent52c6654061e8bd5c8607defd279fa77dfb3dfb87 (diff)
downloadgsoc2013-epiphany-b47075448a59c1419cc21ac8104a58d549962ce6.tar
gsoc2013-epiphany-b47075448a59c1419cc21ac8104a58d549962ce6.tar.gz
gsoc2013-epiphany-b47075448a59c1419cc21ac8104a58d549962ce6.tar.bz2
gsoc2013-epiphany-b47075448a59c1419cc21ac8104a58d549962ce6.tar.lz
gsoc2013-epiphany-b47075448a59c1419cc21ac8104a58d549962ce6.tar.xz
gsoc2013-epiphany-b47075448a59c1419cc21ac8104a58d549962ce6.tar.zst
gsoc2013-epiphany-b47075448a59c1419cc21ac8104a58d549962ce6.zip
Add support for string enums.
2003-06-13 Marco Pesenti Gritti <marco@it.gnome.org> * lib/ephy-dialog.c: (set_config_from_editable), (set_config_from_optionmenu), (set_config_from_radiobuttongroup), (set_config_from_spin_button), (set_config_from_togglebutton), (set_config_from_color), (set_editable_from_config), (set_optionmenu_from_config), (set_radiobuttongroup_from_config), (set_spin_button_from_config), (set_togglebutton_from_config), (set_color_from_config), (prefs_togglebutton_clicked_cb), (prefs_radiobutton_clicked_cb), (prefs_spinbutton_timeout_cb), (prefs_color_changed_cb), (prefs_entry_changed_cb), (prefs_optionmenu_selected_cb), (ephy_dialog_init), (load_props), (save_props), (free_props), (ephy_dialog_finalize), (ephy_dialog_add_enum), (init_props), (impl_construct), (impl_show): Add support for string enums. * lib/ephy-dialog.h: * lib/ephy-prefs.h: * src/prefs-dialog.c: (prefs_dialog_init): * data/epiphany.schemas.in: * embed/downloader-view.c: * embed/ephy-embed-prefs.h: * embed/find-dialog.c: * embed/mozilla/mozilla-embed-single.cpp: * embed/mozilla/mozilla-notifiers.cpp: * embed/print-dialog.c: * lib/Makefile.am: Cleanup gconf prefs. This breaks compatibility but better now that later.
Diffstat (limited to 'embed/mozilla/mozilla-notifiers.cpp')
-rw-r--r--embed/mozilla/mozilla-notifiers.cpp189
1 files changed, 80 insertions, 109 deletions
diff --git a/embed/mozilla/mozilla-notifiers.cpp b/embed/mozilla/mozilla-notifiers.cpp
index f17e36213..f67bf6492 100644
--- a/embed/mozilla/mozilla-notifiers.cpp
+++ b/embed/mozilla/mozilla-notifiers.cpp
@@ -35,8 +35,6 @@
#include <locale.h>
#include <libgnome/gnome-i18n.h>
#include <stdlib.h>
-#include <sys/utsname.h>
-#include "nsBuildID.h"
#include "nsCOMPtr.h"
#include "nsIPrefService.h"
#include "nsIServiceManager.h"
@@ -85,12 +83,6 @@ mozilla_language_notifier(GConfClient *client,
EphyEmbedSingle *single);
static void
-mozilla_default_font_notifier(GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- EphyEmbedSingle *single);
-
-static void
mozilla_proxy_mode_notifier (GConfClient *client,
guint cnxn_id,
GConfEntry *entry,
@@ -100,12 +92,21 @@ mozilla_proxy_autoconfig_notifier (GConfClient *client,
guint cnxn_id,
GConfEntry *entry,
EphyEmbedSingle *single);
-
static void
-mozilla_user_agent_notifier(GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- EphyEmbedSingle *single);
+mozilla_proxy_mode_notifier (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ EphyEmbedSingle *single);
+static void
+mozilla_cookies_accept_notifier (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ char *pref);
+static void
+mozilla_cache_compare_notifier (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ char *pref);
/* Keeps the list of the notifiers we installed for mozilla prefs */
/* to be able to remove them when exiting */
@@ -129,7 +130,6 @@ conversion_table [] =
{
{ CONF_SECURITY_JAVA_ENABLED, BOOL_PREF, "security.enable_java"},
{ CONF_SECURITY_JAVASCRIPT_ENABLED, BOOL_PREF, "javascript.enabled"},
- { CONF_RENDERING_UNDERLINE_LINKS, BOOL_PREF, "browser.underline_anchors"},
{ CONF_NETWORK_PROXY_AUTO_URL, STRING_PREF, "network.proxy.autoconfig_url"},
{ CONF_NETWORK_HTTP_PROXY, STRING_PREF, "network.proxy.http"},
{ CONF_NETWORK_FTP_PROXY, STRING_PREF, "network.proxy.ftp"},
@@ -137,10 +137,10 @@ conversion_table [] =
{ CONF_NETWORK_HTTP_PROXY_PORT, INT_PREF, "network.proxy.http_port"},
{ CONF_NETWORK_FTP_PROXY_PORT, INT_PREF, "network.proxy.ftp_port"},
{ CONF_NETWORK_SSL_PROXY_PORT, INT_PREF, "network.proxy.ssl_port"},
- { CONF_NETWORK_CACHE_COMPARE, INT_PREF, "browser.cache.check_doc_frequency"},
- { CONF_SECURITY_COOKIES_ACCEPT, BOOL_PREF, "network.cookie.warnAboutCookies"},
{ CONF_LANGUAGE_DEFAULT_ENCODING, STRING_PREF, "intl.charset.default" },
{ CONF_LANGUAGE_AUTODETECT_ENCODING, STRING_PREF, "intl.charset.detector" },
+ { CONF_RENDERING_DEFAULT_FONT, STRING_PREF, "font.default" },
+
{ NULL, 0, NULL }
};
@@ -151,8 +151,6 @@ static const struct
}
custom_notifiers [] =
{
- { CONF_NETWORK_USER_AGENT,
- (GConfClientNotifyFunc) mozilla_user_agent_notifier },
{ CONF_RENDERING_USE_OWN_COLORS,
(GConfClientNotifyFunc) mozilla_own_colors_notifier },
{ CONF_RENDERING_USE_OWN_FONTS,
@@ -161,15 +159,18 @@ custom_notifiers [] =
(GConfClientNotifyFunc) mozilla_allow_popups_notifier },
{ CONF_RENDERING_LANGUAGE,
(GConfClientNotifyFunc) mozilla_language_notifier },
- { CONF_RENDERING_DEFAULT_FONT,
- (GConfClientNotifyFunc) mozilla_default_font_notifier },
{ CONF_NETWORK_PROXY_MODE,
(GConfClientNotifyFunc) mozilla_proxy_mode_notifier },
{ CONF_NETWORK_PROXY_AUTO_URL,
(GConfClientNotifyFunc) mozilla_proxy_autoconfig_notifier },
{ CONF_NETWORK_CACHE_SIZE,
(GConfClientNotifyFunc) mozilla_cache_size_notifier },
- {NULL, NULL}
+ { CONF_NETWORK_CACHE_COMPARE,
+ (GConfClientNotifyFunc) mozilla_cache_compare_notifier },
+ { CONF_SECURITY_COOKIES_ACCEPT,
+ (GConfClientNotifyFunc) mozilla_cookies_accept_notifier },
+
+ { NULL, NULL }
};
static gboolean
@@ -280,6 +281,64 @@ mozilla_proxy_mode_notifier (GConfClient *client,
}
static void
+mozilla_cookies_accept_notifier (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ char *pref)
+{
+ const char *mode;
+ int mozilla_mode = 0;
+
+ mode = gconf_value_get_string(entry->value);
+
+ if (strcmp (mode, "anywhere") == 0)
+ {
+ mozilla_mode = 0;
+ }
+ else if (strcmp (mode, "current site") == 0)
+ {
+ mozilla_mode = 1;
+ }
+ else if (strcmp (mode, "nowhere") == 0)
+ {
+ mozilla_mode = 2;
+ }
+
+ mozilla_prefs_set_int ("network.cookie.cookieBehavior", mozilla_mode);
+}
+
+static void
+mozilla_cache_compare_notifier (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ char *pref)
+{
+ const char *mode;
+ int mozilla_mode = 0;
+
+ mode = gconf_value_get_string(entry->value);
+
+ if (strcmp (mode, "once per session") == 0)
+ {
+ mozilla_mode = 0;
+ }
+ else if (strcmp (mode, "every time") == 0)
+ {
+ mozilla_mode = 1;
+ }
+ else if (strcmp (mode, "never") == 0)
+ {
+ mozilla_mode = 2;
+ }
+ else if (strcmp (mode, "automatic") == 0)
+ {
+ mozilla_mode = 3;
+ }
+
+ mozilla_prefs_set_int ("browser.cache.check_doc_frequency", mozilla_mode);
+}
+
+static void
mozilla_font_notifier (GConfClient *client,
guint cnxn_id,
GConfEntry *entry,
@@ -620,91 +679,3 @@ mozilla_language_notifier(GConfClient *client,
g_slist_foreach (languages, (GFunc) g_free, NULL);
g_slist_free (languages);
}
-
-static void
-mozilla_default_font_notifier(GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- EphyEmbedSingle *single)
-{
- const gchar *font_types [] = {"serif","sans-serif"};
- int default_font;
-
- default_font = eel_gconf_get_integer (CONF_RENDERING_DEFAULT_FONT);
- if (default_font < 0 ||
- default_font >= (int)(sizeof(font_types) / sizeof(font_types[0])))
- {
- g_warning ("mozilla_default_font_notifier: "
- "unsupported value: %d", default_font);
- return;
- }
- mozilla_prefs_set_string ("font.default", font_types[default_font]);
-}
-
-static void
-mozilla_prefs_set_user_agent ()
-{
- static gchar *default_user_agent = NULL;
- gchar *value;
- gchar *user_agent = NULL;
- struct utsname name;
- gchar *system;
-
- if (!default_user_agent)
- {
- if (uname (&name) == 0)
- {
- system = g_strdup_printf ("%s %s",
- name.sysname,
- name.machine);
- }
- else
- {
- system = g_strdup ("Unknown");
- }
-
- default_user_agent = g_strdup_printf
- ("Mozilla/5.0 (X11; U; %s) Gecko/%d Epiphany/" VERSION,
- system,
- NS_BUILD_ID/100);
-
- g_free (system);
- }
-
- value = eel_gconf_get_string (CONF_NETWORK_USER_AGENT);
-
- /* now, build a valid user agent string */
- if (!value || !strcmp ("", value)
- || !strcmp ("default", value)
- || !strcmp ("Ephy", value)
- || !strcmp (_("Default (recommended)"), value)
- || !strcmp ("Default (recommended)", value))
- {
- user_agent = g_strdup (default_user_agent);
- }
- else
- {
- user_agent = g_strdup (value);
- }
-
- mozilla_prefs_set_string ("general.useragent.override", user_agent);
- g_free (user_agent);
-}
-
-static void
-mozilla_user_agent_notifier (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- EphyEmbedSingle *single)
-{
- switch (entry->value->type)
- {
- case GCONF_VALUE_STRING:
- mozilla_prefs_set_user_agent ();
- break;
-
- default:
- g_warning ("Unsupported variable type");
- break;
- }
-}