The concept of queues is going away over the next few releases, so we
should rename this variable for consistency. I considered calling it
"playlist_model", but I think "gui_model" better matches naming
conventions in the gui.
Imlements #77: Rename queue_model to playlist_model
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
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>
The function gtk_menu_popup() is deprecated as of Gtk 3.22, so replace
it with the simplified popup_at_pointer() function.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Otherwise we will crash with a memory error. This only seems to be a
problem when Ocarina is started up after creating a user playlist.
Fixes#99: Ocarina crashes during startup with user playlists
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
__gui_playlist_init_idle() will select the first visible playlist by
default, which is what we want. Let's not override this by showing the
Collection later in this function.
Fixes#95: Startup shows Collection instead of Queued Tracks
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
I find that I usually create playlists through either a right click
action or through a keyboard shortcut, so we don't need an extra option
hidden inside a MenuButton. Let's remove the button and show the "Add
Library Path" option directly instead.
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>
These options are mostly used to communicate with a running Ocarina
instance to control playback.
Implements #37: Ocarina Command Line Commands
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>
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>
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 has to be created programmatically due to the dynamic nature of
user playlists. The easiest way to do that is to list user playlists in
a submenu and switch them out as needed.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This lets me add new options without needing to clutter the gui with
lots of rarely-used buttons.
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>
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 intend to use this to hide empty playlists, but it could potentially
also be used to search for a specific playlist.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Unplayed, Most Played, and Least Played tracks playlists update
themselves with an idle task when tracks have been played. It looks
like we haven't been processing these tasks, so the queue was just
building up after every track. Fix this by enabling the GTK idle
callback whenever a track is played.
Fixes#89: Dynamic playlists aren't updating
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
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>
We can cut out several thousand function calls and allocations by
reusing the same GtkTreePath structure.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This gives users the ability to add new library paths by pressing the
"Enter" key instead of needing to click a button with their mouse.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Most users will have their music in their ~/Music directory, so it makes
sense to select this path by default.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This patch also adds the genre field to the list of fields that can be
searched.
Implements #62: Replace filter layer with token matching
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
We only need to do this after Ocarina init has completed, otherwise
artist playlists will be added twice.
Fixes#79: Artist playlists not updated when tracks are added
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
We were calling the queue function directly, rather than passing through
the playlist layer. This means random state isn't saved when the button
is clicked and Ocarina is closed.
Fixes#78: Call playlist_set_random() when clicking random button
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
But only if the library database is empty. This patch also changes the
prompt of the dialog to "Add Music" so users know what is going on.
Fixes#80: Pop up FileChooserDialog the first time Ocarina is run
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This is easier than responding to events from the treeview. Let's just
pop up a dialog and let the user select from there, rather than doing
something complicated with a stack.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
System playlists cannot be deleted, but library playlists can. Deleting
a library playlist removes the library and associated tracks from the database.
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>
Otherwise the existance check will still pass the next time
__queue_filter() is called, and we will attempt to destroy it again.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
I wasn't doing this, but I also wasn't refiltering queues when they were
changed. This resulted in showing a filtered queue, but without a way
to clear it. Remembering the text lets me simply set the text, instead
of refiltering queues whenever they are changed.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This preserves the original behavior, where the collection is always
selected from the beginning. This can be improved upon later, once
queued tracks are implemented as a playlist.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
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>
The file filter and preview widget are both cleaned up when the file
chooser dialog is destroyed.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Sometimes Ocarina gets the correct image for CD1, but not for CD2.
Allow traversing into hidden folders so users can select the correct
image out of the artwork cache.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Otherwise the new image will never be updated due to the "did the album
change?" check in __artwork_set_pixbuf()
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This lets users actually see images before selecting them for ablum art.
Implements #59: Add preview widget to album art chooser
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Using gdk_pixbuf_new_from_file_at_scale() can result in a blurry image
due to something in the gdk backend. I want to have a sharper image, so
we need to perform the scale manually through Cairo.
Fixes issue #60: Album art is blurry
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Since MusicBrainz limits us to one request each second, it doesn't
really make sense to poll for new artwork every half second. Instead,
let's just put this into a new timeout function that gets called every
two seconds. This should also let us stop polling once artwork has been
found.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
If the user is fixing broken album art then we need to update the image
immediately, otherwise the user will be confused.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
Using gdk_pixbuf_new_from_file_at_scale() will load a scaled pixbuf,
which looks better than loading a height x height square.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I don't think it makes sense that callers of file_open() are expected to
check the file version after opening. This should be something handled
by the file code so we can print a consistent error message.
Implements issue #5: Better file versioning
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This will help reduce disk accesses during thet main startup sequence.
Implements #12: Load temporary queues through an idle task
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This patch fixes two issues. First, I disable scrolling when the user
has manually selected a track. I've found that extra scrolling in this
case can be disorienting, and frequently ends up with the wrong track
selected due to how queue iterators are set so it's probably best just
to disable scrolling in this case.
This patch also changes the order of calls to set_cursor() and
scroll_to_cell(). I've found that scrolling before setting the cursor
causes the GtkTreeView to ignore alignment settings unless the row is
already on the screen. Switching the order makes everything work
properly.
Fixes#57: Wrong track is sometimes scrolled to
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This patch adds support for changing a rows font face to bold for the
currently playing track. This should make it easier to find what track
is playing while quickly skimming through the list.
Fixes#22: Highlight the currently-playing song in the collection
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
Otherwise the list of tracks is left blank, which the user might not be
expecting.
Fixes#55: Collection should be selected by default
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
Cleared is only called during Ocarina shutdown, so calling save here
wipes out any temporary queues as they are written to disk.
Fixes#24: Temporary queues not saving
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
The right way to do this would be to respond to the "activate",
"startup", and "shutdown" signals. I can't to this easily, because
gstreamer needs argc and argv. Let's fake things up now and sort it out
later.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
- Press "f" to add tracks to the Favorites playlist
- Press "q" to create a new temporary queue
- Press "r" to create a new temporary queue with Q_RANDOM set
- Press 0 .. 9 to add tracks to a temporary queue
- Delete to remove tracks from a queue
I also removed the corresponding keypress events from the C++ code to
make progress easier to track.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This function is similar to queue_remove(), except the remove can be
prevented if qop_erase() returns false.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>