[cheese/three-point-oh] Fixed bug causing recreation of effects everytime button was toggled



commit 65d575616b27df251dba803ac35a8bb6784f634a
Author: Yuvaraj Pandian T <yuvipanda gmail com>
Date:   Wed Jun 30 14:58:31 2010 +0530

    Fixed bug causing recreation of effects everytime button was toggled

 valasrc/cheese-window.vala |   62 ++++++++++++++++++++++---------------------
 1 files changed, 32 insertions(+), 30 deletions(-)
---
diff --git a/valasrc/cheese-window.vala b/valasrc/cheese-window.vala
index 8e0c273..00ee614 100644
--- a/valasrc/cheese-window.vala
+++ b/valasrc/cheese-window.vala
@@ -436,38 +436,40 @@ public class Cheese.MainWindow : Gtk.Window
   private void setup_effects_selector()
   {
 	  video_preview.hide();
-	  
-	  effects_grid = new Mx.Grid();
-	  effects_scroller = new Mx.ScrollView();
-	  effects_scroller.scroll_policy = Mx.ScrollPolicy.HORIZONTAL;
-	  effects_scroller.enable_gestures = true;
-	  
-	  effects_grid.line_alignment = Mx.Align.MIDDLE;
-	  effects_grid.child_x_align = Mx.Align.MIDDLE;
-	  effects_grid.child_y_align = Mx.Align.MIDDLE;	
-	  effects_grid.orientation = Mx.Orientation.VERTICAL;
-//	  effects_grid.max_stride = 2;
-	  effects_grid.column_spacing = 20;
-	  effects_grid.row_spacing = 20;
-	  
-	  effects_manager = new EffectsManager();
-	  effects_manager.load_effects();
-	  
-	  effects_scroller.add((Clutter.Actor)effects_grid);
-	  
-	  foreach (Effect effect in effects_manager.effects)
+	  if (effects_grid == null)
 	  {
-		  Clutter.Texture texture = new Clutter.Texture();
-		  texture.width = 160;
-		  texture.height = 120;
-
-		  Mx.Button button = new Mx.Button();
-		  button.add((Clutter.Actor)texture);
-		  button.set_data ("effect", effect);
-		  button.clicked.connect (on_selected_effect_change);
+		  effects_grid = new Mx.Grid();
+		  effects_scroller = new Mx.ScrollView();
+		  effects_scroller.scroll_policy = Mx.ScrollPolicy.HORIZONTAL;
+		  effects_scroller.enable_gestures = true;
 		  
-		  effects_grid.add((Clutter.Actor)button);
-		  camera.connect_effect_texture (effect, texture);				
+		  effects_grid.line_alignment = Mx.Align.MIDDLE;
+		  effects_grid.child_x_align = Mx.Align.MIDDLE;
+		  effects_grid.child_y_align = Mx.Align.MIDDLE;	
+		  effects_grid.orientation = Mx.Orientation.VERTICAL;
+
+		  effects_grid.column_spacing = 20;
+		  effects_grid.row_spacing = 20;
+		  
+		  effects_manager = new EffectsManager();
+		  effects_manager.load_effects();
+		  
+		  effects_scroller.add((Clutter.Actor)effects_grid);
+		  
+		  foreach (Effect effect in effects_manager.effects)
+		  {
+			  Clutter.Texture texture = new Clutter.Texture();
+			  texture.width = 160;
+			  texture.height = 120;
+			  
+			  Mx.Button button = new Mx.Button();
+			  button.add((Clutter.Actor)texture);
+			  button.set_data ("effect", effect);
+			  button.clicked.connect (on_selected_effect_change);
+			  
+			  effects_grid.add((Clutter.Actor)button);
+			  camera.connect_effect_texture (effect, texture);				
+		  }
 	  }
 	
 	  viewport_layout.add((Clutter.Actor)effects_scroller);



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