diff options
author | Dan Winship <danw@src.gnome.org> | 2000-10-03 04:16:53 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2000-10-03 04:16:53 +0800 |
commit | 3694d8a1359eee3ff5e834056130c02f08ae0f0b (patch) | |
tree | ce2daf82ec94fccfb4bb7a86d9ec012d592af896 | |
parent | 853d2b99ff4a6509cad65e893a84bb00bae4f669 (diff) | |
download | gsoc2013-evolution-3694d8a1359eee3ff5e834056130c02f08ae0f0b.tar.gz gsoc2013-evolution-3694d8a1359eee3ff5e834056130c02f08ae0f0b.tar.zst gsoc2013-evolution-3694d8a1359eee3ff5e834056130c02f08ae0f0b.zip |
Remove "Port" entry from source dialog. We'll use "host:port" like
* mail-config-gui.c: Remove "Port" entry from source dialog. We'll
use "host:port" like Netscape and other programs do.
(service_page_get_url): If host ends in ":###", use that as port.
(service_page_set_url): If URL contains a port, append it to the
hostname, separated by a colon.
svn path=/trunk/; revision=5670
-rw-r--r-- | mail/ChangeLog | 8 | ||||
-rw-r--r-- | mail/mail-config-gui.c | 92 |
2 files changed, 25 insertions, 75 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 90b3b125ea..6b2974772e 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,11 @@ +2000-10-02 Dan Winship <danw@helixcode.com> + + * mail-config-gui.c: Remove "Port" entry from source dialog. We'll + use "host:port" like Netscape and other programs do. + (service_page_get_url): If host ends in ":###", use that as port. + (service_page_set_url): If URL contains a port, append it to the + hostname, separated by a colon. + 2000-10-02 Chris Toshok <toshok@helixcode.com> * Makefile.am (evolution_mail_SOURCES): subscribe-control.[ch] -> subscribe_dialog.[ch] diff --git a/mail/mail-config-gui.c b/mail/mail-config-gui.c index 345300949c..67ad633771 100644 --- a/mail/mail-config-gui.c +++ b/mail/mail-config-gui.c @@ -76,7 +76,6 @@ typedef struct gboolean userneed; GtkWidget *host; gboolean hostneed; - GtkWidget *port; GtkWidget *path; gboolean pathneed; GtkWidget *auth_optionmenu; @@ -85,8 +84,6 @@ typedef struct GtkWidget *auth_detect; GtkWidget *keep_on_server; gint pnum; - gint default_port; - GtkWidget *use_default_port; } MailDialogServicePageItem; struct _MailDialogServicePage @@ -588,21 +585,15 @@ service_page_get_url (MailDialogServicePage *page) if (spitem->user) url->user = e_utf8_gtk_editable_get_chars (GTK_EDITABLE (spitem->user), 0, -1); - if (spitem->host) - url->host = e_utf8_gtk_editable_get_chars (GTK_EDITABLE (spitem->host), 0, -1); - if (spitem->port && !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (spitem->use_default_port))) { - gchar *val; - - val = e_utf8_gtk_editable_get_chars (GTK_EDITABLE (spitem->port), 0, -1); - - if (*val) - url->port = atoi (val); - else - url->port = 0; + if (spitem->host) { + char *p; - g_free (val); - } else { - url->port = 0; + url->host = e_utf8_gtk_editable_get_chars (GTK_EDITABLE (spitem->host), 0, -1); + p = strchr (url->host, ':'); + if (p) { + *p++ = '\0'; + url->port = atoi (p); + } } if (spitem->path) { @@ -661,24 +652,17 @@ service_page_set_url (MailDialogServicePage *page, MailConfigService *service) if (spitem->user && url && url->user) e_utf8_gtk_entry_set_text (GTK_ENTRY (spitem->user), url->user); - if (spitem->host && url && url->host) - e_utf8_gtk_entry_set_text (GTK_ENTRY (spitem->host), url->host); - - if (spitem->port) { - gchar *tmp; - - if (url && url->port) { - tmp = g_strdup_printf ("%d", url->port); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (spitem->use_default_port), - FALSE); - } else if (spitem->default_port) { - tmp = g_strdup_printf ("%d", spitem->default_port); + if (spitem->host && url && url->host) { + if (url->port) { + char *hostport; + hostport = g_strdup_printf ("%s:%d", url->host, + url->port); + e_utf8_gtk_entry_set_text (GTK_ENTRY (spitem->host), + hostport); } else { - tmp = g_strdup (""); + e_utf8_gtk_entry_set_text (GTK_ENTRY (spitem->host), + url->host); } - - e_utf8_gtk_entry_set_text (GTK_ENTRY (spitem->port), tmp); - g_free (tmp); } if (spitem->path && url && url->path) { @@ -879,18 +863,6 @@ service_page_add_elem (MailDialogServicePage *page, GtkWidget *table, return entry; } -static void -toggle_port (GtkWidget *w, gpointer user_data) -{ - MailDialogServicePage *page; - gboolean val; - - page = (MailDialogServicePage *) user_data; - - val = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w)); - gtk_widget_set_sensitive (page->spitem->port, val); -} - static MailDialogServicePageItem * service_page_item_new (MailDialogServicePage *page, MailService *mcs) { @@ -922,39 +894,9 @@ service_page_item_new (MailDialogServicePage *page, MailService *mcs) service_flags = mcs->service->url_flags & ~CAMEL_SERVICE_URL_NEED_AUTH; if (service_flags & CAMEL_SERVICE_URL_ALLOW_HOST) { - GtkWidget *w; - item->host = service_page_add_elem (page, table, row++, _("Server:")); item->hostneed = ((service_flags & CAMEL_SERVICE_URL_NEED_HOST) == CAMEL_SERVICE_URL_NEED_HOST); - - item->default_port = mcs->provider->default_ports[mcs->type]; - - w = gtk_label_new (_("Port:")); - gtk_table_attach (GTK_TABLE (table), w, 0, 1, - row, row + 1, GTK_FILL, 0, 0, 0); - gtk_misc_set_alignment (GTK_MISC (w), 1, 0.5); - - item->port = gtk_entry_new(); - gtk_table_attach (GTK_TABLE (table), item->port, - 1, 2, row, row + 1, - GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, - 0, 0); - gtk_signal_connect (GTK_OBJECT (item->port), "changed", - GTK_SIGNAL_FUNC (service_page_item_changed), page); - gtk_widget_set_sensitive (item->port, FALSE); - - item->use_default_port = gtk_check_button_new_with_label (_("Use default port")); - gtk_table_attach (GTK_TABLE (table), item->use_default_port, - 2, 3, row, row + 1, - GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, - 0, 0); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item->use_default_port), - TRUE); - gtk_signal_connect (GTK_OBJECT (item->use_default_port), "toggled", - GTK_SIGNAL_FUNC (toggle_port), - page); - row++; } if (service_flags & CAMEL_SERVICE_URL_ALLOW_USER) { |