Attempt at save/restoring queue#808
Conversation
|
Oh! I know why it didnt work! |
|
This one works but Note: I went with a fixed array size from start, forloop and assigning the array to parse instead of adding to an empty array while parsing |
|
Okay @danirabbit thank you very much for your feedback. Learning how to properly integrate stuff in the sane/right places thanks to you. |
| var play_pause_action = (SimpleAction) GLib.Application.get_default ().lookup_action (Application.ACTION_PLAY_PAUSE); | ||
| play_pause_action.set_enabled (current_audio != null); | ||
|
|
||
| settings.set_string ("uri-last-played", current_audio.uri); |
There was a problem hiding this comment.
shouldn't we just bind this instead of getting and setting in different places?
There was a problem hiding this comment.
"uri-last-played" gets overwritten before being used. But apart from that, yes i suppose, but do not forget this is a draft - i want first to have something that works (im failing at it), before making it clean.
| PlaybackManager.get_default ().restore_queue (); | ||
|
|
||
| settings.set_string ("uri-last-played", uri_last_played); | ||
| PlaybackManager.get_default ().restore_last_played (); |
There was a problem hiding this comment.
Is there a reason to have this be two separate functions? We always want to restore both the previous queue and the previously played audio right?
There was a problem hiding this comment.
No
If the user double-click on a music file with the app closed, they want to play it - not play last week's track
restoring previous queue without previous played makes sense in this case, before adding the new track, but the expected behaviour is not to play another totally unrelated track.
this is kind of a problem introduced by restoring sessions, because before the queue would have always been empty, unless the app was already started
There was a problem hiding this comment.
Oh yeah that makes sense. Thanks for clarifying!
|
So i can save the stupid last played track. Reliably. |
|
Yes. I cant figure this out. |
|
Should i close the PR ? Sorry im useless i thought i could tackle this, but it just doesnt care whatever i set as current audio or call, it will always reset to 0 after the activate() |
|
Please leave the PR up. I'll take a look when I get a moment. You're definitely not useless! It seems like you're really close. Be kind to yourself 🩷 |
|
@teamcons okay, so we can get some stuff merged, what do you think about breaking this up into 3 branches?
That way we can merge in the stuff that's working now and scope things down a bit so it doens't feel as overwhelming |
Fixes #792
This is not ready yet.
The new key in gschema does not seem to install at all. I am trying to figure this out.
-After constructing the window and adding all the signals, when everything is ready, start loading previous queue
-Handle a close request for the window, the handler slorps everything in the queue in gsettings
alternatively i could change the plumbing to have the app save in realtime whenever the liststore gets changed. This would keep state despite a crash, but it feels gross constantly writing to gsettings