r17023 - gnucash/branches/gda-dev2/src/gnome-utils - Set Save action sensitive if and only if the book is dirty.

Phil Longstaff plongstaff at cvs.gnucash.org
Sun Mar 9 17:46:14 EDT 2008


Author: plongstaff
Date: 2008-03-09 17:46:14 -0400 (Sun, 09 Mar 2008)
New Revision: 17023
Trac: http://svn.gnucash.org/trac/changeset/17023

Modified:
   gnucash/branches/gda-dev2/src/gnome-utils/gnc-main-window.c
Log:
Set Save action sensitive if and only if the book is dirty.



Modified: gnucash/branches/gda-dev2/src/gnome-utils/gnc-main-window.c
===================================================================
--- gnucash/branches/gda-dev2/src/gnome-utils/gnc-main-window.c	2008-03-09 21:00:54 UTC (rev 17022)
+++ gnucash/branches/gda-dev2/src/gnome-utils/gnc-main-window.c	2008-03-09 21:46:14 UTC (rev 17023)
@@ -1217,13 +1217,19 @@
   QofBook *book;
   const gchar *filename = NULL, *dirty = "";
   gchar *title, *ptr;
+  GtkAction* action;
 
+  /* The save action is sensitive iff the book is dirty */
+  action = gnc_main_window_find_action (window, "FileSaveAction");
+  gtk_action_set_sensitive(action, FALSE);
   if (gnc_current_session_exist()) {
       filename = gnc_session_get_url (gnc_get_current_session ());
       book = gnc_get_current_book();
-      if (qof_instance_is_dirty(QOF_INSTANCE(book)))
-	dirty = "*";
- }
+      if (qof_instance_is_dirty(QOF_INSTANCE(book))) {
+		dirty = "*";
+		gtk_action_set_sensitive(action, TRUE);
+	  }
+  }
 
   if (!filename)
     filename = _("<no file>");



More information about the gnucash-changes mailing list