aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDiego Escalante Urrelo <descalante@igalia.com>2010-05-16 09:37:51 +0800
committerDiego Escalante Urrelo <descalante@igalia.com>2010-10-25 14:49:18 +0800
commit0bc6455d757cf8a22ad3936288ff4023ddd7e4a7 (patch)
treea8cfdeeafb355ab2a46a6c4ac24cf79569848fa8 /src
parent107681ebb16674e0cbac5d28966825ff1b05d609 (diff)
downloadgsoc2013-epiphany-0bc6455d757cf8a22ad3936288ff4023ddd7e4a7.tar.gz
gsoc2013-epiphany-0bc6455d757cf8a22ad3936288ff4023ddd7e4a7.tar.zst
gsoc2013-epiphany-0bc6455d757cf8a22ad3936288ff4023ddd7e4a7.zip
popup-commands: use the image name on Open image
Name the temp file "<original_name>.XXXXXX" instead of "viewimageXXXXXX.tmp". Bug #302986
Diffstat (limited to 'src')
-rw-r--r--src/popup-commands.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/src/popup-commands.c b/src/popup-commands.c
index 4db684ea7..1bbce9dce 100644
--- a/src/popup-commands.c
+++ b/src/popup-commands.c
@@ -446,31 +446,34 @@ save_source_completed_cb (EphyEmbedPersist *persist)
static void
save_temp_source (const char *address)
{
- char *tmp, *base;
EphyEmbedPersist *persist;
const char *static_temp_dir;
+ char *base, *tmp_name, *tmp_path, *dest;
+
+ if (address == NULL) return;
static_temp_dir = ephy_file_tmp_dir ();
- if (static_temp_dir == NULL)
- {
- return;
- }
+ if (static_temp_dir == NULL) return;
- base = g_build_filename (static_temp_dir, "viewimageXXXXXX", NULL);
- tmp = ephy_file_tmp_filename (base, "tmp"); /* FIXME */
+ base = g_path_get_basename (address);
+ tmp_name = g_strconcat (base, ".XXXXXX", NULL);
g_free (base);
- if (tmp == NULL)
- {
- return;
- }
+
+ tmp_path = g_build_filename (static_temp_dir, tmp_name, NULL);
+ g_free (tmp_name);
+
+ dest = ephy_file_tmp_filename (tmp_path, NULL);
+ g_free (tmp_path);
+
+ if (dest == NULL) return;
persist = EPHY_EMBED_PERSIST
(g_object_new (EPHY_TYPE_EMBED_PERSIST, NULL));
ephy_embed_persist_set_source (persist, address);
+ ephy_embed_persist_set_dest (persist, dest);
ephy_embed_persist_set_flags (persist, EPHY_EMBED_PERSIST_FROM_CACHE |
EPHY_EMBED_PERSIST_NO_VIEW);
- ephy_embed_persist_set_dest (persist, tmp);
g_signal_connect (persist, "completed",
G_CALLBACK (save_source_completed_cb), NULL);
@@ -478,7 +481,7 @@ save_temp_source (const char *address)
ephy_embed_persist_save (persist);
g_object_unref (persist);
- g_free (tmp);
+ g_free (dest);
}
void