Bug 799491 - Add "Clear All" button to register filter

Add a 'Clear All' button to the register filter dialog
This commit is contained in:
Robert Fewell 2025-01-16 11:14:36 +00:00
parent dd221e409c
commit 1fb79ef207
2 changed files with 66 additions and 7 deletions

View File

@ -162,8 +162,10 @@ void gnc_plugin_page_register_filter_end_cb (GtkWidget* radio,
GncPluginPageRegister* page); GncPluginPageRegister* page);
void gnc_plugin_page_register_filter_response_cb (GtkDialog* dialog, void gnc_plugin_page_register_filter_response_cb (GtkDialog* dialog,
gint response, GncPluginPageRegister* plugin_page); gint response, GncPluginPageRegister* plugin_page);
void gnc_plugin_page_register_filter_status_all_cb (GtkButton* button, void gnc_plugin_page_register_filter_status_select_all_cb (GtkButton* button,
GncPluginPageRegister* plugin_page); 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, void gnc_plugin_page_register_filter_status_one_cb (GtkToggleButton* button,
GncPluginPageRegister* page); GncPluginPageRegister* page);
void gnc_plugin_page_register_filter_save_cb (GtkToggleButton* button, 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. * associated with this filter dialog.
*/ */
void void
gnc_plugin_page_register_filter_status_all_cb (GtkButton* button, gnc_plugin_page_register_filter_status_select_all_cb (GtkButton* button,
GncPluginPageRegister* page) GncPluginPageRegister* page)
{ {
GncPluginPageRegisterPrivate* priv; GncPluginPageRegisterPrivate* priv;
GtkWidget* widget; 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 /** This function computes the starting and ending times for the
* filter by examining the dialog widgets to see which ones are * filter by examining the dialog widgets to see which ones are
* selected, and will pull times out of the data entry boxes if * selected, and will pull times out of the data entry boxes if

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 --> <!-- Generated with glade 3.40.0 -->
<interface> <interface>
<requires lib="gtk+" version="3.22"/> <requires lib="gtk+" version="3.22"/>
<object class="GtkAdjustment" id="days_adjustment"> <object class="GtkAdjustment" id="days_adjustment">
@ -378,7 +378,7 @@ If 0, all previous days included</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<child> <child>
<!-- n-columns=1 n-rows=7 --> <!-- n-columns=1 n-rows=8 -->
<object class="GtkGrid" id="table1"> <object class="GtkGrid" id="table1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
@ -473,7 +473,7 @@ If 0, all previous days included</property>
<property name="receives-default">True</property> <property name="receives-default">True</property>
<property name="halign">center</property> <property name="halign">center</property>
<property name="use-underline">True</property> <property name="use-underline">True</property>
<signal name="clicked" handler="gnc_plugin_page_register_filter_status_all_cb" swapped="no"/> <signal name="clicked" handler="gnc_plugin_page_register_filter_status_select_all_cb" swapped="no"/>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@ -493,6 +493,21 @@ If 0, all previous days included</property>
<property name="top-attach">5</property> <property name="top-attach">5</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkButton" id="button85">
<property name="label" translatable="yes">Clear _All</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="halign">center</property>
<property name="use-underline">True</property>
<signal name="clicked" handler="gnc_plugin_page_register_filter_status_clear_all_cb" swapped="no"/>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">7</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>