From 4ecaf2fb3c12dc413bb0a58c144e003a8f4364b1 Mon Sep 17 00:00:00 2001 From: Dave Peticolas Date: Fri, 8 Sep 2000 07:51:18 +0000 Subject: [PATCH] Use the last opened file as the file dialog default. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@2808 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/FileBox.h | 2 +- src/file-history.h | 2 +- src/gnome/dialog-filebox.c | 11 +++++++++-- src/gnome/file-history.c | 2 +- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/FileBox.h b/src/FileBox.h index 79e3f90bd3..afb48d95d2 100644 --- a/src/FileBox.h +++ b/src/FileBox.h @@ -28,6 +28,6 @@ #include "config.h" /** PROTOTYPES ******************************************************/ -char *fileBox( const char * title, const char * filter ); +const char *fileBox( const char * title, const char * filter ); #endif diff --git a/src/file-history.h b/src/file-history.h index 6f193da96f..9fea93f56d 100644 --- a/src/file-history.h +++ b/src/file-history.h @@ -27,6 +27,6 @@ void gnc_history_add_file(char *); void gnc_history_update_menu(); -char * gnc_history_get_last(); +const char * gnc_history_get_last(); #endif diff --git a/src/gnome/dialog-filebox.c b/src/gnome/dialog-filebox.c index 69cfdd91bb..150c5bd9df 100644 --- a/src/gnome/dialog-filebox.c +++ b/src/gnome/dialog-filebox.c @@ -27,6 +27,7 @@ #include #include "FileBox.h" +#include "file-history.h" #include "messages.h" #include "util.h" @@ -61,11 +62,13 @@ static gboolean gnc_file_box_delete_cb(GtkWidget *widget, GdkEvent *event, * * * Args: title - the title of the window * * filter - the file filter to use * - * Return: char * containing the name of the file the user selected * + * Return: containing the name of the file the user selected * \********************************************************************/ -char * +const char * fileBox(const char * title, const char * filter) { + const char *last_file; + ENTER("\n"); /* Set a default title if nothing was passed in */ @@ -78,6 +81,10 @@ fileBox(const char * title, const char * filter) fb_info.file_box = GTK_FILE_SELECTION(gtk_file_selection_new(title)); fb_info.file_name = NULL; + last_file = gnc_history_get_last(); + if (last_file != NULL) + gtk_file_selection_set_filename(fb_info.file_box, last_file); + /* hack alert - this was filtering directory names as well as file * names, so I think we should not do this by default (rgmerk) */ #if 0 diff --git a/src/gnome/file-history.c b/src/gnome/file-history.c index d9f595f239..51cb9790c3 100644 --- a/src/gnome/file-history.c +++ b/src/gnome/file-history.c @@ -143,7 +143,7 @@ gnc_history_add_file(char *newfile) __gnc_history_config_write(); } -char * +const char * gnc_history_get_last() { if(history_list == NULL)