[gnome-initial-setup] account: design changes of local part
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-initial-setup] account: design changes of local part
- Date: Thu, 29 May 2014 16:50:30 +0000 (UTC)
commit 86aa54c56edb8d48a3e34e859f8de99d4d553668
Author: Ondrej Holy <oholy redhat com>
Date: Fri Apr 11 14:50:08 2014 +0200
account: design changes of local part
Design changes are done according mockup. It corresponds with
User Accounts panel in Gnome Control Center.
Use checkmarks to indicate correct values instead of checkmarks.
Alignment of hints is changed. Hints are dimmed and dynamic.
https://bugzilla.gnome.org/show_bug.cgi?id=693650
.../pages/account/gis-account-page-local.c | 97 +++++++++++++++----
.../pages/account/gis-account-page-local.ui | 16 +++-
gnome-initial-setup/pages/account/um-utils.c | 13 +--
3 files changed, 93 insertions(+), 33 deletions(-)
---
diff --git a/gnome-initial-setup/pages/account/gis-account-page-local.c
b/gnome-initial-setup/pages/account/gis-account-page-local.c
index 2b5d7e0..e1d49cc 100644
--- a/gnome-initial-setup/pages/account/gis-account-page-local.c
+++ b/gnome-initial-setup/pages/account/gis-account-page-local.c
@@ -39,6 +39,7 @@
#include <rest/oauth-proxy.h>
#include <json-glib/json-glib.h>
+#define VALIDATION_TIMEOUT 600
struct _GisAccountPageLocalPrivate
{
@@ -47,8 +48,11 @@ struct _GisAccountPageLocalPrivate
GtkWidget *subtitle;
GtkWidget *fullname_entry;
GtkWidget *username_combo;
+ GtkWidget *username_explanation;
UmPhotoDialog *photo_dialog;
+ gint timeout_id;
+
GdkPixbuf *avatar_pixbuf;
gchar *avatar_filename;
@@ -235,6 +239,48 @@ accounts_changed (GoaClient *client, GoaObject *object, gpointer data)
prepopulate_account_page (page);
}
+static gboolean
+validate (GisAccountPageLocal *page)
+{
+ GisAccountPageLocalPrivate *priv = gis_account_page_local_get_instance_private (page);
+ GtkWidget *entry;
+ const gchar *name, *username;
+ gchar *tip;
+
+ if (priv->timeout_id != 0) {
+ g_source_remove (priv->timeout_id);
+ priv->timeout_id = 0;
+ }
+
+ entry = gtk_bin_get_child (GTK_BIN (priv->username_combo));
+
+ name = gtk_entry_get_text (GTK_ENTRY (priv->fullname_entry));
+ username = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (priv->username_combo));
+
+ priv->valid_name = is_valid_name (name);
+ if (priv->valid_name)
+ set_entry_validation_checkmark (GTK_ENTRY (priv->fullname_entry));
+
+ priv->valid_username = is_valid_username (username, &tip);
+ if (priv->valid_username)
+ set_entry_validation_checkmark (GTK_ENTRY (entry));
+
+ gtk_label_set_text (GTK_LABEL (priv->username_explanation), tip);
+ g_free (tip);
+
+ validation_changed (page);
+
+ return FALSE;
+}
+
+static gboolean
+on_focusout (GisAccountPageLocal *page)
+{
+ validate (page);
+
+ return FALSE;
+}
+
static void
fullname_changed (GtkWidget *w,
GParamSpec *pspec,
@@ -252,18 +298,19 @@ fullname_changed (GtkWidget *w,
gtk_list_store_clear (GTK_LIST_STORE (model));
- priv->valid_name = is_valid_name (name);
-
- if (!priv->valid_name) {
+ if (strlen (name) == 0) {
gtk_entry_set_text (GTK_ENTRY (entry), "");
- return;
+ }
+ else {
+ generate_username_choices (name, GTK_LIST_STORE (model));
+ gtk_combo_box_set_active (GTK_COMBO_BOX (priv->username_combo), 0);
}
- generate_username_choices (name, GTK_LIST_STORE (model));
+ clear_entry_validation_error (GTK_ENTRY (w));
- gtk_combo_box_set_active (GTK_COMBO_BOX (priv->username_combo), 0);
+ priv->valid_name = FALSE;
- validation_changed (page);
+ /* username_changed() is called consequently due to changes */
}
static void
@@ -271,25 +318,17 @@ username_changed (GtkComboBoxText *combo,
GisAccountPageLocal *page)
{
GisAccountPageLocalPrivate *priv = gis_account_page_local_get_instance_private (page);
- const gchar *username;
- gchar *tip;
GtkWidget *entry;
- username = gtk_combo_box_text_get_active_text (combo);
-
- priv->valid_username = is_valid_username (username, &tip);
-
entry = gtk_bin_get_child (GTK_BIN (combo));
+ clear_entry_validation_error (GTK_ENTRY (entry));
- if (tip) {
- set_entry_validation_error (GTK_ENTRY (entry), tip);
- g_free (tip);
- }
- else {
- clear_entry_validation_error (GTK_ENTRY (entry));
- }
-
+ priv->valid_username = FALSE;
validation_changed (page);
+
+ if (priv->timeout_id != 0)
+ g_source_remove (priv->timeout_id);
+ priv->timeout_id = g_timeout_add (VALIDATION_TIMEOUT, (GSourceFunc)validate, page);
}
static void
@@ -335,8 +374,16 @@ gis_account_page_local_constructed (GObject *object)
g_signal_connect (priv->fullname_entry, "notify::text",
G_CALLBACK (fullname_changed), page);
+ g_signal_connect_swapped (priv->fullname_entry, "focus-out-event",
+ G_CALLBACK (on_focusout), page);
+ g_signal_connect_swapped (priv->fullname_entry, "activate",
+ G_CALLBACK (validate), page);
g_signal_connect (priv->username_combo, "changed",
G_CALLBACK (username_changed), page);
+ g_signal_connect_swapped (priv->username_combo, "focus-out-event",
+ G_CALLBACK (on_focusout), page);
+ g_signal_connect_swapped (gtk_bin_get_child (GTK_BIN (priv->username_combo)),
+ "activate", G_CALLBACK (validate), page);
priv->valid_name = FALSE;
priv->valid_username = FALSE;
@@ -363,6 +410,8 @@ gis_account_page_local_constructed (GObject *object)
priv->photo_dialog = um_photo_dialog_new (priv->avatar_button,
avatar_callback,
page);
+
+ validate (page);
}
static void
@@ -376,6 +425,11 @@ gis_account_page_local_dispose (GObject *object)
g_clear_pointer (&priv->avatar_filename, g_free);
g_clear_pointer (&priv->photo_dialog, um_photo_dialog_free);
+ if (priv->timeout_id != 0) {
+ g_source_remove (priv->timeout_id);
+ priv->timeout_id = 0;
+ }
+
G_OBJECT_CLASS (gis_account_page_local_parent_class)->dispose (object);
}
@@ -454,6 +508,7 @@ gis_account_page_local_class_init (GisAccountPageLocalClass *klass)
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisAccountPageLocal, subtitle);
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisAccountPageLocal,
fullname_entry);
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisAccountPageLocal,
username_combo);
+ gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisAccountPageLocal,
username_explanation);
object_class->constructed = gis_account_page_local_constructed;
object_class->dispose = gis_account_page_local_dispose;
diff --git a/gnome-initial-setup/pages/account/gis-account-page-local.ui
b/gnome-initial-setup/pages/account/gis-account-page-local.ui
index 81bcac7..60b010c 100644
--- a/gnome-initial-setup/pages/account/gis-account-page-local.ui
+++ b/gnome-initial-setup/pages/account/gis-account-page-local.ui
@@ -60,7 +60,7 @@
<object class="GtkGrid" id="form">
<property name="visible">True</property>
<property name="column_spacing">12</property>
- <property name="row_spacing">12</property>
+ <property name="row_spacing">6</property>
<property name="margin_top">54</property>
<child>
<object class="GtkLabel" id="fullname_label">
@@ -101,6 +101,7 @@
<property name="label" translatable="yes">_Username</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">comboboxtext-entry</property>
+ <property name="margin_top">6</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -116,6 +117,7 @@
<property name="has_entry">True</property>
<property name="entry_text_column">0</property>
<property name="id_column">1</property>
+ <property name="margin_top">6</property>
<child internal-child="entry">
<object class="GtkEntry" id="comboboxtext-entry">
<property name="can_focus">True</property>
@@ -133,10 +135,16 @@
<child>
<object class="GtkLabel" id="username_explanation">
<property name="visible">True</property>
- <property name="halign">start</property>
- <property name="margin_bottom">12</property>
- <property name="label" translatable="yes">Your username cannot be changed after
setup.</property>
+ <property name="yalign">0</property>
+ <property name="xalign">0</property>
+ <property name="width-chars">35</property>
+ <property name="max-width-chars">35</property>
+ <property name="height-request">50</property>
<property name="wrap">True</property>
+ <property name="wrap_mode">word-char</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
<attributes>
<attribute name="scale" value="0.8"/>
</attributes>
diff --git a/gnome-initial-setup/pages/account/um-utils.c b/gnome-initial-setup/pages/account/um-utils.c
index d71be0c..69d2f6d 100644
--- a/gnome-initial-setup/pages/account/um-utils.c
+++ b/gnome-initial-setup/pages/account/um-utils.c
@@ -242,24 +242,21 @@ is_valid_username (const gchar *username, gchar **tip)
if (!empty && (in_use || too_long || !valid)) {
if (in_use) {
- *tip = g_strdup_printf (_("A user with the username '%s' already exists"),
+ *tip = g_strdup_printf (_("A user with the username '%s' already exists."),
username);
}
else if (too_long) {
- *tip = g_strdup_printf (_("The username is too long"));
+ *tip = g_strdup_printf (_("The username is too long."));
}
else if (username[0] == '-') {
- *tip = g_strdup (_("The username cannot start with a '-'"));
+ *tip = g_strdup (_("The username cannot start with a '-'."));
}
else {
- *tip = g_strdup (_("The username must only consist of:\n"
- " \xe2\x9e\xa3 letters from the English alphabet\n"
- " \xe2\x9e\xa3 digits\n"
- " \xe2\x9e\xa3 any of the characters '.', '-' and '_'"));
+ *tip = g_strdup (_("The username should only consist of lower and upper case letters
from a-z, digits and any of characters '.', '-' and '_'."));
}
}
else {
- *tip = NULL;
+ *tip = g_strdup (_("This will be used to name your home folder and can't be changed."));
}
return valid;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]