[gnome-devel-docs] Vala samples: Tidied up GtkApplication examples.
- From: Tiffany Antopolski <antopolski src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-devel-docs] Vala samples: Tidied up GtkApplication examples.
- Date: Sun, 15 Apr 2012 03:24:17 +0000 (UTC)
commit 14406bb281e0fa91767b1aaa6e8c8b80768e318a
Author: Tiffany Antopolski <tiffany antopolski gmail com>
Date: Sat Apr 14 23:19:19 2012 -0400
Vala samples: Tidied up GtkApplication examples.
- Added "this" keyword to Gtk.Application examples.
- Made Window section style="2column"
- Added links to valadoc for relevant widgets and methods.
platform-demos/C/GtkApplication.vala.page | 42 +++++++++++++++++--------
platform-demos/C/aboutdialog.vala.page | 16 +++++-----
platform-demos/C/beginner.vala.page | 2 +-
platform-demos/C/samples/GtkApplication.vala | 14 ++++----
platform-demos/C/samples/aboutdialog.vala | 6 ++--
5 files changed, 47 insertions(+), 33 deletions(-)
---
diff --git a/platform-demos/C/GtkApplication.vala.page b/platform-demos/C/GtkApplication.vala.page
index 64a0169..569bcc7 100644
--- a/platform-demos/C/GtkApplication.vala.page
+++ b/platform-demos/C/GtkApplication.vala.page
@@ -20,29 +20,38 @@
</info>
<title>ApplicationWindow</title>
- <media type="image" mime="image/png" src="media/GtkApplication.png"/>
- <note style="bug"><p>
- This program will not compile until <link href="https://bugzilla.gnome.org/show_bug.cgi?id=674090">Bug #674090</link> is fixed.
- </p></note>
+ <table>
+ <tr>
+ <td>
+ <media type="image" mime="image/png" src="media/GtkApplication.png"/>
+ </td>
+ <td>
+ <note style="important">
+ <p><em style="strong">You need to be running Gtk+-3.4 or later for this to work</em></p>
+ </note>
+ <note style="bug"><p>
+ This program will not compile until <link href="https://bugzilla.gnome.org/show_bug.cgi?id=674090">Bug #674090</link> is fixed.
+ </p></note>
+ </td>
+ </tr>
+ </table>
<p>A demonstration of the menu integration.</p>
<code mime="text/x-vala" style="numbered"><![CDATA[
-/*** You need to be running Gtk+-3.4 or later for this to work ***/
-
//A window in the application
public class Window : Gtk.ApplicationWindow {
public Window (Application app) {
Object (application: app, title: "GtkApplication Example");
var label = new Gtk.Label ("Hello GtkApplication!");
- add (label);
+ this.add (label);
var about_action = new SimpleAction ("about", null);
about_action.activate.connect (about);
- add_action (about_action);
+ this.add_action (about_action);
- set_default_size (400, 200);
- show_all ();
+ this.set_default_size (400, 200);
+ this.show_all ();
}
void about () {
@@ -72,11 +81,11 @@ public class Application : Gtk.Application {
var menu = new Menu ();
menu.append ("About", "win.about");
menu.append ("Quit", "app.quit");
- app_menu = menu;
+ this.app_menu = menu;
var quit_action = new SimpleAction ("quit", null);
- quit_action.activate.connect (quit);
- add_action (quit_action);
+ quit_action.activate.connect (this.quit);
+ this.add_action (quit_action);
}
public Application () {
@@ -93,6 +102,11 @@ int main (string[] args) {
In this sample we used the following:
</p>
<list>
- <item><p><link href="">thing1</link></p></item>
+ <item><p><link href="http://references.valadoc.org/#!api=gtk+-3.0/Gtk.Application">Gtk.Application</link></p></item>
+ <item><p><link href="http://references.valadoc.org/#!api=gtk+-3.0/Gtk.ApplicationWindow">Gtk.ApplicationWindow</link></p></item>
+ <item><p><link href="http://references.valadoc.org/#!api=gio-2.0/GLib.Menu.Menu">Menu</link></p></item>
+ <item><p><link href="http://references.valadoc.org/#!api=gio-2.0/GLib.Menu.append">append</link></p></item>
+ <item><p><link href="http://references.valadoc.org/#!api=gio-2.0/GLib.SimpleAction">SimpleAction</link></p></item>
+ <item><p><link href="http://www.valadoc.org/#!api=gio-2.0/GLib.ActionMap.add_action">add_action</link></p></item>
</list>
</page>
diff --git a/platform-demos/C/aboutdialog.vala.page b/platform-demos/C/aboutdialog.vala.page
index bbaf015..6028e20 100644
--- a/platform-demos/C/aboutdialog.vala.page
+++ b/platform-demos/C/aboutdialog.vala.page
@@ -14,7 +14,6 @@
<credit type="author">
<name>Tiffany Antopolski</name>
<email>tiffany antopolski gmail com</email>
- <years></years>
</credit>
@@ -24,21 +23,19 @@
<title>AboutDialog</title>
<media type="image" mime="image/png" src="media/aboutdialog.png"/>
<p>An AboutDialog example using Gtk.Application</p>
+ <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"><![CDATA[
-/*** You need to be running Gtk3.4 or later for this to work ***/
-
//A window in the application
public class Window : Gtk.ApplicationWindow {
public Window (Application app) {
Object (application: app, title: "AboutDialog Example");
- set_default_size (400, 200);
-
+ this.set_default_size (400, 200);
var button = new Gtk.Button.with_label ("About");
button.clicked.connect (about_clicked);
- add (button);
+ this.add (button);
- show_all ();
+ this.show_all ();
}
void about_clicked () {
@@ -76,6 +73,9 @@ int main (string[] args) {
In this sample we used the following:
</p>
<list>
- <item><p><link href="">thing1</link></p></item>
+ <item><p><link href="http://references.valadoc.org/#!api=gtk+-3.0/Gtk.Application">Gtk.Application</link></p></item>
+ <item><p><link href="http://references.valadoc.org/#!api=gtk+-3.0/Gtk.ApplicationWindow">Gtk.ApplicationWindow</link></p></item>
+ <item><p><link href="http://www.valadoc.org/#!api=gtk+-3.0/Gtk.Window.set_default_size">set_default_size</link></p></item>
+ <item><p><link href="http://www.valadoc.org/#!api=gtk+-2.0/Gtk.Button.Button.with_label">Gtk.Button.with_label</link></p></item>
</list>
</page>
diff --git a/platform-demos/C/beginner.vala.page b/platform-demos/C/beginner.vala.page
index f9179cf..3f106fd 100644
--- a/platform-demos/C/beginner.vala.page
+++ b/platform-demos/C/beginner.vala.page
@@ -49,7 +49,7 @@
</item>
</steps>
- <section id="windows"><title>Windows</title>
+ <section id="windows" style="2column"><title>Windows</title>
<p></p>
</section>
<section id="display-widgets"><title>Display widgets</title>
diff --git a/platform-demos/C/samples/GtkApplication.vala b/platform-demos/C/samples/GtkApplication.vala
index 95debb1..d9097f3 100644
--- a/platform-demos/C/samples/GtkApplication.vala
+++ b/platform-demos/C/samples/GtkApplication.vala
@@ -8,14 +8,14 @@ public class Window : Gtk.ApplicationWindow {
Object (application: app, title: "GtkApplication Example");
var label = new Gtk.Label ("Hello GtkApplication!");
- add (label);
+ this.add (label);
var about_action = new SimpleAction ("about", null);
about_action.activate.connect (about);
- add_action (about_action);
+ this.add_action (about_action);
- set_default_size (400, 200);
- show_all ();
+ this.set_default_size (400, 200);
+ this.show_all ();
}
void about () {
@@ -45,11 +45,11 @@ public class Application : Gtk.Application {
var menu = new Menu ();
menu.append ("About", "win.about");
menu.append ("Quit", "app.quit");
- app_menu = menu;
+ this.app_menu = menu;
var quit_action = new SimpleAction ("quit", null);
- quit_action.activate.connect (quit);
- add_action (quit_action);
+ quit_action.activate.connect (this.quit);
+ this.add_action (quit_action);
}
public Application () {
diff --git a/platform-demos/C/samples/aboutdialog.vala b/platform-demos/C/samples/aboutdialog.vala
index 633cf1f..0c01148 100644
--- a/platform-demos/C/samples/aboutdialog.vala
+++ b/platform-demos/C/samples/aboutdialog.vala
@@ -6,12 +6,12 @@
public class Window : Gtk.ApplicationWindow {
public Window (Application app) {
Object (application: app, title: "AboutDialog Example");
- set_default_size (400, 200);
+ this.set_default_size (400, 200);
var button = new Gtk.Button.with_label ("About");
button.clicked.connect (about_clicked);
- add (button);
+ this.add (button);
- show_all ();
+ this.show_all ();
}
void about_clicked () {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]