Revision: 2056
          http://gtkpod.svn.sourceforge.net/gtkpod/?rev=2056&view=rev
Author:   jcsjcs
Date:     2008-07-19 13:54:01 +0000 (Sat, 19 Jul 2008)

Log Message:
-----------
        * src/display_playlists.c (pm_add_child): when adding
          playlists to the end, don't add behind the Photo item.

Modified Paths:
--------------
    gtkpod/trunk/ChangeLog
    gtkpod/trunk/src/display_playlists.c

Modified: gtkpod/trunk/ChangeLog
===================================================================
--- gtkpod/trunk/ChangeLog      2008-07-19 13:14:13 UTC (rev 2055)
+++ gtkpod/trunk/ChangeLog      2008-07-19 13:54:01 UTC (rev 2056)
@@ -1,3 +1,8 @@
+2008-07-19 Jorg Schuler <jcsjcs at users.sourceforge.net>
+
+       * src/display_playlists.c (pm_add_child): when adding
+          playlists to the end, don't add behind the Photo item.
+
 2008-07-18 P.G. Richardson <phantom_sf at users.sourceforge.net>
 
        * src/file.c (get_track_info_from_file): 

Modified: gtkpod/trunk/src/display_playlists.c
===================================================================
--- gtkpod/trunk/src/display_playlists.c        2008-07-19 13:14:13 UTC (rev 
2055)
+++ gtkpod/trunk/src/display_playlists.c        2008-07-19 13:54:01 UTC (rev 
2056)
@@ -1237,13 +1237,36 @@
          mpli = NULL;
       }
       else
-      {
+      {   /* Handle normal playlist */
          /* MPL must be set before calling this function */
          g_return_if_fail (mpli);
-         /* reduce position by one because the MPL is not included in the
-            tree model's count */
-         if (pos != -1)
+         if (pos == -1)
+         {   /* just adding at the end will add behind the photo
+              * item. Find out how many playlists there are and add
+              * at the end. */
+             GtkTreeIter pl_iter;
+             Playlist *pl;
+             pos = 0;
+               /* go down one hierarchy and try all other iters */
+             if (gtk_tree_model_iter_children (model, &pl_iter, &mpl_iter))
+             {
+                 do
+                 {
+                     gtk_tree_model_get (model, &pl_iter,
+                                         PM_COLUMN_PLAYLIST, &pl,
+                                         -1);
+                     if (pl != NULL)
+                     {
+                         ++pos;
+                     }
+                 } while (pl && gtk_tree_model_iter_next (model, &pl_iter));
+             }
+         }
+         else
+         {   /* reduce position by one because the MPL is not included in the
+                tree model's count */
              --pos;
+         }
       }
       break;
   case PM_COLUMN_PHOTOS:


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to