[gnome-devel-docs] Tutorials: Button widget sample
- From: Susanna Huhtanen <susannah src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-devel-docs] Tutorials: Button widget sample
- Date: Tue, 21 Feb 2012 11:26:17 +0000 (UTC)
commit 82630dc9a657fbad92c35b4f3c7acb26684efb8a
Author: Susanna Huhtanen <ihmis suski gmail com>
Date: Tue Feb 21 13:24:42 2012 +0200
Tutorials: Button widget sample
platform-demos/C/button.js.page | 41 +++++++++++++++++++++++++++++++++++++
platform-demos/C/entry.js.page | 3 +-
platform-demos/C/media/button.png | Bin 0 -> 4766 bytes
platform-demos/Makefile.am | 2 +
4 files changed, 45 insertions(+), 1 deletions(-)
---
diff --git a/platform-demos/C/button.js.page b/platform-demos/C/button.js.page
new file mode 100644
index 0000000..8c77581
--- /dev/null
+++ b/platform-demos/C/button.js.page
@@ -0,0 +1,41 @@
+<page xmlns="http://projectmallard.org/1.0/"
+ type="guide" style="task"
+ id="button.js">
+ <info>
+ <link type="guide" xref="beginner.js#samples"/>
+ <revision version="0.1" date="2012-02-21" status="stub"/>
+
+ <credit type="author copyright">
+ <name>Susanna Huhtanen</name>
+ <email>ihmis suski gmail com</email>
+ <years>2012</years>
+ </credit>
+
+ <desc>A button widget which is connected to a progress bar</desc>
+ </info>
+
+ <title>Button widget</title>
+
+ <media type="image" mime="image/png" src="media/button.png"/>
+ <p>A button widget connected to a progress bar.</p>
+
+ <code mime="text/javascript" style="numbered"><![CDATA[
+#!/usr/bin/gjs
+Gtk = imports.gi.Gtk;
+Gtk.init(null, 0);
+myW = new Gtk.Window({type: Gtk.WindowType.TOPLEVEL});
+myW.title = "Button";
+myW.connect("destroy", function(){Gtk.main_quit()});
+grid = new Gtk.Grid();
+myW.add(grid);
+this.pbar = new Gtk.ProgressBar();
+function foo(){
+ this.pbar.pulse();
+}
+var button = new Gtk.Button({label: "Button"});
+button.connect("clicked", foo);
+grid.attach(button, 1, 1, 1, 1);
+grid.attach_next_to(pbar, button, 3,1,1);
+myW.show_all();
+Gtk.main();]]></code>
+</page>
diff --git a/platform-demos/C/entry.js.page b/platform-demos/C/entry.js.page
index 1486b3c..096c155 100644
--- a/platform-demos/C/entry.js.page
+++ b/platform-demos/C/entry.js.page
@@ -31,7 +31,8 @@ grid = new Gtk.Grid();
myW.add(grid);
//create the entry widget
-var entry = new Gtk.Entry({text: "Write something here"});
+var entry = new Gtk.Entry();
+entry.set_text("Write something here");
entry.set_width_chars(50);
//create the first label
var label = new Gtk.Label({label: "Entry widget: "});
diff --git a/platform-demos/C/media/button.png b/platform-demos/C/media/button.png
new file mode 100644
index 0000000..f39a458
Binary files /dev/null and b/platform-demos/C/media/button.png differ
diff --git a/platform-demos/Makefile.am b/platform-demos/Makefile.am
index 9033d88..5b57a33 100644
--- a/platform-demos/Makefile.am
+++ b/platform-demos/Makefile.am
@@ -24,6 +24,7 @@ demo_sources = \
DOC_FIGURES = \
media/ubuntu.png \
+ media/button.png \
media/entry.png \
media/fedora.png \
media/opensuse.png \
@@ -43,6 +44,7 @@ DOC_PAGES = \
audio-player.vala.page \
beginner.vala.page \
bug-filing.page \
+ button.js.page \
documentation.page \
desktop.js.page \
beginner.js.page \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]