[Goodies-commits] r6967 - in xfmpc/trunk: . src

Vincent Legout vincent at xfce.org
Sat Mar 21 13:44:32 CET 2009


Author: vincent
Date: 2009-03-21 12:44:32 +0000 (Sat, 21 Mar 2009)
New Revision: 6967

Modified:
   xfmpc/trunk/ChangeLog
   xfmpc/trunk/src/mpdclient.c
   xfmpc/trunk/src/mpdclient.h
   xfmpc/trunk/src/playlist.c
   xfmpc/trunk/src/playlist.h
Log:
Display the position rather than the id of the track in the playlist


Modified: xfmpc/trunk/ChangeLog
===================================================================
--- xfmpc/trunk/ChangeLog	2009-03-20 23:02:37 UTC (rev 6966)
+++ xfmpc/trunk/ChangeLog	2009-03-21 12:44:32 UTC (rev 6967)
@@ -1,3 +1,11 @@
+2009-03-21	Vincent Legout <vincent at legout.info>
+
+Display the position rather than the id of the track in the playlist
+	* src/playlist.[ch]:
+	  - Display the position and not the id of the track
+	* src/mpdclient.[ch](xfmpc_mpdclient_playlist_read):
+	  - Return the position of the song in the playlist
+
 2009-03-14	Vincent Legout <vincent at legout.info>
 
 Don't set a size for the labels in the song dialog

Modified: xfmpc/trunk/src/mpdclient.c
===================================================================
--- xfmpc/trunk/src/mpdclient.c	2009-03-20 23:02:37 UTC (rev 6966)
+++ xfmpc/trunk/src/mpdclient.c	2009-03-21 12:44:32 UTC (rev 6967)
@@ -708,7 +708,7 @@
 {
   gint id;
 
-  while (xfmpc_mpdclient_playlist_read (mpdclient, &id, NULL, NULL, NULL))
+  while (xfmpc_mpdclient_playlist_read (mpdclient, &id, NULL, NULL, NULL, NULL))
     {
       if (!xfmpc_mpdclient_queue_remove_id (mpdclient, id))
         return FALSE;
@@ -722,6 +722,7 @@
 gboolean
 xfmpc_mpdclient_playlist_read (XfmpcMpdclient *mpdclient,
                                gint *id,
+                               gint *pos,
                                gchar **filename,
                                gchar **song,
                                gchar **length)
@@ -742,6 +743,8 @@
         *song = _get_formatted_name (data->song);
       if (NULL != length)
         *length = g_strdup_printf ("%d:%02d", data->song->time / 60, data->song->time % 60);
+      if (NULL != pos)
+      	*pos = data->song->pos;
       *id = data->song->id;
     }
 
@@ -792,7 +795,7 @@
 
   if (is_dir && strcmp (filename, ""))
     {
-      while (xfmpc_mpdclient_playlist_read (mpdclient, &id, &basename, NULL, NULL))
+      while (xfmpc_mpdclient_playlist_read (mpdclient, &id, NULL, &basename, NULL, NULL))
         {
           if (g_str_has_prefix (basename, filename))
             found = TRUE;

Modified: xfmpc/trunk/src/mpdclient.h
===================================================================
--- xfmpc/trunk/src/mpdclient.h	2009-03-20 23:02:37 UTC (rev 6966)
+++ xfmpc/trunk/src/mpdclient.h	2009-03-21 12:44:32 UTC (rev 6967)
@@ -95,6 +95,7 @@
 
 gboolean                xfmpc_mpdclient_playlist_read           (XfmpcMpdclient *mpdclient,
                                                                  gint *id,
+                                                                 gint *pos,
                                                                  gchar **filename,
                                                                  gchar **song,
                                                                  gchar **length);

Modified: xfmpc/trunk/src/playlist.c
===================================================================
--- xfmpc/trunk/src/playlist.c	2009-03-20 23:02:37 UTC (rev 6966)
+++ xfmpc/trunk/src/playlist.c	2009-03-21 12:44:32 UTC (rev 6967)
@@ -323,6 +323,7 @@
 void
 xfmpc_playlist_append (XfmpcPlaylist *playlist,
                        gint id,
+                       gint pos,
                        gchar *filename,
                        gchar *song,
                        gchar *length)
@@ -334,7 +335,7 @@
   gtk_list_store_set (priv->store, &iter,
                       COLUMN_ID, id,
                       COLUMN_FILENAME, filename,
-                      COLUMN_POSITION, id + 1,
+                      COLUMN_POSITION, pos + 1,
                       COLUMN_SONG, song,
                       COLUMN_LENGTH, length,
                       COLUMN_WEIGHT, PANGO_WEIGHT_NORMAL,
@@ -433,14 +434,14 @@
 {
   XfmpcPlaylistPrivate *priv = XFMPC_PLAYLIST (playlist)->priv;
   gchar                *filename, *song, *length;
-  gint                  id, current;
+  gint                  id, pos, current;
 
   current = xfmpc_mpdclient_get_id (playlist->mpdclient);
 
   xfmpc_playlist_clear (playlist);
-  while (xfmpc_mpdclient_playlist_read (playlist->mpdclient, &id, &filename, &song, &length))
+  while (xfmpc_mpdclient_playlist_read (playlist->mpdclient, &id, &pos, &filename, &song, &length))
     {
-      xfmpc_playlist_append (playlist, id, filename, song, length);
+      xfmpc_playlist_append (playlist, id, pos, filename, song, length);
       g_free (filename);
       g_free (song);
       g_free (length);

Modified: xfmpc/trunk/src/playlist.h
===================================================================
--- xfmpc/trunk/src/playlist.h	2009-03-20 23:02:37 UTC (rev 6966)
+++ xfmpc/trunk/src/playlist.h	2009-03-21 12:44:32 UTC (rev 6967)
@@ -41,6 +41,7 @@
 
 void                    xfmpc_playlist_append                   (XfmpcPlaylist *playlist,
                                                                  gint id,
+                                                                 gint pos,
                                                                  gchar *filename,
                                                                  gchar *song,
                                                                  gchar *length);




More information about the Goodies-commits mailing list