gnucash master: Multiple changes pushed

Robert Fewell bobit at code.gnucash.org
Sun Feb 5 05:58:03 EST 2023


Updated	 via  https://github.com/Gnucash/gnucash/commit/6946d219 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/45a07463 (commit)
	from  https://github.com/Gnucash/gnucash/commit/85c24916 (commit)



commit 6946d2197b7731e482aacdb058453f7fbd25012d
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Sun Feb 5 10:56:50 2023 +0000

    Change default invoice report dialog
    
    If selected default invoice report is missing, hide the timeout and
    wait for user selection.

diff --git a/gnucash/gnome-utils/gnc-report-combo.c b/gnucash/gnome-utils/gnc-report-combo.c
index 68d552e39..3897dfbe1 100644
--- a/gnucash/gnome-utils/gnc-report-combo.c
+++ b/gnucash/gnome-utils/gnc-report-combo.c
@@ -446,6 +446,20 @@ gnc_report_combo_set_active_guid_name (GncReportCombo *grc,
     }
 }
 
+gboolean
+gnc_report_combo_is_warning_visible_for_active (GncReportCombo *grc)
+{
+    GncReportComboPrivate *priv;
+    gboolean missing = FALSE;
+
+    g_return_val_if_fail (grc != NULL, FALSE);
+    g_return_val_if_fail (GNC_IS_REPORT_COMBO(grc), FALSE);
+
+    priv = GET_PRIVATE(grc);
+
+    return gtk_widget_is_visible (GTK_WIDGET(priv->warning_image));
+}
+
 static void
 combo_changed_cb (GtkComboBox *widget, gpointer user_data)
 {
diff --git a/gnucash/gnome-utils/gnc-report-combo.h b/gnucash/gnome-utils/gnc-report-combo.h
index ff811ed42..e71566405 100644
--- a/gnucash/gnome-utils/gnc-report-combo.h
+++ b/gnucash/gnome-utils/gnc-report-combo.h
@@ -104,7 +104,7 @@ gchar * gnc_report_combo_get_active_name (GncReportCombo *grc);
 
 /** Set the active report to the guid string
  *
- *  @param combo The GtkComboBox that presents the list.
+ *  @param grc The report combo widget.
  *
  *  @param guid_name The concatination of the guid/name of the Invoice Report
  */
@@ -120,4 +120,12 @@ void gnc_report_combo_set_active_guid_name (GncReportCombo *grc,
  */
 gchar * gnc_report_combo_get_active_guid_name (GncReportCombo *grc);
 
+/** Is the warning displayed for active entry.
+ *
+ *  @param grc The report combo widget.
+ *
+ *  @return TRUE is warning is displayed, else FALSE
+ */
+gboolean gnc_report_combo_is_warning_visible_for_active (GncReportCombo *grc);
+
 #endif /* __GNC_REPORT_COMBO_H__ */
diff --git a/gnucash/gnome/dialog-invoice.c b/gnucash/gnome/dialog-invoice.c
index 786da9655..3359af65a 100644
--- a/gnucash/gnome/dialog-invoice.c
+++ b/gnucash/gnome/dialog-invoice.c
@@ -834,8 +834,8 @@ combo_changed_cb (GtkComboBox *widget, gpointer user_data)
 
 /* This function will return the selected invoice report guid if
  * the countdown times out or a selection is made and OK pressed.
- * 
- * If cancel is pressed then it return a NULL 
+ *
+ * If cancel is pressed then it will return NULL
  */
 static char*
 use_default_report_template_or_change (GtkWindow *parent)
@@ -847,20 +847,34 @@ use_default_report_template_or_change (GtkWindow *parent)
     GtkWidget   *ok_button;
     GtkWidget   *report_combo_hbox;
     GtkWidget   *progress_bar;
+    GtkWidget   *label;
     gchar       *ret_guid = NULL;
     gchar       *rep_guid = NULL;
     gchar       *rep_name = NULL;
+    gboolean     warning_visible = FALSE;
     gint         result;
     gdouble      timeout;
     dialog_args *args;
 
     timeout = qof_book_get_default_invoice_report_timeout (book);
 
-    if (timeout == 0)
-        return gnc_get_default_invoice_print_report ();
-
     combo = gnc_default_invoice_report_combo ("gnc:custom-report-invoice-template-guids");
 
+    rep_name = qof_book_get_default_invoice_report_name (book);
+    rep_guid = gnc_get_default_invoice_print_report ();
+
+    gnc_report_combo_set_active (GNC_REPORT_COMBO(combo),
+                                 rep_guid,
+                                 rep_name);
+    g_free (rep_guid);
+    g_free (rep_name);
+
+    warning_visible = gnc_report_combo_is_warning_visible_for_active (GNC_REPORT_COMBO(combo));
+
+    // When timeout is 0, only return if warning not visible
+    if (timeout == 0 && !warning_visible)
+        return gnc_get_default_invoice_print_report ();
+
     builder = gtk_builder_new ();
     gnc_builder_add_from_file (builder, "dialog-invoice.glade", "invoice_print_dialog");
 
@@ -873,20 +887,12 @@ use_default_report_template_or_change (GtkWindow *parent)
     ok_button = GTK_WIDGET(gtk_builder_get_object (builder, "ok_button"));
     report_combo_hbox = GTK_WIDGET(gtk_builder_get_object (builder, "report_combo_hbox"));
     progress_bar = GTK_WIDGET(gtk_builder_get_object (builder, "progress_bar"));
+    label = GTK_WIDGET(gtk_builder_get_object (builder, "label"));
 
     gtk_box_pack_start (GTK_BOX(report_combo_hbox), GTK_WIDGET(combo), TRUE, TRUE, 0);
 
     gtk_widget_grab_focus (ok_button);
 
-    rep_name = qof_book_get_default_invoice_report_name (book);
-    rep_guid = gnc_get_default_invoice_print_report ();
-
-    gnc_report_combo_set_active (GNC_REPORT_COMBO(combo),
-                                 rep_guid,
-                                 rep_name);
-    g_free (rep_guid);
-    g_free (rep_name);
-
     gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(progress_bar), 1);
 
     args = g_malloc (sizeof(dialog_args));
@@ -907,7 +913,15 @@ use_default_report_template_or_change (GtkWindow *parent)
     g_signal_connect (G_OBJECT(combo), "notify::popup-shown",
                       G_CALLBACK (combo_popped_cb), args);
 
-    g_timeout_add (100, update_progress_bar, args);
+    // if warning visible, do not add args timeout, wait for user
+    if (warning_visible)
+    {
+        gtk_label_set_text (GTK_LABEL(label),
+                            N_("Choose a different report template or Printable Invoice will be used"));
+        gtk_widget_hide (GTK_WIDGET(progress_bar));
+    }
+    else
+        g_timeout_add (100, update_progress_bar, args);
 
     result = gtk_dialog_run (GTK_DIALOG(dialog));
 

commit 45a07463fb84d182d1aac9970d712abc4773bcb5
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Sun Feb 5 10:21:56 2023 +0000

    Change max timeout to 20 seconds for default invoice report

diff --git a/libgnucash/engine/gnc-optiondb.cpp b/libgnucash/engine/gnc-optiondb.cpp
index cb13ed7b9..b62436d16 100644
--- a/libgnucash/engine/gnc-optiondb.cpp
+++ b/libgnucash/engine/gnc-optiondb.cpp
@@ -1283,7 +1283,7 @@ gnc_option_db_book_options(GncOptionDB* odb)
     gnc_register_number_range_option<double>(odb, business_section,
                                      OPTION_NAME_DEFAULT_INVOICE_REPORT_TIMEOUT, "e2",
                                      N_("Length of time to change the used invoice report. A value of 0 means disabled."),
-                                     0.0, 0.0, 10.0, 1.0);
+                                     0.0, 0.0, 20.0, 1.0);
     gnc_register_taxtable_option(odb, business_section,
                                  N_("Default Customer TaxTable"), "f1",
                                  N_("The default tax table to apply to customers."),



Summary of changes:
 gnucash/gnome-utils/gnc-report-combo.c | 14 +++++++++++
 gnucash/gnome-utils/gnc-report-combo.h | 10 +++++++-
 gnucash/gnome/dialog-invoice.c         | 44 ++++++++++++++++++++++------------
 libgnucash/engine/gnc-optiondb.cpp     |  2 +-
 4 files changed, 53 insertions(+), 17 deletions(-)



More information about the gnucash-changes mailing list