gnucash unstable: Multiple changes pushed

Geert Janssens gjanssens at code.gnucash.org
Tue Oct 31 04:56:12 EDT 2017


Updated	 via  https://github.com/Gnucash/gnucash/commit/f05761e6 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/641d56f3 (commit)
	from  https://github.com/Gnucash/gnucash/commit/9669bd6b (commit)



commit f05761e636f27810145b55e2ef25a93b88c2ca1b
Merge: 9669bd6 641d56f
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Tue Oct 31 09:53:33 2017 +0100

    Merge branch 'gtk3-update7' of https://github.com/Bob-IT/gnucash into unstable

diff --cc gnucash/gnucash-320.css
index 812d063,29242ca..d7e0495
--- a/gnucash/gnucash-320.css
+++ b/gnucash/gnucash-320.css
@@@ -67,5 -67,6 +67,5 @@@ cursor button 
  /* Some tweaks for the about dialog */
  dialog#GnuCash > box > box > label
  {
-     font-size: 24px;
+   font-size: 24px;
  }
 -

commit 641d56f346f256cc8517f8014449dd5cb978f912
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Mon Oct 2 11:36:18 2017 +0100

    Move the CSS files to a Gresource file
    
    Move the source CSS files to the gnucash directory and load them from
    a gresource file. As pseudo class 'insensative' is deprecated, add a
    second main css file to be used after Gtk3.20

