[gthumb] filters: allow to set a shortcut to remove the filter



commit 3fc2456fadd63afe5d8fe93952862a8494e8b21e
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Wed Aug 4 11:30:11 2021 +0200

    filters: allow to set a shortcut to remove the filter

 gthumb/gth-browser-actions-callbacks.c | 13 +++++++++++++
 gthumb/gth-browser-actions-callbacks.h |  1 +
 gthumb/gth-browser-actions-entries.h   |  3 +++
 gthumb/gth-filterbar.c                 | 10 ++++++++++
 gthumb/gth-filterbar.h                 |  1 +
 5 files changed, 28 insertions(+)
---
diff --git a/gthumb/gth-browser-actions-callbacks.c b/gthumb/gth-browser-actions-callbacks.c
index 0c7ff437..c45feccd 100644
--- a/gthumb/gth-browser-actions-callbacks.c
+++ b/gthumb/gth-browser-actions-callbacks.c
@@ -641,3 +641,16 @@ gth_browser_activate_set_filter (GSimpleAction *action,
        filterbar = gth_browser_get_filterbar (browser);
        gth_filterbar_set_test_by_id (GTH_FILTERBAR (filterbar), test_id);
 }
+
+
+void
+gth_browser_activate_set_filter_all (GSimpleAction *action,
+                                    GVariant      *parameter,
+                                    gpointer        user_data)
+{
+       GthBrowser *browser = GTH_BROWSER (user_data);
+       GtkWidget  *filterbar;
+
+       filterbar = gth_browser_get_filterbar (browser);
+       gth_filterbar_set_show_all (GTH_FILTERBAR (filterbar));
+}
diff --git a/gthumb/gth-browser-actions-callbacks.h b/gthumb/gth-browser-actions-callbacks.h
index 06e4f548..656a09e0 100644
--- a/gthumb/gth-browser-actions-callbacks.h
+++ b/gthumb/gth-browser-actions-callbacks.h
@@ -72,5 +72,6 @@ DEF_ACTION_CALLBACK (gth_browser_activate_select_all)
 DEF_ACTION_CALLBACK (gth_browser_activate_unselect_all)
 DEF_ACTION_CALLBACK (gth_browser_activate_show_menu)
 DEF_ACTION_CALLBACK (gth_browser_activate_set_filter)
+DEF_ACTION_CALLBACK (gth_browser_activate_set_filter_all)
 
 #endif /* GTH_BROWSER_ACTIONS_CALLBACK_H */
diff --git a/gthumb/gth-browser-actions-entries.h b/gthumb/gth-browser-actions-entries.h
index fb0107e6..caee141b 100644
--- a/gthumb/gth-browser-actions-entries.h
+++ b/gthumb/gth-browser-actions-entries.h
@@ -84,6 +84,7 @@ static const GActionEntry gth_browser_actions[] = {
        { "file-list-unselect-all", gth_browser_activate_unselect_all },
 
        { "set-filter", gth_browser_activate_set_filter, "s" },
+       { "set-filter-all", gth_browser_activate_set_filter_all },
 };
 
 
@@ -130,6 +131,8 @@ static const GthShortcut gth_browser_shortcuts[] = {
        { "file-list-select-all", N_("Select all"), GTH_SHORTCUT_CONTEXT_BROWSER | 
GTH_SHORTCUT_CONTEXT_INTERNAL, GTH_SHORTCUT_CATEGORY_NAVIGATION, "<Primary>a" },
        { "file-list-unselect-all", N_("Select none"), GTH_SHORTCUT_CONTEXT_BROWSER | 
GTH_SHORTCUT_CONTEXT_INTERNAL, GTH_SHORTCUT_CATEGORY_NAVIGATION, "<Primary><Shift>a" },
 
+       { "set-filter-all", N_("All"), GTH_SHORTCUT_CONTEXT_BROWSER, GTH_SHORTCUT_CATEGORY_FILTERS },
+
        /* file list keybindings (read only) */
 
        { "file-list-move-cursor-right", NULL, GTH_SHORTCUT_CONTEXT_BROWSER | GTH_SHORTCUT_CONTEXT_INTERNAL, 
GTH_SHORTCUT_CATEGORY_HIDDEN, "Right" },
diff --git a/gthumb/gth-filterbar.c b/gthumb/gth-filterbar.c
index 71834d61..0dbca8f5 100644
--- a/gthumb/gth-filterbar.c
+++ b/gthumb/gth-filterbar.c
@@ -581,6 +581,16 @@ gth_filterbar_set_test_by_id (GthFilterbar *filterbar,
 }
 
 
+void
+gth_filterbar_set_show_all (GthFilterbar *filterbar)
+{
+       GtkTreeIter iter;
+
+       gtk_tree_model_get_iter_first (GTK_TREE_MODEL (filterbar->priv->model), &iter);
+       gtk_combo_box_set_active_iter (GTK_COMBO_BOX (filterbar->priv->test_combo_box), &iter);
+}
+
+
 GtkWidget *
 gth_filterbar_get_extra_area (GthFilterbar *filterbar)
 {
diff --git a/gthumb/gth-filterbar.h b/gthumb/gth-filterbar.h
index de39e261..c9f34707 100644
--- a/gthumb/gth-filterbar.h
+++ b/gthumb/gth-filterbar.h
@@ -66,6 +66,7 @@ void          gth_filterbar_set_filter_list           (GthFilterbar *filterbar,
                                                         GList        *filters /* GthTest list */);
 gboolean       gth_filterbar_set_test_by_id            (GthFilterbar *filterbar,
                                                         const char   *id);
+void           gth_filterbar_set_show_all               (GthFilterbar *filterbar);
 GtkWidget *    gth_filterbar_get_extra_area            (GthFilterbar *filterbar);
 
 G_END_DECLS


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]