aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorDiego Escalante Urrelo <descalante@igalia.com>2010-07-25 07:59:55 +0800
committerXan Lopez <xan@gnome.org>2010-10-08 17:09:11 +0800
commit5df7af9e3041102a5f5601d60faa11c38b48de75 (patch)
treefe0306b87e0874a8541a082fe844f4a487331161 /embed
parent60d08f64c2466ce8eda20d832239ec6defc9ef06 (diff)
downloadgsoc2013-epiphany-5df7af9e3041102a5f5601d60faa11c38b48de75.tar
gsoc2013-epiphany-5df7af9e3041102a5f5601d60faa11c38b48de75.tar.gz
gsoc2013-epiphany-5df7af9e3041102a5f5601d60faa11c38b48de75.tar.bz2
gsoc2013-epiphany-5df7af9e3041102a5f5601d60faa11c38b48de75.tar.lz
gsoc2013-epiphany-5df7af9e3041102a5f5601d60faa11c38b48de75.tar.xz
gsoc2013-epiphany-5df7af9e3041102a5f5601d60faa11c38b48de75.tar.zst
gsoc2013-epiphany-5df7af9e3041102a5f5601d60faa11c38b48de75.zip
gsettings: port epiphany to gsettings
Adds our own schemas, a migration file and removes old gconf API and files. Bug #624485
Diffstat (limited to 'embed')
-rw-r--r--embed/downloader-view.c44
-rw-r--r--embed/ephy-embed-prefs.c353
-rw-r--r--embed/ephy-embed-prefs.h23
-rw-r--r--embed/ephy-embed-single.c7
-rw-r--r--embed/ephy-embed.c10
-rw-r--r--embed/ephy-encodings.c42
-rw-r--r--embed/ephy-history.c23
-rw-r--r--embed/ephy-web-view.c14
8 files changed, 191 insertions, 325 deletions
diff --git a/embed/downloader-view.c b/embed/downloader-view.c
index e62064a45..698a0fe6e 100644
--- a/embed/downloader-view.c
+++ b/embed/downloader-view.c
@@ -28,7 +28,7 @@
#include "ephy-gui.h"
#include "ephy-debug.h"
#include "ephy-prefs.h"
-#include "eel-gconf-extensions.h"
+#include "ephy-settings.h"
#include <glib/gi18n.h>
#include <gtk/gtk.h>
@@ -76,25 +76,6 @@ struct _DownloaderViewPrivate
enum
{
- PROP_WINDOW,
- PROP_TREEVIEW,
- PROP_PAUSE_BUTTON,
- PROP_ABORT_BUTTON,
-};
-
-static const
-EphyDialogProperty properties [] =
-{
- { "download_manager_dialog", NULL, PT_NORMAL, 0 },
- { "clist", NULL, PT_NORMAL, 0 },
- { "pause_button", NULL, PT_NORMAL, 0 },
- { "abort_button", NULL, PT_NORMAL, 0 },
-
- { NULL }
-};
-
-enum
-{
RESPONSE_PAUSE = 1,
RESPONSE_STOP = 2
};
@@ -146,12 +127,14 @@ show_downloader_cb (DownloaderView *dv)
if (!gtk_window_has_toplevel_focus (GTK_WINDOW (dv->priv->window)))
{
ephy_dialog_show (EPHY_DIALOG (dv));
- eel_gconf_set_boolean (CONF_DOWNLOADS_HIDDEN, FALSE);
+ g_settings_set_boolean (EPHY_SETTINGS_UI,
+ EPHY_PREFS_UI_DOWNLOADS_HIDDEN, FALSE);
}
else
{
ephy_dialog_hide (EPHY_DIALOG (dv));
- eel_gconf_set_boolean (CONF_DOWNLOADS_HIDDEN, TRUE);
+ g_settings_set_boolean (EPHY_SETTINGS_UI,
+ EPHY_PREFS_UI_DOWNLOADS_HIDDEN, TRUE);
}
}
@@ -752,7 +735,8 @@ downloader_view_add_download (DownloaderView *dv,
return;
}
- if (eel_gconf_get_boolean (CONF_DOWNLOADS_HIDDEN) && !visible)
+ if (g_settings_get_boolean (EPHY_SETTINGS_UI,
+ EPHY_PREFS_UI_DOWNLOADS_HIDDEN) && !visible)
{
#ifdef HAVE_LIBNOTIFY
char *name;
@@ -864,19 +848,17 @@ downloader_view_build_ui (DownloaderView *dv)
GtkTreeSelection *selection;
ephy_dialog_construct (d,
- properties,
ephy_file ("epiphany.ui"),
"download_manager_dialog",
NULL);
/* lookup needed widgets */
- ephy_dialog_get_controls
- (d,
- properties[PROP_WINDOW].id, &priv->window,
- properties[PROP_TREEVIEW].id, &priv->treeview,
- properties[PROP_PAUSE_BUTTON].id, &priv->pause_button,
- properties[PROP_ABORT_BUTTON].id, &priv->abort_button,
- NULL);
+ ephy_dialog_get_controls (d,
+ "download_manager_dialog", &priv->window,
+ "clist", &priv->treeview,
+ "pause_button", &priv->pause_button,
+ "abort_button", &priv->abort_button,
+ NULL);
g_signal_connect (priv->window, "response",
G_CALLBACK (download_dialog_response_cb), dv);
diff --git a/embed/ephy-embed-prefs.c b/embed/ephy-embed-prefs.c
index b39238b08..2b43f69ea 100644
--- a/embed/ephy-embed-prefs.c
+++ b/embed/ephy-embed-prefs.c
@@ -1,4 +1,5 @@
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
+/* vim: set sw=2 ts=2 sts=2 et: */
/* Copyright © 2008 Xan Lopez <xan@gnome.org>
*
* This program is free software; you can redistribute it and/or modify
@@ -22,105 +23,34 @@
#include <glib.h>
#include <webkit/webkit.h>
-#include "eel-gconf-extensions.h"
#include "ephy-embed-prefs.h"
+#include "ephy-embed-shell.h"
#include "ephy-embed-utils.h"
#include "ephy-file-helpers.h"
#include "ephy-langs.h"
+#include "ephy-prefs.h"
+#include "ephy-settings.h"
typedef struct
{
- char *gconf_key;
+ char *schema;
+ char *key;
char *webkit_pref;
- GConfClientNotifyFunc func;
- guint cnxn_id;
+ GCallback callback;
} PrefData;
-static WebKitWebSettings *settings = NULL;
-static guint *connections = NULL;
+static WebKitWebSettings *webkit_settings = NULL;
static void
-webkit_pref_callback_int (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- gpointer data)
-{
- GConfValue *gcvalue;
- gint value = 0;
- char *webkit_pref = data;
-
- gcvalue = gconf_entry_get_value (entry);
-
- /* happens on initial notify if the key doesn't exist */
- if (gcvalue != NULL &&
- gcvalue->type == GCONF_VALUE_INT) {
- value = gconf_value_get_int (gcvalue);
- value = MAX (value, 0);
- }
-
- g_object_set (settings, webkit_pref, value, NULL);
-}
-
-static void
-webkit_pref_callback_boolean (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- gpointer data)
-{
- GConfValue *gcvalue;
- gboolean value = FALSE;
- char *webkit_pref = data;
-
- gcvalue = gconf_entry_get_value (entry);
-
- /* happens on initial notify if the key doesn't exist */
- if (gcvalue != NULL &&
- gcvalue->type == GCONF_VALUE_BOOL) {
- value = gconf_value_get_bool (gcvalue);
- }
-
- g_object_set (settings, webkit_pref, value, NULL);
-}
-
-static void
-webkit_pref_callback_string (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- gpointer data)
-{
- GConfValue *gcvalue;
- const char *value = NULL;
- char *webkit_pref = data;
-
- gcvalue = gconf_entry_get_value (entry);
-
- /* happens on initial notify if the key doesn't exist */
- if (gcvalue != NULL &&
- gcvalue->type == GCONF_VALUE_STRING) {
- value = gconf_value_get_string (gcvalue);
- }
-
- g_object_set (settings, webkit_pref, value, NULL);
-}
-
-static void
-webkit_pref_callback_user_stylesheet (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
+webkit_pref_callback_user_stylesheet (GSettings *settings,
+ char *key,
gpointer data)
{
- GConfValue *gcvalue;
gboolean value = FALSE;
char *uri = NULL;
char *webkit_pref = data;
- gcvalue = gconf_entry_get_value (entry);
-
- /* happens on initial notify if the key doesn't exist */
- if (gcvalue != NULL &&
- gcvalue->type == GCONF_VALUE_BOOL) {
- value = gconf_value_get_bool (gcvalue);
- }
+ value = g_settings_get_boolean (settings, key);
if (value)
/* We need the leading file://, so use g_strconcat instead
@@ -130,7 +60,8 @@ webkit_pref_callback_user_stylesheet (GConfClient *client,
G_DIR_SEPARATOR_S,
USER_STYLESHEET_FILENAME,
NULL);
- g_object_set (settings, webkit_pref, uri, NULL);
+
+ g_object_set (webkit_settings, webkit_pref, uri, NULL);
g_free (uri);
}
@@ -175,7 +106,7 @@ webkit_pref_get_internal_user_agent (void)
g_key_file_free (branding_keyfile);
- g_object_get (settings, "user-agent", &webkit_user_agent, NULL);
+ g_object_get (webkit_settings, "user-agent", &webkit_user_agent, NULL);
user_agent = g_strconcat (webkit_user_agent, " ",
vendor_user_agent ? vendor_user_agent : "",
@@ -190,51 +121,37 @@ webkit_pref_get_internal_user_agent (void)
}
static void
-webkit_pref_callback_user_agent (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
+webkit_pref_callback_user_agent (GSettings *settings,
+ char *key,
gpointer data)
{
- GConfValue *gcvalue;
- const char *value = NULL;
+ char *value = NULL;
static char *internal_user_agent = NULL;
char *webkit_pref = data;
- gcvalue = gconf_entry_get_value (entry);
-
- /* happens on initial notify if the key doesn't exist */
- if (gcvalue != NULL &&
- gcvalue->type == GCONF_VALUE_STRING) {
- value = gconf_value_get_string (gcvalue);
- }
+ value = g_settings_get_string (settings, key);
if (value == NULL || value[0] == '\0') {
if (internal_user_agent == NULL)
internal_user_agent = webkit_pref_get_internal_user_agent ();
- g_object_set (settings, webkit_pref, internal_user_agent, NULL);
+ g_object_set (webkit_settings, webkit_pref, internal_user_agent, NULL);
} else
- g_object_set (settings, webkit_pref, value, NULL);
+ g_object_set (webkit_settings, webkit_pref, value, NULL);
+
+ g_free (value);
}
static void
-webkit_pref_callback_font_size (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
+webkit_pref_callback_font_size (GSettings *settings,
+ char *key,
gpointer data)
{
- GConfValue *gcvalue;
char *webkit_pref = data;
- const char *value = NULL;
+ char *value = NULL;
int size = 9; /* FIXME: What to use here? */
- gcvalue = gconf_entry_get_value (entry);
-
- /* happens on initial notify if the key doesn't exist */
- if (gcvalue != NULL &&
- gcvalue->type == GCONF_VALUE_STRING) {
- value = gconf_value_get_string (gcvalue);
- }
+ value = g_settings_get_string (settings, key);
if (value) {
PangoFontDescription* desc;
@@ -246,26 +163,19 @@ webkit_pref_callback_font_size (GConfClient *client,
pango_font_description_free (desc);
}
- g_object_set (settings, webkit_pref, size, NULL);
+ g_object_set (webkit_settings, webkit_pref, size, NULL);
+ g_free (value);
}
static void
-webkit_pref_callback_font_family (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
+webkit_pref_callback_font_family (GSettings *settings,
+ char *key,
gpointer data)
{
- GConfValue *gcvalue;
char *webkit_pref = data;
- const char *value = NULL;
-
- gcvalue = gconf_entry_get_value (entry);
+ char *value = NULL;
- /* happens on initial notify if the key doesn't exist */
- if (gcvalue != NULL &&
- gcvalue->type == GCONF_VALUE_STRING) {
- value = gconf_value_get_string (gcvalue);
- }
+ value = g_settings_get_string (settings, key);
if (value) {
PangoFontDescription* desc;
@@ -273,9 +183,11 @@ webkit_pref_callback_font_family (GConfClient *client,
desc = pango_font_description_from_string (value);
family = pango_font_description_get_family (desc);
- g_object_set (settings, webkit_pref, family, NULL);
+ g_object_set (webkit_settings, webkit_pref, family, NULL);
pango_font_description_free (desc);
}
+
+ g_free (value);
}
/* Part of this code taken from libsoup (soup-session.c) */
@@ -324,40 +236,31 @@ build_accept_languages_header (GArray *languages)
/* Based on Christian Persch's code from gecko backend of epiphany
(old transform_accept_languages_list() function) */
static void
-webkit_pref_callback_accept_languages (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
+webkit_pref_callback_accept_languages (GSettings *settings,
+ char *key,
gpointer data)
{
SoupSession *session;
- GConfValue *gcvalue;
GArray *array;
- GSList *languages, *l;
- char **array_data;
+ char **languages;
char *langs_str;
char *webkit_pref;
+ int i;
webkit_pref = data;
- gcvalue = gconf_entry_get_value (entry);
- if (gcvalue == NULL ||
- gcvalue->type != GCONF_VALUE_LIST ||
- gconf_value_get_list_type (gcvalue) != GCONF_VALUE_STRING)
- return;
- languages = gconf_value_get_list (gcvalue);
+ languages = g_settings_get_strv (settings, key);
array = g_array_new (TRUE, FALSE, sizeof (char *));
- for (l = languages; l != NULL; l = l->next) {
- const char *lang = gconf_value_get_string ((GConfValue *) l->data);
-
- if ((lang != NULL) && !g_strcmp0 (lang, "system")) {
- ephy_langs_append_languages (array);
- } else if (lang != NULL && lang[0] != '\0') {
- char *str = g_ascii_strdown (lang, -1);
- g_array_append_val (array, str);
- }
- }
+ for (i = 0; languages[i]; i++) {
+ if (!g_strcmp0 (languages[i], "system")) {
+ ephy_langs_append_languages (array);
+ } else if (languages[i][0] != '\0') {
+ char *str = g_ascii_strdown (languages[i], -1);
+ g_array_append_val (array, str);
+ }
+ }
ephy_langs_sanitise (array);
@@ -367,26 +270,24 @@ webkit_pref_callback_accept_languages (GConfClient *client,
session = webkit_get_default_session ();
g_object_set (G_OBJECT (session), webkit_pref, langs_str, NULL);
- /* Free memory */
- array_data = (char **) g_array_free (array, FALSE);
- g_strfreev (array_data);
+ g_strfreev (languages);
g_free (langs_str);
}
void
ephy_embed_prefs_set_cookie_jar_policy (SoupCookieJar *jar,
- const char *gconf_policy)
+ const char *settings_policy)
{
SoupCookieJarAcceptPolicy policy;
g_return_if_fail (SOUP_IS_COOKIE_JAR (jar));
- g_return_if_fail (gconf_policy != NULL);
+ g_return_if_fail (settings_policy != NULL);
- if (g_str_equal (gconf_policy, "nowhere"))
+ if (g_str_equal (settings_policy, "never"))
policy = SOUP_COOKIE_JAR_ACCEPT_NEVER;
- else if (g_str_equal (gconf_policy, "anywhere"))
+ else if (g_str_equal (settings_policy, "always"))
policy = SOUP_COOKIE_JAR_ACCEPT_ALWAYS;
- else if (g_str_equal (gconf_policy, "current site"))
+ else if (g_str_equal (settings_policy, "no-third-party"))
policy = SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY;
else {
g_warn_if_reached ();
@@ -397,25 +298,16 @@ ephy_embed_prefs_set_cookie_jar_policy (SoupCookieJar *jar,
}
static void
-webkit_pref_callback_cookie_accept_policy (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
+webkit_pref_callback_cookie_accept_policy (GSettings *settings,
+ char *key,
gpointer data)
{
SoupSession *session;
char *webkit_pref;
- GConfValue *gcvalue;
- const char *value = NULL;
+ char *value = NULL;
webkit_pref = data;
-
- gcvalue = gconf_entry_get_value (entry);
-
- /* happens on initial notify if the key doesn't exist */
- if (gcvalue != NULL &&
- gcvalue->type == GCONF_VALUE_STRING) {
- value = gconf_value_get_string (gcvalue);
- }
+ value = g_settings_get_string (settings, key);
if (value) {
SoupSessionFeature *jar;
@@ -427,58 +319,48 @@ webkit_pref_callback_cookie_accept_policy (GConfClient *client,
ephy_embed_prefs_set_cookie_jar_policy (SOUP_COOKIE_JAR (jar), value);
}
+
+ g_free (value);
}
static const PrefData webkit_pref_entries[] =
{
- { CONF_RENDERING_FONT_MIN_SIZE,
- "minimum-logical-font-size",
- webkit_pref_callback_int },
- { CONF_DESKTOP_FONT_VAR_NAME,
+ { "org.gnome.desktop.interface",
+ "font-name",
"default-font-size",
- webkit_pref_callback_font_size },
- { CONF_DESKTOP_FONT_VAR_NAME,
+ G_CALLBACK (webkit_pref_callback_font_size) },
+ { "org.gnome.desktop.interface",
+ "font-name",
"default-font-family",
- webkit_pref_callback_font_family },
- { CONF_DESKTOP_FONT_VAR_NAME,
+ G_CALLBACK (webkit_pref_callback_font_family) },
+ { "org.gnome.desktop.interface",
+ "font-name",
"sans-serif-font-family",
- webkit_pref_callback_font_family },
- { CONF_DESKTOP_FONT_FIXED_NAME,
+ G_CALLBACK (webkit_pref_callback_font_family) },
+ { "org.gnome.desktop.interface",
+ "monospace-font-name",
"default-monospace-font-size",
- webkit_pref_callback_font_size },
- { CONF_DESKTOP_FONT_FIXED_NAME,
+ G_CALLBACK (webkit_pref_callback_font_size) },
+ { "org.gnome.desktop.interface",
+ "monospace-font-name",
"monospace-font-family",
- webkit_pref_callback_font_family },
- { CONF_SECURITY_JAVASCRIPT_ENABLED,
- "enable-scripts",
- webkit_pref_callback_boolean },
- { CONF_LANGUAGE_DEFAULT_ENCODING,
- "default-encoding",
- webkit_pref_callback_string },
- { CONF_WEB_INSPECTOR_ENABLED,
- "enable-developer-extras",
- webkit_pref_callback_boolean },
- { CONF_USER_CSS_ENABLED,
+ G_CALLBACK (webkit_pref_callback_font_family) },
+ { EPHY_PREFS_WEB_SCHEMA,
+ EPHY_PREFS_WEB_ENABLE_USER_CSS,
"user-stylesheet-uri",
- webkit_pref_callback_user_stylesheet },
- { CONF_CARET_BROWSING_ENABLED,
- "enable-caret-browsing",
- webkit_pref_callback_boolean },
- { CONF_SECURITY_ALLOW_POPUPS,
- "javascript-can-open-windows-automatically",
- webkit_pref_callback_boolean },
- { CONF_RENDERING_LANGUAGE,
+ G_CALLBACK (webkit_pref_callback_user_stylesheet) },
+ { EPHY_PREFS_WEB_SCHEMA,
+ EPHY_PREFS_WEB_LANGUAGE,
"accept-language",
- webkit_pref_callback_accept_languages },
- { CONF_USER_AGENT,
+ G_CALLBACK (webkit_pref_callback_accept_languages) },
+ { EPHY_PREFS_SCHEMA,
+ EPHY_PREFS_USER_AGENT,
"user-agent",
- webkit_pref_callback_user_agent },
- { CONF_SECURITY_COOKIES_ACCEPT,
+ G_CALLBACK (webkit_pref_callback_user_agent) },
+ { EPHY_PREFS_WEB_SCHEMA,
+ EPHY_PREFS_WEB_COOKIES_POLICY,
"accept-policy",
- webkit_pref_callback_cookie_accept_policy },
- { CONF_SECURITY_PLUGINS_ENABLED,
- "enable-plugins",
- webkit_pref_callback_boolean }
+ G_CALLBACK (webkit_pref_callback_cookie_accept_policy) },
};
static void
@@ -493,12 +375,10 @@ ephy_embed_prefs_init (void)
{
int i;
- eel_gconf_monitor_add ("/apps/epiphany/web");
-
- settings = webkit_web_settings_new ();
+ webkit_settings = webkit_web_settings_new ();
/* Hardcoded settings */
- g_object_set (settings,
+ g_object_set (webkit_settings,
"auto-shrink-images", FALSE,
"enable-default-context-menu", FALSE,
"enable-site-specific-quirks", TRUE,
@@ -506,33 +386,58 @@ ephy_embed_prefs_init (void)
"auto-resize-window", TRUE,
NULL);
- /* Connections */
- connections = g_malloc (sizeof (guint) * G_N_ELEMENTS (webkit_pref_entries));
-
for (i = 0; i < G_N_ELEMENTS (webkit_pref_entries); i++) {
- connections[i] = eel_gconf_notification_add (webkit_pref_entries[i].gconf_key,
- webkit_pref_entries[i].func,
- webkit_pref_entries[i].webkit_pref);
+ GSettings *settings;
+ char *key;
+
+ settings = ephy_settings_get (webkit_pref_entries[i].schema);
+ key = g_strconcat ("changed::", webkit_pref_entries[i].key, NULL);
- eel_gconf_notify (webkit_pref_entries[i].gconf_key);
+ g_signal_connect (settings, key,
+ webkit_pref_entries[i].callback,
+ webkit_pref_entries[i].webkit_pref);
+ g_free (key);
}
+
+ g_settings_bind (EPHY_SETTINGS_WEB,
+ EPHY_PREFS_WEB_ENABLE_JAVASCRIPT,
+ webkit_settings, "enable-scripts",
+ G_SETTINGS_BIND_GET);
+ g_settings_bind (EPHY_SETTINGS_MAIN,
+ EPHY_PREFS_ENABLE_WEB_INSPECTOR,
+ webkit_settings, "enable-developer-extras",
+ G_SETTINGS_BIND_GET);
+ g_settings_bind (EPHY_SETTINGS_MAIN,
+ EPHY_PREFS_ENABLE_CARET_BROWSING,
+ webkit_settings, "enable-caret-browsing",
+ G_SETTINGS_BIND_GET);
+ g_settings_bind (EPHY_SETTINGS_WEB,
+ EPHY_PREFS_WEB_ENABLE_POPUPS,
+ webkit_settings, "javascript-can-open-windows-automatically",
+ G_SETTINGS_BIND_GET);
+ g_settings_bind (EPHY_SETTINGS_WEB,
+ EPHY_PREFS_WEB_ENABLE_PLUGINS,
+ webkit_settings, "enable-plugins",
+ G_SETTINGS_BIND_GET);
+ g_settings_bind (EPHY_SETTINGS_WEB,
+ EPHY_PREFS_WEB_FONT_MIN_SIZE,
+ webkit_settings, "minimum-logical-font-size",
+ G_SETTINGS_BIND_GET);
+ g_settings_bind (EPHY_SETTINGS_WEB,
+ EPHY_PREFS_WEB_DEFAULT_ENCODING,
+ webkit_settings, "default-encoding",
+ G_SETTINGS_BIND_GET);
}
void
ephy_embed_prefs_shutdown (void)
{
- int i;
-
- for (i = 0; i < G_N_ELEMENTS (webkit_pref_entries); i++)
- eel_gconf_notification_remove (connections[i]);
-
- g_free (connections);
- g_object_unref (settings);
+ g_object_unref (webkit_settings);
}
void
ephy_embed_prefs_add_embed (EphyEmbed *embed)
{
- ephy_embed_prefs_apply (embed, settings);
+ ephy_embed_prefs_apply (embed, webkit_settings);
}
diff --git a/embed/ephy-embed-prefs.h b/embed/ephy-embed-prefs.h
index 4cb63a3ad..0afbef5d3 100644
--- a/embed/ephy-embed-prefs.h
+++ b/embed/ephy-embed-prefs.h
@@ -23,29 +23,6 @@
#include "ephy-embed.h"
-#define CONF_NETWORK_CACHE_SIZE "/apps/epiphany/web/cache_size"
-#define CONF_RENDERING_FONT "/apps/epiphany/web/font"
-#define CONF_RENDERING_FONT_MIN_SIZE "/apps/epiphany/web/minimum_font_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_USER_CSS_ENABLED "/apps/epiphany/web/user_css_enabled"
-#define CONF_SECURITY_ALLOW_POPUPS "/apps/epiphany/web/allow_popups"
-#define CONF_SECURITY_PLUGINS_ENABLED "/apps/epiphany/web/plugins_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_IMAGE_ANIMATION_MODE "/apps/epiphany/web/image_animation"
-#define CONF_IMAGE_LOADING_MODE "/apps/epiphany/web/image_loading"
-#define CONF_DISPLAY_SMOOTHSCROLL "/apps/epiphany/web/smooth_scroll"
-#define CONF_WEB_INSPECTOR_ENABLED "/apps/epiphany/web/inspector_enabled"
-#define CONF_CARET_BROWSING_ENABLED "/apps/epiphany/web/browse_with_caret"
-#define CONF_USER_AGENT "/apps/epiphany/general/user_agent"
-
-#define CONF_DESKTOP_FONT_VAR_NAME "/desktop/gnome/interface/font_name"
-#define CONF_DESKTOP_FONT_FIXED_NAME "/desktop/gnome/interface/monospace_font_name"
-
#if !defined (__EPHY_EPIPHANY_H_INSIDE__) && !defined (EPIPHANY_COMPILATION)
#error "Only <epiphany/epiphany.h> can be included directly."
#endif
diff --git a/embed/ephy-embed-single.c b/embed/ephy-embed-single.c
index 04ead3f57..560eb3431 100644
--- a/embed/ephy-embed-single.c
+++ b/embed/ephy-embed-single.c
@@ -23,8 +23,8 @@
#define LIBSOUP_I_HAVE_READ_BUG_594377_AND_KNOW_SOUP_PASSWORD_MANAGER_MIGHT_GO_AWAY
#define NSPLUGINWRAPPER_SETUP "/usr/bin/mozilla-plugin-config"
-#include "eel-gconf-extensions.h"
#include "ephy-embed-single.h"
+#include "ephy-embed-shell.h"
#include "ephy-embed-prefs.h"
#include "ephy-embed-type-builtins.h"
#include "ephy-debug.h"
@@ -33,6 +33,8 @@
#include "ephy-signal-accumulator.h"
#include "ephy-permission-manager.h"
#include "ephy-profile-migration.h"
+#include "ephy-prefs.h"
+#include "ephy-settings.h"
#ifdef ENABLE_CERTIFICATE_MANAGER
#include "ephy-certificate-manager.h"
@@ -480,7 +482,8 @@ ephy_embed_single_initialize (EphyEmbedSingle *single)
filename = g_build_filename (ephy_dot_dir (), "cookies.sqlite", NULL);
jar = soup_cookie_jar_sqlite_new (filename, FALSE);
g_free (filename);
- cookie_policy = eel_gconf_get_string (CONF_SECURITY_COOKIES_ACCEPT);
+ cookie_policy = g_settings_get_string (EPHY_SETTINGS_WEB,
+ EPHY_PREFS_WEB_COOKIES_POLICY);
ephy_embed_prefs_set_cookie_jar_policy (jar, cookie_policy);
g_free (cookie_policy);
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index 0f6b01198..77066d393 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -26,7 +26,6 @@
#include "config.h"
#include "downloader-view.h"
-#include "eel-gconf-extensions.h"
#include "ephy-adblock-manager.h"
#include "ephy-debug.h"
#include "ephy-embed.h"
@@ -40,6 +39,7 @@
#include "ephy-file-helpers.h"
#include "ephy-history.h"
#include "ephy-prefs.h"
+#include "ephy-settings.h"
#include "ephy-stock-icons.h"
#include "ephy-string.h"
#include "ephy-web-view.h"
@@ -445,7 +445,7 @@ request_destination_uri (WebKitWebView *web_view,
dialog = ephy_file_chooser_new (_("Save"),
window,
GTK_FILE_CHOOSER_ACTION_SAVE,
- CONF_STATE_SAVE_DIR,
+ EPHY_PREFS_STATE_SAVE_DIR,
EPHY_FILE_FILTER_ALL_SUPPORTED);
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE);
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), suggested_filename);
@@ -823,7 +823,8 @@ download_status_changed_cb (GObject *object,
*/
g_object_freeze_notify (G_OBJECT (download));
- if (eel_gconf_get_boolean (CONF_AUTO_DOWNLOADS)) {
+ if (g_settings_get_boolean (EPHY_SETTINGS_MAIN,
+ EPHY_PREFS_AUTO_DOWNLOADS)) {
perform_auto_download (download);
/* User won't select a destination, unfreeze. */
g_object_thaw_notify (G_OBJECT (download));
@@ -857,7 +858,8 @@ download_requested_cb (WebKitWebView *web_view,
EphyEmbed *embed)
{
/* Is download locked down? */
- if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_SAVE_TO_DISK))
+ if (g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_SAVE_TO_DISK))
return FALSE;
/* Wait for the request to be sent in all cases, so that we have a
diff --git a/embed/ephy-encodings.c b/embed/ephy-encodings.c
index 15230ac64..597f53132 100644
--- a/embed/ephy-encodings.c
+++ b/embed/ephy-encodings.c
@@ -24,8 +24,9 @@
#include "ephy-encodings.h"
#include "ephy-node-db.h"
#include "ephy-file-helpers.h"
-#include "eel-gconf-extensions.h"
#include "ephy-debug.h"
+#include "ephy-prefs.h"
+#include "ephy-settings.h"
#include <glib/gi18n.h>
#include <string.h>
@@ -146,7 +147,6 @@ enum
DETECTORS_NODE_ID = 5
};
-#define RECENT_KEY "/apps/epiphany/general/recent_encodings"
#define RECENT_MAX 4
static void ephy_encodings_class_init (EphyEncodingsClass *klass);
@@ -326,7 +326,8 @@ void
ephy_encodings_add_recent (EphyEncodings *encodings,
const char *code)
{
- GSList *element;
+ GSList *element, *l;
+ GVariantBuilder builder;
g_return_if_fail (EPHY_IS_ENCODINGS (encodings));
g_return_if_fail (code != NULL);
@@ -358,8 +359,15 @@ ephy_encodings_add_recent (EphyEncodings *encodings,
g_slist_remove_link (encodings->priv->recent, tail);
}
- /* persist the list */
- eel_gconf_set_string_list (RECENT_KEY, encodings->priv->recent);
+ g_variant_builder_init (&builder, G_VARIANT_TYPE_STRING_ARRAY);
+ for (l = encodings->priv->recent; l; l = l->next)
+ {
+ g_variant_builder_add (&builder, "s", l->data);
+ }
+
+ g_settings_set (EPHY_SETTINGS_STATE,
+ EPHY_PREFS_STATE_RECENT_ENCODINGS,
+ "as", &builder);
}
GList *
@@ -385,8 +393,8 @@ static void
ephy_encodings_init (EphyEncodings *encodings)
{
EphyNodeDb *db;
- GSList *list, *l;
- guint i;
+ char **list;
+ int i;
encodings->priv = EPHY_ENCODINGS_GET_PRIVATE (encodings);
@@ -412,29 +420,29 @@ ephy_encodings_init (EphyEncodings *encodings)
}
/* get the list of recently used encodings */
- list = eel_gconf_get_string_list (RECENT_KEY);
+ list = g_settings_get_strv (EPHY_SETTINGS_STATE,
+ EPHY_PREFS_STATE_RECENT_ENCODINGS);
/* make sure the list has no duplicates (GtkUIManager goes
* crazy otherwise), and only valid entries
*/
encodings->priv->recent = NULL;
- for (l = list; l != NULL; l = l->next)
+ for (i = 0; list[i]; i++)
{
- if (g_slist_find (encodings->priv->recent, l->data) == NULL
+ char *item;
+ item = list[i];
+
+ if (g_slist_find (encodings->priv->recent, item) == NULL
&& g_slist_length (encodings->priv->recent) < RECENT_MAX
- && ephy_encodings_get_node (encodings, l->data, FALSE) != NULL)
+ && ephy_encodings_get_node (encodings, item, FALSE) != NULL)
{
encodings->priv->recent =
g_slist_prepend (encodings->priv->recent,
- l->data);
- }
- else
- {
- g_free (l->data);
+ g_strdup (item));
}
}
encodings->priv->recent = g_slist_reverse (encodings->priv->recent);
- g_slist_free (list);
+ g_strfreev (list);
}
EphyEncodings *
diff --git a/embed/ephy-history.c b/embed/ephy-history.c
index 117315c34..86a4aaaf0 100644
--- a/embed/ephy-history.c
+++ b/embed/ephy-history.c
@@ -26,8 +26,8 @@
#include "ephy-debug.h"
#include "ephy-node-db.h"
#include "ephy-node-common.h"
-#include "eel-gconf-extensions.h"
#include "ephy-prefs.h"
+#include "ephy-settings.h"
#include "ephy-string.h"
#include <time.h>
@@ -59,7 +59,6 @@ struct _EphyHistoryPrivate
GHashTable *pages_hash;
guint autosave_timeout;
guint update_hosts_idle;
- guint disable_history_notifier_id;
gboolean dirty;
gboolean enabled;
};
@@ -469,16 +468,6 @@ connect_page_removed_from_host (char *url,
}
static void
-disable_history_notifier (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- EphyHistory *history)
-{
- ephy_history_set_enabled
- (history, !eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_HISTORY));
-}
-
-static void
ephy_history_init (EphyHistory *eb)
{
EphyNodeDb *db;
@@ -561,10 +550,10 @@ ephy_history_init (EphyHistory *eb)
(GSourceFunc)periodic_save_cb,
eb);
- disable_history_notifier (NULL, 0, NULL, eb);
- eb->priv->disable_history_notifier_id = eel_gconf_notification_add
- (CONF_LOCKDOWN_DISABLE_HISTORY,
- (GConfClientNotifyFunc) disable_history_notifier, eb);
+ g_settings_bind (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_HISTORY,
+ eb, "enabled",
+ G_SETTINGS_BIND_INVERT_BOOLEAN | G_SETTINGS_BIND_GET);
}
static void
@@ -589,8 +578,6 @@ ephy_history_finalize (GObject *object)
g_source_remove (eb->priv->autosave_timeout);
- eel_gconf_notification_remove (eb->priv->disable_history_notifier_id);
-
g_free (eb->priv->xml_file);
LOG ("Global history finalized");
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index ba2f48f78..ac68164d4 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -29,7 +29,6 @@
#include <webkit/webkit.h>
#include <gnome-keyring.h>
-#include "eel-gconf-extensions.h"
#include "ephy-debug.h"
#include "ephy-embed.h"
#include "ephy-embed-container.h"
@@ -45,6 +44,7 @@
#include "ephy-profile-migration.h"
#include "ephy-favicon-cache.h"
#include "ephy-history.h"
+#include "ephy-settings.h"
#include "ephy-string.h"
#include "ephy-web-view.h"
#include "ephy-zoom.h"
@@ -345,8 +345,8 @@ ephy_web_view_get_popups_allowed (EphyWebView *view)
break;
case EPHY_PERMISSION_DEFAULT:
default:
- allow = eel_gconf_get_boolean
- (CONF_SECURITY_ALLOW_POPUPS);
+ allow = g_settings_get_boolean (EPHY_SETTINGS_WEB,
+ EPHY_PREFS_WEB_ENABLE_POPUPS);
break;
}
@@ -1990,7 +1990,8 @@ load_status_cb (WebKitWebView *web_view,
g_object_notify (object, "embed-title");
if (ephy_has_private_profile () == FALSE &&
- eel_gconf_get_boolean (CONF_PRIVACY_REMEMBER_PASSWORDS))
+ g_settings_get_boolean (EPHY_SETTINGS_MAIN,
+ EPHY_PREFS_REMEMBER_PASSWORDS))
_ephy_web_view_hook_into_forms (view);
_ephy_web_view_hook_into_links (view);
@@ -2220,7 +2221,8 @@ normalize_or_autosearch_url (EphyWebView *view, const char *url)
!g_regex_match (priv->non_search_regex, url, 0, NULL)) {
char *query_param, *url_search;
- url_search = eel_gconf_get_string (CONF_URL_SEARCH);
+ url_search = g_settings_get_string (EPHY_SETTINGS_MAIN,
+ EPHY_PREFS_KEYWORD_SEARCH_URL);
if (url_search == NULL || url_search[0] == '\0') {
g_free (url_search);
@@ -3561,7 +3563,7 @@ ephy_web_view_load_homepage (EphyWebView *view)
g_signal_emit_by_name (view, "loading-homepage");
- home = eel_gconf_get_string (CONF_GENERAL_HOMEPAGE);
+ home = g_settings_get_string (EPHY_SETTINGS_MAIN, EPHY_PREFS_HOMEPAGE_URL);
if (home == NULL || home[0] == '\0')
{