changeset 1430:740c08db08d9 trunk

[svn] via Christian Birchinger <joker -at- netswarm.net>: - Add a `sort by Playlist Entry' option.
author nenolod
date Tue, 25 Jul 2006 12:12:29 -0700
parents a360afd8df52
children 8b4232e681d7
files ChangeLog audacious/playlist.c audacious/playlist.h audacious/ui_playlist.c
diffstat 4 files changed, 63 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Jul 24 16:20:05 2006 -0700
+++ b/ChangeLog	Tue Jul 25 12:12:29 2006 -0700
@@ -1,3 +1,16 @@
+2006-07-24 23:20:05 +0000  Derek Pomery <nemo@m8y.org>
+  revision [1772]
+  Make annoying recursion that consistently returns wrong art, optional.
+  
+
+  Changes:        Modified:
+  +89 -0          trunk/audacious/glade/prefswin.glade  
+  +2 -0           trunk/audacious/main.c  
+  +2 -0           trunk/audacious/main.h  
+  +42 -0          trunk/audacious/prefswin.c  
+  +14 -15         trunk/audacious/ui_fileinfo.c  
+
+
 2006-07-21 17:24:28 +0000  William Pitcock <nenolod@nenolod.net>
   revision [1770]
   - add translators list
--- a/audacious/playlist.c	Mon Jul 24 16:20:05 2006 -0700
+++ b/audacious/playlist.c	Tue Jul 25 12:12:29 2006 -0700
@@ -108,6 +108,7 @@
 static gint playlist_compare_artist(PlaylistEntry * a, PlaylistEntry * b);
 static gint playlist_compare_date(PlaylistEntry * a, PlaylistEntry * b);
 static gint playlist_compare_track(PlaylistEntry * a, PlaylistEntry * b);
+static gint playlist_compare_playlist(PlaylistEntry * a, PlaylistEntry * b);
 
 static gint playlist_dupscmp_path(PlaylistEntry * a, PlaylistEntry * b);
 static gint playlist_dupscmp_filename(PlaylistEntry * a, PlaylistEntry * b);
@@ -119,7 +120,8 @@
     playlist_compare_title,
     playlist_compare_artist,
     playlist_compare_date,
-    playlist_compare_track
+    playlist_compare_track,
+    playlist_compare_playlist
 };
 
 static void playlist_save_m3u(FILE * file);
@@ -1774,6 +1776,36 @@
 }
 
 static gint
+playlist_compare_playlist(PlaylistEntry * a,
+		          PlaylistEntry * b)
+{
+    const gchar *a_title = NULL, *b_title = NULL;
+
+    g_return_val_if_fail(a != NULL, 0);
+    g_return_val_if_fail(b != NULL, 0);
+
+    if (a->title != NULL)
+        a_title = a->title;
+    else {
+        if (strrchr(a->filename, '/'))
+            a_title = strrchr(a->filename, '/') + 1;
+        else
+            a_title = a->filename;
+    }
+
+    if (b->title != NULL)
+        b_title = b->title;
+    else {
+        if (strrchr(a->filename, '/'))
+            b_title = strrchr(b->filename, '/') + 1;
+        else
+            b_title = b->filename;
+    }
+
+    return strcasecmp(a_title, b_title);
+}
+
+static gint
 playlist_compare_title(PlaylistEntry * a,
                        PlaylistEntry * b)
 {
--- a/audacious/playlist.h	Mon Jul 24 16:20:05 2006 -0700
+++ b/audacious/playlist.h	Tue Jul 25 12:12:29 2006 -0700
@@ -34,7 +34,8 @@
     PLAYLIST_SORT_TITLE,
     PLAYLIST_SORT_ARTIST,
     PLAYLIST_SORT_DATE,
-    PLAYLIST_SORT_TRACK
+    PLAYLIST_SORT_TRACK,
+    PLAYLIST_SORT_PLAYLIST
 } PlaylistSortType;
 
 typedef enum {
--- a/audacious/ui_playlist.c	Mon Jul 24 16:20:05 2006 -0700
+++ b/audacious/ui_playlist.c	Tue Jul 25 12:12:29 2006 -0700
@@ -83,7 +83,8 @@
     PLAYLISTWIN_SORT_SEL_BYTITLE, PLAYLISTWIN_SORT_SEL_BYFILENAME,
     PLAYLISTWIN_SORT_SEL_BYPATH, PLAYLISTWIN_SORT_SEL_BYDATE,
     PLAYLISTWIN_SORT_RANDOMIZE, PLAYLISTWIN_SORT_REVERSE,
-    PLAYLISTWIN_SORT_BYTRACK, PLAYLISTWIN_SORT_SEL_BYTRACK
+    PLAYLISTWIN_SORT_BYTRACK, PLAYLISTWIN_SORT_SEL_BYTRACK,
+    PLAYLISTWIN_SORT_BYPLAYLIST, PLAYLISTWIN_SORT_SEL_BYPLAYLIST
 };
 
 GtkWidget *playlistwin;
@@ -265,6 +266,8 @@
      PLAYLISTWIN_SORT_BYDATE, "<ImageItem>", sortbydate_pixbuf},
     {N_("/Sort List/By Track Number"), NULL, plsort_menu_callback,
      PLAYLISTWIN_SORT_BYTRACK, "<ImageItem>", sortbytitle_pixbuf},
+    {N_("/Sort List/By Playlist Entry"), NULL, plsort_menu_callback,
+     PLAYLISTWIN_SORT_BYPLAYLIST, "<ImageItem>", sortbytitle_pixbuf},
     {N_("/Sort Selection"), NULL, NULL, 0, "<Branch>", NULL},
     {N_("/Sort Selection/By Title"), NULL, plsort_menu_callback,
      PLAYLISTWIN_SORT_SEL_BYTITLE, "<ImageItem>", sortbytitle_pixbuf},
@@ -277,7 +280,9 @@
     {N_("/Sort Selection/By Date"), NULL, plsort_menu_callback,
      PLAYLISTWIN_SORT_SEL_BYDATE, "<ImageItem>", sortbydate_pixbuf},
     {N_("/Sort Selection/By Track Number"), NULL, plsort_menu_callback,
-     PLAYLISTWIN_SORT_SEL_BYTRACK, "<ImageItem>", sortbytitle_pixbuf}
+     PLAYLISTWIN_SORT_SEL_BYTRACK, "<ImageItem>", sortbytitle_pixbuf},
+    {N_("/Sort Selection/By Playlist Entry"), NULL, plsort_menu_callback,
+     PLAYLISTWIN_SORT_SEL_BYPLAYLIST, "<ImageItem>", sortbytitle_pixbuf}
 };
 
 
@@ -1855,6 +1860,10 @@
                      GtkWidget * widget)
 {
     switch (action) {
+    case PLAYLISTWIN_SORT_BYPLAYLIST:
+        playlist_sort(PLAYLIST_SORT_PLAYLIST);
+        playlistwin_update_list();
+        break;
     case PLAYLISTWIN_SORT_BYTRACK:
         playlist_sort(PLAYLIST_SORT_TRACK);
         playlistwin_update_list();
@@ -1879,6 +1888,10 @@
         playlist_sort(PLAYLIST_SORT_FILENAME);
         playlistwin_update_list();
         break;
+    case PLAYLISTWIN_SORT_SEL_BYPLAYLIST:
+        playlist_sort_selected(PLAYLIST_SORT_PLAYLIST);
+        playlistwin_update_list();
+        break;
     case PLAYLISTWIN_SORT_SEL_BYTRACK:
         playlist_sort_selected(PLAYLIST_SORT_TRACK);
         playlistwin_update_list();