Don't allow a report page to be closed of it is in the process of

reloading.  Make the close buttons on the notebook tabs insensitive
when the rest of the UI is insensitive. Fixes 339327.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13823 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
David Hampton 2006-04-21 22:55:05 +00:00
parent 8de7eaa17b
commit 3b9d56fe93
3 changed files with 40 additions and 3 deletions

View File

@ -1,5 +1,11 @@
2006-04-21 David Hampton <hampton@employees.org>
* src/report/report-gnome/gnc-plugin-page-report.c:
* src/gnome-utils/gnc-main-window.c: Don't allow a report page to
be closed of it is in the process of reloading. Make the close
buttons on the notebook tabs insensitive when the rest of the UI
is insensitive. Fixes 339327.
* src/report/utility-reports/welcome-to-gnucash.scm:
* src/report/report-gnome/report-gnome.scm: Make the "Welcome to
GnuCash" report menu item build the entire report, instead of just

View File

@ -2102,6 +2102,9 @@ gnc_main_window_close_page (GncPluginPage *page)
if (!page->notebook_page)
return;
if (!gnc_plugin_page_finish_pending(page))
return;
window = GNC_MAIN_WINDOW (page->window);
if (!window) {
g_warning("Page is not in a window.");
@ -2855,8 +2858,6 @@ gnc_main_window_cmd_file_close (GtkAction *action, GncMainWindow *window)
priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
page = priv->current_page;
if (!gnc_plugin_page_finish_pending(page))
return;
gnc_main_window_close_page(page);
}
@ -3371,11 +3372,14 @@ static void
gnc_main_window_all_ui_set_sensitive (GncWindow *unused, gboolean sensitive)
{
GncMainWindow *window;
GList *winp;
GncMainWindowPrivate *priv;
GList *winp, *tmp;
GSList *widgetp, *toplevels;
GtkWidget *close_button;
for (winp = active_windows; winp; winp = g_list_next(winp)) {
window = winp->data;
priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
toplevels = gtk_ui_manager_get_toplevels(window->ui_merge,
GTK_UI_MANAGER_MENUBAR |
GTK_UI_MANAGER_TOOLBAR |
@ -3384,6 +3388,13 @@ gnc_main_window_all_ui_set_sensitive (GncWindow *unused, gboolean sensitive)
gtk_widget_set_sensitive (widgetp->data, sensitive);
}
g_slist_free(toplevels);
for (tmp = priv->installed_pages; tmp; tmp = g_list_next(tmp)) {
close_button = g_object_get_data(tmp->data, PLUGIN_PAGE_CLOSE_BUTTON);
if (!close_button)
continue;
gtk_widget_set_sensitive (close_button, sensitive);
}
}
}

View File

@ -109,6 +109,9 @@ typedef struct GncPluginPageReportPrivate
/* This is set to mark the fact that we need to reload the html */
gboolean need_reload;
/* The page is in the process of reloading the html */
gboolean reloading;
/// the gnc_html abstraction this PluginPage contains
gnc_html *html;
@ -132,6 +135,7 @@ static void gnc_plugin_page_report_destroy_widget( GncPluginPage *plugin_page );
static void gnc_plugin_page_report_save_page (GncPluginPage *plugin_page, GKeyFile *file, const gchar *group);
static GncPluginPage *gnc_plugin_page_report_recreate_page (GtkWidget *window, GKeyFile *file, const gchar *group);
static void gnc_plugin_page_report_name_changed (GncPluginPage *page, const gchar *name);
static gboolean gnc_plugin_page_report_finish_pending (GncPluginPage *page);
static int gnc_plugin_page_report_check_urltype(URLType t);
static void gnc_plugin_page_report_load_cb(gnc_html * html, URLType type,
@ -258,6 +262,7 @@ gnc_plugin_page_report_class_init (GncPluginPageReportClass *klass)
gnc_plugin_page_class->save_page = gnc_plugin_page_report_save_page;
gnc_plugin_page_class->recreate_page = gnc_plugin_page_report_recreate_page;
gnc_plugin_page_class->page_name_changed = gnc_plugin_page_report_name_changed;
gnc_plugin_page_class->finish_pending = gnc_plugin_page_report_finish_pending;
g_type_class_add_private(klass, sizeof(GncPluginPageReportPrivate));
@ -832,6 +837,19 @@ gnc_plugin_page_report_name_changed (GncPluginPage *page, const gchar *name)
}
static gboolean
gnc_plugin_page_report_finish_pending (GncPluginPage *page)
{
GncPluginPageReportPrivate *priv;
GncPluginPageReport *report;
report = GNC_PLUGIN_PAGE_REPORT(page);
priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
printf("%s: reloading is %d\n", __FUNCTION__, priv->reloading);
return !priv->reloading;
}
/********************************************************************
* gnc_report_window_destroy
* free and destroy a window
@ -1121,7 +1139,9 @@ gnc_plugin_page_report_reload_cb( GtkAction *action, GncPluginPageReport *report
gtk_widget_queue_draw( GTK_WIDGET(priv->container) );
// this does...
priv->reloading = TRUE;
gnc_html_reload( priv->html );
priv->reloading = FALSE;
}
static void