[tepl] AmtkFactory: show code example to create a GtkToolbar
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tepl] AmtkFactory: show code example to create a GtkToolbar
- Date: Wed, 9 Aug 2017 10:56:15 +0000 (UTC)
commit 6b51f98449544b29ef031b125e4c5010647a4c30
Author: Sébastien Wilmet <swilmet gnome org>
Date: Wed Aug 9 12:51:49 2017 +0200
AmtkFactory: show code example to create a GtkToolbar
amtk/amtk-factory.c | 36 ++++++++++++++++++++++++++++++++++++
1 files changed, 36 insertions(+), 0 deletions(-)
---
diff --git a/amtk/amtk-factory.c b/amtk/amtk-factory.c
index 18bb09d..863dfde 100644
--- a/amtk/amtk-factory.c
+++ b/amtk/amtk-factory.c
@@ -133,6 +133,42 @@
* return menu_bar;
* }
* ]|
+ *
+ * # Toolbars
+ *
+ * #AmtkFactory has functions to create #GtkToolItem's.
+ *
+ * ## Code example to create a toolbar
+ *
+ * How to create a #GtkToolbar with #AmtkFactory.
+ *
+ * |[
+ * static GtkWidget *
+ * create_toolbar (void)
+ * {
+ * GtkToolbar *toolbar;
+ * AmtkFactory *factory;
+ *
+ * toolbar = GTK_TOOLBAR (gtk_toolbar_new ());
+ *
+ * // Do not associate a GtkApplication, because the menu has already been
+ * // generated, the menu contains all actions, so
+ * // gtk_application_set_accels_for_action() has already been called for all
+ * // actions. Another way is to set the AMTK_FACTORY_IGNORE_ACCELS_FOR_APP
+ * // flag.
+ * factory = amtk_factory_new (NULL);
+ * gtk_toolbar_insert (toolbar, amtk_factory_create_tool_button (factory, "win.new-file"), -1);
+ * gtk_toolbar_insert (toolbar, amtk_factory_create_tool_button (factory, "win.open"), -1);
+ * gtk_toolbar_insert (toolbar, amtk_factory_create_tool_button (factory, "win.save"), -1);
+ * gtk_toolbar_insert (toolbar, gtk_separator_tool_item_new (), -1);
+ * gtk_toolbar_insert (toolbar, amtk_factory_create_tool_button (factory, "win.cut"), -1);
+ * gtk_toolbar_insert (toolbar, amtk_factory_create_tool_button (factory, "win.copy"), -1);
+ * gtk_toolbar_insert (toolbar, amtk_factory_create_tool_button (factory, "win.paste"), -1);
+ * g_object_unref (factory);
+ *
+ * return GTK_WIDGET (toolbar);
+ * }
+ * ]|
*/
struct _AmtkFactoryPrivate
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]