[empathy] invite-participant-dialog: don't display treeview if no contact list



commit 5c4c3ec113984d8ae5a1f68513da64b0eb901841
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Thu Oct 27 16:14:58 2011 +0200

    invite-participant-dialog: don't display treeview if no contact list
    
    https://bugzilla.gnome.org/show_bug.cgi?id=662843

 src/empathy-invite-participant-dialog.c |   24 ++++++++++++++++++++++--
 1 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/src/empathy-invite-participant-dialog.c b/src/empathy-invite-participant-dialog.c
index 7651fad..8d9d712 100644
--- a/src/empathy-invite-participant-dialog.c
+++ b/src/empathy-invite-participant-dialog.c
@@ -168,6 +168,17 @@ filter_individual (EmpathyContactChooser *chooser,
   return display;
 }
 
+static gboolean
+has_contact_list (EmpathyInviteParticipantDialog *self)
+{
+  TpConnection *conn;
+
+  conn = tp_channel_borrow_connection (TP_CHANNEL (self->priv->tp_chat));
+
+  return tp_proxy_has_interface_by_id (conn,
+      TP_IFACE_QUARK_CONNECTION_INTERFACE_CONTACT_LIST);
+}
+
 static void
 invite_participant_dialog_constructed (GObject *object)
 {
@@ -214,8 +225,17 @@ invite_participant_dialog_constructed (GObject *object)
   gtk_window_set_title (GTK_WINDOW (self), _("Invite Participant"));
   gtk_window_set_role (GTK_WINDOW (self), "invite_participant");
 
-  /* Set a default height so a few contacts are displayed */
-  gtk_window_set_default_size (GTK_WINDOW (self), -1, 400);
+  if (has_contact_list (self))
+    {
+      /* Set a default height so a few contacts are displayed */
+      gtk_window_set_default_size (GTK_WINDOW (self), -1, 400);
+    }
+  else
+    {
+      /* No need to display an empty treeview (ie IRC) */
+      empathy_contact_chooser_show_tree_view (
+          EMPATHY_CONTACT_CHOOSER (self->priv->chooser), FALSE);
+    }
 }
 
 static void



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