[evolution-patches] Fix for bug271551[gtkhtml]



Hi

Attached fix for Bug 271551 – File Manager Used During Composer Should
Remember Last Directory

Please Review

Thanks,
Rohini
Index: menubar.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/components/html-editor/menubar.c,v
retrieving revision 1.124
diff -u -p -r1.124 menubar.c
--- menubar.c	14 Sep 2005 12:25:36 -0000	1.124
+++ menubar.c	16 Jan 2006 11:02:48 -0000
@@ -41,6 +41,7 @@
 #include <gtk/gtkfilesel.h>
 #endif
 #include <bonobo.h>
+#include <gconf/gconf-client.h>
 
 #include "htmlengine.h"
 #include "htmlengine-edit-cut-and-paste.h"
@@ -97,6 +98,8 @@ insert_image_cb (BonoboUIComponent *uic,
 {
 	GtkWidget *filesel;
 	HTMLObject *img;
+	char *dir;
+	GConfClient *gconf;
 
 #ifdef USE_GTKFILECHOOSER
 	filesel = gtk_file_chooser_dialog_new (_("Insert image"),
@@ -109,6 +112,16 @@ insert_image_cb (BonoboUIComponent *uic,
 #else
 	filesel = gtk_file_selection_new (_("Insert image"));
 #endif
+
+	gconf = gconf_client_get_default();
+	dir = gconf_client_get_string(gconf, "/apps/evolution/mail/save_dir", NULL);
+	g_object_unref(gconf);
+
+	if (dir == NULL)
+		dir = g_get_home_dir();
+
+	gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (filesel), dir);
+
 	if (filesel) {
 		if (gtk_dialog_run (GTK_DIALOG (filesel)) == GTK_RESPONSE_OK) {
 			const char *filename;
@@ -116,8 +129,11 @@ insert_image_cb (BonoboUIComponent *uic,
 
 #ifdef USE_GTKFILECHOOSER
 			filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (filesel));
+			gconf_client_set_string(gconf, "/apps/evolution/mail/save_dir", gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER (filesel)), NULL);
 #else
 			filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (filesel));
+			dir = g_path_get_dirname (filename);
+			gconf_client_set_string(gconf, "/apps/evolution/mail/save_dir", dir, NULL);
 #endif
 			url = gtk_html_filename_to_uri (filename);
 			img = html_image_new (html_engine_get_image_factory (cd->html->engine), url,
@@ -856,6 +872,7 @@ menubar_setup (BonoboUIComponent  *uic,
 		cd->has_spell_control = FALSE;
 		bonobo_ui_component_set_prop (uic, "/commands/EditSpellCheck", "sensitive", "0", NULL);
 	} else {
+		cd->has_spell_control = TRUE;
 		cd->has_spell_control = TRUE;
 		bonobo_ui_component_set_prop (uic, "/commands/EditSpellCheck", "sensitive", "1", NULL);
 	}
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtkhtml/components/html-editor/ChangeLog,v
retrieving revision 1.520
diff -u -p -r1.520 ChangeLog
--- ChangeLog	4 Jan 2006 04:03:37 -0000	1.520
+++ ChangeLog	16 Jan 2006 11:13:38 -0000
@@ -1,3 +1,10 @@
+2006-01-16  Rohini S  <srohini novell com>
+
+	* menubar.c (insert_image_cb): Use gconf entry save_dir to remember and 
+	retrieve path information.
+
+	Fixes bug #271551
+
 2006-01-04  Tor Lillqvist  <tml novell com>
 
 	* Makefile.am: On Win32, use a relative path to the DLL in the


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]