[gitg] Add platform specific styles



commit 2f4fbc73a7ffa495a3fe178fedc56a92962e8d61
Author: Jesse van den Kieboom <jessevdk gnome org>
Date:   Mon Dec 21 21:53:53 2015 +0100

    Add platform specific styles

 configure.ac                                       |    4 ++++
 gitg/Makefile.am                                   |    7 ++++++-
 gitg/gitg-application.vala                         |   15 ++++++++++-----
 .../{gitg-resources.xml => gitg-resources.xml.in}  |    1 +
 gitg/resources/ui/style-osx.css                    |    3 +++
 vapi/config.vapi                                   |    1 +
 6 files changed, 25 insertions(+), 6 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 1602a08..c96abfe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -116,9 +116,12 @@ do
 done
 
 AC_SUBST(PLATFORM_NAME)
+
 AM_CONDITIONAL(PLATFORM_OSX, test x"$PLATFORM_NAME" = "xosx")
 AM_CONDITIONAL(PLATFORM_WIN32, test x"$PLATFORM_NAME" = "xwin32")
 
+AC_DEFINE_UNQUOTED(PLATFORM_NAME,"$PLATFORM_NAME", [platform name])
+
 PKG_CHECK_MODULES(LIBGITG, [
        gthread-2.0 >= $GLIB_REQUIRED_VERSION
        glib-2.0 >= $GLIB_REQUIRED_VERSION
@@ -345,6 +348,7 @@ LIBGD_INIT([
 
 AC_CONFIG_FILES([
 Makefile
+gitg/resources/gitg-resources.xml
 libgd/Makefile
 libgitg/libgitg-1.0.pc
 libgitg-ext/libgitg-ext-1.0.pc
diff --git a/gitg/Makefile.am b/gitg/Makefile.am
index 33dfe0b..e241f93 100644
--- a/gitg/Makefile.am
+++ b/gitg/Makefile.am
@@ -107,6 +107,11 @@ gitg/gitg-resources.c: $(gitg_resources_deps)
        $(GRESGEN)
 
 CLEANFILES += gitg/gitg-resources.c
-EXTRA_DIST += $(gitg_resources_deps)
+EXTRA_DIST +=                                  \
+       $(gitg_resources_deps)                  \
+       gitg/resources/gitg-resources.xml.in    \
+       gitg/resources/ui/style-osx.css         \
+       gitg/resources/ui/style-win32.css       \
+       gitg/resources/ui/style-unix.css
 
 # vi:ts=8:noet
diff --git a/gitg/gitg-application.vala b/gitg/gitg-application.vala
index 16a474e..f2b8854 100644
--- a/gitg/gitg-application.vala
+++ b/gitg/gitg-application.vala
@@ -383,8 +383,16 @@ public class Application : Gtk.Application
                        }
                }
 
-               // Use our own css provider
-               Gtk.CssProvider? provider = Resource.load_css("style.css");
+               add_css("style.css");
+               add_css(@"style-$(Config.PLATFORM_NAME).css");;
+
+               var theme = Gtk.IconTheme.get_default();
+               theme.prepend_search_path(Path.build_filename(PlatformSupport.get_data_dir(), "icons"));
+       }
+
+       private void add_css(string path)
+       {
+               Gtk.CssProvider? provider = Resource.load_css(path);
 
                if (provider != null)
                {
@@ -392,9 +400,6 @@ public class Application : Gtk.Application
                                                                 provider,
                                                                 600);
                }
-
-               var theme = Gtk.IconTheme.get_default();
-               theme.prepend_search_path(Path.build_filename(PlatformSupport.get_data_dir(), "icons"));
        }
 
        protected override void shutdown()
diff --git a/gitg/resources/gitg-resources.xml b/gitg/resources/gitg-resources.xml.in
similarity index 97%
rename from gitg/resources/gitg-resources.xml
rename to gitg/resources/gitg-resources.xml.in
index 3b80541..ed48baa 100644
--- a/gitg/resources/gitg-resources.xml
+++ b/gitg/resources/gitg-resources.xml.in
@@ -25,6 +25,7 @@
     <file compressed="true" preprocess="xml-stripblanks">ui/gitg-remote-notification.ui</file>
 
     <file compressed="true">ui/style.css</file>
+    <file compressed="true">ui/style- PLATFORM_NAME@.css</file>
   </gresource>
 </gresources>
 
diff --git a/gitg/resources/ui/style-osx.css b/gitg/resources/ui/style-osx.css
new file mode 100644
index 0000000..6ff3fb5
--- /dev/null
+++ b/gitg/resources/ui/style-osx.css
@@ -0,0 +1,3 @@
+.monospace {
+       font: menlo;
+}
diff --git a/gitg/resources/ui/style-unix.css b/gitg/resources/ui/style-unix.css
new file mode 100644
index 0000000..e69de29
diff --git a/gitg/resources/ui/style-win32.css b/gitg/resources/ui/style-win32.css
new file mode 100644
index 0000000..e69de29
diff --git a/vapi/config.vapi b/vapi/config.vapi
index fa2dd34..2cfe3d3 100644
--- a/vapi/config.vapi
+++ b/vapi/config.vapi
@@ -9,6 +9,7 @@ namespace Gitg.Config
        public const string GITG_LOCALEDIR;
        public const string GITG_LIBDIR;
        public const string VERSION;
+       public const string PLATFORM_NAME;
 }
 
 // ex:ts=4 noet


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