Fixed play queue currently playing when reorder happens
This commit is contained in:
@@ -139,8 +139,6 @@ class SublimeMusicApp(Gtk.Application):
|
|||||||
'device-update', self.on_device_update)
|
'device-update', self.on_device_update)
|
||||||
self.window.player_controls.connect(
|
self.window.player_controls.connect(
|
||||||
'volume-change', self.on_volume_change)
|
'volume-change', self.on_volume_change)
|
||||||
self.window.player_controls.connect(
|
|
||||||
'play-queue-reorder', self.on_play_queue_reorder)
|
|
||||||
self.window.connect('key-press-event', self.on_window_key_press)
|
self.window.connect('key-press-event', self.on_window_key_press)
|
||||||
|
|
||||||
self.window.show_all()
|
self.window.show_all()
|
||||||
@@ -238,11 +236,6 @@ class SublimeMusicApp(Gtk.Application):
|
|||||||
# Send out to the bus that we exist.
|
# Send out to the bus that we exist.
|
||||||
self.dbus_manager.property_diff()
|
self.dbus_manager.property_diff()
|
||||||
|
|
||||||
def on_play_queue_reorder(self, _, new_queue):
|
|
||||||
self.state.play_queue = new_queue
|
|
||||||
self.save_play_queue()
|
|
||||||
self.update_window()
|
|
||||||
|
|
||||||
# ########## DBUS MANAGMENT ########## #
|
# ########## DBUS MANAGMENT ########## #
|
||||||
def do_dbus_register(self, connection, path):
|
def do_dbus_register(self, connection, path):
|
||||||
def get_state_and_player():
|
def get_state_and_player():
|
||||||
|
@@ -50,11 +50,6 @@ class PlayerControls(Gtk.ActionBar):
|
|||||||
GObject.TYPE_NONE,
|
GObject.TYPE_NONE,
|
||||||
(object, bool),
|
(object, bool),
|
||||||
),
|
),
|
||||||
'play-queue-reorder': (
|
|
||||||
GObject.SignalFlags.RUN_FIRST,
|
|
||||||
GObject.TYPE_NONE,
|
|
||||||
(object, ),
|
|
||||||
),
|
|
||||||
}
|
}
|
||||||
editing: bool = False
|
editing: bool = False
|
||||||
editing_play_queue_song_list: bool = False
|
editing_play_queue_song_list: bool = False
|
||||||
@@ -360,9 +355,16 @@ class PlayerControls(Gtk.ActionBar):
|
|||||||
# which one comes first, but just in case, we have this
|
# which one comes first, but just in case, we have this
|
||||||
# reordering_play_queue_song_list flag.
|
# reordering_play_queue_song_list flag.
|
||||||
if self.reordering_play_queue_song_list:
|
if self.reordering_play_queue_song_list:
|
||||||
|
currently_playing_index = [
|
||||||
|
i for i, s in enumerate(self.play_queue_store) if s[2]
|
||||||
|
][0]
|
||||||
self.emit(
|
self.emit(
|
||||||
'play-queue-reorder',
|
'refresh-window',
|
||||||
[s[-1] for s in self.play_queue_store],
|
{
|
||||||
|
'current_song_index': currently_playing_index,
|
||||||
|
'play_queue': [s[-1] for s in self.play_queue_store],
|
||||||
|
},
|
||||||
|
False,
|
||||||
)
|
)
|
||||||
self.reordering_play_queue_song_list = False
|
self.reordering_play_queue_song_list = False
|
||||||
else:
|
else:
|
||||||
|
Reference in New Issue
Block a user