aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-contact-widget.c
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@gmail.com>2007-10-21 06:07:28 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2007-10-21 06:07:28 +0800
commit004e78f70d1088c94bdd00e66c96260abe03cae9 (patch)
treecffed793486c9322d189fce6c7691186e10c30f2 /libempathy-gtk/empathy-contact-widget.c
parentcdd6455b8cacfbc06363e0f3e9737f7cc6e4b640 (diff)
downloadgsoc2013-empathy-004e78f70d1088c94bdd00e66c96260abe03cae9.tar
gsoc2013-empathy-004e78f70d1088c94bdd00e66c96260abe03cae9.tar.gz
gsoc2013-empathy-004e78f70d1088c94bdd00e66c96260abe03cae9.tar.bz2
gsoc2013-empathy-004e78f70d1088c94bdd00e66c96260abe03cae9.tar.lz
gsoc2013-empathy-004e78f70d1088c94bdd00e66c96260abe03cae9.tar.xz
gsoc2013-empathy-004e78f70d1088c94bdd00e66c96260abe03cae9.tar.zst
gsoc2013-empathy-004e78f70d1088c94bdd00e66c96260abe03cae9.zip
To know if an account is connected, use
2007-10-21 Xavier Claessens <xclaesse@gmail.com> * libempathy-gtk/empathy-account-chooser.c: * libempathy-gtk/empathy-contact-dialogs.c: * libempathy-gtk/empathy-contact-widget.c: * libempathy-gtk/empathy-contact-widget.h: * libempathy-gtk/empathy-accounts-dialog.c: To know if an account is connected, use mission_control_get_connection_status() instead of mission_control_get_connection(). Update account chooser if an account's status changes or if it get removed. Move account chooser filter func for add-contact's window from EmpathyContactWidget to EmpathyContactDialogs. svn path=/trunk/; revision=384
Diffstat (limited to 'libempathy-gtk/empathy-contact-widget.c')
-rw-r--r--libempathy-gtk/empathy-contact-widget.c57
1 files changed, 21 insertions, 36 deletions
diff --git a/libempathy-gtk/empathy-contact-widget.c b/libempathy-gtk/empathy-contact-widget.c
index 34a8023fe..cde5acd61 100644
--- a/libempathy-gtk/empathy-contact-widget.c
+++ b/libempathy-gtk/empathy-contact-widget.c
@@ -223,6 +223,27 @@ empathy_contact_widget_get_contact (GtkWidget *widget)
return information->contact;
}
+
+void
+empathy_contact_widget_set_account_filter (GtkWidget *widget,
+ EmpathyAccountChooserFilterFunc filter,
+ gpointer user_data)
+{
+ EmpathyContactWidget *information;
+ EmpathyAccountChooser *chooser;
+
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+
+ information = g_object_get_data (G_OBJECT (widget), "EmpathyContactWidget");
+ if (!information) {
+ return;
+ }
+
+ chooser = EMPATHY_ACCOUNT_CHOOSER (information->widget_account);
+ if (chooser) {
+ empathy_account_chooser_set_filter (chooser, filter, user_data);
+ }
+}
static void
contact_widget_destroy_cb (GtkWidget *widget,
@@ -282,38 +303,6 @@ contact_widget_set_contact (EmpathyContactWidget *information,
}
static gboolean
-contact_widget_can_add_contact_to_account (McAccount *account,
- gpointer user_data)
-{
- MissionControl *mc;
- TpConn *tp_conn;
- McProfile *profile;
- const gchar *protocol_name;
-
- mc = empathy_mission_control_new ();
- tp_conn = mission_control_get_connection (mc, account, NULL);
- g_object_unref (mc);
- if (tp_conn == NULL) {
- /* Account is disconnected */
- return FALSE;
- }
- g_object_unref (tp_conn);
-
- profile = mc_account_get_profile (account);
- protocol_name = mc_profile_get_protocol_name (profile);
- if (strcmp (protocol_name, "local-xmpp") == 0) {
- /* We can't add accounts to a XMPP LL connection
- * FIXME: We should inspect the flags of the contact list group interface
- */
- g_object_unref (profile);
- return FALSE;
- }
-
- g_object_unref (profile);
- return TRUE;
-}
-
-static gboolean
contact_widget_id_activate_timeout (EmpathyContactWidget *self)
{
contact_widget_change_contact (self);
@@ -354,10 +343,6 @@ contact_widget_contact_setup (EmpathyContactWidget *information)
/* Setup account label/chooser */
if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_ACCOUNT) {
information->widget_account = empathy_account_chooser_new ();
- empathy_account_chooser_set_filter (
- EMPATHY_ACCOUNT_CHOOSER (information->widget_account),
- contact_widget_can_add_contact_to_account,
- NULL);
g_signal_connect (information->widget_account, "changed",
G_CALLBACK (contact_widget_account_changed_cb),