changeset 26972:126ad6235023

Preserve the location when defaulting to png for saving unsupported image format.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 16 May 2009 20:50:53 +0000
parents 9e45d860b9af
children 4bba5827b7fc
files pidgin/gtkimhtml.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkimhtml.c	Sat May 16 20:37:08 2009 +0000
+++ b/pidgin/gtkimhtml.c	Sat May 16 20:50:53 2009 +0000
@@ -3714,6 +3714,7 @@
 		   it's a png */
 		if (!type){
 			char *basename, *tmp;
+			char *dirname;
 #if GTK_CHECK_VERSION(2,4,0)
 			GtkWidget *dialog = gtk_message_dialog_new_with_markup(NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
 							_("<span size='larger' weight='bold'>Unrecognized file type</span>\n\nDefaulting to PNG."));
@@ -3726,11 +3727,13 @@
 			gtk_widget_show(dialog);
 
 			type = g_strdup("png");
+			dirname = g_path_get_dirname(filename);
 			basename = g_path_get_basename(filename);
 			tmp = strrchr(basename, '.');
 			if (tmp != NULL)
 				tmp[0] = '\0';
-			newfilename = g_strdup_printf("%s.png", basename);
+			newfilename = g_strdup_printf("%s" G_DIR_SEPARATOR_S  "%s.png", dirname, basename);
+			g_free(dirname);
 			g_free(basename);
 		} else {
 			/*