aboutsummaryrefslogtreecommitdiffstats
path: root/embed/webkit/webkit-embed-prefs.c
diff options
context:
space:
mode:
authorXan Lopez <xan@src.gnome.org>2009-02-27 19:23:44 +0800
committerXan Lopez <xan@src.gnome.org>2009-02-27 19:23:44 +0800
commit984af6ebf45e9615c9aa8f7c3d97e776ed480502 (patch)
treecefc650e1dcd593c59d637e77502e75fe5550888 /embed/webkit/webkit-embed-prefs.c
parent629007ce134231d72cc85db3a411c0e3ec303c63 (diff)
downloadgsoc2013-epiphany-984af6ebf45e9615c9aa8f7c3d97e776ed480502.tar
gsoc2013-epiphany-984af6ebf45e9615c9aa8f7c3d97e776ed480502.tar.gz
gsoc2013-epiphany-984af6ebf45e9615c9aa8f7c3d97e776ed480502.tar.bz2
gsoc2013-epiphany-984af6ebf45e9615c9aa8f7c3d97e776ed480502.tar.lz
gsoc2013-epiphany-984af6ebf45e9615c9aa8f7c3d97e776ed480502.tar.xz
gsoc2013-epiphany-984af6ebf45e9615c9aa8f7c3d97e776ed480502.tar.zst
gsoc2013-epiphany-984af6ebf45e9615c9aa8f7c3d97e776ed480502.zip
webkit-embed-prefs: support user style sheets.
Bug #562628 svn path=/trunk/; revision=8819
Diffstat (limited to 'embed/webkit/webkit-embed-prefs.c')
-rw-r--r--embed/webkit/webkit-embed-prefs.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/embed/webkit/webkit-embed-prefs.c b/embed/webkit/webkit-embed-prefs.c
index 4ee0d0ea0..77cac6cad 100644
--- a/embed/webkit/webkit-embed-prefs.c
+++ b/embed/webkit/webkit-embed-prefs.c
@@ -25,6 +25,7 @@
#include "webkit-embed-prefs.h"
#include "eel-gconf-extensions.h"
#include "ephy-embed-prefs.h"
+#include "ephy-file-helpers.h"
typedef struct
{
@@ -101,6 +102,37 @@ webkit_pref_callback_string (GConfClient *client,
g_object_set (settings, webkit_pref, value, NULL);
}
+static void
+webkit_pref_callback_user_stylesheet (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ 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);
+ }
+
+ if (value)
+ /* We need the leading file://, so use g_strconcat instead
+ * of g_build_filename */
+ uri = g_strconcat ("file://",
+ ephy_dot_dir (),
+ G_DIR_SEPARATOR_S,
+ USER_STYLESHEET_FILENAME,
+ NULL);
+ g_object_set (settings, webkit_pref, uri, NULL);
+ g_free (uri);
+}
+
static const PrefData webkit_pref_entries[] =
{
{ CONF_RENDERING_FONT_MIN_SIZE,
@@ -114,7 +146,10 @@ static const PrefData webkit_pref_entries[] =
webkit_pref_callback_string },
{ CONF_WEB_INSPECTOR_ENABLED,
"enable-developer-extras",
- webkit_pref_callback_boolean }
+ webkit_pref_callback_boolean },
+ { CONF_USER_CSS_ENABLED,
+ "user-stylesheet-uri",
+ webkit_pref_callback_user_stylesheet }
};
static void