Fix bug 585899 - environment variable GNC_DEFAULT_DATABASE can be used to set the default

database name for the Save As dialog.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18218 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Phil Longstaff 2009-07-19 20:16:44 +00:00
parent 787d8f6a39
commit 6066b5613b

View File

@ -174,6 +174,19 @@ cb_uri_type_changed_cb( GtkComboBox* cb )
set_widget_sensitivity_for_uri_type( faw, type );
}
static const char*
get_default_database( void )
{
const gchar* default_db;
default_db = g_getenv( "GNC_DEFAULT_DATABASE" );
if( default_db == NULL ) {
default_db = DEFAULT_DATABASE;
}
return default_db;
}
static void
gnc_ui_file_access( int type )
{
@ -195,6 +208,7 @@ gnc_ui_file_access( int type )
gboolean need_access_method_xml = FALSE;
gint access_method_index = -1;
gint active_access_method_index = -1;
const gchar* default_db;
g_return_if_fail( type == FILE_ACCESS_OPEN || type == FILE_ACCESS_SAVE_AS );
@ -214,7 +228,8 @@ gnc_ui_file_access( int type )
faw->tf_host = GTK_ENTRY(glade_xml_get_widget( xml, "tf_host" ));
gtk_entry_set_text( faw->tf_host, DEFAULT_HOST );
faw->tf_database = GTK_ENTRY(glade_xml_get_widget( xml, "tf_database" ));
gtk_entry_set_text( faw->tf_database, DEFAULT_DATABASE );
default_db = get_default_database();
gtk_entry_set_text( faw->tf_database, default_db );
faw->tf_username = GTK_ENTRY(glade_xml_get_widget( xml, "tf_username" ));
faw->tf_password = GTK_ENTRY(glade_xml_get_widget( xml, "tf_password" ));
op = GTK_BUTTON(glade_xml_get_widget( xml, "pb_op" ));