[gnome-devel-docs] Vala samples: new Gtk.Entry example
- From: Tiffany Antopolski <antopolski src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-devel-docs] Vala samples: new Gtk.Entry example
- Date: Fri, 4 May 2012 04:49:43 +0000 (UTC)
commit d5417dd9ceeb630e8efd00d362edbd2c1659213e
Author: Tiffany Antopolski <tiffany antopolski gmail com>
Date: Fri May 4 00:47:46 2012 -0400
Vala samples: new Gtk.Entry example
platform-demos/C/aboutdialog.vala.page | 3 +-
platform-demos/C/entry.vala.page | 30 +++++++++--------
.../C/{entry.js.page => grid_with_entry.js.page} | 2 +-
.../C/media/{entry.png => grid_with_entry.png} | Bin 10420 -> 10420 bytes
platform-demos/C/samples/entry.vala | 33 ++++++++++++++++++++
platform-demos/Makefile.am | 5 ++-
6 files changed, 55 insertions(+), 18 deletions(-)
---
diff --git a/platform-demos/C/aboutdialog.vala.page b/platform-demos/C/aboutdialog.vala.page
index 27725a9..10ca002 100644
--- a/platform-demos/C/aboutdialog.vala.page
+++ b/platform-demos/C/aboutdialog.vala.page
@@ -27,8 +27,7 @@
<note><p><em style="bold">You need to be running Gtk3.4 or later for this to work</em></p></note>
<code mime="text/x-vala" style="numbered">
-<xi:include href="samples/aboutdialog.vala" parse="text"><xi:fallback/></xi:include>
-</code>
+<xi:include href="samples/aboutdialog.vala" parse="text"><xi:fallback/></xi:include></code>
<p>
In this sample we used the following:
</p>
diff --git a/platform-demos/C/entry.vala.page b/platform-demos/C/entry.vala.page
index 38605eb..5dfc49f 100644
--- a/platform-demos/C/entry.vala.page
+++ b/platform-demos/C/entry.vala.page
@@ -1,27 +1,29 @@
<page xmlns="http://projectmallard.org/1.0/"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
type="guide" style="task"
id="entry.vala">
<info>
- <link type="guide" xref="beginner.vala#entry"/>
- <revision version="0.1" date="2012-02-19" status="stub"/>
+ <link type="guide" xref="beginner.vala#entry"/>
+ <revision version="0.1" date="2012-05-03" status="draft"/>
<credit type="author copyright">
- <name></name>
- <email></email>
- <years></years>
+ <name>Tiffany Antopolski</name>
+ <email>tiffany antopolski gmail com</email>
+ <years>2012</years>
</credit>
- <desc>How to make an entry widget and connect its contents to a label</desc>
+ <desc>A single line text entry field</desc>
</info>
- <title>Entry widget</title>
-
+ <title>Entry</title>
<media type="image" mime="image/png" src="media/entry.png"/>
- <p>This an entry widget. An entry widget is a container that you can type in to. </p>
-
- <code mime="text/x-vala" style="numbered"><![CDATA[
-]]></code>
-
-<p>In this sample we use the following widgets: <link href="">Gtk.Window</link>, <link href="">Gtk.Grid</link>, <link href="">Gtk.Entry</link>, <link href="">Gtk.Label</link>, <link href="">Gtk.Button</link>.</p>
+ <p>This application greets you in the terminal.</p>
+<code mime="text/x-vala" style="numbered"><xi:include href="samples/entry.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.Entry">Gtk.Entry</link></p></item>
+</list>
</page>
diff --git a/platform-demos/C/entry.js.page b/platform-demos/C/grid_with_entry.js.page
similarity index 96%
rename from platform-demos/C/entry.js.page
rename to platform-demos/C/grid_with_entry.js.page
index e0b0feb..2b5eb2e 100644
--- a/platform-demos/C/entry.js.page
+++ b/platform-demos/C/grid_with_entry.js.page
@@ -16,7 +16,7 @@
<title>Entry widget</title>
- <media type="image" mime="image/png" src="media/entry.png"/>
+ <media type="image" mime="image/png" src="media/grid_with_entry.png"/>
<p>This an entry widget. An entry widget is a container that you can type in to. </p>
<code mime="text/javascript" style="numbered"><![CDATA[
diff --git a/platform-demos/C/media/entry.png b/platform-demos/C/media/grid_with_entry.png
similarity index 100%
rename from platform-demos/C/media/entry.png
rename to platform-demos/C/media/grid_with_entry.png
diff --git a/platform-demos/C/samples/entry.vala b/platform-demos/C/samples/entry.vala
new file mode 100644
index 0000000..e4b06ad
--- /dev/null
+++ b/platform-demos/C/samples/entry.vala
@@ -0,0 +1,33 @@
+public class MyWindow : Gtk.ApplicationWindow {
+
+ void on_activate (Gtk.Entry entry) {
+ name = entry.get_text ();
+ print ("Hello " + name + "!\n");
+ }
+
+ internal MyWindow (MyApplication app) {
+ Object (application: app, title: "What is your name?");
+
+ var name_box = new Gtk.Entry ();
+ name_box.activate.connect (on_activate);
+ name_box.show ();
+
+ this.set_default_size (300, 100);
+ this.border_width = 10;
+ this.add (name_box);
+ }
+}
+
+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 dcaf384..da2db9d 100644
--- a/platform-demos/Makefile.am
+++ b/platform-demos/Makefile.am
@@ -24,6 +24,7 @@ demo_sources = \
samples/aboutdialog.vala \
samples/button.vala \
samples/dialog.vala \
+ samples/entry.vala \
samples/gmenu.c \
samples/gmenu.js \
samples/gmenu.py \
@@ -53,6 +54,7 @@ DOC_FIGURES = \
media/gmenu.py.png \
media/gmenu.vala.png \
media/grid.png \
+ media/grid_with_entry.png \
media/guitar-tuner.png \
media/guitar-tuner-glade.png \
media/guitar-tuner-pipeline.png \
@@ -87,8 +89,9 @@ DOC_PAGES = \
desktop.js.page \
dialog.vala.page \
documentation.page \
- entry.js.page \
+ entry.vala.page \
getting-ready.page \
+ grid_with_entry.js.page \
grid.js.page \
gmenu.c.page \
gmenu.js.page \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]