Index: composer/e-msg-composer.h
===================================================================
--- composer/e-msg-composer.h	(revision 34389)
+++ composer/e-msg-composer.h	(working copy)
@@ -198,6 +198,10 @@
 
 struct _EAttachmentBar*          e_msg_composer_get_attachment_bar                (EMsgComposer *composer);
 
+void                     e_msg_composer_set_attach_path                  (EMsgComposer *composer, const gchar *path);
+const gchar *            e_msg_composer_get_attach_path                  (EMsgComposer *composer);
+
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
Index: composer/ChangeLog
===================================================================
--- composer/ChangeLog	(revision 34389)
+++ composer/ChangeLog	(working copy)
@@ -1,3 +1,15 @@
+2007-10-16  Milan Crha  <mcrha@redhat.com>
+
+	** Part of fix for bug #271551
+
+	* e-msg-composer.h: (e_msg_composer_set_attach_path),
+	(e_msg_composer_get_attach_path):
+	* e-msg-composer.c: (e_msg_composer_set_attach_path),
+	(e_msg_composer_get_attach_path):
+	Functions to set/get attach path to both composer and editor.
+	* e-msg-composer-select-file.c: (get_selector), (select_file_response),
+	(select_attach_response): Using new functions.
+
 2007-10-11  Milan Crha  <mcrha@redhat.com>
 
 	** Fix for bug #412360
Index: composer/e-msg-composer-select-file.c
===================================================================
--- composer/e-msg-composer-select-file.c	(revision 34389)
+++ composer/e-msg-composer-select-file.c	(working copy)
@@ -58,9 +58,9 @@
 	GtkWidget *selection;
 	GtkWidget *showinline = NULL;
 	GList *icon_list;
-	char *path;
+	const char *path;
 	
-	path = g_object_get_data ((GObject *) composer, "attach_path");
+	path = e_msg_composer_get_attach_path (composer);
 	
 	if (flags & SELECTOR_MODE_SAVE)
 		selection = gtk_file_chooser_dialog_new (title,
@@ -120,7 +120,8 @@
 
 		name = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (selector));
 		path = g_path_get_dirname (gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (selector)));
-		g_object_set_data_full ((GObject *) composer, "attach_path", path, g_free);
+		e_msg_composer_set_attach_path (composer, path);
+		g_free (path);
 
 		func(composer, name);
 	}
@@ -172,7 +173,8 @@
 			g_free (filename);
 		}
 		if (path)
-			g_object_set_data_full ((GObject *) composer, "attach_path", path, g_free);
+			e_msg_composer_set_attach_path (composer, path);
+		g_free (path);
 
 		func(composer, names, gtk_toggle_button_get_active(showinline));
 		
Index: composer/e-msg-composer.c
===================================================================
--- composer/e-msg-composer.c	(revision 34389)
+++ composer/e-msg-composer.c	(working copy)
@@ -1067,6 +1067,58 @@
 	CORBA_exception_free (&ev);
 }
 
+/**
+ * e_msg_composer_set_attach_path
+ * Attach path is used to be preset when choosing files. This function ensures same path
+ * in editor and in composer.
+ * @param composer Composer.
+ * @param path Path to be used.
+ **/
+void
+e_msg_composer_set_attach_path (EMsgComposer *composer, const gchar *path)
+{
+	g_return_if_fail (composer != NULL);
+
+	g_object_set_data_full ((GObject *) composer, "attach_path", g_strdup (path), g_free);
+
+	if (composer->priv->eeditor_engine) {
+		CORBA_Environment ev;
+
+		CORBA_exception_init (&ev);
+	
+		GNOME_GtkHTML_Editor_Engine_setFilePath (composer->priv->eeditor_engine, path, &ev);
+
+		CORBA_exception_free (&ev);
+	}
+}
+
+/**
+ * e_msg_composer_get_attach_path
+ * Last path, if any, used to select file.
+ * @param composer Composer.
+ * @return Last used path, or NULL when not set yet.
+ **/
+const gchar *
+e_msg_composer_get_attach_path (EMsgComposer *composer)
+{
+	g_return_val_if_fail (composer != NULL, NULL);
+
+	if (composer->priv->eeditor_engine) {
+		char *str;
+		CORBA_Environment ev;
+
+		CORBA_exception_init (&ev);
+
+		str = GNOME_GtkHTML_Editor_Engine_getFilePath (composer->priv->eeditor_engine, &ev);
+		if (ev._major == CORBA_NO_EXCEPTION && str)
+			e_msg_composer_set_attach_path (composer, str);
+
+		CORBA_exception_free (&ev);
+	}
+
+	return g_object_get_data ((GObject *) composer, "attach_path");
+}
+
 static char *
 encode_signature_name (const char *name)
 {
