[evolution-patches] [gtkhtml] Fix for 271551



Hi

Worked on http://bugzilla.gnome.org/show_bug.cgi?id=271551.

Please review

Thanks
Johnny
Index: components/html-editor/ChangeLog
===================================================================
RCS file: /cvs/gnome/gtkhtml/components/html-editor/ChangeLog,v
retrieving revision 1.519
diff -u -p -r1.519 ChangeLog
--- components/html-editor/ChangeLog	19 Dec 2005 06:40:33 -0000	1.519
+++ components/html-editor/ChangeLog	16 Jan 2006 10:54:42 -0000
@@ -1,3 +1,9 @@
+2006-01-16  Johnny Jacob  <johnnyjacob gmail com>
+
+	Fixes #271551.
+	* components/html-editor/menubar.c (insert_image_cb) :
+	set the default directory of file selector from gconf.
+
 2005-12-19  Srinivasa Ragavan <sragavan novell com>
 
 	** Fixes bug #246938
Index: components/html-editor/menubar.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/components/html-editor/menubar.c,v
retrieving revision 1.124
diff -u -p -r1.124 menubar.c
--- components/html-editor/menubar.c	14 Sep 2005 12:25:36 -0000	1.124
+++ components/html-editor/menubar.c	16 Jan 2006 10:54: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"
@@ -64,6 +65,8 @@
 #include "table.h"
 #include "template.h"
 
+#define KEY_DEFAULT_PATH "/apps/evolution/mail/save_dir"
+
 static void smiley_cb (BonoboUIComponent *uic, GtkHTMLControlData *cd, const char *cname);
 static void font_style_cb (BonoboUIComponent *uic, GtkHTMLControlData *cd, const char *cname);
 static void command_cb (BonoboUIComponent *uic, GtkHTMLControlData *cd, const char *cname);
@@ -97,7 +100,11 @@ insert_image_cb (BonoboUIComponent *uic,
 {
 	GtkWidget *filesel;
 	HTMLObject *img;
+	GConfClient *gconf;
+	gchar *default_path;
 
+	gconf = gconf_client_get_default();
+	default_path = gconf_client_get_string (gconf, KEY_DEFAULT_PATH, NULL);
 #ifdef USE_GTKFILECHOOSER
 	filesel = gtk_file_chooser_dialog_new (_("Insert image"),
 					       NULL,
@@ -105,9 +112,11 @@ insert_image_cb (BonoboUIComponent *uic,
 					       GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
 					       GTK_STOCK_OPEN, GTK_RESPONSE_OK,
 					       NULL);
+	gtk_file_chooser_set_current_folder (filesel, default_path);
 	gtk_dialog_set_default_response (GTK_DIALOG (filesel), GTK_RESPONSE_OK);
 #else
 	filesel = gtk_file_selection_new (_("Insert image"));
+	gtk_file_selection_set_filename (filesel, default_path);
 #endif
 	if (filesel) {
 		if (gtk_dialog_run (GTK_DIALOG (filesel)) == GTK_RESPONSE_OK) {
@@ -119,6 +128,9 @@ insert_image_cb (BonoboUIComponent *uic,
 #else
 			filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (filesel));
 #endif
+			default_path = g_path_get_dirname (filename);
+			gconf_client_set_string (gconf, KEY_DEFAULT_PATH, default_path, NULL);
+
 			url = gtk_html_filename_to_uri (filename);
 			img = html_image_new (html_engine_get_image_factory (cd->html->engine), url,
 					      NULL, NULL, 0, 0, 0, 0, 0, NULL, HTML_VALIGN_NONE, FALSE);


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