gnucash stable: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Tue Sep 26 16:44:53 EDT 2023


Updated	 via  https://github.com/Gnucash/gnucash/commit/14e06965 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/2038903e (commit)
	from  https://github.com/Gnucash/gnucash/commit/15193c5c (commit)



commit 14e069653198921bfc753e99123f80603057e2ca
Merge: 15193c5ce0 2038903eee
Author: John Ralls <jralls at ceridwen.us>
Date:   Tue Sep 26 13:31:39 2023 -0700

    Merge John Ralls's 'bug798890' into stable.


commit 2038903eee842dd3536f81fea965dd6d3cc3a12d
Author: John Ralls <jralls at ceridwen.us>
Date:   Sat Sep 16 12:49:16 2023 -0700

    Bug 798890 - Printing Problem

diff --git a/gnucash/gnome/gnc-plugin-page-report.cpp b/gnucash/gnome/gnc-plugin-page-report.cpp
index 59aa1d0ae3..724008b4d8 100644
--- a/gnucash/gnome/gnc-plugin-page-report.cpp
+++ b/gnucash/gnome/gnc-plugin-page-report.cpp
@@ -102,7 +102,7 @@ typedef struct GncPluginPageReportPrivate
     /// The report-id
     int reportId;
     gint component_manager_id;
-
+    GSimpleActionGroup* action_group;
     /// The report which this Page is satisfying
     SCM cur_report;
     /// The Option DB for this report.
@@ -201,6 +201,17 @@ static GActionEntry report_actions[] =
     { "ReportStopAction", gnc_plugin_page_report_stop_cb, nullptr, nullptr, nullptr },
 };
 static guint num_report_actions = G_N_ELEMENTS(report_actions);
+static const gchar *initially_insensitive_actions[] =
+{
+    nullptr
+};
+
+static const gchar *disable_during_load_actions[] =
+{
+    "FilePrintAction",
+    "FilePrintPDFAction",
+    "ReportOptionsAction"
+};
 
 /** The default menu items that need to be add to the menu */
 static const gchar *gnc_plugin_load_ui_items [] =
@@ -443,6 +454,8 @@ gnc_plugin_page_report_load_uri (GncPluginPage *page)
         g_object_remove_weak_pointer(G_OBJECT(page), (gpointer*)(&weak_page));
     }
 
+    gnc_plugin_set_actions_enabled(G_ACTION_MAP(priv->action_group),
+                                   disable_during_load_actions, TRUE);
     // this resets the window for the progressbar to nullptr
     gnc_window_set_progressbar_window( nullptr );
 }
@@ -794,6 +807,8 @@ gnc_plugin_page_report_option_change_cb(gpointer data)
     /* it's probably already dirty, but make sure */
     scm_call_2(dirty_report, priv->cur_report, SCM_BOOL_T);
 
+    gnc_plugin_set_actions_enabled(G_ACTION_MAP(priv->action_group),
+                                   disable_during_load_actions, FALSE);
     // prevent closing this page while loading...
     priv->reloading = TRUE;
 
@@ -811,6 +826,8 @@ gnc_plugin_page_report_option_change_cb(gpointer data)
     // this resets the window for the progressbar to nullptr
     gnc_window_set_progressbar_window( nullptr );
 
+    gnc_plugin_set_actions_enabled(G_ACTION_MAP(priv->action_group),
+                                   disable_during_load_actions, FALSE);
     priv->reloading = FALSE;
 }
 
@@ -1175,14 +1192,11 @@ gnc_plugin_page_report_destroy(GncPluginPageReportPrivate * priv)
         scm_gc_unprotect_object(priv->edited_reports);
 }
 
-static const gchar *initially_insensitive_actions[] =
-{
-    nullptr
-};
-
 static void
 gnc_plugin_page_report_init ( GncPluginPageReport *plugin_page )
 {
+    GncPluginPageReportPrivate *priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(plugin_page);
+    priv->action_group = NULL;
 }
 
 static GObject*
@@ -1277,7 +1291,6 @@ static void
 gnc_plugin_page_report_constr_init (GncPluginPageReport *plugin_page, gint reportId)
 {
     GncPluginPageReportPrivate *priv;
-    GSimpleActionGroup *simple_action_group;
     GncPluginPage *parent;
     gboolean use_new;
     gchar *name;
@@ -1304,14 +1317,16 @@ gnc_plugin_page_report_constr_init (GncPluginPageReport *plugin_page, gint repor
     gnc_plugin_page_add_book (parent, gnc_get_current_book());
 
     /* Create menu and toolbar information */
-    simple_action_group = gnc_plugin_page_create_action_group (parent, "GncPluginPageReportActions");
-    g_action_map_add_action_entries (G_ACTION_MAP(simple_action_group),
+    priv->action_group = gnc_plugin_page_create_action_group (parent, "GncPluginPageReportActions");
+    g_action_map_add_action_entries (G_ACTION_MAP(priv->action_group),
                                      report_actions,
                                      num_report_actions,
                                      plugin_page);
 
-    gnc_plugin_set_actions_enabled (G_ACTION_MAP(simple_action_group), initially_insensitive_actions,
+    gnc_plugin_set_actions_enabled (G_ACTION_MAP(priv->action_group), initially_insensitive_actions,
                                     FALSE);
+    gnc_plugin_set_actions_enabled(G_ACTION_MAP(priv->action_group),
+                                   disable_during_load_actions, FALSE);
 }
 
 GncPluginPage*
@@ -1456,7 +1471,9 @@ gnc_plugin_page_report_reload_cb (GSimpleAction *simple,
     scm_call_2(dirty_report, priv->cur_report, SCM_BOOL_T);
 
     /* now queue the fact that we need to reload this report */
-
+    // Disable some actions reported to crash while loading
+    gnc_plugin_set_actions_enabled(G_ACTION_MAP(priv->action_group),
+                                   disable_during_load_actions, FALSE);
     // prevent closing this page while loading...
     priv->reloading = TRUE;
     // this sets the window for the progressbar
@@ -1471,6 +1488,8 @@ gnc_plugin_page_report_reload_cb (GSimpleAction *simple,
 
     // this resets the window for the progressbar to nullptr
     gnc_window_set_progressbar_window( nullptr );
+    gnc_plugin_set_actions_enabled(G_ACTION_MAP(priv->action_group),
+                                   disable_during_load_actions, FALSE);
     priv->reloading = FALSE;
 }
 



Summary of changes:
 gnucash/gnome/gnc-plugin-page-report.cpp | 41 +++++++++++++++++++++++---------
 1 file changed, 30 insertions(+), 11 deletions(-)



More information about the gnucash-changes mailing list