gnucash stable: Multiple changes pushed
Christopher Lam
clam at code.gnucash.org
Fri Aug 8 02:30:13 EDT 2025
Updated via https://github.com/Gnucash/gnucash/commit/deded468 (commit)
via https://github.com/Gnucash/gnucash/commit/c15ddb09 (commit)
from https://github.com/Gnucash/gnucash/commit/435735e8 (commit)
commit deded4680616a6f52540dd479cf8cd9b6b59fc3a
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Fri Jul 25 10:03:42 2025 +0800
[gnc-plugin-page-report] confirm before overwriting saved report
diff --git a/gnucash/gnome/gnc-plugin-page-report.cpp b/gnucash/gnome/gnc-plugin-page-report.cpp
index 3e21c1f195..6f2743b4c5 100644
--- a/gnucash/gnome/gnc-plugin-page-report.cpp
+++ b/gnucash/gnome/gnc-plugin-page-report.cpp
@@ -1722,6 +1722,13 @@ gnc_plugin_page_report_save_cb (GSimpleAction *simple,
check_func = scm_c_eval_string("gnc:is-custom-report-type");
if (scm_is_true (scm_call_1 (check_func, priv->cur_report)))
{
+ auto report_name_str{priv->cur_odb->lookup_string_option("General", "Report name")};
+ auto window{GTK_WINDOW(gnc_plugin_page_get_window (GNC_PLUGIN_PAGE(report)))};
+
+ if (!gnc_action_dialog (window, _("_Overwrite"), false, _("This will update and \
+overwrite the existing saved report named \"%s\"."), report_name_str.c_str()))
+ return;
+
/* The current report is already based on a custom report.
* Replace the existing one instead of adding a new one
*/
commit c15ddb09dd5d8440c437a4ed3f6b9e9c86f677ab
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Thu Jul 17 21:18:34 2025 +0800
[gnc-ui.h] gnc_action_dialog to offer Action/Cancel buttons
Instead of gnc_verify_dialog with YES/NO buttons, or
gnc_ok_cancel_dialog with OK/CANCEL buttons, it is safer to offer
explicit ACTION/CANCEL buttons whereby ACTION is customisable.
The action_default boolean would typically be TRUE for safe
actions (e.g. Open Readonly) and FALSE for destructive
actions (e.g. Delete Transaction).
diff --git a/gnucash/gnome-utils/gnc-gui-query.c b/gnucash/gnome-utils/gnc-gui-query.c
index 1aef41910a..2858640597 100644
--- a/gnucash/gnome-utils/gnc-gui-query.c
+++ b/gnucash/gnome-utils/gnc-gui-query.c
@@ -82,7 +82,37 @@ gnc_ok_cancel_dialog(GtkWindow *parent,
return(result);
}
+gboolean
+gnc_action_dialog (GtkWindow *parent, const gchar *action,
+ gboolean action_default, const gchar *format, ...)
+{
+ g_return_val_if_fail (action, FALSE);
+
+ if (!parent)
+ parent = gnc_ui_get_main_window (NULL);
+
+ va_list args;
+ va_start(args, format);
+ gchar *buffer = g_strdup_vprintf(format, args);
+ va_end(args);
+
+ GtkWidget *dialog = gtk_message_dialog_new (parent,
+ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE,
+ "%s", buffer);
+
+ gtk_dialog_add_button (GTK_DIALOG(dialog), action, GTK_RESPONSE_ACCEPT);
+ gtk_dialog_add_button (GTK_DIALOG(dialog), _("_Cancel"), GTK_RESPONSE_CANCEL);
+ gtk_dialog_set_default_response (GTK_DIALOG(dialog), action_default ?
+ GTK_RESPONSE_ACCEPT : GTK_RESPONSE_CANCEL);
+
+ gint result = gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_widget_destroy (dialog);
+ g_free(buffer);
+
+ return result == GTK_RESPONSE_ACCEPT;
+}
/********************************************************************\
* gnc_verify_dialog *
diff --git a/gnucash/gnome-utils/gnc-ui.h b/gnucash/gnome-utils/gnc-ui.h
index 5715321b20..cb1e0924e2 100644
--- a/gnucash/gnome-utils/gnc-ui.h
+++ b/gnucash/gnome-utils/gnc-ui.h
@@ -100,6 +100,12 @@ gnc_ok_cancel_dialog (GtkWindow *parent,
gint default_result,
const char *format, ...) G_GNUC_PRINTF (3, 4);
+extern gboolean
+gnc_action_dialog (GtkWindow *parent,
+ const gchar *action,
+ gboolean action_default,
+ const gchar *format, ...) G_GNUC_PRINTF (4, 5);
+
extern void
gnc_warning_dialog (GtkWindow *parent,
const char *format, ...) G_GNUC_PRINTF (2, 3);
Summary of changes:
gnucash/gnome-utils/gnc-gui-query.c | 30 ++++++++++++++++++++++++++++++
gnucash/gnome-utils/gnc-ui.h | 6 ++++++
gnucash/gnome/gnc-plugin-page-report.cpp | 7 +++++++
3 files changed, 43 insertions(+)
More information about the gnucash-changes
mailing list