gnucash master: Multiple changes pushed
J. Alex Aycinena
alex.aycinena at code.gnucash.org
Sun Jun 5 16:45:34 EDT 2016
Updated via https://github.com/Gnucash/gnucash/commit/d80bd038 (commit)
via https://github.com/Gnucash/gnucash/commit/079257a0 (commit)
via https://github.com/Gnucash/gnucash/commit/b555f495 (commit)
via https://github.com/Gnucash/gnucash/commit/293b43dc (commit)
via https://github.com/Gnucash/gnucash/commit/5d69ec7d (commit)
from https://github.com/Gnucash/gnucash/commit/0390322b (commit)
commit d80bd0387d693dcfc46a9dd3b7874c4f340a9acd
Author: Alex Aycinena <alex.aycinena at gmail.com>
Date: Sun Jun 5 13:24:06 2016 -0700
Remove semi-colon accidently left in prior commit.
diff --git a/src/gnome-utils/gnc-main-window.c b/src/gnome-utils/gnc-main-window.c
index f32bebc..52ea626 100644
--- a/src/gnome-utils/gnc-main-window.c
+++ b/src/gnome-utils/gnc-main-window.c
@@ -3966,7 +3966,7 @@ gnc_book_options_dialog_apply_cb(GNCOptionWin * optionwin,
if (!options) return;
- if (gnc_book_options_dialog_apply_helper (options));
+ if (gnc_book_options_dialog_apply_helper (options))
{
gnc_gui_refresh_all ();
if (!optionwin) return;
commit 079257a074fe3ac6dca8ceb644cc9118645ed6ed
Merge: 0390322 b555f49
Author: Alex Aycinena <alex.aycinena at gmail.com>
Date: Sun Jun 5 13:21:30 2016 -0700
Merge maint. The gnc_gui_refresh_all statement in gnc_book_options_dialog_apply_cb causes the 'apply' and 'OK' buttons to be set to sensitive on the open Book Options dialog in some circumstances; this commit causes them to be reset to insensitive, as they should be.
diff --cc src/app-utils/gnc-ui-util.c
index ef00790,e27bffc..ea28d48
--- a/src/app-utils/gnc-ui-util.c
+++ b/src/app-utils/gnc-ui-util.c
@@@ -263,92 -263,8 +263,91 @@@ gnc_book_option_num_field_source_change
}
gnc_book_option_num_field_source_change (num_action);
gnc_resume_gui_refresh ();
- gnc_gui_refresh_all ();
}
+/** Calls gnc_book_option_book_currency_selected to initiate registered
+ * callbacks when currency accounting book option changes to book-currency so
+ * that registers/reports can update themselves; sets feature flag */
+void
+gnc_book_option_book_currency_selected_cb (gboolean use_book_currency)
+{
+ gnc_suspend_gui_refresh ();
+ if (use_book_currency)
+ {
+ /* Set a feature flag in the book for use of book currency. This will
+ * prevent older GnuCash versions that don't support this feature from
+ * opening this file. */
+ gnc_features_set_used (gnc_get_current_book(),
+ GNC_FEATURE_BOOK_CURRENCY);
+ }
+ gnc_book_option_book_currency_selected (use_book_currency);
+ gnc_resume_gui_refresh ();
+ gnc_gui_refresh_all ();
+}
+
+/** Returns TRUE if both book-currency and default gain/loss policy KVPs exist
+ * and are valid and trading accounts are not used. */
+gboolean
+gnc_book_use_book_currency (QofBook *book)
+{
+ const gchar *policy;
+ const gchar *currency;
+
+ if (!book) return FALSE;
+
+ policy = qof_book_get_default_gains_policy (book);
+ currency = qof_book_get_book_currency (book);
+
+ /* If either a default gain/loss policy or a book-currency does not exist,
+ book-currency accounting method not valid */
+ if (!policy || !currency)
+ return FALSE;
+
+ /* If both exist, both must be valid */
+ if (!gnc_valid_policy (policy) || !gnc_commodity_table_lookup
+ (gnc_commodity_table_get_table
+ (gnc_get_current_book()),
+ GNC_COMMODITY_NS_CURRENCY,
+ currency))
+ return FALSE;
+
+ /* If both exist and are valid, there must be no trading accounts flag */
+ if (qof_book_use_trading_accounts (book))
+ return FALSE;
+
+ return TRUE;
+}
+
+/** Returns pointer to Book Currency name for book or NULL; determines
+ * that both book-currency and default gain/loss policy KVPs exist and that
+ * both are valid, a requirement for the 'book-currency' currency accounting
+ * method to apply. */
+const gchar *
+gnc_book_get_book_currency (QofBook *book)
+{
+ if (!book) return NULL;
+
+ if (gnc_book_use_book_currency (book))
+ return qof_book_get_book_currency (book);
+
+ return NULL;
+}
+
+/** Returns pointer to default gain/loss policy for book or NULL; determines
+ * that both book-currency and default gain/loss policy KVPs exist and that
+ * both are valid, a requirement for the 'book-currency' currency accounting
+ * method to apply. */
+const gchar *
+gnc_book_get_default_gains_policy (QofBook *book)
+{
+ if (!book) return NULL;
+
+ if (gnc_book_use_book_currency (book))
+ return qof_book_get_default_gains_policy (book);
+
+ return NULL;
+}
+
Account *
gnc_get_current_root_account (void)
{
diff --cc src/gnome-utils/gnc-main-window.c
index 65145df,681f469..f32bebc
--- a/src/gnome-utils/gnc-main-window.c
+++ b/src/gnome-utils/gnc-main-window.c
@@@ -3923,40 -3935,32 +3923,58 @@@ gnc_main_window_cmd_page_setup (GtkActi
gnc_ui_page_setup(gtk_window);
}
- void
-static void
-gnc_book_options_dialog_apply_cb(GNCOptionWin * optionwin,
- gpointer user_data)
++gboolean
+gnc_book_options_dialog_apply_helper(GNCOptionDB * options)
{
- GNCOptionDB * options = user_data;
- kvp_frame *slots = qof_book_get_slots (gnc_get_current_book ());
+ QofBook *book = gnc_get_current_book ();
gboolean use_split_action_for_num_before =
- qof_book_use_split_action_for_num_field (gnc_get_current_book ());
+ qof_book_use_split_action_for_num_field (book);
+ gboolean use_book_currency_before =
+ gnc_book_use_book_currency (book);
gboolean use_split_action_for_num_after;
+ gboolean use_book_currency_after;
++ gboolean return_val = FALSE;
-- if (!options) return;
++ if (!options) return return_val;
gnc_option_db_commit (options);
- gnc_option_db_save_to_kvp (options, slots, TRUE);
- qof_book_kvp_changed (gnc_get_current_book());
+ qof_book_begin_edit (book);
+ qof_book_save_options (book, gnc_option_db_save, options, TRUE);
use_split_action_for_num_after =
- qof_book_use_split_action_for_num_field (gnc_get_current_book ());
+ qof_book_use_split_action_for_num_field (book);
+ use_book_currency_after = gnc_book_use_book_currency (book);
if (use_split_action_for_num_before != use_split_action_for_num_after)
+ {
- gnc_book_option_num_field_source_change_cb (use_split_action_for_num_after);
+ gnc_book_option_num_field_source_change_cb (
+ use_split_action_for_num_after);
++ return_val = TRUE;
++ }
+ if (use_book_currency_before != use_book_currency_after)
++ {
+ gnc_book_option_book_currency_selected_cb (use_book_currency_after);
++ return_val = TRUE;
++ }
+ qof_book_commit_edit (book);
++ return return_val;
+}
+
+static void
+gnc_book_options_dialog_apply_cb(GNCOptionWin * optionwin,
+ gpointer user_data)
+{
+ GNCOptionDB * options = user_data;
++
+ if (!options) return;
- gnc_book_options_dialog_apply_helper (options);
++
++ if (gnc_book_options_dialog_apply_helper (options));
++ {
+ gnc_gui_refresh_all ();
++ if (!optionwin) return;
+ /* the previous stmt causes the 'apply' and 'OK' buttons to be set to
+ sensitive on the open Book Options dialog; the next stmt resets them
+ to insensitive, as they should be */
+ gnc_options_dialog_not_changed (optionwin);
+ }
}
static void
diff --cc src/gnome-utils/gnc-main-window.h
index 044058b,9c1cb4a..c414617
--- a/src/gnome-utils/gnc-main-window.h
+++ b/src/gnome-utils/gnc-main-window.h
@@@ -422,18 -422,6 +422,19 @@@ void gnc_main_window_show_all_windows(v
**/
GtkWidget *gnc_book_options_dialog_cb (gboolean modal, gchar *title);
+/**
+ * Processes selected options in the Book Options dialog: checks book_currency
+ * and use_split_action_for_num to see if features kvp shuold be set. To be used
+ * where ever a new book situation requires book option selection (e.g., not
+ * just in Book Options dialog opened from main window but also in new-file
+ * assistant).
+ *
+ * @param GNCOptionDB * options.
+ *
++ * @return TRUE if gnc_gui_refresh_all should be called; otherwise FALSE.
+ **/
- void gnc_book_options_dialog_apply_helper(GNCOptionDB * options);
++gboolean gnc_book_options_dialog_apply_helper(GNCOptionDB * options);
+
#endif /* __GNC_MAIN_WINDOW_H */
/** @} */
commit b555f495676f882c5494560a53ecae5a37c47302
Author: Alex Aycinena <alex.aycinena at gmail.com>
Date: Sat Jun 4 14:41:28 2016 -0700
The gnc_gui_refresh_all statement in gnc_book_options_dialog_apply_cb causes the 'apply' and 'OK' buttons to be set to sensitive on the open Book Options dialog in some circumstances; this commit causes them to be reset to insensitive, as they should be.
diff --git a/src/app-utils/gnc-ui-util.c b/src/app-utils/gnc-ui-util.c
index 9251c0f..e27bffc 100644
--- a/src/app-utils/gnc-ui-util.c
+++ b/src/app-utils/gnc-ui-util.c
@@ -263,7 +263,6 @@ gnc_book_option_num_field_source_change_cb (gboolean num_action)
}
gnc_book_option_num_field_source_change (num_action);
gnc_resume_gui_refresh ();
- gnc_gui_refresh_all ();
}
Account *
diff --git a/src/gnome-utils/dialog-options.c b/src/gnome-utils/dialog-options.c
index 936bc89..48d4267 100644
--- a/src/gnome-utils/dialog-options.c
+++ b/src/gnome-utils/dialog-options.c
@@ -168,6 +168,14 @@ gnc_options_dialog_changed (GNCOptionWin *win)
}
void
+gnc_options_dialog_not_changed (GNCOptionWin *win)
+{
+ if (!win) return;
+
+ gnc_options_dialog_changed_internal (win->dialog, FALSE);
+}
+
+void
gnc_option_changed_widget_cb(GtkWidget *widget, GNCOption *option)
{
gnc_option_set_changed (option, TRUE);
diff --git a/src/gnome-utils/dialog-options.h b/src/gnome-utils/dialog-options.h
index 4cdcbb1..a981894 100644
--- a/src/gnome-utils/dialog-options.h
+++ b/src/gnome-utils/dialog-options.h
@@ -46,6 +46,7 @@ GtkWidget * gnc_options_page_list(GNCOptionWin * win);
GtkWidget * gnc_options_dialog_notebook(GNCOptionWin * win);
void gnc_options_dialog_changed (GNCOptionWin *win);
+void gnc_options_dialog_not_changed (GNCOptionWin *win);
void gnc_option_changed_widget_cb(GtkWidget *widget, GNCOption *option);
void gnc_option_changed_option_cb(GtkWidget *dummy, GNCOption *option);
diff --git a/src/gnome-utils/gnc-main-window.c b/src/gnome-utils/gnc-main-window.c
index 4b2c2db..681f469 100644
--- a/src/gnome-utils/gnc-main-window.c
+++ b/src/gnome-utils/gnc-main-window.c
@@ -3953,7 +3953,14 @@ gnc_book_options_dialog_apply_cb(GNCOptionWin * optionwin,
use_split_action_for_num_after =
qof_book_use_split_action_for_num_field (gnc_get_current_book ());
if (use_split_action_for_num_before != use_split_action_for_num_after)
+ {
gnc_book_option_num_field_source_change_cb (use_split_action_for_num_after);
+ gnc_gui_refresh_all ();
+ /* the previous stmt causes the 'apply' and 'OK' buttons to be set to
+ sensitive on the open Book Options dialog; the next stmt resets them
+ to insensitive, as they should be */
+ gnc_options_dialog_not_changed (optionwin);
+ }
}
static void
commit 293b43dcedc36e9a9c6469b36c3032724d1f824b
Author: Geert Janssens <janssens-geert at telenet.be>
Date: Tue May 31 13:09:44 2016 +0200
Update README file regarding pull request policy
diff --git a/README b/README
index 14a4564..6cf4654 100644
--- a/README
+++ b/README
@@ -323,8 +323,7 @@ Getting Source with Git
We maintain a mirror of our master repository on Github. You can
browse the code at https://github.com/Gnucash/gnucash. Clone URIs are
on that page, or if you have a Github account you can fork it
-there. Note, however, that we do *not* accept Github pull requests:
-All patches should be submitted via Bugzilla, see below.
+there.
##################
Developing GnuCash
@@ -355,5 +354,8 @@ Submitting a Patch:
patches to either of the mailing lists, as they tend to be
forgotten.
+ Alternatively, you can also submit your patches in the form of a git
+ pull request.
+
Thank you.
commit 5d69ec7d87bb40c5f652525db123c517bf33c614
Author: John Ralls <jralls at ceridwen.us>
Date: Sun May 29 15:56:41 2016 -0700
Bug 766960 - gnucash-make-guids fails to run due to hardcoded paths.
diff --git a/src/bin/overrides/CMakeLists.txt b/src/bin/overrides/CMakeLists.txt
index 0390377..371d313 100644
--- a/src/bin/overrides/CMakeLists.txt
+++ b/src/bin/overrides/CMakeLists.txt
@@ -9,7 +9,7 @@ SET(GNC_BUILDDIR ${CMAKE_BINARY_DIR})
CONFIGURE_FILE(gnucash-make-guids.in ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/gnucash-make-guids)
GNC_CONFIGURE(gnucash-env.in ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/gnucash-env)
-GNC_CONFIGURE(guile.in ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/guile)
+GNC_CONFIGURE(guile.in ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/guile) #not installed
GNC_CONFIGURE(gnucash-build-env.in ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/gnucash-build-env) # not installed
SET(SCRIPT_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
@@ -28,6 +28,5 @@ INSTALL(
PROGRAMS
${SCRIPT_OUTPUT_DIR}/gnucash-env
${SCRIPT_OUTPUT_DIR}/gnucash-make-guids
- ${SCRIPT_OUTPUT_DIR}/guile
DESTINATION libexec/gnucash/overrides
-)
\ No newline at end of file
+)
diff --git a/src/bin/overrides/Makefile.am b/src/bin/overrides/Makefile.am
index 2476cdf..74fb50a 100644
--- a/src/bin/overrides/Makefile.am
+++ b/src/bin/overrides/Makefile.am
@@ -2,8 +2,7 @@ gncoverridesdir = ${GNC_LIBEXECDIR}/overrides
# When you add a file here, please modify ../test/Makefile.am's overrides.stamp
gncoverrides_SCRIPTS = \
gnucash-env \
- gnucash-make-guids \
- guile
+ gnucash-make-guids
EXTRA_DIST = \
gnucash-env.in \
@@ -11,7 +10,7 @@ EXTRA_DIST = \
gnucash-make-guids \
guile.in
-noinst_DATA = gnucash-build-env
+noinst_DATA = gnucash-build-env guile
PWD := $(shell pwd)
diff --git a/src/bin/overrides/gnucash-make-guids.in b/src/bin/overrides/gnucash-make-guids.in
index d03e135..df501ce 100755
--- a/src/bin/overrides/gnucash-make-guids.in
+++ b/src/bin/overrides/gnucash-make-guids.in
@@ -1,5 +1,5 @@
#!/bin/sh
-exec gnucash-env @GUILE@ -s "$0" "$@"
+exec gnucash-env guile -s "$0" "$@"
!#
(define (usage)
Summary of changes:
README | 6 ++++--
src/app-utils/gnc-ui-util.c | 1 -
src/bin/overrides/CMakeLists.txt | 5 ++---
src/bin/overrides/Makefile.am | 5 ++---
src/bin/overrides/gnucash-make-guids.in | 2 +-
src/gnome-utils/dialog-options.c | 8 ++++++++
src/gnome-utils/dialog-options.h | 1 +
src/gnome-utils/gnc-main-window.c | 24 +++++++++++++++++++++---
src/gnome-utils/gnc-main-window.h | 3 ++-
9 files changed, 41 insertions(+), 14 deletions(-)
More information about the gnucash-changes
mailing list