From 439bc7a3ec18635897c63d572e46288775fd5594 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Mon, 9 Jul 2001 23:55:02 +0000 Subject: Handle application/pgp using the text/plain handler. 2001-07-09 Jeffrey Stedfast * mail-format.c (setup_mime_tables): Handle application/pgp using the text/plain handler. * mail-account-gui.c (get_sensitive_widget): New function to determine which widget is focused. * mail-account-editor.c (apply_changes): Not only flip to the notebook page that wasn't finished, but also grab the focus of the incomplete widget. * mail-config-druid.c (source_changed): Grab the focus of the incomplete widget. (transport_prepare): And here. (identity_changed): Here too. * mail-account-gui.c (mail_account_gui_identity_complete): Take an incomplete argument so we can set which widget is incomplete and then the caller can focus it or whatever. (service_complete): Same. (mail_account_gui_transport_complete): And again here. (mail_account_gui_management_complete): And here too. svn path=/trunk/; revision=10939 --- mail/ChangeLog | 24 +++++++ mail/mail-account-editor.c | 10 +-- mail/mail-account-gui.c | 156 ++++++++++++++++++++++++++++++++------------- mail/mail-account-gui.h | 8 +-- mail/mail-config-druid.c | 82 ++++++++++++++---------- mail/mail-format.c | 20 ++++-- 6 files changed, 207 insertions(+), 93 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index 6d9cec5276..bf5971477c 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,27 @@ +2001-07-09 Jeffrey Stedfast + + * mail-format.c (setup_mime_tables): Handle application/pgp using + the text/plain handler. + + * mail-account-gui.c (get_sensitive_widget): New function to determine + which widget is focused. + + * mail-account-editor.c (apply_changes): Not only flip to the + notebook page that wasn't finished, but also grab the focus of the + incomplete widget. + + * mail-config-druid.c (source_changed): Grab the focus of the + incomplete widget. + (transport_prepare): And here. + (identity_changed): Here too. + + * mail-account-gui.c (mail_account_gui_identity_complete): Take an + incomplete argument so we can set which widget is incomplete and + then the caller can focus it or whatever. + (service_complete): Same. + (mail_account_gui_transport_complete): And again here. + (mail_account_gui_management_complete): And here too. + 2001-07-09 Jeffrey Stedfast * mail-format.c (decode_pgp): Update to pass in the `remember' diff --git a/mail/mail-account-editor.c b/mail/mail-account-editor.c index fa706b5e0d..f5084270d3 100644 --- a/mail/mail-account-editor.c +++ b/mail/mail-account-editor.c @@ -90,18 +90,20 @@ static gboolean apply_changes (MailAccountEditor *editor) { MailConfigAccount *account; + GtkWidget *incomplete; int page = -1; - if (!mail_account_gui_identity_complete (editor->gui) || - !mail_account_gui_management_complete (editor->gui)) + if (!mail_account_gui_identity_complete (editor->gui, &incomplete) || + !mail_account_gui_management_complete (editor->gui, &incomplete)) page = 0; - else if (!mail_account_gui_source_complete (editor->gui)) + else if (!mail_account_gui_source_complete (editor->gui, &incomplete)) page = 1; - else if (!mail_account_gui_transport_complete (editor->gui)) + else if (!mail_account_gui_transport_complete (editor->gui, &incomplete)) page = 3; if (page != -1) { gtk_notebook_set_page (editor->notebook, page); + gtk_widget_grab_focus (incomplete); e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, _("You have not filled in all of the required information.")); return FALSE; } diff --git a/mail/mail-account-gui.c b/mail/mail-account-gui.c index 8245518bf6..c922ff0f93 100644 --- a/mail/mail-account-gui.c +++ b/mail/mail-account-gui.c @@ -27,6 +27,7 @@ #endif #include +#include #include #include @@ -60,23 +61,58 @@ is_email (const char *address) return strchr (hname, '.') != NULL; } +static GtkWidget * +get_sensitive_widget (GtkWidget *def, ...) +{ + GtkWidget *widget, *ret = NULL; + va_list args; + + va_start (args, def); + widget = va_arg (args, GtkWidget *); + while (widget) { + if (GTK_WIDGET_HAS_FOCUS (widget)) { + ret = widget; + break; + } + + widget = va_arg (args, GtkWidget *); + } + va_end (ap); + + if (ret) + return ret; + else + return def; +} + gboolean -mail_account_gui_identity_complete (MailAccountGui *gui) +mail_account_gui_identity_complete (MailAccountGui *gui, GtkWidget **incomplete) { char *text; text = gtk_entry_get_text (gui->full_name); - if (!text || !*text) + if (!text || !*text) { + if (incomplete) + *incomplete = get_sensitive_widget (GTK_WIDGET (gui->full_name), + GTK_WIDGET (gui->email_address), + NULL); return FALSE; + } + text = gtk_entry_get_text (gui->email_address); - if (!text || !is_email (text)) + if (!text || !is_email (text)) { + if (incomplete) + *incomplete = get_sensitive_widget (GTK_WIDGET (gui->email_address), + GTK_WIDGET (gui->full_name), + NULL); return FALSE; + } return TRUE; } static gboolean -service_complete (MailAccountGuiService *service) +service_complete (MailAccountGuiService *service, GtkWidget **incomplete) { const CamelProvider *prov = service->provider; char *text; @@ -86,35 +122,53 @@ service_complete (MailAccountGuiService *service) if (CAMEL_PROVIDER_NEEDS (prov, CAMEL_URL_PART_HOST)) { text = gtk_entry_get_text (service->hostname); - if (!text || !*text) + if (!text || !*text) { + if (incomplete) + *incomplete = get_sensitive_widget (GTK_WIDGET (service->hostname), + GTK_WIDGET (service->username), + GTK_WIDGET (service->path), + NULL); return FALSE; + } } if (CAMEL_PROVIDER_NEEDS (prov, CAMEL_URL_PART_USER)) { text = gtk_entry_get_text (service->username); - if (!text || !*text) + if (!text || !*text) { + if (incomplete) + *incomplete = get_sensitive_widget (GTK_WIDGET (service->username), + GTK_WIDGET (service->path), + GTK_WIDGET (service->hostname), + NULL); return FALSE; + } } if (CAMEL_PROVIDER_NEEDS (prov, CAMEL_URL_PART_PATH)) { text = gtk_entry_get_text (service->path); - if (!text || !*text) + if (!text || !*text) { + if (incomplete) + *incomplete = get_sensitive_widget (GTK_WIDGET (service->path), + GTK_WIDGET (service->hostname), + GTK_WIDGET (service->username), + NULL); return FALSE; + } } return TRUE; } gboolean -mail_account_gui_source_complete (MailAccountGui *gui) +mail_account_gui_source_complete (MailAccountGui *gui, GtkWidget **incomplete) { - return service_complete (&gui->source); + return service_complete (&gui->source, incomplete); } gboolean -mail_account_gui_transport_complete (MailAccountGui *gui) +mail_account_gui_transport_complete (MailAccountGui *gui, GtkWidget **incomplete) { - if (!service_complete (&gui->transport)) + if (!service_complete (&gui->transport, incomplete)) return FALSE; /* FIXME? */ @@ -122,20 +176,31 @@ mail_account_gui_transport_complete (MailAccountGui *gui) CAMEL_PROVIDER_ALLOWS (gui->transport.provider, CAMEL_URL_PART_USER)) { char *text = gtk_entry_get_text (gui->transport.username); - if (!text || !*text) + if (!text || !*text) { + if (incomplete) + *incomplete = get_sensitive_widget (GTK_WIDGET (gui->transport.username), + GTK_WIDGET (gui->transport.hostname), + NULL); return FALSE; + } } return TRUE; } gboolean -mail_account_gui_management_complete (MailAccountGui *gui) +mail_account_gui_management_complete (MailAccountGui *gui, GtkWidget **incomplete) { char *text; text = gtk_entry_get_text (gui->account_name); - return text && *text; + if (text && *text) + return TRUE; + + if (incomplete) + *incomplete = GTK_WIDGET (gui->account_name); + + return FALSE; } @@ -174,7 +239,7 @@ build_auth_menu (MailAccountGuiService *service, gtk_widget_set_sensitive (item, FALSE); else if (!first) first = item; - + gtk_object_set_data (GTK_OBJECT (item), "authtype", authtype); gtk_signal_connect (GTK_OBJECT (item), "activate", service_authtype_changed, service); @@ -376,7 +441,7 @@ service_changed (GtkEntry *entry, gpointer user_data) MailAccountGuiService *service = user_data; gtk_widget_set_sensitive (GTK_WIDGET (service->check_supported), - service_complete (service)); + service_complete (service, NULL)); } static void @@ -901,7 +966,7 @@ do_exit (ESignatureEditor *editor) gnome_dialog_set_parent (GNOME_DIALOG (dialog), GTK_WINDOW (editor->win)); gnome_dialog_set_default (GNOME_DIALOG (dialog), 0); button = gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); - + exit_dialog_cb (button, editor); } else destroy_editor (editor); @@ -911,7 +976,7 @@ static void menu_file_close_cb (BonoboUIComponent *uic, gpointer data, const gchar *path) { ESignatureEditor *editor; - + editor = E_SIGNATURE_EDITOR (data); do_exit (editor); } @@ -920,7 +985,7 @@ static BonoboUIVerb verbs [] = { BONOBO_UI_VERB ("FileSave", menu_file_save_cb), BONOBO_UI_VERB ("FileClose", menu_file_close_cb), - + BONOBO_UI_VERB_END }; @@ -928,10 +993,10 @@ static void load_signature (ESignatureEditor *editor) { CORBA_Environment ev; - + if (editor->html) { Bonobo_PersistFile pfile_iface; - + pfile_iface = bonobo_object_client_query_interface (bonobo_widget_get_server (BONOBO_WIDGET (editor->control)), "IDL:Bonobo/PersistFile:1.0", NULL); CORBA_exception_init (&ev); @@ -941,29 +1006,29 @@ load_signature (ESignatureEditor *editor) Bonobo_PersistStream pstream_iface; BonoboStream *stream; gchar *data, *html; - + data = e_msg_composer_get_sig_file_content (editor->filename, FALSE); html = g_strdup_printf ("
\n%s", data);
 		g_free (data);
-
+		
 		pstream_iface = bonobo_object_client_query_interface
 			(bonobo_widget_get_server (BONOBO_WIDGET (editor->control)),
 			 "IDL:Bonobo/PersistStream:1.0", NULL);
 		CORBA_exception_init (&ev);
 		stream = bonobo_stream_mem_create (html, strlen (html), TRUE, FALSE);
-
+		
 		if (stream == NULL) {
 			g_warning ("Couldn't create memory stream\n");
 		} else {
 			BonoboObject *stream_object;
 			Bonobo_Stream corba_stream;
-
+			
 			stream_object = BONOBO_OBJECT (stream);
 			corba_stream = bonobo_object_corba_objref (stream_object);
 			Bonobo_PersistStream_load (pstream_iface, corba_stream,
 						   "text/html", &ev);
 		}
-
+		
 		Bonobo_Unknown_unref (pstream_iface, &ev);
 		CORBA_Object_release (pstream_iface, &ev);
 		CORBA_exception_free (&ev);
@@ -980,15 +1045,15 @@ launch_signature_editor (MailAccountGui *gui, const gchar *filename, gboolean ht
 	BonoboUIComponent *component;
 	BonoboUIContainer *container;
 	gchar *title;
-
+	
 	if (!filename || !*filename)
 		return;
-
+	
 	editor = g_new0 (ESignatureEditor, 1);
-
+	
 	editor->html     = html;
 	editor->filename = g_strdup (filename);
-
+	
 	title       = g_strdup_printf ("Edit %ssignature (%s)", html ? "HTML " : "", filename);
 	editor->win = bonobo_window_new ("e-sig-editor", title);
 	editor->gui = gui;
@@ -996,27 +1061,27 @@ launch_signature_editor (MailAccountGui *gui, const gchar *filename, gboolean ht
 	gtk_window_set_policy (GTK_WINDOW (editor->win), FALSE, TRUE, FALSE);
 	gtk_window_set_modal (GTK_WINDOW (editor->win), TRUE);
 	g_free (title);
-
+	
 	container = bonobo_ui_container_new ();
 	bonobo_ui_container_set_win (container, BONOBO_WINDOW (editor->win));
-
+	
 	component = bonobo_ui_component_new ("evolution-signature-editor");
 	bonobo_ui_component_set_container (component, bonobo_object_corba_objref (BONOBO_OBJECT (container)));
 	bonobo_ui_component_add_verb_list_with_data (component, verbs, editor);
 	bonobo_ui_util_set_ui (component, EVOLUTION_DATADIR, "evolution-signature-editor.xml", "evolution-signature-editor");
-
+	
 	editor->control = bonobo_widget_new_control ("OAFIID:GNOME_GtkHTML_Editor",
 						     bonobo_ui_component_get_container (component));
-
+	
 	if (editor->control == NULL) {
 		g_warning ("Cannot get 'OAFIID:GNOME_GtkHTML_Editor'.");
-
+		
 		destroy_editor (editor);
 		return;
 	}
-
+	
 	load_signature (editor);
-
+	
 	bonobo_window_set_contents (BONOBO_WINDOW (editor->win), editor->control);
 	bonobo_widget_set_property (BONOBO_WIDGET (editor->control), "FormatHTML", html, NULL);
 	gtk_widget_show (GTK_WIDGET (editor->win));
@@ -1077,13 +1142,13 @@ mail_account_gui_new (MailConfigAccount *account)
 	gnome_file_entry_set_default_path (gui->html_signature, g_get_home_dir ());
 	gui->edit_signature = GTK_BUTTON (glade_xml_get_widget (gui->xml, "button_edit_signature"));
 	gui->edit_html_signature = GTK_BUTTON (glade_xml_get_widget (gui->xml, "button_edit_html_signature"));
-
+	
 	gtk_signal_connect (GTK_OBJECT (gnome_file_entry_gtk_entry (gui->signature)), "changed", signature_changed, gui);
 	gtk_signal_connect (GTK_OBJECT (gnome_file_entry_gtk_entry (gui->html_signature)), "changed",
 			    html_signature_changed, gui);
 	gtk_signal_connect (GTK_OBJECT (gui->edit_signature), "clicked", edit_signature, gui);
 	gtk_signal_connect (GTK_OBJECT (gui->edit_html_signature), "clicked", edit_html_signature, gui);
-
+	
 	if (account->id) {
 		if (account->id->name)
 			e_utf8_gtk_entry_set_text (gui->full_name, account->id->name);
@@ -1103,7 +1168,7 @@ mail_account_gui_new (MailConfigAccount *account)
 		}
 		gtk_toggle_button_set_active (gui->has_html_signature, account->id->has_html_signature);
 	}
-
+	
 	/* Source */
 	gui->source.type = GTK_OPTION_MENU (glade_xml_get_widget (gui->xml, "source_type_omenu"));
 	gui->source.hostname = GTK_ENTRY (glade_xml_get_widget (gui->xml, "source_host"));
@@ -1456,10 +1521,10 @@ mail_account_gui_save (MailAccountGui *gui)
 	MailConfigAccount *account = gui->account;
 	gboolean old_enabled;
 	
-	if (!mail_account_gui_identity_complete (gui) ||
-	    !mail_account_gui_source_complete (gui) ||
-	    !mail_account_gui_transport_complete (gui) ||
-	    !mail_account_gui_management_complete (gui))
+	if (!mail_account_gui_identity_complete (gui, NULL) ||
+	    !mail_account_gui_source_complete (gui, NULL) ||
+	    !mail_account_gui_transport_complete (gui, NULL) ||
+	    !mail_account_gui_management_complete (gui, NULL))
 		return FALSE;
 	
 	g_free (account->name);
@@ -1475,7 +1540,7 @@ mail_account_gui_save (MailAccountGui *gui)
 	account->id->signature = gnome_file_entry_get_full_path (gui->signature, TRUE);
 	account->id->html_signature = gnome_file_entry_get_full_path (gui->html_signature, TRUE);
 	account->id->has_html_signature = gtk_toggle_button_get_active (gui->has_html_signature);
-
+	
 	old_enabled = account->source && account->source->enabled;
 	service_destroy (account->source);
 	account->source = g_new0 (MailConfigService, 1);
@@ -1521,4 +1586,3 @@ mail_account_gui_destroy (MailAccountGui *gui)
 	g_free (gui->sent_folder.uri);
 	g_free (gui);
 }
-
diff --git a/mail/mail-account-gui.h b/mail/mail-account-gui.h
index 1a6086c3d2..606d716175 100644
--- a/mail/mail-account-gui.h
+++ b/mail/mail-account-gui.h
@@ -106,10 +106,10 @@ void mail_account_gui_setup (MailAccountGui *gui, GtkWidget *top);
 gboolean mail_account_gui_save (MailAccountGui *gui);
 void mail_account_gui_destroy (MailAccountGui *gui);
 
-gboolean mail_account_gui_identity_complete (MailAccountGui *gui);
-gboolean mail_account_gui_source_complete (MailAccountGui *gui);
-gboolean mail_account_gui_transport_complete (MailAccountGui *gui);
-gboolean mail_account_gui_management_complete (MailAccountGui *gui);
+gboolean mail_account_gui_identity_complete (MailAccountGui *gui, GtkWidget **incomplete);
+gboolean mail_account_gui_source_complete (MailAccountGui *gui, GtkWidget **incomplete);
+gboolean mail_account_gui_transport_complete (MailAccountGui *gui, GtkWidget **incomplete);
+gboolean mail_account_gui_management_complete (MailAccountGui *gui, GtkWidget **incomplete);
 
 void mail_account_gui_build_extra_conf (MailAccountGui *gui, const char *url);
 
diff --git a/mail/mail-config-druid.c b/mail/mail-config-druid.c
index 7f716ef341..018b220b61 100644
--- a/mail/mail-config-druid.c
+++ b/mail/mail-config-druid.c
@@ -51,7 +51,7 @@ GtkType
 mail_config_druid_get_type (void)
 {
 	static GtkType type = 0;
-
+	
 	if (!type) {
 		GtkTypeInfo type_info = {
 			"MailConfigDruid",
@@ -62,10 +62,10 @@ mail_config_druid_get_type (void)
 			(GtkArgSetFunc) NULL,
 			(GtkArgGetFunc) NULL
 		};
-
+		
 		type = gtk_type_unique (gtk_window_get_type (), &type_info);
 	}
-
+	
 	return type;
 }
 
@@ -73,10 +73,10 @@ static void
 mail_config_druid_class_init (MailConfigDruidClass *class)
 {
 	GtkObjectClass *object_class;
-
+	
 	object_class = (GtkObjectClass *) class;
 	parent_class = gtk_type_class (gtk_window_get_type ());
-
+	
 	/* override methods */
 	object_class->finalize = mail_config_druid_finalize;
 }
@@ -85,7 +85,7 @@ static void
 mail_config_druid_finalize (GtkObject *obj)
 {
 	MailConfigDruid *druid = (MailConfigDruid *) obj;
-
+	
 	mail_account_gui_destroy (druid->gui);
         ((GtkObjectClass *)(parent_class))->finalize (obj);
 }
@@ -122,7 +122,7 @@ create_html (const char *name)
 	GtkStyle *style;
 	char *utf8;
 	int i;
-
+	
 	html = gtk_html_new ();
 	GTK_LAYOUT (html)->height = 0;
 	gtk_signal_connect (GTK_OBJECT (html), "size_request",
@@ -136,19 +136,19 @@ create_html (const char *name)
 						       &style->bg[0]);
 	}
 	gtk_widget_show (html);
-
+	
 	scrolled = gtk_scrolled_window_new (NULL, NULL);
 	gtk_widget_show (scrolled);
 	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
 					GTK_POLICY_NEVER, GTK_POLICY_NEVER);
 	gtk_container_add (GTK_CONTAINER (scrolled), html);
-
+	
 	for (i = 0; i < num_info; i++) {
 		if (!strcmp (name, info[i].name))
 			break;
 	}
 	g_return_val_if_fail (i != num_info, scrolled);
-
+	
 	stream = gtk_html_begin_content (GTK_HTML (html),
 					 "text/html; charset=utf-8");
 	gtk_html_write (GTK_HTML (html), stream, "

", 9); @@ -157,7 +157,7 @@ create_html (const char *name) g_free (utf8); gtk_html_write (GTK_HTML (html), stream, "

", 11); gtk_html_end (GTK_HTML (html), stream, GTK_HTML_STREAM_OK); - + return scrolled; } @@ -166,7 +166,7 @@ druid_cancel (GnomeDruid *druid, gpointer user_data) { /* Cancel the setup of the account */ MailConfigDruid *config = user_data; - + gtk_widget_destroy (GTK_WIDGET (config)); } @@ -177,17 +177,17 @@ druid_finish (GnomeDruidPage *page, gpointer arg1, gpointer user_data) MailConfigDruid *druid = user_data; MailAccountGui *gui = druid->gui; GSList *mini; - + mail_account_gui_save (gui); if (gui->account->source) gui->account->source->enabled = TRUE; mail_config_add_account (gui->account); mail_config_write (); - + mini = g_slist_prepend (NULL, gui->account); mail_load_storages (druid->shell, mini, TRUE); g_slist_free (mini); - + gtk_widget_destroy (GTK_WIDGET (druid)); } @@ -196,16 +196,22 @@ static void identity_changed (GtkWidget *widget, gpointer data) { MailConfigDruid *druid = data; - gboolean next_sensitive = mail_account_gui_identity_complete (druid->gui); - + GtkWidget *incomplete; + gboolean next_sensitive; + + next_sensitive = mail_account_gui_identity_complete (druid->gui, &incomplete); + gnome_druid_set_buttons_sensitive (druid->druid, TRUE, next_sensitive, TRUE); + + if (!next_sensitive) + gtk_widget_grab_focus (incomplete); } static void identity_prepare (GnomeDruidPage *page, GnomeDruid *druid, gpointer data) { MailConfigDruid *config = data; - + gtk_widget_grab_focus (GTK_WIDGET (config->gui->full_name)); identity_changed (NULL, config); } @@ -214,10 +220,10 @@ static gboolean identity_next (GnomeDruidPage *page, GnomeDruid *druid, gpointer data) { MailConfigDruid *config = data; - + if (!config->identity_copied) { char *username; - + /* Copy the username part of the email address into * the Username field of the source and transport pages. */ @@ -226,10 +232,10 @@ identity_next (GnomeDruidPage *page, GnomeDruid *druid, gpointer data) gtk_entry_set_text (config->gui->source.username, username); gtk_entry_set_text (config->gui->transport.username, username); g_free (username); - + config->identity_copied = TRUE; } - + return FALSE; } @@ -238,16 +244,22 @@ static void source_changed (GtkWidget *widget, gpointer data) { MailConfigDruid *druid = data; - gboolean next_sensitive = mail_account_gui_source_complete (druid->gui); - + GtkWidget *incomplete; + gboolean next_sensitive; + + next_sensitive = mail_account_gui_source_complete (druid->gui, &incomplete); + gnome_druid_set_buttons_sensitive (druid->druid, TRUE, next_sensitive, TRUE); + + if (!next_sensitive) + gtk_widget_grab_focus (incomplete); } static void source_prepare (GnomeDruidPage *page, GnomeDruid *druid, gpointer data) { MailConfigDruid *config = data; - + source_changed (NULL, config); } @@ -256,16 +268,16 @@ source_next (GnomeDruidPage *page, GnomeDruid *druid, gpointer data) { MailConfigDruid *config = data; GtkWidget *transport_page; - + /* FIXME: if online, check that the data is good. */ - + if (config->gui->source.provider && config->gui->source.provider->extra_conf) return FALSE; - + /* Otherwise, skip to transport page. */ transport_page = glade_xml_get_widget (config->gui->xml, "transport_page"); gnome_druid_set_page (config->druid, GNOME_DRUID_PAGE (transport_page)); - + return TRUE; } @@ -274,7 +286,7 @@ static void extra_prepare (GnomeDruidPage *page, GnomeDruid *druid, gpointer data) { MailConfigDruid *config = data; - + if (config->gui->source.provider != config->last_source) { config->last_source = config->gui->source.provider; mail_account_gui_build_extra_conf (config->gui, NULL); @@ -286,9 +298,15 @@ static void transport_prepare (GnomeDruidPage *page, GnomeDruid *druid, gpointer data) { MailConfigDruid *config = data; - gboolean next_sensitive = mail_account_gui_transport_complete (config->gui); - + GtkWidget *incomplete; + gboolean next_sensitive; + + next_sensitive = mail_account_gui_transport_complete (config->gui, &incomplete); + gnome_druid_set_buttons_sensitive (config->druid, TRUE, next_sensitive, TRUE); + + if (!next_sensitive) + gtk_widget_grab_focus (incomplete); } static gboolean diff --git a/mail/mail-format.c b/mail/mail-format.c index 7dcbc978cb..fb0218659c 100644 --- a/mail/mail-format.c +++ b/mail/mail-format.c @@ -273,7 +273,7 @@ setup_mime_tables (void) { mime_handler_table = g_hash_table_new (g_str_hash, g_str_equal); mime_function_table = g_hash_table_new (g_str_hash, g_str_equal); - + g_hash_table_insert (mime_function_table, "text/plain", handle_text_plain); g_hash_table_insert (mime_function_table, "text/richtext", @@ -282,7 +282,7 @@ setup_mime_tables (void) handle_text_enriched); g_hash_table_insert (mime_function_table, "text/html", handle_text_html); - + g_hash_table_insert (mime_function_table, "image/gif", handle_image); g_hash_table_insert (mime_function_table, "image/jpeg", @@ -311,14 +311,14 @@ setup_mime_tables (void) handle_image); g_hash_table_insert (mime_function_table, "image/x-xpixmap", handle_image); - + g_hash_table_insert (mime_function_table, "message/rfc822", handle_message_rfc822); g_hash_table_insert (mime_function_table, "message/news", handle_message_rfc822); g_hash_table_insert (mime_function_table, "message/external-body", handle_message_external_body); - + g_hash_table_insert (mime_function_table, "multipart/alternative", handle_multipart_alternative); g_hash_table_insert (mime_function_table, "multipart/related", @@ -331,11 +331,17 @@ setup_mime_tables (void) handle_multipart_encrypted); g_hash_table_insert (mime_function_table, "multipart/signed", handle_multipart_signed); - + + /* Some broken mailers, such as The Bat! send pgp + * signed/encrypted messages with a content-type of + * application/pgp which basically means it's a text/plain but + * either signed or encrypted. */ + g_hash_table_insert (mime_function_table, "application/pgp", + handle_text_plain); + /* RFC 2046 says unrecognized text subtypes can be treated * as text/plain (as long as you recognize the character set), - * and unrecognized multipart subtypes as multipart/mixed. - */ + * and unrecognized multipart subtypes as multipart/mixed. */ g_hash_table_insert (mime_function_table, "text/*", handle_text_plain); g_hash_table_insert (mime_function_table, "multipart/*", -- cgit