[gnome-devel-docs] Vala GtkImage sample added.



commit 4366a427bcded7ec4180168103f053a23a8ae0e3
Author: Tiffany Antopolski <tiffany antopolski gmail com>
Date:   Thu May 3 21:51:21 2012 -0400

    Vala GtkImage sample added.

 platform-demos/C/image.vala.page         |   33 ++++++++++++++++++++++++++++++
 platform-demos/C/media/gnome-image.png   |  Bin 0 -> 33988 bytes
 platform-demos/C/media/image.png         |  Bin 0 -> 39988 bytes
 platform-demos/C/samples/gnome-image.png |  Bin 0 -> 33988 bytes
 platform-demos/C/samples/image.vala      |   26 +++++++++++++++++++++++
 platform-demos/Makefile.am               |    3 ++
 6 files changed, 62 insertions(+), 0 deletions(-)
---
diff --git a/platform-demos/C/image.vala.page b/platform-demos/C/image.vala.page
new file mode 100644
index 0000000..239ee87
--- /dev/null
+++ b/platform-demos/C/image.vala.page
@@ -0,0 +1,33 @@
+<page xmlns="http://projectmallard.org/1.0/";
+      xmlns:xi="http://www.w3.org/2001/XInclude";
+      type="guide" style="task"
+      id="image.vala">
+  <info>
+    <link type="guide" xref="beginner.vala#display-widgets"/>
+    <revision version="0.1" date="2012-05-03" status="draft"/>
+
+    <credit type="author copyright">
+      <name>Tiffany Antopolski</name>
+      <email>tiffany antopolski gmail com</email>
+      <years>2012</years>
+    </credit>
+
+    <desc>A widget displaying an image</desc>
+  </info>
+
+  <title>Image</title>
+  <media type="image" mime="image/png" src="media/image.png"/>
+  <p>This GtkApplication displayis an image file from the current directory.</p>
+  <note><p>
+    If the image file isn't loaded successfully, the image will contain a "broken image" icon.  The <file>filename.png</file> needs to be in the current directory for this code to work.  Use your favorite picture!
+  </p></note>
+<code mime="text/x-vala" style="numbered"><xi:include href="samples/image.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.Application";>GtkApplication</link></p></item>
+  <item><p><link href="http://references.valadoc.org/#!api=gtk+-3.0/Gtk.ApplicationWindow";>GtkApplicationWindow</link></p></item>
+  <item><p><link href="http://references.valadoc.org/#!api=gtk+-3.0/Gtk.Image";>GtkImage</link></p></item>
+</list>
+</page>
diff --git a/platform-demos/C/media/gnome-image.png b/platform-demos/C/media/gnome-image.png
new file mode 100644
index 0000000..0064fe6
Binary files /dev/null and b/platform-demos/C/media/gnome-image.png differ
diff --git a/platform-demos/C/media/image.png b/platform-demos/C/media/image.png
new file mode 100644
index 0000000..254763a
Binary files /dev/null and b/platform-demos/C/media/image.png differ
diff --git a/platform-demos/C/samples/gnome-image.png b/platform-demos/C/samples/gnome-image.png
new file mode 100644
index 0000000..0064fe6
Binary files /dev/null and b/platform-demos/C/samples/gnome-image.png differ
diff --git a/platform-demos/C/samples/image.vala b/platform-demos/C/samples/image.vala
new file mode 100644
index 0000000..89e2793
--- /dev/null
+++ b/platform-demos/C/samples/image.vala
@@ -0,0 +1,26 @@
+public class MyWindow : Gtk.ApplicationWindow {
+	internal MyWindow (MyApplication app) {
+		Object (application: app, title: "Welcome to GNOME");
+
+		var image = new Gtk.Image ();
+		image.set_from_file ("gnome-image.png");
+                this.add (image);
+		this.set_default_size (300, 300);
+
+		this.show_all ();
+	}
+}
+
+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 875d80f..dcaf384 100644
--- a/platform-demos/Makefile.am
+++ b/platform-demos/Makefile.am
@@ -33,6 +33,7 @@ demo_sources = \
         samples/GtkApplicationWindow.js		\
 	samples/GtkApplicationWindow.py		\
 	samples/GtkApplicationWindow.vala	\
+	samples/image.vala			\
 	samples/label.vala			\
 	samples/messagedialog.vala		\
 	samples/window.c			\
@@ -56,6 +57,7 @@ DOC_FIGURES = \
 	media/guitar-tuner-glade.png		\
 	media/guitar-tuner-pipeline.png		\
 	media/helloWorldJs.png			\
+	media/image.png				\
 	media/image-viewer.png			\
 	media/label.png				\
 	media/magic-mirror.png			\
@@ -104,6 +106,7 @@ DOC_PAGES =				\
 	guitar-tuner.vala.page		\
 	helloWorld.js.page  		\
 	helloworldautotools.js.page	\
+	image.vala.page			\
 	image-viewer.c.page		\
 	image-viewer.cpp.page		\
 	image-viewer.js.page		\



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