r21585 - gnucash/trunk/src - More checking of the read-only flag of the book.
Christian Stimming
cstim at code.gnucash.org
Sat Nov 19 06:49:00 EST 2011
Author: cstim
Date: 2011-11-19 06:49:00 -0500 (Sat, 19 Nov 2011)
New Revision: 21585
Trac: http://svn.gnucash.org/trac/changeset/21585
Modified:
gnucash/trunk/src/business/business-gnome/gnc-plugin-page-invoice.c
gnucash/trunk/src/business/business-ledger/gncEntryLedger.c
gnucash/trunk/src/gnome/gnc-plugin-page-register.c
Log:
More checking of the read-only flag of the book.
- GncEntryLedger switches to read-only
- Toolbar actions of several plugin pages switch to insensitive
(invoice, normal register)
Modified: gnucash/trunk/src/business/business-gnome/gnc-plugin-page-invoice.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/gnc-plugin-page-invoice.c 2011-11-19 11:48:42 UTC (rev 21584)
+++ gnucash/trunk/src/business/business-gnome/gnc-plugin-page-invoice.c 2011-11-19 11:49:00 UTC (rev 21585)
@@ -423,6 +423,13 @@
g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(page));
+ if (qof_book_is_readonly(gnc_get_current_book()))
+ {
+ // Are we readonly? Then don't allow any actions.
+ is_posted = TRUE;
+ can_unpost = FALSE;
+ }
+
action_group = gnc_plugin_page_get_action_group(page);
gnc_plugin_update_actions (action_group, posted_actions,
"sensitive", is_posted);
Modified: gnucash/trunk/src/business/business-ledger/gncEntryLedger.c
===================================================================
--- gnucash/trunk/src/business/business-ledger/gncEntryLedger.c 2011-11-19 11:48:42 UTC (rev 21584)
+++ gnucash/trunk/src/business/business-ledger/gncEntryLedger.c 2011-11-19 11:49:00 UTC (rev 21585)
@@ -378,6 +378,10 @@
/* Initialize Display */
gnc_entry_ledger_display_init (ledger);
+ if (qof_book_is_readonly(ledger->book))
+ {
+ gnc_entry_ledger_set_readonly(ledger, TRUE);
+ }
return ledger;
}
@@ -603,6 +607,7 @@
void gnc_entry_ledger_set_readonly (GncEntryLedger *ledger, gboolean readonly)
{
if (!ledger) return;
+ if (!readonly && qof_book_is_readonly(ledger->book)) return;
/* reset the ledger type appropriately */
if (readonly)
Modified: gnucash/trunk/src/gnome/gnc-plugin-page-register.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-plugin-page-register.c 2011-11-19 11:48:42 UTC (rev 21584)
+++ gnucash/trunk/src/gnome/gnc-plugin-page-register.c 2011-11-19 11:49:00 UTC (rev 21585)
@@ -827,12 +827,13 @@
SplitRegister *reg;
GNCLedgerDisplayType ledger_type;
int i;
+ gboolean is_readwrite = !qof_book_is_readonly(gnc_get_current_book());
priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
account = gnc_plugin_page_register_get_account (page);
action_group = gnc_plugin_page_get_action_group(GNC_PLUGIN_PAGE(page));
gnc_plugin_update_actions(action_group, actions_requiring_account,
- "sensitive", account != NULL);
+ "sensitive", is_readwrite && account != NULL);
/* Set "style" radio button */
ledger_type = gnc_ledger_display_type(priv->ledger);
@@ -1300,14 +1301,15 @@
GtkAction *action;
gboolean can_copy = FALSE, can_cut = FALSE, can_paste = FALSE;
gboolean has_selection;
+ gboolean is_readwrite = !qof_book_is_readonly(gnc_get_current_book());
reg_page = GNC_PLUGIN_PAGE_REGISTER(page);
priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(reg_page);
has_selection = gnucash_register_has_selection (priv->gsr->reg);
can_copy = has_selection;
- can_cut = has_selection;
- can_paste = TRUE;
+ can_cut = is_readwrite && has_selection;
+ can_paste = is_readwrite;
action = gnc_plugin_page_get_action (page, "EditCopyAction");
gtk_action_set_sensitive (action, can_copy);
More information about the gnucash-changes
mailing list