From 1fb79ef207153d7e72b3bba556f664e687b367c8 Mon Sep 17 00:00:00 2001 From: Robert Fewell <14uBobIT@gmail.com> Date: Thu, 16 Jan 2025 11:14:36 +0000 Subject: [PATCH] Bug 799491 - Add "Clear All" button to register filter Add a 'Clear All' button to the register filter dialog --- gnucash/gnome/gnc-plugin-page-register.cpp | 52 +++++++++++++++++-- .../gtkbuilder/gnc-plugin-page-register.glade | 21 ++++++-- 2 files changed, 66 insertions(+), 7 deletions(-) diff --git a/gnucash/gnome/gnc-plugin-page-register.cpp b/gnucash/gnome/gnc-plugin-page-register.cpp index fddebc73d9..49d594b11d 100644 --- a/gnucash/gnome/gnc-plugin-page-register.cpp +++ b/gnucash/gnome/gnc-plugin-page-register.cpp @@ -162,8 +162,10 @@ void gnc_plugin_page_register_filter_end_cb (GtkWidget* radio, GncPluginPageRegister* page); void gnc_plugin_page_register_filter_response_cb (GtkDialog* dialog, gint response, GncPluginPageRegister* plugin_page); -void gnc_plugin_page_register_filter_status_all_cb (GtkButton* button, - GncPluginPageRegister* plugin_page); +void gnc_plugin_page_register_filter_status_select_all_cb (GtkButton* button, + GncPluginPageRegister* plugin_page); +void gnc_plugin_page_register_filter_status_clear_all_cb (GtkButton* button, + GncPluginPageRegister* plugin_page); void gnc_plugin_page_register_filter_status_one_cb (GtkToggleButton* button, GncPluginPageRegister* page); void gnc_plugin_page_register_filter_save_cb (GtkToggleButton* button, @@ -2766,8 +2768,8 @@ gnc_plugin_page_register_filter_status_one_cb (GtkToggleButton* button, * associated with this filter dialog. */ void -gnc_plugin_page_register_filter_status_all_cb (GtkButton* button, - GncPluginPageRegister* page) +gnc_plugin_page_register_filter_status_select_all_cb (GtkButton* button, + GncPluginPageRegister* page) { GncPluginPageRegisterPrivate* priv; GtkWidget* widget; @@ -2797,6 +2799,48 @@ gnc_plugin_page_register_filter_status_all_cb (GtkButton* button, } + +/** This function is called whenever the "clear all" status button is + * clicked. It updates all of the checkbox widgets, then updates the + * query on the register. + * + * @param button The button that was clicked. + * + * @param page A pointer to the GncPluginPageRegister that is + * associated with this filter dialog. + */ +void +gnc_plugin_page_register_filter_status_clear_all_cb (GtkButton* button, + GncPluginPageRegister* page) +{ + GncPluginPageRegisterPrivate* priv; + GtkWidget* widget; + gint i; + + g_return_if_fail (GTK_IS_BUTTON (button)); + g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page)); + + ENTER ("(button %p, page %p)", button, page); + + /* Turn off all the check menu items */ + for (i = 0; status_actions[i].action_name; i++) + { + widget = status_actions[i].widget; + g_signal_handlers_block_by_func (widget, + (gpointer)gnc_plugin_page_register_filter_status_one_cb, page); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE); + g_signal_handlers_unblock_by_func (widget, + (gpointer)gnc_plugin_page_register_filter_status_one_cb, page); + } + + /* Set the requested status */ + priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page); + priv->fd.cleared_match = CLEARED_NONE; + gnc_ppr_update_status_query (page); + LEAVE (" "); +} + + /** This function computes the starting and ending times for the * filter by examining the dialog widgets to see which ones are * selected, and will pull times out of the data entry boxes if diff --git a/gnucash/gtkbuilder/gnc-plugin-page-register.glade b/gnucash/gtkbuilder/gnc-plugin-page-register.glade index 939a0f8faa..291a355c0f 100644 --- a/gnucash/gtkbuilder/gnc-plugin-page-register.glade +++ b/gnucash/gtkbuilder/gnc-plugin-page-register.glade @@ -1,5 +1,5 @@ - + @@ -378,7 +378,7 @@ If 0, all previous days included False vertical - + True False @@ -473,7 +473,7 @@ If 0, all previous days included True center True - + 0 @@ -493,6 +493,21 @@ If 0, all previous days included 5 + + + Clear _All + True + True + True + center + True + + + + 0 + 7 + + True