Add argument to fileBox to allow setting the default filename.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3183 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2000-11-20 21:55:01 +00:00
parent e49fce1712
commit 2b99156495
6 changed files with 21 additions and 22 deletions

View File

@ -28,6 +28,8 @@
#include "config.h"
/** PROTOTYPES ******************************************************/
const char *fileBox( const char * title, const char * filter );
const char *fileBox (const char * title,
const char * filter,
const char * default_name);
#endif

View File

@ -361,7 +361,7 @@ gncFileOpen (void)
if (!gncFileQuerySave ())
return;
newfile = fileBox(_("Open"), NULL);
newfile = fileBox(_("Open"), NULL, NULL);
gncPostFileOpen (newfile);
/* This dialogue can show up early in the startup process. If the
@ -464,7 +464,7 @@ gncFileSaveAs (void)
const char *oldfile;
gboolean uh_oh = FALSE;
filename = fileBox(_("Save"), "*.gnc");
filename = fileBox(_("Save"), "*.gnc", NULL);
if (!filename) return;
/* Check to see if the user specified the same file as the current

View File

@ -63,10 +63,11 @@ static gboolean gnc_file_box_delete_cb(GtkWidget *widget, GdkEvent *event,
* *
* Args: title - the title of the window *
* filter - the file filter to use *
* default_name - the default name to use *
* Return: containing the name of the file the user selected *
\********************************************************************/
const char *
fileBox(const char * title, const char * filter)
fileBox (const char * title, const char * filter, const char *default_name)
{
const char *last_file;
@ -83,7 +84,10 @@ fileBox(const char * title, const char * filter)
fb_info.file_name = NULL;
last_file = gnc_history_get_last();
if (last_file && !filter)
if (default_name)
gtk_file_selection_set_filename(fb_info.file_box, default_name);
else if (last_file)
gtk_file_selection_set_filename(fb_info.file_box, last_file);
/* hack alert - this was filtering directory names as well as file

View File

@ -226,7 +226,7 @@ gnc_ui_qif_import_select_file_cb(GtkButton * button,
const char * new_file_name;
new_file_name = fileBox(_("Select QIF File"), "*.qif");
new_file_name = fileBox(_("Select QIF File"), "*.qif", "");
/* set the filename entry for what was selected */
if(wind->filename_entry) {
@ -239,9 +239,6 @@ gnc_ui_qif_import_select_file_cb(GtkButton * button,
"");
}
}
/* free new_file_name -- g_free or free? */
/* FIXME */
}

View File

@ -201,15 +201,14 @@ gnc_report_error_dialog(const char *message)
parent = GTK_WINDOW(gnc_html_window_get_window(reportwindow));
if (message == NULL)
text = err_msg;
text = g_strdup (err_msg);
else
text = g_strconcat(err_msg, "\n\n", message, NULL);
text = g_strconcat (err_msg, "\n\n", message, NULL);
PERR("gnc_report_error_dialog: error running report.\n%s\n", message);
gnc_error_dialog_parented(parent, text);
if (message != NULL)
g_free(text);
}
@ -316,7 +315,7 @@ gnc_report_export(ReportData *report_data)
text = report_data->text;
/* Get the filename */
export_filename = fileBox(_("Export To"), NULL);
export_filename = fileBox(_("Export To"), NULL, "");
if (export_filename == NULL)
return;

View File

@ -99,16 +99,13 @@
(list "Extensions" "")
(lambda ()
(let ((file-name (gnc:file-selection-dialog
"Select file to save strings in" ".txt")))
"Select file to save strings in" ".txt" "")))
(if file-name (gnc:save-translatable-strings file-name))))))
(gnc:add-extension menu)
(gnc:add-extension export-item)
(gnc:add-extension progress-item)
(if (gnc:debugging?)
(gnc:add-extension strings-item)))
(gnc:add-extension strings-item))
(if (gnc:debugging?)
(gnc:hook-add-dangler gnc:*main-window-opened-hook*