[Gnucash-changes] r13732 - gnucash/trunk - Serialize access to the
"Save" and "Save As" commands. Fixes 148905.
David Hampton
hampton at cvs.gnucash.org
Mon Apr 3 18:26:41 EDT 2006
Author: hampton
Date: 2006-04-03 18:26:39 -0400 (Mon, 03 Apr 2006)
New Revision: 13732
Trac: http://svn.gnucash.org/trac/changeset/13732
Modified:
gnucash/trunk/ChangeLog
gnucash/trunk/src/gnome-utils/gnc-main-window.c
gnucash/trunk/src/gnome-utils/gnc-main-window.h
gnucash/trunk/src/gnome/gnc-plugin-basic-commands.c
Log:
Serialize access to the "Save" and "Save As" commands. Fixes 148905.
Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog 2006-04-03 21:39:25 UTC (rev 13731)
+++ gnucash/trunk/ChangeLog 2006-04-03 22:26:39 UTC (rev 13732)
@@ -1,5 +1,9 @@
2006-04-03 David Hampton <hampton at employees.org>
+ * src/gnome-utils/gnc-main-window.[ch]:
+ * src/gnome/gnc-plugin-basic-commands.c: Serialize access to the
+ "Save" and "Save As" commands. Fixes 148905.
+
* src/backend/file/sixtp-dom-generators.c:
* src/backend/file/gnc-commodity-xml-v2.c:
* src/gnome-utils/dialog-commodity.c:
Modified: gnucash/trunk/src/gnome/gnc-plugin-basic-commands.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-plugin-basic-commands.c 2006-04-03 21:39:25 UTC (rev 13731)
+++ gnucash/trunk/src/gnome/gnc-plugin-basic-commands.c 2006-04-03 22:26:39 UTC (rev 13732)
@@ -296,6 +296,13 @@
************************************************************/
static void
+save_allowed (gboolean allowed)
+{
+ gnc_main_window_all_action_set_sensitive("FileSaveAction", allowed);
+ gnc_main_window_all_action_set_sensitive("FileSaveAsAction", allowed);
+}
+
+static void
gnc_main_window_cmd_file_new (GtkAction *action, GncMainWindowActionData *data)
{
gnc_file_new ();
@@ -321,7 +328,9 @@
return;
gnc_window_set_progressbar_window (GNC_WINDOW(data->window));
+ save_allowed(FALSE);
gnc_file_save ();
+ save_allowed(TRUE);
gnc_window_set_progressbar_window (NULL);
/* FIXME GNOME 2 Port (update the title etc.) */
}
@@ -335,7 +344,9 @@
return;
gnc_window_set_progressbar_window (GNC_WINDOW(data->window));
+ save_allowed(FALSE);
gnc_file_save_as ();
+ save_allowed(TRUE);
gnc_window_set_progressbar_window (NULL);
/* FIXME GNOME 2 Port (update the title etc.) */
}
Modified: gnucash/trunk/src/gnome-utils/gnc-main-window.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-main-window.c 2006-04-03 21:39:25 UTC (rev 13731)
+++ gnucash/trunk/src/gnome-utils/gnc-main-window.c 2006-04-03 22:26:39 UTC (rev 13732)
@@ -3509,5 +3509,18 @@
}
/* CS: End of code copied from gtk/gtkactiongroup.c */
+void
+gnc_main_window_all_action_set_sensitive (const gchar *action_name,
+ gboolean sensitive)
+{
+ GList *tmp;
+ GtkAction *action;
+
+ for (tmp = active_windows; tmp; tmp = g_list_next(tmp)) {
+ action = gnc_main_window_find_action (tmp->data, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+ }
+}
+
/** @} */
/** @} */
Modified: gnucash/trunk/src/gnome-utils/gnc-main-window.h
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-main-window.h 2006-04-03 21:39:25 UTC (rev 13731)
+++ gnucash/trunk/src/gnome-utils/gnc-main-window.h 2006-04-03 22:26:39 UTC (rev 13732)
@@ -340,6 +340,16 @@
* should cancel the pending operation. TRUE otherwise */
gboolean gnc_main_window_all_finish_pending (void);
+/** Change the sensitivity of a command in all windows. This can be
+ * used to serialize access to a command so that in cannot be
+ * reinvoked until the current invocation is finished.
+ *
+ * @param action_name The name of the command to modity.
+ *
+ * @param sensitive Whether or not the user should be able to invoke
+ * this action. */
+void gnc_main_window_all_action_set_sensitive (const gchar *action_name, gboolean sensitive);
+
G_END_DECLS
#endif /* __GNC_MAIN_WINDOW_H */
More information about the gnucash-changes
mailing list