Re: Bug#201854: [patch] Bug #201854: galeon: doesn't remember last path in filerequester in <INPUT type="FILE"> select

Mark Howard <[email protected]>
Newsgroups gmane.comp.web.galeon.devel
Message-ID <[email protected]>
Hi,
  Thanks for the patch! I'm CC'ing it to galeon-devel for their comments
and so that they will hopefully commit it. I've not tested it yet - busy
building garnome. One comment - you've created  new gconf key, so an
entry should be added to galeon.schemas.in.

On Thu, 2003-07-24 at 09:16, John Lightsey wrote:
> tags 201854 + patch
> thanks
> 
> The attached patch creates a new gconf variable to track the last used 
> directory for the filerequester dialog.  It also clears this gconf variable 
> (and the last download directory variable) when Galeon is started.
> 
> This ties in a bit to bug #197683 but I'll have to put together another patch 
> to get that one fixed properly.
> 
> John Lightsey
> http://www.nixnuts.net/debian-bugs.html
-- 
  .''`. Mark Howard
 : :' :
 `. `'  http://www.tildemh.com
   `-   [email protected] | [email protected] | [email protected]
galeon-6.diff (text/x-patch, 2.8 KB)
diff -ur galeon-1.3.5.20030714.orig/mozilla/FilePicker.cpp galeon-1.3.5.20030714/mozilla/FilePicker.cpp
--- galeon-1.3.5.20030714.orig/mozilla/FilePicker.cpp	2003-07-14 13:21:16.000000000 -0500
+++ galeon-1.3.5.20030714/mozilla/FilePicker.cpp	2003-07-24 02:51:40.000000000 -0500
@@ -35,6 +35,7 @@
 #include "galeon-config.h"
 #include "gul-string.h"
 #include "gul-gui.h"
+#include "prefs-strings.h"
 #include "eel-gconf-extensions.h"
 #include "gfilepicker.h"
 
@@ -89,11 +90,22 @@
 	mFile = do_CreateInstance (NS_LOCAL_FILE_CONTRACTID);
 	mDisplayDirectory = do_CreateInstance (NS_LOCAL_FILE_CONTRACTID);
 	mDisplayDirectory->InitWithNativePath(nsDependentCString(g_get_home_dir()));
+	
+	gchar *dirName = eel_gconf_get_string (CONF_STATE_LAST_UPLOAD_DIR);
+	if (dirName && dirName[0] == '\0') {
+		g_free (dirName);
+	        dirName = NULL;
+	}
+	if (dirName)	
+		mDisplayDirectory->InitWithNativePath(nsDependentCString(dirName));
 }
 
 GFilePicker::~GFilePicker()
 {
 	/* destructor code */
+        nsCAutoString cDirName;
+	mDisplayDirectory->GetNativePath(cDirName);
+	eel_gconf_set_string (CONF_STATE_LAST_UPLOAD_DIR, cDirName.get());
 }
 
 ////////////////////////////////////////////////////////////////////////////////
diff -ur galeon-1.3.5.20030714.orig/src/session.c galeon-1.3.5.20030714/src/session.c
--- galeon-1.3.5.20030714.orig/src/session.c	2003-07-14 13:21:12.000000000 -0500
+++ galeon-1.3.5.20030714/src/session.c	2003-07-24 02:51:40.000000000 -0500
@@ -293,8 +293,16 @@
 	
 	g_free (saved_session);
 
-	/* return SESSION_RESUMED, if a window was opened, else SESSION_OK */
-	return (session->priv->windows != NULL) ? SESSION_RESUMED : SESSION_OK;
+	/* If a window was not opened clear the per-session gconf variables
+	 * and return SESSION_OK.  If a window was opened leave gconf alone
+	 * and return SESSION_RESUMED.  */
+	if (session->priv->windows == NULL) {
+		eel_gconf_set_string (CONF_STATE_LAST_DOWNLOAD_DIR, "");
+		eel_gconf_set_string (CONF_STATE_LAST_UPLOAD_DIR, "");
+		return SESSION_OK;
+	} else {
+		return SESSION_RESUMED;
+	}
 }
 
 static void
diff -ur galeon-1.3.5.20030714.orig/utils/prefs-strings.h galeon-1.3.5.20030714/utils/prefs-strings.h
--- galeon-1.3.5.20030714.orig/utils/prefs-strings.h	2003-07-14 13:21:15.000000000 -0500
+++ galeon-1.3.5.20030714/utils/prefs-strings.h	2003-07-24 02:52:23.000000000 -0500
@@ -59,6 +59,7 @@
 #define CONF_DOWNLOADING_EXTERNAL_COMMAND "/apps/galeon/Handlers/Downloading/external_download_command"
 #define CONF_DOWNLOADING_EXTERNAL_TERMINAL "/apps/galeon/Handlers/Downloading/external_download_terminal"
 #define CONF_STATE_LAST_DOWNLOAD_DIR "/apps/galeon/State/last_download_dir"
+#define CONF_STATE_LAST_UPLOAD_DIR "/apps/galeon/State/last_upload_dir"
 #define CONF_DOWNLOADING_DIR "/apps/galeon/Handlers/Downloading/download_dir"
 
 /* State */
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.