aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2002-03-08 08:13:41 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2002-03-08 08:13:41 +0800
commita9791c82f0513cdeb607c94f8b73c8040dc16bf5 (patch)
treecdf68803d1bc1cb35dd1e2411c7e32f192b4b41b
parent6090a80c421cea55b1bc03194bcd505f9dd9bba3 (diff)
downloadgsoc2013-evolution-a9791c82f0513cdeb607c94f8b73c8040dc16bf5.tar
gsoc2013-evolution-a9791c82f0513cdeb607c94f8b73c8040dc16bf5.tar.gz
gsoc2013-evolution-a9791c82f0513cdeb607c94f8b73c8040dc16bf5.tar.bz2
gsoc2013-evolution-a9791c82f0513cdeb607c94f8b73c8040dc16bf5.tar.lz
gsoc2013-evolution-a9791c82f0513cdeb607c94f8b73c8040dc16bf5.tar.xz
gsoc2013-evolution-a9791c82f0513cdeb607c94f8b73c8040dc16bf5.tar.zst
gsoc2013-evolution-a9791c82f0513cdeb607c94f8b73c8040dc16bf5.zip
Re-focus the account name entry widget. (identity_prepare): If a name is
2002-03-07 Jeffrey Stedfast <fejj@ximian.com> * mail-config-druid.c (management_changed): Re-focus the account name entry widget. (identity_prepare): If a name is not set, try and get the user's full name for them and set the text on the entry widget. (management_prepare): If the account name is already taken, generate a unique one by appending " (%d)". svn path=/trunk/; revision=15986
-rw-r--r--mail/ChangeLog16
-rw-r--r--mail/mail-config-druid.c50
-rw-r--r--mail/mail-config.glade22
3 files changed, 73 insertions, 15 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index b94a636e53..9db70b38b5 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,12 @@
+2002-03-07 Jeffrey Stedfast <fejj@ximian.com>
+
+ * mail-config-druid.c (management_changed): Re-focus the account
+ name entry widget.
+ (identity_prepare): If a name is not set, try and get the user's
+ full name for them and set the text on the entry widget.
+ (management_prepare): If the account name is already taken,
+ generate a unique one by appending " (%d)".
+
2002-03-07 Radek Doulik <rodo@ximian.com>
* mail-account-gui.c (sig_new_html): make edit button sensitive
@@ -6,8 +15,11 @@
2002-03-07 Anna Marie Dirks <anna@ximian.com>
- * folder-browser.c: Made all the acclerators in the context menu on a message work. (There are 22 different menu items here, so picking a unique accelerator for each label was tricky, and some of the choices I made are different from the ones I would have made if there weren't so many stinking menu items.)
-
+ * folder-browser.c: Made all the acclerators in the context menu
+ on a message work. (There are 22 different menu items here, so
+ picking a unique accelerator for each label was tricky, and some
+ of the choices I made are different from the ones I would have
+ made if there weren't so many stinking menu items.)
2002-03-07 Jeffrey Stedfast <fejj@ximian.com>
diff --git a/mail/mail-config-druid.c b/mail/mail-config-druid.c
index 68c745debe..e43f0dfbf5 100644
--- a/mail/mail-config-druid.c
+++ b/mail/mail-config-druid.c
@@ -244,8 +244,16 @@ static void
identity_prepare (EvolutionWizard *wizard, gpointer data)
{
MailConfigWizard *gui = data;
+ const char *name;
gui->page = MAIL_CONFIG_WIZARD_PAGE_IDENTITY;
+
+ name = gtk_entry_get_text (gui->gui->full_name);
+ if (!name) {
+ name = g_get_real_name ();
+ gtk_entry_set_text (gui->gui->full_name, name ? name : "");
+ gtk_entry_select_region (gui->gui->full_name, 0, -1);
+ }
gtk_widget_grab_focus (GTK_WIDGET (gui->gui->full_name));
identity_changed (NULL, data);
}
@@ -382,15 +390,16 @@ static void
management_check (MailConfigWizard *wizard)
{
gboolean next_sensitive;
+ GtkWidget *label;
char *text;
-
+
text = gtk_entry_get_text (wizard->gui->account_name);
next_sensitive = text && *text;
-
+
/* no accounts with the same name */
if (next_sensitive && mail_config_get_account_by_name (text))
next_sensitive = FALSE;
-
+
evolution_wizard_set_buttons_sensitive (wizard->wizard, TRUE,
next_sensitive, TRUE, NULL);
}
@@ -399,12 +408,28 @@ static void
management_prepare (EvolutionWizard *wizard, gpointer data)
{
MailConfigWizard *gui = data;
- char *name;
+ const char *name;
gui->page = MAIL_CONFIG_WIZARD_PAGE_MANAGEMENT;
name = gtk_entry_get_text (gui->gui->email_address);
- if (name && *name)
+ if (name && *name) {
+ if (mail_config_get_account_by_name (name)) {
+ char *template, *p;
+ unsigned int i = 1;
+
+ /* length of name + 1 char for ' ' + 1 char
+ for '(' + 10 chars for %d + 1 char for ')'
+ + 1 char for nul */
+ template = alloca (strlen (name) + 14);
+ p = stpcpy (template, name);
+ name = template;
+ do {
+ sprintf (p, " (%d)", i++);
+ } while (mail_config_get_account_by_name (name) && i != 0);
+ }
+
gtk_entry_set_text (gui->gui->account_name, name);
+ }
management_check (gui);
}
@@ -413,10 +438,13 @@ static void
management_changed (GtkWidget *widget, gpointer data)
{
MailConfigWizard *gui = data;
-
+
if (gui->page != MAIL_CONFIG_WIZARD_PAGE_MANAGEMENT)
return;
+
management_check (gui);
+
+ gtk_widget_grab_focus (GTK_WIDGET (gui->gui->account_name));
}
static MailConfigAccount *
@@ -425,19 +453,19 @@ make_account (void)
MailConfigAccount *account;
char *name, *user;
struct utsname uts;
-
+
account = g_new0 (MailConfigAccount, 1);
-
+
account->id = g_new0 (MailConfigIdentity, 1);
name = g_get_real_name ();
account->id->name = e_utf8_from_locale_string (name);
- user = getenv ("USER");
+ user = g_get_user_name ();
if (user && !uname (&uts) && strchr (uts.nodename, '.'))
account->id->address = g_strdup_printf ("%s@%s", user, uts.nodename);
-
+
if (mail_config_get_default_transport ())
account->transport = service_copy (mail_config_get_default_transport ());
-
+
return account;
}
diff --git a/mail/mail-config.glade b/mail/mail-config.glade
index 5d87d490f6..e00f31e685 100644
--- a/mail/mail-config.glade
+++ b/mail/mail-config.glade
@@ -247,17 +247,35 @@ Click &quot;Finish&quot; to save your settings.</text>
<widget>
<class>GtkVBox</class>
- <name>vbox31</name>
+ <name>account_vbox</name>
<border_width>3</border_width>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<widget>
+ <class>GtkLabel</class>
+ <name>management_description_label</name>
+ <label>Type the name by which you would like to refer to this account.
+For example: &quot;Work&quot; or &quot;Personal&quot;</label>
+ <justify>GTK_JUSTIFY_LEFT</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>True</fill>
+ </child>
+ </widget>
+
+ <widget>
<class>GtkHBox</class>
<name>hbox24</name>
<border_width>3</border_width>
<homogeneous>False</homogeneous>
- <spacing>5</spacing>
+ <spacing>4</spacing>
<child>
<padding>0</padding>
<expand>False</expand>