[gnome-calculator] Remove app menu
- From: Robert Roth <robertroth src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calculator] Remove app menu
- Date: Thu, 5 Jul 2018 16:06:30 +0000 (UTC)
commit f3701900b0a51d876946e8f5211c5dfd1b91b293
Author: Robert Ancell <robert ancell canonical com>
Date: Mon Jul 2 12:30:34 2018 +1200
Remove app menu
https://wiki.gnome.org/Initiatives/GnomeGoals/AppMenuRetirement
po/POTFILES.in | 1 -
src/gnome-calculator.gresource.xml | 1 -
src/gnome-calculator.vala | 14 +---------
src/math-window.ui | 54 ++++++++++++++++++++++++++++++++++++++
src/menu.ui | 41 -----------------------------
5 files changed, 55 insertions(+), 56 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index c20d1139..d7bf6867 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -11,7 +11,6 @@ src/math-function-popover.ui
src/math-variable-popover.ui
src/math-window.ui
src/math-shortcuts.ui
-src/menu.ui
data/org.gnome.calculator.gschema.xml
lib/currency.vala
lib/equation-lexer.vala
diff --git a/src/gnome-calculator.gresource.xml b/src/gnome-calculator.gresource.xml
index 403c0456..4196d220 100644
--- a/src/gnome-calculator.gresource.xml
+++ b/src/gnome-calculator.gresource.xml
@@ -12,7 +12,6 @@
<file preprocess="xml-stripblanks">math-variable-popover.ui</file>
<file preprocess="xml-stripblanks">math-window.ui</file>
<file preprocess="xml-stripblanks">math-shortcuts.ui</file>
- <file preprocess="xml-stripblanks">menu.ui</file>
<file>calculator.css</file>
</gresource>
</gresources>
diff --git a/src/gnome-calculator.vala b/src/gnome-calculator.vala
index 9f2549e7..17a49e6e 100644
--- a/src/gnome-calculator.vala
+++ b/src/gnome-calculator.vala
@@ -93,19 +93,6 @@ public class Calculator : Gtk.Application
buttons.programming_base = number_base;
buttons.mode = button_mode; // FIXME: We load the basic buttons even if we immediately switch to the
next type
- var builder = new Gtk.Builder ();
- try
- {
- builder.add_from_resource ("/org/gnome/calculator/menu.ui");
- }
- catch (Error e)
- {
- error ("Error loading menu UI: %s", e.message);
- }
-
- var menu = builder.get_object ("appmenu") as MenuModel;
- set_app_menu (menu);
-
set_accels_for_action ("win.mode::basic", {"<alt>B"});
set_accels_for_action ("win.mode::advanced", {"<alt>A"});
set_accels_for_action ("win.mode::financial", {"<alt>F"});
@@ -116,6 +103,7 @@ public class Calculator : Gtk.Application
set_accels_for_action ("win.undo", {"<control>Z"});
set_accels_for_action ("win.close", {"<control>W"});
set_accels_for_action ("win.redo", {"<control><shift>Z"});
+ set_accels_for_action ("app.quit", {"<control>Q"});
return current_window;
}
diff --git a/src/math-window.ui b/src/math-window.ui
index 5d6e97e7..bc1233d5 100644
--- a/src/math-window.ui
+++ b/src/math-window.ui
@@ -43,6 +43,38 @@
</item>
</section>
</menu>
+ <menu id="primary_menu">
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">New Window</attribute>
+ <attribute name="action">app.newwindow</attribute>
+ <attribute name="accel"><Primary>n</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">Preferences</attribute>
+ <attribute name="action">app.preferences</attribute>
+ </item>
+ </section>
+ <section>
+ <attribute name="id">help-section</attribute>
+ <item>
+ <attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
+ <attribute name="action">app.shortcuts</attribute>
+ <attribute name="accel"><Primary>question</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Help</attribute>
+ <attribute name="action">app.help</attribute>
+ <attribute name="accel">F1</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">About</attribute>
+ <attribute name="action">app.about</attribute>
+ </item>
+ </section>
+ </menu>
<template class="MathWindow" parent="GtkApplicationWindow">
<property name="can_focus">False</property>
<property name="title" translatable="yes">Calculator</property>
@@ -123,6 +155,28 @@
</style>
</object>
</child>
+ <child>
+ <object class="GtkMenuButton">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="receives_default">False</property>
+ <property name="menu_model">primary_menu</property>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">open-menu-symbolic</property>
+ <property name="icon_size">1</property>
+ </object>
+ </child>
+ <style>
+ <class name="image-button"/>
+ </style>
+ </object>
+ <packing>
+ <property name="pack_type">end</property>
+ </packing>
+ </child>
</object>
</child>
</template>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]