diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 109db6e876..56296e8ea5 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -14,10 +14,11 @@ SET(doc_DATA README.win32-bin.txt guile-hackers.txt projects.html + gtk-3.0.css ) SET(doc_noinst_DATA - build-aix.txt build-solaris.txt CMakeLists.txt gnc-fq-dump.1 gnc-fq-helper.1 gnucash.1.in gtkrc-2.0.gnucash + build-aix.txt build-solaris.txt CMakeLists.txt gnc-fq-dump.1 gnc-fq-helper.1 gnucash.1.in misc-notes.txt README.HBCI README.OFX README.translator.txt tip_of_the_day.list.in TRANSLATION_HOWTO) diff --git a/doc/gtk-3.0.css b/doc/gtk-3.0.css new file mode 100755 index 0000000000..4b56b89883 --- /dev/null +++ b/doc/gtk-3.0.css @@ -0,0 +1,96 @@ +/* This is an example GTK CSS file that can be used with Gnucash. + Simply copy this file to the loaction specified below according + to your platform and then restart gnucash. + + - Windows: CSIDL_APPDATA/GnuCash + (or the default is users\%USERNAME%\AppData\Roaming\GnuCash) + + - OS X: $HOME/Application Support/GnuCash + + - Linux: $XDG_CONFIG_HOME/gnucash + (or the default is $HOME/.config/gnucash) + + These settings are mainly to do with register colors and can be seen + when the preference setting 'Register\Use GnuCash built-in color theme' + is unset. + + Note: Widgets obtained from Glade files will not be addressable + directly by name as these are not brought in when loaded, only + the widget type can be configured unless they are named in code. +*/ + +/* Register sheet font setting */ +sheet { + font: 18px arial, sans-serif; +} + +sheet calendar { + font: 12px arial, sans-serif; +} + + +/* Register User Colors */ +.header-color { + background-color: seagreen; + color: white; +} + +.primary-color { + background-color: pink; +} + +.primary-color:disabled { + background-color: plum; +} + +.secondary-color { + background-color: lightgreen; +} + +.secondary-color:disabled { + background-color: plum; +} + +.split-color { + background-color: lightblue; +} + +.split-color:disabled { + background-color: plum; +} + +.cursor-color { + background-color: #00BFFF; + color: white; +} + +cursor entry { + background-color: #00BFFF; + color: white; +} + + +/* Dense Calendar Settings */ +.calendar { + border-color: white; +} + +.calendar.header { + background-color: lightgreen; +} + +.calendar.primary { + background-color: darksalmon; +} + +.calendar.secondary { + background-color: darkseagreen; +} + +.calendar.markers { + background-color: indianred; +} + +#dense-cal-popup treeview { + background-color: lightcoral; +} diff --git a/doc/gtkrc-2.0.gnucash b/doc/gtkrc-2.0.gnucash deleted file mode 100644 index c1cb6d4175..0000000000 --- a/doc/gtkrc-2.0.gnucash +++ /dev/null @@ -1,197 +0,0 @@ -# -# This is an example GTK RC file that can be used with Gnucash. -# Simply copy this file to ~/.gtkrc-2.0.gnucash and then restart -# gnucash. Yes the colors are hideous, but then this is a (bad) -# example that you should customize to your liking. -# -# On an FC3 system, the RC files (if they exist) are loaded for in -# this order: -# -# /usr/share/gtkrc-2.0 -# /etc/gtk-2.0/gtkrc -# ~/.gtkrc-2.0 -# ** ~/.gtkrc-2.0.gnucash ** -# ~/.gnome2/gtkrc-2.0 -# ~/.themes/Bluecurve/gtk-2.0/gtkrc -# /usr/share/themes/Bluecurve/gtk-2.0/gtkrc -# ~/.themes/Default/gtk-2.0-key/gtkrc -# /usr/share/themes/Default/gtk-2.0-key/gtkrc -# - -########## -# -# Define the various styles here -# -########## - -style "gnc-button" -{ - # This shows all the possible states for a button. The only one that - # doesn't apply is the SELECTED state. - - bg[NORMAL] = "LightBlue" - fg[NORMAL] = "IndianRed" - - # Mouse over - bg[PRELIGHT] = "SkyBlue" - fg[PRELIGHT] = "white" - - # Mouse down - bg[ACTIVE] = "SteelBlue" - fg[ACTIVE] = "white" - - bg[INSENSITIVE] = { 1.0, 1.0, 1.0 } - fg[INSENSITIVE] = { 1.0, 0, 1.0 } -} - -style "gnc-button2" = "gnc-button" -{ - bg[NORMAL] = "PeachPuff" - fg[NORMAL] = "firebrick" -} - -style "gnc-button3" = "gnc-button" -{ - bg[NORMAL] = "LightGoldenrod1" - fg[NORMAL] = "firebrick" -} - - - -style "gnc-entry" -{ - base[NORMAL] = "LightBlue" - text[NORMAL] = "firebrick" -} - -style "gnc-entry2" -{ - base[NORMAL] = "RoyalBlue" - text[NORMAL] = "WhiteSmoke" -} - - - -style "gnc-treeview" -{ - GtkTreeView::even-row-color = "IndianRed" - GtkTreeView::odd-row-color = "LightBlue" -} - - - -########## -# -# Program wide changes should go here. -# -########## -class "GtkEntry" style "gnc-entry" -class "GtkButton" style "gnc-button" - - -########## -# -# Individual window changes should go here. -# -########## - -# -# Price Selection Dialog -# -# widget "Prices Dialog.*.close_button" style "gnc-button" -# widget "Prices Dialog.*.get_quotes_button" style "gnc-button2" -# widget "Prices Dialog.*.edit_button" style "gnc-button2" -# widget "Prices Dialog.*.add_button" style "gnc-button2" -# widget "Prices Dialog.*.remove_button" style "gnc-button2" -# widget "Prices Dialog.*.remove_old_button" style "gnc-button2" -widget "Prices Dialog.*.price_tree" style "gnc-treeview" -widget "Prices Dialog.*.price_tree.GtkButton" style "gnc-button3" - -# -# Dialog to edit one price -# -# widget "Price Dialog.*.cancel_button" style "gnc-button2" -# widget "Price Dialog.*.ok_button" style "gnc-button2" -# widget "Price Dialog.*.GNCGeneralSelect" style "gnc-entry" -# widget "Price Dialog.*.GNCCurrencyEdit" style "gnc-entry" -# widget "Price Dialog.*.GNCDateEdit.GtkEntry" style "gnc-entry" -# widget "Price Dialog.*.source_entry" style "gnc-entry" -# widget "Price Dialog.*.type_option" style "foo" -widget "Price Dialog.*.GNCAmountEdit" style "gnc-entry2" - -# -# Commodity Dialog -# -widget "Commodities Dialog.*.commodity_tree" style "gnc-treeview" - - -# -# Register - Font -# -style "gnc-register" -{ - font_name = "Sans 10" -} -widget "*.GnucashSheet" style "gnc-register" - - -# -# Register Window - Colors -# - -# The header lines at the top of a register. -style "gnc-register-header" -{ - base[NORMAL] = "#B18396" -} - -# The color of the first line/transaction in a register. -style "gnc-register-primary" -{ - base[NORMAL] = "#DEB9BF" - base[SELECTED] = "#EF98FF" -} - -# The color of the second line/transaction in a register. -style "gnc-register-secondary" -{ - base[NORMAL] = "#FFDAF6" - base[SELECTED] = "#EF98FF" -} - -# The color of any "split" lines in a register. -style "gnc-register-split" -{ - base[NORMAL] = "#E7D3ED" - base[SELECTED] = "#EF98FF" -} -widget "GncMainWindow.*.header_color" style : highest "gnc-register-header" -widget "GncMainWindow.*.primary_color" style : highest "gnc-register-primary" -widget "GncMainWindow.*.secondary_color" style : highest "gnc-register-secondary" -widget "GncMainWindow.*.split_color" style : highest "gnc-register-split" - - - -# -# From: calmar -# Allow changing notebook tabs with vim next/prev keys. -# -binding "book" { - bind "k" { - "change-current-page" (1) - } - bind "j" { - "change-current-page" (-1) - } -} -class "GtkNotebook" binding "book" - -# -# From: calmar -# Use larger disclosure tiangles in all tree views. -# -style "wide-tree" -{ - GtkTreeView::expander_size = 20 -} -class "GtkTreeView" style "wide-tree" diff --git a/gnucash/gnome-utils/gnc-dense-cal.c b/gnucash/gnome-utils/gnc-dense-cal.c index 8b5733028f..b6d31badc9 100644 --- a/gnucash/gnome-utils/gnc-dense-cal.c +++ b/gnucash/gnome-utils/gnc-dense-cal.c @@ -947,6 +947,9 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal) marker_color_class = g_strconcat ("markers", class_extension, NULL); } + /* lets confirm text height size */ + pango_layout_set_text(layout, "S", -1); + pango_layout_get_pixel_size(layout, NULL, &dcal->dayLabelHeight); /* Fill in alternating month colors. */ { @@ -1037,9 +1040,6 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal) gint j; cairo_save (cr); - pango_layout_set_text(layout, "S", -1); - pango_layout_get_pixel_size(layout, NULL, &dcal->dayLabelHeight); - gdk_rgba_parse (&color, "black"); x = dcal->leftPadding diff --git a/gnucash/gnome-utils/gnc-gnome-utils.c b/gnucash/gnome-utils/gnc-gnome-utils.c index efd6573605..1ed551fe88 100644 --- a/gnucash/gnome-utils/gnc-gnome-utils.c +++ b/gnucash/gnome-utils/gnc-gnome-utils.c @@ -219,11 +219,11 @@ gnc_add_css_file (void) #endif gtk_css_provider_load_from_resource (provider_fallback, "/org/gnucash/gnucash-fallback-310.css"); - var = g_get_home_dir (); + var = gnc_userconfig_dir (); if (var) { gchar *str; - str = g_build_filename (var, ".gtk-3.0-gnucash.css", (char *)NULL); + str = g_build_filename (var, "gtk-3.0.css", (char *)NULL); gtk_css_provider_load_from_path (provider_user, str, &error); g_free (str); } diff --git a/libgnucash/app-utils/gnc-gsettings.c b/libgnucash/app-utils/gnc-gsettings.c index 92a6edd8f3..6e174eebb1 100644 --- a/libgnucash/app-utils/gnc-gsettings.c +++ b/libgnucash/app-utils/gnc-gsettings.c @@ -837,8 +837,8 @@ void gnc_gsettings_version_upgrade (void) if (!gnc_gsettings_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_MIGRATE_PREFS_DONE)) gnc_gsettings_migrate_from_gconf (); - /* Convert settings to 2.8 compatibility level */ - if (old_maj_min < 208) + /* Convert settings to 3.0 compatibility level */ + if (old_maj_min < 207) { /* 'use-theme-colors' has been replaced with 'use-gnucash-color-theme' * which inverts the meaning of the setting */ diff --git a/libgnucash/core-utils/gnc-filepath-utils.cpp b/libgnucash/core-utils/gnc-filepath-utils.cpp index 8b45780b8a..a8857d41c6 100644 --- a/libgnucash/core-utils/gnc-filepath-utils.cpp +++ b/libgnucash/core-utils/gnc-filepath-utils.cpp @@ -543,6 +543,33 @@ get_userdata_home(void) return userdata_home; } +static bfs::path +get_userconfig_home(void) +{ + gchar *config_dir = NULL; + auto userconfig_home = bfs::path(); + +#ifdef G_OS_WIN32 + config_dir = win32_get_userdata_home (); +#elif defined MAC_INTEGRATION + config_dir = quarz_get_userdata_home (); +#endif + + /* On Windows and Macs the data directory is used, for Linux + $HOME/.config is used */ + if (config_dir) + { + userconfig_home = config_dir; + g_free(config_dir); + } + else + userconfig_home = g_get_user_config_dir(); + + userconfig_home = userconfig_home / PACKAGE; + + return userconfig_home; +} + gboolean gnc_filepath_init (void) { @@ -684,6 +711,24 @@ gnc_userdata_dir (void) return gnc_userdata_home.string().c_str(); } +/** @fn const gchar * gnc_userconfig_dir () + * @brief Return the config directory + * + * Note that the default path depends on the platform. + * - Windows: CSIDL_APPDATA/Gnucash + * - OS X: $HOME/Application Support/Gnucash + * - Linux: $XDG_CONFIG_HOME/Gnucash (or the default $HOME/.config/Gnucash) + * + * @return An absolute path to the configuration directory. This string is + * owned by the gnc_filepath_utils code and should not be freed by the user. + */ +const gchar * +gnc_userconfig_dir (void) +{ + auto path_string = get_userconfig_home(); + return g_strdup(path_string.string().c_str()); +} + static const bfs::path& gnc_userdata_dir_as_path (void) { diff --git a/libgnucash/core-utils/gnc-filepath-utils.h b/libgnucash/core-utils/gnc-filepath-utils.h index 465d404b78..f327446bcf 100644 --- a/libgnucash/core-utils/gnc-filepath-utils.h +++ b/libgnucash/core-utils/gnc-filepath-utils.h @@ -103,6 +103,8 @@ gchar *gnc_build_data_path (const gchar *filename); gchar *gnc_build_report_path (const gchar *filename); gchar *gnc_build_stdreports_path (const gchar *filename); +const gchar *gnc_userconfig_dir (void); + /** Given a pixmap/pixbuf file name, find the file in the pixmap * directory associated with this application. This routine will * display an error message if it can't find the file.