accounts-dialog: move the 'no protocol' message to a different page
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Wed, 15 Feb 2012 15:04:49 +0000 (16:04 +0100)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Thu, 16 Feb 2012 13:10:32 +0000 (14:10 +0100)
It's cleaner that way

https://bugzilla.gnome.org/show_bug.cgi?id=670203

src/empathy-accounts-dialog.c
src/empathy-accounts-dialog.ui

index 7ad6f12ce4c996c732ba3df19dd8269771b52fbf..35cb9bdb3fe26f609fdf3ad5d21158b25e1b4477 100644 (file)
@@ -78,7 +78,8 @@ G_DEFINE_TYPE (EmpathyAccountsDialog, empathy_accounts_dialog, GTK_TYPE_DIALOG);
 enum
 {
   NOTEBOOK_PAGE_ACCOUNT = 0,
-  NOTEBOOK_PAGE_LOADING
+  NOTEBOOK_PAGE_LOADING,
+  NOTEBOOK_PAGE_NO_PROTOCOL
 };
 
 typedef struct {
@@ -91,7 +92,6 @@ typedef struct {
   GtkWidget *image_status;
   GtkWidget *throbber;
   GtkWidget *enabled_switch;
-  GtkWidget *frame_no_protocol;
 
   GtkWidget *treeview;
 
@@ -984,14 +984,15 @@ accounts_dialog_update_settings (EmpathyAccountsDialog *dialog,
 
       /* No account and no profile, warn the user */
       gtk_widget_hide (priv->vbox_details);
-      gtk_widget_show (priv->frame_no_protocol);
       gtk_widget_set_sensitive (priv->button_add, FALSE);
+
+      gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook_account),
+          NOTEBOOK_PAGE_NO_PROTOCOL);
       return;
     }
 
   /* We have an account selected, destroy old settings and create a new
    * one for the account selected */
-  gtk_widget_hide (priv->frame_no_protocol);
   gtk_widget_show (priv->vbox_details);
 
   if (priv->dialog_content)
@@ -2210,7 +2211,6 @@ accounts_dialog_build_ui (EmpathyAccountsDialog *dialog)
   gui = empathy_builder_get_file (filename,
       "accounts_dialog_hbox", &top_hbox,
       "vbox_details", &priv->vbox_details,
-      "frame_no_protocol", &priv->frame_no_protocol,
       "alignment_settings", &priv->alignment_settings,
       "alignment_infobar", &priv->alignment_infobar,
       "treeview", &priv->treeview,
@@ -2224,8 +2224,6 @@ accounts_dialog_build_ui (EmpathyAccountsDialog *dialog)
       NULL);
   g_free (filename);
 
-  gtk_widget_set_no_show_all (priv->frame_no_protocol, TRUE);
-
   empathy_builder_connect (gui, dialog,
       "button_add", "clicked", accounts_dialog_button_add_clicked_cb,
       "button_remove", "clicked", accounts_dialog_button_remove_clicked_cb,
index 8e5b3f7af659cb94a52e6594dd03cae566c9468f..789ccba0cf1ddbfac5dba98534c0b48247012d59 100644 (file)
                 <property name="position">1</property>
               </packing>
             </child>
-            <child>
-              <object class="GtkFrame" id="frame_no_protocol">
-                <property name="label_xalign">0</property>
-                <property name="shadow_type">none</property>
-                <child>
-                  <object class="GtkAlignment" id="alignment21">
-                    <property name="visible">True</property>
-                    <property name="top_padding">6</property>
-                    <property name="left_padding">12</property>
-                    <child>
-                      <object class="GtkLabel" id="label4">
-                        <property name="visible">True</property>
-                        <property name="label" translatable="yes">To add a new account, you first have to install a backend for each protocol you want to use.</property>
-                        <property name="wrap">True</property>
-                      </object>
-                    </child>
-                  </object>
-                </child>
-                <child type="label">
-                  <object class="GtkLabel" id="label_no_protocol">
-                    <property name="visible">True</property>
-                    <property name="label" translatable="yes">No protocol installed</property>
-                    <attributes>
-                      <attribute name="weight" value="bold"/>
-                    </attributes>
-                  </object>
-                </child>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">2</property>
-              </packing>
-            </child>
-            <child>
-              <placeholder/>
-            </child>
           </object>
         </child>
         <child type="tab">
             <property name="position">1</property>
           </packing>
         </child>
+        <child>
+          <object class="GtkVBox" id="vbox_no_protocol">
+            <property name="visible">True</property>
+            <property name="spacing">18</property>
+            <child>
+              <object class="GtkFrame" id="frame_no_protocol">
+                <property name="label_xalign">0</property>
+                <property name="shadow_type">none</property>
+                <child>
+                  <object class="GtkAlignment" id="alignment21">
+                    <property name="visible">True</property>
+                    <property name="top_padding">6</property>
+                    <property name="left_padding">12</property>
+                    <child>
+                      <object class="GtkLabel" id="label4">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">To add a new account, you first have to install a backend for each protocol you want to use.</property>
+                        <property name="wrap">True</property>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+                <child type="label">
+                  <object class="GtkLabel" id="label_no_protocol">
+                    <property name="visible">True</property>
+                    <property name="label" translatable="yes">No protocol installed</property>
+                    <attributes>
+                      <attribute name="weight" value="bold"/>
+                    </attributes>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+          </object>
+        </child>
       </object>
       <packing>
         <property name="position">1</property>