Commit Graph

1372 Commits

Author SHA1 Message Date
Anna Schumaker 3723dff87d core/file: Add cache_file_exists() function
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-06-24 10:50:37 -04:00
Anna Schumaker 79ecaa11fb core/file: Add cache_file_write_path() function
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-06-24 10:50:37 -04:00
Anna Schumaker 5dcf681e48 core/file: Add cache_file_path() function
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-06-24 10:50:37 -04:00
Anna Schumaker b5e13af30c core/file: Add cache_file_init() function
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-06-24 10:50:37 -04:00
Anna Schumaker 12949651f7 core/file: Add struct cache_file
I want to reuse as much file code as I can for cache files, but I need a
new struct since data and cache files track different properties.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-06-24 10:50:37 -04:00
Anna Schumaker 9e0f017e61 core/file: Build in minimum version checks
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>
2016-06-24 10:50:37 -04:00
Anna Schumaker ee4f0d4c89 core/file: Writes go to a temporary file first
And then rename the temporary file when closed.  This protects users
data in case Ocarina gets killed.

Implements issue #31: Make file writes seem atomic
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-06-24 10:50:37 -04:00
Anna Schumaker 224290d4eb core/file: file->f_name can be a pointer
I'm only setting this to a static string, so it doesn't make sense to
store this as a char array.  Let's use a string pointer instead.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-06-24 10:50:37 -04:00
Anna Schumaker 427319b72e core/file: Move OCARINA_NAME configuration into version.h
I'm going to use this for saving album art to the right place.  I moved
it into an include file to avoid duplicating code.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-06-24 10:50:37 -04:00
Anna Schumaker 98faba93d1 core/string: Add a string_length() function
This is a wrapper around strlen(), but checks for a NULL pointer first.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-06-24 10:50:37 -04:00
Anna Schumaker 4998b0867b core/tags/track: Find the average play count of tracks
This function returns the average count of tracks that have been played,
and not the average count of all tracks.

Implements #29: Efficiently calculate average play count of tracks
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-06-14 17:11:06 -04:00
Anna Schumaker 1973d15605 core/tags/track: Count the total number of tracks played
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-06-14 17:10:52 -04:00
Anna Schumaker a97ec66e7f core/tags/track: Count the number of unplayed tracks
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-06-14 17:10:47 -04:00
Anna Schumaker d825e2d481 core: Remove random functions
I no longer need these now that the queue is using the glib
g_random_int_range() function.

