diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2001-01-23 10:47:57 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2001-01-23 10:47:57 +0800 |
commit | 096f54cfa0d3ec4916c3c27038ce2d609b5edbd0 (patch) | |
tree | b53cf29d10710aeff31ba9b0a4739c0ed6994082 /mail/mail-config-druid.c | |
parent | ce15b4480fcf7cb0cb2b7d8257d4d548ab5fdbe2 (diff) | |
download | gsoc2013-evolution-096f54cfa0d3ec4916c3c27038ce2d609b5edbd0.tar.gz gsoc2013-evolution-096f54cfa0d3ec4916c3c27038ce2d609b5edbd0.tar.zst gsoc2013-evolution-096f54cfa0d3ec4916c3c27038ce2d609b5edbd0.zip |
Automagically fill in the user's default transport if he/she has setup
2001-01-22 Jeffrey Stedfast <fejj@ximian.com>
* mail-config-druid.c (set_defaults): Automagically fill in the
user's default transport if he/she has setup previous accounts.
svn path=/trunk/; revision=7736
Diffstat (limited to 'mail/mail-config-druid.c')
-rw-r--r-- | mail/mail-config-druid.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/mail/mail-config-druid.c b/mail/mail-config-druid.c index a7c947a026..954dafe4be 100644 --- a/mail/mail-config-druid.c +++ b/mail/mail-config-druid.c @@ -768,12 +768,14 @@ provider_compare (const CamelProvider *p1, const CamelProvider *p2) static void set_defaults (MailConfigDruid *druid) { + const MailConfigService *default_xport; GtkWidget *stores, *transports, *item; GtkWidget *fstore = NULL, *ftransport = NULL; int si = 0, hstore = 0, ti = 0, htransport = 0; char *user, *realname; char hostname[1024]; char domain[1024]; + CamelURL *url; GList *l; /* set the default Name field */ @@ -801,6 +803,13 @@ set_defaults (MailConfigDruid *druid) transports = gtk_menu_new (); druid->providers = camel_session_list_providers (session, TRUE); + /* get the default transport */ + default_xport = mail_config_get_default_transport (); + if (default_xport && default_xport->url) + url = camel_url_new (default_xport->url, NULL); + else + url = NULL; + /* sort the providers, remote first */ druid->providers = g_list_sort (druid->providers, (GCompareFunc) provider_compare); @@ -848,6 +857,11 @@ set_defaults (MailConfigDruid *druid) htransport = ti; } + if (url && !g_strcasecmp (provider->protocol, url->protocol)) { + ftransport = item; + htransport = ti; + } + ti++; } @@ -884,6 +898,21 @@ set_defaults (MailConfigDruid *druid) if (ftransport) gtk_signal_emit_by_name (GTK_OBJECT (ftransport), "activate", druid); + + if (url) { + if (url->host) { + char *hostname; + + if (url->port) + hostname = g_strdup_printf ("%s:%d", url->host, url->port); + else + hostname = g_strdup (url->host); + + gtk_entry_set_text (druid->outgoing_hostname, hostname); + g_free (hostname); + } + camel_url_free (url); + } } static gboolean |