r18218 - gnucash/trunk/src/gnome-utils - Fix bug 585899 - environment variable GNC_DEFAULT_DATABASE can be used to set the default

Phil Longstaff plongstaff at code.gnucash.org
Sun Jul 19 16:16:44 EDT 2009


Author: plongstaff
Date: 2009-07-19 16:16:44 -0400 (Sun, 19 Jul 2009)
New Revision: 18218
Trac: http://svn.gnucash.org/trac/changeset/18218

Modified:
   gnucash/trunk/src/gnome-utils/dialog-file-access.c
Log:
Fix bug 585899 - environment variable GNC_DEFAULT_DATABASE can be used to set the default
database name for the Save As dialog.


Modified: gnucash/trunk/src/gnome-utils/dialog-file-access.c
===================================================================
--- gnucash/trunk/src/gnome-utils/dialog-file-access.c	2009-07-18 18:40:00 UTC (rev 18217)
+++ gnucash/trunk/src/gnome-utils/dialog-file-access.c	2009-07-19 20:16:44 UTC (rev 18218)
@@ -174,6 +174,19 @@
 	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 @@
 	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 @@
     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" ));



More information about the gnucash-changes mailing list