]> git.0d.be Git - empathy.git/commitdiff
display a specific message if no account is configured
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Thu, 2 Feb 2012 14:50:51 +0000 (15:50 +0100)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Fri, 3 Feb 2012 11:57:51 +0000 (12:57 +0100)
https://bugzilla.gnome.org/show_bug.cgi?id=656097

src/empathy-roster-window.c

index a1e1209194dfcc53103d4d44c7f0a1851068730c..709df601dbad3826d83be035f0d1538db055acf4 100644 (file)
@@ -637,6 +637,13 @@ display_page_message (EmpathyRosterWindow *self,
       PAGE_MESSAGE);
 }
 
+static void
+display_page_no_account (EmpathyRosterWindow *self)
+{
+  display_page_message (self,
+      _("You need to setup an account to see contacts here."), TRUE);
+}
+
 static void
 roster_window_row_deleted_cb (GtkTreeModel *model,
     GtkTreePath *path,
@@ -2113,6 +2120,22 @@ add_account (EmpathyRosterWindow *self,
   roster_window_setup_balance (self, account);
 }
 
+static void
+set_notebook_page (EmpathyRosterWindow *self)
+{
+  GList *accounts;
+
+  accounts = tp_account_manager_get_valid_accounts (
+      self->priv->account_manager);
+
+  if (g_list_length (accounts) == 0)
+    display_page_no_account (self);
+  else
+    display_page_contact_list (self);
+
+  g_list_free (accounts);
+}
+
 static void
 roster_window_account_validity_changed_cb (TpAccountManager  *manager,
     TpAccount *account,
@@ -2123,6 +2146,8 @@ roster_window_account_validity_changed_cb (TpAccountManager  *manager,
     add_account (self, account);
   else
     roster_window_account_removed_cb (manager, account, self);
+
+  set_notebook_page (self);
 }
 
 static void
@@ -2195,6 +2220,8 @@ account_manager_prepared_cb (GObject *source_object,
   gtk_action_set_sensitive (self->priv->view_history,
       g_list_length (accounts) > 0);
 
+  set_notebook_page (self);
+
   g_list_free (accounts);
 }