From: Richard Kettlewell Date: Sun, 7 Aug 2011 16:45:36 +0000 (+0100) Subject: Merge branch 'protogen' X-Git-Tag: branchpoint-5.1~22 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/commitdiff_plain/6961095b797229842e1465ff3670625d11e95167?hp=-c Merge branch 'protogen' --- 6961095b797229842e1465ff3670625d11e95167 diff --combined cgi/disorder-cgi.h index 7788578,43ad241..e9deab2 --- a/cgi/disorder-cgi.h +++ b/cgi/disorder-cgi.h @@@ -77,6 -77,7 +77,6 @@@ struct queue_entry *dcgi_findtrack(cons void option_set(const char *name, const char *value); const char *option_label(const char *key); int option_label_exists(const char *key); -char **option_columns(const char *name, int *ncolumns); #define DCGI_QUEUE 0x0001 #define DCGI_PLAYING 0x0002 @@@ -91,8 -92,8 +91,8 @@@ extern struct queue_entry *dcgi_queue extern struct queue_entry *dcgi_playing; extern struct queue_entry *dcgi_recent; - extern int dcgi_volume_left; - extern int dcgi_volume_right; + extern long dcgi_volume_left; + extern long dcgi_volume_right; extern char **dcgi_new; extern int dcgi_nnew; diff --combined clients/disorder.c index 64694ef,5d47bb1..b401c62 --- a/clients/disorder.c +++ b/clients/disorder.c @@@ -138,8 -138,9 +138,9 @@@ static void cf_playing(char attribute(( } static void cf_play(char **argv) { + char *id; while(*argv) - if(disorder_play(getclient(), *argv++)) exit(EXIT_FAILURE); + if(disorder_play(getclient(), *argv++, &id)) exit(EXIT_FAILURE); } static void cf_remove(char **argv) { @@@ -244,7 -245,7 +245,7 @@@ static int isarg_regexp(const char *s) } static void cf_dirs(char **argv) { - cf_somelist(argv, disorder_directories); + cf_somelist(argv, disorder_dirs); } static void cf_files(char **argv) { @@@ -316,10 -317,10 +317,10 @@@ static void cf_stats(char attribute((un } static void cf_get_volume(char attribute((unused)) **argv) { - int l, r; + long l, r; if(disorder_get_volume(getclient(), &l, &r)) exit(EXIT_FAILURE); - xprintf("%d %d\n", l, r); + xprintf("%ld %ld\n", l, r); } static void cf_set_volume(char **argv) { @@@ -344,7 -345,7 +345,7 @@@ static void cf_move(char **argv) static void cf_part(char **argv) { char *s; - if(disorder_part(getclient(), &s, argv[0], argv[1], argv[2])) exit(EXIT_FAILURE); + if(disorder_part(getclient(), argv[0], argv[1], argv[2], &s)) exit(EXIT_FAILURE); xprintf("%s\n", nullcheck(utf82mb_f(s))); } @@@ -359,7 -360,7 +360,7 @@@ static void cf_authorize(char **argv) static void cf_resolve(char **argv) { char *track; - if(disorder_resolve(getclient(), &track, argv[0])) exit(EXIT_FAILURE); + if(disorder_resolve(getclient(), argv[0], &track)) exit(EXIT_FAILURE); xprintf("%s\n", nullcheck(utf82mb_f(track))); } @@@ -415,7 -416,7 +416,7 @@@ static int isarg_integer(const char *s static void cf_new(char **argv) { char **vec; - if(disorder_new_tracks(getclient(), &vec, 0, argv[0] ? atoi(argv[0]) : 0)) + if(disorder_new_tracks(getclient(), argv[0] ? atol(argv[0]) : 0, &vec, 0)) exit(EXIT_FAILURE); while(*vec) xprintf("%s\n", nullcheck(utf82mb(*vec++))); @@@ -504,15 -505,9 +505,15 @@@ static void cf_setup_guest(char **argv exit(EXIT_FAILURE); } +/** @brief A scheduled event read from the server */ struct scheduled_event { + /** @brief When event should occur */ time_t when; + + /** @brief Details of action */ struct kvp *actiondata; + + /** @brief Event ID */ char *id; }; @@@ -586,31 -581,27 +587,27 @@@ static void cf_schedule_del(char **argv } static void cf_schedule_play(char **argv) { - if(disorder_schedule_add(getclient(), - dateparse(argv[0]), - argv[1], - "play", - argv[2])) + if(disorder_schedule_add_play(getclient(), + dateparse(argv[0]), + argv[1], + argv[2])) exit(EXIT_FAILURE); } static void cf_schedule_set_global(char **argv) { - if(disorder_schedule_add(getclient(), - dateparse(argv[0]), - argv[1], - "set-global", - argv[2], - argv[3])) + if(disorder_schedule_add_set_global(getclient(), + dateparse(argv[0]), + argv[1], + argv[2], + argv[3])) exit(EXIT_FAILURE); } static void cf_schedule_unset_global(char **argv) { - if(disorder_schedule_add(getclient(), - dateparse(argv[0]), - argv[1], - "set-global", - argv[2], - (char *)0)) + if(disorder_schedule_add_unset_global(getclient(), + dateparse(argv[0]), + argv[1], + argv[2])) exit(EXIT_FAILURE); } @@@ -678,28 -669,12 +675,28 @@@ static void cf_playlist_set(char **argv exit(EXIT_FAILURE); } -static const struct command { +/** @brief Command-line client's definition of a command */ +static const struct client_command { + /** @brief Command name */ const char *name; - int min, max; + + /** @brief Minimum number of argument */ + int min; + + /** @brief Maximum number of argument */ + int max; + + /** @brief Pointer to function implementing command */ void (*fn)(char **); + + /** @brief Function to recognize a valid argument, or NULL */ int (*isarg)(const char *); - const char *argstr, *desc; + + /** @brief Summary of arguments */ + const char *argstr; + + /** @brief Description */ + const char *desc; } commands[] = { { "adduser", 2, 3, cf_adduser, isarg_rights, "USERNAME PASSWORD [RIGHTS]", "Create a new user" }, diff --combined disobedience/playlists.c index 3b38bc7,50e099f..c5273ae --- a/disobedience/playlists.c +++ b/disobedience/playlists.c @@@ -253,7 -253,8 +253,8 @@@ static int playlistcmp(const void *ap, /* Playlists menu ----------------------------------------------------------- */ static void playlist_menu_playing(void attribute((unused)) *v, - const char *err) { + const char *err, + const char attribute((unused)) *id) { if(err) popup_submsg(playlist_window, GTK_MESSAGE_ERROR, err); } @@@ -270,7 -271,7 +271,7 @@@ static void playlist_menu_received_cont return; } for(int n = 0; n < nvec; ++n) - disorder_eclient_play(client, vec[n], playlist_menu_playing, NULL); + disorder_eclient_play(client, playlist_menu_playing, vec[n], NULL); } /** @brief Called to activate a playlist @@@ -579,7 -580,7 +580,7 @@@ static const char *playlist_new_valid(v /** @brief Get entered new-playlist details * @param namep Where to store entered name (or NULL) * @param fullnamep Where to store computed full name (or NULL) - * @param sharep Where to store 'shared' flag (or NULL) + * @param sharedp Where to store 'shared' flag (or NULL) * @param publicp Where to store 'public' flag (or NULL) * @param privatep Where to store 'private' flag (or NULL) */ @@@ -663,8 -664,7 +664,8 @@@ static void playlist_picker_fill(const } /** @brief Update a section in the picker tree model - * @param section Section name + * @param title Display name of section + * @param key Key to search for * @param start First entry in @ref playlists * @param end Past last entry in @ref playlists */ @@@ -695,7 -695,8 +696,7 @@@ static void playlist_picker_update_sect * @param title Display name of section * @param key Key to search for * @param iter Iterator to point at key - * @param create If TRUE, key will be created if it doesn't exist - * @param compare Row comparison function + * @param create Whether to create the row * @return TRUE if key exists else FALSE * * If the @p key exists then @p iter will point to it and TRUE will be diff --combined disobedience/properties.c index fb39ea4,92f2128..ded862b --- a/disobedience/properties.c +++ b/disobedience/properties.c @@@ -61,26 -61,23 +61,26 @@@ struct prefdata GtkWidget *widget; }; -/* The type of a preference is the collection of callbacks needed to get, - * display and set it */ +/** @brief Type of a track preference + * + * The type of a preference is the collection of callbacks needed to get, + * display and set it. + */ struct preftype { + /** @brief Kick off the request to fetch the pref from the server. */ void (*kickoff)(struct prefdata *f); - /* Kick off the request to fetch the pref from the server. */ + /** @brief Called when the value comes back in; creates the widget. */ void (*completed)(struct prefdata *f); - /* Called when the value comes back in; creates the widget. */ + /** @brief Get the edited value from the widget. */ const char *(*get_edited)(struct prefdata *f); - /* Get the edited value from the widget. */ /** @brief Update the edited value */ void (*set_edited)(struct prefdata *f, const char *value); + /** @brief Set the new value and (if necessary) arrange for our display to update. */ void (*set)(struct prefdata *f, const char *value); - /* Set the new value and (if necessary) arrange for our display to update. */ }; /* A namepart pref */ @@@ -110,7 -107,7 +110,7 @@@ static const struct preftype preftype_b set_boolean }; -/* @brief The known prefs for each track */ +/** @brief The known prefs for each track */ static const struct pref { const char *label; /**< @brief user-level description */ const char *part; /**< @brief protocol-level tag */ @@@ -338,8 -335,8 +338,8 @@@ static void kickoff_namepart(struct pre * wanted was the underlying preference, but in fact it should always match * and will supply a sane default without having to know how to parse tracks * names (which implies knowing collection roots). */ - disorder_eclient_namepart(client, prefdata_completed, - f->track, "display", f->p->part, f); + disorder_eclient_part(client, prefdata_completed, + f->track, "display", f->p->part, f); } static void completed_namepart(struct prefdata *f) {