[devhelp] window: move menubar to gnome3 style menu button
- From: Thomas Bechtold <toabctl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devhelp] window: move menubar to gnome3 style menu button
- Date: Fri, 1 Feb 2013 15:13:41 +0000 (UTC)
commit c9395dc32e99b392d2ccfb5a82e2efa576ba752b
Author: Thomas Bechtold <thomasbechtold jpberlin de>
Date: Fri Feb 1 16:11:10 2013 +0100
window: move menubar to gnome3 style menu button
src/devhelp.ui | 191 +++++++++++--------------------------------------------
src/dh-app.c | 3 -
src/dh-window.c | 13 +++-
3 files changed, 46 insertions(+), 161 deletions(-)
---
diff --git a/src/devhelp.ui b/src/devhelp.ui
index 23b3c54..0a899b1 100644
--- a/src/devhelp.ui
+++ b/src/devhelp.ui
@@ -51,162 +51,45 @@
</menu>
<menu id="window-menu">
- <submenu>
- <attribute name="label" translatable="yes">_Window</attribute>
- <section>
- <item>
- <attribute name="label" translatable="yes">New _Tab</attribute>
- <attribute name="action">win.new-tab</attribute>
- <attribute name="accel"><Primary>t</attribute>
- <attribute name="use-underline">True</attribute>
- </item>
- </section>
- <section>
- <item>
- <attribute name="label" translatable="yes">_Print</attribute>
- <attribute name="action">win.print</attribute>
- <attribute name="accel"><Primary>p</attribute>
- </item>
- </section>
- <section>
- <item>
- <attribute name="label" translatable="yes">_Close</attribute>
- <attribute name="action">win.close</attribute>
- <attribute name="accel"><Primary>w</attribute>
- </item>
- </section>
- </submenu>
- <submenu>
- <attribute name="label" translatable="yes">_Edit</attribute>
- <section>
- <item>
- <attribute name="label" translatable="yes">_Copy</attribute>
- <attribute name="action">win.copy</attribute>
- <attribute name="accel"><Primary>c</attribute>
- </item>
- </section>
- <section>
- <item>
- <attribute name="label" translatable="yes">_Find</attribute>
- <attribute name="action">win.find</attribute>
- <attribute name="accel"><Primary>f</attribute>
- </item>
- <item>
- <attribute name="label" translatable="yes">Find _Next</attribute>
- <attribute name="action">win.find-next</attribute>
- <attribute name="accel"><Primary>g</attribute>
- </item>
- <item>
- <attribute name="label" translatable="yes">Find _Previous</attribute>
- <attribute name="action">win.find-previous</attribute>
- <attribute name="accel"><Primary><Alt>g</attribute>
- </item>
- </section>
- </submenu>
- <submenu>
- <attribute name="label" translatable="yes">_View</attribute>
- <section>
- <item>
- <attribute name="label" translatable="yes">_Larger text</attribute>
- <attribute name="action">win.zoom-in</attribute>
- <attribute name="accel"><Primary>plus</attribute>
- </item>
- <item>
- <attribute name="label" translatable="yes">S_maller text</attribute>
- <attribute name="action">win.zoom-out</attribute>
- <attribute name="accel"><Primary>minus</attribute>
- </item>
- <item>
- <attribute name="label" translatable="yes">_Normal size</attribute>
- <attribute name="action">win.zoom-default</attribute>
- <attribute name="accel"><Primary>0</attribute>
- </item>
- </section>
- </submenu>
- <submenu>
- <attribute name="label" translatable="yes">_Go</attribute>
- <section>
- <item>
- <attribute name="label" translatable="yes">_Back</attribute>
- <attribute name="action">win.go-back</attribute>
- <attribute name="accel"><Alt>Left</attribute>
- </item>
- <item>
- <attribute name="label" translatable="yes">_Forward</attribute>
- <attribute name="action">win.go-forward</attribute>
- <attribute name="accel"><Alt>Right</attribute>
- </item>
- </section>
- <section>
- <item>
- <attribute name="label" translatable="yes">_Search Tab</attribute>
- <attribute name="action">win.go-search-tab</attribute>
- <attribute name="accel"><Primary>s</attribute>
- </item>
- <item>
- <attribute name="label" translatable="yes">_Contents Tab</attribute>
- <attribute name="action">win.go-contents-tab</attribute>
- <attribute name="accel"><Primary>b</attribute>
- </item>
- </section>
- </submenu>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">New _Tab</attribute>
+ <attribute name="action">win.new-tab</attribute>
+ <attribute name="accel"><Primary>t</attribute>
+ <attribute name="use-underline">True</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_Print</attribute>
+ <attribute name="action">win.print</attribute>
+ <attribute name="accel"><Primary>p</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_Find</attribute>
+ <attribute name="action">win.find</attribute>
+ <attribute name="accel"><Primary>f</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_Larger text</attribute>
+ <attribute name="action">win.zoom-in</attribute>
+ <attribute name="accel"><Primary>plus</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">S_maller text</attribute>
+ <attribute name="action">win.zoom-out</attribute>
+ <attribute name="accel"><Primary>minus</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_Normal size</attribute>
+ <attribute name="action">win.zoom-default</attribute>
+ <attribute name="accel"><Primary>0</attribute>
+ </item>
+ </section>
</menu>
- <object class="GtkToolbar" id="toolbar">
- <property name="visible">True</property>
- <property name="expand">False</property>
- <child>
- <object class="GtkToolButton" id="back-button">
- <property name="is-important">True</property>
- <property name="stock_id">gtk-go-back</property>
- <property name="action_name">win.go-back</property>
- <property name="use_action_appearance">True</property>
- <property name="tooltip_text" translatable="yes">Go to the previous page</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
- </child>
- <child>
- <object class="GtkToolButton" id="forward-button">
- <property name="is-important">True</property>
- <property name="stock_id">gtk-go-forward</property>
- <property name="action_name">win.go-forward</property>
- <property name="use_action_appearance">True</property>
- <property name="tooltip_text" translatable="yes">Go to the next page</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
- </child>
- <child>
- <object class="GtkToolButton" id="zoom-out-button">
- <property name="stock_id">gtk-zoom-out</property>
- <property name="action_name">win.zoom-out</property>
- <property name="use_action_appearance">True</property>
- <property name="tooltip_text" translatable="yes">Decrease the text size</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
- </child>
- <child>
- <object class="GtkToolButton" id="zoom-in-button">
- <property name="stock_id">gtk-zoom-in</property>
- <property name="action_name">win.zoom-in</property>
- <property name="use_action_appearance">True</property>
- <property name="tooltip_text" translatable="yes">Increase the text size</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
- </child>
- </object>
-
<object class="GtkListStore" id="bookshelf_store">
<columns>
<!-- column-name enabled -->
diff --git a/src/dh-app.c b/src/dh-app.c
index 579ec6f..c19b73c 100644
--- a/src/dh-app.c
+++ b/src/dh-app.c
@@ -289,9 +289,6 @@ setup_menu (DhApp *self)
model = G_MENU_MODEL (gtk_builder_get_object (builder, "app-menu"));
gtk_application_set_app_menu (GTK_APPLICATION (self), model);
- model = G_MENU_MODEL (gtk_builder_get_object (builder, "window-menu"));
- gtk_application_set_menubar (GTK_APPLICATION (self), model);
-
g_object_unref (builder);
}
diff --git a/src/dh-window.c b/src/dh-window.c
index 2f28cf7..ab49ece 100644
--- a/src/dh-window.c
+++ b/src/dh-window.c
@@ -642,6 +642,8 @@ window_populate (DhWindow *window)
GtkWidget *back;
GtkWidget *forward;
GtkWidget *box;
+ GtkWidget *menu_button;
+ GtkWidget *menu;
priv = window->priv;
book_manager = dh_app_peek_book_manager (DH_APP (gtk_window_get_application (GTK_WINDOW (window))));
@@ -661,11 +663,14 @@ window_populate (DhWindow *window)
gtk_style_context_add_class (gtk_widget_get_style_context (box), "linked");
gtk_widget_reparent (back, box);
gtk_widget_reparent (forward, box);
+
gd_main_toolbar_add_widget (GD_MAIN_TOOLBAR (priv->toolbar), box, TRUE);
- gd_main_toolbar_add_menu (GD_MAIN_TOOLBAR (priv->toolbar),
- "emblem-system-symbolic",
- "",
- FALSE);
+ menu_button = gd_main_toolbar_add_menu (GD_MAIN_TOOLBAR (priv->toolbar),
+ "emblem-system-symbolic",
+ "",
+ FALSE);
+ menu = gtk_builder_get_object (priv->builder, "window-menu");
+ gtk_menu_button_set_menu_model (menu_button, menu);
/* Add toolbar to main box */
gtk_box_pack_start (GTK_BOX (priv->main_box), priv->toolbar,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]