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
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;
}
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) {
}
static void cf_dirs(char **argv) {
- cf_somelist(argv, disorder_directories);
+ cf_somelist(argv, disorder_dirs);
}
static void cf_files(char **argv) {
}
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) {
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)));
}
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)));
}
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++)));
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;
};
}
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);
}
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" },
/* 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);
}
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
/** @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)
*/
}
/** @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
*/
* @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
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 */
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 */
* 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) {