[Gnucash-changes] r13823 - gnucash/trunk - Don't allow a report page to be closed of it is in the process of

David Hampton hampton at cvs.gnucash.org
Fri Apr 21 18:55:06 EDT 2006


Author: hampton
Date: 2006-04-21 18:55:05 -0400 (Fri, 21 Apr 2006)
New Revision: 13823
Trac: http://svn.gnucash.org/trac/changeset/13823

Modified:
   gnucash/trunk/ChangeLog
   gnucash/trunk/src/gnome-utils/gnc-main-window.c
   gnucash/trunk/src/report/report-gnome/gnc-plugin-page-report.c
Log:
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.


Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog	2006-04-21 21:14:18 UTC (rev 13822)
+++ gnucash/trunk/ChangeLog	2006-04-21 22:55:05 UTC (rev 13823)
@@ -1,5 +1,11 @@
 2006-04-21  David Hampton  <hampton at 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

Modified: gnucash/trunk/src/gnome-utils/gnc-main-window.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-main-window.c	2006-04-21 21:14:18 UTC (rev 13822)
+++ gnucash/trunk/src/gnome-utils/gnc-main-window.c	2006-04-21 22:55:05 UTC (rev 13823)
@@ -2102,6 +2102,9 @@
 	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 @@
 
 	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 @@
 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 @@
 	    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);
+	  }
 	}
 }
 

Modified: gnucash/trunk/src/report/report-gnome/gnc-plugin-page-report.c
===================================================================
--- gnucash/trunk/src/report/report-gnome/gnc-plugin-page-report.c	2006-04-21 21:14:18 UTC (rev 13822)
+++ gnucash/trunk/src/report/report-gnome/gnc-plugin-page-report.c	2006-04-21 22:55:05 UTC (rev 13823)
@@ -109,6 +109,9 @@
         /* 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_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_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 @@
 }
 
 
+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 @@
         gtk_widget_queue_draw( GTK_WIDGET(priv->container) );
 
         // this does...
+	priv->reloading = TRUE;
         gnc_html_reload( priv->html );
+	priv->reloading = FALSE;
 }
 
 static void



More information about the gnucash-changes mailing list