diff options
author | Aylur <[email protected]> | 2024-10-29 22:00:10 +0000 |
---|---|---|
committer | Aylur <[email protected]> | 2024-10-29 22:00:10 +0000 |
commit | c1eb257b99aad659d7a79dc35bcbb28a36aae5b0 (patch) | |
tree | 6e55eadb554c0e7eab7e4081d7b60d87189d0835 | |
parent | 58e947dcbc9614ddb9a0833154ec0028aed23d17 (diff) |
fix(mpris): bus_name setter
for real this time
-rw-r--r-- | lib/mpris/player.vala | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/lib/mpris/player.vala b/lib/mpris/player.vala index 26ce7e6..2050f61 100644 --- a/lib/mpris/player.vala +++ b/lib/mpris/player.vala @@ -15,7 +15,7 @@ public class AstalMpris.Player : Object { /** * Full dbus namae of this player. */ - public string bus_name { owned get; private construct set; } + public string bus_name { owned get; private set; } /** * Indicates if [[email protected]:bus_name] is available on dbus. @@ -42,7 +42,7 @@ public class AstalMpris.Player : Object { * The media player may refuse to allow clients to shut it down. * In this case, the [[email protected]:can_quit] property is false and this method does nothing. */ - public void quit() throws Error { + public void quit() { try { proxy.quit(); } catch (Error err) { critical(err.message); } } @@ -412,8 +412,8 @@ public class AstalMpris.Player : Object { * @param name dbus name of the player. */ public Player(string name) { - Object(bus_name: name.has_prefix("org.mpris.MediaPlayer2.") - ? name : @"org.mpris.MediaPlayer2.$name"); + bus_name = name.has_prefix("org.mpris.MediaPlayer2.") + ? name : @"org.mpris.MediaPlayer2.$name"; } private void sync() { @@ -564,13 +564,15 @@ public class AstalMpris.Player : Object { } construct { - try { - setup_proxy(); - setup_position_poll(); - sync(); - } catch (Error error) { - critical(error.message); - } + notify["bus-name"].connect(() => { + try { + setup_proxy(); + setup_position_poll(); + sync(); + } catch (Error error) { + critical(error.message); + } + }); } private void setup_position_poll() { |