summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b840385)
raw | patch | inline | side by side (parent: b840385)
author | Max Kellermann <max.kellermann@gmail.com> | |
Fri, 17 Mar 2017 21:26:37 +0000 (22:26 +0100) | ||
committer | Max Kellermann <max.kellermann@gmail.com> | |
Fri, 17 Mar 2017 21:41:29 +0000 (22:41 +0100) |
src/callbacks.h | patch | blob | history | |
src/main.c | patch | blob | history | |
src/mpdclient.c | patch | blob | history |
diff --git a/src/callbacks.h b/src/callbacks.h
index 2bc84732aaac373e067926127fdfee344972b337..610050895c346ab905bced0de0d268a5dc2fe6a1 100644 (file)
--- a/src/callbacks.h
+++ b/src/callbacks.h
#ifndef NCMPC_CALLBACKS_H
#define NCMPC_CALLBACKS_H
+#include <mpd/client.h>
+
#include <stdbool.h>
struct mpdclient;
bool
mpdclient_auth_callback(struct mpdclient *c);
+void
+mpdclient_idle_callback(enum mpd_error error,
+ enum mpd_server_error server_error,
+ const char *message, enum mpd_idle events,
+ void *ctx);
+
#endif
diff --git a/src/main.c b/src/main.c
index 1459df4baee3bf68c51e29dbfa043f63c83acad7..31112fb9514adfd4d4f25d7cbac5f7f879943996 100644 (file)
--- a/src/main.c
+++ b/src/main.c
#include "config.h"
#include "ncmpc.h"
#include "mpdclient.h"
-#include "gidle.h"
+#include "callbacks.h"
#include "charset.h"
#include "options.h"
#include "command.h"
}
#endif /* WIN32 */
-static void
-idle_callback(enum mpd_error error,
- gcc_unused enum mpd_server_error server_error,
- const char *message, enum mpd_idle events,
- gcc_unused void *ctx);
-
static gboolean
timer_mpd_update(gpointer data);
return FALSE;
}
- struct mpd_connection *connection = mpdclient_get_connection(mpd);
-
#ifndef NCMPC_MINI
/* quit if mpd is pre 0.14 - song id not supported by mpd */
+ struct mpd_connection *connection = mpdclient_get_connection(mpd);
if (mpd_connection_cmp_server_version(connection, 0, 16, 0) < 0) {
const unsigned *version =
mpd_connection_get_server_version(connection);
}
#endif
- mpd->source = mpd_glib_new(connection,
- idle_callback, mpd);
-
screen_status_clear_message();
doupdate();
* This function is called by the gidle.c library when MPD sends us an
* idle event (or when the connection dies).
*/
-static void
-idle_callback(enum mpd_error error,
- gcc_unused enum mpd_server_error server_error,
- const char *message, enum mpd_idle events,
- void *ctx)
+void
+mpdclient_idle_callback(enum mpd_error error,
+ gcc_unused enum mpd_server_error server_error,
+ const char *message, enum mpd_idle events,
+ void *ctx)
{
struct mpdclient *c = ctx;
diff --git a/src/mpdclient.c b/src/mpdclient.c
index 582d302b7b5c78155708a38fac684933bb07be51..f0076b6047442e4682097da63883a1ae9029a090 100644 (file)
--- a/src/mpdclient.c
+++ b/src/mpdclient.c
return false;
}
+ c->source = mpd_glib_new(c->connection,
+ mpdclient_idle_callback, c);
+
++c->connection_id;
return true;