mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Budgets are sensitive to readonly status
Disable some budget features if book is readonly
This commit is contained in:
parent
47f2e82f8e
commit
f96585b863
@ -1265,6 +1265,9 @@ budget_col_edited (Account *account, GtkTreeViewColumn *col,
|
||||
guint period_num;
|
||||
gnc_numeric numeric = gnc_numeric_error (GNC_ERROR_ARG);
|
||||
|
||||
if (qof_book_is_readonly (gnc_get_current_book ()))
|
||||
return;
|
||||
|
||||
if (!xaccParseAmount (new_text, TRUE, &numeric, NULL) &&
|
||||
!(new_text && *new_text == '\0'))
|
||||
return;
|
||||
|
@ -202,6 +202,17 @@ static GtkActionEntry gnc_plugin_page_budget_actions [] =
|
||||
|
||||
};
|
||||
|
||||
static const gchar *writeable_actions[] =
|
||||
{
|
||||
/* actions which must be disabled on a readonly book. */
|
||||
"DeleteBudgetAction",
|
||||
"OptionsBudgetAction",
|
||||
"EstimateBudgetAction",
|
||||
"AllPeriodsBudgetAction",
|
||||
"BudgetNoteAction",
|
||||
NULL
|
||||
};
|
||||
|
||||
static guint gnc_plugin_page_budget_n_actions =
|
||||
G_N_ELEMENTS(gnc_plugin_page_budget_actions);
|
||||
|
||||
@ -366,6 +377,10 @@ gnc_plugin_page_budget_init (GncPluginPageBudget *plugin_page)
|
||||
plugin_page);
|
||||
gnc_plugin_init_short_names (action_group, toolbar_labels);
|
||||
|
||||
if (qof_book_is_readonly (gnc_get_current_book()))
|
||||
gnc_plugin_update_actions (action_group, writeable_actions,
|
||||
"sensitive", FALSE);
|
||||
|
||||
/* Visible types */
|
||||
priv->fd.visible_types = -1; /* Start with all types */
|
||||
priv->fd.show_hidden = FALSE;
|
||||
|
Loading…
Reference in New Issue
Block a user