Serialize access to the "Save" and "Save As" commands. Fixes 148905.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13732 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
David Hampton 2006-04-03 22:26:39 +00:00
parent 73e481da0c
commit 79c0b4f77d
4 changed files with 38 additions and 0 deletions

View File

@ -1,5 +1,9 @@
2006-04-03 David Hampton <hampton@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:

View File

@ -3509,5 +3509,18 @@ gnc_gtk_action_group_set_translation_domain (GtkActionGroup *action_group,
}
/* 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);
}
}
/** @} */
/** @} */

View File

@ -340,6 +340,16 @@ gboolean gnc_main_window_finish_pending (GncMainWindow *window);
* 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 */

View File

@ -295,6 +295,13 @@ gnc_plugin_basic_commands_finalize (GObject *object)
* Command Callbacks *
************************************************************/
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)
{
@ -321,7 +328,9 @@ gnc_main_window_cmd_file_save (GtkAction *action, GncMainWindowActionData *data)
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 @@ gnc_main_window_cmd_file_save_as (GtkAction *action, GncMainWindowActionData *da
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.) */
}