From 0e4f684d3b99065c6970db08fcf26f4d4c98b4c0 Mon Sep 17 00:00:00 2001 From: Alain M Date: Mon, 30 Dec 2019 22:59:38 -0500 Subject: [PATCH] Relesase 0.2.4 --- data/com.github.alainm23.byte.appdata.xml.in | 10 ++++++++++ src/Services/Notification.vala | 9 +++++++-- src/Utils.vala | 9 +++++---- src/Views/Playlist.vala | 4 +++- src/Widgets/MediaControl.vala | 4 +--- 5 files changed, 26 insertions(+), 10 deletions(-) diff --git a/data/com.github.alainm23.byte.appdata.xml.in b/data/com.github.alainm23.byte.appdata.xml.in index 6dfdc8d..aecfb55 100644 --- a/data/com.github.alainm23.byte.appdata.xml.in +++ b/data/com.github.alainm23.byte.appdata.xml.in @@ -23,6 +23,16 @@ com.github.alainm23.byte + + +

This update brings some new features and bug fixes:

+
    +
  • Fixing error loading songs in your playlists.
  • +
  • The error that does not allow adding a song as a favorite is fixed.
  • +
  • Notifications now show album covers correctly.
  • +
+
+

This update brings some new features and bug fixes:

diff --git a/src/Services/Notification.vala b/src/Services/Notification.vala index b654179..131319f 100644 --- a/src/Services/Notification.vala +++ b/src/Services/Notification.vala @@ -17,9 +17,14 @@ public class Services.Notification : GLib.Object { try { var notification = new GLib.Notification (track.title); notification.set_body (track.artist_name); - notification.set_icon (GLib.Icon.new_for_string (Byte.utils.get_cover_file (track.id))); notification.set_priority (GLib.NotificationPriority.LOW); - + + if (Byte.utils.cover_file_exists (track.id)) { + notification.set_icon (GLib.Icon.new_for_string (Byte.utils.get_cover_file (track.id))); + } else { + notification.set_icon (new ThemedIcon (Byte.instance.application_id)); + } + Byte.instance.send_notification (Byte.instance.application_id, notification); } catch (Error e) { stderr.printf ("Error setting default avatar icon: %s ", e.message); diff --git a/src/Utils.vala b/src/Utils.vala index 52be46e..7d515fa 100644 --- a/src/Utils.vala +++ b/src/Utils.vala @@ -244,11 +244,12 @@ public class Utils : GLib.Object { public string get_cover_file (int track_id) { var cover_path = GLib.Path.build_filename (Byte.utils.COVER_FOLDER, ("track-%i.jpg").printf (track_id)); - if (File.new_for_path (cover_path).query_exists ()) { - return "file://" + cover_path; - } + return "file://" + cover_path; + } - return "file:///usr/share/com.github.alainm23.byte/track-default-cover.svg"; + public bool cover_file_exists (int track_id) { + var cover_path = GLib.Path.build_filename (Byte.utils.COVER_FOLDER, ("track-%i.jpg").printf (track_id)); + return File.new_for_path (cover_path).query_exists (); } public string get_cover_radio_file (int radio_id) { diff --git a/src/Views/Playlist.vala b/src/Views/Playlist.vala index 06b45b5..e3afa6a 100644 --- a/src/Views/Playlist.vala +++ b/src/Views/Playlist.vala @@ -49,7 +49,7 @@ public class Views.Playlist : Gtk.EventBox { var pixbuf = new Gdk.Pixbuf.from_file_at_size (cover_path, 128, 128); image_cover.pixbuf = pixbuf; } catch (Error e) { - var pixbuf = new Gdk.Pixbuf.from_file_at_size ("/usr/share/com.github.alainm23.byte/album-default-cover.svg", 128, 128); + var pixbuf = new Gdk.Pixbuf.from_resource_at_scale ("/com/github/alainm23/byte/playlist-default-cover.svg", 128, 128, true); image_cover.pixbuf = pixbuf; } @@ -58,6 +58,7 @@ public class Views.Playlist : Gtk.EventBox { }); if (Byte.scan_service.is_sync == false) { + print ("Entro aqui\n"); all_tracks = new Gee.ArrayList (); all_tracks = Byte.database.get_all_tracks_by_playlist ( playlist.id, @@ -66,6 +67,7 @@ public class Views.Playlist : Gtk.EventBox { ); foreach (var item in all_tracks) { + print ("ID: %i".printf (item.id)); var row = new Widgets.TrackRow (item, 6); listbox.add (row); } diff --git a/src/Widgets/MediaControl.vala b/src/Widgets/MediaControl.vala index f7ee8f1..0ede5e3 100644 --- a/src/Widgets/MediaControl.vala +++ b/src/Widgets/MediaControl.vala @@ -198,9 +198,7 @@ public class Widgets.MediaControl : Gtk.Revealer { } private void activate_menu (Objects.Track track) { - if (menu == null) { - build_context_menu (track); - } + build_context_menu (track); foreach (var child in playlists.get_children ()) { child.destroy ();