This will eventually display the remaining time before the pause takes
effect, but for now just show the widget.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
I either round to the nearest minute or nearest 5-second interval
depending on how much time is left. This will eventually be used to
populate a GtkPopover to display the remaining time.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
We need to do this in a couple of different places, so let's make it
easier to do the conversion manually. Additionally, the datetime module
was having some trouble handling times over one hour. The new code
should handle it just fine, though.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
I'm planning to use this for the automatic pausing code to tell the user
how much longer until we pause.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Users tell us how many tracks they would like to listen to, and then we
pause when that is complete. I make sure we test the about-to-finish
signal with this patch, since we hadn't been doing that up until now.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
We have to do this because the "input" signal attached to a real
Gtk.SpinButton is broken, and likes to increment from -1 to 1, bypassing
0 all together.
Of course, this is only a problem when I try to have "This Track" and
"Next Track" text displayed instead of numbers, but I think everything
looks nicer this way.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Now we only toggle the show-more button state if the entry is already
focused. Otherwise, we allow the grab focus.
Additionally, I rename "updown_button" to "show_more" to match how it's
being used.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
I change the keyboard shortcuts up slightly with this patch:
- ctrl+m shows and hides the search widgets
- ctrl+f now shows the widgets and focuses the track filtering entry
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
If everything goes well and the test passes, then this line will never
be reached. Let's move it so it doesn't skew the code coverage report.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
- Make sure we properly test the idle_id
- Make sure we're testing all the can_activate_accel() code
- Provide a generic main_loop() function that can be used by other test
code
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
The following shortcuts are currently supported:
- Backspace: Previous song
- Return: Next Song
- Space: Toggle play / pause
- Ctrl+f: Open search bar
- Ctrl+s: Open search bar and focus search entry
- Ctrl+r: Toggle random
- Ctrl+Up: Increase volume
- Ctrl+Down: Decrease volume
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Otherwise we could end up sending notifications that don't make any
sense after their corresponding test ends.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This patch allows the user to filter playlists based on text that they
enter. I use the python regex module to handle searching, which gives
the user more flexibility in how they search. If the user inputs an
invalid regular expression, then I apply the "warning" style class to
the entry to let them know something has gone wrong.
I needed to change how the new-playlist signal is handled when I
switched over to using the playlist entry. For some reason the
GtkTreeModelFilter would glitch out whenever I sent the row-added
signal, so instead I let the filter model detect new rows when their
size is set instead. This seems to work, even if it's not how everything
is intended to be used.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
We really need the UI to know about playlists as early as possible, so
send that notification as soon as playlists are allocated to avoid
potential ordering issues with the track scanning thread.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
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>