[gtk+/wip/gmenu] Add an example



commit c0418f25b0ae65e56d547802f395516bc6667986
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Dec 4 19:16:08 2011 -0500

    Add an example

 gtk/gtkapplicationwindow.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkapplicationwindow.c b/gtk/gtkapplicationwindow.c
index 24adfce..43127c2 100644
--- a/gtk/gtkapplicationwindow.c
+++ b/gtk/gtkapplicationwindow.c
@@ -51,6 +51,31 @@
  * automatically show the menu as part of a menubar. This behaviour
  * can be overridden with the #GtkApplicationWindow:show-menubar
  * property.
+ *
+ * <example><title>A GtkApplicationWindow with a menubar</title>
+ * <programlisting><![CDATA[
+ * app = gtk_application_new ();
+ *
+ * builder = gtk_builder_new ();
+ * gtk_builder_add_from_string (builder,
+ *     "<interface>"
+ *     "  <menu id='menubar'>"
+ *     "    <submenu label='_Edit'>"
+ *     "      <item label='_Copy' action='win.copy'/>"
+ *     "      <item label='_Paste' action='win.paste'/>"
+ *     "    </submenu>"
+ *     "  </menu>"
+ *     "</interface>");
+ * g_application_set_menubar (G_APPLICATION (app),
+ *                            G_MENU_MODEL (gtk_builder_get_object (builder, "menubar")));
+ * g_object_unref (builder);
+ *
+ * ...
+ *
+ * window = gtk_application_window_new (app);
+ * ]]>
+ * </programlisting>
+ * </example>
  */
 struct _GtkApplicationWindowPrivate
 {



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