[libdazzle] prefs: add helper to repply the current filter



commit 24918a9a66076ea093ba7f737cd20264c45aed49
Author: Christian Hergert <chergert redhat com>
Date:   Tue Jun 6 02:38:07 2017 -0700

    prefs: add helper to repply the current filter
    
    This is sort of a hack, but convenient if you're using plugins and want
    to force refilter. Ideally we would process filters as we add widgets.

 src/prefs/dzl-preferences-view.c |   10 +++++++++-
 src/prefs/dzl-preferences-view.h |    3 ++-
 2 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/src/prefs/dzl-preferences-view.c b/src/prefs/dzl-preferences-view.c
index ec31d36..a5fed68 100644
--- a/src/prefs/dzl-preferences-view.c
+++ b/src/prefs/dzl-preferences-view.c
@@ -192,6 +192,14 @@ go_back_activate (GSimpleAction *action,
   gtk_widget_hide (GTK_WIDGET (self->subpage_stack));
 }
 
+void
+dzl_preferences_view_reapply_filter (DzlPreferencesView *self)
+{
+  g_return_if_fail (DZL_IS_PREFERENCES_VIEW (self));
+
+  dzl_preferences_view_refilter (self, gtk_entry_get_text (GTK_ENTRY (self->search_entry)));
+}
+
 static void
 dzl_preferences_view_search_entry_changed (DzlPreferencesView *self,
                                            GtkSearchEntry     *search_entry)
@@ -199,7 +207,7 @@ dzl_preferences_view_search_entry_changed (DzlPreferencesView *self,
   g_assert (DZL_IS_PREFERENCES_VIEW (self));
   g_assert (GTK_IS_SEARCH_ENTRY (search_entry));
 
-  dzl_preferences_view_refilter (self, gtk_entry_get_text (GTK_ENTRY (search_entry)));
+  dzl_preferences_view_reapply_filter (self);
 }
 
 static void
diff --git a/src/prefs/dzl-preferences-view.h b/src/prefs/dzl-preferences-view.h
index 91ca058..32aadcb 100644
--- a/src/prefs/dzl-preferences-view.h
+++ b/src/prefs/dzl-preferences-view.h
@@ -29,7 +29,8 @@ G_BEGIN_DECLS
 
 G_DECLARE_FINAL_TYPE (DzlPreferencesView, dzl_preferences_view, DZL, PREFERENCES_VIEW, GtkBin)
 
-GtkWidget *dzl_preferences_view_new (void);
+GtkWidget *dzl_preferences_view_new            (void);
+void       dzl_preferences_view_reapply_filter (DzlPreferencesView *self);
 
 G_END_DECLS
 


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