[gnome-builder] menus: keep menu for view-stack private to GbViewStack
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] menus: keep menu for view-stack private to GbViewStack
- Date: Wed, 2 Sep 2015 07:00:30 +0000 (UTC)
commit 20a0ffab4d56ac3473af538fef2a7b3129720409
Author: Christian Hergert <christian hergert me>
Date: Tue Sep 1 23:59:58 2015 -0700
menus: keep menu for view-stack private to GbViewStack
data/gtk/menus.ui | 65 -------------------------------------
data/ui/gb-view-stack.ui | 65 +++++++++++++++++++++++++++++++++++++
src/views/gb-view-stack-private.h | 1 +
src/views/gb-view-stack.c | 9 +----
4 files changed, 68 insertions(+), 72 deletions(-)
---
diff --git a/data/gtk/menus.ui b/data/gtk/menus.ui
index 99399f5..e15c61a 100644
--- a/data/gtk/menus.ui
+++ b/data/gtk/menus.ui
@@ -101,71 +101,6 @@
</section>
-->
</menu>
- <menu id="gb-view-stack-menu">
- <section id="gb-view-stack-splits">
- <attribute name="id">splits-section</attribute>
- <attribute name="display-hint">horizontal-buttons</attribute>
- <attribute name="label" translatable="yes">Split</attribute>
- <item>
- <attribute name="label" translatable="yes">Split Left</attribute>
- <attribute name="action">view-stack.split-left</attribute>
- <attribute name="verb-icon">builder-split-tab-left-symbolic</attribute>
- </item>
- <item>
- <attribute name="label" translatable="yes">Split Right</attribute>
- <attribute name="action">view-stack.split-right</attribute>
- <attribute name="verb-icon">builder-split-tab-right-symbolic</attribute>
- </item>
- <item>
- <attribute name="label" translatable="yes">Split Down</attribute>
- <attribute name="action">view-stack.split-down</attribute>
- <attribute name="verb-icon">builder-split-tab-symbolic</attribute>
- </item>
- </section>
- <section id="gb-view-stack-moves">
- <attribute name="id">move-section</attribute>
- <attribute name="display-hint">horizontal-buttons</attribute>
- <attribute name="label" translatable="yes">Move</attribute>
- <item>
- <attribute name="label" translatable="yes">Move Left</attribute>
- <attribute name="action">view-stack.move-left</attribute>
- <attribute name="verb-icon">builder-move-left-symbolic</attribute>
- </item>
- <item>
- <attribute name="label" translatable="yes">Move Right</attribute>
- <attribute name="action">view-stack.move-right</attribute>
- <attribute name="verb-icon">builder-move-right-symbolic</attribute>
- </item>
- </section>
- <section id="gb-view-stack-preview">
- <item>
- <attribute name="label" translatable="yes">Pre_view</attribute>
- <attribute name="action">view.preview</attribute>
- </item>
- </section>
- <section id="gb-view-stack-save">
- <item>
- <attribute name="label" translatable="yes">_Save</attribute>
- <attribute name="action">view.save</attribute>
- </item>
- <item>
- <attribute name="label" translatable="yes">_Save As</attribute>
- <attribute name="action">view.save-as</attribute>
- </item>
- </section>
- <section id="gb-view-stack-print">
- <item>
- <attribute name="label" translatable="yes">Print</attribute>
- <attribute name="action">view.print</attribute>
- </item>
- </section>
- <section id="gb-view-stack-close">
- <item>
- <attribute name="label" translatable="yes">_Close</attribute>
- <attribute name="action">view-stack.close</attribute>
- </item>
- </section>
- </menu>
<menu id="gb-project-tree-display-options">
<section id="gb-project-tree-display-options-section">
<submenu>
diff --git a/data/ui/gb-view-stack.ui b/data/ui/gb-view-stack.ui
index b5c12a2..6e11cf2 100644
--- a/data/ui/gb-view-stack.ui
+++ b/data/ui/gb-view-stack.ui
@@ -190,4 +190,69 @@
</object>
</child>
</object>
+ <menu id="stack_menu">
+ <section id="gb-view-stack-splits">
+ <attribute name="id">splits-section</attribute>
+ <attribute name="display-hint">horizontal-buttons</attribute>
+ <attribute name="label" translatable="yes">Split</attribute>
+ <item>
+ <attribute name="label" translatable="yes">Split Left</attribute>
+ <attribute name="action">view-stack.split-left</attribute>
+ <attribute name="verb-icon">builder-split-tab-left-symbolic</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Split Right</attribute>
+ <attribute name="action">view-stack.split-right</attribute>
+ <attribute name="verb-icon">builder-split-tab-right-symbolic</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Split Down</attribute>
+ <attribute name="action">view-stack.split-down</attribute>
+ <attribute name="verb-icon">builder-split-tab-symbolic</attribute>
+ </item>
+ </section>
+ <section id="gb-view-stack-moves">
+ <attribute name="id">move-section</attribute>
+ <attribute name="display-hint">horizontal-buttons</attribute>
+ <attribute name="label" translatable="yes">Move</attribute>
+ <item>
+ <attribute name="label" translatable="yes">Move Left</attribute>
+ <attribute name="action">view-stack.move-left</attribute>
+ <attribute name="verb-icon">builder-move-left-symbolic</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Move Right</attribute>
+ <attribute name="action">view-stack.move-right</attribute>
+ <attribute name="verb-icon">builder-move-right-symbolic</attribute>
+ </item>
+ </section>
+ <section id="gb-view-stack-preview">
+ <item>
+ <attribute name="label" translatable="yes">Pre_view</attribute>
+ <attribute name="action">view.preview</attribute>
+ </item>
+ </section>
+ <section id="gb-view-stack-save">
+ <item>
+ <attribute name="label" translatable="yes">_Save</attribute>
+ <attribute name="action">view.save</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_Save As</attribute>
+ <attribute name="action">view.save-as</attribute>
+ </item>
+ </section>
+ <section id="gb-view-stack-print">
+ <item>
+ <attribute name="label" translatable="yes">Print</attribute>
+ <attribute name="action">view.print</attribute>
+ </item>
+ </section>
+ <section id="gb-view-stack-close">
+ <item>
+ <attribute name="label" translatable="yes">_Close</attribute>
+ <attribute name="action">view-stack.close</attribute>
+ </item>
+ </section>
+ </menu>
</interface>
diff --git a/src/views/gb-view-stack-private.h b/src/views/gb-view-stack-private.h
index a09389e..72fd21c 100644
--- a/src/views/gb-view-stack-private.h
+++ b/src/views/gb-view-stack-private.h
@@ -47,6 +47,7 @@ struct _GbViewStack
GtkLabel *modified_label;
GtkPopover *popover;
GtkStack *stack;
+ GMenuModel *stack_menu;
GtkLabel *title_label;
GtkListBox *views_button;
GtkListBox *views_listbox;
diff --git a/src/views/gb-view-stack.c b/src/views/gb-view-stack.c
index 5926b1f..ffd0612 100644
--- a/src/views/gb-view-stack.c
+++ b/src/views/gb-view-stack.c
@@ -553,6 +553,7 @@ gb_view_stack_class_init (GbViewStackClass *klass)
GB_WIDGET_CLASS_BIND (klass, GbViewStack, modified_label);
GB_WIDGET_CLASS_BIND (klass, GbViewStack, popover);
GB_WIDGET_CLASS_BIND (klass, GbViewStack, stack);
+ GB_WIDGET_CLASS_BIND (klass, GbViewStack, stack_menu);
GB_WIDGET_CLASS_BIND (klass, GbViewStack, title_label);
GB_WIDGET_CLASS_BIND (klass, GbViewStack, views_button);
GB_WIDGET_CLASS_BIND (klass, GbViewStack, views_listbox);
@@ -562,15 +563,9 @@ gb_view_stack_class_init (GbViewStackClass *klass)
static void
gb_view_stack_init (GbViewStack *self)
{
- GtkApplication *app;
- GMenu *menu;
-
gtk_widget_init_template (GTK_WIDGET (self));
- app = GTK_APPLICATION (g_application_get_default ());
- menu = gtk_application_get_menu_by_id (app, "gb-view-stack-menu");
-
- gtk_popover_bind_model (self->popover, G_MENU_MODEL (menu), NULL);
+ gtk_popover_bind_model (self->popover, self->stack_menu, NULL);
g_signal_connect_object (self->stack,
"notify::visible-child",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]