Code

po: update German translation
[ncmpc.git] / src / mpdclient.h
index b6027da7be83c43a1db3704e5cce02b8610e7213..a93db74baf135392acba5ff418bc3f18d2dffc6d 100644 (file)
@@ -12,6 +12,23 @@ struct mpdclient {
        struct mpdclient_playlist playlist;
 
        struct mpd_connection *connection;
+
+       /**
+        * If this object is non-NULL, it tracks idle events.  It is
+        * automatically called by mpdclient_get_connection() and
+        * mpdclient_put_connection().  It is not created by the
+        * mpdclient library; the user of this library has to
+        * initialize it.  However, it is freed when the MPD
+        * connection is closed.
+        */
+       struct mpd_glib_source *source;
+
+       /**
+        * This attribute is true when the connection is currently in
+        * "idle" mode, and the #mpd_glib_source waits for an event.
+        */
+       bool idle;
+
        struct mpd_status *status;
        const struct mpd_song *song;
 
@@ -40,12 +57,19 @@ mpdclient_is_connected(const struct mpdclient *c)
        return c->connection != NULL;
 }
 
+G_GNUC_PURE
+static inline bool
+mpdclient_is_playing(const struct mpdclient *c)
+{
+       return c->status != NULL &&
+               (mpd_status_get_state(c->status) == MPD_STATE_PLAY ||
+                mpd_status_get_state(c->status) == MPD_STATE_PAUSE);
+}
+
 static inline const struct mpd_song *
 mpdclient_get_current_song(const struct mpdclient *c)
 {
-       return c->song != NULL && c->status != NULL &&
-               (mpd_status_get_state(c->status) == MPD_STATE_PLAY ||
-                mpd_status_get_state(c->status) == MPD_STATE_PAUSE)
+       return c->song != NULL && mpdclient_is_playing(c)
                ? c->song
                : NULL;
 }
@@ -75,9 +99,6 @@ mpdclient_ui_error(const char *message);
 
 /*** MPD Commands  **********************************************************/
 
-bool
-mpdclient_cmd_play(struct mpdclient *c, gint index);
-
 bool
 mpdclient_cmd_crop(struct mpdclient *c);
 
@@ -106,11 +127,7 @@ bool
 mpdclient_cmd_delete_range(struct mpdclient *c, unsigned start, unsigned end);
 
 bool
-mpdclient_cmd_move(struct mpdclient *c, gint old_index, gint new_index);
-
-/* list functions */
-GList *mpdclient_get_artists(struct mpdclient *c);
-GList *mpdclient_get_albums(struct mpdclient *c, const gchar *artist_utf8);
+mpdclient_cmd_move(struct mpdclient *c, unsigned dest, unsigned src);
 
 /*** playlist functions  **************************************************/