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>
We don't need different operations for each queue. If we store this
then a higher layer doesn't need to keep passing the same structure over
and over again.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I'm not even going to try converting my C++ code. Let's just start
fresh, and write unit tests as we build this up.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This gets cleared every time the queue is changed and disabled when we
show pages that cannot be filtered.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I need to change the state of these toggle buttons whenever the
sidebar's current selection changes. Some gtk themes have trouble
showing the state of toggle buttons, so I change the sensitivity of both
the button and associated image so users know the current state.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This function is used to notify a higher layer that a queue is being
deinitialized. The higher layer should then clean up any state
associated with that queue.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This function is used to notify a higher layer that a queue has been
initialized. That higher layer can return a pointer to be attached to
the "private data" field of the queue.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This feature isn't used very often, and keeping the checkbox in the
sidebar looks pretty ugly.
Fixes#50: Remove Collection checkbox
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I'm surprised this wasn't already there. I think the "folder" icon
works best, considering library paths are directories in the filesystem.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
It's easier just to set all images to have the same size, rather than
making the header's image slightly larger.
Fixes#39: Remove GtkIconSize from Playlist treeview
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I also update the icon to match what is on the "Hide Track" button.
Fixes#49: Hidden playlist still says "Banned" in sidebar
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I'm using multiple treeviews, but only one should be selected at any
time. Use this function to coordinate that.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
Saving maximized state is too complicated, so let's just store width and
height of the window when it is not maximized.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I handle the Escape key through gtkbuilder, so let's move the
tab-changing keys into the tabs source file.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
Otherwise pressing the spacebar while searching could toggle the play /
pause status.
Fixes#36: Button accelerators always triggered
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This is better than calling audio_*() functions directly, since we can
make sure signals are wired up properly in glade.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>