[gnome-devel-docs] Sample grid.vala: replaced lambda function.



commit 4ea578795094e299a8e82a2d202df4d97f8292ec
Author: Tiffany Antopolski <tiffany antopolski gmail com>
Date:   Sat May 5 16:09:06 2012 -0400

    Sample grid.vala: replaced lambda function.

 platform-demos/C/samples/grid.vala |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/platform-demos/C/samples/grid.vala b/platform-demos/C/samples/grid.vala
index a28c1fa..f19b06d 100644
--- a/platform-demos/C/samples/grid.vala
+++ b/platform-demos/C/samples/grid.vala
@@ -1,15 +1,15 @@
 public class MyWindow : Gtk.ApplicationWindow {
 
+	Gtk.Widget progress_bar;
+
 	internal MyWindow (MyApplication app) {
 		Object (application: app, title: "Grid Example");
 		var grid = new Gtk.Grid();
-		var progress_bar = new Gtk.ProgressBar ();
+		progress_bar = new Gtk.ProgressBar ();
 		progress_bar.show ();
 
 		var button = new Gtk.Button.with_label ("Button");
-		button.clicked.connect (() => {
-				progress_bar.pulse ();
-		});
+		button.clicked.connect (on_button_click);
 		button.show ();
 
 		this.add(grid);
@@ -17,6 +17,10 @@ public class MyWindow : Gtk.ApplicationWindow {
 		grid.attach_next_to (progress_bar, button, Gtk.PositionType.BOTTOM, 1, 1);
 		grid.show ();
 	}
+
+	void on_button_click (Gtk.Button button) {
+		(progress_bar as Gtk.ProgressBar).pulse ();
+	}
 }
 
 public class MyApplication : Gtk.Application {



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