Skip to content

Commit

Permalink
Merge branch 'gtk3-update7' of https://github.com/Bob-IT/gnucash into…
Browse files Browse the repository at this point in the history
… unstable
  • Loading branch information
gjanssens committed Oct 31, 2017
2 parents 9669bd6 + 641d56f commit f05761e
Show file tree
Hide file tree
Showing 10 changed files with 180 additions and 28 deletions.
3 changes: 3 additions & 0 deletions configure.ac
Expand Up @@ -333,6 +333,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)
Expand Down
37 changes: 36 additions & 1 deletion gnucash/CMakeLists.txt
Expand Up @@ -27,6 +27,7 @@ ENDIF (WIN32)

SET (gnucash_SOURCES
gnucash-bin.c
gnucash-gresources.c
${GNUCASH_RESOURCE_FILE}
)

Expand All @@ -44,6 +45,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})
Expand Down Expand Up @@ -204,7 +239,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}
Expand Down
9 changes: 8 additions & 1 deletion gnucash/Makefile.am
Expand Up @@ -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 \
Expand Down Expand Up @@ -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\"
47 changes: 34 additions & 13 deletions gnucash/gnome-utils/gnc-gnome-utils.c
Expand Up @@ -169,15 +169,40 @@ 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)
{
GtkCssProvider *provider_user, *provider_app, *provider_fallback;
GdkDisplay *display;
GdkScreen *screen;
const gchar *var;
gchar* pkgdatadir = gnc_path_get_pkgdatadir ();
gchar *str;
GError *error = 0;

provider_user = gtk_css_provider_new ();
Expand All @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions gnucash/gnome-utils/ui/CMakeLists.txt
Expand Up @@ -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})
4 changes: 1 addition & 3 deletions gnucash/gnome-utils/ui/Makefile.am
Expand Up @@ -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
81 changes: 81 additions & 0 deletions gnucash/gnucash-310.css
@@ -0,0 +1,81 @@
/* Note: Widgets obtained from Glade files will not be addressable
unless they have been named or have style classes added. Only
the widget type can be configured unless they are named in code */


/* Negative value label colors */
.default-color {
color: @default-color;
}

.negative-numbers {
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;
}

cursor button {
padding: 1px 1px 1px 1px;
}

/* Register defaults */
@define-color register_header_bg_color #96B183;
@define-color register_primary_bg_color #BFDEB9;
@define-color register_secondary_bg_color #F6FFDA;
@define-color register_split_bg_color #EDE7D3;
@define-color register_cursor_bg_color #FFEF98;

.register-header {
background-color: @register_header_bg_color;
}

*.register-primary {
background-color: @register_primary_bg_color;
}

*.register-primary:insensitive {
background-color: mix (@register_primary_bg_color, grey, 0.2);
}

*.register-secondary {
background-color: @register_secondary_bg_color;
}

*.register-secondary:insensitive {
background-color: mix (@register_secondary_bg_color, grey, 0.2);
}

*.register-split {
background-color: @register_split_bg_color;
}

*.register-split:insensitive {
background-color: mix (@register_split_bg_color, grey, 0.2);
}

*.register-cursor {
background-color: @register_cursor_bg_color;
}

*.register-cursor:insensitive {
background-color: mix (@register_cursor_bg_color, grey, 0.2);
}

/* Some tweaks for the about dialog */
dialog#GnuCash > box > box > label
{
font-size: 24px;
}

12 changes: 6 additions & 6 deletions gnucash/gnome-utils/ui/gnucash.css → 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 */


Expand Down Expand Up @@ -36,36 +36,36 @@ cursor button {
background-color: @register_primary_bg_color;
}

*.register-primary:insensitive {
*.register-primary:disabled {
background-color: mix (@register_primary_bg_color, grey, 0.2);
}

*.register-secondary {
background-color: @register_secondary_bg_color;
}

*.register-secondary:insensitive {
*.register-secondary:disabled {
background-color: mix (@register_secondary_bg_color, grey, 0.2);
}

*.register-split {
background-color: @register_split_bg_color;
}

*.register-split:insensitive {
*.register-split:disabled {
background-color: mix (@register_split_bg_color, grey, 0.2);
}

*.register-cursor {
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;
font-size: 24px;
}
@@ -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 */


Expand Down Expand Up @@ -62,7 +62,7 @@
@define-color marker_bg_color yellow;

*.primary {
background-color: @primary_bg_color;
background-color: @primary_bg_color;
}

*.primary-dark {
Expand Down
9 changes: 9 additions & 0 deletions 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>

0 comments on commit f05761e

Please sign in to comment.