Bug 797489 - No option to use account codes in Budget View - Part1

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.
pull/520/head
Robert Fewell 6 years ago
parent d0727a1bfb
commit 803d4c511e

@ -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"
@ -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];
@ -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));

@ -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 },
};

@ -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"
/** @} */

Loading…
Cancel
Save