[gnome-devel-docs: 11/11] platform-demos: Improve paned.js
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-devel-docs: 11/11] platform-demos: Improve paned.js
- Date: Sun, 23 Jun 2013 23:08:26 +0000 (UTC)
commit b91cc2a4e1607260f63e3297fcd4819635583207
Author: David King <amigadave amigadave com>
Date: Sun Jun 23 23:44:28 2013 +0100
platform-demos: Improve paned.js
platform-demos/C/paned.js | 62 -------------------------------------
platform-demos/C/samples/paned.js | 61 ++++++++++++++++++++++++++++++++++++
platform-demos/Makefile.am | 1 +
3 files changed, 62 insertions(+), 62 deletions(-)
---
diff --git a/platform-demos/C/samples/paned.js b/platform-demos/C/samples/paned.js
new file mode 100644
index 0000000..3119ac9
--- /dev/null
+++ b/platform-demos/C/samples/paned.js
@@ -0,0 +1,61 @@
+#!/usr/bin/gjs
+
+const Gtk = imports.gi.Gtk;
+const Lang = imports.lang;
+
+const PanedExample = new Lang.Class ({
+ Name: 'Paned Example',
+
+ // Create the application itself
+ _init: function () {
+ this.application = new Gtk.Application({ application_id: 'org.example.panedexample' });
+
+ // Connect 'activate' and 'startup' signals to the callback functions
+ this.application.connect('activate', Lang.bind(this, this._onActivate));
+ this.application.connect('startup', Lang.bind(this, this._onStartup));
+ },
+
+ // Callback function for 'activate' signal presents windows when active
+ _onActivate: function() {
+ this.window.present();
+ },
+
+ // Callback function for 'startup' signal builds the UI
+ _onStartup: function () {
+ this._buildUI ();
+ },
+
+ // Build the application's UI
+ _buildUI: function() {
+ // Create the application window
+ this.window = new Gtk.ApplicationWindow ({ application: this.application,
+ window_position: Gtk.WindowPosition.CENTER,
+ title: "Paned Window Example",
+ default_width: 450,
+ default_height: 350,
+ border_width: 10 });
+
+ // a new widget with two adjustable panes,
+ // one on the left and one on the right
+ this.paned = Gtk.Paned.new(Gtk.Orientation.HORIZONTAL);
+
+ // two images
+ this.image1 = new Gtk.Image();
+ this.image1.set_from_file("gnome-image.png");
+ this.image2 = new Gtk.Image();
+ this.image2.set_from_file("tux.png");
+
+ // add the first image to the left pane
+ this.paned.add1(this.image1);
+ // add the second image to the right pane
+ this.paned.add2(this.image2)
+
+ // add the panes to the window
+ this.window.add(this.paned)
+ this.window.show_all();
+ }
+});
+
+// Run the application
+let app = new PanedExample();
+app.application.run (ARGV);
diff --git a/platform-demos/Makefile.am b/platform-demos/Makefile.am
index 69f34a1..c331fc4 100644
--- a/platform-demos/Makefile.am
+++ b/platform-demos/Makefile.am
@@ -131,6 +131,7 @@ demo_sources = \
samples/messagedialog.py \
samples/messagedialog.vala \
samples/muteswan.png \
+ samples/paned.js \
samples/paned.py \
samples/paned.vala \
samples/progressbar.c \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]