[gnome-initial-setup] account: Remove toggle button array in favor of using regular buttons



commit 2427380e51ee341da9d5562689169934292986b4
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Jan 3 13:34:32 2013 -0500

    account: Remove toggle button array in favor of using regular buttons

 .../pages/account/gis-account-page.c               |   31 +++-----
 .../pages/account/gis-account-page.ui              |   71 +++++++------------
 2 files changed, 38 insertions(+), 64 deletions(-)
---
diff --git a/gnome-initial-setup/pages/account/gis-account-page.c b/gnome-initial-setup/pages/account/gis-account-page.c
index f149dcd..8ea4a19 100644
--- a/gnome-initial-setup/pages/account/gis-account-page.c
+++ b/gnome-initial-setup/pages/account/gis-account-page.c
@@ -189,8 +189,6 @@ set_mode (GisAccountPage *page,
   priv->mode = mode;
   gtk_widget_set_visible (WID ("local-area"), (mode == UM_LOCAL));
   gtk_widget_set_visible (WID ("enterprise-area"), (mode == UM_ENTERPRISE));
-  gtk_toggle_button_set_active (OBJ (GtkToggleButton *, "local-button"), (mode == UM_LOCAL));
-  gtk_toggle_button_set_active (OBJ (GtkToggleButton *, "enterprise-button"), (mode == UM_ENTERPRISE));
 
   update_account_page_status (page);
 }
@@ -205,7 +203,8 @@ set_has_enterprise (GisAccountPage *page,
     return;
 
   priv->has_enterprise = has_enterprise;
-  gtk_widget_set_visible (WID ("account-mode"), has_enterprise);
+  gtk_widget_set_visible (WID ("local-button"), has_enterprise);
+  gtk_widget_set_visible (WID ("enterprise-button"), has_enterprise);
 
   if (!has_enterprise)
     set_mode (page, UM_LOCAL);
@@ -812,23 +811,17 @@ on_entry_changed (GtkEditable *editable,
 }
 
 static void
-on_local_toggle (GtkToggleButton *toggle,
-                 gpointer         user_data)
+on_local_clicked (GtkButton *button,
+                  gpointer   user_data)
 {
-  GisAccountPage *page = user_data;
-  if (gtk_toggle_button_get_active (toggle)) {
-    set_mode (page, UM_LOCAL);
-  }
+  set_mode (GIS_ACCOUNT_PAGE (user_data), UM_LOCAL);
 }
 
 static void
-on_enterprise_toggle (GtkToggleButton *toggle,
-                      gpointer         user_data)
+on_enterprise_clicked (GtkButton *button,
+                       gpointer   user_data)
 {
-  GisAccountPage *page = user_data;
-  if (gtk_toggle_button_get_active (toggle)) {
-    set_mode (page, UM_ENTERPRISE);
-  }
+  set_mode (GIS_ACCOUNT_PAGE (user_data), UM_ENTERPRISE);
 }
 
 static void
@@ -881,10 +874,10 @@ gis_account_page_constructed (GObject *object)
                     G_CALLBACK (on_domain_changed), page);
   g_signal_connect (WID("enterprise-login"), "changed",
                     G_CALLBACK (on_entry_changed), page);
-  g_signal_connect (WID("local-button"), "toggled",
-                    G_CALLBACK (on_local_toggle), page);
-  g_signal_connect (WID("enterprise-button"), "toggled",
-                    G_CALLBACK (on_enterprise_toggle), page);
+  g_signal_connect (WID("local-button"), "clicked",
+                    G_CALLBACK (on_local_clicked), page);
+  g_signal_connect (WID("enterprise-button"), "clicked",
+                    G_CALLBACK (on_enterprise_clicked), page);
 
   priv->act_client = act_user_manager_get_default ();
 
diff --git a/gnome-initial-setup/pages/account/gis-account-page.ui b/gnome-initial-setup/pages/account/gis-account-page.ui
index df9b0fa..66ba991 100644
--- a/gnome-initial-setup/pages/account/gis-account-page.ui
+++ b/gnome-initial-setup/pages/account/gis-account-page.ui
@@ -49,51 +49,6 @@
       </packing>
     </child>
     <child>
-      <object class="GtkBox" id="account-mode">
-        <property name="can_focus">False</property>
-        <property name="halign">center</property>
-        <property name="margin_bottom">12</property>
-        <style>
-          <class name="linked"/>
-        </style>
-        <child>
-          <object class="GtkToggleButton" id="local-button">
-            <property name="label" translatable="yes">_Local Account</property>
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="receives_default">True</property>
-            <property name="use_underline">True</property>
-            <property name="focus_on_click">False</property>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkToggleButton" id="enterprise-button">
-            <property name="label" translatable="yes">_Enterprise Login</property>
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="receives_default">True</property>
-            <property name="use_underline">True</property>
-            <property name="focus_on_click">False</property>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">True</property>
-        <property name="position">1</property>
-      </packing>
-    </child>
-    <child>
       <object class="GtkGrid" id="local-area">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
@@ -111,6 +66,19 @@
           </packing>
         </child>
         <child>
+          <object class="GtkButton" id="enterprise-button">
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">Use _Enterprise Login</property>
+            <property name="use_underline">True</property>
+            <property name="halign">start</property>
+            <property name="valign">end</property>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">6</property>
+          </packing>
+        </child>
+        <child>
           <object class="GtkLabel" id="account-fullname-label">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
@@ -439,6 +407,19 @@
             <property name="height">1</property>
           </packing>
         </child>
+        <child>
+          <object class="GtkButton" id="local-button">
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">Use _Local Login</property>
+            <property name="use_underline">True</property>
+            <property name="halign">start</property>
+            <property name="valign">end</property>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">3</property>
+          </packing>
+        </child>
       </object>
       <packing>
         <property name="expand">False</property>



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