[devhelp/wip/stuff: 2/2] window: fallback app actions into gear menu if no app menu is allowed
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devhelp/wip/stuff: 2/2] window: fallback app actions into gear menu if no app menu is allowed
- Date: Tue, 30 Jul 2013 15:54:28 +0000 (UTC)
commit 788d2e36290c75f2291b606323e441c71b637977
Author: Ignacio Casal Quinteiro <ignacio casal nice-software com>
Date: Tue Jul 30 17:53:40 2013 +0200
window: fallback app actions into gear menu if no app menu is allowed
src/dh-window.c | 8 ++++++
src/dh-window.ui | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 72 insertions(+), 3 deletions(-)
---
diff --git a/src/dh-window.c b/src/dh-window.c
index 269b1c9..eba57be 100644
--- a/src/dh-window.c
+++ b/src/dh-window.c
@@ -40,6 +40,7 @@
#define TAB_WIDTH_N_CHARS 15
typedef struct {
+ GMenuModel *gear_app_menu;
GtkWidget *hpaned;
GtkWidget *sidebar;
GtkWidget *notebook;
@@ -48,6 +49,7 @@ typedef struct {
GtkImage *back_button_image;
GtkWidget *forward_button;
GtkImage *forward_button_image;
+ GtkMenuButton *gear_menu_button;
GtkWidget *close_button;
GtkWidget *grid_sidebar;
GtkWidget *grid_documents;
@@ -520,6 +522,10 @@ dh_window_init (DhWindow *window)
priv = dh_window_get_instance_private (window);
priv->selected_search_link = NULL;
+ if (!_dh_app_has_app_menu (DH_APP (g_application_get_default ()))) {
+ gtk_menu_button_set_menu_model (priv->gear_menu_button, priv->gear_app_menu);
+ }
+
/* handle settings */
priv->settings = dh_settings_get ();
priv->fonts_changed_id = g_signal_connect (priv->settings,
@@ -593,11 +599,13 @@ dh_window_class_init (DhWindowClass *klass)
/* Bind class to template */
gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/devhelp/dh-window.ui");
+ gtk_widget_class_bind_template_child_private (widget_class, DhWindow, gear_app_menu);
gtk_widget_class_bind_template_child_private (widget_class, DhWindow, header_bar);
gtk_widget_class_bind_template_child_private (widget_class, DhWindow, back_button);
gtk_widget_class_bind_template_child_private (widget_class, DhWindow, back_button_image);
gtk_widget_class_bind_template_child_private (widget_class, DhWindow, forward_button);
gtk_widget_class_bind_template_child_private (widget_class, DhWindow, forward_button_image);
+ gtk_widget_class_bind_template_child_private (widget_class, DhWindow, gear_menu_button);
gtk_widget_class_bind_template_child_private (widget_class, DhWindow, close_button);
gtk_widget_class_bind_template_child_private (widget_class, DhWindow, hpaned);
gtk_widget_class_bind_template_child_private (widget_class, DhWindow, grid_sidebar);
diff --git a/src/dh-window.ui b/src/dh-window.ui
index 94067f3..398b091 100644
--- a/src/dh-window.ui
+++ b/src/dh-window.ui
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.8 -->
- <menu id="gear-menu">
+ <menu id="gear_menu">
<section>
<item>
<attribute name="label" translatable="yes">New _Tab</attribute>
@@ -40,6 +40,67 @@
</item>
</section>
</menu>
+ <menu id="gear_app_menu">
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">New _Window</attribute>
+ <attribute name="action">app.new-window</attribute>
+ <attribute name="accel"><Primary>n</attribute>
+ </item>
+ <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>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_Preferences</attribute>
+ <attribute name="action">app.preferences</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_About Devhelp</attribute>
+ <attribute name="action">app.about</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_Quit</attribute>
+ <attribute name="action">app.quit</attribute>
+ <attribute name="accel"><Primary>q</attribute>
+ </item>
+ </section>
+ </menu>
<template class="DhWindow" parent="GtkApplicationWindow">
<property name="can_focus">False</property>
<property name="has_focus">False</property>
@@ -100,12 +161,12 @@
</packing>
</child>
<child>
- <object class="GtkMenuButton" id="gear_menu">
+ <object class="GtkMenuButton" id="gear_menu_button">
<property name="visible">True</property>
<property name="valign">center</property>
<property name="can_focus">False</property>
<property name="action_name">win.gear-menu</property>
- <property name="menu_model">gear-menu</property>
+ <property name="menu_model">gear_menu</property>
<style>
<class name="image-button"/>
</style>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]