[totem] browser-plugin: Only delete copies we made



commit 08541cab1d667d5cf61f592cf64d261625b2d272
Author: Bastien Nocera <hadess hadess net>
Date:   Sun Dec 4 16:23:55 2011 +0100

    browser-plugin: Only delete copies we made
    
    Not random files that might not belong to us.

 browser-plugin/totem-plugin-viewer.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/browser-plugin/totem-plugin-viewer.c b/browser-plugin/totem-plugin-viewer.c
index 3ba2b45..793d8c8 100644
--- a/browser-plugin/totem-plugin-viewer.c
+++ b/browser-plugin/totem-plugin-viewer.c
@@ -127,6 +127,7 @@ typedef struct _TotemEmbedded {
 	GList *playlist, *current;
 	guint parser_id;
 	int num_items;
+	gboolean remove_copy;
 
 	/* Open menu item */
 	GAppInfo *app;
@@ -1027,6 +1028,7 @@ totem_embedded_set_playlist (TotemEmbedded *emb,
 		g_object_unref (dst);
 		close (fd);
 
+		emb->remove_copy = TRUE;
 		totem_embedded_set_uri (emb, file_uri, base_uri, NULL, FALSE);
 		g_free (file_uri);
 	} else {
@@ -2079,7 +2081,6 @@ totem_embedded_push_parser (gpointer data)
 	TotemEmbedded *emb = (TotemEmbedded *) data;
 	TotemPlParser *parser;
 	TotemPlParserResult res;
-	GFile *file;
 
 	emb->parser_id = 0;
 
@@ -2094,9 +2095,16 @@ totem_embedded_push_parser (gpointer data)
 
 	/* Delete the temporary file created in
 	 * totem_embedded_set_playlist */
-	file = g_file_new_for_uri (emb->current_uri);
-	g_file_delete (file, NULL, NULL);
-	g_object_unref (file);
+	if (emb->remove_copy) {
+		GFile *file;
+
+		file = g_file_new_for_uri (emb->current_uri);
+		g_file_delete (file, NULL, NULL);
+		g_object_unref (file);
+
+		/* And reset */
+		emb->remove_copy = FALSE;
+	}
 
 	/* FIXME: show a proper error message */
 	switch (res) {



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