[gnome-control-center] user-accounts: fix enterprise toggle



commit 608fa9609ce5e2fe5fff5560f7a75ff25250bbcc
Author: Ondrej Holy <oholy redhat com>
Date:   Wed Jul 30 22:24:11 2014 +0200

    user-accounts: fix enterprise toggle
    
    Enterprise toggle isn't shown due to header bar buttons. Don't add
    the toggle in to the dialog action area to fix the bug.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=734422

 panels/user-accounts/data/account-dialog.ui |   52 ++++++++++++++++++++++++++-
 panels/user-accounts/um-account-dialog.c    |   39 +++++++-------------
 2 files changed, 64 insertions(+), 27 deletions(-)
---
diff --git a/panels/user-accounts/data/account-dialog.ui b/panels/user-accounts/data/account-dialog.ui
index 5ef6be3..d9c9a62 100644
--- a/panels/user-accounts/data/account-dialog.ui
+++ b/panels/user-accounts/data/account-dialog.ui
@@ -26,7 +26,13 @@
       </row>
     </data>
   </object>
-          <object class="GtkNotebook" id="account-dialog">
+
+      <object class="GtkBox" id="account-dialog">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <child>
+          <object class="GtkNotebook" id="notebook">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="show_tabs">False</property>
@@ -632,6 +638,50 @@ enterprise login accounts.</property>
               </packing>
             </child>
           </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkBox" id="box3">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <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="border_width">6</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkSpinner" id="spinner">
+                <property name="visible">True</property>
+                <property name="can_focus">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">False</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
   <object class="GtkDialog" id="join-dialog">
     <property name="can_focus">False</property>
     <property name="border_width">10</property>
diff --git a/panels/user-accounts/um-account-dialog.c b/panels/user-accounts/um-account-dialog.c
index 0b47378..4174967 100644
--- a/panels/user-accounts/um-account-dialog.c
+++ b/panels/user-accounts/um-account-dialog.c
@@ -64,6 +64,7 @@ static void   um_account_dialog_response  (GtkDialog *dialog,
 
 struct _UmAccountDialog {
         GtkDialog parent;
+        GtkWidget *notebook;
         GtkWidget *container_widget;
         GSimpleAsyncResult *async;
         GCancellable *cancellable;
@@ -145,7 +146,7 @@ begin_action (UmAccountDialog *self)
         g_debug ("Beginning action, disabling dialog controls");
 
         if (self->enterprise_check_credentials) {
-                gtk_widget_set_sensitive (self->container_widget, FALSE);
+                gtk_widget_set_sensitive (self->notebook, FALSE);
         }
         gtk_widget_set_sensitive (self->enterprise_button, FALSE);
         gtk_dialog_set_response_sensitive (GTK_DIALOG (self), GTK_RESPONSE_OK, FALSE);
@@ -160,7 +161,7 @@ finish_action (UmAccountDialog *self)
         g_debug ("Completed domain action");
 
         if (self->enterprise_check_credentials) {
-                gtk_widget_set_sensitive (self->container_widget, TRUE);
+                gtk_widget_set_sensitive (self->notebook, TRUE);
         }
         gtk_widget_set_sensitive (self->enterprise_button, TRUE);
         gtk_dialog_set_response_sensitive (GTK_DIALOG (self), GTK_RESPONSE_OK, TRUE);
@@ -1379,7 +1380,7 @@ mode_change (UmAccountDialog *self,
                 mode = available ? UM_ENTERPRISE : UM_OFFLINE;
         }
 
-        gtk_notebook_set_current_page (GTK_NOTEBOOK (self->container_widget), mode);
+        gtk_notebook_set_current_page (GTK_NOTEBOOK (self->notebook), mode);
 
         /* The enterprise toggle state */
         active = (mode != UM_LOCAL);
@@ -1419,8 +1420,6 @@ um_account_dialog_init (UmAccountDialog *self)
         GError *error = NULL;
         GtkDialog *dialog;
         GtkWidget *content;
-        GtkWidget *actions;
-        GtkWidget *box;
 
         builder = gtk_builder_new ();
 
@@ -1433,33 +1432,18 @@ um_account_dialog_init (UmAccountDialog *self)
         }
 
         dialog = GTK_DIALOG (self);
-        actions = gtk_dialog_get_action_area (dialog);
         content = gtk_dialog_get_content_area (dialog);
         gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
         gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
         gtk_window_set_title (GTK_WINDOW (dialog), _("Add User"));
         gtk_window_set_icon_name (GTK_WINDOW (dialog), "system-users");
 
-        /* Rearrange the bottom of dialog, so we can have spinner on left */
-        g_object_ref (actions);
-        box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
-        gtk_container_remove (GTK_CONTAINER (content), actions);
-        gtk_box_pack_end (GTK_BOX (box), actions, FALSE, TRUE, 0);
-        gtk_box_pack_end (GTK_BOX (content), box, TRUE, TRUE, 0);
-        gtk_widget_show (box);
-        g_object_unref (actions);
-
-        /* Create enterprise toggle button. */
-        self->enterprise_button = gtk_toggle_button_new_with_mnemonic (_("_Enterprise Login"));
-        gtk_container_set_border_width (GTK_CONTAINER (self->enterprise_button), 6);
-        gtk_box_pack_start (GTK_BOX (box), self->enterprise_button, FALSE, FALSE, 0);
-
-        /* Create the spinner, but don't show it yet */
-        self->spinner = GTK_SPINNER (gtk_spinner_new ());
-        widget = gtk_alignment_new (0.5, 0.5, 1.0, 1.0);
-        gtk_box_pack_end (GTK_BOX (box), widget, FALSE, FALSE, 0);
-        gtk_container_add (GTK_CONTAINER (widget), GTK_WIDGET (self->spinner));
-        gtk_widget_show (widget);
+        widget = GTK_WIDGET (gtk_builder_get_object (builder, "enterprise-button"));
+        self->enterprise_button = widget;
+
+        widget = GTK_WIDGET (gtk_builder_get_object (builder, "spinner"));
+        gtk_widget_hide (widget);
+        self->spinner = GTK_SPINNER (widget);
 
         gtk_dialog_add_button (dialog, _("Cancel"), GTK_RESPONSE_CANCEL);
         widget = gtk_dialog_add_button (dialog, _("_Add"), GTK_RESPONSE_OK);
@@ -1470,6 +1454,9 @@ 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;
+
         local_init (self, builder);
         enterprise_init (self, builder);
         join_init (self, builder);


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