[f-spot] Don't delete emailed files after a fixed time-out.



commit 4641e0b5183778dabcbaa37fce6d3c82dfd1a106
Author: Dave Neary <dneary gnome org>
Date:   Fri May 14 20:12:28 2010 +0200

    Don't delete emailed files after a fixed time-out.
    
    Instead we, leave it up to the operating system to clear /tmp/.
    
    Fixes BGO #601711 - F-Spot deletes temporary image files too early when
    sending mails
    
    Signed-off-by: Ruben Vermeersch <ruben savanne be>

 src/Preferences.cs |    3 ---
 src/SendEmail.cs   |   36 ++----------------------------------
 2 files changed, 2 insertions(+), 37 deletions(-)
---
diff --git a/src/Preferences.cs b/src/Preferences.cs
index 19d4fd3..706ba47 100644
--- a/src/Preferences.cs
+++ b/src/Preferences.cs
@@ -61,7 +61,6 @@ namespace FSpot
 
 		public const string EXPORT_EMAIL_SIZE = APP_FSPOT + "export/email/size";
 		public const string EXPORT_EMAIL_ROTATE = APP_FSPOT + "export/email/auto_rotate";
-		public const string EXPORT_EMAIL_DELETE_TIMEOUT_SEC = APP_FSPOT + "export/email/delete_timeout_seconds";
 
 		public const string IMPORT_GUI_ROLL_HISTORY = APP_FSPOT + "import/gui_roll_history";
 
@@ -155,8 +154,6 @@ namespace FSpot
 			case EXPORT_EMAIL_ROTATE:
 			case VIEWER_INTERPOLATION:
 				return true;
-			case EXPORT_EMAIL_DELETE_TIMEOUT_SEC:
-				return 30;	// delete temporary email pictures after 30 seconds
 			case VIEWER_TRANSPARENCY:
 				return "NONE";
 			case VIEWER_TRANS_COLOR:
diff --git a/src/SendEmail.cs b/src/SendEmail.cs
index a78ce78..29ce5d1 100644
--- a/src/SendEmail.cs
+++ b/src/SendEmail.cs
@@ -203,26 +203,6 @@ namespace FSpot {
 		}
 
 
-		private bool DeleteTempFile ()
-		{
-//			System.Console.WriteLine ("Lets delete all temp files");
-
-			// Lets delete all the temporary files now
-			for (int k = 0; k < tmp_paths.Count; k++) {
-				if (System.IO.File.Exists((string) tmp_paths[k])) {
-					System.IO.File.Delete ((string) tmp_paths[k]);
-//					System.Console.WriteLine ("Lets delete temp file {0}", tmp_paths[k]);
-				}
-			}
-			
-			if (System.IO.Directory.Exists(tmp_mail_dir)) {
-				System.IO.Directory.Delete(tmp_mail_dir);
-//				System.Console.WriteLine ("Lets delete temp dir {0}", tmp_mail_dir);
-			}
-			
-			return false;
-		}
-
 		private void HandleResponse (object sender, Gtk.ResponseArgs args)
 		{
 			int size = 0;
@@ -323,9 +303,8 @@ namespace FSpot {
 			if (progress_dialog != null) 
 				progress_dialog.Destroy (); // No need to keep this window
 
-			if (UserCancelled)
-				DeleteTempFile();
-			else {		
+
+			if (!UserCancelled) {
 				// Send the mail :)
 				string mail_subject = Catalog.GetString("My Photos");
 				switch (Preferences.Get<string> (Preferences.GNOME_MAILTO_COMMAND)) {
@@ -352,17 +331,6 @@ namespace FSpot {
 					GtkBeans.Global.ShowUri (Dialog.Screen, "mailto:?subject="; + System.Web.HttpUtility.UrlEncode(mail_subject) + mail_attach);
 					break;
 				}
-				                
-				// Check if we have any temporary files to be deleted
-				if (tmp_paths.Count > 0) {
-					// Fetch timeout value from preferences. In seconds. Needs to be multiplied with 1000 to get msec
-					uint delete_timeout;
-					delete_timeout = (uint) (Preferences.Get<int> (Preferences.EXPORT_EMAIL_DELETE_TIMEOUT_SEC));
-					delete_timeout = delete_timeout * 1000; // to get milliseconds.
-
-					// Start a timer and when it occurs, delete the temp files.
-					GLib.Timeout.Add (delete_timeout, new GLib.TimeoutHandler (DeleteTempFile));
-				}
 			}
 		}
 	}



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