Implements #32: Remove custom RNG code
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-06-14 17:10:30 -04:00
Anna Schumaker bc513532c1 gui/idle: Add a function to disable processing idle tasks
This is needed during ocarina shutdown to prevent a segfault.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-06-14 17:09:39 -04:00
Anna Schumaker 0bcfa06bfb core/containers/database: Add a function for loading databases when idle
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-06-14 17:06:57 -04:00
Anna Schumaker f01cce3b47 gui/idle: Split out idle queue functions
I want to use this outside of the collection, so let's move these
functions into a new file.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-06-13 09:47:46 -04:00
Anna Schumaker dfb023a0fc gui/model: Set text to bold for the currently playing track
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>
2016-06-07 09:14:52 -04:00
Anna Schumaker a89aa5a201 core/audio: Trigger queue updates when changing tracks
I need to do this for temporary queues in addition to the collection for
bolding to work properly.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-06-07 09:01:13 -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 108dbacf41 gui/ocarina: Replace share_file() with find_file_path()
And don't keep the result around any longer than we need to.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-05-27 12:01:43 -04:00
Anna Schumaker e97939a9cd gui: Remove old Tab and QueueTab code
Now that nothing uses it

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-05-27 12:01:43 -04:00
Anna Schumaker c0a6c663d1 gui: Move tempq operations into tempq.c
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-05-27 12:01:43 -04:00
Anna Schumaker bd22c8da6d gui/collection: Move collection_ops into collection.c
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-05-27 12:01:43 -04:00
Anna Schumaker 27a4cc23ed gui: Remove C++ collection tab code
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-05-27 12:01:43 -04:00
Anna Schumaker e290552812 gui/history: Convert file to C
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-05-27 12:01:43 -04:00
Anna Schumaker 5a9c6a1dd1 gui/history: Remove obsolete HistoryTab code
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-05-27 12:01:43 -04:00
Anna Schumaker d769140e35 gui: Remove C++ playlist code
And notebook switching code in playlist.c

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-05-27 12:01:43 -04:00
Anna Schumaker 7995e381c0 gui/playlist: Move playlist_ops into playlist.c
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-05-27 12:01:43 -04:00
Anna Schumaker a1c6502226 gui/audio: Handle favorite and hide buttons
This lets me remove gui/playlist_tab.cpp

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-05-27 12:01:43 -04:00
Anna Schumaker f328b1686d gui/view: Scroll to the current queue's iterator position
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-05-27 12:01:43 -04:00
Anna Schumaker cacd344741 gui/view: Sort queue when columns are clicked
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-05-27 12:01:43 -04:00
Anna Schumaker 8e6b963eb8 gui/view: Add a right-click menu
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-05-27 12:01:43 -04:00
Anna Schumaker c9eb9d724b gui/view: Add keypress events
- 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>
2016-05-27 12:01:43 -04:00
Anna Schumaker aee4764a2c core/queue: Add queue_erase() and qop_erase()
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>
2016-05-27 12:01:43 -04:00
Anna Schumaker 8d2b0caf6c core/tempq: Store queue operations passed to tempq_init()
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>
2016-05-27 12:01:43 -04:00
Anna Schumaker 2d1ddd5a35 gui/view: Load a track when treeview is double clicked
And remove this feature from the C++ code.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-05-27 12:01:43 -04:00
Anna Schumaker bbf111ecb0 gui/view: Add gui_view_set_model()
To set the currently displayed treemodel

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-05-27 12:01:43 -04:00
Anna Schumaker 76a6eba537 gui/queue: Add functions to filter the currently displayed queue
And remove the ability to filter from the C++ code.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-05-27 12:01:43 -04:00
Anna Schumaker 4c784366d7 gui/view: Save and restore column widths
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-05-27 12:01:43 -04:00
Anna Schumaker b59b2a2daf gui/audio: Remove old pause after configuration code
And rearrange UI widgets a bit

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-05-14 12:03:53 -04:00
Anna Schumaker bf73685098 gui/audio: Add new GtkComboBox for controlling automatic pausing
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-05-14 11:55:46 -04:00
Anna Schumaker ada392550a gui: Switch over to using a GuiQueueModel
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-05-14 07:37:24 -04:00
Anna Schumaker ea149d57df gui/model: Convert iters and paths into tracks
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-05-14 07:37:17 -04:00
Anna Schumaker e8681e4c92 gui/queue: Add functions to update the model
These are simple passthrough functions to convert a struct queue into a
GuiQueueModel.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-05-14 07:37:03 -04:00
Anna Schumaker 70803cc199 gui/queue: Create a GuiQueueModel as part of the gui_queue
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-05-14 07:36:56 -04:00
Anna Schumaker 4fd370ceb6 gui/model: Send tree model signals
"row-inserted", "row-deleted", and "row-changed"

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-05-14 07:36:50 -04:00
Anna Schumaker eb481b8d09 gui/model: Add support for gtk_tree_model_get_iter()
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-05-14 07:35:50 -04:00
Anna Schumaker ff81af24fc gui/model: Add support for gtk_tree_model_get_column_type()
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-05-14 07:35:40 -04:00
Anna Schumaker ddcb973d8e gui/model: Begin new custom tree model for queues
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>
2016-05-14 07:35:20 -04:00
Anna Schumaker 21eb09ced3 gui: Remove old TabToolbar code
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-05-14 07:35:08 -04:00
Anna Schumaker bc9efade75 gui/queue: Add a switch to enable and disable tempqueues
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-05-14 07:35:01 -04:00
Anna Schumaker d19e0b2cc0 gui/queue: Add a search entry widget
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>
2016-05-14 07:34:55 -04:00
Anna Schumaker ddbc040a3b gui/queue: Set state of random and repeat buttons
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>
2016-05-14 07:34:40 -04:00
Anna Schumaker 410a784ede gui/queue: Add flags to the gui queue
This will be used to determine if the random and random buttons should
be enabled.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-05-13 16:36:44 -04:00
Anna Schumaker ce8ec63886 gui/sidebar: Switch over to using the new gui queues
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-05-13 16:36:44 -04:00
Anna Schumaker f098811a28 gui: Wire up gui_queue_{alloc|free}() in the queue operations
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-05-13 16:36:44 -04:00
Anna Schumaker 2d6e42832b gui/queue: Add a text field to the gui queue
The sidebar is going to look at this when setting queue sizes.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-05-13 16:36:44 -04:00
Anna Schumaker f85ad3a9c3 gui/queue: Add a new gui_queue struct
This will be used to store queue state once I no longer support notebook
tabs.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-05-13 16:36:44 -04:00
Anna Schumaker 5bc9f65cd9 core/tempq: Add tempq_index() function
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-05-13 16:36:44 -04:00
Anna Schumaker 5419711409 core/queue: Add qop_deinit() queue operation
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>
2016-05-13 16:36:44 -04:00
Anna Schumaker 8bb7a20ff4 core/queue: Add qop_init() queue operation
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>
2016-05-13 16:36:44 -04:00
Anna Schumaker f2222c1063 tests/gui: Add __collection_buttonpress() default handler
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-05-10 11:16:44 -04:00
Anna Schumaker 13dadd25ef core/audio: Remove audio_stop() function
It has no users now that the stop button has been removed.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-05-10 11:15:35 -04:00
Anna Schumaker 16b055f06b gui/sidebar: Add support for removing temporary queues
Either through the delete key or when the queue runs out of tracks.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-29 13:04:45 -04:00
Anna Schumaker 839f4c4aa1 gui/sidebar: Add support for adding temporary queues
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-29 13:04:45 -04:00
Anna Schumaker c663f287d4 gui/sidebar: Add sizes to Collection and History entries
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-29 13:04:45 -04:00
Anna Schumaker eb137c4339 gui/sidebar: Change notebook page through the sidebar
And make sure other sidebar views are deselected.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-29 13:04:45 -04:00
Anna Schumaker 6c653c6a79 gui/sidebar: Add Collection and History entries to the sidebar
I could do this as a treeview, but creating this as a liststore in glade
is WAY easier!

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-29 13:04:45 -04:00
Anna Schumaker 9ee00f9997 gui/sidebar: Add a function for deselecting treeviews
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>
2016-04-29 13:04:45 -04:00
Anna Schumaker 7439a2a73d gui/playlist: Change current playlist when selected
I also add a function to get the currently selected playlist.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-29 13:04:45 -04:00
Anna Schumaker be6895630d gui/playlist: Begin new playlist sidebar widget
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-29 13:04:45 -04:00
Anna Schumaker 3c3f11b958 gui/collection: Remove old collection manager code
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-29 13:04:45 -04:00
Anna Schumaker 2cae2cd525 gui/collection: Remove library paths with the Delete key
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-29 13:04:45 -04:00
Anna Schumaker 0afe46b5df gui/collection: Toggle library state through the gui
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-29 13:04:45 -04:00
Anna Schumaker 8dece02eed gui/collection: Update library paths when rows are clicked
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-29 13:04:45 -04:00
Anna Schumaker f34e2cb57b gui/collection: Change tab page when "Add new Path" is selected
I also add in code that reuses the current file chooser for picking
paths.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-29 13:04:45 -04:00
Anna Schumaker eb81fa2e20 gui/collection: Add sidebar widget showing Collection header
And make it non-selectable.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-29 13:04:45 -04:00
Anna Schumaker 58d61f52e2 gui/sidebar: Add new sidebar widget
This is a GtkPaned that remembers its size between Ocarina sessions.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-29 13:04:45 -04:00
Anna Schumaker 870a2b769b gui/window: Save width and height between sessions
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>
2016-04-29 13:04:45 -04:00
Anna Schumaker 0c214dd1a9 gui/window: Add gui_window_deinit()
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-29 13:04:45 -04:00
Anna Schumaker 0c8bcfa552 gui/window: Switch to C-style gtk widgets
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-29 13:04:45 -04:00
Anna Schumaker 5e96f40cf8 gui/audio: Unit test can simulate button presses
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>
2016-04-08 13:39:39 -04:00
Anna Schumaker 50a7c83d61 gui/audio: Convert gst.cpp to audio.c
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 13:16:10 -04:00
Anna Schumaker 5368208a37 gui/gst: Remove gst :: pre_init() and rename gst_init()
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 13:12:19 -04:00
Anna Schumaker dee8b948b0 gui/gst: Remove gst :: toggle()
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 12:03:08 -04:00
Anna Schumaker aacc1f876a gui/gst: Completely define the play button in glade
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 12:03:08 -04:00
Anna Schumaker 6723ef88c7 gui/gst: Completely define the pause button in glade
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 12:03:08 -04:00
Anna Schumaker 8ae31ed483 gui/gst: Completely define the stop button in glade
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 12:03:08 -04:00
Anna Schumaker 00899873bd gui/gst: Completely define the previous button in glade
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 12:03:08 -04:00
Anna Schumaker 6680cdbd0e gui/gst: Completely define the next button in glade
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 12:03:08 -04:00
Anna Schumaker 44d7f9a853 core/gst: Set ban / favorite status when tracks are loaded
It's easier to do this from the audio code than the plalist code.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 12:03:08 -04:00
Anna Schumaker 61436d5ccd gui: Switch over to the new gui_builder system
Glib::wrap() all the things!

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 12:03:08 -04:00
Anna Schumaker 0eb8521094 gui/builder: Get a widget from the GTK builder
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 12:03:08 -04:00
Anna Schumaker d4b27316c0 gui/builder: Get an object from the builder
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 12:03:08 -04:00
Anna Schumaker 3bc5b1db9e gui/builder: Add new file for accessing the GtkBuilder
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 12:03:08 -04:00
Anna Schumaker c479042a86 gui/settings: Add gui_settings_has() function
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 12:03:08 -04:00
Anna Schumaker 92c1b64b1a gui/settings: Add functions for setting and getting values
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 12:03:08 -04:00
Anna Schumaker f23fb9e0f5 gui/settings: Add new settings file
The settings layer will track various configuration options set by the
user.  This belongs in the gui, and not core, because it controls
settings specific to this gui implementation.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 12:03:08 -04:00
Anna Schumaker 711eb67f44 core/queue: Fix queue random and selection test
6.4.8 changed how random tracks are selected, but never updated the unit
test.  This patch fixes the unit test, and makes a few changes to make
sure the right tracks are getting selected.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:03:21 -04:00
Anna Schumaker df2d365b80 tests: Remove test_cp_data_dir()
This function is unused now.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker 0cf5187867 core/audio: Add on_state_change() audio operation
Called to notify when playback state has changed.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker ed5f035855 core/audio: Rename audio_get_player() to test_audio_player()
Also, let's only have this function when CONFIG_TESTING is enabled.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker 2586348921 core/audio: Convert file to C
I also convert core/core.c so the audio test can be converted at the
same time.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker a59a71eb38 core/core: Move core_deinit() out of the core namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker 04291f4296 core/core: Move core_init() out of the core namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker 1d76990fd1 core/audio: Add audio_error() to handle error messages
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker a5556ac10a core/audio: Move audio_eos() out of the AudioDriver
This change lets me remove the AudioDriver, too.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker 276c56406a core/audio: Move audio_pause_after() out of the audio namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker d18d3dd214 core/audio: Move audio_prev() out of the audio namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker 3f25369444 core/audio: Move audio_next() out of the audio namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker 7765c2bf57 core/audio: Remove unused on_error() AudioDriver function
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker 2511db3a08 core/audio: Add audio_cur_state() function
This replaces the is_playing() function of the AudioDriver class.  I can
also make the GUIs GstDriver static.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker 0a1a9f1394 core/audio: Move audio_cur_track() out of the audio namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker d1d722a163 core/audio: Move audio_stop() out of the audio namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker e1abe94b28 core/audio: Move audio_duration() out of the audio namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker 20bb01ef4e core/audio: Move audio_position() out of the audio namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker 566ef3bb50 core/audio: Move audio_seek() out of the audio namespace 2016-03-28 08:01:30 -04:00
Anna Schumaker 9097bd0ffc core/audio: Move audio_pause() out of the audio namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:29 -04:00
Anna Schumaker 16c4c23a42 core/audio: Move audio_play() out of the audio namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:29 -04:00
Anna Schumaker e5c3d8f02e core/audio: Move audio_load() out of the audio namespace
And add the on_load() audio operation.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:29 -04:00
Anna Schumaker e0c89556ed core/audio: Add audio_deinit() function
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:29 -04:00
Anna Schumaker d9540b29d6 core/audio: Move audio_init() out of the audio namespace
I also move the gstreamer playbin back into core/

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:29 -04:00
Anna Schumaker aad90782ba core/collection: Clean up error handling code
I was assuming that my disk returns -EIO when it enters its failed
state, but it really seems to be return -ENOENT.  Let's have this code
check for any error, rather than one specific one.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-23 09:42:05 -04:00
Anna Schumaker 5979d1dcaf core/collection: Handle -EIO errors coming from the filesystem
One of my disks frequently returns this error, and has wiped out my
track database on more than one occasion.  Let's handle this error by
disabling the library until the user tells us it is safe to use again.

