changeset 2221:e7ecc79293c8 trunk

[svn] - deletion of the last playlist is now handled directly in playlist_remove_playlist (patch by Joker) ; small code changes in playlist manager
author giacomo
date Fri, 29 Dec 2006 14:33:09 -0800
parents b4d874d3d9ff
children 4de6e7d138c6
files ChangeLog audacious/playlist.c audacious/playlist_manager.c
diffstat 3 files changed, 31 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Dec 29 09:59:21 2006 -0800
+++ b/ChangeLog	Fri Dec 29 14:33:09 2006 -0800
@@ -1,3 +1,11 @@
+2006-12-29 17:59:21 +0000  Yoshiki Yazawa <yaz@cc.rim.or.jp>
+  revision [3445]
+  - fix a typo that kustodian pointed out. (probably it's mine.)
+  
+  trunk/audacious/glade/prefswin.glade |    2 +-
+  1 file changed, 1 insertion(+), 1 deletion(-)
+
+
 2006-12-29 14:14:57 +0000  Kiyoshi Aman <kiyoshi.aman@gmail.com>
   revision [3443]
   Add Serbian Latin & Cyrillic translations courtesy of external translator Strahinja Kustudi?\196?\135 <kustodian -at- gmail.com>
--- a/audacious/playlist.c	Fri Dec 29 09:59:21 2006 -0800
+++ b/audacious/playlist.c	Fri Dec 29 14:33:09 2006 -0800
@@ -250,6 +250,16 @@
 void
 playlist_remove_playlist(Playlist *playlist)
 {
+    /* trying to free the last playlist simply clears and resets it */
+    if (g_list_length(playlists) < 2) {
+        playlist_clear(playlist);
+        playlist_set_current_name(playlist, NULL);
+        return;
+    }
+
+    if (playlist == playlist_get_active())
+        playlist_select_next();
+
     /* upon removal, a playlist should be cleared and freed */
     playlists = g_list_remove(playlists, playlist);
     playlist_clear(playlist);
--- a/audacious/playlist_manager.c	Fri Dec 29 09:59:21 2006 -0800
+++ b/audacious/playlist_manager.c	Fri Dec 29 14:33:09 2006 -0800
@@ -120,19 +120,19 @@
     gtk_tree_model_get( store, &iter, PLLIST_COL_PLPOINTER , &playlist , -1 );
 
     if ( gtk_tree_model_iter_n_children( store , NULL ) < 2 )
-      return; /* do not delete the last playlist available */
-
-    gtk_list_store_remove( (GtkListStore*)store , &iter );
-
-    /* if the playlist removed is the active one, switch to the next */
-    if ( playlist == playlist_get_active() )
-      playlist_select_next();
-
-    /* this ensures that playlist_manager_update() will
-       not perform update, since we're already doing it here */
-    DISABLE_MANAGER_UPDATE();
-    playlist_remove_playlist( playlist );
-    ENABLE_MANAGER_UPDATE();
+    {
+      /* let playlist_manager_update() handle the deletion of the last playlist */
+      playlist_remove_playlist( playlist );
+    }
+    else
+    {
+      gtk_list_store_remove( (GtkListStore*)store , &iter );
+      /* this ensures that playlist_manager_update() will
+         not perform update, since we're already doing it here */
+      DISABLE_MANAGER_UPDATE();
+      playlist_remove_playlist( playlist );
+      ENABLE_MANAGER_UPDATE();
+    }
   }
 
   return;