[gnome-control-center] user-accounts: use radio buttons for account type in Add User dialog
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] user-accounts: use radio buttons for account type in Add User dialog
- Date: Wed, 1 Jun 2016 15:12:29 +0000 (UTC)
commit efc887c419740eb99dd6864db96aef20efeaef21
Author: Felipe Borges <felipeborges gnome org>
Date: Wed May 25 10:21:50 2016 +0200
user-accounts: use radio buttons for account type in Add User dialog
https://wiki.gnome.org/Design/SystemSettings/UserAccounts
https://bugzilla.gnome.org/show_bug.cgi?id=767065
panels/user-accounts/data/account-dialog.ui | 56 +++++++++++++++------------
panels/user-accounts/um-account-dialog.c | 10 +---
2 files changed, 34 insertions(+), 32 deletions(-)
---
diff --git a/panels/user-accounts/data/account-dialog.ui b/panels/user-accounts/data/account-dialog.ui
index edcbc69..2337d2b 100644
--- a/panels/user-accounts/data/account-dialog.ui
+++ b/panels/user-accounts/data/account-dialog.ui
@@ -8,24 +8,6 @@
<column type="gchararray"/>
</columns>
</object>
- <object class="GtkListStore" id="account-type-model">
- <columns>
- <!-- column-name gchararray -->
- <column type="gchararray"/>
- <!-- column-name gint -->
- <column type="gint"/>
- </columns>
- <data>
- <row>
- <col id="0" translatable="yes" context="Account type">Standard</col>
- <col id="1">0</col>
- </row>
- <row>
- <col id="0" translatable="yes" context="Account type">Administrator</col>
- <col id="1">1</col>
- </row>
- </data>
- </object>
<object class="GtkBox" id="account-dialog">
<property name="visible">True</property>
@@ -134,15 +116,32 @@
</packing>
</child>
<child>
- <object class="GtkComboBox" id="local-account-type">
+ <object class="GtkBox" id="local-account-type">
<property name="visible">True</property>
- <property name="model">account-type-model</property>
- <property name="hexpand">True</property>
+ <property name="can_focus">False</property>
+ <style>
+ <class name="linked"/>
+ </style>
+ <child>
+ <object class="GtkRadioButton" id="account-type-standard">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="label" translatable="yes">Standard</property>
+ <property name="draw_indicator">False</property>
+ <property name="height_request">35</property>
+ </object>
+ </child>
<child>
- <object class="GtkCellRendererText" id="account-type-cell"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
+ <object class="GtkRadioButton" id="account-type-admin">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="label" translatable="yes">Administrator</property>
+ <property name="draw_indicator">False</property>
+ <property name="height_request">35</property>
+ <property name="group">account-type-standard</property>
+ </object>
</child>
</object>
<packing>
@@ -966,4 +965,11 @@ type their domain password here.</property>
<widget name="enterprise-password"/>
</widgets>
</object>
+ <object class="GtkSizeGroup">
+ <property name="mode">horizontal</property>
+ <widgets>
+ <widget name="account-type-standard"/>
+ <widget name="account-type-admin"/>
+ </widgets>
+ </object>
</interface>
diff --git a/panels/user-accounts/um-account-dialog.c b/panels/user-accounts/um-account-dialog.c
index 6bee2c1..e853136 100644
--- a/panels/user-accounts/um-account-dialog.c
+++ b/panels/user-accounts/um-account-dialog.c
@@ -246,16 +246,12 @@ local_create_user (UmAccountDialog *self)
const gchar *username;
const gchar *name;
gint account_type;
- GtkTreeModel *model;
- GtkTreeIter iter;
begin_action (self);
name = gtk_entry_get_text (GTK_ENTRY (self->local_name));
username = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (self->local_username));
- model = gtk_combo_box_get_model (GTK_COMBO_BOX (self->local_account_type));
- gtk_combo_box_get_active_iter (GTK_COMBO_BOX (self->local_account_type), &iter);
- gtk_tree_model_get (model, &iter, 1, &account_type, -1);
+ account_type = (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->local_account_type)) ?
ACT_USER_ACCOUNT_TYPE_STANDARD : ACT_USER_ACCOUNT_TYPE_ADMINISTRATOR);
g_debug ("Creating local user: %s", username);
@@ -569,7 +565,7 @@ local_init (UmAccountDialog *self,
widget = (GtkWidget *) gtk_builder_get_object (builder, "local-username-hint");
self->local_username_hint = widget;
- widget = (GtkWidget *) gtk_builder_get_object (builder, "local-account-type");
+ widget = (GtkWidget *) gtk_builder_get_object (builder, "account-type-standard");
self->local_account_type = widget;
widget = (GtkWidget *) gtk_builder_get_object (builder, "local-password-now-radio");
@@ -617,7 +613,7 @@ local_prepare (UmAccountDialog *self)
gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (self->local_username))), "");
model = gtk_combo_box_get_model (GTK_COMBO_BOX (self->local_username));
gtk_list_store_clear (GTK_LIST_STORE (model));
- gtk_combo_box_set_active (GTK_COMBO_BOX (self->local_account_type), 0);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->local_account_type), TRUE);
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]