[gnome-devel-docs] demos: add fontchoooserwidget example for vala
- From: Tiffany Antopolski <antopolski src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-devel-docs] demos: add fontchoooserwidget example for vala
- Date: Wed, 19 Jun 2013 18:31:47 +0000 (UTC)
commit 0ae8f3df01672b1a43242c037b20244d0f16dfc2
Author: Tiffany Ann Antopolski <tiffany antopolski gmail com>
Date: Wed Jun 19 12:55:01 2013 -0400
demos: add fontchoooserwidget example for vala
platform-demos/C/fontchooserwidget.vala.page | 39 +++++++++++++++++++++++
platform-demos/C/samples/fontchooserwidget.vala | 32 ++++++++++++++++++
platform-demos/Makefile.am | 4 ++-
3 files changed, 74 insertions(+), 1 deletions(-)
---
diff --git a/platform-demos/C/fontchooserwidget.vala.page b/platform-demos/C/fontchooserwidget.vala.page
new file mode 100644
index 0000000..a10f487
--- /dev/null
+++ b/platform-demos/C/fontchooserwidget.vala.page
@@ -0,0 +1,39 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<page xmlns="http://projectmallard.org/1.0/"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ type="guide" style="task"
+ id="fontchooserwidget.vala">
+ <info>
+ <title type="text">FontChooserWidget (Vala)</title>
+ <link type="guide" xref="beginner.vala#font-selectors"/>
+ <revision version="0.2" date="2013-06-19" status="review"/>
+
+ <credit type="author copyright">
+ <name>Tiffany Antpoolski</name>
+ <email>tiffany antopolski gmail com</email>
+ <years>2013</years>
+ </credit>
+
+ <desc>A widget to choose a font</desc>
+ </info>
+
+ <title>FontChooserWidget</title>
+
+ <media type="image" mime="image/png" src="media/fontchooserwidget.png"/>
+ <p>A FontChooserWidget with a lambda callback function.</p>
+
+ <links type="section" />
+
+ <section id="code">
+ <title>Code used to generate this example</title>
+ <code mime="text/x-csharp" style="numbered"><xi:include href="samples/fontchooserwidget.vala"
parse="text"><xi:fallback/></xi:include></code>
+ </section>
+
+ <section id="references">
+ <title>API References</title>
+ <p>In this sample we used the following:</p>
+ <list>
+ <item><p><link
href="http://www.valadoc.org/gtk+-3.0/Gtk.FontChooserWidget.html">GtkFontChooserWidget</link></p></item>
+ </list>
+ </section>
+</page>
diff --git a/platform-demos/C/samples/fontchooserwidget.vala b/platform-demos/C/samples/fontchooserwidget.vala
new file mode 100644
index 0000000..20f28cf
--- /dev/null
+++ b/platform-demos/C/samples/fontchooserwidget.vala
@@ -0,0 +1,32 @@
+public class MyWindow : Gtk.ApplicationWindow {
+ internal MyWindow (MyApplication app) {
+ Object (application: app, title: "FontChooserWidget");
+
+ var font_chooser = new Gtk.FontChooserWidget ();
+ font_chooser.set_font ("Sans");
+ font_chooser.set_preview_text ("This is an example of preview text!");
+ this.add (font_chooser);
+
+ font_chooser.notify["font"].connect (() => {
+ print ("font: %s\n", font_chooser.get_font ().to_string ());
+ print ("desc: %s\n", font_chooser.get_font_desc ().to_string ());
+ print ("face: %s\n", font_chooser.get_font_face ().get_face_name ());
+ print ("size: %d\n", font_chooser.get_font_size ());
+ print ("family: %s\n", font_chooser.get_font_family ().get_name ());
+ print ("monospace: %s\n\n", font_chooser.get_font_family ().is_monospace ().to_string
());
+ });
+
+ this.show_all ();
+ }
+}
+
+public class MyApplication : Gtk.Application {
+ protected override void activate () {
+ new MyWindow (this).show ();
+ }
+}
+
+public int main (string[] args) {
+ return new MyApplication ().run (args);
+}
+
diff --git a/platform-demos/Makefile.am b/platform-demos/Makefile.am
index 3441695..f73ecea 100644
--- a/platform-demos/Makefile.am
+++ b/platform-demos/Makefile.am
@@ -59,6 +59,7 @@ demo_sources = \
samples/filechooserdialog.ui \
samples/filechooserdialog.vala \
samples/fontchooserwidget.py \
+ samples/fontchooserwidget.vala \
samples/fruitbat.png \
samples/gentoopenguin.png \
samples/gmenu.c \
@@ -328,6 +329,7 @@ HELP_FILES = \
filechooserdialog.py.page \
filechooserdialog.vala.page \
fontchooserwidget.py.page \
+ fontchooserwidget.vala.page \
getting-ready.page \
gmenu.c.page \
gmenu.js.page \
@@ -350,7 +352,7 @@ HELP_FILES = \
hello-world.c.page \
hello-world.js.page \
hello-world.py.page \
- hello-world.vala.page \
+ hello-world.vala.page \
image.c.page \
image.js.page \
image.py.page \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]