[evince/gnome-3-20] Allow to use a different CSS file depending to the GTK+ version



commit 92df336e54f7bba630b129a731baa291734a7ce6
Author: Carlos Garcia Campos <carlosgc gnome org>
Date:   Sun Jun 19 09:59:52 2016 +0200

    Allow to use a different CSS file depending to the GTK+ version
    
    If GTK+ >= 3.20 evince.css is used, otherwise evince-3-18.css.
    For now both files are the same, but this will allow us to fix the
    appearance with GTK+ 3.20 without breaking it with previous versions.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=765557

 configure.ac                                       |    4 ++
 shell/Makefile.am                                  |   19 ++++++-
 shell/evince-3-18.css                              |   57 ++++++++++++++++++++
 ...vince.gresource.xml => evince.gresource.xml.in} |    2 +-
 4 files changed, 78 insertions(+), 4 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 01e602f..abe80c8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -174,6 +174,10 @@ else
    AC_MSG_RESULT([no])
 fi
 
+
+# Check if GTK+ version is older than 3.20 to use different CSS.
+AM_CONDITIONAL([HAVE_GTK_320],[$($PKG_CONFIG --atleast-version=3.20.0 gtk+-3.0)])
+
 SHELL_PLATFORM_PKGS=
 case "$with_platform" in
   gnome)
diff --git a/shell/Makefile.am b/shell/Makefile.am
index 9719fa1..757c813 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -168,14 +168,27 @@ endif
 
 EXTRA_DIST = \
        evince.css \
+       evince-3-18.css \
        evince-menus.ui \
         help-overlay.ui \
        evince-icon.rc \
-       evince.gresource.xml \
+       evince.gresource.xml.in \
        ev-gdbus.xml \
        ev-daemon-gdbus.xml
 
-ev-resources.c: evince.gresource.xml Makefile $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies 
--sourcedir=$(srcdir) --sourcedir=$(top_srcdir)/data $(srcdir)/evince.gresource.xml)
+GRESOURCE_XML_IN_FILES = evince.gresource.xml.in
+GRESOURCE_XML_FILE = $(GRESOURCE_XML_IN_FILES:.xml.in=.xml)
+
+if HAVE_GTK_320
+EVINCE_CSS=evince.css
+else
+EVINCE_CSS=evince-3-18.css
+endif
+
+$(GRESOURCE_XML_FILE): $(GRESOURCE_XML_IN_FILES) Makefile
+       $(AM_V_GEN) $(SED) -e "s|\ EVINCE_CSS\@|$(EVINCE_CSS)|" $< > $@
+
+ev-resources.c: $(GRESOURCE_XML_FILE) Makefile $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies 
--sourcedir=$(srcdir) --sourcedir=$(top_srcdir)/data $(srcdir)/evince.gresource.xml)
        $(AM_V_GEN) XMLLINT=$(XMLLINT) $(GLIB_COMPILE_RESOURCES) --target $@ --sourcedir=$(srcdir) 
--sourcedir=$(top_srcdir)/data --generate-source --c-name ev $<
 
 ev-gdbus-generated.c ev-gdbus-generated.h: ev-gdbus.xml Makefile
@@ -194,6 +207,6 @@ ev-daemon-gdbus-generated.c ev-daemon-gdbus-generated.h: ev-daemon-gdbus.xml Mak
                        --generate-c-code ev-daemon-gdbus-generated \
                        $<
 
-DISTCLEANFILES = $(BUILT_SOURCES)
+DISTCLEANFILES = $(BUILT_SOURCES) $(GRESOURCE_XML_FILE)
 
 -include $(top_srcdir)/git.mk
diff --git a/shell/evince-3-18.css b/shell/evince-3-18.css
new file mode 100644
index 0000000..d8c4613
--- /dev/null
+++ b/shell/evince-3-18.css
@@ -0,0 +1,57 @@
+#ev-fullscreen-toolbar {
+    -GtkToolbar-shadow-type: none;
+}
+
+#ev-loading-message {
+    background-color: @theme_bg_color;
+    color: @theme_fg_color;
+    border-radius: 10px;
+    padding: 10px;
+}
+
+.content-view.document-page {
+    border-style: solid;
+    border-width: 3px 3px 6px 4px;
+    border-image: url("resource:///org/gnome/evince/ui/thumbnail-frame.png") 3 3 6 4;
+    background-color: @theme_bg_color;
+}
+
+EvView {
+    background-color: @theme_bg_color;
+}
+
+EvView:selected {
+    background-color: @theme_selected_bg_color;
+}
+
+EvView.document-page {
+    background-color: white;
+    padding: 0;
+}
+
+EvView.document-page.inverted {
+    background-color: black;
+}
+
+EvSidebarThumbnails.page-thumbnail {
+    background-color: white;
+    border-color: black;
+    border-style: solid;
+    border-width: 1px;
+    border-radius: 0;
+    border-image: none;
+    padding: 0;
+}
+
+EvSidebarThumbnails.page-thumbnail.inverted {
+    background-color: black;
+}
+
+ binding-set MoveCursor {
+    unbind "<Control>p";
+    unbind "<Control>n";
+}
+
+GtkIconView {
+    gtk-key-bindings: MoveCursor;
+}
diff --git a/shell/evince.gresource.xml b/shell/evince.gresource.xml.in
similarity index 93%
rename from shell/evince.gresource.xml
rename to shell/evince.gresource.xml.in
index c7dcc17..873a444 100644
--- a/shell/evince.gresource.xml
+++ b/shell/evince.gresource.xml.in
@@ -18,7 +18,7 @@
 <gresources>
   <gresource prefix="/org/gnome/evince">
     <file alias="gtk/help-overlay.ui" preprocess="xml-stripblanks">help-overlay.ui</file>
-    <file alias="ui/evince.css" compressed="true">evince.css</file>
+    <file alias="ui/evince.css" compressed="true">@EVINCE_CSS@</file>
     <file alias="ui/thumbnail-frame.png" compressed="true">thumbnail-frame.png</file>
     <file alias="gtk/menus.ui" compressed="true" preprocess="xml-stripblanks">evince-menus.ui</file>
   </gresource>


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