Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/f-spot/ChangeLog,v
retrieving revision 1.1546
diff -u -r1.1546 ChangeLog
--- ChangeLog	4 Sep 2006 09:45:05 -0000	1.1546
+++ ChangeLog	5 Sep 2006 19:45:33 -0000
@@ -1,3 +1,9 @@
+2006-09-05  Yves Kurz  <yves.kurz@gmail.com>
+
+	* src/MainWin.cs: Show progress dialog when attaching/removing
+	tags to/from more than five photos and meta data is stored to
+	phtos. 
+	
 2006-09-04  Roozbeh Pournader  <roozbeh@farsiweb.info>
 
 	* configure.in: Add "fa" (Persian) to ALL_LINGUAS.
Index: src/MainWindow.cs
===================================================================
RCS file: /cvs/gnome/f-spot/src/MainWindow.cs,v
retrieving revision 1.305
diff -u -r1.305 MainWindow.cs
--- src/MainWindow.cs	1 Sep 2006 16:20:43 -0000	1.305
+++ src/MainWindow.cs	5 Sep 2006 19:45:36 -0000
@@ -1226,11 +1226,7 @@
 
 	public void HandleAttachTagMenuSelected (Tag t) 
 	{
-		db.BeginTransaction ();
-		foreach (int num in SelectedIds ()) {
-			AddTagExtended (num, new Tag [] {t});
-		}
-		db.CommitTransaction ();
+		AttachTags (new Tag [] {t}, SelectedIds ());
 	}
 	
 	void HandleFindTagMenuSelected (Tag t)
@@ -1240,12 +1236,7 @@
 
 	public void HandleRemoveTagMenuSelected (Tag t)
 	{
-		db.BeginTransaction ();
-		foreach (int num in SelectedIds ()) {
-			query.Photos [num].RemoveTag (t);
-			query.Commit (num);
-		}
-		db.CommitTransaction ();
+		RemoveTags (new Tag [] { t }, SelectedIds ());
 	}
 
 	//
@@ -1667,26 +1658,61 @@
 
 	void AttachTags (Tag [] tags, int [] ids) 
 	{
+		ProgressDialog dialog = null;
+		if ((bool) Preferences.Get (Preferences.METADATA_EMBED_IN_IMAGE) && ids.Length > 5)
+			dialog = new ProgressDialog (Mono.Posix.Catalog.GetString ("Attaching tags"), 
+						ProgressDialog.CancelButtonType.Stop, ids.Length, main_window);
+			
+		main_window.Sensitive = false;
 		db.BeginTransaction ();
 		foreach (int num in ids) {
+			while (Gtk.Global.EventsPending) 
+				Gtk.Main.Iteration ();
+			
 			AddTagExtended (num, tags);
+			
+			if (dialog != null)
+				if (dialog.Update (Mono.Posix.Catalog.GetString ("Attaching tags to selected Photos")))
+					break;
 		}
+		if (dialog != null)
+			dialog.Destroy ();
+	
 		db.CommitTransaction ();
+		main_window.Sensitive = true;
 	}
-
-	public void HandleRemoveTagCommand (object obj, EventArgs args)
+	
+	void RemoveTags (Tag [] tags, int [] ids) 
 	{
-		Tag [] tags = this.tag_selection_widget.TagHighlight;
-
+		ProgressDialog dialog = null;
+		if ((bool) Preferences.Get (Preferences.METADATA_EMBED_IN_IMAGE) && ids.Length > 5)  
+			dialog = new ProgressDialog ("Removing Tags", ProgressDialog.CancelButtonType.Stop, ids.Length, main_window);
+			
+		main_window.Sensitive = false;
 		db.BeginTransaction ();
-		foreach (int num in SelectedIds ()) {
+		foreach (int num in ids) {
+			while (Gtk.Global.EventsPending) 
+				Gtk.Main.Iteration ();
+			
 			Photo p = query.Photos [num];
-
 			p.RemoveTag (tags);
-
 			query.Commit (num);
+			
+			if (dialog != null)
+				if (dialog.Update ("Removing tags to selected Photos")) 
+					break;
 		}
+		if (dialog != null)
+			dialog.Destroy ();
+	
 		db.CommitTransaction ();
+		main_window.Sensitive = true;
+	}
+
+	public void HandleRemoveTagCommand (object obj, EventArgs args)
+	{
+		Tag [] tags = this.tag_selection_widget.TagHighlight;
+		RemoveTags (tags, SelectedIds ());
 	}
 
 	public void HandleEditSelectedTag (object sender, EventArgs ea)
