Commit ce42884e authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

app/dialogs/file-open-dialog.c (file_open_dialog_response) don't bail out

2005-02-12  Michael Natterer  <mitch@gimp.org>

	* app/dialogs/file-open-dialog.c (file_open_dialog_response)
	* app/dialogs/file-save-dialog.c (file_save_dialog_response):
	don't bail out if filename_from_uri() returns NULL. Perform
	checks for G_FILE_TEST_IS_REGULAR and G_FILE_TEST_EXISTS
	only on local files.

	(This brings up the problem that we will overwrite existing remote
	files without warning. Need to fix that before enabling remote
	files in GimpFileDialog).
parent fc677ae7
2005-02-12 Michael Natterer <mitch@gimp.org>
* app/dialogs/file-open-dialog.c (file_open_dialog_response)
* app/dialogs/file-save-dialog.c (file_save_dialog_response):
don't bail out if filename_from_uri() returns NULL. Perform
checks for G_FILE_TEST_IS_REGULAR and G_FILE_TEST_EXISTS
only on local files.
(This brings up the problem that we will overwrite existing remote
files without warning. Need to fix that before enabling remote
files in GimpFileDialog).
2005-02-12 Michael Natterer <mitch@gimp.org>
* libgimpbase/gimpbaseenums.h (enum GimpProgressCommand):
......
......@@ -124,36 +124,41 @@ file_open_dialog_response (GtkWidget *open_dialog,
{
gchar *filename = file_utils_filename_from_uri (list->data);
if (g_file_test (filename, G_FILE_TEST_IS_REGULAR))
if (filename)
{
if (dialog->gimage)
gboolean regular = g_file_test (filename, G_FILE_TEST_IS_REGULAR);
g_free (filename);
if (! regular)
continue;
}
if (dialog->gimage)
{
if (file_open_dialog_open_layer (open_dialog,
dialog->gimage,
list->data,
list->data,
dialog->file_proc))
{
if (file_open_dialog_open_layer (open_dialog,
dialog->gimage,
list->data,
list->data,
dialog->file_proc))
{
success = TRUE;
}
success = TRUE;
}
else
}
else
{
if (file_open_dialog_open_image (open_dialog,
gimp,
list->data,
list->data,
dialog->file_proc))
{
if (file_open_dialog_open_image (open_dialog,
gimp,
list->data,
list->data,
dialog->file_proc))
{
success = TRUE;
gdk_window_raise (open_dialog->window);
}
success = TRUE;
gdk_window_raise (open_dialog->window);
}
}
g_free (filename);
if (dialog->canceled)
break;
}
......
......@@ -134,11 +134,17 @@ file_save_dialog_response (GtkWidget *save_dialog,
if (uri && strlen (uri))
{
gchar *filename = file_utils_filename_from_uri (uri);
gchar *filename = file_utils_filename_from_uri (uri);
gboolean exists = FALSE;
g_return_if_fail (filename != NULL);
if (filename)
{
exists = g_file_test (filename, G_FILE_TEST_EXISTS);
g_free (filename);
}
if (g_file_test (filename, G_FILE_TEST_EXISTS))
if (exists)
{
file_save_overwrite (save_dialog, uri, uri);
}
......@@ -159,7 +165,6 @@ file_save_dialog_response (GtkWidget *save_dialog,
gimp_file_dialog_set_sensitive (dialog, TRUE);
}
g_free (filename);
g_free (uri);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment