[empathy] individual-view: add API to define our own filter function



commit 3cceb20e7ded94d9a797f53704b53afde9e5176f
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Fri May 6 14:09:05 2011 +0200

    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(+), 0 deletions(-)
---
diff --git a/libempathy-gtk/empathy-individual-view.c b/libempathy-gtk/empathy-individual-view.c
index fcbc93f..dbd8f33 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 bae7fbc..ae94ed3 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__ */



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