nemo r78 - in trunk: gtk uicommon



Author: arj
Date: Wed Feb  6 19:55:26 2008
New Revision: 78
URL: http://svn.gnome.org/viewvc/nemo?rev=78&view=rev

Log:
Redraw more intelligently (=less redrawing = better performance)



Modified:
   trunk/gtk/CalendarDrawer.cs
   trunk/gtk/DisplayItem.cs
   trunk/gtk/FixedResizeWidget.cs
   trunk/gtk/MainWindow.cs
   trunk/uicommon/Item.cs

Modified: trunk/gtk/CalendarDrawer.cs
==============================================================================
--- trunk/gtk/CalendarDrawer.cs	(original)
+++ trunk/gtk/CalendarDrawer.cs	Wed Feb  6 19:55:26 2008
@@ -47,7 +47,7 @@
 
 			GtkCommon.set_background_color(header_wrapper, "white");
 
-                        // 0 = day of week, 1 = day of month, 2 = month
+            // 0 = day of week, 1 = day of month, 2 = month
 			header.Text = String.Format(Mono.Unix.Catalog.GetString("{0}, {1}/{2}"), date.DayOfWeek, date.Day, date.Month);
 			header_wrapper.ButtonPressEvent += delegate { update_view(date); };
 
@@ -441,14 +441,14 @@
 						uint tmp_row = row;
 						ItemWrapper tmp_wrapper = wrapper; // oh lambda bug, we love ye
 				
-						wrapper.item.on_got_data_from_tracker = delegate {
+						wrapper.item.on_data_callback = delegate {
 							calendar_body.Attach(tmp_wrapper.item.Display().get_representation(), tmp_col, tmp_col+1, tmp_row, tmp_row+1, 
 									     	     AttachOptions.Shrink | AttachOptions.Fill | AttachOptions.Expand, 
 												 AttachOptions.Shrink | AttachOptions.Fill,
 												 0,0);
 						};
 						
-						wrapper.item.on_got_data_from_tracker();
+						wrapper.item.on_data_callback();
 
 			            col = ++col % cols;
 			            if (col == 0)
@@ -862,6 +862,8 @@
 				month_button.Active = false;
 			}
 
+			System.Console.WriteLine("calendar show all");
+			
 			calendar.ShowAll();
 		}
 	}

Modified: trunk/gtk/DisplayItem.cs
==============================================================================
--- trunk/gtk/DisplayItem.cs	(original)
+++ trunk/gtk/DisplayItem.cs	Wed Feb  6 19:55:26 2008
@@ -218,8 +218,10 @@
 			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 Feb  6 19:55:26 2008
@@ -147,7 +147,9 @@
 			int box_height = allocation.Height;
 			
 			box_height -= 15; // for more
-		
+
+			int added_files = 0;
+			
 			List<FileLayout.Group> groups = Singleton<FileLayout>.Instance.layout(percent, box_height, line_height, 0, spacing);
 
 			foreach (FileLayout.Group group in groups) {
@@ -168,16 +170,21 @@
 					ItemWrapper tmp_wrapper = element.wrapper; 
 					int tmp_c = c;
 
-					tmp_wrapper.item.on_got_data_from_tracker = delegate {  
+					tmp_wrapper.item.on_labels_callback = delegate {  
 						Remove(b);
 
 						b = create_right_click_button<RightClickItemButton>(tmp_wrapper.item, allocation.Width); 
 						Put(b, 0, begin+tmp_c*line_height);
 						ShowAll();
+					};					
+					
+					tmp_wrapper.item.on_data_callback = delegate {  
+						b.set_item(tmp_wrapper.item);
+						GtkCommon.create_preview(tmp_wrapper.item, b, b);
 					};
 
-					tmp_wrapper.item.on_labels_callback = tmp_wrapper.item.on_got_data_from_tracker; 
-
+					added_files += 1;
+					
 					Put(b, 0, begin+tmp_c*line_height);
             		
 		            c += 1;
@@ -246,7 +253,10 @@
 				}
 			}
 			
-           	ShowAll();
+			System.Console.WriteLine("showing all in fixed resize widget {0}", added_files);
+			
+			if (added_files > 0) // the ShowAll call in calendardrawer will take care of drawing it with no elements   
+				ShowAll();
 		}
 
 		public class MorePopup : Overlay

Modified: trunk/gtk/MainWindow.cs
==============================================================================
--- trunk/gtk/MainWindow.cs	(original)
+++ trunk/gtk/MainWindow.cs	Wed Feb  6 19:55:26 2008
@@ -265,7 +265,8 @@
 
 				if (Nemo.DocumentItem.is_document(result[0]))
 				{
-					Nemo.VoidFunction callback = wrapper.item.on_got_data_from_tracker;
+					Nemo.VoidFunction data_callback = wrapper.item.on_data_callback;
+					Nemo.VoidFunction label_callback = wrapper.item.on_labels_callback;
 					
 					// in case something was changed before we got data from tracker
 					wrapper.item.file.labels.Clear();
@@ -273,15 +274,20 @@
 						wrapper.item.file.labels.Add(l.metalabel);
 
 					wrapper.item = new Nemo.DocumentItem(wrapper.item.file, result, search_input.Text); 
-					if (callback != null) {
-						wrapper.item.on_got_data_from_tracker = callback;
-						wrapper.item.on_labels_callback = callback;
-						wrapper.item.on_got_data_from_tracker();
+
+					if (data_callback != null) {
+						wrapper.item.on_data_callback = data_callback;
+						wrapper.item.on_data_callback();
+					}
+					
+					if (label_callback != null) {
+						wrapper.item.on_labels_callback = label_callback;
 					}
 				} 
 				else if (Nemo.PictureItem.is_image(result[0])) 
 				{
-					Nemo.VoidFunction callback = wrapper.item.on_got_data_from_tracker;
+					Nemo.VoidFunction data_callback = wrapper.item.on_data_callback;
+					Nemo.VoidFunction label_callback = wrapper.item.on_labels_callback;
 
 					// in case something was changed before we got data from tracker
 					wrapper.item.file.labels.Clear();
@@ -289,10 +295,14 @@
 						wrapper.item.file.labels.Add(l.metalabel);
 
 					wrapper.item = new Nemo.PictureItem(wrapper.item.file, result); 
-					if (callback != null) {
-						wrapper.item.on_got_data_from_tracker = callback;
-						wrapper.item.on_labels_callback = callback;
-						wrapper.item.on_got_data_from_tracker();
+
+					if (data_callback != null) {
+						wrapper.item.on_data_callback = data_callback;
+						wrapper.item.on_data_callback();
+					}
+					
+					if (label_callback != null) {
+						wrapper.item.on_labels_callback = label_callback;
 					}
 				} else 
 					wrapper.item.mime_type = result[0];

Modified: trunk/uicommon/Item.cs
==============================================================================
--- trunk/uicommon/Item.cs	(original)
+++ trunk/uicommon/Item.cs	Wed Feb  6 19:55:26 2008
@@ -54,7 +54,7 @@
 		public List<UserLabel> labels;
 
 		public VoidFunction on_labels_callback;
-		public VoidFunction on_got_data_from_tracker;
+		public VoidFunction on_data_callback;
 
 		public string name(int length)
 		{



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