Commit Graph

64 Commits

Author SHA1 Message Date
Anna Schumaker 6ab3cff28f gui/playlist: Support drag and drop for adding tracks to playlists
Dragging onto a sidebar row without a valid playlist will prompt the
user to create a new playlist.  I could probably add a "New Playlist"
row at some point, but this is easier for now :)

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2018-05-16 07:35:28 -04:00
Anna Schumaker a9970c455f gui/sidebar: Add a function for getting an iter from x, y coordinates
This will be used for drag and drop, so that we can figure out what
playlist tracks are being added to.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2018-05-16 07:35:28 -04:00
Anna Schumaker 07196a7cc8 gui/sidebar: Conditionally hide the rename menu option
We can only rename user-created playlists, so let's not even show this
option for the other playlist types.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-12-05 15:19:36 -05:00
Anna Schumaker 64e27c1221 gui/sidebar: Add a right click menu
Implements #112: Add sidebar right-click menu
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-12-05 15:19:24 -05:00
Anna Schumaker 31cda0eebd gui/sidebar: Add a function for selecting paths
Normally GTK will take care of this, but we'll need it for the
right-click menu so we might as well implement it.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-12-05 14:58:57 -05:00
Anna Schumaker 9b9be4e322 gui/sidebar: Rename playlists when pressing the Backspace key
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-12-05 14:58:57 -05:00
Anna Schumaker 1374a025e1 gui/sidebar: Split out __gui_sidebar_delete() into a new function
This gives me a function that I can reuse in the sidebar right-click
menu, and it cleans up the main keypress handler so more keys can be
added.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-12-05 14:58:57 -05:00
Anna Schumaker 21e1796b14 gui/sidebar: Add a function for finding the current playlist
This seems like a useful function to have, and we already need it for
deleting playlists.  Let's make it a real function so we don't need to
duplicate code.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-12-05 14:58:57 -05:00
Anna Schumaker a7280356c8 gui/sidebar: Start editing on a double-middle click
A single middle click could happen by accident, especially if the user
has a touchpad.  A double click is more likely to be deliberate.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-08-29 09:38:31 -04:00
Anna Schumaker 8b17962b4e gui/sidebar: Don't set user playlists as editable by default
Instead, watch for a middle click and set the editable state manually
from there.  This fixes a bug where double clicking on a user playlist
put us in editing mode instead of selecting the playlist for playback.

Fixes #110: Cannot select user playlists
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-08-25 13:36:52 -04:00
Anna Schumaker 7e303fa2b1 gui/sidebar: Add functions for setting and getting editable state
I want to be able to change this when the user middle-clicks a row, so
let's start by adding in some support functions.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-08-25 13:16:11 -04:00
Anna Schumaker 466d9ce291 gui/sidebar: Enable editing playlist treeview entries
But only for user playlists.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-08-22 09:16:02 -04:00
Anna Schumaker 3f9372051f gui/sidebar: Add a function for setting an iterator from string
The GtkTreeView editing callbacks give me a path string that I'll need
to convert into an iterator to find the edited playlist.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-08-22 09:15:48 -04:00
Anna Schumaker 2cfccb8177 gui/sidebar: Add a playlist update function that takes a playlist
Once we change the name of a playlist, we won't be able to find it in
the sidebar model.  So let's add a way to update an iterator by passing
the playlist to use for updating.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-08-22 09:15:31 -04:00
Anna Schumaker 1d09e967d0 core/playlist: Move random setting into the playlist struct
I move the random variable into the playlist code since it is no longer
used by the queue layer.  This gives me the opportunity to change it
into a boolean rather than a bit flag.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-05-13 08:45:04 -04:00
Anna Schumaker b5c1af263a core/playlist: Rename playlist_cur() -> playlist_current()
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-04-28 09:40:02 -04:00
Anna Schumaker 5c215df0bf core/playlist: playlist_select() takes a playlist pointer
And stores it for future reference, so we don't have to keep looking up
current and previous playlists.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-04-28 09:40:02 -04:00
Anna Schumaker 09e358b96b core/playlist: Rename playlist_get() -> playlist_lookup()
I think "lookup" is a better name for this function, since it's similar
to performing a dictionary lookup.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-04-28 09:40:02 -04:00
Anna Schumaker 61e3137131 core/playlist: playlist_{get,set}_random() take a playlist pointer
Additionally, playlist_set_random() uses a playlist-level function
pointer to decide what to do.  In most cases this will simply toggle the
flag, but the history playlist does not support random playback.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-04-28 09:40:02 -04:00
Anna Schumaker 0c1147513e core/playlist: playlist_size() takes a playlist pointer
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-04-28 09:40:02 -04:00
Anna Schumaker 066027ecb6 core/playlist: playlist_delete() uses a playlist-level function pointer
Rather than going through the playlist-type operations.  Additionally, I
take this opportunity to change playlist_delete() to take a playlist
struct directly.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-04-28 09:40:02 -04:00
Anna Schumaker 846f7df9c1 gui/sidebar: Add a gui_sidebar_iter_playlist() function
It's frequently useful to get the playlist directly, rather than looking
up type and name first.  Let's add a function to do just that!

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-04-28 09:40:02 -04:00
Anna Schumaker 638caeaa91 gui/sidebar: Set the playlist before changing the random button
Otherwise we could end up changing the random setting on the previous
playlist when displaying a new one.

