From 3cceb20e7ded94d9a797f53704b53afde9e5176f Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Fri, 6 May 2011 14:09:05 +0200 Subject: individual-view: add API to define our own filter function --- libempathy-gtk/empathy-individual-view.c | 17 +++++++++++++++++ libempathy-gtk/empathy-individual-view.h | 4 ++++ 2 files changed, 21 insertions(+) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-individual-view.c b/libempathy-gtk/empathy-individual-view.c index fcbc93fa4..dbd8f336b 100644 --- a/libempathy-gtk/empathy-individual-view.c +++ b/libempathy-gtk/empathy-individual-view.c @@ -88,6 +88,9 @@ typedef struct /* Distance between mouse pointer and the nearby border. Negative when scrolling updards.*/ gint distance; + + GtkTreeModelFilterVisibleFunc custom_filter; + gpointer custom_filter_data; } EmpathyIndividualViewPriv; typedef struct @@ -1800,6 +1803,9 @@ individual_view_filter_visible_func (GtkTreeModel *model, gboolean visible, is_online; gboolean is_searching = TRUE; + if (priv->custom_filter != NULL) + return priv->custom_filter (model, iter, priv->custom_filter_data); + if (priv->search_widget == NULL || !gtk_widget_get_visible (priv->search_widget)) is_searching = FALSE; @@ -2843,3 +2849,14 @@ empathy_individual_view_start_search (EmpathyIndividualView *self) else gtk_widget_show (GTK_WIDGET (priv->search_widget)); } + +void +empathy_individual_view_set_custom_filter (EmpathyIndividualView *self, + GtkTreeModelFilterVisibleFunc filter, + gpointer data) +{ + EmpathyIndividualViewPriv *priv = GET_PRIV (self); + + priv->custom_filter = filter; + priv->custom_filter_data = data; +} diff --git a/libempathy-gtk/empathy-individual-view.h b/libempathy-gtk/empathy-individual-view.h index bae7fbcba..ae94ed3d6 100644 --- a/libempathy-gtk/empathy-individual-view.h +++ b/libempathy-gtk/empathy-individual-view.h @@ -129,5 +129,9 @@ void empathy_individual_view_set_store (EmpathyIndividualView *self, void empathy_individual_view_start_search (EmpathyIndividualView *self); +void empathy_individual_view_set_custom_filter (EmpathyIndividualView *self, + GtkTreeModelFilterVisibleFunc filter, + gpointer data); + G_END_DECLS #endif /* __EMPATHY_INDIVIDUAL_VIEW_H__ */ -- cgit v1.2.3