[empathy] contact-selector-dialog: add API for subclass to redefine the accoutn filter function



commit 0af3c68b4c8c9392174d780712f5d4a12d0e13e6
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Wed Dec 16 11:18:37 2009 +0000

    contact-selector-dialog: add API for subclass to redefine the accoutn filter function

 libempathy-gtk/empathy-contact-selector-dialog.c |   18 ++++++++++++++++--
 libempathy-gtk/empathy-contact-selector-dialog.h |    3 +++
 2 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/libempathy-gtk/empathy-contact-selector-dialog.c b/libempathy-gtk/empathy-contact-selector-dialog.c
index c52ac6c..6c04484 100644
--- a/libempathy-gtk/empathy-contact-selector-dialog.c
+++ b/libempathy-gtk/empathy-contact-selector-dialog.c
@@ -230,6 +230,20 @@ entry_activate_cb (GtkEntry *entry,
   gtk_dialog_response (GTK_DIALOG (self), GTK_RESPONSE_ACCEPT);
 }
 
+static gboolean
+account_chooser_filter (TpAccount *account,
+    gpointer user_data)
+{
+  EmpathyContactSelectorDialog *self = user_data;
+  EmpathyContactSelectorDialogClass *class = \
+      EMPATHY_CONTACT_SELECTOR_DIALOG_GET_CLASS (self);
+
+  if (class->account_filter == NULL)
+    return empathy_account_chooser_filter_is_connected (account, user_data);
+
+  return class->account_filter (self, account);
+}
+
 static void
 empathy_contact_selector_dialog_init (EmpathyContactSelectorDialog *dialog)
 {
@@ -299,8 +313,8 @@ empathy_contact_selector_dialog_init (EmpathyContactSelectorDialog *dialog)
            1, 2, 0, 1);
   empathy_account_chooser_set_filter (
       EMPATHY_ACCOUNT_CHOOSER (priv->account_chooser),
-      empathy_account_chooser_filter_is_connected,
-      NULL);
+      account_chooser_filter,
+      dialog);
   gtk_widget_show (priv->account_chooser);
 
   contact_selector_dialog_account_changed_cb (priv->account_chooser, dialog);
diff --git a/libempathy-gtk/empathy-contact-selector-dialog.h b/libempathy-gtk/empathy-contact-selector-dialog.h
index 0f52799..2315bc4 100644
--- a/libempathy-gtk/empathy-contact-selector-dialog.h
+++ b/libempathy-gtk/empathy-contact-selector-dialog.h
@@ -39,6 +39,9 @@ struct _EmpathyContactSelectorDialogClass {
   void (*got_response) (EmpathyContactSelectorDialog *self,
       TpConnection *connection,
       const gchar *contact_id);
+
+  gboolean (*account_filter) (EmpathyContactSelectorDialog *self,
+      TpAccount *account);
 };
 
 struct _EmpathyContactSelectorDialog {



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