pidgin: 74274694: Preserve the location when defaulting to...

sadrul at pidgin.im sadrul at pidgin.im
Sat May 16 16:45:36 EDT 2009


-----------------------------------------------------------------
Revision: 7427469432399386537a063a99a515185e8437db
Ancestor: 4b868c40c990df3155a7300397fb9bcd9971fcd5
Author: sadrul at pidgin.im
Date: 2009-05-16T20:50:53
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/7427469432399386537a063a99a515185e8437db

Modified files:
        pidgin/gtkimhtml.c

ChangeLog: 

Preserve the location when defaulting to png for saving unsupported image format.

-------------- next part --------------
============================================================
--- pidgin/gtkimhtml.c	71db140247eb797275efe1e601ed1633aacbd97d
+++ pidgin/gtkimhtml.c	0ff7cf82b741606d67da89aca88455c15274561c
@@ -3714,6 +3714,7 @@ image_save_yes_cb(GtkIMHtmlImageSave *sa
 		   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 @@ image_save_yes_cb(GtkIMHtmlImageSave *sa
 			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 {
 			/*


More information about the Commits mailing list