[empathy] accounts-dialog: don't show the avatar button if avatars are not supported



commit a711c1e353bc84a0e97652fb22d39e34bd729f4e
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Thu Jun 28 11:07:37 2012 +0200

    accounts-dialog: don't show the avatar button if avatars are not supported
    
    https://bugzilla.gnome.org/show_bug.cgi?id=627948

 src/empathy-accounts-dialog.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c
index 578f998..7645d16 100644
--- a/src/empathy-accounts-dialog.c
+++ b/src/empathy-accounts-dialog.c
@@ -790,18 +790,25 @@ create_contact_info_editor (EmpathyAccountsDialog *self,
   EmpathyAccountsDialogPriv *priv = GET_PRIV (self);
   GtkWidget *editor, *alig;
   EmpathyContact *contact;
+  EmpathyContactWidgetFlags flags;
+  TpConnection *conn;
 
   contact = empathy_contact_dup_from_tp_contact (tp_contact);
 
   alig = gtk_alignment_new (0.5, 0, 1, 1);
 
-  /* create the contact info editor for this account */
-  editor = empathy_contact_widget_new (contact,
-      EMPATHY_CONTACT_WIDGET_EDIT_ALIAS |
-      EMPATHY_CONTACT_WIDGET_EDIT_AVATAR |
+  flags = EMPATHY_CONTACT_WIDGET_EDIT_ALIAS |
       EMPATHY_CONTACT_WIDGET_NO_STATUS |
       EMPATHY_CONTACT_WIDGET_EDIT_DETAILS |
-      EMPATHY_CONTACT_WIDGET_NO_ACCOUNT);
+      EMPATHY_CONTACT_WIDGET_NO_ACCOUNT;
+
+  conn = tp_contact_get_connection (tp_contact);
+  if (tp_proxy_has_interface_by_id (conn,
+        TP_IFACE_QUARK_CONNECTION_INTERFACE_AVATARS))
+    flags |= EMPATHY_CONTACT_WIDGET_EDIT_AVATAR;
+
+  /* create the contact info editor for this account */
+  editor = empathy_contact_widget_new (contact, flags);
 
   gtk_box_pack_start (GTK_BOX (priv->dialog_content), alig, TRUE, TRUE, 0);
   gtk_container_add (GTK_CONTAINER (alig), editor);



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