[Xfce4-commits] <parole:bluesabre/gtk3> Fix errors when removing last item from playlist

Sean Davis noreply at xfce.org
Mon Sep 23 04:34:01 CEST 2013


Updating branch refs/heads/bluesabre/gtk3
         to 97a15428d98a099991d00d1125a9f7a479fe4c94 (commit)
       from 130d28415d83ad17b0ba2177bc924077ad0609b9 (commit)

commit 97a15428d98a099991d00d1125a9f7a479fe4c94
Author: Sean Davis <smd.seandavis at gmail.com>
Date:   Sun Sep 22 22:33:52 2013 -0400

    Fix errors when removing last item from playlist

 src/parole-medialist.c |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/parole-medialist.c b/src/parole-medialist.c
index 814a54d..cd2d6b0 100644
--- a/src/parole-medialist.c
+++ b/src/parole-medialist.c
@@ -996,8 +996,15 @@ parole_media_list_remove_clicked_cb (GtkButton *button, ParoleMediaList *list)
     g_list_foreach (row_list, (GFunc) gtk_tree_row_reference_free, NULL);
     g_list_free (row_list);
     
+    /*
+     * Returns the number of children that iter has. 
+     * As a special case, if iter is NULL, 
+     * then the number of toplevel nodes is returned. Gtk API doc.
+     */
+    nch = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (list->priv->store), NULL); 
+    
     /* No row was selected, then select the first one*/
-    if (!row_selected)
+    if (!row_selected && nch != 0)
     {
         GtkTreePath *path;
         path = parole_media_list_get_first_path (model);
@@ -1005,13 +1012,6 @@ parole_media_list_remove_clicked_cb (GtkButton *button, ParoleMediaList *list)
         gtk_tree_path_free (path);
     }
     
-    /*
-     * Returns the number of children that iter has. 
-     * As a special case, if iter is NULL, 
-     * then the number of toplevel nodes is returned. Gtk API doc.
-     */
-    nch = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (list->priv->store), NULL); 
-    
     parole_media_list_set_playlist_count(list, nch);
 }
 


More information about the Xfce4-commits mailing list