diff options
Diffstat (limited to '')
-rw-r--r-- | src/playlist_error.h | 12 | ||||
-rw-r--r-- | src/playlist_print.c | 5 | ||||
-rw-r--r-- | src/playlist_print.h | 4 | ||||
-rw-r--r-- | src/playlist_save.c | 10 | ||||
-rw-r--r-- | src/playlist_save.h | 5 |
5 files changed, 26 insertions, 10 deletions
diff --git a/src/playlist_error.h b/src/playlist_error.h index 9ecb28e95..ad9c62cf1 100644 --- a/src/playlist_error.h +++ b/src/playlist_error.h @@ -20,6 +20,8 @@ #ifndef MPD_PLAYLIST_ERROR_H #define MPD_PLAYLIST_ERROR_H +#include <glib.h> + enum playlist_result { PLAYLIST_RESULT_SUCCESS, PLAYLIST_RESULT_ERRNO, @@ -34,4 +36,14 @@ enum playlist_result { PLAYLIST_RESULT_DISABLED, }; +/** + * Quark for GError.domain; the code is an enum #playlist_result. + */ +G_GNUC_CONST +static inline GQuark +playlist_quark(void) +{ + return g_quark_from_static_string("playlist"); +} + #endif diff --git a/src/playlist_print.c b/src/playlist_print.c index 40b50545b..9962ffc35 100644 --- a/src/playlist_print.c +++ b/src/playlist_print.c @@ -117,11 +117,12 @@ playlist_print_changes_position(struct client *client, } bool -spl_print(struct client *client, const char *name_utf8, bool detail) +spl_print(struct client *client, const char *name_utf8, bool detail, + GError **error_r) { GPtrArray *list; - list = spl_load(name_utf8); + list = spl_load(name_utf8, error_r); if (list == NULL) return false; diff --git a/src/playlist_print.h b/src/playlist_print.h index 7b520db93..d4f1911d2 100644 --- a/src/playlist_print.h +++ b/src/playlist_print.h @@ -20,6 +20,7 @@ #ifndef PLAYLIST_PRINT_H #define PLAYLIST_PRINT_H +#include <glib.h> #include <stdbool.h> #include <stdint.h> @@ -99,7 +100,8 @@ playlist_print_changes_position(struct client *client, * @return true on success, false if the playlist does not exist */ bool -spl_print(struct client *client, const char *name_utf8, bool detail); +spl_print(struct client *client, const char *name_utf8, bool detail, + GError **error_r); /** * Send the playlist file to the client. diff --git a/src/playlist_save.c b/src/playlist_save.c index e86cbcec1..b8e03ea85 100644 --- a/src/playlist_save.c +++ b/src/playlist_save.c @@ -110,15 +110,15 @@ spl_save_playlist(const char *name_utf8, const struct playlist *playlist) return spl_save_queue(name_utf8, &playlist->queue); } -enum playlist_result +bool playlist_load_spl(struct playlist *playlist, struct player_control *pc, - const char *name_utf8) + const char *name_utf8, GError **error_r) { GPtrArray *list; - list = spl_load(name_utf8); + list = spl_load(name_utf8, error_r); if (list == NULL) - return PLAYLIST_RESULT_NO_SUCH_LIST; + return false; for (unsigned i = 0; i < list->len; ++i) { const char *temp = g_ptr_array_index(list, i); @@ -139,5 +139,5 @@ playlist_load_spl(struct playlist *playlist, struct player_control *pc, } spl_free(list); - return PLAYLIST_RESULT_SUCCESS; + return true; } diff --git a/src/playlist_save.h b/src/playlist_save.h index fcee9e8bf..f8bfb8355 100644 --- a/src/playlist_save.h +++ b/src/playlist_save.h @@ -22,6 +22,7 @@ #include "playlist_error.h" +#include <stdbool.h> #include <stdio.h> struct song; @@ -51,8 +52,8 @@ spl_save_playlist(const char *name_utf8, const struct playlist *playlist); * Loads a stored playlist file, and append all songs to the global * playlist. */ -enum playlist_result +bool playlist_load_spl(struct playlist *playlist, struct player_control *pc, - const char *name_utf8); + const char *name_utf8, GError **error_r); #endif |