[epiphany] popup-commands: use the image name on Open image



commit 0bc6455d757cf8a22ad3936288ff4023ddd7e4a7
Author: Diego Escalante Urrelo <descalante igalia com>
Date:   Sat May 15 20:37:51 2010 -0500

    popup-commands: use the image name on Open image
    
    Name the temp file "<original_name>.XXXXXX" instead of "viewimageXXXXXX.tmp".
    
    Bug #302986

 src/popup-commands.c |   29 ++++++++++++++++-------------
 1 files changed, 16 insertions(+), 13 deletions(-)
---
diff --git a/src/popup-commands.c b/src/popup-commands.c
index 4db684e..1bbce9d 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



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]