mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
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:
parent
e49fce1712
commit
2b99156495
@ -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
|
||||
|
@ -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
|
||||
|
@ -61,12 +61,13 @@ static gboolean gnc_file_box_delete_cb(GtkWidget *widget, GdkEvent *event,
|
||||
* (This function does not return until the user selects a file *
|
||||
* or presses "Cancel" or the window manager destroy button) *
|
||||
* *
|
||||
* Args: title - the title of the window *
|
||||
* filter - the file filter to use *
|
||||
* 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
|
||||
|
@ -226,8 +226,8 @@ 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) {
|
||||
if(new_file_name) {
|
||||
@ -239,9 +239,6 @@ gnc_ui_qif_import_select_file_cb(GtkButton * button,
|
||||
"");
|
||||
}
|
||||
}
|
||||
|
||||
/* free new_file_name -- g_free or free? */
|
||||
/* FIXME */
|
||||
}
|
||||
|
||||
|
||||
|
@ -201,16 +201,15 @@ 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);
|
||||
g_free(text);
|
||||
}
|
||||
|
||||
static char *
|
||||
@ -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;
|
||||
|
||||
|
@ -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*
|
||||
|
Loading…
Reference in New Issue
Block a user