r17979 - gnucash/trunk/src/gnome-utils - Disable radio buttons for access types (sqlite3/mysql/pgsql) which don't have a qof backend
Phil Longstaff
plongstaff at cvs.gnucash.org
Sat Mar 7 12:46:25 EST 2009
Author: plongstaff
Date: 2009-03-07 12:46:25 -0500 (Sat, 07 Mar 2009)
New Revision: 17979
Trac: http://svn.gnucash.org/trac/changeset/17979
Modified:
gnucash/trunk/src/gnome-utils/dialog-file-access.c
Log:
Disable radio buttons for access types (sqlite3/mysql/pgsql) which don't have a qof backend
registered.
Modified: gnucash/trunk/src/gnome-utils/dialog-file-access.c
===================================================================
--- gnucash/trunk/src/gnome-utils/dialog-file-access.c 2009-03-07 17:36:13 UTC (rev 17978)
+++ gnucash/trunk/src/gnome-utils/dialog-file-access.c 2009-03-07 17:46:25 UTC (rev 17979)
@@ -236,6 +236,8 @@
GtkWidget* align;
GtkFileChooserWidget* fileChooser;
GtkFileChooserAction fileChooserAction;
+ GList* list;
+ GList* node;
g_return_if_fail( type == FILE_ACCESS_OPEN || type == FILE_ACCESS_SAVE_AS );
@@ -284,6 +286,24 @@
glade_xml_signal_autoconnect_full( xml, gnc_glade_autoconnect_full_func,
faw->dialog );
+ /* See what qof backends are available, and disable sqlite3, mysql and postgres if not
+ available */
+ gtk_widget_set_sensitive( faw->rb_sqlite3, FALSE );
+ gtk_widget_set_sensitive( faw->rb_mysql, FALSE );
+ gtk_widget_set_sensitive( faw->rb_pgsql, FALSE );
+ list = qof_backend_get_registered_access_method_list();
+ for( node = list; node != NULL; node = node->next ) {
+ const gchar* access_method = node->data;
+ if( strcmp( access_method, "sqlite3" ) == 0 ) {
+ gtk_widget_set_sensitive( faw->rb_sqlite3, TRUE );
+ } else if( strcmp( access_method, "mysql" ) == 0 ) {
+ gtk_widget_set_sensitive( faw->rb_mysql, TRUE );
+ } else if( strcmp( access_method, "postgres" ) == 0 ) {
+ gtk_widget_set_sensitive( faw->rb_pgsql, TRUE );
+ }
+ }
+ g_list_free(list);
+
/* 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 );
More information about the gnucash-changes
mailing list