epiphany r8940 - in trunk: embed embed/webkit lib



Author: gns
Date: Thu Mar 26 15:29:32 2009
New Revision: 8940
URL: http://svn.gnome.org/viewvc/epiphany?rev=8940&view=rev

Log:
Remove downloading files when cancelling the download.

Modified:
   trunk/embed/downloader-view.c
   trunk/embed/webkit/webkit-embed.c
   trunk/lib/ephy-file-helpers.c
   trunk/lib/ephy-file-helpers.h

Modified: trunk/embed/downloader-view.c
==============================================================================
--- trunk/embed/downloader-view.c	(original)
+++ trunk/embed/downloader-view.c	Thu Mar 26 15:29:32 2009
@@ -996,6 +996,7 @@
 	{
 		if (!l->data) continue;
 		webkit_download_cancel ((WebKitDownload*) l->data);
+		ephy_file_delete_uri (webkit_download_get_destination_uri ((WebKitDownload*) l->data));
 		g_object_unref (l->data);
 	}
 	

Modified: trunk/embed/webkit/webkit-embed.c
==============================================================================
--- trunk/embed/webkit/webkit-embed.c	(original)
+++ trunk/embed/webkit/webkit-embed.c	Thu Mar 26 15:29:32 2009
@@ -425,8 +425,10 @@
     dview = EPHY_DOWNLOADER_VIEW (ephy_embed_shell_get_downloader_view (embed_shell));
     downloader_view_add_download (dview, download);
   }
-  else
+  else {
     webkit_download_cancel (download);
+    ephy_file_delete_uri (webkit_download_get_destination_uri (download));
+  }
 
   gtk_widget_destroy (GTK_WIDGET (dialog));
 }

Modified: trunk/lib/ephy-file-helpers.c
==============================================================================
--- trunk/lib/ephy-file-helpers.c	(original)
+++ trunk/lib/ephy-file-helpers.c	Thu Mar 26 15:29:32 2009
@@ -754,3 +754,31 @@
 	}
 	g_object_unref (file);
 }
+
+/**
+ * ephy_file_delete_uri
+ * @uri: URI of the file to be deleted
+ *
+ * Remove the given URI.
+ *
+ */
+void
+ephy_file_delete_uri (const char *uri)
+{
+	GFile *file;
+	gboolean ret;
+
+	file = g_file_new_for_uri (uri);
+
+	ret = g_file_delete (file, NULL, NULL);
+
+	if (ret == TRUE)
+	{
+		LOG ("Deleted file at URI '%s'", uri);
+	}
+	else
+	{
+		LOG ("Couldn't file at URI '%s'", uri);
+	}
+	g_object_unref (file);
+}

Modified: trunk/lib/ephy-file-helpers.h
==============================================================================
--- trunk/lib/ephy-file-helpers.h	(original)
+++ trunk/lib/ephy-file-helpers.h	Thu Mar 26 15:29:32 2009
@@ -103,6 +103,7 @@
 
 void	   ephy_file_delete_directory	 (const char *path);
 
+void	   ephy_file_delete_uri		 (const char *uri);
 G_END_DECLS
 
 #endif /* EPHY_FILE_HELPERS_H */



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