Commit 2530f3b9 authored by Christopher Davis's avatar Christopher Davis 🌱

Retire app menu

As per GNOME/Initiatives#4,
the application menu is being retired.

The application menu has been moved into a primary menu within
Usage, with "About" being changed to "About Usage".

Related to GNOME/gnome-usage#52
parent 488677b0
Pipeline #38983 passed with stage
in 2 minutes and 26 seconds
resource_data = files(
'interface/adwaita.css',
'ui/primary-menu.ui',
'ui/header-bar.ui',
'ui/memory-speedometer.ui',
'ui/no-results-found-view.ui',
......
......@@ -2,6 +2,7 @@
<gresources>
<gresource prefix="/org/gnome/Usage">
<file compressed="true">interface/adwaita.css</file>
<file preprocess="xml-stripblanks">ui/primary-menu.ui</file>
<file preprocess="xml-stripblanks">ui/header-bar.ui</file>
<file preprocess="xml-stripblanks">ui/memory-speedometer.ui</file>
<file preprocess="xml-stripblanks">ui/no-results-found-view.ui</file>
......
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.9 -->
<!-- interface-requires gtk+ 3.12 -->
<template class="UsageHeaderBar" parent="GtkHeaderBar">
<property name="visible">False</property>
......@@ -30,6 +30,21 @@
</object>
</child>
<child>
<object class="GtkMenuButton" id="primary_menu_button">
<property name="visible">True</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="icon-name">open-menu-symbolic</property>
</object>
</child>
</object>
<packing>
<property name="pack-type">end</property>
</packing>
</child>
<child>
<object class="GtkButton" id="storage_rescan_button">
<property name="visible">False</property>
......@@ -96,3 +111,4 @@
</child>
</template>
</interface>
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.16 -->
<template class="UsagePrimaryMenu" parent="GtkPopover">
<child>
<object class="GtkBox" id="primary_menu_container">
<property name="visible">True</property>
<property name="margin">6</property>
<child>
<object class="GtkModelButton" id="about_usage_button">
<property name="visible">True</property>
<property name="action-name">app.about</property>
<property name="text" translatable="yes">_About Usage</property>
</object>
</child>
</object>
</child>
</template>
</interface>
......@@ -50,21 +50,8 @@ namespace Usage
window = new Window(this);
// Create menu
GLib.Menu menu_preferences = new GLib.Menu();
GLib.Menu menu_common = new GLib.Menu();
var item = new GLib.MenuItem (_("About"), "app.about");
menu_common.append_item(item);
set_accels_for_action("app.quit", {"<Primary>q"});
item = new GLib.MenuItem (_("Quit"), "app.quit");
item.set_attribute("accel", "s", "<Primary>q");
menu_common.append_item(item);
GLib.Menu menu = new GLib.Menu();
menu.append_section(null, menu_preferences);
menu.append_section(null, menu_common);
set_app_menu(menu);
window.show_all();
}
......
......@@ -49,9 +49,13 @@ namespace Usage
[GtkChild]
private Gtk.Button storage_cancel_button;
[GtkChild]
private Gtk.MenuButton primary_menu_button;
private Gtk.MenuButton? storage_selection_menu;
private string title_text = "";
private HeaderBarMode mode;
private Usage.PrimaryMenu menu;
const GLib.ActionEntry[] select_action_entries = {
{ "select-all", select_all },
......@@ -61,7 +65,9 @@ namespace Usage
public HeaderBar(Gtk.Stack stack)
{
mode = HeaderBarMode.PERFORMANCE;
menu = new Usage.PrimaryMenu();
stack_switcher.set_stack(stack);
this.primary_menu_button.set_popover(menu);
set_mode(HeaderBarMode.PERFORMANCE);
}
......
......@@ -22,6 +22,7 @@ vala_sources = [
'no-results-found-view.vala',
'performance-view.vala',
'pie-chart.vala',
'primary-menu.vala',
'process-list-box.vala',
'process-row.vala',
'process.vala',
......
/* primary-menu.vala
*
* Copyright 2018 Christopher Davis <brainblasted@disroot.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
using Gtk;
namespace Usage {
[GtkTemplate (ui="/org/gnome/Usage/ui/primary-menu.ui")]
public class PrimaryMenu : Gtk.Popover {
[GtkChild]
private Gtk.ModelButton about_usage_button;
public PrimaryMenu() {
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment