From 0af3c68b4c8c9392174d780712f5d4a12d0e13e6 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Wed, 16 Dec 2009 11:18:37 +0000 Subject: 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(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-contact-selector-dialog.c b/libempathy-gtk/empathy-contact-selector-dialog.c index c52ac6c56..6c0448441 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 0f5279946..2315bc401 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 { -- cgit v1.2.3