[Rawstudio-commit] r1650 - trunk/src

Anders Brander anders at brander.dk
Tue Mar 4 18:07:02 CET 2008


Author: abrander
Date: 2008-03-04 18:07:02 +0100 (Tue, 04 Mar 2008)
New Revision: 1650

Modified:
   trunk/src/gtk-helper.c
   trunk/src/gtk-interface.c
   trunk/src/gtk-save-dialog.c
Log:
Added some sanity checks before gtk_file_chooser_set_current_folder() where needed.

Modified: trunk/src/gtk-helper.c
===================================================================
--- trunk/src/gtk-helper.c	2008-02-29 07:22:49 UTC (rev 1649)
+++ trunk/src/gtk-helper.c	2008-03-04 17:07:02 UTC (rev 1650)
@@ -440,12 +440,13 @@
 		GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL);
 	gtk_dialog_set_default_response(GTK_DIALOG(fc), GTK_RESPONSE_ACCEPT);
 
-	if (path)
+	if (path && g_file_test(path, G_FILE_TEST_IS_DIR))
 		gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(fc), path);
 	else
 	{
 #define DEAULT_PROFILE_PATH "/usr/share/color/icc"
-		if (g_access(DEAULT_PROFILE_PATH, X_OK)==0)
+		if ((g_access(DEAULT_PROFILE_PATH, X_OK)==0)
+			&& g_file_test(DEAULT_PROFILE_PATH, G_FILE_TEST_IS_DIR))
 			gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(fc),
 				DEAULT_PROFILE_PATH);
 #undef DEAULT_PROFILE_PATH

Modified: trunk/src/gtk-interface.c
===================================================================
--- trunk/src/gtk-interface.c	2008-02-29 07:22:49 UTC (rev 1649)
+++ trunk/src/gtk-interface.c	2008-03-04 17:07:02 UTC (rev 1650)
@@ -313,7 +313,8 @@
 		GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL);
 	gtk_dialog_set_default_response(GTK_DIALOG(fc), GTK_RESPONSE_ACCEPT);
 	
-	gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER (fc), lwd);
+	if (g_file_test(lwd, G_FILE_TEST_IS_DIR))
+		gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER (fc), lwd);
 
 	if (gtk_dialog_run (GTK_DIALOG (fc)) == GTK_RESPONSE_ACCEPT)
 	{

Modified: trunk/src/gtk-save-dialog.c
===================================================================
--- trunk/src/gtk-save-dialog.c	2008-02-29 07:22:49 UTC (rev 1649)
+++ trunk/src/gtk-save-dialog.c	2008-03-04 17:07:02 UTC (rev 1650)
@@ -326,7 +326,8 @@
 #if GTK_CHECK_VERSION(2,8,0)
 	gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (fc), TRUE);
 #endif
-	gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (fc), dirname);
+	if (g_file_test(dirname, G_FILE_TEST_IS_DIR))
+		gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (fc), dirname);
 	gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (fc), name->str);
 	gtk_file_chooser_set_extra_widget(GTK_FILE_CHOOSER (fc), prefbox);
 	if (gtk_dialog_run (GTK_DIALOG (fc)) == GTK_RESPONSE_ACCEPT)




More information about the Rawstudio-commit mailing list