diff --git a/configure.ac b/configure.ac
index fd23a64..5b7fedc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -325,6 +325,9 @@ AC_CHECK_HEADERS(dirent.h dlfcn.h dl.h utmp.h locale.h mcheck.h unistd.h wctype.
 
 GLIB_GSETTINGS
 
+GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable glib_compile_resources gio-2.0`
+AC_SUBST(GLIB_COMPILE_RESOURCES)
+
 # I'm sure we (used to?) require this in various places, so don't remove
 # this test unless you've done sufficient code review/testing.
 AC_MSG_CHECKING(if unsigned long is at least as big as guint32)
diff --git a/gnucash/CMakeLists.txt b/gnucash/CMakeLists.txt
index b939be5..a85ebfd 100644
--- a/gnucash/CMakeLists.txt
+++ b/gnucash/CMakeLists.txt
@@ -27,6 +27,7 @@ ENDIF (WIN32)
 
 SET (gnucash_SOURCES
   gnucash-bin.c
+  gnucash-gresources.c
   ${GNUCASH_RESOURCE_FILE}
 )
 
@@ -42,6 +43,40 @@ TARGET_LINK_LIBRARIES (gnucash
    ${GUILE_LDFLAGS} ${GLIB2_LDFLAGS} ${GTK3_LDFLAGS} ${GTK_MAC_LDFLAGS}
 )
 
+# Get glib executable for generating the gresource file
+EXECUTE_PROCESS(
+   COMMAND
+       ${PKG_CONFIG_EXECUTABLE} gio-2.0 --variable glib_compile_resources
+   OUTPUT_VARIABLE
+       GLIB_COMPILE_RESOURCES_EXECUTABLE
+   OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+
+# Get the dependencies of the gresource
+EXECUTE_PROCESS(
+  OUTPUT_VARIABLE
+      gr_files
+  COMMAND ${GLIB_COMPILE_RESOURCES_EXECUTABLE}
+     --sourcedir=${CMAKE_CURRENT_SOURCE_DIR}
+     --generate-dependencies
+     ${CMAKE_CURRENT_SOURCE_DIR}/gnucash-gresources.xml
+)
+
+STRING (REPLACE "\n" ";" gresource_files ${gr_files})
+
+ADD_CUSTOM_COMMAND(
+   OUTPUT gnucash-gresources.c
+   COMMAND
+    ${GLIB_COMPILE_RESOURCES_EXECUTABLE}
+    --target=gnucash-gresources.c
+    --sourcedir=${CMAKE_CURRENT_SOURCE_DIR}
+    --generate-source
+    ${CMAKE_CURRENT_SOURCE_DIR}/gnucash-gresources.xml
+   DEPENDS
+    ${CMAKE_CURRENT_SOURCE_DIR}/gnucash-gresources.xml ${gresource_files}
+   WORKING_DIRECTORY
+    ${CMAKE_CURRENT_BINARY_DIR}
+)
 
 IF (MAC_INTEGRATION)
   TARGET_COMPILE_OPTIONS(gnucash PRIVATE ${OSX_EXTRA_COMPILE_FLAGS})
@@ -202,7 +237,7 @@ ENDIF(WIN32)
 
 
 SET_LOCAL_DIST(gnucash_DIST_local CMakeLists.txt environment.in generate-gnc-script
-               gnucash-bin.c gnucash.rc.in gnucash-valgrind.in
+               gnucash-bin.c gnucash.rc.in gnucash-valgrind.in gnucash-gresourses.xml ${gresource_files}
                Makefile.am ${gnucash_EXTRA_DIST})
 
 SET(gnucash_DIST ${gnucash_DIST_local} ${gnome_DIST} ${gnome_search_DIST}
diff --git a/gnucash/Makefile.am b/gnucash/Makefile.am
index 9687a4f..c79855f 100644
--- a/gnucash/Makefile.am
+++ b/gnucash/Makefile.am
@@ -55,9 +55,14 @@ PLATFORM_FILES = gnucash-valgrind
 
 endif !PLATFORM_WIN32
 
+# gresource for css
+gresource_files = $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/gnucash-gresources.xml)
+gnucash-gresources.c: gnucash-gresources.xml $(gresource_files)
+	$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate-source $<
+
 BIN_NAME = gnucash
 bin_PROGRAMS = ${BIN_NAME}
-gnucash_SOURCES = gnucash-bin.c ${GNUCASH_RESOURCE_FILE}
+gnucash_SOURCES = gnucash-bin.c gnucash-gresources.c ${GNUCASH_RESOURCE_FILE}
 gnucash_LDADD = \
   ${top_builddir}/gnucash/register/ledger-core/libgncmod-ledger-core.la \
   ${top_builddir}/gnucash/report/report-gnome/libgncmod-report-gnome.la \
@@ -156,6 +161,8 @@ EXTRA_DIST = \
 	generate-gnc-script \
 	gnucash-valgrind.in \
 	environment.in \
+	gnucash-gresources.xml \
+	${gresource_files} \
 	CMakeLists.txt
 
 AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.bin\"
diff --git a/gnucash/gnome-utils/gnc-gnome-utils.c b/gnucash/gnome-utils/gnc-gnome-utils.c
index 1642ed9..099072c 100644
--- a/gnucash/gnome-utils/gnc-gnome-utils.c
+++ b/gnucash/gnome-utils/gnc-gnome-utils.c
@@ -169,6 +169,33 @@ gnc_configure_date_completion (void)
     qof_date_completion_set(dc, backmonths);
 }
 
+/* This function was copied from GTK3.22 as it was only introduced in
+ * version 3.16 */
+#if !GTK_CHECK_VERSION(3,16,0)
+static void
+gtk_css_provider_load_from_resource (GtkCssProvider *css_provider,
+                                     const gchar *resource_path)
+{
+  GFile *file;
+  gchar *uri, *escaped;
+
+  g_return_if_fail (GTK_IS_CSS_PROVIDER (css_provider));
+  g_return_if_fail (resource_path != NULL);
+
+  escaped = g_uri_escape_string (resource_path,
+                  G_URI_RESERVED_CHARS_ALLOWED_IN_PATH, FALSE);
+  uri = g_strconcat ("resource://", escaped, NULL);
+  g_free (escaped);
+
+  file = g_file_new_for_uri (uri);
+  g_free (uri);
+
+  gtk_css_provider_load_from_file (css_provider, file, NULL);
+
+  g_object_unref (file);
+}
+#endif
+
 void
 gnc_add_css_file (void)
 {
@@ -176,8 +203,6 @@ gnc_add_css_file (void)
     GdkDisplay *display;
     GdkScreen *screen;
     const gchar *var;
-    gchar* pkgdatadir = gnc_path_get_pkgdatadir ();
-    gchar *str;
     GError *error = 0;
 
     provider_user = gtk_css_provider_new ();
@@ -190,21 +215,17 @@ gnc_add_css_file (void)
     gtk_style_context_add_provider_for_screen (screen, GTK_STYLE_PROVIDER (provider_app), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
     gtk_style_context_add_provider_for_screen (screen, GTK_STYLE_PROVIDER (provider_user), GTK_STYLE_PROVIDER_PRIORITY_USER);
 
-    if (pkgdatadir)
-    {
-        str = g_build_filename (pkgdatadir, "ui", "gnucash-fallback.css", (char *)NULL);
-        gtk_css_provider_load_from_path (provider_fallback, str, &error);
-        g_free (str);
-
-        str = g_build_filename (pkgdatadir, "ui", "gnucash.css", (char *)NULL);
-        gtk_css_provider_load_from_path (provider_app, str, &error);
-        g_free (str);
-    }
-    g_free (pkgdatadir);
+#if GTK_CHECK_VERSION(3,20,0)
+    gtk_css_provider_load_from_resource (provider_app, "/org/gnucash/gnucash-320.css");
+#else
+    gtk_css_provider_load_from_resource (provider_app, "/org/gnucash/gnucash-310.css");
+#endif
+    gtk_css_provider_load_from_resource (provider_fallback,  "/org/gnucash/gnucash-fallback-310.css");
 
     var = g_get_home_dir ();
     if (var)
     {
+        gchar *str;
         str = g_build_filename (var, ".gtk-3.0-gnucash.css", (char *)NULL);
         gtk_css_provider_load_from_path (provider_user, str, &error);
         g_free (str);
diff --git a/gnucash/gnome-utils/ui/CMakeLists.txt b/gnucash/gnome-utils/ui/CMakeLists.txt
index d0bfa4a..cdf16ef 100644
--- a/gnucash/gnome-utils/ui/CMakeLists.txt
+++ b/gnucash/gnome-utils/ui/CMakeLists.txt
@@ -15,8 +15,6 @@ SET(gnome_utils_ui_DIST_local
         gnc-windows-menu-ui.xml
         Makefile.am
         osx_accel_map
-        gnucash.css
-        gnucash-fallback.css
         )
 
 SET_DIST_LIST(gnome_utils_ui_DIST ${gnome_utils_ui_DIST_local})
diff --git a/gnucash/gnome-utils/ui/Makefile.am b/gnucash/gnome-utils/ui/Makefile.am
index 4eeeec0..3f82751 100644
--- a/gnucash/gnome-utils/ui/Makefile.am
+++ b/gnucash/gnome-utils/ui/Makefile.am
@@ -3,8 +3,6 @@ ui_DATA = \
 	gnc-main-window-ui.xml \
 	gnc-windows-menu-ui.xml \
 	gnc-windows-menu-ui-quartz.xml \
-	osx_accel_map \
-	gnucash.css \
-	gnucash-fallback.css
+	osx_accel_map
 
 EXTRA_DIST = $(ui_DATA) CMakeLists.txt
diff --git a/gnucash/gnome-utils/ui/gnucash.css b/gnucash/gnucash-310.css
similarity index 85%
copy from gnucash/gnome-utils/ui/gnucash.css
copy to gnucash/gnucash-310.css
index 7ed35d1..e4a37a3 100644
--- a/gnucash/gnome-utils/ui/gnucash.css
+++ b/gnucash/gnucash-310.css
@@ -1,5 +1,5 @@
 /* Note: Widgets obtained from Glade files will not be addressable
-   unless they have been named or have style classes added. Only 
+   unless they have been named or have style classes added. Only
    the widget type can be configured unless they are named in code */
 
 
@@ -12,6 +12,15 @@
   color: @negative-numbers;
 }
 
+/* Change font color by mixing with grey */
+.lighter-grey-mix {
+  color: mix (currentColor, grey, 0.8);
+}
+
+.darker-grey-mix {
+  color: mix (currentColor, grey, 0.2);
+}
+
 /* Register Cursor padding settings, make sure entry matches sheet.h */
 cursor entry {
   padding: 2px 5px 2px 5px;
@@ -64,3 +73,9 @@ cursor button {
   background-color: mix (@register_cursor_bg_color, grey, 0.2);
 }
 
+/* Some tweaks for the about dialog */
+dialog#GnuCash > box > box > label
+{
+  font-size: 24px;
+}
+
diff --git a/gnucash/gnome-utils/ui/gnucash.css b/gnucash/gnucash-320.css
similarity index 86%
rename from gnucash/gnome-utils/ui/gnucash.css
rename to gnucash/gnucash-320.css
index 7ed35d1..29242ca 100644
--- a/gnucash/gnome-utils/ui/gnucash.css
+++ b/gnucash/gnucash-320.css
@@ -1,5 +1,5 @@
 /* Note: Widgets obtained from Glade files will not be addressable
-   unless they have been named or have style classes added. Only 
+   unless they have been named or have style classes added. Only
    the widget type can be configured unless they are named in code */
 
 
@@ -36,7 +36,7 @@ cursor button {
   background-color: @register_primary_bg_color;
 }
 
-*.register-primary:insensitive {
+*.register-primary:disabled {
   background-color: mix (@register_primary_bg_color, grey, 0.2);
 }
 
@@ -44,7 +44,7 @@ cursor button {
   background-color: @register_secondary_bg_color;
 }
 
-*.register-secondary:insensitive {
+*.register-secondary:disabled {
   background-color: mix (@register_secondary_bg_color, grey, 0.2);
 }
 
@@ -52,7 +52,7 @@ cursor button {
   background-color: @register_split_bg_color;
 }
 
-*.register-split:insensitive {
+*.register-split:disabled {
   background-color: mix (@register_split_bg_color, grey, 0.2);
 }
 
@@ -60,7 +60,13 @@ cursor button {
   background-color: @register_cursor_bg_color;
 }
 
-*.register-cursor:insensitive {
+*.register-cursor:disabled {
   background-color: mix (@register_cursor_bg_color, grey, 0.2);
 }
 
+/* Some tweaks for the about dialog */
+dialog#GnuCash > box > box > label
+{
+  font-size: 24px;
+}
+
diff --git a/gnucash/gnome-utils/ui/gnucash-fallback.css b/gnucash/gnucash-fallback-310.css
similarity index 97%
rename from gnucash/gnome-utils/ui/gnucash-fallback.css
rename to gnucash/gnucash-fallback-310.css
index b08a722..7cc73d8 100644
--- a/gnucash/gnome-utils/ui/gnucash-fallback.css
+++ b/gnucash/gnucash-fallback-310.css
@@ -1,5 +1,5 @@
 /* Note: Widgets obtained from Glade files will not be addressable
-   unless they have been named or have style classes added. Only 
+   unless they have been named or have style classes added. Only
    the widget type can be configured unless they are named in code */
 
 
@@ -62,7 +62,7 @@
 @define-color marker_bg_color yellow;
 
 *.primary {
-   background-color: @primary_bg_color;
+  background-color: @primary_bg_color;
 }
 
 *.primary-dark {
diff --git a/gnucash/gnucash-gresources.xml b/gnucash/gnucash-gresources.xml
new file mode 100644
index 0000000..78dbc6d
--- /dev/null
+++ b/gnucash/gnucash-gresources.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<gresources>
+  <gresource prefix="/org/gnucash">
+    <file>gnucash-310.css</file>
+    <file>gnucash-320.css</file>
+    <file>gnucash-fallback-310.css</file>
+  </gresource>
+</gresources>



Summary of changes:
 configure.ac                                       |  3 ++
 gnucash/CMakeLists.txt                             | 37 ++++++++++++++++-
 gnucash/Makefile.am                                |  9 ++++-
 gnucash/gnome-utils/gnc-gnome-utils.c              | 47 ++++++++++++++++------
 gnucash/gnome-utils/ui/CMakeLists.txt              |  2 -
 gnucash/gnome-utils/ui/Makefile.am                 |  4 +-
 .../ui/gnucash.css => gnucash-310.css}             | 14 ++++++-
 .../ui/gnucash.css => gnucash-320.css}             | 12 +++---
 ...ucash-fallback.css => gnucash-fallback-310.css} |  4 +-
 gnucash/gnucash-gresources.xml                     |  9 +++++
 10 files changed, 111 insertions(+), 30 deletions(-)
 copy gnucash/{gnome-utils/ui/gnucash.css => gnucash-310.css} (89%)
 rename gnucash/{gnome-utils/ui/gnucash.css => gnucash-320.css} (90%)
 rename gnucash/{gnome-utils/ui/gnucash-fallback.css => gnucash-fallback-310.css} (97%)
 create mode 100644 gnucash/gnucash-gresources.xml



More information about the gnucash-changes mailing list