[accounts-dialog] Change 'Short name' to 'Username'
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [accounts-dialog] Change 'Short name' to 'Username'
- Date: Fri, 16 Jul 2010 03:18:12 +0000 (UTC)
commit ce0be67c53f4ba8b92d33b9073150a496c67e5ca
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Jul 15 23:16:09 2010 -0400
Change 'Short name' to 'Username'
This is consistent with gdm, and common terminology.
Based on a patch by Milan Bouchet-Valat, bug 623287.
data/account-dialog.ui | 12 +++---
src/um-account-dialog.c | 90 +++++++++++++++++++++++-----------------------
2 files changed, 51 insertions(+), 51 deletions(-)
---
diff --git a/data/account-dialog.ui b/data/account-dialog.ui
index 12ae1b0..07132a2 100644
--- a/data/account-dialog.ui
+++ b/data/account-dialog.ui
@@ -2,7 +2,7 @@
<interface>
<!-- interface-requires gtk+ 2.12 -->
<!-- interface-naming-policy toplevel-contextual -->
- <object class="GtkListStore" id="shortname-model">
+ <object class="GtkListStore" id="username-model">
<columns>
<!-- column-name gchararray -->
<column type="gchararray"/>
@@ -57,12 +57,12 @@
<property name="column_spacing">6</property>
<property name="row_spacing">6</property>
<child>
- <object class="GtkComboBoxEntry" id="shortname-combo">
+ <object class="GtkComboBoxEntry" id="username-combo">
<property name="visible">True</property>
- <property name="model">shortname-model</property>
+ <property name="model">username-model</property>
<property name="text_column">0</property>
<child internal-child="entry">
- <object class="GtkEntry" id="shortname-entry">
+ <object class="GtkEntry" id="username-entry">
<property name="activates_default">True</property>
</object>
</child>
@@ -78,9 +78,9 @@
<object class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="xalign">1</property>
- <property name="label" translatable="yes">_Short name:</property>
+ <property name="label" translatable="yes">_Username:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">shortname-combo</property>
+ <property name="mnemonic_widget">username-combo</property>
<attributes>
<attribute name="foreground" value="#555555555555"/>
</attributes>
diff --git a/src/um-account-dialog.c b/src/um-account-dialog.c
index 93be534..93e10b5 100644
--- a/src/um-account-dialog.c
+++ b/src/um-account-dialog.c
@@ -38,13 +38,13 @@
struct _UmAccountDialog {
GtkWidget *dialog;
- GtkWidget *shortname_combo;
+ GtkWidget *username_combo;
GtkWidget *name_entry;
GtkWidget *account_type_combo;
GtkWidget *ok_button;
gboolean valid_name;
- gboolean valid_shortname;
+ gboolean valid_username;
UserCreatedCallback user_created_callback;
gpointer user_created_data;
@@ -96,21 +96,21 @@ accept_account_dialog (GtkButton *button,
UmAccountDialog *um)
{
UmUserManager *manager;
- const gchar *shortname;
+ const gchar *username;
const gchar *name;
gint account_type;
GtkTreeModel *model;
GtkTreeIter iter;
name = gtk_entry_get_text (GTK_ENTRY (um->name_entry));
- shortname = gtk_combo_box_get_active_text (GTK_COMBO_BOX (um->shortname_combo));
+ username = gtk_combo_box_get_active_text (GTK_COMBO_BOX (um->username_combo));
model = gtk_combo_box_get_model (GTK_COMBO_BOX (um->account_type_combo));
gtk_combo_box_get_active_iter (GTK_COMBO_BOX (um->account_type_combo), &iter);
gtk_tree_model_get (model, &iter, 1, &account_type, -1);
manager = um_user_manager_ref_default ();
um_user_manager_create_user (manager,
- shortname,
+ username,
name,
account_type,
(GAsyncReadyCallback)create_user_done,
@@ -122,67 +122,67 @@ accept_account_dialog (GtkButton *button,
}
static gboolean
-is_shortname_used (const gchar *shortname)
+is_username_used (const gchar *username)
{
struct passwd *pwent;
- pwent = getpwnam (shortname);
+ pwent = getpwnam (username);
return pwent != NULL;
}
static void
-shortname_changed (GtkComboBox *combo,
+username_changed (GtkComboBox *combo,
UmAccountDialog *um)
{
gboolean in_use;
gboolean empty;
gboolean valid;
gboolean toolong;
- const gchar *shortname;
+ const gchar *username;
const gchar *c;
gchar *tip;
GtkWidget *entry;
- shortname = gtk_combo_box_get_active_text (combo);
+ username = gtk_combo_box_get_active_text (combo);
- in_use = is_shortname_used (shortname);
- empty = shortname[0] == 0;
- toolong = strlen (shortname) > MAXNAMELEN;
+ in_use = is_username_used (username);
+ empty = username[0] == 0;
+ toolong = strlen (username) > MAXNAMELEN;
valid = TRUE;
if (!in_use && !empty && !toolong) {
/* First char must be a letter, and it must only composed
* of ASCII letters, digits, and a '.', '-', '_'
*/
- for (c = shortname; *c; c++) {
+ for (c = username; *c; c++) {
if (! ((*c >= 'a' && *c <= 'z') ||
(*c >= 'A' && *c <= 'Z') ||
(*c >= '0' && *c <= '9') ||
(*c == '_') || (*c == '.') ||
- (*c == '-' && c != shortname)))
+ (*c == '-' && c != username)))
valid = FALSE;
}
}
- um->valid_shortname = !empty && !in_use && !toolong && valid;
- gtk_widget_set_sensitive (um->ok_button, um->valid_name && um->valid_shortname);
+ um->valid_username = !empty && !in_use && !toolong && valid;
+ gtk_widget_set_sensitive (um->ok_button, um->valid_name && um->valid_username);
entry = gtk_bin_get_child (GTK_BIN (combo));
if (!empty && (in_use || toolong || !valid)) {
if (in_use) {
- tip = g_strdup_printf (_("A user with the short name '%s' already exists"),
- shortname);
+ tip = g_strdup_printf (_("A user with the username '%s' already exists"),
+ username);
}
else if (toolong) {
- tip = g_strdup_printf (_("The short name is too long"));
+ tip = g_strdup_printf (_("The username is too long"));
}
- else if (shortname[0] == '-') {
- tip = g_strdup (_("The short name cannot start with a '-'"));
+ else if (username[0] == '-') {
+ tip = g_strdup (_("The username cannot start with a '-'"));
}
else {
- tip = g_strdup (_("The short name must consist of:\n"
+ tip = g_strdup (_("The username must 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 '_'"));
@@ -218,14 +218,14 @@ name_changed (GtkEntry *name_entry,
int nwords1, nwords2, i;
GHashTable *items;
- entry = gtk_bin_get_child (GTK_BIN (um->shortname_combo));
- model = gtk_combo_box_get_model (GTK_COMBO_BOX (um->shortname_combo));
+ entry = gtk_bin_get_child (GTK_BIN (um->username_combo));
+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (um->username_combo));
gtk_list_store_clear (GTK_LIST_STORE (model));
name = gtk_entry_get_text (GTK_ENTRY (name_entry));
um->valid_name = (strlen (name) > 0);
- gtk_widget_set_sensitive (um->ok_button, um->valid_name && um->valid_shortname);
+ gtk_widget_set_sensitive (um->ok_button, um->valid_name && um->valid_username);
if (!um->valid_name) {
gtk_entry_set_text (GTK_ENTRY (entry), "");
@@ -347,54 +347,54 @@ name_changed (GtkEntry *name_entry,
items = g_hash_table_new (g_str_hash, g_str_equal);
- in_use = is_shortname_used (item1->str);
+ in_use = is_username_used (item1->str);
if (nwords2 > 0 && !in_use && !g_ascii_isdigit (item1->str[0])) {
- gtk_combo_box_append_text (GTK_COMBO_BOX (um->shortname_combo), item1->str);
+ gtk_combo_box_append_text (GTK_COMBO_BOX (um->username_combo), item1->str);
g_hash_table_insert (items, item1->str, item1->str);
}
/* if there's only one word, would be the same as item1 */
if (nwords2 > 1) {
/* add other items */
- in_use = is_shortname_used (item2->str);
+ in_use = is_username_used (item2->str);
if (!in_use && !g_ascii_isdigit (item2->str[0]) &&
!g_hash_table_lookup (items, item2->str)) {
- gtk_combo_box_append_text (GTK_COMBO_BOX (um->shortname_combo), item2->str);
+ gtk_combo_box_append_text (GTK_COMBO_BOX (um->username_combo), item2->str);
g_hash_table_insert (items, item2->str, item2->str);
}
- in_use = is_shortname_used (item3->str);
+ in_use = is_username_used (item3->str);
if (!in_use && !g_ascii_isdigit (item3->str[0]) &&
!g_hash_table_lookup (items, item3->str)) {
- gtk_combo_box_append_text (GTK_COMBO_BOX (um->shortname_combo), item3->str);
+ gtk_combo_box_append_text (GTK_COMBO_BOX (um->username_combo), item3->str);
g_hash_table_insert (items, item3->str, item3->str);
}
- in_use = is_shortname_used (item4->str);
+ in_use = is_username_used (item4->str);
if (!in_use && !g_ascii_isdigit (item4->str[0]) &&
!g_hash_table_lookup (items, item4->str)) {
- gtk_combo_box_append_text (GTK_COMBO_BOX (um->shortname_combo), item4->str);
+ gtk_combo_box_append_text (GTK_COMBO_BOX (um->username_combo), item4->str);
g_hash_table_insert (items, item4->str, item4->str);
}
/* add the last word */
- in_use = is_shortname_used (last_word->str);
+ in_use = is_username_used (last_word->str);
if (!in_use && !g_ascii_isdigit (last_word->str[0]) &&
!g_hash_table_lookup (items, last_word->str)) {
- gtk_combo_box_append_text (GTK_COMBO_BOX (um->shortname_combo), last_word->str);
+ gtk_combo_box_append_text (GTK_COMBO_BOX (um->username_combo), last_word->str);
g_hash_table_insert (items, last_word->str, last_word->str);
}
/* ...and the first one */
- in_use = is_shortname_used (first_word->str);
+ in_use = is_username_used (first_word->str);
if (!in_use && !g_ascii_isdigit (first_word->str[0]) &&
!g_hash_table_lookup (items, first_word->str)) {
- gtk_combo_box_append_text (GTK_COMBO_BOX (um->shortname_combo), first_word->str);
+ gtk_combo_box_append_text (GTK_COMBO_BOX (um->username_combo), first_word->str);
g_hash_table_insert (items, first_word->str, first_word->str);
}
}
- gtk_combo_box_set_active (GTK_COMBO_BOX (um->shortname_combo), 0);
+ gtk_combo_box_set_active (GTK_COMBO_BOX (um->username_combo), 0);
g_hash_table_destroy (items);
g_strfreev (words1);
g_string_free (first_word, TRUE);
@@ -441,10 +441,10 @@ um_account_dialog_new (void)
G_CALLBACK (accept_account_dialog), um);
gtk_widget_grab_default (widget);
- widget = (GtkWidget *) gtk_builder_get_object (builder, "shortname-combo");
+ widget = (GtkWidget *) gtk_builder_get_object (builder, "username-combo");
g_signal_connect (widget, "changed",
- G_CALLBACK (shortname_changed), um);
- um->shortname_combo = widget;
+ G_CALLBACK (username_changed), um);
+ um->username_combo = widget;
widget = (GtkWidget *) gtk_builder_get_object (builder, "name-entry");
g_signal_connect (widget, "notify::text",
@@ -475,8 +475,8 @@ um_account_dialog_show (UmAccountDialog *um,
GtkTreeModel *model;
gtk_entry_set_text (GTK_ENTRY (um->name_entry), "");
- gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (um->shortname_combo))), "");
- model = gtk_combo_box_get_model (GTK_COMBO_BOX (um->shortname_combo));
+ gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (um->username_combo))), "");
+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (um->username_combo));
gtk_list_store_clear (GTK_LIST_STORE (model));
gtk_combo_box_set_active (GTK_COMBO_BOX (um->account_type_combo), 0);
@@ -484,7 +484,7 @@ um_account_dialog_show (UmAccountDialog *um,
gtk_window_present (GTK_WINDOW (um->dialog));
gtk_widget_grab_focus (um->name_entry);
- um->valid_name = um->valid_shortname = TRUE;
+ um->valid_name = um->valid_username = TRUE;
um->user_created_callback = user_created_callback;
um->user_created_data = user_created_data;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]