nemo r123 - in trunk: gtk uicommon



Author: arj
Date: Wed Aug  6 15:35:41 2008
New Revision: 123
URL: http://svn.gnome.org/viewvc/nemo?rev=123&view=rev

Log:
Fix some problems with starred update functions

- Sometimes the update functions was called many times
- Update the preview with new view didn't work properly. Resulting in
  missing pictures



Modified:
   trunk/gtk/Cairo.cs
   trunk/gtk/DisplayItem.cs
   trunk/gtk/FixedResizeWidget.cs
   trunk/gtk/SearchPopup.cs
   trunk/uicommon/DocumentItem.cs
   trunk/uicommon/Item.cs
   trunk/uicommon/PictureItem.cs

Modified: trunk/gtk/Cairo.cs
==============================================================================
--- trunk/gtk/Cairo.cs	(original)
+++ trunk/gtk/Cairo.cs	Wed Aug  6 15:35:41 2008
@@ -168,4 +168,4 @@
 			gr.Stroke();
 		}
 	}
-}
\ No newline at end of file
+}

Modified: trunk/gtk/DisplayItem.cs
==============================================================================
--- trunk/gtk/DisplayItem.cs	(original)
+++ trunk/gtk/DisplayItem.cs	Wed Aug  6 15:35:41 2008
@@ -223,10 +223,8 @@
 			if (picture_wrapper != null)
 				picture_wrapper.Add(picture);
 
-#if false
 			if (representation != null)
 				representation.ShowAll();
-#endif
 		}
 		
 		public DisplayItem(Item item)

Modified: trunk/gtk/FixedResizeWidget.cs
==============================================================================
--- trunk/gtk/FixedResizeWidget.cs	(original)
+++ trunk/gtk/FixedResizeWidget.cs	Wed Aug  6 15:35:41 2008
@@ -52,7 +52,7 @@
 				
 				b.set_picture(img_alignment, image);
 				
-				item.register_starred_change(b.update_starred);
+				item.register_small_starred_change(b.update_starred);
 				
 //				Gtk.Image img = new Gtk.Image(null, image);
 				img_alignment.Add(b.picture);

Modified: trunk/gtk/SearchPopup.cs
==============================================================================
--- trunk/gtk/SearchPopup.cs	(original)
+++ trunk/gtk/SearchPopup.cs	Wed Aug  6 15:35:41 2008
@@ -340,7 +340,7 @@
 				else
 					img = new Gtk.Image(null, image); 
 				
-				item.register_starred_change(delegate(bool starred) {
+				item.register_small_starred_change(delegate(bool starred) {
 					foreach (Widget w in img_alignment)
 						w.Destroy();
 					if (starred)

Modified: trunk/uicommon/DocumentItem.cs
==============================================================================
--- trunk/uicommon/DocumentItem.cs	(original)
+++ trunk/uicommon/DocumentItem.cs	Wed Aug  6 15:35:41 2008
@@ -56,7 +56,7 @@
 			set_page_count(fields[fields_index+1]);
 
 			display_item = new DisplayDocumentItem(pages, title, this);
-			register_starred_change(display_item.update_starred);
+			register_big_starred_change(display_item.update_starred);
 			display_item.set_labels();
         }
 
@@ -197,4 +197,4 @@
             }
         }
 	}
-}
\ No newline at end of file
+}

Modified: trunk/uicommon/Item.cs
==============================================================================
--- trunk/uicommon/Item.cs	(original)
+++ trunk/uicommon/Item.cs	Wed Aug  6 15:35:41 2008
@@ -92,8 +92,8 @@
 			if (extension.Length > 4)
 				extension = extension.Substring(0, 4);
 
-        	display_item = new DisplayItem(this);
-			register_starred_change(display_item.update_starred);
+			display_item = new DisplayItem(this);
+			register_big_starred_change(display_item.update_starred);
 
 			foreach (MetaLabel label in file.labels)
 				labels.Add(new UserLabel(label));
@@ -107,7 +107,6 @@
 			this.path = path;
 
 			labels = new List<UserLabel>();
-			starred_update_functions = new List<VoidFunction<bool>>();
 		}
 
 		public string image()
@@ -120,11 +119,17 @@
             Process.Start("'" + path + "'");
 		}
 
-		List<VoidFunction<bool>> starred_update_functions;
+	        VoidFunction<bool> small_starred_update_function;
+   	        VoidFunction<bool> big_starred_update_function;
 
-		public void register_starred_change(VoidFunction<bool> update_function)
+		public void register_small_starred_change(VoidFunction<bool> update_function)
 		{
-			starred_update_functions.Add(update_function);
+			small_starred_update_function = update_function;
+		}
+		
+		public void register_big_starred_change(VoidFunction<bool> update_function)
+		{
+			big_starred_update_function = update_function;
 		}
 		
 		public void update_starred()
@@ -133,8 +138,11 @@
 			
 			Singleton<SingletonWrapper<Broker>>.Instance.wrapped.set_starred(file, file.starred);
 
-			foreach (VoidFunction<bool> func in starred_update_functions)
-				func(file.starred);
+			if (small_starred_update_function != null)
+			    small_starred_update_function(file.starred);
+
+			if (big_starred_update_function != null)
+			    big_starred_update_function(file.starred);
 		}
 		
 		// labels
@@ -194,4 +202,4 @@
 			return String.Format("{0:HH:mm:ss} {0:dd/MM/yy}", date); // {0:HH:mm:ss} 
         }
 	}
-}
\ No newline at end of file
+}

Modified: trunk/uicommon/PictureItem.cs
==============================================================================
--- trunk/uicommon/PictureItem.cs	(original)
+++ trunk/uicommon/PictureItem.cs	Wed Aug  6 15:35:41 2008
@@ -53,8 +53,8 @@
 			string resolution = width + "x" + height;
 			
 			display_item = (DisplayItem) new DisplayPictureItem(resolution, this);
-			register_starred_change(display_item.update_starred);
+			register_big_starred_change(display_item.update_starred);
 			display_item.set_labels();
         }
 	}
-}
\ No newline at end of file
+}



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