[gnome-devel-docs] Samples: Gtk.Grid Vala example



commit b943f9d30c08473b02adac0ccc655435e5cd46ce
Author: Tiffany Antopolski <tiffany antopolski gmail com>
Date:   Sat May 5 00:58:09 2012 -0400

    Samples: Gtk.Grid Vala example

 platform-demos/C/grid.vala.page    |   29 +++++++++++++++++++++++++++++
 platform-demos/C/samples/grid.vala |   36 ++++++++++++++++++++++++++++++++++++
 platform-demos/Makefile.am         |    2 ++
 3 files changed, 67 insertions(+), 0 deletions(-)
---
diff --git a/platform-demos/C/grid.vala.page b/platform-demos/C/grid.vala.page
new file mode 100644
index 0000000..cfa5a55
--- /dev/null
+++ b/platform-demos/C/grid.vala.page
@@ -0,0 +1,29 @@
+<page xmlns="http://projectmallard.org/1.0/";
+      xmlns:xi="http://www.w3.org/2001/XInclude";
+      type="guide" style="task"
+      id="grid.vala">
+  <info>
+    <link type="guide" xref="beginner.vala#layout"/>
+    <revision version="0.1" date="2012-05-04" status="draft"/>
+
+    <credit type="author copyright">
+      <name>Tiffany Antopolski</name>
+      <email>tiffany antopolski gmail com</email>
+      <years>2012</years>
+    </credit>
+
+    <desc>Pack widgets in rows and columns</desc>
+  </info>
+
+  <title>Grid widget</title>
+  <media type="image" mime="image/png" src="media/grid.png"/>
+  <p>A button widget connected to a progress bar.</p>
+
+<code mime="text/x-vala" style="numbered"><xi:include href="samples/grid.vala" parse="text"><xi:fallback/></xi:include></code>
+<p>
+  In this sample we used the following:
+</p>
+<list>
+  <item><p><link href="http://references.valadoc.org/#!api=gtk+-3.0/Gtk.Grid";>Gtk.Grid</link></p></item>
+</list>
+</page>
diff --git a/platform-demos/C/samples/grid.vala b/platform-demos/C/samples/grid.vala
new file mode 100644
index 0000000..a28c1fa
--- /dev/null
+++ b/platform-demos/C/samples/grid.vala
@@ -0,0 +1,36 @@
+public class MyWindow : Gtk.ApplicationWindow {
+
+	internal MyWindow (MyApplication app) {
+		Object (application: app, title: "Grid Example");
+		var grid = new Gtk.Grid();
+		var progress_bar = new Gtk.ProgressBar ();
+		progress_bar.show ();
+
+		var button = new Gtk.Button.with_label ("Button");
+		button.clicked.connect (() => {
+				progress_bar.pulse ();
+		});
+		button.show ();
+
+		this.add(grid);
+		grid.attach(button, 1, 1, 1, 1);
+		grid.attach_next_to (progress_bar, button, Gtk.PositionType.BOTTOM, 1, 1);
+		grid.show ();
+	}
+}
+
+public class MyApplication : Gtk.Application {
+	protected override void activate () {
+
+		new MyWindow (this).show ();
+	}
+
+	internal MyApplication () {
+		Object (application_id: "org.example.MyApplication");
+
+	}
+}
+
+public int main (string[] args) {
+	return new MyApplication ().run (args);
+}
diff --git a/platform-demos/Makefile.am b/platform-demos/Makefile.am
index da2db9d..1b300c7 100644
--- a/platform-demos/Makefile.am
+++ b/platform-demos/Makefile.am
@@ -30,6 +30,7 @@ demo_sources = \
 	samples/gmenu.py			\
 	samples/gmenu.vala			\
 	samples/grid.py				\
+	samples/grid.vala			\
 	samples/GtkApplicationWindow.c		\
         samples/GtkApplicationWindow.js		\
 	samples/GtkApplicationWindow.py		\
@@ -93,6 +94,7 @@ DOC_PAGES =				\
 	getting-ready.page		\
 	grid_with_entry.js.page		\
 	grid.js.page			\
+	grid.vala.page			\
 	gmenu.c.page			\
 	gmenu.js.page			\
 	gmenu.py.page			\



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