From eec9d512361a0773d0aa56cd10395244ac291492 Mon Sep 17 00:00:00 2001 From: Alx Sa Date: Wed, 18 Mar 2026 01:11:18 +0000 Subject: [PATCH] widgets: Sync filter visibility with toggle button Resolves #16002 Since the "Toggle All Filter Visibility" button's state is only updated when the NDE filter popover first appears, it could get out of sync with the current state of the filter stack. (For instance, if you open the popover and turn all the filters' visibility off, then clicked the button, it would try to turn them off again) This patch adds a check for gimp_drawable_has_visible_filters () whenever the filter changes, and updates the toggle button with that value. This patch also condenses the filter visibility check to use the existing function rather than its own custom code. --- app/widgets/gimpdrawabletreeview-filters.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/app/widgets/gimpdrawabletreeview-filters.c b/app/widgets/gimpdrawabletreeview-filters.c index 395efc1aec..8fc185c150 100644 --- a/app/widgets/gimpdrawabletreeview-filters.c +++ b/app/widgets/gimpdrawabletreeview-filters.c @@ -126,7 +126,6 @@ _gimp_drawable_tree_view_filter_editor_show (GimpDrawableTreeView *view, GimpDrawableTreeViewFiltersEditor *editor = view->editor; GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (view); GimpContainer *filters; - GList *list; gint n_editable; gboolean visible = FALSE; @@ -285,17 +284,7 @@ _gimp_drawable_tree_view_filter_editor_show (GimpDrawableTreeView *view, } filters = gimp_drawable_get_filters (drawable); - - for (list = GIMP_LIST (filters)->queue->tail; - list; - list = g_list_previous (list)) - { - if (GIMP_IS_DRAWABLE_FILTER (list->data)) - { - if (gimp_filter_get_active (list->data)) - visible = TRUE; - } - } + visible = gimp_drawable_has_visible_filters (drawable); /* Set the initial value for the effect visibility toggle */ g_signal_handlers_block_by_func (editor->visible_button, @@ -462,6 +451,8 @@ gimp_drawable_filters_editor_set_sensitive (GimpDrawableTreeView *view) is_editable = (index >= first_editable && index <= last_editable); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->visible_button), + has_visible_filters); gtk_widget_set_sensitive (editor->visible_button, TRUE); gtk_widget_set_sensitive (editor->edit_button,