And make sure we center the pixbuf in the GtkImage by allowing the image
to expand to its maximum width.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This acts as a placeholder, and keeps the sidebar from bouncing around
when tracks are changed.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
I always scale from the original reference image, and never from the
displayed pixbuf. This avoids artifacts due to lossy scaling algorithms.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
I took inspiration from a few other icons I found online, but I hacked
up my own version in Inkscape.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
We were ignoring this argument and setting whatever is appropriate in
alloc_child(), so let's just remove it entirely.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This could exist as its own file, but it is only ever used from user.py.
Merging helps to simplify the code a little.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
- Use constants for the starred playlist icon and sort fields list
- Don't keep a reference to the new and starred playlists, and allocate
new instances after a reset()
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
- Use constants for the sort fields list
- Have alloc_child() set the icon directly, rather than using the one
passed in by lookup()
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
- Use constants for the sort fields list
- Have alloc_child() set the icon directly, rather than using the one
passed in by lookup()
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
- Use constants for the sort fields list
- Have alloc_child() set the icon directly, rather than using the one
passed in by lookup()
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
- Use constants for the sort list
- Have alloc_child() set the icon directly, rather than using the one
passed in
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
We use the allocate version everywhere already, so let's just rename it
to lookup and have a less confusing name.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
And keep it as a global variable. This reduces the amount of work in the
root node, and makes things a little easier to follow
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
I want to create a previous() function in the __init__.py file, but this
is causing import errors. We need to rename this file so everything
works as expected.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
We still do this internally in the playlist/__init__.py file, so we can
skip it here and make the lines a little shorter.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Rather than continuing to use the tree lock. This lets us be a little
more focused in what the locks protect, while also allowing tree
operations to happen in parallel with playlist operations.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This lets us have peek() advance a counter without actually changing the
state of the playlist and avoids a potential deadlock from calling
next() with the lock held.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This cuts down on code duplication, and lets us use bisection searches
to find tracks in more places.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Most functions lock the tree from the leaves up, but this was locking
the tree from the root down. This was leading to frequent deadlocks.
Let's fix this by only holding the tree_lock to look up each node, and
release it ASAP instead of locking the entire tree.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
We're going to use this to be able to look up by ID from any anscestor
of the node in question.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
The child-inserted notification is more specific than node-inserted, and
carries the child's path with it as an argument. This saves some work on
the UI side, and avoids potential deadlocks.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
- Listen for the "first-child" notification rather than "node-inserted"
- Use the walrus operator in more places to tidy up the code
- Use the playlist_iter() function to get iterators directly
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
The UI has been guessing this during scanning, but we can easily figure
this out and tell them when a tree node is given their first child.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
And always run tasks marked for the idle queue in the idle queue, even
if we're in the main thread.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This lets us save str(node) to be used for something else, and it gives
playlists a chance to escape their names before returning to the UI
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
- Use the walrus operator (:=) in __insert__
- Simplify child_index()
- Don't use any passed in arguments to sort_key()
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
I really want to remove this function, so let's start by swapping out
calls to append_child() with insert_child()
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>