We have to disable the up and down buttons when typing in the entry in
case the user decides to type a minus or plus sign.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
We can only rename user-created playlists, so let's not even show this
option for the other playlist types.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Normally GTK will take care of this, but we'll need it for the
right-click menu so we might as well implement it.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This gives me a function that I can reuse in the sidebar right-click
menu, and it cleans up the main keypress handler so more keys can be
added.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This seems like a useful function to have, and we already need it for
deleting playlists. Let's make it a real function so we don't need to
duplicate code.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
If multiple paths are passed, then only load the first one to keep
things simple.
Implements #102: Allow outside tracks
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
A single middle click could happen by accident, especially if the user
has a touchpad. A double click is more likely to be deliberate.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Instead, watch for a middle click and set the editable state manually
from there. This fixes a bug where double clicking on a user playlist
put us in editing mode instead of selecting the playlist for playback.
Fixes#110: Cannot select user playlists
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
I want to be able to change this when the user middle-clicks a row, so
let's start by adding in some support functions.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
We use this to set the playlist name in the provided GtkEntry, clearing
out the number of tracks
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
The GtkTreeView editing callbacks give me a path string that I'll need
to convert into an iterator to find the edited playlist.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Once we change the name of a playlist, we won't be able to find it in
the sidebar model. So let's add a way to update an iterator by passing
the playlist to use for updating.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This way we don't need to keep including the same core libraries in
almost every file.
Implements #83: Include useful headers in core/core.h
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
The core_init_data only held three items, most of which don't get set
during testing. Removing this struct means several tests no longer need
to define a "dummy" initdata object to pass around during init.
Implements #92: Remove core_init_data
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
And make them optional, that way tests don't need to keep creating fake
callbacks if they don't need anything from the audio layer.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Passing this option tells Ocarina that it should only process
synchronous idle tasks, such as library or playlist updates. This
effectively disables album art fetching (and any async jobs we add in
the future).
Implements #91: Add --no-fetch option
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Rather than offering two init functions for testing. This lets the UI
select if they want async idle tasks (like Album Art fetching).
Implements #90: Give idle_init an async flag
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Everything has been merged into the playlist layer to better match how
playlists are actually used. This means we can remove the queue files.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Artist and library playlists are allocated manually, so there should be
generic functions that both can use to get a playlist pointer and free
it when we're done.
I also add a callback for telling the UI when new playlists have been
allocated. This isn't needed for Library playlists, but this is the
only way the UI can know about new Artists.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
And change its type to gchar **. This lets the playlist code manage
setting and freeing search strings. The UI is still responsible for
how this string is used.
This patch also lets me remove the now-unused queue_deinit() function
and associated callback.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
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>
The iterator only needs to point to the current position on the GQueue,
so we can do away with manual position tracking. This lets us use a
GList pointer as an iterator instead of something more complicated.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
I keep using the queue_iter struct for now to reduce code churn in this
patch. I'll be replacing it in the next patch.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
I also take this chance to add extra functions for directly manipulating
the current track, since this is something we do fairly often.
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>
I move the random variable into the playlist code since it is no longer
used by the queue layer. This gives me the opportunity to change it
into a boolean rather than a bit flag.
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>
This replaces the "reset" field that had been passed to sort. I think
this makes things a little more straightforward, and gives us a function
we can call when freeing playlists.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
And stores it for future reference, so we don't have to keep looking up
current and previous playlists.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>