changeset 808:72400fdbd0ed

2006-8-10 Brian Masney <masneyb@gftp.org> * lib/options.h src/gtk/gftp-gtk.c (_gftp_exit) - added new option: remember_last_directory. This will control whether or not the last directory is remembered when the application is closed. I had a lot of people ask for this option. I personally find it annoying, which is why I left the option disabled by default.
author masneyb
date Sun, 10 Sep 2006 16:18:16 +0000
parents a3fd5e501513
children d0e71c4aad29
files ChangeLog lib/options.h src/gtk/gftp-gtk.c
diffstat 3 files changed, 23 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Sep 10 16:10:44 2006 +0000
+++ b/ChangeLog	Sun Sep 10 16:18:16 2006 +0000
@@ -1,4 +1,10 @@
 2006-8-10 Brian Masney <masneyb@gftp.org>
+	* lib/options.h src/gtk/gftp-gtk.c (_gftp_exit) - added new option:
+	remember_last_directory. This will control whether or not the last
+	directory is remembered when the application is closed. I had a lot
+	of people ask for this option. I personally find it annoying, which
+	is why I left the option disabled by default.
+
 	* src/gtk/gtkui.c (gftpui_refresh) - delete the cache entry before
 	checking to see if it needs to reconnect to the remote server
 
@@ -3558,7 +3564,7 @@
 
 	* cvsclean - added this script
 
-	* *.[ch] - added $Id: ChangeLog,v 1.470 2006/09/10 16:10:40 masneyb Exp $ tags
+	* *.[ch] - added $Id: ChangeLog,v 1.471 2006/09/10 16:18:15 masneyb Exp $ tags
 
 	* debian/* - updated files from Debian maintainer
 
--- a/lib/options.h	Sun Sep 10 16:10:44 2006 +0000
+++ b/lib/options.h	Sun Sep 10 16:18:16 2006 +0000
@@ -106,7 +106,12 @@
    GFTP_PORT_GTK, NULL},
   {"cmd_in_gui", N_("Allow manual commands in GUI"), 
    gftp_option_type_checkbox, GINT_TO_POINTER(0), NULL, 0,
-   N_("Allow entering manual commands in the GUI (functions like the text port)"), GFTP_PORT_GTK, NULL},
+   N_("Allow entering manual commands in the GUI (functions like the text port)"),
+   GFTP_PORT_GTK, NULL},
+  {"remember_last_directory", N_("Remember last directory"), 
+   gftp_option_type_checkbox, GINT_TO_POINTER(0), NULL, 0,
+   N_("Save the last local and remote directory when the application is closed"),
+   GFTP_PORT_GTK, NULL},
 
   {"", N_("Network"), gftp_option_type_notebook, NULL, NULL, 
    GFTP_CVARS_FLAGS_SHOW_BOOKMARK, NULL, GFTP_PORT_GTK, NULL},
--- a/src/gtk/gftp-gtk.c	Sun Sep 10 16:10:44 2006 +0000
+++ b/src/gtk/gftp-gtk.c	Sun Sep 10 16:18:16 2006 +0000
@@ -57,6 +57,7 @@
 static void
 _gftp_exit (GtkWidget * widget, gpointer data)
 {
+  intptr_t remember_last_directory;
   const char *tempstr;
   GtkWidget * tempwid;
   intptr_t ret;
@@ -110,11 +111,16 @@
   tempstr = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (useredit)->entry));
   gftp_set_global_option ("user_value", tempstr);
 
-  tempstr = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (window1.combo)->entry));
-  gftp_set_global_option ("local_startup_directory", tempstr);
+  gftp_lookup_global_option ("remember_last_directory",
+                             &remember_last_directory);
+  if (remember_last_directory)
+    {
+      tempstr = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (window1.combo)->entry));
+      gftp_set_global_option ("local_startup_directory", tempstr);
 
-  tempstr = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (window2.combo)->entry));
-  gftp_set_global_option ("remote_startup_directory", tempstr);
+      tempstr = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (window2.combo)->entry));
+      gftp_set_global_option ("remote_startup_directory", tempstr);
+    }
 
   tempwid = gtk_menu_get_active (GTK_MENU (protocol_menu));
   ret = GPOINTER_TO_INT (gtk_object_get_user_data (GTK_OBJECT (tempwid)));