The UI might take a while to process queued notifications, so to keep
from overwhelming the UI we want to only queue notification that haven't
been added already.
I also add in a lock around the notification queue since the main thread
processes notifications added by other threads.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This lets the UI know that it has something to process when it gets the
chance. Additionally, I change the return value of run_queued() to
return false when there are no tasks remaining on the queue.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Rather than doing this as part of the playlist constructor. This ensures
that the UI is notified AFTER the playlist has been appended to the
PlaylistManager to prevent race conditions.
Additionally, I send the sorted index of the playlist and an indicator
if this is the first playlist added as part of the notification to help
make the UI's job easier.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
We ask for the notification to be placed on the queue so multiple
changes to the same playlist will get batched together.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
The playlist manager doesn't need all the information about what changed
in the playlist, since it's mostly just updating the track count. Let's
just send the playlist so it won't get queued multiple times.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
I was having some trouble when adding in a GtkTreeModelFilter, so I
figured a good first step is to make sure we're testing the TreeModel
properly
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Now that we can use direct indexing on the PlaylistManager, let's
simplify these functions. Additionally, I implemented an iter_valid()
function to help determin if we have a valid Gtk.TreeIter.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This isn't intended to hold playlists. Instead, it represents extra
spacing between playlists for the UI.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This makes the user's intentions a little more explicit, and saves us a
couple of lines of code.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This replaces the PlaylistAllocator, and provides a true base class that
can be used by each type of playlist manager.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This lines up with how we handle the Library and Genre managers, and it
seems best to keep things consistent. For now, I keep string-indexing
implemented but I plan to switch over to numeric indexing soon.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
We can figure this out a little easier on the backend side, so let's
handle this there rather than on the UI side
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This should make the UI side easier, since we can check against the
playlist type when searching for the playlist.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
The separator is only one pixel wide, but it was still noticable when
the search entry was hidden. Hiding it too just makes things look nicer.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
The actual search function isn't implemented yet. We show or hide this
widget based on the up / down button state.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
I'm going to use this to show and hide the text entries for playlist
filtering and autopause controls.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
- Change top left controls into a buttonbox
- Change new library button to list-add-symbolic
- Remove "can focus" from buttons
- Make play / pause / next / previous buttons pill-shaped and
homogeneous
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This style class is for on-screen-display widgets, which lines up with
how we're using this button.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Clicking the button shows a popover with a file chooser widget, which
can be used to select a library path.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
I think this looks a little nicer. While I'm at it, I also shove all the
headerbar widgets into two boxes packed on either side.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
- do_iter_parent() needs to return None if there is no parent playlist
- do_iter_next() needs to increment user_data2 for lower level playlists
instead of user_data1
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
We have a find_playlist() function, so let's stick with a more generic
notification name so we don't have to repeat a lot of code.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Now that we push row_added notifications into the main thread, we can
enable this optimization that makes the treeview more efficient.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Reset is used to make testing a little easier, since we won't have to
manually set set everything up again during each setUp function.
Stop is used to stop the library thread before shutdown.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Keeping this as a class that can never be instantiated seems like
overkill when we could just use plain functions.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This eases up some of the work on the UI side, since we don't need to
spend time trying to figure out where the track is in the playlist.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Gtk really doesn't like notifications coming from other threads, so we
need to handle notifications from the main thread through an idle task.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Gtk really doesn't like updates coming from outside of the main thread,
so let's add a way to register callbacks that can be queued up and run
later.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>