[gnome-web-photo/webkit] Add back the use of a user CSS



commit 1e67a1604434d469027ba63a288d86394386032d
Author: Vincent Untz <vuntz gnome org>
Date:   Wed Feb 16 16:05:45 2011 +0100

    Add back the use of a user CSS
    
    It's empty at the moment, but people might want to tweak that.

 data/Makefile.am      |    8 ++++++--
 data/style.css        |    3 +++
 src/Makefile.am       |    1 +
 src/gnome-web-photo.c |    9 +++++++++
 4 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/data/Makefile.am b/data/Makefile.am
index 3665bee..b507253 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -20,9 +20,13 @@ thumbnailerdir = $(datadir)/thumbnailers
 thumbnailer_DATA = gnome-web-photo.thumbnailer
 endif
 
+cssdir = $(pkgdatadir)
+css_DATA = style.css
+
 EXTRA_DIST = \
-	$(schema_in_files) \
-	$(thumbnailer_DATA)
+	$(schema_in_files)	\
+	$(thumbnailer_DATA)	\
+	$(css_DATA)
 
 CLEANFILES = $(schema_DATA)
 DISTCLEANFILES = $(schema_DATA)
diff --git a/data/style.css b/data/style.css
new file mode 100644
index 0000000..9865cf3
--- /dev/null
+++ b/data/style.css
@@ -0,0 +1,3 @@
+/* Content of this CSS will be used in the pages rendered by gnome-web-photo.
+ * Use "!important" to override a rule that might be specified in the CSS
+ * of the page. See http://www.w3.org/TR/CSS2/cascade.html#important-rules */
diff --git a/src/Makefile.am b/src/Makefile.am
index 9df9dc3..5a5431a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -7,6 +7,7 @@ gnome_web_photo_SOURCES =		\
 
 gnome_web_photo_CPPFLAGS = \
 	$(DEPENDENCY_CFLAGS)			\
+	-DPKGDATADIR=\"$(pkgdatadir)\"		\
 	-DLOCALEDIR=\"$(datadir)/locale\"	\
 	$(AM_CPPFLAGS)
 
diff --git a/src/gnome-web-photo.c b/src/gnome-web-photo.c
index 9152d81..c9528bb 100644
--- a/src/gnome-web-photo.c
+++ b/src/gnome-web-photo.c
@@ -243,9 +243,14 @@ _prepare_web_settings (WebKitWebSettings *settings,
   char *value;
   char *font_name = NULL;
   int   font_size = 0;
+  char *css_uri;
 
   /* Various settings */
 
+  value = g_build_filename (PKGDATADIR, "style.css", NULL);
+  css_uri = g_filename_to_uri (value, NULL, NULL);
+  g_free (value);
+
   g_object_set (G_OBJECT (settings),
                 /* printing settings */
                 "print-backgrounds", print_background,
@@ -260,8 +265,12 @@ _prepare_web_settings (WebKitWebSettings *settings,
                 /* ensure secure settings */
                 "javascript-can-access-clipboard", FALSE,
                 "enable-universal-access-from-file-uris", FALSE,
+                /* custom css */
+                "user-stylesheet-uri", css_uri,
                 NULL);
 
+  g_free (css_uri);
+
   /* Fetch fonts from user config */
 
 #ifdef HAVE_GNOME3



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]