user-accounts: use GtkStack instead of GtkNotebook in Add user dialog

https://bugzilla.gnome.org/show_bug.cgi?id=734422
This commit is contained in:
Ondrej Holy 2014-08-14 11:58:14 +02:00
parent ed4653627b
commit 3695f858dd
2 changed files with 20 additions and 13 deletions

View file

@ -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>

View file

@ -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);