[gnome-control-center] user-accounts: use GtkStack instead of GtkNotebook in Add user dialog



commit 3695f858dde4d91243885c853302d9b9b2f64bf2
Author: Ondrej Holy <oholy redhat com>
Date:   Thu Aug 14 11:58:14 2014 +0200

    user-accounts: use GtkStack instead of GtkNotebook in Add user dialog
    
    https://bugzilla.gnome.org/show_bug.cgi?id=734422

 panels/user-accounts/data/account-dialog.ui |   12 +++++++-----
 panels/user-accounts/um-account-dialog.c    |   21 +++++++++++++--------
 2 files changed, 20 insertions(+), 13 deletions(-)
---
diff --git a/panels/user-accounts/data/account-dialog.ui b/panels/user-accounts/data/account-dialog.ui
index d9c9a62..d99ac91 100644
--- a/panels/user-accounts/data/account-dialog.ui
+++ b/panels/user-accounts/data/account-dialog.ui
@@ -32,11 +32,10 @@
         <property name="can_focus">False</property>
         <property name="orientation">vertical</property>
         <child>
-          <object class="GtkNotebook" id="notebook">
+          <object class="GtkStack" id="stack">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
-            <property name="show_tabs">False</property>
-            <property name="show_border">False</property>
+            <property name="transition-type">none</property>
             <property name="border_width">6</property>
             <property name="margin_bottom">6</property>
             <child>
@@ -367,6 +366,9 @@
                   </packing>
                 </child>
               </object>
+              <packing>
+                <property name="name">_local</property>
+              </packing>
             </child>
             <child>
               <object class="GtkGrid" id="enterprise-area">
@@ -563,7 +565,7 @@
                 </child>
               </object>
               <packing>
-                <property name="position">1</property>
+                <property name="name">_enterprise</property>
               </packing>
             </child>
             <child>
@@ -634,7 +636,7 @@ enterprise login accounts.</property>
                 </child>
               </object>
               <packing>
-                <property name="position">2</property>
+                <property name="name">_offline</property>
               </packing>
             </child>
           </object>
diff --git a/panels/user-accounts/um-account-dialog.c b/panels/user-accounts/um-account-dialog.c
index d1147a2..5ac24e4 100644
--- a/panels/user-accounts/um-account-dialog.c
+++ b/panels/user-accounts/um-account-dialog.c
@@ -36,10 +36,15 @@
 typedef enum {
         UM_LOCAL,
         UM_ENTERPRISE,
-        UM_OFFLINE,
-        NUM_MODES
+        UM_OFFLINE
 } UmAccountMode;
 
+static const char * const mode_pages[] = {
+  "_local",
+  "_enterprise",
+  "_offline"
+};
+
 static void   mode_change          (UmAccountDialog *self,
                                     UmAccountMode mode);
 
@@ -64,7 +69,7 @@ static void   um_account_dialog_response  (GtkDialog *dialog,
 
 struct _UmAccountDialog {
         GtkDialog parent;
-        GtkWidget *notebook;
+        GtkWidget *stack;
         GtkWidget *container_widget;
         GSimpleAsyncResult *async;
         GCancellable *cancellable;
@@ -147,7 +152,7 @@ begin_action (UmAccountDialog *self)
         g_debug ("Beginning action, disabling dialog controls");
 
         if (self->enterprise_check_credentials) {
-                gtk_widget_set_sensitive (self->notebook, FALSE);
+                gtk_widget_set_sensitive (self->stack, FALSE);
         }
         gtk_widget_set_sensitive (self->enterprise_button, FALSE);
         gtk_dialog_set_response_sensitive (GTK_DIALOG (self), GTK_RESPONSE_OK, FALSE);
@@ -162,7 +167,7 @@ finish_action (UmAccountDialog *self)
         g_debug ("Completed domain action");
 
         if (self->enterprise_check_credentials) {
-                gtk_widget_set_sensitive (self->notebook, TRUE);
+                gtk_widget_set_sensitive (self->stack, TRUE);
         }
         gtk_widget_set_sensitive (self->enterprise_button, TRUE);
         gtk_dialog_set_response_sensitive (GTK_DIALOG (self), GTK_RESPONSE_OK, TRUE);
@@ -1395,7 +1400,7 @@ mode_change (UmAccountDialog *self,
                 mode = available ? UM_ENTERPRISE : UM_OFFLINE;
         }
 
-        gtk_notebook_set_current_page (GTK_NOTEBOOK (self->notebook), mode);
+        gtk_stack_set_visible_child_name (GTK_STACK (self->stack), mode_pages[mode]);
 
         /* The enterprise toggle state */
         active = (mode != UM_LOCAL);
@@ -1469,8 +1474,8 @@ um_account_dialog_init (UmAccountDialog *self)
         gtk_container_add (GTK_CONTAINER (content), widget);
         self->container_widget = widget;
 
-        widget = GTK_WIDGET (gtk_builder_get_object (builder, "notebook"));
-        self->notebook = widget;
+        widget = GTK_WIDGET (gtk_builder_get_object (builder, "stack"));
+        self->stack = widget;
 
         local_init (self, builder);
         enterprise_init (self, builder);


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