[gnome-initial-setup] Move the 'Use Enterprise Login' button to action area



commit a481685802f643b6adf23f2fde8926a9b6832559
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Jan 19 18:32:20 2013 -0500

    Move the 'Use Enterprise Login' button to action area
    
    Following the latest design review.

 .../pages/account/gis-account-page.c               |   42 ++++++++++++-------
 .../pages/account/gis-account-page.ui              |   35 ----------------
 2 files changed, 26 insertions(+), 51 deletions(-)
---
diff --git a/gnome-initial-setup/pages/account/gis-account-page.c b/gnome-initial-setup/pages/account/gis-account-page.c
index a5623d6..e9fc54a 100644
--- a/gnome-initial-setup/pages/account/gis-account-page.c
+++ b/gnome-initial-setup/pages/account/gis-account-page.c
@@ -70,6 +70,8 @@ struct _GisAccountPagePrivate
   guint realmd_watch;
   UmRealmManager *realm_manager;
   gboolean domain_chosen;
+
+  GtkWidget *action;
 };
 
 #define OBJ(type,name) ((type)gtk_builder_get_object(GIS_PAGE (page)->builder,(name)))
@@ -189,6 +191,11 @@ set_mode (GisAccountPage *page,
 
   priv->mode = mode;
 
+  gtk_button_set_label (GTK_BUTTON (priv->action),
+                        mode == UM_LOCAL ? _("Use _Enterprise Login")
+                                         : _("_Use Local Login"));
+  gtk_button_set_use_underline (GTK_BUTTON (priv->action), TRUE);
+
   nb = WID("account-notebook");
   gtk_notebook_set_current_page (GTK_NOTEBOOK (nb), (mode == UM_LOCAL) ? 0 : 1);
 
@@ -205,8 +212,6 @@ set_has_enterprise (GisAccountPage *page,
     return;
 
   priv->has_enterprise = 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);
@@ -813,17 +818,13 @@ on_entry_changed (GtkEditable *editable,
 }
 
 static void
-on_local_clicked (GtkButton *button,
-                  gpointer   user_data)
-{
-  set_mode (GIS_ACCOUNT_PAGE (user_data), UM_LOCAL);
-}
-
-static void
-on_enterprise_clicked (GtkButton *button,
-                       gpointer   user_data)
+toggle_mode (GtkButton *button,
+             gpointer   user_data)
 {
-  set_mode (GIS_ACCOUNT_PAGE (user_data), UM_ENTERPRISE);
+  set_mode (GIS_ACCOUNT_PAGE (user_data),
+            GIS_ACCOUNT_PAGE (user_data)->priv->mode == UM_LOCAL
+            ? UM_ENTERPRISE
+            : UM_LOCAL);
 }
 
 static void
@@ -876,10 +877,6 @@ 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"), "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 ();
 
@@ -890,6 +887,11 @@ gis_account_page_constructed (GObject *object)
 
   priv->has_enterprise = FALSE;
 
+  priv->action = gtk_button_new_with_mnemonic ("_Use Enterprise Login");
+  g_signal_connect (priv->action, "clicked", G_CALLBACK (toggle_mode), page);
+  gtk_widget_show (priv->action);
+  g_object_ref_sink (priv->action);
+
   /* force a refresh by setting to an invalid value */
   priv->mode = NUM_MODES;
   set_mode (page, UM_LOCAL);
@@ -908,10 +910,17 @@ gis_account_page_dispose (GObject *object)
   g_clear_object (&priv->act_user);
   g_clear_object (&priv->act_client);
   g_clear_object (&priv->realm_manager);
+  g_clear_object (&priv->action);
 
   G_OBJECT_CLASS (gis_account_page_parent_class)->dispose (object);
 }
 
+static GtkWidget *
+gis_account_page_get_action_widget (GisPage *page)
+{
+  return GIS_ACCOUNT_PAGE (page)->priv->action;
+}
+
 static void
 gis_account_page_class_init (GisAccountPageClass *klass)
 {
@@ -919,6 +928,7 @@ gis_account_page_class_init (GisAccountPageClass *klass)
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
   page_class->page_id = PAGE_ID;
+  page_class->get_action_widget = gis_account_page_get_action_widget;
   object_class->constructed = gis_account_page_constructed;
   object_class->dispose = gis_account_page_dispose;
 
diff --git a/gnome-initial-setup/pages/account/gis-account-page.ui b/gnome-initial-setup/pages/account/gis-account-page.ui
index a2c8339..57fd7f1 100644
--- a/gnome-initial-setup/pages/account/gis-account-page.ui
+++ b/gnome-initial-setup/pages/account/gis-account-page.ui
@@ -102,23 +102,6 @@
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="enterprise-button">
-                <property name="label" translatable="yes">Use _Enterprise Login</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="halign">start</property>
-                <property name="valign">end</property>
-                <property name="use_underline">True</property>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">7</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
-              </packing>
-            </child>
-            <child>
               <object class="GtkLabel" id="account-fullname-label">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
@@ -459,24 +442,6 @@
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="local-button">
-                <property name="label" translatable="yes">Use _Local Login</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="halign">start</property>
-                <property name="valign">end</property>
-                <property name="vexpand">True</property>
-                <property name="use_underline">True</property>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">5</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
-              </packing>
-            </child>
-            <child>
               <object class="GtkComboBox" id="enterprise-domain">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>



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