[gnome-devel-docs] Added Mallard page and screenshot for MenuButton sample page.



commit 168c707c6c09f79e8e0166aaba7fe559d31ee2fb
Author: Tiffany Antopolski <tiffany antopolski gmail com>
Date:   Thu Jul 19 18:03:15 2012 -0400

    Added Mallard page and screenshot for MenuButton sample page.

 platform-demos/C/media/menubutton.png  |  Bin 0 -> 13213 bytes
 platform-demos/C/menubutton.js.page    |   33 ++++++++++++++++++++++++++++++++
 platform-demos/C/samples/menubutton.js |   27 ++++++++++---------------
 3 files changed, 44 insertions(+), 16 deletions(-)
---
diff --git a/platform-demos/C/media/menubutton.png b/platform-demos/C/media/menubutton.png
new file mode 100644
index 0000000..b9fb607
Binary files /dev/null and b/platform-demos/C/media/menubutton.png differ
diff --git a/platform-demos/C/menubutton.js.page b/platform-demos/C/menubutton.js.page
new file mode 100644
index 0000000..cf932df
--- /dev/null
+++ b/platform-demos/C/menubutton.js.page
@@ -0,0 +1,33 @@
+<?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="menubutton.js">
+  <info>
+    <link type="guide" xref="beginner.js#buttons"/>
+    <revision version="0.1" date="2012-07-18" status="draft"/>
+
+    <credit type="author copyright">
+      <name>Anna Zacchi</name>
+      <email>azzurroverde gmail com</email>
+      <years>2012</years>
+    </credit>
+
+    <desc>A widget that shows a menu when clicked on</desc>
+  </info>
+
+  <title>MenuButton</title>
+  <media type="image" mime="image/png" src="media/menubutton.png"/>
+  <p>The GtkMenuButton widget is used to display a menu when clicked on. This menu can be provided either as a GtkMenu, or an abstract GMenuModel.
+
+The GtkMenuButton widget can hold any valid child widget. That is, it can hold almost any other standard GtkWidget. The most commonly used child is the provided GtkArrow.</p>
+
+<note><p>You need to be running GNOME 3.6 for the MenuButton to work.</p></note>
+<code mime="text/javascript" style="numbered"><xi:include href="samples/menubutton.js" parse="text"><xi:fallback/></xi:include></code>
+<p>
+  In this sample we used the following:
+</p>
+<list>
+  <item><p><link href="http://developer.gnome.org/gtk3/3.5/gtk3-GtkMenuButton.html";>MenuButton</link></p></item>
+</list>
+</page>
diff --git a/platform-demos/C/samples/menubutton.js b/platform-demos/C/samples/menubutton.js
index c4a4da5..a882762 100644
--- a/platform-demos/C/samples/menubutton.js
+++ b/platform-demos/C/samples/menubutton.js
@@ -1,7 +1,6 @@
 #!/usr/bin/gjs
 
 const _ = imports.gettext.gettext;
-
 const Gio = imports.gi.Gio;
 const GLib = imports.gi.GLib;
 const Gtk = imports.gi.Gtk;
@@ -22,29 +21,25 @@ const Application = new Lang.Class ({
        this.application.connect('startup', Lang.bind(this, this._onStartup));
     },
 
-    //create the UI (in this case it's just the ApplicationWindow
+    //create the UI (in this case it's just the ApplicationWindow)
     _buildUI: function() {
         this._window = new Gtk.ApplicationWindow  ({ application: this.application,
                                                    window_position: Gtk.WindowPosition.CENTER,
                                                    title: "Welcome to GNOME" });
-
-        //uncommenting the line below will change the window size
-        this._window.set_default_size(600, 400);
-        
-        this.grid = new Gtk.Grid();
-        this._window.add(this.grid);
+        this._window.set_default_size (600, 400);
+        this.grid = new Gtk.Grid ();
+        this._window.add (this.grid);
         
         
         this._menuButton = new Gtk.MenuButton();
-        this.grid.attach( this._menuButton, 0, 0, 1, 1 );//here for GTK bug: workaround
-        this.menu = new Gtk.Menu.new_from_model(this.menuModel);
+        this.grid.attach (this._menuButton, 0, 0, 1, 1 );
+        this.menu = new Gtk.Menu.new_from_model (this.menuModel);
         
-        this.menu.show();
-        this._menuButton.set_menu( this.menu );
-        this._menuButton.set_size_request(80, 35);
-        this._menuButton.show();
+        this.menu.show ();
+        this._menuButton.set_menu (this.menu );
+        this._menuButton.set_size_request (80, 35);
+        this._menuButton.show ();
         
-        //show the window and all child widgets (none in this case)
         this._window.show_all();
     },
 
@@ -117,4 +112,4 @@ const Application = new Lang.Class ({
 
 //run the application
 let app = new Application ();
-app.application.run (ARGV);
\ No newline at end of file
+app.application.run (ARGV);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]