Fixes #33: Handle music directories disappearing better
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-21 08:36:48 -04:00
Anna Schumaker 882ee6e1e7 core/tempq: Convert file to C
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-11 10:40:34 -05:00
Anna Schumaker 15f5b8fc87 core/tempq: Switch STL list for glib GSList
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-11 10:40:34 -05:00
Anna Schumaker 27eab88b9c core/tempq: Remove unused TempQueue class
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-11 10:40:34 -05:00
Anna Schumaker 9633806c2d core/tempq: Merge TempQueue :: read() with tempq_init()
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-11 10:40:34 -05:00
Anna Schumaker 2102b1bfc9 core/tempq: Move tempq_save() out of the deck namespace
And remove the deck :: write() and TempQueue :: write() functions while
we're at it.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-11 10:40:34 -05:00
Anna Schumaker b919843717 core/tempq: Add tempq_deinit() function
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-11 10:40:34 -05:00
Anna Schumaker b3d95a06d4 core/tempq: Move tempq_next() out of the deck namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-11 10:40:34 -05:00
Anna Schumaker ecda136015 core/tempq: Move tempq_move() out of the deck namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-11 10:40:34 -05:00
Anna Schumaker c22b93b2cf core/tempq: Move tempq_get() out of the deck namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-11 10:40:34 -05:00
Anna Schumaker 6bdc481cb4 core/tempq: Make __tempq_index() private
It has no users outside of unit tests.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-11 10:40:34 -05:00
Anna Schumaker 06d62240bb core/tempq: Move tempq_free() out of the deck namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-11 10:40:34 -05:00
Anna Schumaker bce2ba33f7 core/tempq: Move tempq_alloc() out of the deck namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-11 10:40:34 -05:00
Anna Schumaker 8c7550d5c3 core/tempq: Move tempq_init() out of the deck namespace
I also take this opportunity to drop support for upgrading from file
format 0.  I've had several releases since this format was supported, so
this should be safe to do.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-11 10:40:34 -05:00
Anna Schumaker 51379c7e8c core/history: Add history_prev() function
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-11 10:40:34 -05:00
Anna Schumaker c125b3893e core/history: Add history_add() function
I decided that having a uniqueue history queue doesn't really get me
anything, so I dropped that portion of the behavior.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-11 10:40:34 -05:00
Anna Schumaker 75c039f22d core/history: Add history_init() and history_deinit() functions
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-11 10:40:34 -05:00
Anna Schumaker 77d4815eb6 core/history: Move history queue into a new file
I think managing this separately from temporary queues will make the
code simpler.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-11 10:40:34 -05:00
Anna Schumaker 8c8ab2a9eb core/idle: Add idle_cancel() function
This function is used to cancel all idle tasks and free the memory
allocated for them.  This needs to be called when Ocarina is shutting
down to prevent a possible hang with the gtk idle callback continuing to
process tasks.

