diff --git a/src/backend/dbi/gnc-backend-dbi.c b/src/backend/dbi/gnc-backend-dbi.c index 1d4aa55764..2ecb987a09 100644 --- a/src/backend/dbi/gnc-backend-dbi.c +++ b/src/backend/dbi/gnc-backend-dbi.c @@ -54,6 +54,11 @@ static QofLogModule log_module = G_LOG_DOMAIN; +#define FILE_URI_TYPE "file" +#define FILE_URI_PREFIX (FILE_URI_TYPE "://") +#define SQLITE3_URI_TYPE "sqlite3" +#define SQLITE3_URI_PREFIX (SQLITE3_URI_TYPE "://") + typedef gchar* (*CREATE_TABLE_DDL_FN)( GncSqlConnection* conn, const gchar* table_name, const GList* col_info_list ); @@ -103,6 +108,7 @@ struct GncDbiBackend_struct gboolean in_query; gboolean supports_transactions; gboolean is_pristine_db; // Are we saving to a new pristine db? + gboolean exists; // Does the database exist? gint obj_total; // Total # of objects (for percentage calculation) gint operations_done; // Number of operations (save/load) done @@ -127,7 +133,7 @@ create_tables_cb( const gchar* type, gpointer data_p, gpointer be_p ) } static void -error_fn( dbi_conn conn, void* user_data ) +sqlite3_error_fn( dbi_conn conn, void* user_data ) { GncDbiBackend *be = (GncDbiBackend*)user_data; const gchar* msg; @@ -153,6 +159,14 @@ gnc_dbi_sqlite3_session_begin( QofBackend *qbe, QofSession *session, ENTER (" "); + /* Remove uri type if present */ + if( g_str_has_prefix( book_id, FILE_URI_PREFIX ) ) { + book_id += strlen( FILE_URI_PREFIX ); + } + if( g_str_has_prefix( book_id, SQLITE3_URI_PREFIX ) ) { + book_id += strlen( SQLITE3_URI_PREFIX ); + } + if (!create_if_nonexistent && !g_file_test(book_id, G_FILE_TEST_IS_REGULAR | G_FILE_TEST_EXISTS)) { qof_backend_set_error(qbe, ERR_FILEIO_FILE_NOT_FOUND); @@ -170,7 +184,7 @@ gnc_dbi_sqlite3_session_begin( QofBackend *qbe, QofSession *session, dirname = g_path_get_dirname( book_id ); basename = g_path_get_basename( book_id ); - dbi_conn_error_handler( be->conn, error_fn, be ); + dbi_conn_error_handler( be->conn, sqlite3_error_fn, be ); dbi_conn_set_option( be->conn, "host", "localhost" ); dbi_conn_set_option( be->conn, "dbname", basename ); dbi_conn_set_option( be->conn, "sqlite3_dbdir", dirname ); @@ -189,6 +203,19 @@ gnc_dbi_sqlite3_session_begin( QofBackend *qbe, QofSession *session, LEAVE (" "); } +static void +mysql_error_fn( dbi_conn conn, void* user_data ) +{ + GncDbiBackend *be = (GncDbiBackend*)user_data; + const gchar* msg; + + dbi_conn_error( conn, &msg ); + PERR( "DBI error: %s\n", msg ); + if( g_str_has_prefix( msg, "1049: Unknown database" ) ) { + be->exists = FALSE; + } +} + static void gnc_dbi_mysql_session_begin( QofBackend *qbe, QofSession *session, const gchar *book_id, @@ -227,26 +254,53 @@ gnc_dbi_mysql_session_begin( QofBackend *qbe, QofSession *session, LEAVE( " " ); return; } - dbi_conn_error_handler( be->conn, error_fn, be ); + dbi_conn_error_handler( be->conn, mysql_error_fn, be ); dbi_conn_set_option( be->conn, "host", host ); dbi_conn_set_option_numeric( be->conn, "port", 0 ); - dbi_conn_set_option( be->conn, "dbname", dbname ); + dbi_conn_set_option( be->conn, "dbname", "mysql" ); dbi_conn_set_option( be->conn, "username", username ); dbi_conn_set_option( be->conn, "password", password ); + be->exists = TRUE; result = dbi_conn_connect( be->conn ); - g_free( dsn ); - if( result < 0 ) { + if( result == 0 ) { + result = dbi_conn_select_db( be->conn, dbname ); + if( result == 0 ) { + be->sql_be.conn = create_dbi_connection( GNC_DBI_PROVIDER_MYSQL, be->conn ); + } else { + if( create_if_nonexistent ) { + /* Couldn't select the db, so try to create it */ + dbi_result dresult; + dresult = dbi_conn_queryf( be->conn, "CREATE DATABASE %s", dbname ); + result = dbi_conn_select_db( be->conn, dbname ); + if( result == 0 ) { + be->sql_be.conn = create_dbi_connection( GNC_DBI_PROVIDER_MYSQL, be->conn ); + } else { + PERR( "Unable to connect to %s: %d\n", book_id, result ); + qof_backend_set_error( qbe, ERR_BACKEND_CANT_CONNECT ); + } + } else { + qof_backend_set_error( qbe, ERR_BACKEND_NO_SUCH_DB ); + } + } + } else { PERR( "Unable to connect to %s: %d\n", book_id, result ); - qof_backend_set_error( qbe, ERR_BACKEND_BAD_URL ); - LEAVE( " " ); - return; + qof_backend_set_error( qbe, ERR_BACKEND_CANT_CONNECT ); } - be->sql_be.conn = create_dbi_connection( GNC_DBI_PROVIDER_MYSQL, be->conn ); - + g_free( dsn ); LEAVE (" "); } +static void +pgsql_error_fn( dbi_conn conn, void* user_data ) +{ + GncDbiBackend *be = (GncDbiBackend*)user_data; + const gchar* msg; + + dbi_conn_error( conn, &msg ); + PERR( "DBI error: %s\n", msg ); +} + static void gnc_dbi_postgres_session_begin( QofBackend *qbe, QofSession *session, const gchar *book_id, @@ -285,7 +339,7 @@ gnc_dbi_postgres_session_begin( QofBackend *qbe, QofSession *session, LEAVE( " " ); return; } - dbi_conn_error_handler( be->conn, error_fn, be ); + dbi_conn_error_handler( be->conn, pgsql_error_fn, be ); dbi_conn_set_option( be->conn, "host", host ); dbi_conn_set_option_numeric( be->conn, "port", 0 ); dbi_conn_set_option( be->conn, "dbname", dbname ); @@ -618,7 +672,16 @@ qof_backend_module_init(void) prov = g_new0 (QofBackendProvider, 1); prov->provider_name = "GnuCash Libdbi (SQLITE3) Backend"; - prov->access_method = "file"; + prov->access_method = FILE_URI_TYPE; + prov->partial_book_supported = FALSE; + prov->backend_new = gnc_dbi_backend_sqlite3_new; + prov->provider_free = gnc_dbi_provider_free; + prov->check_data_type = gnc_dbi_check_sqlite3_file; + qof_backend_register_provider( prov ); + + prov = g_new0 (QofBackendProvider, 1); + prov->provider_name = "GnuCash Libdbi (SQLITE3) Backend"; + prov->access_method = SQLITE3_URI_TYPE; prov->partial_book_supported = FALSE; prov->backend_new = gnc_dbi_backend_sqlite3_new; prov->provider_free = gnc_dbi_provider_free; diff --git a/src/gnome-utils/Makefile.am b/src/gnome-utils/Makefile.am index e6e14f7eef..32abf6af42 100644 --- a/src/gnome-utils/Makefile.am +++ b/src/gnome-utils/Makefile.am @@ -20,8 +20,7 @@ AM_CPPFLAGS = \ ${GTKHTML_CFLAGS} \ ${GUILE_INCS} \ ${QOF_CFLAGS} \ - ${GOFFICE_CFLAGS} \ - ${LIBGDA_CFLAGS} + ${GOFFICE_CFLAGS} libgncmod_gnome_utils_la_SOURCES = \ QuickFill.c \ @@ -30,7 +29,7 @@ libgncmod_gnome_utils_la_SOURCES = \ dialog-account.c \ dialog-book-close.c \ dialog-commodity.c \ - dialog-database-connection.c \ + dialog-file-access.c \ dialog-options.c \ dialog-preferences.c \ dialog-query-list.c \ @@ -106,7 +105,7 @@ gncinclude_HEADERS = \ dialog-account.h \ dialog-book-close.h \ dialog-commodity.h \ - dialog-database-connection.h \ + dialog-file-access.h \ dialog-preferences.h \ dialog-options.h \ dialog-query-list.h \ diff --git a/src/gnome-utils/dialog-file-access.c b/src/gnome-utils/dialog-file-access.c new file mode 100644 index 0000000000..0a352b62e6 --- /dev/null +++ b/src/gnome-utils/dialog-file-access.c @@ -0,0 +1,308 @@ +/********************************************************************\ + * dialog-file-access.c -- dialog for opening a file or making a * + * connection to a libdbi database * + * * + * Copyright (C) 2009 Phil Longstaff (plongstaff@rogers.com) * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License as * + * published by the Free Software Foundation; either version 2 of * + * the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License* + * along with this program; if not, contact: * + * * + * Free Software Foundation Voice: +1-617-542-5942 * + * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 * + * Boston, MA 02110-1301, USA gnu@gnu.org * +\********************************************************************/ + +#include "config.h" + +#include +#include +#include + +#include "gnc-ui.h" +#include "dialog-utils.h" +#include "dialog-file-access.h" +#include "gnc-file.h" +#include "gnc-session.h" + +static QofLogModule log_module = GNC_MOD_GUI; + +#define DEFAULT_HOST "localhost" +#define DEFAULT_DATABASE "gnucash" +#define FILE_ACCESS_OPEN 0 +#define FILE_ACCESS_SAVE_AS 1 + +void gnc_ui_file_access_response_cb( GtkDialog *, gint, GtkDialog * ); +void gnc_ui_file_access_rb_xml_clicked_cb( GtkToggleButton* tb ); +void gnc_ui_file_access_rb_sqlite3_clicked_cb( GtkToggleButton* tb ); +void gnc_ui_file_access_rb_mysql_clicked_cb( GtkToggleButton* tb ); +void gnc_ui_file_access_rb_pgsql_clicked_cb( GtkToggleButton* tb ); + +typedef struct FileAccessWindow +{ + /* Parts of the dialog */ + int type; + + GtkWidget* dialog; + GtkWidget* frame_file; + GtkWidget* frame_database; + GtkFileChooser* fileChooser; + GtkWidget* rb_xml; + GtkWidget* rb_sqlite3; + GtkWidget* rb_mysql; + GtkWidget* rb_pgsql; + GtkWidget* tf_host; + GtkWidget* tf_database; + GtkWidget* tf_username; + GtkWidget* tf_password; +} FileAccessWindow; + +static gchar* +geturl( FileAccessWindow* faw ) +{ + gchar* url; + const gchar* host; + const gchar* database; + const gchar* username; + const gchar* password; + const gchar* type; + const gchar* file; + + host = gtk_entry_get_text( GTK_ENTRY(faw->tf_host) ); + database = gtk_entry_get_text( GTK_ENTRY(faw->tf_database) ); + username = gtk_entry_get_text( GTK_ENTRY(faw->tf_username) ); + password = gtk_entry_get_text( GTK_ENTRY(faw->tf_password) ); + file = gtk_file_chooser_get_filename( faw->fileChooser ); + + if( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(faw->rb_xml) ) ) { + type = "xml"; + url = g_strdup_printf( "%s://%s", type, file ); + } else if( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(faw->rb_sqlite3) ) ) { + type = "sqlite3"; + url = g_strdup_printf( "%s://%s", type, file ); + } else if( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(faw->rb_mysql) ) ) { + type = "mysql"; + url = g_strdup_printf( "%s://%s:%s:%s:%s", + type, host, database, username, password ); + } else { + g_assert( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(faw->rb_pgsql) ) ); + type = "postgres"; + url = g_strdup_printf( "%s://%s:%s:%s:%s", + type, host, database, username, password ); + } + + return url; +} + +void +gnc_ui_file_access_response_cb(GtkDialog *dialog, gint response, GtkDialog *unused) +{ + FileAccessWindow* faw; + gchar* url; + + g_return_if_fail( dialog != NULL ); + + faw = g_object_get_data( G_OBJECT(dialog), "FileAccessWindow" ); + g_return_if_fail( faw != NULL ); + + switch( response ) { + case GTK_RESPONSE_HELP: + gnc_gnome_help( HF_HELP, HL_GLOBPREFS ); + break; + + case GTK_RESPONSE_OK: + url = geturl( faw ); + if( faw->type == FILE_ACCESS_OPEN ) { + gnc_file_open_file( url ); + } else if( faw->type == FILE_ACCESS_SAVE_AS ) { + gnc_file_do_save_as( url ); + } + break; + + case GTK_RESPONSE_CANCEL: + break; + + default: + PERR( "Invalid response" ); + break; + } + + if( response != GTK_RESPONSE_HELP ) { + gtk_widget_destroy( GTK_WIDGET(dialog) ); + } +} + +/* Activate the file chooser and deactivate the db selection fields */ +static void +on_rb_filetype_clicked( FileAccessWindow* faw ) +{ + gtk_widget_set_sensitive( faw->frame_file, TRUE ); + gtk_widget_set_sensitive( faw->frame_database, FALSE ); +} + +void +gnc_ui_file_access_rb_xml_clicked_cb( GtkToggleButton* tb ) +{ + GtkWidget* dialog; + FileAccessWindow* faw; + + g_return_if_fail( tb != NULL ); + + if( gtk_toggle_button_get_active( tb ) ) { + dialog = gtk_widget_get_toplevel( GTK_WIDGET(tb) ); + g_return_if_fail( dialog != NULL ); + faw = g_object_get_data( G_OBJECT(dialog), "FileAccessWindow" ); + g_return_if_fail( faw != NULL ); + + on_rb_filetype_clicked( faw ); + } +} + +void +gnc_ui_file_access_rb_sqlite3_clicked_cb( GtkToggleButton* tb ) +{ + GtkWidget* dialog; + FileAccessWindow* faw; + + if( gtk_toggle_button_get_active( tb ) ) { + dialog = gtk_widget_get_toplevel( GTK_WIDGET(tb) ); + g_return_if_fail( dialog != NULL ); + faw = g_object_get_data( G_OBJECT(dialog), "FileAccessWindow" ); + g_return_if_fail( faw != NULL ); + + on_rb_filetype_clicked( faw ); + } +} + +/* Deactivate the file chooser and activate the db selection fields */ +static void +on_rb_databasetype_clicked( FileAccessWindow* faw ) +{ + gtk_widget_set_sensitive( faw->frame_file, FALSE ); + gtk_widget_set_sensitive( faw->frame_database, TRUE ); +} + +void +gnc_ui_file_access_rb_mysql_clicked_cb( GtkToggleButton* tb ) +{ + GtkWidget* dialog; + FileAccessWindow* faw; + + if( gtk_toggle_button_get_active( tb ) ) { + g_return_if_fail( tb != NULL ); + dialog = gtk_widget_get_toplevel( GTK_WIDGET(tb) ); + g_return_if_fail( dialog != NULL ); + faw = g_object_get_data( G_OBJECT(dialog), "FileAccessWindow" ); + g_return_if_fail( faw != NULL ); + + on_rb_databasetype_clicked( faw ); + } +} + +void +gnc_ui_file_access_rb_pgsql_clicked_cb( GtkToggleButton* tb ) +{ + GtkWidget* dialog; + FileAccessWindow* faw; + + if( gtk_toggle_button_get_active( tb ) ) { + g_return_if_fail( tb != NULL ); + dialog = gtk_widget_get_toplevel( GTK_WIDGET(tb) ); + g_return_if_fail( dialog != NULL ); + faw = g_object_get_data( G_OBJECT(dialog), "FileAccessWindow" ); + g_return_if_fail( faw != NULL ); + + on_rb_databasetype_clicked( faw ); + } +} + +static void +gnc_ui_file_access( int type ) +{ + FileAccessWindow *faw; + GladeXML* xml; + GtkWidget* box; + GList* ds_node; + GtkButton* op; + GtkWidget* align; + GtkFileChooserWidget* fileChooser; + GtkFileChooserAction fileChooserAction; + + g_return_if_fail( type == FILE_ACCESS_OPEN || type == FILE_ACCESS_SAVE_AS ); + + faw = g_new0(FileAccessWindow, 1); + g_return_if_fail( faw != NULL ); + + faw->type = type; + + /* Open the dialog */ + xml = gnc_glade_xml_new( "dialog-file-access.glade", "File Access" ); + faw->dialog = glade_xml_get_widget( xml, "File Access" ); + + faw->frame_file = glade_xml_get_widget( xml, "frame_file" ); + faw->frame_database = glade_xml_get_widget( xml, "frame_database" ); + faw->rb_xml = glade_xml_get_widget( xml, "rb_xml" ); + faw->rb_sqlite3 = glade_xml_get_widget( xml, "rb_sqlite3" ); + faw->rb_mysql = glade_xml_get_widget( xml, "rb_mysql" ); + faw->rb_pgsql = glade_xml_get_widget( xml, "rb_pgsql" ); + faw->tf_host = glade_xml_get_widget( xml, "tf_host" ); + gtk_entry_set_text( GTK_ENTRY(faw->tf_host), DEFAULT_HOST ); + faw->tf_database = glade_xml_get_widget( xml, "tf_database" ); + gtk_entry_set_text( GTK_ENTRY(faw->tf_database), DEFAULT_DATABASE ); + faw->tf_username = glade_xml_get_widget( xml, "tf_username" ); + faw->tf_password = glade_xml_get_widget( xml, "tf_password" ); + op = GTK_BUTTON(glade_xml_get_widget( xml, "pb_op" )); + if( op != NULL ) { + switch( type ) { + case FILE_ACCESS_OPEN: + gtk_button_set_label( op, "gtk-open" ); + fileChooserAction = GTK_FILE_CHOOSER_ACTION_OPEN; + break; + + case FILE_ACCESS_SAVE_AS: + gtk_button_set_label( op, "gtk-save-as" ); + fileChooserAction = GTK_FILE_CHOOSER_ACTION_SAVE; + break; + } + gtk_button_set_use_stock( op, TRUE ); + } + align = glade_xml_get_widget( xml, "alignment_file_chooser" ); + fileChooser = GTK_FILE_CHOOSER_WIDGET(gtk_file_chooser_widget_new( fileChooserAction )); + faw->fileChooser = GTK_FILE_CHOOSER(fileChooser); + gtk_container_add( GTK_CONTAINER(align), GTK_WIDGET(fileChooser) ); + + /* Autoconnect signals */ + glade_xml_signal_autoconnect_full( xml, gnc_glade_autoconnect_full_func, + faw->dialog ); + + /* Clean up the xml data structure when the dialog is destroyed */ + g_object_set_data_full( G_OBJECT(faw->dialog), "dialog-file-access.glade", + xml, g_object_unref ); + g_object_set_data_full( G_OBJECT(faw->dialog), "FileAccessWindow", faw, + g_free ); + + /* Run the dialog */ + gtk_widget_show_all( faw->dialog ); +} + +void +gnc_ui_file_access_for_open( void ) +{ + gnc_ui_file_access( FILE_ACCESS_OPEN ); +} + + +void +gnc_ui_file_access_for_save_as( void ) +{ + gnc_ui_file_access( FILE_ACCESS_SAVE_AS ); +} diff --git a/src/gnome-utils/dialog-file-access.h b/src/gnome-utils/dialog-file-access.h new file mode 100644 index 0000000000..e1c44049f2 --- /dev/null +++ b/src/gnome-utils/dialog-file-access.h @@ -0,0 +1,42 @@ +/********************************************************************\ + * dialog-file-access.h -- dialog for opening a file or making a * + * connection to a libdbi database * + * * + * Copyright (C) 2009 Phil Longstaff (plongstaff@rogers.com) * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License as * + * published by the Free Software Foundation; either version 2 of * + * the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License* + * along with this program; if not, contact: * + * * + * Free Software Foundation Voice: +1-617-542-5942 * + * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 * + * Boston, MA 02110-1301, USA gnu@gnu.org * +\********************************************************************/ + +#ifndef DIALOG_FILE_ACCESS_H +#define DIALOG_FILE_ACCESS_H + +/** @addtogroup GUI + @{ */ +/** @file dialog-file-access.h + * + * This file contains the functions to present a GUI to select + * a file or a database connection. Separate functions exist for + * loading/open and for saving. + */ + +void gnc_ui_file_access_for_open( void ); +void gnc_ui_file_access_for_save_as( void ); + +/** @} */ + +#endif /* DIALOG_FILE_ACCESS_H */ diff --git a/src/gnome-utils/glade/Makefile.am b/src/gnome-utils/glade/Makefile.am index 1ff6f60385..c5776d2687 100644 --- a/src/gnome-utils/glade/Makefile.am +++ b/src/gnome-utils/glade/Makefile.am @@ -3,6 +3,7 @@ glade_DATA = \ commodity.glade \ dialog-book-close.glade \ dialog-database-connection.glade \ + dialog-file-access.glade \ dialog-query-list.glade \ dialog-reset-warnings.glade \ druid-provider-multifile.glade \ diff --git a/src/gnome-utils/glade/dialog-file-access.glade b/src/gnome-utils/glade/dialog-file-access.glade new file mode 100644 index 0000000000..173da10273 --- /dev/null +++ b/src/gnome-utils/glade/dialog-file-access.glade @@ -0,0 +1,266 @@ + + + + + + 5 + GTK_WIN_POS_CENTER_ON_PARENT + GDK_WINDOW_TYPE_HINT_DIALOG + + + + True + 2 + + + True + + + True + + + True + + + True + True + XML + 0 + True + True + rb_sqlite3 + + + + + + True + True + SQLite3 + 0 + True + True + + + + 1 + + + + + True + True + MySQL + 0 + True + True + rb_xml + + + + 2 + + + + + True + True + PostgreSQL + 0 + True + True + rb_xml + + + + 3 + + + + + + + True + 0 + GTK_SHADOW_IN + + + True + 12 + + + True + + + True + + + True + host + + + + + True + database + + + 1 + + + + + True + username + + + 2 + + + + + True + password + + + 3 + + + + + + + True + + + True + True + + + + + True + True + + + 1 + + + + + True + True + + + 2 + + + + + True + True + + + 3 + + + + + 1 + + + + + + + + + True + <b>Database Connection</b> + True + + + label_item + + + + + 1 + + + + + False + + + + + True + 0 + GTK_SHADOW_IN + + + True + 12 + + + + + + + + True + <b>File</b> + True + + + label_item + + + + + 1 + + + + + 1 + + + + + True + GTK_BUTTONBOX_END + + + True + True + True + gtk-cancel + True + -6 + + + + + True + True + True + gtk-save-as + True + -5 + + + 1 + + + + + False + GTK_PACK_END + + + + + + diff --git a/src/gnome/gnc-plugin-basic-commands.c b/src/gnome/gnc-plugin-basic-commands.c index 042b21912f..596965a12c 100644 --- a/src/gnome/gnc-plugin-basic-commands.c +++ b/src/gnome/gnc-plugin-basic-commands.c @@ -41,7 +41,7 @@ #include "dialog-book-close.h" #include "dialog-chart-export.h" -#include "dialog-database-connection.h" +#include "dialog-file-access.h" #include "dialog-fincalc.h" #include "dialog-find-transactions.h" #include "dialog-sx-since-last-run.h" @@ -361,7 +361,11 @@ gnc_main_window_cmd_file_open (GtkAction *action, GncMainWindowActionData *data) return; gnc_window_set_progressbar_window (GNC_WINDOW(data->window)); +#ifdef HAVE_DBI_DBI_H + gnc_ui_file_access_for_open(); +#else gnc_file_open (); +#endif gnc_window_set_progressbar_window (NULL); } @@ -373,7 +377,7 @@ gnc_main_window_cmd_file_db_connection (GtkAction *action, GncMainWindowActionDa if (!gnc_main_window_all_finish_pending()) return; - gnc_ui_database_connection(); + gnc_ui_file_access_for_open(); } static void @@ -399,7 +403,11 @@ gnc_main_window_cmd_file_save_as (GtkAction *action, GncMainWindowActionData *da return; gnc_window_set_progressbar_window (GNC_WINDOW(data->window)); +#ifdef HAVE_DBI_DBI_H + gnc_ui_file_access_for_save_as(); +#else gnc_file_save_as (); +#endif gnc_window_set_progressbar_window (NULL); /* FIXME GNOME 2 Port (update the title etc.) */ }