[gnome-builder/wip/greeter] greeter: cleanup row filtering
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/greeter] greeter: cleanup row filtering
- Date: Sun, 10 May 2015 21:01:38 +0000 (UTC)
commit cd5b580188e1d7f05d750eedc1376999788be102
Author: Christian Hergert <christian hergert me>
Date: Sun May 10 14:01:33 2015 -0700
greeter: cleanup row filtering
src/greeter/gb-greeter-window.c | 43 ++++++++++++++++++++------------------
1 files changed, 23 insertions(+), 20 deletions(-)
---
diff --git a/src/greeter/gb-greeter-window.c b/src/greeter/gb-greeter-window.c
index 3e9194e..fb5b142 100644
--- a/src/greeter/gb-greeter-window.c
+++ b/src/greeter/gb-greeter-window.c
@@ -64,8 +64,8 @@ gb_greeter_window_get_recent_projects (GbGreeterWindow *self)
}
static void
-foreach_cb (GtkWidget *widget,
- gpointer user_data)
+gb_greeter_window_apply_filter_cb (GtkWidget *widget,
+ gpointer user_data)
{
gboolean *visible = user_data;
@@ -76,35 +76,38 @@ foreach_cb (GtkWidget *widget,
}
static void
+gb_greeter_window_apply_filter (GbGreeterWindow *self,
+ GtkListBox *list_box,
+ GtkContainer *container)
+{
+ gboolean visible = FALSE;
+
+ g_assert (GB_IS_GREETER_WINDOW (self));
+ g_assert (GTK_IS_LIST_BOX (list_box));
+ g_assert (GTK_IS_CONTAINER (container));
+
+ gtk_list_box_invalidate_filter (list_box);
+ gtk_container_foreach (container, gb_greeter_window_apply_filter_cb, &visible);
+ gtk_widget_set_visible (GTK_WIDGET (container), visible);
+}
+
+static void
gb_greeter_window__search_entry_changed (GbGreeterWindow *self,
GtkSearchEntry *search_entry)
{
const gchar *text;
- gboolean visible;
g_assert (GB_IS_GREETER_WINDOW (self));
g_assert (GTK_IS_SEARCH_ENTRY (search_entry));
- text = gtk_entry_get_text (GTK_ENTRY (search_entry));
-
g_clear_pointer (&self->pattern_spec, ide_pattern_spec_unref);
-
- if (text != NULL)
+ if ((text = gtk_entry_get_text (GTK_ENTRY (search_entry))))
self->pattern_spec = ide_pattern_spec_new (text);
- gtk_list_box_invalidate_filter (self->my_projects_list_box);
- visible = FALSE;
- gtk_container_foreach (GTK_CONTAINER (self->my_projects_list_box),
- foreach_cb,
- &visible);
- gtk_widget_set_visible (GTK_WIDGET (self->my_projects_container), visible);
-
- gtk_list_box_invalidate_filter (self->other_projects_list_box);
- visible = FALSE;
- gtk_container_foreach (GTK_CONTAINER (self->other_projects_list_box),
- foreach_cb,
- &visible);
- gtk_widget_set_visible (GTK_WIDGET (self->other_projects_container), visible);
+ gb_greeter_window_apply_filter (self, self->my_projects_list_box,
+ GTK_CONTAINER (self->my_projects_container));
+ gb_greeter_window_apply_filter (self, self->other_projects_list_box,
+ GTK_CONTAINER (self->other_projects_container));
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]