aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2002-04-04 02:19:27 +0800
committerDan Winship <danw@src.gnome.org>2002-04-04 02:19:27 +0800
commit2ecd3ce0ee5b33a9f78b1808f363a9b20d78c4bd (patch)
tree2608ca9f222ab0e1947b4be0f569019bd84f4f3e /mail
parentdf281e27199559d0166142ef78c01d7a38d60964 (diff)
downloadgsoc2013-evolution-2ecd3ce0ee5b33a9f78b1808f363a9b20d78c4bd.tar.gz
gsoc2013-evolution-2ecd3ce0ee5b33a9f78b1808f363a9b20d78c4bd.tar.zst
gsoc2013-evolution-2ecd3ce0ee5b33a9f78b1808f363a9b20d78c4bd.zip
Changes to allow combined store/transport providers (like exchange and
* mail-account-gui.c: Changes to allow combined store/transport providers (like exchange and nntp). You can only select the transport if the account is also using that provider for the source. (source_type_changed): If changing away from a combined store/transport type, disable that provider on the transport page. If change to a combined store/transport type, enable and select that provider on the transport page. (mail_account_gui_setup): Do some additional bookkeeping here to make the above stuff work. (transport_type_changed): If the provider is a combined store/transport type, pretend it doesn't need any additional URL configuration. (mail_account_gui_transport_complete): if the transport provider is also a store provider, then as long as it matches the source for the account, it's considered complete. (mail_account_gui_save): If the selected transport is a combined store/transport provider, use the source page's information to fill in the transport url. * mail-local.c (mail_local_provider_init): Don't set up service_cache. svn path=/trunk/; revision=16331
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog25
-rw-r--r--mail/mail-account-gui.c83
-rw-r--r--mail/mail-local.c1
3 files changed, 94 insertions, 15 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 6bd057596f..1c925d358d 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,28 @@
+2002-04-03 Dan Winship <danw@ximian.com>
+
+ * mail-account-gui.c: Changes to allow combined store/transport
+ providers (like exchange and nntp). You can only select the
+ transport if the account is also using that provider for the
+ source.
+ (source_type_changed): If changing away from a combined
+ store/transport type, disable that provider on the transport page.
+ If change to a combined store/transport type, enable and select
+ that provider on the transport page.
+ (mail_account_gui_setup): Do some additional bookkeeping here to
+ make the above stuff work.
+ (transport_type_changed): If the provider is a combined
+ store/transport type, pretend it doesn't need any additional URL
+ configuration.
+ (mail_account_gui_transport_complete): if the transport provider
+ is also a store provider, then as long as it matches the source
+ for the account, it's considered complete.
+ (mail_account_gui_save): If the selected transport is a combined
+ store/transport provider, use the source page's information to
+ fill in the transport url.
+
+ * mail-local.c (mail_local_provider_init): Don't set up
+ service_cache.
+
2002-04-02 Jeffrey Stedfast <fejj@ximian.com>
* mail-callbacks.c (do_edit_messages): Pass the UID of the message
diff --git a/mail/mail-account-gui.c b/mail/mail-account-gui.c
index 39be507cca..f4d9927c6c 100644
--- a/mail/mail-account-gui.c
+++ b/mail/mail-account-gui.c
@@ -190,6 +190,17 @@ mail_account_gui_source_complete (MailAccountGui *gui, GtkWidget **incomplete)
gboolean
mail_account_gui_transport_complete (MailAccountGui *gui, GtkWidget **incomplete)
{
+ /* If it's both source and transport, there's nothing extra to
+ * configure on the transport page.
+ */
+ if (CAMEL_PROVIDER_IS_STORE_AND_TRANSPORT (gui->transport.provider)) {
+ if (gui->transport.provider == gui->source.provider)
+ return TRUE;
+ if (incomplete)
+ *incomplete = GTK_WIDGET (gui->transport.type);
+ return FALSE;
+ }
+
if (!service_complete (&gui->transport, incomplete))
return FALSE;
@@ -290,7 +301,27 @@ build_auth_menu (MailAccountGuiService *service, GList *all_authtypes,
if (first) {
gtk_option_menu_set_history (service->authtype, history);
- gtk_signal_emit_by_name (GTK_OBJECT (first), "activate", service);
+ gtk_signal_emit_by_name (GTK_OBJECT (first), "activate");
+ }
+}
+
+static void
+transport_provider_set_available (MailAccountGui *gui, CamelProvider *provider,
+ gboolean available)
+{
+ GtkWidget *menuitem;
+
+ menuitem = gtk_object_get_data (GTK_OBJECT (gui->transport.type),
+ provider->protocol);
+ g_return_if_fail (menuitem != NULL);
+ gtk_widget_set_sensitive (menuitem, available);
+
+ if (available) {
+ gpointer number = gtk_object_get_data (GTK_OBJECT (menuitem), "number");
+
+ gtk_signal_emit_by_name (GTK_OBJECT (menuitem), "activate");
+ gtk_option_menu_set_history (gui->transport.type,
+ GPOINTER_TO_UINT (number));
}
}
@@ -302,6 +333,13 @@ source_type_changed (GtkWidget *widget, gpointer user_data)
CamelProvider *provider;
provider = gtk_object_get_data (GTK_OBJECT (widget), "provider");
+
+ /* If the previously-selected provider has a linked transport,
+ * disable it.
+ */
+ if (gui->source.provider &&
+ CAMEL_PROVIDER_IS_STORE_AND_TRANSPORT (gui->source.provider))
+ transport_provider_set_available (gui, gui->source.provider, FALSE);
gui->source.provider = provider;
@@ -403,6 +441,10 @@ source_type_changed (GtkWidget *widget, gpointer user_data)
gtk_widget_grab_focus (dwidget);
mail_account_gui_build_extra_conf (gui, gui && gui->account && gui->account->source ? gui->account->source->url : NULL);
+
+ if (provider &&
+ CAMEL_PROVIDER_IS_STORE_AND_TRANSPORT (provider))
+ transport_provider_set_available (gui, provider, TRUE);
}
@@ -428,17 +470,15 @@ transport_type_changed (GtkWidget *widget, gpointer user_data)
provider = gtk_object_get_data (GTK_OBJECT (widget), "provider");
gui->transport.provider = provider;
-
+
/* description */
- if (provider)
- gtk_label_set_text (gui->transport.description, provider->description);
- else
- gtk_label_set_text (gui->transport.description, "");
+ gtk_label_set_text (gui->transport.description, provider->description);
frame = glade_xml_get_widget (gui->xml, "transport_frame");
- if (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_HOST) ||
- (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_AUTH) &&
- !CAMEL_PROVIDER_NEEDS (provider, CAMEL_URL_PART_AUTH))) {
+ if (!CAMEL_PROVIDER_IS_STORE_AND_TRANSPORT (provider) &&
+ (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_HOST) ||
+ (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_AUTH) &&
+ !CAMEL_PROVIDER_NEEDS (provider, CAMEL_URL_PART_AUTH)))) {
gtk_widget_show (frame);
label = glade_xml_get_widget (gui->xml, "transport_host_label");
@@ -473,7 +513,8 @@ transport_type_changed (GtkWidget *widget, gpointer user_data)
gtk_widget_hide (frame);
frame = glade_xml_get_widget (gui->xml, "transport_auth_frame");
- if (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_AUTH)) {
+ if (!CAMEL_PROVIDER_IS_STORE_AND_TRANSPORT (provider) &&
+ CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_AUTH)) {
gtk_widget_show (frame);
label = glade_xml_get_widget (gui->xml, "transport_user_label");
@@ -988,7 +1029,7 @@ construct_ssl_menu (MailAccountGuiService *service)
gtk_option_menu_set_menu (service->use_ssl, menu);
gtk_option_menu_set_history (service->use_ssl, i - 1);
- gtk_signal_emit_by_name (GTK_OBJECT (item), "activate", service);
+ gtk_signal_emit_by_name (GTK_OBJECT (item), "activate");
}
static void
@@ -1552,7 +1593,11 @@ mail_account_gui_setup (MailAccountGui *gui, GtkWidget *top)
item = NULL;
if (provider->object_types[CAMEL_PROVIDER_STORE] && provider->flags & CAMEL_PROVIDER_IS_SOURCE) {
item = gtk_menu_item_new_with_label (provider->name);
+ gtk_object_set_data (GTK_OBJECT (gui->source.type),
+ provider->protocol, item);
gtk_object_set_data (GTK_OBJECT (item), "provider", provider);
+ gtk_object_set_data (GTK_OBJECT (item), "number",
+ GUINT_TO_POINTER (si));
gtk_signal_connect (GTK_OBJECT (item), "activate",
GTK_SIGNAL_FUNC (source_type_changed),
gui);
@@ -1576,7 +1621,11 @@ mail_account_gui_setup (MailAccountGui *gui, GtkWidget *top)
if (provider->object_types[CAMEL_PROVIDER_TRANSPORT]) {
item = gtk_menu_item_new_with_label (provider->name);
+ gtk_object_set_data (GTK_OBJECT (gui->transport.type),
+ provider->protocol, item);
gtk_object_set_data (GTK_OBJECT (item), "provider", provider);
+ gtk_object_set_data (GTK_OBJECT (item), "number",
+ GUINT_TO_POINTER (ti));
gtk_signal_connect (GTK_OBJECT (item), "activate",
GTK_SIGNAL_FUNC (transport_type_changed),
gui);
@@ -1584,6 +1633,9 @@ mail_account_gui_setup (MailAccountGui *gui, GtkWidget *top)
gtk_menu_append (GTK_MENU (transports), item);
gtk_widget_show (item);
+
+ if (CAMEL_PROVIDER_IS_STORE_AND_TRANSPORT (provider))
+ gtk_widget_set_sensitive (item, FALSE);
if (!ftransport) {
ftransport = item;
@@ -1667,10 +1719,10 @@ mail_account_gui_setup (MailAccountGui *gui, GtkWidget *top)
}
if (fstore)
- gtk_signal_emit_by_name (GTK_OBJECT (fstore), "activate", gui);
+ gtk_signal_emit_by_name (GTK_OBJECT (fstore), "activate");
if (ftransport)
- gtk_signal_emit_by_name (GTK_OBJECT (ftransport), "activate", gui);
+ gtk_signal_emit_by_name (GTK_OBJECT (ftransport), "activate");
if (source_proto) {
setup_service (&gui->source, gui->account->source);
@@ -1824,7 +1876,10 @@ mail_account_gui_save (MailAccountGui *gui)
service_destroy (account->transport);
account->transport = g_new0 (MailConfigService, 1);
- save_service (&gui->transport, NULL, account->transport);
+ if (CAMEL_PROVIDER_IS_STORE_AND_TRANSPORT (gui->transport.provider))
+ save_service (&gui->source, gui->extra_config, account->transport);
+ else
+ save_service (&gui->transport, NULL, account->transport);
/* Check to make sure that the Drafts folder uri is "valid" before assigning it */
url = source_url && gui->drafts_folder.uri ? camel_url_new (gui->drafts_folder.uri, NULL) : NULL;
diff --git a/mail/mail-local.c b/mail/mail-local.c
index b072f90795..1493866ba5 100644
--- a/mail/mail-local.c
+++ b/mail/mail-local.c
@@ -1091,7 +1091,6 @@ mail_local_provider_init (void)
/* Register with Camel to handle file: URLs */
local_provider.object_types[CAMEL_PROVIDER_STORE] = MAIL_LOCAL_STORE_TYPE;
- local_provider.service_cache = g_hash_table_new (non_hash, non_equal);
local_provider.url_hash = non_hash;
local_provider.url_equal = non_equal;
camel_session_register_provider (session, &local_provider);