Skip to content

Commit

Permalink
Bug 797489 - No option to use account codes in Budget View - Part1
Browse files Browse the repository at this point in the history
In the budget view there is no option to add the account code column
which some uses use for sorting their accounts. This commit introduces
a feature flag to be used in version 4.0 but if set in 3.8 will hide
the new account code column so the view is not disrupted.
  • Loading branch information
Bob-IT committed Dec 11, 2019
1 parent d0727a1 commit 803d4c5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
13 changes: 13 additions & 0 deletions gnucash/gnome/gnc-budget-view.c
Expand Up @@ -47,6 +47,7 @@

#include "gnc-budget-view.h"
#include "gnc-budget.h"
#include "gnc-features.h"

#include "dialog-options.h"
#include "dialog-utils.h"
Expand Down Expand Up @@ -367,6 +368,7 @@ gbv_create_widget (GncBudgetView *budget_view)
GtkTreeViewColumn *totals_title_col;
GtkTreeIter iter;
GtkWidget *h_separator;
GKeyFile *state_file = gnc_state_get_current ();
gchar *state_section;
gchar guidstr[GUID_ENCODING_LENGTH+1];

Expand All @@ -388,6 +390,17 @@ gbv_create_widget (GncBudgetView *budget_view)
guid_to_string_buff (&priv->key, guidstr);
state_section = g_strjoin (" ", STATE_SECTION_PREFIX, guidstr, NULL);
g_object_set (G_OBJECT(tree_view), "state-section", state_section, NULL);

// make sure any extra account columns are hidden, there will be an option to
// show code and description in 4.0 which will disrupt the display of the table
if (gnc_features_check_used (gnc_get_current_book (), GNC_FEATURE_BUDGET_SHOW_EXTRA_ACCOUNT_COLS))
{
if (g_key_file_has_group (state_file, state_section))
{
g_key_file_set_boolean (state_file, state_section, "account-code_visible", FALSE);
g_key_file_set_boolean (state_file, state_section, "description_visible", FALSE);
}
}
g_free (state_section);

gnc_tree_view_configure_columns (GNC_TREE_VIEW(tree_view));
Expand Down
1 change: 1 addition & 0 deletions libgnucash/engine/gnc-features.c
Expand Up @@ -50,6 +50,7 @@ static gncFeature known_features[] =
{ GNC_FEATURE_SQLITE3_ISO_DATES, "Use ISO formatted date-time strings in SQLite3 databases (requires at least GnuCash 2.6.20)"},
{ GNC_FEATURE_REG_SORT_FILTER, "Store the register sort and filter settings in .gcm metadata file (requires at least GnuCash 3.3)"},
{ GNC_FEATURE_BUDGET_UNREVERSED, "Store budget amounts unreversed (i.e. natural) signs (requires at least Gnucash 3.8)"},
{ GNC_FEATURE_BUDGET_SHOW_EXTRA_ACCOUNT_COLS, "Show extra account columns in the Budget View (requires at least Gnucash 3.8)"},
{ NULL },
};

Expand Down
1 change: 1 addition & 0 deletions libgnucash/engine/gnc-features.h
Expand Up @@ -54,6 +54,7 @@ extern "C" {
#define GNC_FEATURE_SQLITE3_ISO_DATES "ISO-8601 formatted date strings in SQLite3 databases."
#define GNC_FEATURE_REG_SORT_FILTER "Register sort and filter settings stored in .gcm file"
#define GNC_FEATURE_BUDGET_UNREVERSED "Use natural signs in budget amounts"
#define GNC_FEATURE_BUDGET_SHOW_EXTRA_ACCOUNT_COLS "Show extra account columns in the Budget View"

/** @} */

Expand Down

0 comments on commit 803d4c5

Please sign in to comment.