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
This commit is contained in:
Dave Peticolas 2000-09-08 07:51:18 +00:00
parent 25b38b6db2
commit 4ecaf2fb3c
4 changed files with 12 additions and 5 deletions

View File

@ -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

View File

@ -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

View File

@ -27,6 +27,7 @@
#include <gnome.h>
#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

View File

@ -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)