Index: mail/ChangeLog
===================================================================
--- mail/ChangeLog	(revision 33603)
+++ mail/ChangeLog	(working copy)
@@ -1,3 +1,14 @@
+2007-05-30  Milan Crha  <mcrha@redhat.com>
+
+	** Fix for bug #352346
+	
+	* mail-config.glade: Applying partial
+	of Matthew Barnes' patch from bug #383842. (component width)
+	
+	* em-account-editor.c: (emae_setup_service):
+	GtkFileChooser will choose file or folder based on provider's url_flags 
+	flag CAMEL_URL_NEED_PATH_FILE.
+
 2007-05-28  Jules Colding  <colding@omesc.com>
 
 	* em-utils.c (em_utils_selection_set_urilist): Fix file leak
Index: mail/mail-config.glade
===================================================================
--- mail/mail-config.glade	(revision 33603)
+++ mail/mail-config.glade	(working copy)
@@ -1354,7 +1354,6 @@
 				  <property name="right_attach">2</property>
 				  <property name="top_attach">2</property>
 				  <property name="bottom_attach">3</property>
-				  <property name="x_options">fill</property>
 				  <property name="y_options"></property>
 				</packing>
 			      </child>
Index: mail/em-account-editor.c
===================================================================
--- mail/em-account-editor.c	(revision 33603)
+++ mail/em-account-editor.c	(working copy)
@@ -1665,9 +1665,22 @@
 	}
 	if (url->user)
 		gtk_entry_set_text(service->username, url->user);
-	if (service->pathentry && url->path)
-		gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (service->pathentry), url->path);
+	if (service->pathentry){
+		GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER;
 
+		if (service->provider && (service->provider->url_flags & CAMEL_URL_NEED_PATH_FILE) != 0){
+			action = GTK_FILE_CHOOSER_ACTION_OPEN;
+		}
+
+		if (action != gtk_file_chooser_get_action (GTK_FILE_CHOOSER (service->pathentry))){
+			gtk_file_chooser_set_action (GTK_FILE_CHOOSER (service->pathentry), action);
+		}
+
+		if (url->path){
+			gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (service->pathentry), url->path);
+		}
+	}
+
 	tmp = camel_url_get_param(url, "use_ssl");
 	if (tmp == NULL)
 		tmp = "never";