Fixes #30: Closing Ocarina should cancel idle tasks
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-01 08:27:13 -05:00
Anna Schumaker b3592e40c0 core/playlist: Rename PL_BANNED -> PL_HIDDEN
"Banning" a track is a bit harsh.  Let's talking about hiding tracks
instead, so that it sounds friendlier.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-29 13:22:31 -05:00
Anna Schumaker fef3ef3353 core: Initialize the playlist before the collection
I think it makes more sense to have the collection manage if banned
tracks are displayed or not, rather than doing this from the playlist
layer.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-26 11:04:42 -05:00
Anna Schumaker beda9bfa3f core/collection: Add functions to ban and unban tracks
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-26 11:04:42 -05:00
Anna Schumaker 3b5bbf14af core/playlist: playlist_remove() can return a boolean
The collection will be using this soon to tell if a track was
successfully unbanned.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-26 11:04:42 -05:00
Anna Schumaker 20825613e9 core/playlist: playlist_add() can return a boolean
There is at least one place in the gui where it needs to know if a track
was actually added to a playlist.  Adding a return value is the best way
to know what happened.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-26 11:04:42 -05:00
Anna Schumaker 02c82c182e core/playlist: Convert file to C
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-26 11:04:42 -05:00
Anna Schumaker b7a4bb3872 core/playlist: Use playlist_t enum to access playlists
Using strings is pretty tedious, so let's restrict restrict playlist
access to known values.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-26 11:04:42 -05:00