Fixed play queue currently playing when reorder happens

This commit is contained in:
Sumner Evans
2019-12-25 10:36:46 -07:00
parent 52a0b3e604
commit 140ed6d38b
2 changed files with 9 additions and 14 deletions

View File

@@ -139,8 +139,6 @@ class SublimeMusicApp(Gtk.Application):
'device-update', self.on_device_update)
self.window.player_controls.connect(
'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.show_all()
@@ -238,11 +236,6 @@ class SublimeMusicApp(Gtk.Application):
# Send out to the bus that we exist.
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 ########## #
def do_dbus_register(self, connection, path):
def get_state_and_player():

View File

@@ -50,11 +50,6 @@ class PlayerControls(Gtk.ActionBar):
GObject.TYPE_NONE,
(object, bool),
),
'play-queue-reorder': (
GObject.SignalFlags.RUN_FIRST,
GObject.TYPE_NONE,
(object, ),
),
}
editing: 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
# reordering_play_queue_song_list flag.
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(
'play-queue-reorder',
[s[-1] for s in self.play_queue_store],
'refresh-window',
{
'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
else: