r18705 - gnucash/trunk/src/gnome-utils - Make sure file urls actually contain path information or are NULL

Geert Janssens gjanssens at code.gnucash.org
Sun Feb 21 18:04:44 EST 2010


Author: gjanssens
Date: 2010-02-21 18:04:44 -0500 (Sun, 21 Feb 2010)
New Revision: 18705
Trac: http://svn.gnucash.org/trac/changeset/18705

Modified:
   gnucash/trunk/src/gnome-utils/dialog-file-access.c
Log:
Make sure file urls actually contain path information or are NULL

Modified: gnucash/trunk/src/gnome-utils/dialog-file-access.c
===================================================================
--- gnucash/trunk/src/gnome-utils/dialog-file-access.c	2010-02-21 18:47:42 UTC (rev 18704)
+++ gnucash/trunk/src/gnome-utils/dialog-file-access.c	2010-02-21 23:04:44 UTC (rev 18705)
@@ -78,10 +78,13 @@
 	file = gtk_file_chooser_get_filename( faw->fileChooser );
 
 	type = gtk_combo_box_get_active_text( faw->cb_uri_type );
+	if ( (( strcmp( type, "xml" ) == 0 ) ||
+	      ( strcmp( type, "sqlite3" ) == 0 ) ||
+	      ( strcmp( type, "file" ) == 0 )) &&
+	        ( file == NULL ) )
+	    return NULL;
+
 	if( strcmp( type, "xml" ) == 0 ) {
-	    if( file == NULL ) {
-		    return NULL;
-		}
 		url = g_strdup_printf( "xml://%s", file );
 	} else if( strcmp( type, "sqlite3" ) == 0 ) {
 		url = g_strdup_printf( "sqlite3://%s", file );
@@ -115,7 +118,7 @@
     case GTK_RESPONSE_HELP:
         gnc_gnome_help( HF_HELP, HL_GLOBPREFS );
         break;
-  
+
 	case GTK_RESPONSE_OK:
 		url = geturl( faw );
 		if( url == NULL ) {
@@ -276,7 +279,7 @@
 	uri_type_container = glade_xml_get_widget( xml, "vb_uri_type_container" );
 	faw->cb_uri_type = GTK_COMBO_BOX(gtk_combo_box_new_text());
 	gtk_container_add( GTK_CONTAINER(uri_type_container), GTK_WIDGET(faw->cb_uri_type) );
-	gtk_box_set_child_packing( GTK_BOX(uri_type_container), GTK_WIDGET(faw->cb_uri_type), 
+	gtk_box_set_child_packing( GTK_BOX(uri_type_container), GTK_WIDGET(faw->cb_uri_type),
 								/*expand*/TRUE, /*fill*/FALSE, /*padding*/0, GTK_PACK_START );
 	g_object_connect( G_OBJECT(faw->cb_uri_type),
 					"signal::changed", cb_uri_type_changed_cb, NULL,
@@ -336,7 +339,7 @@
 	if( need_access_method_xml ) {
 		gtk_combo_box_append_text( faw->cb_uri_type, "xml" );
 		++access_method_index;
-		
+
 		// Set XML as default if it is offered (which mean we are in
 		// the "Save As" dialog)
 		active_access_method_index = access_method_index;
@@ -349,8 +352,8 @@
 
     /* Run the dialog */
     gtk_widget_show_all( faw->dialog );
-    
-    /* Hide the frame that's not required for the active access method so either only 
+
+    /* Hide the frame that's not required for the active access method so either only
      * the File or only the Database frame are presented. */
     gtk_combo_box_set_active( faw->cb_uri_type, active_access_method_index );
     set_widget_sensitivity_for_uri_type( faw, gtk_combo_box_get_active_text( faw->cb_uri_type ) );



More information about the gnucash-changes mailing list