[gnome-control-center/wip/feborges/new-users-panel: 5/6] 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/wip/feborges/new-users-panel: 5/6] user-accounts: use radio buttons for account type in Add User dialog
- Date: Thu, 26 May 2016 08:38:21 +0000 (UTC)
commit b9b16c64aeaf2453399d50e4ad4eb7d9d8abb439
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
panels/user-accounts/data/account-dialog.ui | 56 +++++++++++++++------------
panels/user-accounts/um-account-dialog.c | 13 +-----
2 files changed, 33 insertions(+), 36 deletions(-)
---
diff --git a/panels/user-accounts/data/account-dialog.ui b/panels/user-accounts/data/account-dialog.ui
index 2869665..2e2a1cf 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>
@@ -133,15 +115,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>
@@ -953,4 +952,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 ee8efdf..515a43a 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)) ? 0 : 1);
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");
@@ -611,13 +607,8 @@ local_init (UmAccountDialog *self,
static void
local_prepare (UmAccountDialog *self)
{
- GtkTreeModel *model;
-
gtk_entry_set_text (GTK_ENTRY (self->local_name), "");
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);
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]