Storing the current link from the playlist should give us immediate
access to the track, rather than needing to use playlist_at() all the
time. Additionally, we can now use g_list_next() whenever we need to do
a gtk_tree_model_iter_next()
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This function adds a track directly to the front of the playlist,
without any existence checks. This lets us use it for the History
playlist, which allows multiple tracks.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
I can reuse the "removed" callback to for this, rather than implementing
a new "cleared" callback directly.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Rather than iterating over the entire playlist ourselves, we can instead
use the g_queue_remove_all() function to do most of the work for us and
then send an appropriate number of "removed" callbacks.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This function simply triggers the "updated" callback for the given
playlist and track. I updated the gui model to handle taking tracks
instead of row indexes, since this lets me reuse the same for-each
function that we do for sorting. Additionally, this prevents UI updates
for playlists that aren't currently visible.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This function is called to force-sort the playlist. Additionally, we
trigger the "playlist-sorted" callback to to notify the gui that
playlist rows need to be updated.
Additionally, I implement the gui_model_update_all() function to loop
over the model and update all rows of the current playlist.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
The concept of queues is going away over the next few releases, so we
should rename this variable for consistency. I considered calling it
"playlist_model", but I think "gui_model" better matches naming
conventions in the gui.
Imlements #77: Rename queue_model to playlist_model
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Ocarina is moving in a playlist oriented direction, so move away from
using the queue directly in favor of using the playlist.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This only needs to happen once, so let's do it when we initialize the
model rather than waiting for the first allocation.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This is going to represent a playlist soon enough, so let's just name it
something more generic in case it ever has to change again.
Implements #87: Rename GuiQueueModel -> GuiModel
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Otherwise we will crash with a memory error. This only seems to be a
problem when Ocarina is started up after creating a user playlist.
Fixes#99: Ocarina crashes during startup with user playlists
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
The track tag doesn't need these tags now that they can be found in the
album tag.
Implements #64: Remove Artist and Genre pointers from Tracks
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Now that we can switch between different queues we no longer need to
allocate multiple models.
Implements #72: Only allocate a single GuiQueueModel for all playlists
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
We can cut out several thousand function calls and allocations by
reusing the same GtkTreePath structure.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This patch adds support for changing a rows font face to bold for the
currently playing track. This should make it easier to find what track
is playing while quickly skimming through the list.
Fixes#22: Highlight the currently-playing song in the collection
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I'm not even going to try converting my C++ code. Let's just start
fresh, and write unit tests as we build this up.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>