diff -Nru gnome-music-41.0/debian/changelog gnome-music-41.0/debian/changelog --- gnome-music-41.0/debian/changelog 2022-02-13 15:34:35.000000000 +0000 +++ gnome-music-41.0/debian/changelog 2022-02-17 17:54:10.000000000 +0000 @@ -1,3 +1,11 @@ +gnome-music (41.0-4) unstable; urgency=medium + + * Cherry-pick patch to drop obsolete GNOME MediaKeys support + * Cherry-pick patches to support GNOME 42 dark theme preference + * debian/control.in: Bump minimum libhandy to 1.5.90 + + -- Jeremy Bicha Thu, 17 Feb 2022 12:54:10 -0500 + gnome-music (41.0-2) unstable; urgency=medium * Team upload diff -Nru gnome-music-41.0/debian/control gnome-music-41.0/debian/control --- gnome-music-41.0/debian/control 2022-02-13 15:34:35.000000000 +0000 +++ gnome-music-41.0/debian/control 2022-02-17 17:54:10.000000000 +0000 @@ -20,7 +20,7 @@ libgoa-1.0-dev (>= 3.35.90), libgrilo-0.3-dev (>= 0.3.13), libgtk-3-dev (>= 3.24.14), - libhandy-1-dev (>= 1.2.0), + libhandy-1-dev (>= 1.5.90), libmediaart-2.0-dev (>= 1.9.1), libpango1.0-dev (>= 1.44.0), librsvg2-common:native, @@ -46,7 +46,7 @@ gir1.2-gst-plugins-base-1.0, gir1.2-gstreamer-1.0, gir1.2-gtk-3.0 (>= 3.24.14), - gir1.2-handy-1 (>= 1.2.0), + gir1.2-handy-1 (>= 1.5.90), gir1.2-mediaart-2.0 (>= 1.9.1), gir1.2-pango-1.0 (>= 1.44.0), gir1.2-soup-2.4, diff -Nru gnome-music-41.0/debian/control.in gnome-music-41.0/debian/control.in --- gnome-music-41.0/debian/control.in 2022-02-13 15:34:35.000000000 +0000 +++ gnome-music-41.0/debian/control.in 2022-02-17 17:54:10.000000000 +0000 @@ -16,7 +16,7 @@ libgoa-1.0-dev (>= 3.35.90), libgrilo-0.3-dev (>= 0.3.13), libgtk-3-dev (>= 3.24.14), - libhandy-1-dev (>= 1.2.0), + libhandy-1-dev (>= 1.5.90), libmediaart-2.0-dev (>= 1.9.1), libpango1.0-dev (>= 1.44.0), librsvg2-common:native, @@ -42,7 +42,7 @@ gir1.2-gst-plugins-base-1.0, gir1.2-gstreamer-1.0, gir1.2-gtk-3.0 (>= 3.24.14), - gir1.2-handy-1 (>= 1.2.0), + gir1.2-handy-1 (>= 1.5.90), gir1.2-mediaart-2.0 (>= 1.9.1), gir1.2-pango-1.0 (>= 1.44.0), gir1.2-soup-2.4, diff -Nru gnome-music-41.0/debian/patches/application-Opt-in-to-libhandy-dark-style.patch gnome-music-41.0/debian/patches/application-Opt-in-to-libhandy-dark-style.patch --- gnome-music-41.0/debian/patches/application-Opt-in-to-libhandy-dark-style.patch 1970-01-01 00:00:00.000000000 +0000 +++ gnome-music-41.0/debian/patches/application-Opt-in-to-libhandy-dark-style.patch 2022-02-17 17:54:10.000000000 +0000 @@ -0,0 +1,49 @@ +From: Christopher Davis +Date: Sat, 25 Sep 2021 18:58:56 -0700 +Subject: application: Opt in to libhandy dark style + +GNOME is getting support for a global dark style preference +in GNOME 42. For GTK3 apps we can use libhandy to opt +in to using this preference. + +(cherry picked from commit 31461b860243a5e38825377ee727c07c65f74025) +--- + gnomemusic/application.py | 4 +++- + meson.build | 2 +- + 2 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/gnomemusic/application.py b/gnomemusic/application.py +index c92a6aa..17ac06b 100644 +--- a/gnomemusic/application.py ++++ b/gnomemusic/application.py +@@ -32,7 +32,7 @@ + + from gettext import gettext as _ + +-from gi.repository import Gtk, Gio, GLib, Gdk, GObject ++from gi.repository import Gtk, Gio, GLib, Gdk, GObject, Handy + + from gnomemusic.coregrilo import CoreGrilo + from gnomemusic.coremodel import CoreModel +@@ -220,6 +220,8 @@ class Application(Gtk.Application): + + def do_startup(self): + Gtk.Application.do_startup(self) ++ Handy.StyleManager.get_default().set_color_scheme( ++ Handy.ColorScheme.PREFER_LIGHT) + self._set_actions() + + def _quit(self, action=None, param=None): +diff --git a/meson.build b/meson.build +index 1c283df..2f32bad 100644 +--- a/meson.build ++++ b/meson.build +@@ -45,7 +45,7 @@ dependency('glib-2.0', version: '>= 2.67.1') + dependency('goa-1.0', version: '>= 3.35.90') + dependency('gobject-introspection-1.0', version: '>= 1.35.0') + dependency('gtk+-3.0', version: '>= 3.24.14') +-dependency('libhandy-1', version: '>= 1.2.0') ++dependency('libhandy-1', version: '>= 1.5.0') + dependency('libdazzle-1.0', version: '>= 3.28.0') + dependency('libmediaart-2.0', version: '>= 1.9.1') + dependency('libsoup-2.4') diff -Nru gnome-music-41.0/debian/patches/artstack-Reload-default-icon-when-dark-style-pref-changes.patch gnome-music-41.0/debian/patches/artstack-Reload-default-icon-when-dark-style-pref-changes.patch --- gnome-music-41.0/debian/patches/artstack-Reload-default-icon-when-dark-style-pref-changes.patch 1970-01-01 00:00:00.000000000 +0000 +++ gnome-music-41.0/debian/patches/artstack-Reload-default-icon-when-dark-style-pref-changes.patch 2022-02-17 17:54:10.000000000 +0000 @@ -0,0 +1,141 @@ +From: Christopher Davis +Date: Sat, 27 Nov 2021 18:50:13 -0800 +Subject: artstack: Reload default icon when dark style pref changes + +(cherry picked from commit 25748fff428b0df5fb5910da0af67f2a0dc657f8) +--- + gnomemusic/defaulticon.py | 32 +++++++++++++++++++++----------- + gnomemusic/widgets/artstack.py | 16 +++++++++++++++- + 2 files changed, 36 insertions(+), 12 deletions(-) + +diff --git a/gnomemusic/defaulticon.py b/gnomemusic/defaulticon.py +index c672e00..519b291 100644 +--- a/gnomemusic/defaulticon.py ++++ b/gnomemusic/defaulticon.py +@@ -22,6 +22,8 @@ + # 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 __future__ import annotations ++ + from enum import Enum + from math import pi + from typing import Dict, Tuple +@@ -34,7 +36,7 @@ from gnomemusic.utils import ArtSize + + def make_icon_frame( + icon_surface, art_size=None, scale=1, default_icon=False, +- round_shape=False): ++ round_shape=False, dark=False): + """Create an Art frame, square or round. + + :param cairo.Surface icon_surface: The surface to use +@@ -42,6 +44,7 @@ def make_icon_frame( + :param int scale: The scale of the art + :param bool default_icon: Indicates of this is a default icon + :param bool round_shape: Square or round indicator ++ :param bool dark: Theme dark mode + + :return: The framed surface + :rtype: cairo.Surface +@@ -76,11 +79,12 @@ def make_icon_frame( + ctx.arc(radius, h - radius, radius, 90 * degrees, 180 * degrees) + ctx.arc(radius, radius, radius, 180 * degrees, 270 * degrees) + +- fill_color = Gdk.RGBA(1.0, 1.0, 1.0, 1.0) +- icon_color = Gdk.RGBA(0.0, 0.0, 0.0, 0.3) +- if Handy.StyleManager.get_default().props.dark: ++ if dark: + fill_color = Gdk.RGBA(0.28, 0.28, 0.28, 1.0) + icon_color = Gdk.RGBA(1.0, 1.0, 1.0, 0.5) ++ else: ++ fill_color = Gdk.RGBA(1.0, 1.0, 1.0, 1.0) ++ icon_color = Gdk.RGBA(0.0, 0.0, 0.0, 0.3) + + if default_icon: + ctx.set_source_rgb(fill_color.red, fill_color.green, fill_color.blue) +@@ -106,20 +110,22 @@ class DefaultIcon(GObject.GObject): + ARTIST = "avatar-default-symbolic" + + _cache: Dict[ +- Tuple["DefaultIcon.Type", ArtSize, int, bool], cairo.Surface] = {} ++ Tuple[DefaultIcon.Type, ArtSize, int, bool, bool], cairo.Surface] = {} + + _default_theme = Gtk.IconTheme.get_default() + + def __init__(self): + super().__init__() + +- def _make_default_icon(self, icon_type, art_size, scale, round_shape): ++ def _make_default_icon( ++ self, icon_type: DefaultIcon.Type, art_size: ArtSize, scale: int, ++ round_shape: bool, dark: bool) -> cairo.Surface: + icon_info = self._default_theme.lookup_icon_for_scale( + icon_type.value, art_size.width / 3, scale, 0) + icon = icon_info.load_surface() + + icon_surface = make_icon_frame( +- icon, art_size, scale, True, round_shape=round_shape) ++ icon, art_size, scale, True, round_shape, dark) + + return icon_surface + +@@ -141,9 +147,13 @@ class DefaultIcon(GObject.GObject): + else: + round_shape = True + +- if (icon_type, art_size, scale, round_shape) not in self._cache.keys(): ++ dark = Handy.StyleManager.get_default().props.dark ++ ++ if (icon_type, art_size, ++ scale, round_shape, dark) not in self._cache.keys(): + new_icon = self._make_default_icon( +- icon_type, art_size, scale, round_shape) +- self._cache[(icon_type, art_size, scale, round_shape)] = new_icon ++ icon_type, art_size, scale, round_shape, dark) ++ self._cache[ ++ (icon_type, art_size, scale, round_shape, dark)] = new_icon + +- return self._cache[(icon_type, art_size, scale, round_shape)] ++ return self._cache[(icon_type, art_size, scale, round_shape, dark)] +diff --git a/gnomemusic/widgets/artstack.py b/gnomemusic/widgets/artstack.py +index 0c0b9d3..59974cb 100644 +--- a/gnomemusic/widgets/artstack.py ++++ b/gnomemusic/widgets/artstack.py +@@ -22,7 +22,7 @@ + # 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 GObject, Gtk ++from gi.repository import GObject, Gtk, Handy + + from gnomemusic.asyncqueue import AsyncQueue + from gnomemusic.artcache import ArtCache +@@ -69,6 +69,8 @@ class ArtStack(Gtk.Stack): + self.props.visible_child_name = "A" + + self.connect("destroy", self._on_destroy) ++ Handy.StyleManager.get_default().connect( ++ "notify::dark", self._on_dark_changed) + + @GObject.Property(type=object, flags=GObject.ParamFlags.READWRITE) + def size(self): +@@ -128,6 +130,18 @@ class ArtStack(Gtk.Stack): + if self._coreobject.props.thumbnail is not None: + self._on_thumbnail_changed(self._coreobject, None) + ++ def _on_dark_changed( ++ self, style_manager: Handy.StyleManager, ++ pspec: GObject.ParamSpecBoolean) -> None: ++ default_icon = DefaultIcon().get( ++ self._art_type, self._size, self.props.scale_factor) ++ ++ if self._coreobject: ++ if self._coreobject.props.thumbnail == "generic": ++ self._on_cache_result(self, default_icon) ++ else: ++ self._on_cache_result(self, default_icon) ++ + def _on_thumbnail_changed(self, coreobject, uri): + self._disconnect_cache() + diff -Nru gnome-music-41.0/debian/patches/defaulticon-Add-dark-placeholder-style.patch gnome-music-41.0/debian/patches/defaulticon-Add-dark-placeholder-style.patch --- gnome-music-41.0/debian/patches/defaulticon-Add-dark-placeholder-style.patch 1970-01-01 00:00:00.000000000 +0000 +++ gnome-music-41.0/debian/patches/defaulticon-Add-dark-placeholder-style.patch 2022-02-17 17:54:10.000000000 +0000 @@ -0,0 +1,46 @@ +From: Christopher Davis +Date: Thu, 7 Oct 2021 03:14:00 -0700 +Subject: defaulticon: Add dark placeholder style + +This currently only works when the app is +launched in dark mode. + +(cherry picked from commit f009ce71dc84af31ce7868c35a01b4e2908bc73d) +--- + gnomemusic/defaulticon.py | 14 +++++++++++--- + 1 file changed, 11 insertions(+), 3 deletions(-) + +diff --git a/gnomemusic/defaulticon.py b/gnomemusic/defaulticon.py +index 0ce4da6..c672e00 100644 +--- a/gnomemusic/defaulticon.py ++++ b/gnomemusic/defaulticon.py +@@ -27,7 +27,7 @@ from math import pi + from typing import Dict, Tuple + + import cairo +-from gi.repository import Gtk, GObject ++from gi.repository import Gtk, GObject, Gdk, Handy + + from gnomemusic.utils import ArtSize + +@@ -76,10 +76,18 @@ def make_icon_frame( + ctx.arc(radius, h - radius, radius, 90 * degrees, 180 * degrees) + ctx.arc(radius, radius, radius, 180 * degrees, 270 * degrees) + ++ fill_color = Gdk.RGBA(1.0, 1.0, 1.0, 1.0) ++ icon_color = Gdk.RGBA(0.0, 0.0, 0.0, 0.3) ++ if Handy.StyleManager.get_default().props.dark: ++ fill_color = Gdk.RGBA(0.28, 0.28, 0.28, 1.0) ++ icon_color = Gdk.RGBA(1.0, 1.0, 1.0, 0.5) ++ + if default_icon: +- ctx.set_source_rgb(1, 1, 1) ++ ctx.set_source_rgb(fill_color.red, fill_color.green, fill_color.blue) + ctx.fill() +- ctx.set_source_rgba(0, 0, 0, 0.3) ++ ctx.set_source_rgba( ++ icon_color.red, icon_color.green, icon_color.blue, ++ icon_color.alpha) + ctx.mask_surface(icon_surface, w / 3, h / 3) + ctx.fill() + else: diff -Nru gnome-music-41.0/debian/patches/remove-MediaKeys-api-support.patch gnome-music-41.0/debian/patches/remove-MediaKeys-api-support.patch --- gnome-music-41.0/debian/patches/remove-MediaKeys-api-support.patch 1970-01-01 00:00:00.000000000 +0000 +++ gnome-music-41.0/debian/patches/remove-MediaKeys-api-support.patch 2022-02-17 17:54:10.000000000 +0000 @@ -0,0 +1,160 @@ +From: Jean Felder +Date: Fri, 22 Oct 2021 01:47:00 +0200 +Subject: remove MediaKeys api support + +It has been superseded by MPRIS for a long time. + +See: https://gitlab.gnome.org/GNOME/gnome-settings-daemon/-/merge_requests/268 +(cherry picked from commit 2bc1623ca2bc28832dafd1f8f5d8743cb6252c11) +--- + gnomemusic/mediakeys.py | 106 ------------------------------------------------ + gnomemusic/window.py | 3 -- + org.gnome.Music.json | 1 - + 3 files changed, 110 deletions(-) + delete mode 100644 gnomemusic/mediakeys.py + +diff --git a/gnomemusic/mediakeys.py b/gnomemusic/mediakeys.py +deleted file mode 100644 +index f0ba162..0000000 +--- a/gnomemusic/mediakeys.py ++++ /dev/null +@@ -1,106 +0,0 @@ +-# 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 2 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 GObject, Gio, GLib, Gtk +- +-from gnomemusic.musiclogger import MusicLogger +- +- +-class MediaKeys(GObject.GObject): +- """Media keys handling for Music +- """ +- +- __gtype_name__ = 'MediaKeys' +- +- def __init__(self, player, window): +- """Initialize media keys handling +- +- :param Player player: Player object +- :param Gtk.Window window: Window to grab keys if focused +- """ +- super().__init__() +- +- self._log = MusicLogger() +- +- self._player = player +- self._window = window +- +- self._media_keys_proxy = None +- +- self._init_media_keys_proxy() +- +- def _init_media_keys_proxy(self): +- def name_appeared(connection, name, name_owner, data=None): +- Gio.DBusProxy.new_for_bus( +- Gio.BusType.SESSION, +- Gio.DBusProxyFlags.DO_NOT_LOAD_PROPERTIES, None, +- "org.gnome.SettingsDaemon.MediaKeys", +- "/org/gnome/SettingsDaemon/MediaKeys", +- "org.gnome.SettingsDaemon.MediaKeys", None, +- self._media_keys_proxy_ready) +- +- Gio.bus_watch_name( +- Gio.BusType.SESSION, "org.gnome.SettingsDaemon.MediaKeys", +- Gio.BusNameWatcherFlags.NONE, name_appeared, None) +- +- def _media_keys_proxy_ready(self, proxy, result, data=None): +- try: +- self._media_keys_proxy = proxy.new_finish(result) +- except GLib.Error as e: +- self._log.warning( +- "Error: Failed to contact settings daemon:", e.message) +- return +- +- self._media_keys_proxy.connect("g-signal", self._handle_media_keys) +- +- self._ctrlr = Gtk.EventControllerKey().new(self._window) +- self._ctrlr.props.propagation_phase = Gtk.PropagationPhase.CAPTURE +- self._ctrlr.connect("focus-in", self._grab_media_player_keys) +- +- def _grab_media_player_keys(self, controllerkey=None): +- def proxy_call_finished(proxy, result, data=None): +- try: +- proxy.call_finish(result) +- except GLib.Error as e: +- self._log.warning( +- "Error: Failed to grab mediaplayer keys: {}".format( +- e.message)) +- +- self._media_keys_proxy.call( +- "GrabMediaPlayerKeys", GLib.Variant("(su)", ("Music", 0)), +- Gio.DBusCallFlags.NONE, -1, None, proxy_call_finished) +- +- def _handle_media_keys(self, proxy, sender, signal, parameters): +- app, response = parameters.unpack() +- if app != "Music": +- return +- +- if "Play" in response: +- self._player.play_pause() +- elif "Stop" in response: +- self._player.stop() +- elif "Next" in response: +- self._player.next() +- elif "Previous" in response: +- self._player.previous() +diff --git a/gnomemusic/window.py b/gnomemusic/window.py +index 846e3b8..f365498 100644 +--- a/gnomemusic/window.py ++++ b/gnomemusic/window.py +@@ -26,7 +26,6 @@ from gi.repository import Gtk, Gdk, Gio, GLib, GObject, Handy + from gettext import gettext as _ + + from gnomemusic.gstplayer import Playback +-from gnomemusic.mediakeys import MediaKeys + from gnomemusic.player import RepeatMode + from gnomemusic.search import Search + from gnomemusic.trackerwrapper import TrackerState +@@ -96,8 +95,6 @@ class Window(Handy.ApplicationWindow): + self._startup_timeout_id = 0 + self._setup_view() + +- MediaKeys(self._player, self) +- + def _setup_view(self): + self._headerbar = HeaderBar(self._app) + self._headerbar.props.stack = self._stack +diff --git a/org.gnome.Music.json b/org.gnome.Music.json +index b4981c3..0a1e070 100644 +--- a/org.gnome.Music.json ++++ b/org.gnome.Music.json +@@ -16,7 +16,6 @@ + "--talk-name=org.freedesktop.Tracker3.Writeback", + "--talk-name=org.gnome.OnlineAccounts", + "--talk-name=org.gnome.ControlCenter", +- "--talk-name=org.gnome.SettingsDaemon.MediaKeys", + "--system-talk-name=org.freedesktop.login1", + "--add-policy=Tracker3.dbus:org.freedesktop.Tracker3.Miner.Files=tracker:Audio" + ], diff -Nru gnome-music-41.0/debian/patches/series gnome-music-41.0/debian/patches/series --- gnome-music-41.0/debian/patches/series 2022-02-13 15:34:35.000000000 +0000 +++ gnome-music-41.0/debian/patches/series 2022-02-17 17:54:10.000000000 +0000 @@ -1 +1,5 @@ meson-Remove-incorrect-i18n.merge_file-argument.patch +application-Opt-in-to-libhandy-dark-style.patch +defaulticon-Add-dark-placeholder-style.patch +artstack-Reload-default-icon-when-dark-style-pref-changes.patch +remove-MediaKeys-api-support.patch