From b95233f7f84f0df23b588af336f563513b86f8af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 2 Apr 2024 18:06:27 -0700 Subject: [PATCH 1/7] Application: use modern features for loading assets, use startup (#769) --- data/AlbumImage.css | 33 ------------ ...{PlaybackIndicator.css => Application.css} | 41 +++++++++++++-- data/music.gresource.xml | 6 +-- src/Application.vala | 50 ++++++++++--------- src/Widgets/AlbumImage.vala | 10 ---- src/Widgets/TrackRow.vala | 6 +-- 6 files changed, 68 insertions(+), 78 deletions(-) delete mode 100644 data/AlbumImage.css rename data/{PlaybackIndicator.css => Application.css} (66%) diff --git a/data/AlbumImage.css b/data/AlbumImage.css deleted file mode 100644 index 7180f244c..000000000 --- a/data/AlbumImage.css +++ /dev/null @@ -1,33 +0,0 @@ -/* - * SPDX-License-Identifier: LGPL-3.0-or-later - * SPDX-FileCopyrightText: 2021 elementary, Inc. (https://elementary.io) - */ - -album { - background-image: - linear-gradient( - 170deg, - alpha( - @highlight_color, - 0.1 - ), - alpha( - @highlight_color, - 0.15 - ) 43%, - alpha( - @highlight_color, - 0 - ) 44% - ), - -gtk-icontheme("audio-x-generic-symbolic"), - linear-gradient( - to bottom, - @base_color, - @base_color - ); - background-size: cover, 50%, cover; - background-repeat: no-repeat; - background-position: center center; - color: alpha(@insensitive_fg_color, 0.75); -} diff --git a/data/PlaybackIndicator.css b/data/Application.css similarity index 66% rename from data/PlaybackIndicator.css rename to data/Application.css index db80e7cb3..bccb159ea 100644 --- a/data/PlaybackIndicator.css +++ b/data/Application.css @@ -1,16 +1,50 @@ -spinner { +/* + * SPDX-License-Identifier: LGPL-3.0-or-later + * SPDX-FileCopyrightText: 2021 elementary, Inc. (https://elementary.io) + */ + +album { + background-image: + linear-gradient( + 170deg, + alpha( + @highlight_color, + 0.1 + ), + alpha( + @highlight_color, + 0.15 + ) 43%, + alpha( + @highlight_color, + 0 + ) 44% + ), + -gtk-icontheme("audio-x-generic-symbolic"), + linear-gradient( + to bottom, + @base_color, + @base_color + ); + background-size: cover, 50%, cover; + background-repeat: no-repeat; + background-position: center center; + color: alpha(@insensitive_fg_color, 0.75); +} + +spinner.play-indicator { animation: none; color: @accent_color; min-width: 16px; transition: none; } -spinner:checked { +spinner.play-indicator:checked { opacity: 1; -gtk-icon-source: -gtk-icontheme("playback-paused-symbolic"); } -spinner:checked.playing { +spinner.play-indicator:checked.playing { animation: playing 1.1s linear infinite; -gtk-icon-source: -gtk-icontheme("playback-playing-00-symbolic"); } @@ -36,4 +70,3 @@ spinner:checked.playing { 95% { -gtk-icon-source: -gtk-icontheme("playback-playing-17-symbolic"); } 100% { -gtk-icon-source: -gtk-icontheme("playback-playing-00-symbolic"); } } - diff --git a/data/music.gresource.xml b/data/music.gresource.xml index b411c04c8..4e9ae4a65 100644 --- a/data/music.gresource.xml +++ b/data/music.gresource.xml @@ -1,9 +1,9 @@ - AlbumImage.css - - PlaybackIndicator.css + Application.css + + playback-indicator/paused.svg playback-indicator/playing-00.svg playback-indicator/playing-01.svg diff --git a/src/Application.vala b/src/Application.vala index 1b3c4df39..f27503c75 100644 --- a/src/Application.vala +++ b/src/Application.vala @@ -33,11 +33,10 @@ public class Music.Application : Gtk.Application { GLib.Intl.textdomain (Constants.GETTEXT_PACKAGE); } - protected override void activate () { - if (active_window != null) { - active_window.present_with_time (Gdk.CURRENT_TIME); - return; - } + protected override void startup () { + base.startup (); + + Granite.init (); add_action_entries (ACTION_ENTRIES, this); @@ -47,6 +46,29 @@ public class Music.Application : Gtk.Application { ((SimpleAction) lookup_action (ACTION_PREVIOUS)).set_enabled (false); ((SimpleAction) lookup_action (ACTION_SHUFFLE)).set_enabled (false); + var granite_settings = Granite.Settings.get_default (); + var gtk_settings = Gtk.Settings.get_default (); + + gtk_settings.gtk_icon_theme_name = "elementary"; + gtk_settings.gtk_theme_name = "io.elementary.stylesheet.orange"; + + gtk_settings.gtk_application_prefer_dark_theme = ( + granite_settings.prefers_color_scheme == DARK + ); + + granite_settings.notify["prefers-color-scheme"].connect (() => { + gtk_settings.gtk_application_prefer_dark_theme = ( + granite_settings.prefers_color_scheme == DARK + ); + }); + } + + protected override void activate () { + if (active_window != null) { + active_window.present (); + return; + } + playback_manager = PlaybackManager.get_default (); var mpris_id = Bus.own_name ( @@ -69,24 +91,6 @@ public class Music.Application : Gtk.Application { add_window (main_window); - Gtk.IconTheme.get_for_display (Gdk.Display.get_default ()).add_resource_path ("/io/elementary/music"); - - var granite_settings = Granite.Settings.get_default (); - var gtk_settings = Gtk.Settings.get_default (); - - gtk_settings.gtk_icon_theme_name = "elementary"; - gtk_settings.gtk_theme_name = "io.elementary.stylesheet.orange"; - - gtk_settings.gtk_application_prefer_dark_theme = ( - granite_settings.prefers_color_scheme == Granite.Settings.ColorScheme.DARK - ); - - granite_settings.notify["prefers-color-scheme"].connect (() => { - gtk_settings.gtk_application_prefer_dark_theme = ( - granite_settings.prefers_color_scheme == Granite.Settings.ColorScheme.DARK - ); - }); - /* * This is very finicky. Bind size after present else set_titlebar gives us bad sizes * Set maximize after height/width else window is min size on unmaximize diff --git a/src/Widgets/AlbumImage.vala b/src/Widgets/AlbumImage.vala index a92f5c806..0d7d45b81 100644 --- a/src/Widgets/AlbumImage.vala +++ b/src/Widgets/AlbumImage.vala @@ -6,21 +6,11 @@ public class Music.AlbumImage : Gtk.Grid { public Gtk.Image image; - private static Gtk.CssProvider css_provider; - class construct { set_css_name ("album"); } - static construct { - css_provider = new Gtk.CssProvider (); - css_provider.load_from_resource ("/io/elementary/music/AlbumImage.css"); - } - construct { - unowned var style_context = get_style_context (); - style_context.add_provider (css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); - image = new Gtk.Image (); add_css_class (Granite.STYLE_CLASS_CARD); diff --git a/src/Widgets/TrackRow.vala b/src/Widgets/TrackRow.vala index df929364a..4ac199d7c 100644 --- a/src/Widgets/TrackRow.vala +++ b/src/Widgets/TrackRow.vala @@ -6,7 +6,6 @@ public class Music.TrackRow : Gtk.ListBoxRow { public AudioObject audio_object { get; construct; } - private static Gtk.CssProvider css_provider; private static PlaybackManager playback_manager; private Gtk.Spinner play_icon; @@ -17,16 +16,13 @@ public class Music.TrackRow : Gtk.ListBoxRow { static construct { playback_manager = PlaybackManager.get_default (); - - css_provider = new Gtk.CssProvider (); - css_provider.load_from_resource ("io/elementary/music/PlaybackIndicator.css"); } construct { play_icon = new Gtk.Spinner () { spinning = playback_manager.current_audio == audio_object }; - play_icon.get_style_context ().add_provider (css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); + play_icon.add_css_class ("play-indicator"); var album_image = new Music.AlbumImage (); album_image.image.height_request = 32; From 71b38e98a21f0cefdd9ffe66c6ca513b86caf030 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 2 Apr 2024 18:12:10 -0700 Subject: [PATCH 2/7] Update music.desktop.in (#770) --- data/music.desktop.in | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/data/music.desktop.in b/data/music.desktop.in index 5c59d6bd5..9d9b130d8 100644 --- a/data/music.desktop.in +++ b/data/music.desktop.in @@ -1,14 +1,19 @@ [Desktop Entry] +Version=1.0 Type=Application + Name=Music -GenericName=Music Player Comment=Listen to music -Exec=io.elementary.music %U +Categories=Audio;Music;Player;AudioVideo;GTK; +Keywords=Noise;Audio;Player;MP3;Play;Playlist;Media;Songs; + Icon=io.elementary.music +Exec=io.elementary.music %U +SingleMainWindow=true +StartupNotify=true Terminal=false -Categories=Audio;Music;Player;AudioVideo;GTK; + MimeType=x-content/audio-player;x-content/audio-cdda;application/ogg;application/x-extension-m4a;application/x-extension-mp4;application/x-flac;application/x-ogg;audio/3gpp;audio/aac;audio/ac3;audio/AMR;audio/AMR-WB;audio/basic;audio/flac;audio/midi;audio/mp2;audio/mp4;audio/mpeg;audio/ogg;audio/vnd.rn-realaudio;audio/x-aiff;audio/x-ape;audio/x-flac;audio/x-gsm;audio/x-it;audio/x-m4a;audio/x-matroska;audio/x-mod;audio/x-mp3;audio/x-mpeg;audio/x-mpegurl;audio/x-ms-asf;audio/x-ms-asx;audio/x-ms-wax;audio/x-ms-wma;audio/x-musepack;audio/x-opus+ogg;audio/x-pn-aiff;audio/x-pn-au;audio/x-pn-realaudio;audio/x-pn-realaudio-plugin;audio/x-pn-wav;audio/x-pn-windows-acm;audio/x-realaudio;audio/x-real-audio;audio/x-sbc;audio/x-scpls;audio/x-speex;audio/x-tta;audio/x-vorbis;audio/x-vorbis+ogg;audio/x-wav;audio/x-wavpack;audio/x-xm;audio/x-s3m;inode/directory; -StartupNotify=true -Keywords=Noise;Audio;Player;MP3;Play;Playlist;Media;Songs; + X-GNOME-UsesNotifications=true X-PulseAudio-Properties=media.role=music From d00a6d69bc62df9fac205a98b7fe8972009b297a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Wed, 3 Apr 2024 10:10:14 -0700 Subject: [PATCH 3/7] Update music.desktop.in --- data/music.desktop.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/music.desktop.in b/data/music.desktop.in index 9d9b130d8..a2b398826 100644 --- a/data/music.desktop.in +++ b/data/music.desktop.in @@ -1,5 +1,5 @@ [Desktop Entry] -Version=1.0 +Version=1.5 Type=Application Name=Music From d55572e756112452afc6d1e503aa52da201ad7e9 Mon Sep 17 00:00:00 2001 From: David Hewitt Date: Wed, 1 May 2024 16:07:26 +0100 Subject: [PATCH 4/7] appdata: Use newer, non-deprecated developer tag --- data/music.metainfo.xml.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/data/music.metainfo.xml.in b/data/music.metainfo.xml.in index bf71e403f..2b476e9c2 100644 --- a/data/music.metainfo.xml.in +++ b/data/music.metainfo.xml.in @@ -47,7 +47,9 @@ https://github.com/elementary/music/discussions https://l10n.elementary.io/projects/music - elementary, Inc. + + elementary, Inc. + elementary contact_at_elementary.io From c135185e0184d23bf5cc02607239b50703bc248e Mon Sep 17 00:00:00 2001 From: Ryo Nakano Date: Mon, 6 May 2024 04:02:33 +0000 Subject: [PATCH 5/7] Translated using Weblate (Japanese) Currently translated at 100.0% (15 of 15 strings) Translation: Music/Music Translate-URL: https://l10n.elementary.io/projects/music/music/ja/ --- po/ja.po | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/po/ja.po b/po/ja.po index 9ea55f70a..ed57ba538 100644 --- a/po/ja.po +++ b/po/ja.po @@ -8,16 +8,16 @@ msgstr "" "Project-Id-Version: noise\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-05-31 15:44+0000\n" -"PO-Revision-Date: 2022-11-19 05:10+0000\n" +"PO-Revision-Date: 2024-05-07 04:13+0000\n" "Last-Translator: Ryo Nakano \n" -"Language-Team: Japanese \n" +"Language-Team: Japanese " +"\n" "Language: ja\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Weblate 4.14.2\n" +"X-Generator: Weblate 5.5\n" "X-Launchpad-Export-Date: 2017-03-07 05:53+0000\n" #: src/Application.vala:66 src/Views/NowPlayingView.vala:18 @@ -41,7 +41,7 @@ msgstr "“ファイル”から開いた音声ファイルがここに表示さ #, c-format msgid "%d invalid file was not added to the queue" msgid_plural "%d invalid files were not added to the queue" -msgstr[0] "無効な%d項目のファイルはキューに追加されませんでした" +msgstr[0] "無効な %d 項目のファイルはキューに追加されませんでした" #: src/MainWindow.vala:191 msgid "Repeat None" @@ -59,7 +59,7 @@ msgstr "一曲リピート" #, c-format msgid "%d track was added to the queue" msgid_plural "%d tracks were added to the queue" -msgstr[0] "%d曲をキューに追加しました" +msgstr[0] "%d 曲をキューに追加しました" #. Don't set artist for files without tags #: src/PlaybackManager.vala:190 From b3284732504da8e786f8b0a4b2a9cd5fd138d199 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Wed, 8 May 2024 10:44:49 -0700 Subject: [PATCH 6/7] Flatpak: bump platform to 8.0 (#772) --- .github/workflows/ci.yml | 2 +- .github/workflows/merge.yml | 4 ++-- .github/workflows/release.yml | 2 +- io.elementary.music.yml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e360b71a8..02ee0831a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: fail-fast: false container: - image: ghcr.io/elementary/flatpak-platform/runtime:7.2-${{ matrix.arch }} + image: ghcr.io/elementary/flatpak-platform/runtime:8-${{ matrix.arch }} options: --privileged steps: diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index 51293735a..2dd402c52 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -12,7 +12,7 @@ jobs: name: Gettext runs-on: ubuntu-latest container: - image: ghcr.io/elementary/flatpak-platform/runtime:7.2-x86_64 + image: ghcr.io/elementary/flatpak-platform/runtime:8-x86_64 options: --privileged steps: @@ -48,7 +48,7 @@ jobs: fail-fast: false container: - image: ghcr.io/elementary/flatpak-platform/runtime:7.2-${{ matrix.arch }} + image: ghcr.io/elementary/flatpak-platform/runtime:8-${{ matrix.arch }} options: --privileged steps: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index eafba077c..7657e1495 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -40,7 +40,7 @@ jobs: fail-fast: false container: - image: ghcr.io/elementary/flatpak-platform/runtime:7.2-${{ matrix.arch }} + image: ghcr.io/elementary/flatpak-platform/runtime:8-${{ matrix.arch }} options: --privileged steps: diff --git a/io.elementary.music.yml b/io.elementary.music.yml index b2b787393..ddef1510f 100644 --- a/io.elementary.music.yml +++ b/io.elementary.music.yml @@ -1,6 +1,6 @@ app-id: io.elementary.music runtime: io.elementary.Platform -runtime-version: '7.2' +runtime-version: '8' sdk: io.elementary.Sdk command: io.elementary.music finish-args: From 8a09fc671555797a02edfc91f5f956a50a21195d Mon Sep 17 00:00:00 2001 From: Ryo Nakano Date: Wed, 8 May 2024 13:14:24 +0000 Subject: [PATCH 7/7] Translated using Weblate (Japanese) Currently translated at 100.0% (21 of 21 strings) Translation: Music/Music (Extra) Translate-URL: https://l10n.elementary.io/projects/music/extra/ja/ --- po/extra/ja.po | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/po/extra/ja.po b/po/extra/ja.po index 4ef1d5626..683e1def3 100644 --- a/po/extra/ja.po +++ b/po/extra/ja.po @@ -8,16 +8,16 @@ msgstr "" "Project-Id-Version: noise\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-05-31 15:44+0000\n" -"PO-Revision-Date: 2023-04-06 19:59+0000\n" +"PO-Revision-Date: 2024-05-09 14:13+0000\n" "Last-Translator: Ryo Nakano \n" -"Language-Team: Japanese \n" +"Language-Team: Japanese " +"\n" "Language: ja\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Weblate 4.16.4\n" +"X-Generator: Weblate 5.5\n" "X-Launchpad-Export-Date: 2017-03-07 05:56+0000\n" #: data/music.metainfo.xml.in:10 data/music.desktop.in:4 @@ -36,8 +36,8 @@ msgid "" msgstr "" "手持ちの音声ファイルを簡単にキューに追加して再生しましょう。機能は至ってシン" "プルです。また、ファイルに埋め込まれたアルバムアートワークを表示できます。メ" -"ディアキーやシステム音声インジケーターを使うことで、曲の再生/停止/切り替え" -"も可能です。" +"ディアキーやシステム音声インジケーターを使うことで、曲の再生/停止/切り替えも" +"可能です。" #: data/music.metainfo.xml.in:18 msgid "Quickly queue up your favorite tracks"