Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarlos Garcia Campos <carlosgc@gnome.org>2008-03-19 16:24:50 (GMT)
committer Carlos Garcia Campos <carlosgc@src.gnome.org>2008-03-19 16:24:50 (GMT)
commit08a9f7ae85046d4b4434927a2f0fbe8642287089 (patch)
tree42a2608965eccec4256a023716a3f5d00df889c7
parent65fc8ed56ee130a477f165dd82e34459d5066e69 (diff)
Do not append the extension to filename when saving an image if the
2008-03-19 Carlos Garcia Campos <carlosgc@gnome.org> * shell/ev-window.c: (image_save_dialog_response_cb): Do not append the extension to filename when saving an image if the filename alredy contains the extension. Fixes bug #523069. svn path=/trunk/; revision=2972
-rw-r--r--ChangeLog7
-rw-r--r--shell/ev-window.c21
2 files changed, 19 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 7628ac2..bf084c5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-03-19 Carlos Garcia Campos <carlosgc@gnome.org>
+
+ * shell/ev-window.c: (image_save_dialog_response_cb):
+
+ Do not append the extension to filename when saving an image
+ if the filename alredy contains the extension. Fixes bug #523069.
+
2008-03-18 Carlos Garcia Campos <carlosgc@gnome.org>
* shell/ev-view.[ch]: (ev_view_find_cancel):
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 3431fad..9b2dede 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -4754,7 +4754,6 @@ image_save_dialog_response_cb (GtkWidget *fc,
GError *error = NULL;
GdkPixbuf *pixbuf;
gchar *uri;
- gchar *uri_extension;
gchar **extensions;
gchar *filename;
gchar *file_format;
@@ -4785,27 +4784,31 @@ image_save_dialog_response_cb (GtkWidget *fc,
}
extensions = gdk_pixbuf_format_get_extensions (format);
- uri_extension = g_strconcat (uri, ".", extensions[0], NULL);
+ if (strcmp (extensions[0], uri + strlen (uri) - strlen (extensions[0])) != 0) {
+ gchar *uri_extension;
+
+ uri_extension = g_strconcat (uri, ".", extensions[0], NULL);
+ target_file = g_file_new_for_uri (uri_extension);
+ g_free (uri_extension);
+ } else {
+ target_file = g_file_new_for_uri (uri);
+ }
g_strfreev(extensions);
- file_format = gdk_pixbuf_format_get_name (format);
+ g_free (uri);
- target_file = g_file_new_for_uri (uri_extension);
is_native = g_file_is_native (target_file);
-
if (is_native) {
filename = g_file_get_path (target_file);
} else {
filename = ev_tmp_filename ("saveimage");
}
-
- g_free (uri);
- g_free (uri_extension);
ev_document_doc_mutex_lock ();
pixbuf = ev_document_images_get_image (EV_DOCUMENT_IMAGES (ev_window->priv->document),
ev_window->priv->image);
ev_document_doc_mutex_unlock ();
-
+
+ file_format = gdk_pixbuf_format_get_name (format);
gdk_pixbuf_save (pixbuf, filename, file_format, &error, NULL);
g_free (file_format);
g_object_unref (pixbuf);