always call gtk_file_chooser_set_current_folder_uri() and

2006-06-16  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpfiledialog.c (gimp_file_dialog_set_image):
	always call gtk_file_chooser_set_current_folder_uri() and
	gtk_file_chooser_set_current_name() instead of
	gtk_file_chooser_set_uri(), since the latter only works if the
	file exists and its return value is bogus. Fixes bug #343284.
This commit is contained in:
Michael Natterer
2006-06-17 09:32:30 +00:00
committed by Michael Natterer
parent cba830e75b
commit c24c1fe064
2 changed files with 21 additions and 16 deletions

View File

@ -1,3 +1,11 @@
2006-06-16 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpfiledialog.c (gimp_file_dialog_set_image):
always call gtk_file_chooser_set_current_folder_uri() and
gtk_file_chooser_set_current_name() instead of
gtk_file_chooser_set_uri(), since the latter only works if the
file exists and its return value is bogus. Fixes bug #343284.
2006-06-17 Sven Neumann <sven@gimp.org>
* app/widgets/gimpview.c: fixed casts to silence compiler warnings.

View File

@ -373,8 +373,9 @@ gimp_file_dialog_set_image (GimpFileDialog *dialog,
GimpImage *image,
gboolean save_a_copy)
{
const gchar *uri = NULL;
gboolean uri_set = FALSE;
const gchar *uri = NULL;
gchar *dirname;
gchar *basename;
g_return_if_fail (GIMP_IS_FILE_DIALOG (dialog));
g_return_if_fail (GIMP_IS_IMAGE (image));
@ -386,25 +387,21 @@ gimp_file_dialog_set_image (GimpFileDialog *dialog,
uri = g_object_get_data (G_OBJECT (image), "gimp-image-save-a-copy");
if (! uri)
uri = gimp_object_get_name (GIMP_OBJECT (image));
if (uri)
uri_set = gtk_file_chooser_set_uri (GTK_FILE_CHOOSER (dialog), uri);
uri = gimp_image_get_uri (image);
gimp_file_dialog_set_file_proc (dialog, NULL);
if (! uri_set)
{
const gchar *name = gimp_image_get_uri (image);
gchar *current;
dirname = g_path_get_dirname (uri);
basename = g_path_get_basename (uri);
if (! name)
name = "";
if (dirname && strlen (dirname))
gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (dialog),
dirname);
current = g_path_get_basename (name);
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), current);
g_free (current);
}
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), basename);
g_free (dirname);
g_free (basename);
}