Control: tags -1 patch

Seems that I got this fixed. Attaching the patch.

The bug was that Plasma Media widget asked CanPlay() only on Clementine 
startup (when an empty playlist was active). According to MPRIS2 docs about 
CanPlay [1],

> When this property changes, the 
org.freedesktop.DBus.Properties.PropertiesChanged signal is emitted with the 
new value. 

But this signal wasn't emitted. So I've added some calls to notify about 
CanPlay/CanPause change. This fixes the issue.

[1] https://specifications.freedesktop.org/mpris-spec/latest/
Player_Interface.html#Property:CanPlay

-- 
Alexander Kernozhitsky
Description: Emitting notification on CanPlay/CanPause changed
 If Clementine starts with first playlist empty, CanPlay initially returns False
 (because of empty playlist). Plasma Media Player asks for CanPlay only once,
 because Clementine doesn't say it is changed via DBus. This patch notifies
 about CanPlay/CanPause change every time the engine state or current track
 changes.
Author: Alexander Kernozhitsky <sh200...@mail.ru>
Bug-Debian: https://bugs.debian.org/898998
Last-Update: 2018-08-21

--- clementine-1.3.1+git565-gd20c2244a+dfsg.orig/src/core/mpris2.cpp
+++ clementine-1.3.1+git565-gd20c2244a+dfsg/src/core/mpris2.cpp
@@ -131,6 +131,8 @@ void Mpris2::EngineStateChanged(Engine::
     EmitNotification("Metadata");
   }
 
+  EmitNotification("CanPlay");
+  EmitNotification("CanPause");
   EmitNotification("PlaybackStatus", PlaybackStatus(newState));
   if (newState == Engine::Playing)
     EmitNotification("CanSeek", CanSeek(newState));
@@ -181,6 +183,10 @@ void Mpris2::EmitNotification(const QStr
     value = CanGoPrevious();
   else if (name == "CanSeek")
     value = CanSeek();
+  else if (name == "CanPlay")
+    value = CanPlay();
+  else if (name == "CanPause")
+    value = CanPause();
 
   if (value.isValid()) EmitNotification(name, value);
 }
@@ -328,6 +334,8 @@ QString Mpris2::current_track_id() const
 // changing song starts...
 void Mpris2::CurrentSongChanged(const Song& song) {
   ArtLoaded(song, "");
+  EmitNotification("CanPlay");
+  EmitNotification("CanPause");
   EmitNotification("CanGoNext", CanGoNext());
   EmitNotification("CanGoPrevious", CanGoPrevious());
   EmitNotification("CanSeek", CanSeek());

Reply via email to