aboutsummaryrefslogtreecommitdiffstats
path: root/embed
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
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')
-rw-r--r--embed/downloader-view.c2
-rw-r--r--embed/ephy-embed-prefs.h35
-rwxr-xr-xembed/find-dialog.c6
-rw-r--r--embed/mozilla/mozilla-embed-single.cpp37
-rw-r--r--embed/mozilla/mozilla-notifiers.cpp189
-rwxr-xr-xembed/print-dialog.c31
6 files changed, 153 insertions, 147 deletions
diff --git a/embed/downloader-view.c b/embed/downloader-view.c
index 004b707c9..390fd98d5 100644
--- a/embed/downloader-view.c
+++ b/embed/downloader-view.c
@@ -40,6 +40,8 @@
#include <gtk/gtkprogressbar.h>
#include <libgnomevfs/gnome-vfs-mime-handlers.h>
+#define CONF_DOWNLOADING_SHOW_DETAILS "/apps/epiphany/dialogs/downloader_show_details"
+
enum
{
DOWNLOAD_REMOVE,
diff --git a/embed/ephy-embed-prefs.h b/embed/ephy-embed-prefs.h
index 8a2089e8a..2bc82ad5d 100644
--- a/embed/ephy-embed-prefs.h
+++ b/embed/ephy-embed-prefs.h
@@ -1,22 +1,19 @@
-#define CONF_NETWORK_CACHE_SIZE "/apps/epiphany/network/cache_size"
-#define CONF_NETWORK_CACHE_COMPARE "/apps/epiphany/network/cache_compare"
-#define CONF_NETWORK_USER_AGENT "/apps/epiphany/network/user_agent"
-#define CONF_RENDERING_FONT "/apps/epiphany/rendering/font"
-#define CONF_RENDERING_FONT_VAR_SIZE "/apps/epiphany/rendering/font_var_size"
-#define CONF_RENDERING_FONT_FIXED_SIZE "/apps/epiphany/rendering/font_fixed_size"
-#define CONF_RENDERING_FONT_MIN_SIZE "/apps/epiphany/rendering/font_min_size"
-#define CONF_RENDERING_LANGUAGE "/apps/epiphany/rendering/lang"
-#define CONF_RENDERING_USE_OWN_COLORS "/apps/epiphany/rendering/use_own_colors"
-#define CONF_RENDERING_USE_OWN_FONTS "/apps/epiphany/rendering/use_own_fonts"
-#define CONF_RENDERING_UNDERLINE_LINKS "/apps/epiphany/rendering/underline_links"
-#define CONF_SECURITY_ALLOW_POPUPS "/apps/epiphany/security/allow_popups"
-#define CONF_SECURITY_JAVA_ENABLED "/apps/epiphany/security/java_enabled"
-#define CONF_SECURITY_JAVASCRIPT_ENABLED "/apps/epiphany/security/javascript_enabled"
-#define CONF_SECURITY_COOKIES_ACCEPT "/apps/epiphany/security/cookie_accept"
-#define CONF_LANGUAGE_AUTODETECT_ENCODING "/apps/epiphany/rendering/autodetect_encoding"
-#define CONF_LANGUAGE_DEFAULT_ENCODING "/apps/epiphany/rendering/default_encoding"
-#define CONF_RENDERING_DEFAULT_FONT "/apps/epiphany/rendering/default_font"
-#define CONF_FILTERING_DEFAULT_STATUSBAR "/apps/epiphany/filtering/default_allow_statusbar"
+#define CONF_NETWORK_CACHE_SIZE "/apps/epiphany/web/cache_size"
+#define CONF_NETWORK_CACHE_COMPARE "/apps/epiphany/web/cache_compare"
+#define CONF_RENDERING_FONT "/apps/epiphany/web/font"
+#define CONF_RENDERING_FONT_VAR_SIZE "/apps/epiphany/web/font_var_size"
+#define CONF_RENDERING_FONT_FIXED_SIZE "/apps/epiphany/web/font_fixed_size"
+#define CONF_RENDERING_FONT_MIN_SIZE "/apps/epiphanyweb/font_min_size"
+#define CONF_RENDERING_LANGUAGE "/apps/epiphany/web/language"
+#define CONF_RENDERING_USE_OWN_COLORS "/apps/epiphany/web/use_own_colors"
+#define CONF_RENDERING_USE_OWN_FONTS "/apps/epiphany/web/use_own_fonts"
+#define CONF_SECURITY_ALLOW_POPUPS "/apps/epiphany/web/allow_popups"
+#define CONF_SECURITY_JAVA_ENABLED "/apps/epiphany/web/java_enabled"
+#define CONF_SECURITY_JAVASCRIPT_ENABLED "/apps/epiphany/web/javascript_enabled"
+#define CONF_SECURITY_COOKIES_ACCEPT "/apps/epiphany/web/cookie_accept"
+#define CONF_LANGUAGE_AUTODETECT_ENCODING "/apps/epiphany/web/autodetect_encoding"
+#define CONF_LANGUAGE_DEFAULT_ENCODING "/apps/epiphany/web/default_encoding"
+#define CONF_RENDERING_DEFAULT_FONT "/apps/epiphany/web/default_font_type"
/* These are defined gnome wide now */
#define CONF_NETWORK_PROXY_MODE "/system/proxy/mode"
diff --git a/embed/find-dialog.c b/embed/find-dialog.c
index a81de1618..9cb2f8138 100755
--- a/embed/find-dialog.c
+++ b/embed/find-dialog.c
@@ -23,9 +23,9 @@
#include "ephy-embed.h"
#include <gtk/gtk.h>
-#define CONF_FIND_MATCH_CASE "/apps/epiphany/find/match_case"
-#define CONF_FIND_AUTOWRAP "/apps/epiphany/find/autowrap"
-#define CONF_FIND_WORD "/apps/epiphany/find/word"
+#define CONF_FIND_MATCH_CASE "/apps/epiphany/dialogs/find_match_case"
+#define CONF_FIND_AUTOWRAP "/apps/epiphany/dialogs/find_autowrap"
+#define CONF_FIND_WORD "/apps/epiphany/dialogs/find_word"
static void find_dialog_class_init (FindDialogClass *klass);
static void find_dialog_init (FindDialog *dialog);
diff --git a/embed/mozilla/mozilla-embed-single.cpp b/embed/mozilla/mozilla-embed-single.cpp
index 808d61f24..fa67a9ea3 100644
--- a/embed/mozilla/mozilla-embed-single.cpp
+++ b/embed/mozilla/mozilla-embed-single.cpp
@@ -37,6 +37,8 @@
#include <time.h>
#include <libgnome/gnome-i18n.h>
#include <string.h>
+#include <sys/utsname.h>
+#include "nsBuildID.h"
#include <nsICacheService.h>
#include <nsCOMPtr.h>
#include <nsIPrefService.h>
@@ -322,6 +324,34 @@ mozilla_embed_single_class_init (MozillaEmbedSingleClass *klass)
shell_class->show_file_picker = impl_show_file_picker;
}
+static char *
+build_user_agent ()
+{
+ static char *user_agent;
+ struct utsname name;
+ char *system;
+
+ if (uname (&name) == 0)
+ {
+ system = g_strdup_printf ("%s %s",
+ name.sysname,
+ name.machine);
+ }
+ else
+ {
+ system = g_strdup ("Unknown");
+ }
+
+ user_agent = g_strdup_printf
+ ("Mozilla/5.0 (X11; U; %s) Gecko/%d Epiphany/" VERSION,
+ system,
+ NS_BUILD_ID/100);
+
+ g_free (system);
+
+ return user_agent;
+}
+
static void
mozilla_set_default_prefs (MozillaEmbedSingle *mes)
{
@@ -392,6 +422,13 @@ mozilla_set_default_prefs (MozillaEmbedSingle *mes)
/* Enable Image Auto-Resizing */
pref->SetBoolPref ("browser.enable_automatic_image_resizing", PR_TRUE);
+
+ /* User agent */
+ char *user_agent;
+
+ user_agent = build_user_agent ();
+ pref->SetCharPref ("general.useragent.override", user_agent);
+ g_free (user_agent);
}
static char *
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;
- }
-}
diff --git a/embed/print-dialog.c b/embed/print-dialog.c
index 4a19c7571..2ba9ca348 100755
--- a/embed/print-dialog.c
+++ b/embed/print-dialog.c
@@ -21,22 +21,21 @@
#include <gtk/gtkdialog.h>
#include <gtk/gtkstock.h>
-#define CONF_PRINT_BOTTOM_MARGIN "/apps/epiphany/print/bottom_margin"
-#define CONF_PRINT_TOP_MARGIN "/apps/epiphany/print/top_margin"
-#define CONF_PRINT_LEFT_MARGIN "/apps/epiphany/print/left_margin"
-#define CONF_PRINT_RIGHT_MARGIN "/apps/epiphany/print/right_margin"
-#define CONF_PRINT_PAGE_TITLE "/apps/epiphany/print/page_title_toggle"
-#define CONF_PRINT_PAGE_URL "/apps/epiphany/print/page_url_toggle"
-#define CONF_PRINT_DATE "/apps/epiphany/print/date_toggle"
-#define CONF_PRINT_PAGE_NUMBERS "/apps/epiphany/print/page_numbers_toggle"
-#define CONF_PRINT_PRINTER "/apps/epiphany/print/printer"
-#define CONF_PRINT_FILE "/apps/epiphany/print/file"
-#define CONF_PRINT_PRINTON "/apps/epiphany/print/printon"
-#define CONF_PRINT_PAPER "/apps/epiphany/print/paper"
-#define CONF_PRINT_ALL_PAGES "/apps/epiphany/print/all_pages"
-#define CONF_PRINT_START_FROM_LAST "/apps/epiphany/print/start_from_last"
-#define CONF_PRINT_COLOR "/apps/epiphany/print/color"
-#define CONF_PRINT_ORIENTATION "/apps/epiphany/print/orientation"
+#define CONF_PRINT_BOTTOM_MARGIN "/apps/epiphany/dialogs/print_bottom_margin"
+#define CONF_PRINT_TOP_MARGIN "/apps/epiphany/dialogs/print_top_margin"
+#define CONF_PRINT_LEFT_MARGIN "/apps/epiphany/dialogs/print_left_margin"
+#define CONF_PRINT_RIGHT_MARGIN "/apps/epiphany/dialogs/print_right_margin"
+#define CONF_PRINT_PAGE_TITLE "/apps/epiphany/dialogs/print_page_title"
+#define CONF_PRINT_PAGE_URL "/apps/epiphany/dialogs/print_page_url"
+#define CONF_PRINT_DATE "/apps/epiphany/dialogs/print_date"
+#define CONF_PRINT_PAGE_NUMBERS "/apps/epiphany/dialogs/print_page_numbers"
+#define CONF_PRINT_PRINTER "/apps/epiphany/dialogs/print_printer"
+#define CONF_PRINT_FILE "/apps/epiphany/dialogs/print_file"
+#define CONF_PRINT_PRINTON "/apps/epiphany/dialogs/print_on"
+#define CONF_PRINT_PAPER "/apps/epiphany/dialogs/print_paper"
+#define CONF_PRINT_ALL_PAGES "/apps/epiphany/dialogs/print_all_pages"
+#define CONF_PRINT_COLOR "/apps/epiphany/dialogs/print_color"
+#define CONF_PRINT_ORIENTATION "/apps/epiphany/dialogs/print_orientation"
static void print_dialog_class_init (PrintDialogClass *klass);
static void print_dialog_init (PrintDialog *dialog);