Commit 9aa739a9 authored by Christopher Davis's avatar Christopher Davis

Replace AppMenu with Primary Menu

Retires the AppMenu in favor of a Primary Menu,
as a part of the ongoing initiative:
https://gitlab.gnome.org/GNOME/Initiatives/issues/4

The new AppMenu has it's own source file and .ui file,
the .ui file replacing app-menu.ui. "About" has been
renamed to "About Music".

Related to https://gitlab.gnome.org/GNOME/gnome-music/issues/229
parent 4d030c44
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/Music">
<file alias="gtk/menus.ui" preprocess="xml-stripblanks">ui/app-menu.ui</file>
<file alias="gtk/help-overlay.ui" preprocess="xml-stripblanks">ui/help-overlay.ui</file>
<file>org.gnome.Music.css</file>
<file>icons/initial-state.png</file>
<file preprocess="xml-stripblanks">ui/AboutDialog.ui</file>
<file preprocess="xml-stripblanks">ui/AlbumCover.ui</file>
<file preprocess="xml-stripblanks">ui/AlbumWidget.ui</file>
<file preprocess="xml-stripblanks">ui/AppMenu.ui</file>
<file preprocess="xml-stripblanks">ui/ArtistAlbumWidget.ui</file>
<file preprocess="xml-stripblanks">ui/ArtistAlbumsWidget.ui</file>
<file preprocess="xml-stripblanks">ui/DiscBox.ui</file>
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<template class="AppMenu" parent="GtkPopoverMenu">
<property name="can_focus">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin">6</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkModelButton" id="_keyboard_shortcuts_model_button">
<property name="halign">fill</property>
<property name="hexpand">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="action_name">win.show-help-overlay</property>
<property name="text" translatable="yes">_Keyboard Shortcuts</property>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkModelButton" id="_help_model_button">
<property name="halign">fill</property>
<property name="hexpand">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="action_name">app.help</property>
<property name="text" translatable="yes">_Help</property>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkModelButton" id="_about_model_button">
<property name="halign">fill</property>
<property name="hexpand">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="action_name">app.about</property>
<property name="text" translatable="yes">_About Music</property>
</object>
<packing>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="submenu">main</property>
<property name="position">1</property>
</packing>
</child>
</template>
</interface>
......@@ -4,6 +4,29 @@
<template class="HeaderBar" parent="GtkHeaderBar">
<property name="visible">True</property>
<property name="vexpand">False</property>
<child>
<object class="GtkMenuButton" id="_menu_button">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
<property name="sensitive">True</property>
<property name="tooltip_text" translatable="yes">Menu</property>
<style>
<class name="image-button"/>
</style>
<child>
<object class="GtkImage" id="_menu_button_image">
<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>
</object>
<packing>
<property name="pack_type">end</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="_search_button">
<property name="visible">True</property>
......
<interface>
<menu id="app-menu">
<section>
<item>
<attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
<attribute name="action">win.show-help-overlay</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="action">app.about</attribute>
<attribute name="label" translatable="yes">_About</attribute>
</item>
<item>
<attribute name="action">app.quit</attribute>
<attribute name="label" translatable="yes">_Quit</attribute>
<attribute name="accel">&lt;Primary&gt;q</attribute>
</item>
</section>
</menu>
</interface>
# Copyright 2018 The GNOME Music developers
#
# GNOME Music 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.
#
# GNOME Music 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 GNOME Music; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# The GNOME Music authors hereby grant permission for non-GPL compatible
# GStreamer plugins to be used and distributed together with GStreamer
# and GNOME Music. This permission is above and beyond the permissions
# granted by the GPL license by which GNOME Music is covered. If you
# modify this code, you may extend this exception to your version of the
# code, but you are not obligated to do so. If you do not wish to do so,
# delete this exception statement from your version.
from gi.repository import Gtk
@Gtk.Template(resource_path="/org/gnome/Music/ui/AppMenu.ui")
class AppMenu(Gtk.PopoverMenu):
"""AppMenu shown from the HeaderBar within the main view"""
__gtype_name__ = "AppMenu"
def __repr__(self):
return "<AppMenu>"
def __init__(self):
super().__init__()
......@@ -28,6 +28,7 @@ from gettext import gettext as _, ngettext
from gi.repository import GObject, Gtk
from gnomemusic import log
from gnomemusic.widgets.appmenu import AppMenu
@Gtk.Template(resource_path="/org/gnome/Music/ui/SelectionBarMenuButton.ui")
......@@ -95,6 +96,7 @@ class HeaderBar(Gtk.HeaderBar):
_select_button = Gtk.Template.Child()
_cancel_button = Gtk.Template.Child()
_back_button = Gtk.Template.Child()
_menu_button = Gtk.Template.Child()
search_mode_enabled = GObject.Property(type=bool, default=False)
selected_items_count = GObject.Property(type=int, default=0, minimum=0)
......@@ -116,6 +118,8 @@ class HeaderBar(Gtk.HeaderBar):
self._selection_menu = SelectionBarMenuButton()
self._menu_button.set_popover(AppMenu())
self.bind_property(
"selection-mode", self, "show-close-button",
GObject.BindingFlags.INVERT_BOOLEAN |
......@@ -226,6 +230,11 @@ class HeaderBar(Gtk.HeaderBar):
and self.props.state != HeaderBar.State.EMPTY
)
self._menu_button.props.visible = (
not self.props.selection_mode
and self.props.state == HeaderBar.State.MAIN
)
@log
def _on_selection_mode_allowed_changed(self, widget, data):
if self.props.selection_mode_allowed:
......
......@@ -5,7 +5,7 @@ data/org.gnome.Music.desktop.in.in
data/org.gnome.Music.gschema.xml
data/ui/AboutDialog.ui.in
data/ui/AlbumWidget.ui
data/ui/app-menu.ui
data/ui/AppMenu.ui
data/ui/HeaderBar.ui
data/ui/help-overlay.ui
data/ui/PlayerToolbar.ui
......
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