summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 476af7c)
raw | patch | inline | side by side (parent: 476af7c)
author | Max Kellermann <max@duempel.org> | |
Mon, 28 Sep 2009 15:38:40 +0000 (17:38 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Mon, 28 Sep 2009 15:38:40 +0000 (17:38 +0200) |
Use forward-declared struct instead. This also removes the typedefs
mpdclient_filelist_t, mpdclient_filelist_entry_t,
mpdclient_playlist_t.
mpdclient_filelist_t, mpdclient_filelist_entry_t,
mpdclient_playlist_t.
22 files changed:
diff --git a/src/filelist.h b/src/filelist.h
index 7904016bc07e86dfbadad2d4058a7071bfc521a4..0f1f0c09d30cb77cc3f001234352f91d3f4496d0 100644 (file)
--- a/src/filelist.h
+++ b/src/filelist.h
struct mpd_song;
-typedef struct filelist_entry {
+struct filelist_entry {
guint flags;
struct mpd_entity *entity;
-} filelist_entry_t;
+};
-typedef struct filelist {
+struct filelist {
/* the list */
GPtrArray *entries;
-} mpdclient_filelist_t;
+};
struct filelist *
filelist_new(void);
diff --git a/src/main.c b/src/main.c
index 9f68adb60006996793af0998508f579c00d093d0..8313d019308a49a0f045683acf6e8bf9c83f2cc6 100644 (file)
--- a/src/main.c
+++ b/src/main.c
static const guint idle_interval = 500;
-static mpdclient_t *mpd = NULL;
+static struct mpdclient *mpd = NULL;
static gboolean connected = FALSE;
static GMainLoop *main_loop;
static guint reconnect_source_id, idle_source_id, update_source_id;
}
static void
-error_callback(G_GNUC_UNUSED mpdclient_t *c, gint error, const gchar *_msg)
+error_callback(G_GNUC_UNUSED struct mpdclient *c, gint error, const gchar *_msg)
{
char *msg = utf8_to_locale(_msg);
diff --git a/src/mpdclient.c b/src/mpdclient.c
index 86f825fe885c03e9f5f0684543b66744d0cd43db..14e13fc4b03e417ef74bef07cc693a3a5fdf5871 100644 (file)
--- a/src/mpdclient.c
+++ b/src/mpdclient.c
*/
#include "mpdclient.h"
+#include "filelist.h"
#include "screen_utils.h"
#include "config.h"
#include "options.h"
const struct mpd_entity *e1, *e2;
int n = 0;
- e1 = ((const filelist_entry_t *)filelist_entry1)->entity;
- e2 = ((const filelist_entry_t *)filelist_entry2)->entity;
+ e1 = ((const struct filelist_entry *)filelist_entry1)->entity;
+ e2 = ((const struct filelist_entry *)filelist_entry2)->entity;
if (e1 != NULL && e2 != NULL &&
mpd_entity_get_type(e1) == mpd_entity_get_type(e2)) {
char key1[BUFSIZE], key2[BUFSIZE];
int n = 0;
- e1 = ((const filelist_entry_t *)filelist_entry1)->entity;
- e2 = ((const filelist_entry_t *)filelist_entry2)->entity;
+ e1 = ((const struct filelist_entry *)filelist_entry1)->entity;
+ e2 = ((const struct filelist_entry *)filelist_entry2)->entity;
if (e1 && e2 &&
mpd_entity_get_type(e1) == MPD_ENTITY_TYPE_SONG &&
/* Error callbacks */
static gint
-error_cb(mpdclient_t *c, gint error, const gchar *msg)
+error_cb(struct mpdclient *c, gint error, const gchar *msg)
{
GList *list = c->error_callbacks;
/****************************************************************************/
static gint
-mpdclient_handle_error(mpdclient_t *c)
+mpdclient_handle_error(struct mpdclient *c)
{
enum mpd_error error = mpd_connection_get_error(c->connection);
bool is_fatal = error != MPD_ERROR_SERVER;
}
gint
-mpdclient_finish_command(mpdclient_t *c)
+mpdclient_finish_command(struct mpdclient *c)
{
return mpd_response_finish(c->connection)
? 0 : mpdclient_handle_error(c);
}
-mpdclient_t *
+struct mpdclient *
mpdclient_new(void)
{
- mpdclient_t *c;
+ struct mpdclient *c;
- c = g_malloc0(sizeof(mpdclient_t));
+ c = g_new0(struct mpdclient, 1);
playlist_init(&c->playlist);
c->volume = MPD_STATUS_NO_VOLUME;
}
void
-mpdclient_free(mpdclient_t *c)
+mpdclient_free(struct mpdclient *c)
{
mpdclient_disconnect(c);
}
gint
-mpdclient_disconnect(mpdclient_t *c)
+mpdclient_disconnect(struct mpdclient *c)
{
if (c->connection)
mpd_connection_free(c->connection);
}
gint
-mpdclient_connect(mpdclient_t *c,
+mpdclient_connect(struct mpdclient *c,
const gchar *host,
gint port,
gfloat _timeout,
}
gint
-mpdclient_update(mpdclient_t *c)
+mpdclient_update(struct mpdclient *c)
{
gint retval = 0;
/****************************************************************************/
gint
-mpdclient_cmd_play(mpdclient_t *c, gint idx)
+mpdclient_cmd_play(struct mpdclient *c, gint idx)
{
#ifdef ENABLE_SONG_ID
struct mpd_song *song = playlist_get_song(c, idx);
}
gint
-mpdclient_cmd_pause(mpdclient_t *c, gint value)
+mpdclient_cmd_pause(struct mpdclient *c, gint value)
{
if (MPD_ERROR(c))
return -1;
}
gint
-mpdclient_cmd_crop(mpdclient_t *c)
+mpdclient_cmd_crop(struct mpdclient *c)
{
struct mpd_status *status;
bool playing;
}
gint
-mpdclient_cmd_stop(mpdclient_t *c)
+mpdclient_cmd_stop(struct mpdclient *c)
{
if (MPD_ERROR(c))
return -1;
}
gint
-mpdclient_cmd_next(mpdclient_t *c)
+mpdclient_cmd_next(struct mpdclient *c)
{
if (MPD_ERROR(c))
return -1;
}
gint
-mpdclient_cmd_prev(mpdclient_t *c)
+mpdclient_cmd_prev(struct mpdclient *c)
{
if (MPD_ERROR(c))
return -1;
}
gint
-mpdclient_cmd_seek(mpdclient_t *c, gint id, gint pos)
+mpdclient_cmd_seek(struct mpdclient *c, gint id, gint pos)
{
if (MPD_ERROR(c))
return -1;
}
gint
-mpdclient_cmd_shuffle(mpdclient_t *c)
+mpdclient_cmd_shuffle(struct mpdclient *c)
{
if (MPD_ERROR(c))
return -1;
}
gint
-mpdclient_cmd_shuffle_range(mpdclient_t *c, guint start, guint end)
+mpdclient_cmd_shuffle_range(struct mpdclient *c, guint start, guint end)
{
mpd_send_shuffle_range(c->connection, start, end);
c->need_update = TRUE;
}
gint
-mpdclient_cmd_clear(mpdclient_t *c)
+mpdclient_cmd_clear(struct mpdclient *c)
{
gint retval = 0;
}
gint
-mpdclient_cmd_repeat(mpdclient_t *c, gint value)
+mpdclient_cmd_repeat(struct mpdclient *c, gint value)
{
if (MPD_ERROR(c))
return -1;
}
gint
-mpdclient_cmd_random(mpdclient_t *c, gint value)
+mpdclient_cmd_random(struct mpdclient *c, gint value)
{
if (MPD_ERROR(c))
return -1;
}
gint
-mpdclient_cmd_single(mpdclient_t *c, gint value)
+mpdclient_cmd_single(struct mpdclient *c, gint value)
{
if (MPD_ERROR(c))
return -1;
}
gint
-mpdclient_cmd_consume(mpdclient_t *c, gint value)
+mpdclient_cmd_consume(struct mpdclient *c, gint value)
{
if (MPD_ERROR(c))
return -1;
}
gint
-mpdclient_cmd_crossfade(mpdclient_t *c, gint value)
+mpdclient_cmd_crossfade(struct mpdclient *c, gint value)
{
if (MPD_ERROR(c))
return -1;
}
gint
-mpdclient_cmd_db_update(mpdclient_t *c, const gchar *path)
+mpdclient_cmd_db_update(struct mpdclient *c, const gchar *path)
{
gint ret;
}
gint
-mpdclient_cmd_volume(mpdclient_t *c, gint value)
+mpdclient_cmd_volume(struct mpdclient *c, gint value)
{
if (MPD_ERROR(c))
return -1;
}
gint
-mpdclient_cmd_add_path(mpdclient_t *c, const gchar *path_utf8)
+mpdclient_cmd_add_path(struct mpdclient *c, const gchar *path_utf8)
{
if (MPD_ERROR(c))
return -1;
}
gint
-mpdclient_cmd_add(mpdclient_t *c, const struct mpd_song *song)
+mpdclient_cmd_add(struct mpdclient *c, const struct mpd_song *song)
{
gint retval = 0;
}
gint
-mpdclient_cmd_delete(mpdclient_t *c, gint idx)
+mpdclient_cmd_delete(struct mpdclient *c, gint idx)
{
gint retval = 0;
struct mpd_song *song;
}
gint
-mpdclient_cmd_move(mpdclient_t *c, gint old_index, gint new_index)
+mpdclient_cmd_move(struct mpdclient *c, gint old_index, gint new_index)
{
gint n;
struct mpd_song *song1, *song2;
}
gint
-mpdclient_cmd_save_playlist(mpdclient_t *c, const gchar *filename_utf8)
+mpdclient_cmd_save_playlist(struct mpdclient *c, const gchar *filename_utf8)
{
gint retval = 0;
}
gint
-mpdclient_cmd_load_playlist(mpdclient_t *c, const gchar *filename_utf8)
+mpdclient_cmd_load_playlist(struct mpdclient *c, const gchar *filename_utf8)
{
if (MPD_ERROR(c))
return -1;
}
gint
-mpdclient_cmd_delete_playlist(mpdclient_t *c, const gchar *filename_utf8)
+mpdclient_cmd_delete_playlist(struct mpdclient *c, const gchar *filename_utf8)
{
gint retval = 0;
/****************************************************************************/
static void
-do_list_callbacks(mpdclient_t *c, GList *list, gint event, gpointer data)
+do_list_callbacks(struct mpdclient *c, GList *list, gint event, gpointer data)
{
while (list) {
mpdc_list_cb_t fn = list->data;
}
void
-mpdclient_playlist_callback(mpdclient_t *c, int event, gpointer data)
+mpdclient_playlist_callback(struct mpdclient *c, int event, gpointer data)
{
do_list_callbacks(c, c->playlist_callbacks, event, data);
}
void
-mpdclient_install_playlist_callback(mpdclient_t *c,mpdc_list_cb_t cb)
+mpdclient_install_playlist_callback(struct mpdclient *c,mpdc_list_cb_t cb)
{
c->playlist_callbacks = g_list_append(c->playlist_callbacks, cb);
}
void
-mpdclient_remove_playlist_callback(mpdclient_t *c, mpdc_list_cb_t cb)
+mpdclient_remove_playlist_callback(struct mpdclient *c, mpdc_list_cb_t cb)
{
c->playlist_callbacks = g_list_remove(c->playlist_callbacks, cb);
}
void
-mpdclient_browse_callback(mpdclient_t *c, int event, gpointer data)
+mpdclient_browse_callback(struct mpdclient *c, int event, gpointer data)
{
do_list_callbacks(c, c->browse_callbacks, event, data);
}
void
-mpdclient_install_browse_callback(mpdclient_t *c,mpdc_list_cb_t cb)
+mpdclient_install_browse_callback(struct mpdclient *c,mpdc_list_cb_t cb)
{
c->browse_callbacks = g_list_append(c->browse_callbacks, cb);
}
void
-mpdclient_remove_browse_callback(mpdclient_t *c, mpdc_list_cb_t cb)
+mpdclient_remove_browse_callback(struct mpdclient *c, mpdc_list_cb_t cb)
{
c->browse_callbacks = g_list_remove(c->browse_callbacks, cb);
}
void
-mpdclient_install_error_callback(mpdclient_t *c, mpdc_error_cb_t cb)
+mpdclient_install_error_callback(struct mpdclient *c, mpdc_error_cb_t cb)
{
c->error_callbacks = g_list_append(c->error_callbacks, cb);
}
void
-mpdclient_remove_error_callback(mpdclient_t *c, mpdc_error_cb_t cb)
+mpdclient_remove_error_callback(struct mpdclient *c, mpdc_error_cb_t cb)
{
c->error_callbacks = g_list_remove(c->error_callbacks, cb);
}
/* update playlist */
gint
-mpdclient_playlist_update(mpdclient_t *c)
+mpdclient_playlist_update(struct mpdclient *c)
{
struct mpd_entity *entity;
/* update playlist (plchanges) */
gint
-mpdclient_playlist_update_changes(mpdclient_t *c)
+mpdclient_playlist_update_changes(struct mpdclient *c)
{
struct mpd_song *song;
guint length;
#else
gint
-mpdclient_playlist_update_changes(mpdclient_t *c)
+mpdclient_playlist_update_changes(struct mpdclient *c)
{
return mpdclient_playlist_update(c);
}
/*** Filelist functions *****************************************************/
/****************************************************************************/
-mpdclient_filelist_t *
-mpdclient_filelist_get(mpdclient_t *c, const gchar *path)
+struct filelist *
+mpdclient_filelist_get(struct mpdclient *c, const gchar *path)
{
- mpdclient_filelist_t *filelist;
+ struct filelist *filelist;
struct mpd_entity *entity;
if (MPD_ERROR(c))
return filelist;
}
-mpdclient_filelist_t *
-mpdclient_filelist_search(mpdclient_t *c,
+struct filelist *
+mpdclient_filelist_search(struct mpdclient *c,
int exact_match,
enum mpd_tag_type tag,
gchar *filter_utf8)
}
int
-mpdclient_filelist_add_all(mpdclient_t *c, mpdclient_filelist_t *fl)
+mpdclient_filelist_add_all(struct mpdclient *c, struct filelist *fl)
{
guint i;
mpd_command_list_begin(c->connection, false);
for (i = 0; i < filelist_length(fl); ++i) {
- filelist_entry_t *entry = filelist_get(fl, i);
+ struct filelist_entry *entry = filelist_get(fl, i);
struct mpd_entity *entity = entry->entity;
if (entity != NULL &&
}
GList *
-mpdclient_get_artists(mpdclient_t *c)
+mpdclient_get_artists(struct mpdclient *c)
{
GList *list = NULL;
struct mpd_pair *pair;
}
GList *
-mpdclient_get_albums(mpdclient_t *c, const gchar *artist_utf8)
+mpdclient_get_albums(struct mpdclient *c, const gchar *artist_utf8)
{
GList *list = NULL;
struct mpd_pair *pair;
diff --git a/src/mpdclient.h b/src/mpdclient.h
index 82940ab98880e38afba2e7cd12777b5106419f16..e1b747661f493daa6bb5e61d8eec955398f0c3be 100644 (file)
--- a/src/mpdclient.h
+++ b/src/mpdclient.h
#define MPDCLIENT_H
#include "playlist.h"
-#include "filelist.h"
#include <mpd/tag.h>
-typedef struct mpdclient {
+struct filelist;
+
+struct mpdclient {
/* playlist */
- mpdclient_playlist_t playlist;
+ struct mpdclient_playlist playlist;
/* Callbacks */
GList *error_callbacks;
int volume;
unsigned updatingdb;
-} mpdclient_t;
+};
/** functions ***************************************************************/
gint
-mpdclient_finish_command(mpdclient_t *c);
+mpdclient_finish_command(struct mpdclient *c);
+
+struct mpdclient *
+mpdclient_new(void);
-mpdclient_t *mpdclient_new(void);
-void mpdclient_free(mpdclient_t *c);
-gint mpdclient_connect(mpdclient_t *c, const gchar *host, gint port,
+void mpdclient_free(struct mpdclient *c);
+gint mpdclient_connect(struct mpdclient *c, const gchar *host, gint port,
gfloat timeout_, const gchar *password);
-gint mpdclient_disconnect(mpdclient_t *c);
-gint mpdclient_update(mpdclient_t *c);
+gint mpdclient_disconnect(struct mpdclient *c);
+gint mpdclient_update(struct mpdclient *c);
/*** MPD Commands **********************************************************/
-gint mpdclient_cmd_play(mpdclient_t *c, gint index);
-gint mpdclient_cmd_pause(mpdclient_t *c, gint value);
+gint mpdclient_cmd_play(struct mpdclient *c, gint index);
+gint mpdclient_cmd_pause(struct mpdclient *c, gint value);
gint
-mpdclient_cmd_crop(mpdclient_t *c);
-gint mpdclient_cmd_stop(mpdclient_t *c);
-gint mpdclient_cmd_next(mpdclient_t *c);
-gint mpdclient_cmd_prev(mpdclient_t *c);
-gint mpdclient_cmd_seek(mpdclient_t *c, gint id, gint pos);
-gint mpdclient_cmd_shuffle(mpdclient_t *c);
-gint mpdclient_cmd_shuffle_range(mpdclient_t *c, guint start, guint end);
-gint mpdclient_cmd_clear(mpdclient_t *c);
-gint mpdclient_cmd_repeat(mpdclient_t *c, gint value);
-gint mpdclient_cmd_random(mpdclient_t *c, gint value);
-gint mpdclient_cmd_single(mpdclient_t *c, gint value);
-gint mpdclient_cmd_consume(mpdclient_t *c, gint value);
-gint mpdclient_cmd_crossfade(mpdclient_t *c, gint value);
-gint mpdclient_cmd_db_update(mpdclient_t *c, const gchar *path);
-gint mpdclient_cmd_volume(mpdclient_t *c, gint value);
+mpdclient_cmd_crop(struct mpdclient *c);
+gint mpdclient_cmd_stop(struct mpdclient *c);
+gint mpdclient_cmd_next(struct mpdclient *c);
+gint mpdclient_cmd_prev(struct mpdclient *c);
+gint mpdclient_cmd_seek(struct mpdclient *c, gint id, gint pos);
+gint mpdclient_cmd_shuffle(struct mpdclient *c);
+gint mpdclient_cmd_shuffle_range(struct mpdclient *c, guint start, guint end);
+gint mpdclient_cmd_clear(struct mpdclient *c);
+gint mpdclient_cmd_repeat(struct mpdclient *c, gint value);
+gint mpdclient_cmd_random(struct mpdclient *c, gint value);
+gint mpdclient_cmd_single(struct mpdclient *c, gint value);
+gint mpdclient_cmd_consume(struct mpdclient *c, gint value);
+gint mpdclient_cmd_crossfade(struct mpdclient *c, gint value);
+gint mpdclient_cmd_db_update(struct mpdclient *c, const gchar *path);
+gint mpdclient_cmd_volume(struct mpdclient *c, gint value);
gint mpdclient_cmd_volume_up(struct mpdclient *c);
gint mpdclient_cmd_volume_down(struct mpdclient *c);
-gint mpdclient_cmd_add_path(mpdclient_t *c, const gchar *path);
+gint mpdclient_cmd_add_path(struct mpdclient *c, const gchar *path);
-gint mpdclient_cmd_add(mpdclient_t *c, const struct mpd_song *song);
-gint mpdclient_cmd_delete(mpdclient_t *c, gint index);
-gint mpdclient_cmd_move(mpdclient_t *c, gint old_index, gint new_index);
+gint mpdclient_cmd_add(struct mpdclient *c, const struct mpd_song *song);
+gint mpdclient_cmd_delete(struct mpdclient *c, gint index);
+gint mpdclient_cmd_move(struct mpdclient *c, gint old_index, gint new_index);
-gint mpdclient_cmd_save_playlist(mpdclient_t *c, const gchar *filename);
-gint mpdclient_cmd_load_playlist(mpdclient_t *c, const gchar *filename_utf8);
-gint mpdclient_cmd_delete_playlist(mpdclient_t *c, const gchar *filename_utf8);
+gint mpdclient_cmd_save_playlist(struct mpdclient *c, const gchar *filename);
+gint mpdclient_cmd_load_playlist(struct mpdclient *c, const gchar *filename_utf8);
+gint mpdclient_cmd_delete_playlist(struct mpdclient *c, const gchar *filename_utf8);
/* list functions */
-GList *mpdclient_get_artists(mpdclient_t *c);
-GList *mpdclient_get_albums(mpdclient_t *c, const gchar *artist_utf8);
+GList *mpdclient_get_artists(struct mpdclient *c);
+GList *mpdclient_get_albums(struct mpdclient *c, const gchar *artist_utf8);
/*** error callbacks *****************************************************/
#define IS_ACK_ERROR(n) (n & MPD_ERROR_ACK)
#define GET_ACK_ERROR_CODE(n) ((n & 0xFF00) >> 8)
-typedef void (*mpdc_error_cb_t) (mpdclient_t *c, gint error, const gchar *msg);
+typedef void (*mpdc_error_cb_t) (struct mpdclient *c, gint error, const gchar *msg);
-void mpdclient_install_error_callback(mpdclient_t *c, mpdc_error_cb_t cb);
-void mpdclient_remove_error_callback(mpdclient_t *c, mpdc_error_cb_t cb);
+void mpdclient_install_error_callback(struct mpdclient *c, mpdc_error_cb_t cb);
+void mpdclient_remove_error_callback(struct mpdclient *c, mpdc_error_cb_t cb);
/*** playlist functions **************************************************/
#define PLAYLIST_EVENT_MOVE 0x05
-typedef void (*mpdc_list_cb_t) (mpdclient_t *c, int event, gpointer data);
+typedef void (*mpdc_list_cb_t) (struct mpdclient *c, int event, gpointer data);
/* install a playlist callback function */
-void mpdclient_install_playlist_callback(mpdclient_t *c, mpdc_list_cb_t cb);
+void mpdclient_install_playlist_callback(struct mpdclient *c, mpdc_list_cb_t cb);
/* remove a playlist callback function */
-void mpdclient_remove_playlist_callback(mpdclient_t *c, mpdc_list_cb_t cb);
+void mpdclient_remove_playlist_callback(struct mpdclient *c, mpdc_list_cb_t cb);
/* issue a playlist callback */
-void mpdclient_playlist_callback(mpdclient_t *c, int event, gpointer data);
+void mpdclient_playlist_callback(struct mpdclient *c, int event, gpointer data);
/*** filelist functions ***************************************************/
-mpdclient_filelist_t *mpdclient_filelist_get(mpdclient_t *c, const gchar *path);
-mpdclient_filelist_t *mpdclient_filelist_search(mpdclient_t *c,
- int exact_match,
- enum mpd_tag_type tag,
- gchar *filter_utf8);
+struct filelist *
+mpdclient_filelist_get(struct mpdclient *c, const gchar *path);
+
+struct filelist *
+mpdclient_filelist_search(struct mpdclient *c, int exact_match,
+ enum mpd_tag_type tag,
+ gchar *filter_utf8);
/* add all songs in filelist to the playlist */
-int mpdclient_filelist_add_all(mpdclient_t *c, mpdclient_filelist_t *fl);
+int
+mpdclient_filelist_add_all(struct mpdclient *c, struct filelist *fl);
/*** mpdclient browse callbacks ********************************************/
/* install a playlist callback function */
-void mpdclient_install_browse_callback(mpdclient_t *c, mpdc_list_cb_t cb);
+void mpdclient_install_browse_callback(struct mpdclient *c, mpdc_list_cb_t cb);
/* remove a playlist callback function */
-void mpdclient_remove_browse_callback(mpdclient_t *c, mpdc_list_cb_t cb);
+void mpdclient_remove_browse_callback(struct mpdclient *c, mpdc_list_cb_t cb);
/* issue a playlist callback */
-void mpdclient_browse_callback(mpdclient_t *c, int event, gpointer data);
+void mpdclient_browse_callback(struct mpdclient *c, int event, gpointer data);
/* sort by list-format */
gint compare_filelistentry_format(gconstpointer filelist_entry1, gconstpointer filelist_entry2);
diff --git a/src/playlist.c b/src/playlist.c
index 564cee6b727d82d7be851b77950a7dc3703b2952..38a39abadc594f7293bb60fab3cef765ac2e864b 100644 (file)
--- a/src/playlist.c
+++ b/src/playlist.c
}
gint
-mpdclient_playlist_free(mpdclient_playlist_t *playlist)
+mpdclient_playlist_free(struct mpdclient_playlist *playlist)
{
if (playlist->list != NULL) {
playlist_clear(playlist);
g_ptr_array_free(playlist->list, TRUE);
}
- memset(playlist, 0, sizeof(mpdclient_playlist_t));
+ memset(playlist, 0, sizeof(*playlist));
return 0;
}
struct mpd_song *
-playlist_get_song(mpdclient_t *c, gint idx)
+playlist_get_song(struct mpdclient *c, gint idx)
{
if (idx < 0 || (guint)idx >= c->playlist.list->len)
return NULL;
}
struct mpd_song *
-playlist_lookup_song(mpdclient_t *c, unsigned id)
+playlist_lookup_song(struct mpdclient *c, unsigned id)
{
guint i;
diff --git a/src/playlist.h b/src/playlist.h
index f56daa38453b7c7d45543f7eb8f6b4a6005d1899..b94893681aff5af70b7586fabdd452577d05cc04 100644 (file)
--- a/src/playlist.h
+++ b/src/playlist.h
struct mpdclient;
-typedef struct mpdclient_playlist {
+struct mpdclient_playlist {
/* playlist id */
unsigned id;
/* the list */
GPtrArray *list;
-} mpdclient_playlist_t;
+};
void
playlist_init(struct mpdclient_playlist *playlist);
playlist_clear(struct mpdclient_playlist *playlist);
/* free a playlist */
-gint mpdclient_playlist_free(mpdclient_playlist_t *playlist);
+gint
+mpdclient_playlist_free(struct mpdclient_playlist *playlist);
static inline guint
playlist_length(const struct mpdclient_playlist *playlist)
diff --git a/src/screen.c b/src/screen.c
index 255cacd5393bb2a7e40918781b4511d185cda330..1e6d87b4e790153465a78e2707dd77d8092e8ef1 100644 (file)
--- a/src/screen.c
+++ b/src/screen.c
}
static void
-screen_next_mode(mpdclient_t *c, int offset)
+screen_next_mode(struct mpdclient *c, int offset)
{
int max = g_strv_length(options.screen_list);
int current, next;
}
static void
-paint_top_window2(const char *header, mpdclient_t *c)
+paint_top_window2(const char *header, struct mpdclient *c)
{
int volume;
char flags[5];
}
static void
-paint_top_window(const char *header, mpdclient_t *c, int full_repaint)
+paint_top_window(const char *header, struct mpdclient *c, int full_repaint)
{
static int prev_volume = -1;
static unsigned prev_header_len = -1;
}
static void
-paint_progress_window(mpdclient_t *c)
+paint_progress_window(struct mpdclient *c)
{
double p;
int width;
}
static void
-paint_status_window(mpdclient_t *c)
+paint_status_window(struct mpdclient *c)
{
WINDOW *w = screen.status_window.w;
const struct mpd_status *status = c->status;
}
void
-screen_init(mpdclient_t *c)
+screen_init(struct mpdclient *c)
{
if (COLS < SCREEN_MIN_COLS || LINES < SCREEN_MIN_ROWS) {
fprintf(stderr, "%s\n", _("Error: Screen too small"));
}
void
-screen_paint(mpdclient_t *c)
+screen_paint(struct mpdclient *c)
{
const char *title = NULL;
}
void
-screen_update(mpdclient_t *c)
+screen_update(struct mpdclient *c)
{
#ifndef NCMPC_MINI
static bool initialized = false;
}
void
-screen_idle(mpdclient_t *c)
+screen_idle(struct mpdclient *c)
{
if (c->song != NULL && seek_id == (int)mpd_song_get_id(c->song) &&
(screen.last_cmd == CMD_SEEK_FORWARD ||
#ifdef HAVE_GETMOUSE
int
-screen_get_mouse_event(mpdclient_t *c, unsigned long *bstate, int *row)
+screen_get_mouse_event(struct mpdclient *c, unsigned long *bstate, int *row)
{
MEVENT event;
#endif
static int
-screen_client_cmd(mpdclient_t *c, command_t cmd)
+screen_client_cmd(struct mpdclient *c, command_t cmd)
{
if (c->connection == NULL || c->status == NULL)
return 0;
}
void
-screen_cmd(mpdclient_t *c, command_t cmd)
+screen_cmd(struct mpdclient *c, command_t cmd)
{
screen.last_cmd = cmd;
#ifndef NCMPC_MINI
diff --git a/src/screen.h b/src/screen.h
index fb2bc30abbac95c4e2f278ce8abca32ffc643963..b22eae455d93c194129c98ccdcaa2eba3374221b 100644 (file)
--- a/src/screen.h
+++ b/src/screen.h
#define SCREEN_H
#include "config.h"
-#include "mpdclient.h"
#include "command.h"
#include <mpd/client.h>
#define MAX_SONGNAME_LENGTH 512
+struct mpdclient;
+
struct window {
WINDOW *w;
unsigned rows, cols;
typedef struct screen_functions {
void (*init)(WINDOW *w, int cols, int rows);
void (*exit)(void);
- void (*open)(mpdclient_t *c);
+ void (*open)(struct mpdclient *c);
void (*close)(void);
void (*resize)(int cols, int rows);
void (*paint)(void);
- void (*update)(mpdclient_t *c);
- bool (*cmd)(mpdclient_t *c, command_t cmd);
+ void (*update)(struct mpdclient *c);
+ bool (*cmd)(struct mpdclient *c, command_t cmd);
const char *(*get_title)(char *s, size_t size);
} screen_functions_t;
-void screen_init(mpdclient_t *c);
+void screen_init(struct mpdclient *c);
void screen_exit(void);
void screen_resize(struct mpdclient *c);
void screen_status_message(const char *msg);
void screen_status_printf(const char *format, ...);
char *screen_error(void);
-void screen_paint(mpdclient_t *c);
-void screen_update(mpdclient_t *c);
-void screen_idle(mpdclient_t *c);
-void screen_cmd(mpdclient_t *c, command_t cmd);
+void screen_paint(struct mpdclient *c);
+void screen_update(struct mpdclient *c);
+void screen_idle(struct mpdclient *c);
+void screen_cmd(struct mpdclient *c, command_t cmd);
gint screen_get_id(const char *name);
void
gboolean
screen_is_visible(const struct screen_functions *sf);
-int screen_get_mouse_event(mpdclient_t *c, unsigned long *bstate, int *row);
+int
+screen_get_mouse_event(struct mpdclient *c, unsigned long *bstate, int *row);
bool
screen_file_goto_song(struct mpdclient *c, const struct mpd_song *song);
diff --git a/src/screen_artist.c b/src/screen_artist.c
index f6de9dde00621d6dbe9b697aeac481e01ebfd4c4..03d7155b4366aa5ee7b671496d5ed057a9613257 100644 (file)
--- a/src/screen_artist.c
+++ b/src/screen_artist.c
#include "screen.h"
#include "screen_utils.h"
#include "screen_browser.h"
+#include "filelist.h"
#include <ctype.h>
#include <stdlib.h>
#ifndef NCMPC_MINI
/* the playlist has been updated -> fix highlights */
static void
-playlist_changed_callback(mpdclient_t *c, int event, gpointer data)
+playlist_changed_callback(struct mpdclient *c, int event, gpointer data)
{
browser_playlist_changed(&browser, c, event, data);
/* db updated */
static void
-browse_callback(mpdclient_t *c, int event, G_GNUC_UNUSED gpointer data)
+browse_callback(struct mpdclient *c, int event, G_GNUC_UNUSED gpointer data)
{
switch(event) {
case BROWSE_DB_UPDATED:
}
static void
-open(mpdclient_t *c)
+open(struct mpdclient *c)
{
static gboolean callback_installed = FALSE;
}
static void
-add_query(mpdclient_t *c, enum mpd_tag_type table, char *_filter)
+add_query(struct mpdclient *c, enum mpd_tag_type table, char *_filter)
{
char *str;
- mpdclient_filelist_t *addlist;
+ struct filelist *addlist;
assert(filter != NULL);
}
static bool
-artist_cmd(mpdclient_t *c, command_t cmd)
+artist_cmd(struct mpdclient *c, command_t cmd)
{
char *selected;
char *old;
diff --git a/src/screen_browser.c b/src/screen_browser.c
index c8f705b13f9b78b8178c7b575abbb131568ff6ca..efa2a387de144d43df5f94e1681a75cb51005ec5 100644 (file)
--- a/src/screen_browser.c
+++ b/src/screen_browser.c
#include "charset.h"
#include "strfsong.h"
#include "screen_utils.h"
+#include "mpdclient.h"
+#include "filelist.h"
#include <mpd/client.h>
/* clear the highlight flag for all items in the filelist */
static void
-clear_highlights(mpdclient_filelist_t *fl)
+clear_highlights(struct filelist *fl)
{
guint i;
/* change the highlight flag for a song */
static void
-set_highlight(mpdclient_filelist_t *fl, struct mpd_song *song, int highlight)
+set_highlight(struct filelist *fl, struct mpd_song *song, int highlight)
{
int i = filelist_find_song(fl, song);
struct filelist_entry *entry;
/* sync highlight flags with playlist */
void
-sync_highlights(mpdclient_t *c, mpdclient_filelist_t *fl)
+sync_highlights(struct mpdclient *c, struct filelist *fl)
{
guint i;
/* the playlist has been updated -> fix highlights */
void
-browser_playlist_changed(struct screen_browser *browser, mpdclient_t *c,
+browser_playlist_changed(struct screen_browser *browser, struct mpdclient *c,
int event, gpointer data)
{
if (browser->filelist == NULL)
const char *
browser_lw_callback(unsigned idx, bool *highlight, G_GNUC_UNUSED char **second_column, void *data)
{
+ struct filelist *fl = (struct filelist *) data;
static char buf[BUFSIZE];
- mpdclient_filelist_t *fl = (mpdclient_filelist_t *) data;
- filelist_entry_t *entry;
+ struct filelist_entry *entry;
struct mpd_entity *entity;
if (fl == NULL || idx >= filelist_length(fl))
@@ -170,7 +172,7 @@ browser_lw_callback(unsigned idx, bool *highlight, G_GNUC_UNUSED char **second_c
}
static bool
-load_playlist(mpdclient_t *c, const struct mpd_playlist *playlist)
+load_playlist(struct mpdclient *c, const struct mpd_playlist *playlist)
{
char *filename = utf8_to_locale(mpd_playlist_get_path(playlist));
}
static bool
-enqueue_and_play(mpdclient_t *c, filelist_entry_t *entry)
+enqueue_and_play(struct mpdclient *c, struct filelist_entry *entry)
{
int idx;
const struct mpd_song *song = mpd_entity_get_song(entry->entity);
}
static bool
-browser_handle_enter(struct screen_browser *browser, mpdclient_t *c)
+browser_handle_enter(struct screen_browser *browser, struct mpdclient *c)
{
struct filelist_entry *entry = browser_get_selected_entry(browser);
struct mpd_entity *entity;
}
static bool
-browser_select_entry(mpdclient_t *c, filelist_entry_t *entry,
+browser_select_entry(struct mpdclient *c, struct filelist_entry *entry,
G_GNUC_UNUSED gboolean toggle)
{
assert(entry != NULL);
}
static bool
-browser_handle_select(struct screen_browser *browser, mpdclient_t *c)
+browser_handle_select(struct screen_browser *browser, struct mpdclient *c)
{
struct filelist_entry *entry;
}
static bool
-browser_handle_add(struct screen_browser *browser, mpdclient_t *c)
+browser_handle_add(struct screen_browser *browser, struct mpdclient *c)
{
struct filelist_entry *entry;
}
static void
-browser_handle_select_all(struct screen_browser *browser, mpdclient_t *c)
+browser_handle_select_all(struct screen_browser *browser, struct mpdclient *c)
{
guint i;
#ifdef HAVE_GETMOUSE
static int
-browser_handle_mouse_event(struct screen_browser *browser, mpdclient_t *c)
+browser_handle_mouse_event(struct screen_browser *browser, struct mpdclient *c)
{
int row;
unsigned prev_selected = browser->lw->selected;
diff --git a/src/screen_browser.h b/src/screen_browser.h
index 093ece7cf30dab942db30c78f3734c8e4125b740..44d1d66b71b6434f0b13543fa490bc455952aeb4 100644 (file)
--- a/src/screen_browser.h
+++ b/src/screen_browser.h
#define SCREEN_BROWSER_H
#include "screen.h"
-#include "mpdclient.h"
#include "config.h"
#include <stdbool.h>
+struct mpdclient;
+struct filelist;
struct list_window;
struct list_window_state;
struct screen_browser {
struct list_window *lw;
- mpdclient_filelist_t *filelist;
+ struct filelist *filelist;
};
#ifndef NCMPC_MINI
void
-sync_highlights(mpdclient_t *c, mpdclient_filelist_t *fl);
+sync_highlights(struct mpdclient *c, struct filelist *fl);
void
-browser_playlist_changed(struct screen_browser *browser, mpdclient_t *c,
+browser_playlist_changed(struct screen_browser *browser, struct mpdclient *c,
int event, gpointer data);
#endif
diff --git a/src/screen_file.c b/src/screen_file.c
index c69b7d512d0ad6f327c1250d95cb035e0ce3847b..ed3d26a2610bba51ed1364fab640da84792566e1 100644 (file)
--- a/src/screen_file.c
+++ b/src/screen_file.c
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+
#include "config.h"
#include "i18n.h"
#include "options.h"
#include "charset.h"
#include "mpdclient.h"
+#include "filelist.h"
#include "command.h"
#include "screen.h"
#include "screen_utils.h"
/* the db has changed -> update the filelist */
static void
-file_changed_callback(mpdclient_t *c, G_GNUC_UNUSED int event,
+file_changed_callback(struct mpdclient *c, G_GNUC_UNUSED int event,
G_GNUC_UNUSED gpointer data)
{
file_reload(c);
#ifndef NCMPC_MINI
/* the playlist has been updated -> fix highlights */
static void
-playlist_changed_callback(mpdclient_t *c, int event, gpointer data)
+playlist_changed_callback(struct mpdclient *c, int event, gpointer data)
{
browser_playlist_changed(&browser, c, event, data);
* Change to the specified absolute directory.
*/
static bool
-file_change_directory(mpdclient_t *c, const char *new_path)
+file_change_directory(struct mpdclient *c, const char *new_path)
{
g_free(current_path);
current_path = g_strdup(new_path);
* Change to the parent directory of the current directory.
*/
static bool
-file_change_to_parent(mpdclient_t *c)
+file_change_to_parent(struct mpdclient *c)
{
char *parent = g_path_get_dirname(current_path);
char *old_path;
}
/**
- * Change to the directory referred by the specified filelist_entry_t
+ * Change to the directory referred by the specified #filelist_entry
* object.
*/
static bool
-file_change_to_entry(mpdclient_t *c, const filelist_entry_t *entry)
+file_change_to_entry(struct mpdclient *c, const struct filelist_entry *entry)
{
assert(entry != NULL);
}
static int
-handle_save(mpdclient_t *c)
+handle_save(struct mpdclient *c)
{
- filelist_entry_t *entry;
+ struct filelist_entry *entry;
const char *defaultname = NULL;
char *defaultname_utf8 = NULL;
int ret;
}
static int
-handle_delete(mpdclient_t *c)
+handle_delete(struct mpdclient *c)
{
- filelist_entry_t *entry;
+ struct filelist_entry *entry;
struct mpd_entity *entity;
const struct mpd_playlist *playlist;
char *str, *buf;
}
static void
-browse_open(G_GNUC_UNUSED mpdclient_t *c)
+browse_open(G_GNUC_UNUSED struct mpdclient *c)
{
if (browser.filelist == NULL) {
browser.filelist = mpdclient_filelist_get(c, "");
}
static bool
-browse_cmd(mpdclient_t *c, command_t cmd)
+browse_cmd(struct mpdclient *c, command_t cmd)
{
switch(cmd) {
case CMD_PLAY:
diff --git a/src/screen_help.c b/src/screen_help.c
index 81b479fefbce01b26e879b237ae081edcc0202eb..59ea8a230feba3fd0b3c8096ecedd4a2a3e81420 100644 (file)
--- a/src/screen_help.c
+++ b/src/screen_help.c
}
static bool
-help_cmd(G_GNUC_UNUSED mpdclient_t *c, command_t cmd)
+help_cmd(G_GNUC_UNUSED struct mpdclient *c, command_t cmd)
{
if (list_window_scroll_cmd(lw, help_text_rows, cmd)) {
list_window_paint(lw, list_callback, NULL);
diff --git a/src/screen_keydef.c b/src/screen_keydef.c
index d1dce2314feb85b837e3e1a9173b4fdfb9798b88..16cc95710585982a1cc6636b01da382e9069e47b 100644 (file)
--- a/src/screen_keydef.c
+++ b/src/screen_keydef.c
}
static void
-keydef_open(G_GNUC_UNUSED mpdclient_t *c)
+keydef_open(G_GNUC_UNUSED struct mpdclient *c)
{
if (cmds == NULL) {
command_definition_t *current_cmds = get_command_definitions();
}
static bool
-keydef_cmd(G_GNUC_UNUSED mpdclient_t *c, command_t cmd)
+keydef_cmd(G_GNUC_UNUSED struct mpdclient *c, command_t cmd)
{
int length = LIST_LENGTH();
diff --git a/src/screen_lyrics.c b/src/screen_lyrics.c
index 5714258dbc3d7f5d8958d2edd951188e9befda2c..f9fdb81b643f76cab222c7a4d72b4005d9e483cc 100644 (file)
--- a/src/screen_lyrics.c
+++ b/src/screen_lyrics.c
}
static void
-lyrics_open(mpdclient_t *c)
+lyrics_open(struct mpdclient *c)
{
if (next_song == NULL)
next_song = c->song;
}
static void
-lyrics_update(mpdclient_t *c)
+lyrics_update(struct mpdclient *c)
{
if (!follow)
return;
}
static bool
-lyrics_cmd(mpdclient_t *c, command_t cmd)
+lyrics_cmd(struct mpdclient *c, command_t cmd)
{
if (screen_text_cmd(&text, c, cmd))
return true;
diff --git a/src/screen_outputs.c b/src/screen_outputs.c
index 43b95e319c5937e39e54dc438761b300c21be3fb..ac41c0968556d7772b2e127740491bfa64a67b5d 100644 (file)
--- a/src/screen_outputs.c
+++ b/src/screen_outputs.c
#include "i18n.h"
#include "screen.h"
#include "list_window.h"
+#include "mpdclient.h"
#include <mpd/client.h>
#include <glib.h>
+#include <assert.h>
static list_window_t *lw = NULL;
}
static int
-toggle_output(mpdclient_t *c, unsigned int output_index)
+toggle_output(struct mpdclient *c, unsigned int output_index)
{
int return_value;
struct mpd_output *output;
}
static void
-fill_outputs_list(mpdclient_t *c)
+fill_outputs_list(struct mpdclient *c)
{
struct mpd_output *output;
}
static void
-outputs_open(mpdclient_t *c)
+outputs_open(struct mpdclient *c)
{
fill_outputs_list(c);
}
}
static bool
-outputs_cmd(mpdclient_t *c, command_t cmd)
+outputs_cmd(struct mpdclient *c, command_t cmd)
{
assert(mpd_outputs != NULL);
diff --git a/src/screen_play.c b/src/screen_play.c
index 51835a10e678013cbf592bb9522d3678f4cd37e1..fb5e82b1d3dddad4f48471dcc8e819a636bda7a9 100644 (file)
--- a/src/screen_play.c
+++ b/src/screen_play.c
{
GList **list;
GList **dir_list;
- mpdclient_t *c;
+ struct mpdclient *c;
} completion_callback_data_t;
#endif
}
static void
-playlist_changed_callback(mpdclient_t *c, int event, gpointer data)
+playlist_changed_callback(struct mpdclient *c, int event, gpointer data)
{
switch (event) {
case PLAYLIST_EVENT_DELETE:
@@ -162,7 +162,7 @@ list_callback(unsigned idx, bool *highlight, char **second_column, G_GNUC_UNUSED
}
static void
-center_playing_item(mpdclient_t *c, bool center_cursor)
+center_playing_item(struct mpdclient *c, bool center_cursor)
{
unsigned length = c->playlist.list->len;
int idx;
{
completion_callback_data_t *tmp = (completion_callback_data_t *)data;
GList **list = tmp->list;
- mpdclient_t *c = tmp->c;
+ struct mpdclient *c = tmp->c;
if( *list == NULL ) {
/* create completion list */
#endif
int
-playlist_save(mpdclient_t *c, char *name, char *defaultname)
+playlist_save(struct mpdclient *c, char *name, char *defaultname)
{
gchar *filename, *filename_utf8;
gint error;
#ifndef NCMPC_MINI
static void add_dir(GCompletion *gcmp, gchar *dir, GList **dir_list,
- GList **list, mpdclient_t *c)
+ GList **list, struct mpdclient *c)
{
g_completion_remove_items(gcmp, *list);
*list = string_list_remove(*list, dir);
completion_callback_data_t *tmp = (completion_callback_data_t *)data;
GList **dir_list = tmp->dir_list;
GList **list = tmp->list;
- mpdclient_t *c = tmp->c;
+ struct mpdclient *c = tmp->c;
if (*list == NULL) {
/* create initial list */
completion_callback_data_t *tmp = (completion_callback_data_t *)data;
GList **dir_list = tmp->dir_list;
GList **list = tmp->list;
- mpdclient_t *c = tmp->c;
+ struct mpdclient *c = tmp->c;
if (g_list_length(items) >= 1)
screen_display_completion_list(items);
#endif
static int
-handle_add_to_playlist(mpdclient_t *c)
+handle_add_to_playlist(struct mpdclient *c)
{
gchar *path;
#ifndef NCMPC_MINI
}
static void
-play_open(mpdclient_t *c)
+play_open(struct mpdclient *c)
{
static gboolean install_cb = TRUE;
}
static void
-play_update(mpdclient_t *c)
+play_update(struct mpdclient *c)
{
static int prev_song_id = -1;
#endif
static bool
-play_cmd(mpdclient_t *c, command_t cmd)
+play_cmd(struct mpdclient *c, command_t cmd)
{
static command_t cached_cmd = CMD_NONE;
command_t prev_cmd = cached_cmd;
diff --git a/src/screen_play.h b/src/screen_play.h
index cf76509a9e202df8a009b822d34087257c72fdb7..3cccfb8a7da9b0c6ec7a25e9732821dba686a568 100644 (file)
--- a/src/screen_play.h
+++ b/src/screen_play.h
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-int playlist_save(mpdclient_t *c, char *name, char *defaultname);
+int
+playlist_save(struct mpdclient *c, char *name, char *defaultname);
diff --git a/src/screen_search.c b/src/screen_search.c
index ff78082c7f0c3140216966b95379812f2c35b08b..9ab9a3f716f6be9e6ccb03bb43e62d931aac2791 100644 (file)
--- a/src/screen_search.c
+++ b/src/screen_search.c
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+
#include "i18n.h"
#include "options.h"
#include "charset.h"
#include "utils.h"
#include "screen_utils.h"
#include "screen_browser.h"
+#include "filelist.h"
#include <ctype.h>
#include <stdlib.h>
/* the playlist has been updated -> fix highlights */
static void
-playlist_changed_callback(mpdclient_t *c, int event, gpointer data)
+playlist_changed_callback(struct mpdclient *c, int event, gpointer data)
{
browser_playlist_changed(&browser, c, event, data);
search_repaint_if_active();
}
static void
-search_clear(mpdclient_t *c,
+search_clear(struct mpdclient *c,
gboolean clear_pattern)
{
if (browser.filelist) {
}
}
-static mpdclient_filelist_t *
-filelist_search(mpdclient_t *c, G_GNUC_UNUSED int exact_match, int table,
+static struct filelist *
+filelist_search(struct mpdclient *c, G_GNUC_UNUSED int exact_match, int table,
gchar *local_pattern)
{
- mpdclient_filelist_t *list, *list2;
+ struct filelist *list, *list2;
gchar *filter_utf8 = locale_to_utf8(local_pattern);
if (table == SEARCH_ARTIST_TITLE) {
* Its ugly and MUST be redesigned before the next release!
*-----------------------------------------------------------------------
*/
-static mpdclient_filelist_t *
-search_advanced_query(char *query, mpdclient_t *c)
+static struct filelist *
+search_advanced_query(char *query, struct mpdclient *c)
{
int i,j;
char **strv;
int table[10];
char *arg[10];
- mpdclient_filelist_t *fl = NULL;
+ struct filelist *fl = NULL;
advanced_search_mode = FALSE;
if( g_strrstr(query, ":") == NULL )
}
static void
-search_new(mpdclient_t *c)
+search_new(struct mpdclient *c)
{
if (c->connection == NULL)
return;
}
static void
-open(G_GNUC_UNUSED mpdclient_t *c)
+open(G_GNUC_UNUSED struct mpdclient *c)
{
// if( pattern==NULL )
// search_new(screen, c);
}
static bool
-search_cmd(mpdclient_t *c, command_t cmd)
+search_cmd(struct mpdclient *c, command_t cmd)
{
switch (cmd) {
case CMD_SEARCH_MODE:
diff --git a/src/screen_song.c b/src/screen_song.c
index 8ded35617771e8f74c895e81c4fe968d20c26d4e..fc4664840866d828eb81d9c28abab3d2122f1782 100644 (file)
--- a/src/screen_song.c
+++ b/src/screen_song.c
#include "screen_utils.h"
#include "charset.h"
#include "utils.h"
+#include "mpdclient.h"
#include <mpd/client.h>
#include <glib/gprintf.h>
+#include <assert.h>
#include <string.h>
static list_window_t *lw;
}
static void
-screen_song_add_song(const struct mpd_song *song, const mpdclient_t *c)
+screen_song_add_song(const struct mpd_song *song, const struct mpdclient *c)
{
unsigned i, max_label_width;
enum label {
}
static void
-screen_song_add_stats(const mpdclient_t *c)
+screen_song_add_stats(const struct mpdclient *c)
{
unsigned i, max_label_width;
char buf[64];
}
static void
-screen_song_update(mpdclient_t *c)
+screen_song_update(struct mpdclient *c)
{
/* Clear all lines */
for (guint i = 0; i < current.lines->len; ++i)
}
static bool
-screen_song_cmd(mpdclient_t *c, command_t cmd)
+screen_song_cmd(struct mpdclient *c, command_t cmd)
{
if (list_window_scroll_cmd(lw, current.lines->len, cmd)) {
screen_song_repaint();
};
void
-screen_song_switch(mpdclient_t *c, const struct mpd_song *song)
+screen_song_switch(struct mpdclient *c, const struct mpd_song *song)
{
assert(song != NULL);
assert(current.selected_song == NULL);
diff --git a/src/utils.c b/src/utils.c
index 23408f2f2910b5f78f3e4d6eba7c518d1152d186..41ba2a541375ae07a6fb12fc5b9d9d4f7eb4c40d 100644 (file)
--- a/src/utils.c
+++ b/src/utils.c
#include "options.h"
#include "charset.h"
#include "i18n.h"
+#include "mpdclient.h"
+#include "filelist.h"
#include <ctype.h>
#include <stdlib.h>
/* create a list suitable for GCompletion from path */
GList *
-gcmp_list_from_path(mpdclient_t *c, const gchar *path, GList *list, gint types)
+gcmp_list_from_path(struct mpdclient *c, const gchar *path,
+ GList *list, gint types)
{
guint i;
- mpdclient_filelist_t *filelist;
+ struct filelist *filelist;
if ((filelist = mpdclient_filelist_get(c, path)) == NULL)
return list;
diff --git a/src/utils.h b/src/utils.h
index 20077f0b231a7a1e4881180fa058dbbbf6416d5a..40856800c08fe028f98616e86397c89eb9cc2061 100644 (file)
--- a/src/utils.h
+++ b/src/utils.h
#ifndef UTILS_H
#define UTILS_H
-#include "mpdclient.h"
-
#include <glib.h>
+struct mpdclient;
+
/* functions for lists containing strings */
GList *string_list_free(GList *string_list);
GList *string_list_find(GList *string_list, const gchar *str);
#define GCMP_TYPE_RFILE (GCMP_TYPE_DIR | GCMP_TYPE_FILE)
#define GCMP_TYPE_RPLAYLIST (GCMP_TYPE_DIR | GCMP_TYPE_PLAYLIST)
-GList *gcmp_list_from_path(mpdclient_t *c,
- const gchar *path,
- GList *list,
- gint types);
+GList *
+gcmp_list_from_path(struct mpdclient *c, const gchar *path,
+ GList *list, gint types);
char *
time_seconds_to_durationstr(unsigned long time_seconds);