[gitg: 11/36] egg-list-box: Move refiltered behavior to be a signal
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg: 11/36] egg-list-box: Move refiltered behavior to be a signal
- Date: Tue, 19 Feb 2013 21:55:33 +0000 (UTC)
commit f72c0e70d260bbb72e1213fdf5b86f17e99949f0
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu Jan 17 15:23:22 2013 -0500
egg-list-box: Move refiltered behavior to be a signal
If we want to show a widget when there are no children left after
a refilter, we need a hook to be able to calculate that. Adding
a signal allows us to run handlers before and after the refiltering
is done.
https://bugzilla.gnome.org/show_bug.cgi?id=691979
egg-list-box.c | 24 ++++++++++++++++++++----
egg-list-box.h | 1 +
2 files changed, 21 insertions(+), 4 deletions(-)
---
diff --git a/egg-list-box.c b/egg-list-box.c
index 3e345e6..353f4d8 100644
--- a/egg-list-box.c
+++ b/egg-list-box.c
@@ -107,6 +107,7 @@ enum {
ACTIVATE_CURSOR_CHILD,
TOGGLE_CURSOR_CHILD,
MOVE_CURSOR,
+ REFILTER,
LAST_SIGNAL
};
@@ -190,6 +191,7 @@ static void egg_list_box_real_toggle_cursor_child (EggListBo
static void egg_list_box_real_move_cursor (EggListBox *list_box,
GtkMovementStep step,
gint count);
+static void egg_list_box_real_refilter (EggListBox *list_box);
static void egg_list_box_finalize (GObject *obj);
@@ -317,6 +319,7 @@ egg_list_box_class_init (EggListBoxClass *klass)
klass->activate_cursor_child = egg_list_box_real_activate_cursor_child;
klass->toggle_cursor_child = egg_list_box_real_toggle_cursor_child;
klass->move_cursor = egg_list_box_real_move_cursor;
+ klass->refilter = egg_list_box_real_refilter;
signals[CHILD_SELECTED] =
g_signal_new ("child-selected",
@@ -361,6 +364,14 @@ egg_list_box_class_init (EggListBoxClass *klass)
_egg_marshal_VOID__ENUM_INT,
G_TYPE_NONE, 2,
GTK_TYPE_MOVEMENT_STEP, G_TYPE_INT);
+ signals[REFILTER] =
+ g_signal_new ("refilter",
+ EGG_TYPE_LIST_BOX,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EggListBoxClass, refilter),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
widget_class->activate_signal = signals[ACTIVATE_CURSOR_CHILD];
@@ -522,15 +533,20 @@ egg_list_box_set_separator_funcs (EggListBox *list_box,
egg_list_box_reseparate (list_box);
}
+static void
+egg_list_box_real_refilter (EggListBox *list_box)
+{
+ egg_list_box_apply_filter_all (list_box);
+ egg_list_box_reseparate (list_box);
+ gtk_widget_queue_resize (GTK_WIDGET (list_box));
+}
+
void
egg_list_box_refilter (EggListBox *list_box)
{
g_return_if_fail (list_box != NULL);
-
- egg_list_box_apply_filter_all (list_box);
- egg_list_box_reseparate (list_box);
- gtk_widget_queue_resize (GTK_WIDGET (list_box));
+ g_signal_emit (list_box, signals[REFILTER], 0);
}
static gint
diff --git a/egg-list-box.h b/egg-list-box.h
index c816a14..d071991 100644
--- a/egg-list-box.h
+++ b/egg-list-box.h
@@ -32,6 +32,7 @@ struct _EggListBoxClass
void (*activate_cursor_child) (EggListBox* self);
void (*toggle_cursor_child) (EggListBox* self);
void (*move_cursor) (EggListBox* self, GtkMovementStep step, gint count);
+ void (*refilter) (EggListBox* self);
};
typedef gboolean (*EggListBoxFilterFunc) (GtkWidget* child, void* user_data);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]