I connect this in code so I can pass the column index as data to the
function, avoding the need for a "column index" lookup function.
I restore saved column widths during startup.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
I decided to manually connect signals this time so I can pass sort
information instead of needing to look up the column index.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
And rename the widget from "o_treeview" to just "treeview".
I wanted to rename gui/view.c to gui/treeview.c at some point. I
decided to gradually rework things into a new file to make it easier to
track progress.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This keeps the treepath conversions contained to the filter code when
finding paths to scroll to.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Right now filtering is split between queue.c and view.c, which can make
things somewhat complicated. I think this is a sign that we need a new
file to manage filtering.
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>
This is cleaner and easier than calling into the gtk builder directly.
I bumped up the window layer so other gui components can use it.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Otherwise valgrind will report that we are leaking memory.
Additionally, only initialize the idle queue for sync idle tasks until
album artwork needs it.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This makes the flag a little easier to toggle for testing. I also
rename the compiler option for consistency.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This lets up update track keys to prevent duplicates showing up during a
library path update.
Fixes#93: Library sometimes has duplicated tracks
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Sometimes database entry keys change, so this gives us a way to update
them in the database keys hash table.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This fixes a problem with restoring treeview columns. Sometimes
"Played" gets allocated way too much space, so I solve this by changing
it's setting key to NULL so the column always gets whatever space is
leftover.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
NoWheyCreamery.com doesn't run an Xserver, so we can't run UI tests.
Add a switch to disable these so test results can be reported
accurately.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This playlist has been the same as the hidden playlist for several
releases now. Let's make the change official!
Implements #28: Save hidden playlist as "hidden" instead of "banned"
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
One word labels are always better. I move the "Favorites" and "Hidden"
playlists under the "Playlists" header because they're manually
configured by the user.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This was added so tracks could bump the libary tag size. Now that the
size field has been removed, we can remove this function.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
The convention is for gtk builder files named with a ".ui" extension.
Let's rename our file to match, and drop the 6 while we're at it.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This makes file versioning way easier, since every file will have the
same version. I'll still need to manage minimum-supported versions, but
that shouldn't be too difficult going forward.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
These can be used for version number comparisons as integers, which will
be useful once file version numbers are based off of minor versions.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Most playlists don't allow changing this, and now that we have user
playlists it doesn't make sense to support repeating queued tracks.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This lets me "pause" playing queued tracks in favor of other playlists.
I remember the previous playlist so we can resume track picking once the
queued tracks playlist is empty.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This was used to display the number of tracks in each library path. We
can use playlist functions to get this information now.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This was used to enable and disable library paths in previous Ocarina
versions. This isn't used anymore now that we have library-based
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>
Artist and genre information are already saved by the album tag. In
addition, we can save a single date stamp instead of (year, day, month)
triplets.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
And perform an upgrade when reading back in. After track tags are read,
we can save the database in the new format and remove the old tags.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
And propegate these through the alloc steps to create an album with the
correct artist and genre tags set.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This allows for representing albums with multiple genres. I know this
doesn't happen too often, but it doesn't hurt to be covered. At the
very least, now we have a genre id for constructing new albums!
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
I need a way to represent the same album with different artists to
account for multi-artist albums.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
The date stamp is a single value that represents year, month, and day.
This should be slightly easier than working with three separate values.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Removing items from the database leaves a NULL pointer "hole" that is
never filled in. This doesn't affect correctness, but it could be
wasteful as items are added and removed. This patch adds a function to
defragment the database without changing the order of items.
Implements #66: Add support for rebalancing databases
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
I plan to change the file format of some tags, so add versioning so we
can change things at different times.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
I need to disable filtering when adding artist playlists to avoid some
weird memory corruption issues.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
I query the underlying playlist to see if it is selectable, and then
update the settings file if it is.
Implements #10: Select default playlist
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
I need to have integer playlist ids to store into the settings database
once I allow changing the default playlist.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Right now tracks are picked from this playlist whenever possible. A
system for selecting the default playlist will be added shortly.
Implements #20: Only one queue for "Up Next"
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
The playlist code is heavily tested by unit tests for the files in
core/playlists/, so we no longer need to have a separate playlist test.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I initially tried making several helper functions to reuse code and make
it easier to add new playlists. This didn't work all that well, mostly
because glib wasn't able to expand variable values or find the line
number that errors occured on. Macros don't have this problem, since
they are expanded at compile time.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This test can take a long time to run, especially on slow internet
connections. Let's add a way to disable it when testing other things.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This changes test output slightly, in that files are now placed under
subdirectories of $XDG_USER_DATA_DIR/ocarina-test/ instead of in this
directory directly. This should help avoid conflicting files, and lets
me use a single "rm" command to remove everything before testing.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
The view is now responsible for allocating the filter, but the gui_queue
still needs to set the filter function during an init step.
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>
The dbe_index of a given database item might change in the future, so we
can't rely on it everywhere. Let's just use it for saving and loading
files, with the expectation that changes will happen sometime after
startup.
Implements #69: Reduce use of dbe_index in Ocarina code
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Three unsigned integers is overkill for handling dates.
Implements #65: Date structure can be represented with a single 32bit
value
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Albums tend to have a single genre for all tracks, so it makes more
sense for an album to point to genre information.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
- Define __queue_filter_how_changed() for tests that need queue
callback functions
- Increase column sizes in the view test to make test more reliable
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This is called to check if any string in an artist's token list is
prefixed by the given string.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This is called to check if any string in an album's token list is
prefixed by the given string.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This will be used to replace the current filtering code with a token
comparison for each track.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I set the history playlist to use a noop function, since changing the
history doesn't really make sense.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I'm hitting this problem while developing 6.5, since file formats are
going to change. Let's handle this situation gracefully rather than
segfaulting.
This patch changes versioning problems into fatal errors to prevent us
from overwriting data already on disk.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
The pl_artist_init() function is used to allocate a playlist for each
artist already in the database, and pl_artist_deinit() is then used to
free up this memory during cleanup.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
System playlists cannot be created or deleted, so these functions simply
return false in this case. Library playlists will use this to add new
library paths to Ocarina.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I also take the opportunity to add in a generic lookup function to
convert a library path into a playlist.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This function is for both adding and removing tracks, and only returns
false. Tracks will only be added and removed through the update
function.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
The pl_library_init() function is used to allocate a playlist for each
library path already in the database, and pl_library_deinit() is then
used to free this memory during cleanup.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
Similar to the library tag, this is a void pointer that should only be
used by the playlist layer.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I decided to set this as a void pointer to keep other layers from using
the playlist without our knowledge. The only user of this variable
should be the playlist code.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I'm going to use this to distinguish between various playlist types that
are about to be added. Let's update the playlist functions first, and
then add more types in a future patch.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I'll need this to toggle the random flag for the Collection playlist to
avoid cycling through the GUI in order to save.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
It doesn't make sense to have a subdirectory with a single file. Let's
move it back to core/
Implements #45: Move database into core/
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I think this is cleaner than having an upper layer allocate the results
set manually. This also lets me return NULL in the case that there were
no results.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I was storing database indexes, but this assumes that database indexes
are constant. I intend to change this with database defragmentation.
Implements #46: Filter stores a track pointer
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This is used to remove tracks from the filtering index. We'll need this
once we switch over to storing pointers to keep the same track from
getting added multiple times.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
The thread pool is used to fetch album art in the background, but this
can slow down most tests that aren't interested in album art. Adding a
(testing-only) function for running without the thread pool speeds
things up a bit.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
I plan to remove the containers/queue implementation, so we need a new
iterator for queue access.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I use this status indicator in the playlist code fairly often, so let's
return it directly rather than needing to code around it.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This is needed so the user can manually set album artwork in the cases
where either we don't fetch the right image or no image is found.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>