Fixes #106: Switching playlists clears random setting
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-04-26 14:25:03 -04:00
Anna Schumaker 83a21863b9 gui/sidebar: Select the current playlist on startup
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-04-04 11:27:45 -04:00
Anna Schumaker e876f8125f gui/sidebar: Restore expanded rows on startup
Fixes #94: Playlist heading not open by default
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-04-04 11:27:24 -04:00
Anna Schumaker dc53ae271b gui/sidebar: Store the row expanded setting for later use
I want to use this to track if the user has expanded or collapsed any of
the sidebar rows.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-04-04 10:04:33 -04:00
Anna Schumaker df2236db9f gui/sidebar: Add a function for selecting the default playlist
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-03-31 13:45:55 -04:00
Anna Schumaker 1291a0d139 gui/sidebar: Add a function for updating playlist text
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-03-31 13:45:55 -04:00
Anna Schumaker b3efd9d84d gui/sidebar: Respond to the Delete key
Gtk doesn't have a simple way to manually trigger this, so I didn't
write a unit test for this feature.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-03-31 13:45:55 -04:00
Anna Schumaker 828f861d9a gui/sidebar: Handle random button clicks
This makes the most sense here, and lets us remove gui/queue.c at some
point in the future.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-03-31 13:45:55 -04:00
Anna Schumaker 3562e164b0 gui/sidebar: Implement selection-changed handlers
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-03-31 13:45:55 -04:00
Anna Schumaker a152ed689f gui/sidebar: Move the visible function into sidebar.c
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-03-31 13:45:55 -04:00
Anna Schumaker a2113dc378 gui/sidebar: Add a function for inserting a playlist in sorted order
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-03-31 13:45:55 -04:00
Anna Schumaker 9885c60bff gui/sidebar: Add functions for appending child playlists
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-03-31 13:45:55 -04:00
Anna Schumaker 831a5379e5 gui/sidebar: Add a function for finding playlists
This function scans through the treestore at the current level, without
descending into children.  This is because we frequently know what
category playlists are under when searching for a child, so it makes
sense to find that first.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-03-31 13:45:55 -04:00
Anna Schumaker f3f8ad91c6 gui/sidebar: Add a function for adding playlists
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-03-31 13:45:55 -04:00
Anna Schumaker 4fc8c72ea8 gui/sidebar: Initialize the sidebar with default headers
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-03-31 13:45:55 -04:00
Anna Schumaker 18e76a7dca gui/sidebar: Add useful iterator functions
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-03-31 13:45:55 -04:00
Anna Schumaker b3074979f7 gui/sidebar: Add a gui_sidebar() function
Called to access the GtkPaned widget.  I also rename the widget
"sidebar" to match the new convention.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-03-31 13:45:55 -04:00
Anna Schumaker 69b39ea717 gui/sidebar: Remove unused sidebar liststore
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-09-26 08:07:34 -04:00
Anna Schumaker 7e00c8ed10 core/settings: Move settings into core/
Implements issue #9: Move settings into core/
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-09-23 16:11:08 -04:00
Anna Schumaker 9733b82ae8 core/collection: Remove file
I have replaced everything in this file with the code in
core/playlists/library.c

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-08-13 08:31:30 -04:00
Anna Schumaker bddbd04ef5 gui: Remove stack widget
It isn't needed now that we pop up a file choose dialog for selecting
library paths.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-08-13 08:31:30 -04:00
Anna Schumaker b3476e15e9 gui/collection: Remove unused collection code
And the now unused sidebar widget.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-08-13 08:31:30 -04:00
Anna Schumaker dc07d637f6 gui/history: Remove unused gui queue code
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-07-29 17:06:06 -04:00
Anna Schumaker 64fc5a9a0d gui/collection: Remove unused gui queue code
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-07-29 17:06:06 -04:00
Anna Schumaker 15ed068e13 gui/playlist: Select Collection playlist during startup
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>
2016-07-29 17:06:06 -04:00
Anna Schumaker bd1e20bc56 core/tempq: Load the tempq file through an idle task
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>
2016-06-14 17:05:11 -04:00
Anna Schumaker 1ad112e217 gui/sidebar: Select first enabled queue during startup
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>
2016-06-04 13:52:09 -04:00
Anna Schumaker 2c65584e2d gui: Remove o_notebook
Now that nothing uses it.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-05-27 12:01:43 -04:00