[empathy] accounts-dialog: display loading page while loading accounts (#611701)



commit f3d884d8ddc2fbe3e2db3d333f41f03036ab71a4
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Thu Aug 26 15:38:18 2010 +0200

    accounts-dialog: display loading page while loading accounts (#611701)

 src/empathy-accounts-dialog.c  |   27 +++++++++++++++++++++++++++
 src/empathy-accounts-dialog.ui |   29 ++++++++++++++++++++++++++++-
 2 files changed, 55 insertions(+), 1 deletions(-)
---
diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c
index d97cf65..994d85e 100644
--- a/src/empathy-accounts-dialog.c
+++ b/src/empathy-accounts-dialog.c
@@ -71,6 +71,12 @@
 #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyAccountsDialog)
 G_DEFINE_TYPE (EmpathyAccountsDialog, empathy_accounts_dialog, GTK_TYPE_DIALOG);
 
+enum
+{
+  NOTEBOOK_PAGE_ACCOUNT = 0,
+  NOTEBOOK_PAGE_LOADING
+};
+
 typedef struct {
   GtkWidget *alignment_settings;
   GtkWidget *alignment_infobar;
@@ -96,6 +102,9 @@ typedef struct {
   GtkWidget *label_type;
   GtkWidget *settings_widget;
 
+  GtkWidget *notebook_account;
+  GtkWidget *spinner;
+
   /* We have to keep a reference on the actual EmpathyAccountWidget, not just
    * his GtkWidget. It is the only reliable source we can query to know if
    * there are any unsaved changes to the currently selected account. We can't
@@ -1866,6 +1875,10 @@ finished_loading (EmpathyAccountsDialog *self)
 
   gtk_widget_set_sensitive (priv->button_add, TRUE);
   gtk_widget_set_sensitive (priv->button_import, TRUE);
+
+  gtk_spinner_stop (GTK_SPINNER (priv->spinner));
+  gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook_account),
+      NOTEBOOK_PAGE_ACCOUNT);
 }
 
 static void
@@ -1997,6 +2010,7 @@ accounts_dialog_build_ui (EmpathyAccountsDialog *dialog)
   EmpathyAccountsDialogPriv    *priv = GET_PRIV (dialog);
   GtkWidget                    *content_area;
   GtkWidget *action_area, *vbox, *hbox, *align;
+  GtkWidget *alig;
 
   filename = empathy_file_lookup ("empathy-accounts-dialog.ui", "src");
 
@@ -2011,6 +2025,8 @@ accounts_dialog_build_ui (EmpathyAccountsDialog *dialog)
       "button_remove", &priv->button_remove,
       "button_import", &priv->button_import,
       "hbox_protocol", &priv->hbox_protocol,
+      "notebook_account", &priv->notebook_account,
+      "alignment_loading", &alig,
       NULL);
   g_free (filename);
 
@@ -2035,6 +2051,17 @@ accounts_dialog_build_ui (EmpathyAccountsDialog *dialog)
   gtk_widget_hide (priv->button_remove);
 #endif /* HAVE_MEEGO */
 
+  /* Display loading page */
+  priv->spinner = gtk_spinner_new ();
+
+  gtk_spinner_start (GTK_SPINNER (priv->spinner));
+  gtk_widget_show (priv->spinner);
+
+  gtk_container_add (GTK_CONTAINER (alig), priv->spinner);
+
+  gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook_account),
+      NOTEBOOK_PAGE_LOADING);
+
   /* Remove button is insensitive until we have a selected account */
   gtk_widget_set_sensitive (priv->button_remove, FALSE);
 
diff --git a/src/empathy-accounts-dialog.ui b/src/empathy-accounts-dialog.ui
index 5af524a..049c06c 100644
--- a/src/empathy-accounts-dialog.ui
+++ b/src/empathy-accounts-dialog.ui
@@ -216,7 +216,34 @@
           </packing>
         </child>
         <child>
-          <placeholder/>
+          <object class="GtkHBox" id="hbox_loading">
+            <property name="visible">True</property>
+            <child>
+              <object class="GtkAlignment" id="alignment_loading">
+                <property name="visible">True</property>
+                <property name="left_padding">12</property>
+                <child>
+                  <placeholder/>
+                </child>
+              </object>
+              <packing>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label5">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes">&lt;b&gt;&lt;span size='xx-large'&gt;Loading account information&lt;/span&gt;&lt;/b&gt;</property>
+                <property name="use_markup">True</property>
+              </object>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="position">1</property>
+          </packing>
         </child>
         <child type="tab">
           <object class="GtkLabel" id="label2">



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