# HG changeset patch # User Sadrul Habib Chowdhury # Date 1242507053 0 # Node ID 126ad62350239094e4d5c4c47e897c8026117b95 # Parent 9e45d860b9af6eb4685bf9430be76b7a99bdd1c0 Preserve the location when defaulting to png for saving unsupported image format. diff -r 9e45d860b9af -r 126ad6235023 pidgin/gtkimhtml.c --- 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, _("Unrecognized file type\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 { /*