Update of /cvsroot/gtkpod/gtkpod/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14842/src

Modified Files:
        context_menus.c display_itdb.c file.c misc_confirm.c 
        misc_track.c 
Log Message:
         * display_itdb.c, context_menus.c, misc_confirm.c,
           misc_track.c: provisions for podcasts DND and podcasts
           deletion.



Index: context_menus.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/context_menus.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- context_menus.c     12 Nov 2005 08:54:31 -0000      1.44
+++ context_menus.c     12 Nov 2005 16:54:15 -0000      1.45
@@ -1,4 +1,4 @@
-/* Time-stamp: <2005-11-12 17:34:06 jcs>
+/* Time-stamp: <2005-11-13 01:50:32 jcs>
 |
 |  Copyright (C) 2003 Corey Donohoe <atmos at atmos dot org>
 |  Copyright (C) 2003-2005 Jorg Schuler <jcsjcs at users sourceforge net>
@@ -282,15 +282,16 @@
 {
     static GtkWidget *menu[CM_NUM];
     static GtkWidget *mi_exp[CM_NUM];  /* Export Tracks */
-    static GtkWidget *mi_pl[CM_NUM];   /* DELETE_ACTION_PLAYLIST */
-    static GtkWidget *mi_ipod[CM_NUM]; /* DELETE_ACTION_IPOD     */
-    static GtkWidget *mi_local[CM_NUM];/* DELETE_ACTION_LOCAL    */
-    static GtkWidget *mi_db[CM_NUM];   /* DELETE_ACTION_DATABASE */
-    static GtkWidget *mi_sep[CM_NUM];  /* separator              */
+    static GtkWidget *mi_delpl[CM_NUM];   /* DELETE_ACTION_PLAYLIST */
+    static GtkWidget *mi_delipod[CM_NUM]; /* DELETE_ACTION_IPOD     */
+    static GtkWidget *mi_dellocal[CM_NUM];/* DELETE_ACTION_LOCAL    */
+    static GtkWidget *mi_deldb[CM_NUM];   /* DELETE_ACTION_DATABASE */
+    static GtkWidget *mi_delpcipod[CM_NUM]; /* DELETE_ACTION_IPOD   */
+    static GtkWidget *mi_delsep[CM_NUM];  /* separator              */
     static GtkWidget *mi_spl[CM_NUM];  /* edit smart playlist    */
-    static GtkWidget *mi_ipod_all[CM_NUM];/* DELETE_ACTION_IPOD (all
+    static GtkWidget *mi_delipod_all[CM_NUM];/* DELETE_ACTION_IPOD (all
                                           * tracks)      */
-    static GtkWidget *mi_db_all[CM_NUM];  /* DELETE_ACTION_DATABASE
+    static GtkWidget *mi_deldb_all[CM_NUM];  /* DELETE_ACTION_DATABASE
                                           * (all tracks  */
     static GtkWidget *mi_podcasts_sep[CM_NUM]; /* Podcasts Separator */
     static GtkWidget *mi_podcasts_update[CM_NUM]; /* Update Podcasts */
@@ -349,61 +350,78 @@
        }
        if ((type == CM_ST) || (type == CM_TM))
        {
-           mi_sep[type] = add_separator (menu[type]);
-           mi_ipod[type] = hookup_mi (menu[type],
-                                      _("Delete From iPod"),
-                                      GTK_STOCK_DELETE,
-                                      G_CALLBACK (delete_entries),
-                                      GINT_TO_POINTER (DELETE_ACTION_IPOD));
-           mi_local[type] = hookup_mi (menu[type],
-                                       _("Delete From Harddisk"),
-                                       GTK_STOCK_DELETE,
-                                       G_CALLBACK (delete_entries),
-                                       GINT_TO_POINTER (DELETE_ACTION_LOCAL));
-           mi_db[type] = hookup_mi (menu[type],
-                                    _("Delete From Database"),
-                                    GTK_STOCK_DELETE,
-                                    G_CALLBACK (delete_entries),
-                                    GINT_TO_POINTER (DELETE_ACTION_DATABASE));
-           mi_pl[type] = hookup_mi (menu[type],
-                                    _("Delete From Playlist"),
-                                    GTK_STOCK_DELETE,
-                                    G_CALLBACK (delete_entries),
-                                    GINT_TO_POINTER (DELETE_ACTION_PLAYLIST));
+           mi_delsep[type] = add_separator (menu[type]);
+           mi_delipod[type] =
+               hookup_mi (menu[type],
+                          _("Delete From iPod"),
+                          GTK_STOCK_DELETE,
+                          G_CALLBACK (delete_entries),
+                          GINT_TO_POINTER (DELETE_ACTION_IPOD));
+           mi_dellocal[type] = 
+               hookup_mi (menu[type],
+                          _("Delete From Harddisk"),
+                          GTK_STOCK_DELETE,
+                          G_CALLBACK (delete_entries),
+                          GINT_TO_POINTER (DELETE_ACTION_LOCAL));
+           mi_deldb[type] =
+               hookup_mi (menu[type],
+                          _("Delete From Database"),
+                          GTK_STOCK_DELETE,
+                          G_CALLBACK (delete_entries),
+                          GINT_TO_POINTER (DELETE_ACTION_DATABASE));
+           mi_delpl[type] =
+               hookup_mi (menu[type],
+                          _("Delete From Playlist"),
+                          GTK_STOCK_DELETE,
+                          G_CALLBACK (delete_entries),
+                          GINT_TO_POINTER (DELETE_ACTION_PLAYLIST));
        }
        if (type == CM_PM)
        {
-           mi_sep[type] = add_separator (menu[type]);
-           mi_ipod[type] = hookup_mi (menu[type],
-                                      _("Delete Including Tracks"),
-                                      GTK_STOCK_DELETE,
-                                      G_CALLBACK (delete_entries),
-                                      GINT_TO_POINTER (DELETE_ACTION_IPOD));
-           mi_local[type] = hookup_mi (menu[type],
-                                       _("Delete Including Tracks (Harddisk)"),
-                                       GTK_STOCK_DELETE,
-                                       G_CALLBACK (delete_entries),
-                                       GINT_TO_POINTER (DELETE_ACTION_LOCAL));
-           mi_db[type] = hookup_mi (menu[type],
-                                    _("Delete Including Tracks (Database)"),
-                                    GTK_STOCK_DELETE,
-                                    G_CALLBACK (delete_entries),
-                                    GINT_TO_POINTER (DELETE_ACTION_DATABASE));
-           mi_pl[type] = hookup_mi (menu[type],
-                                    _("Delete But Keep Tracks"),
-                                    GTK_STOCK_DELETE,
-                                    G_CALLBACK (delete_entries),
-                                    GINT_TO_POINTER (DELETE_ACTION_PLAYLIST));
-           mi_ipod_all[type] = hookup_mi (menu[type],
-                                          _("Remove All Tracks from iPod"),
-                                          GTK_STOCK_DELETE,
-                                          G_CALLBACK (delete_entries),
-                                          GINT_TO_POINTER 
(DELETE_ACTION_IPOD));
-           mi_db_all[type] = hookup_mi (menu[type],
-                                        _("Remove All Tracks from Database"),
-                                        GTK_STOCK_DELETE,
-                                        G_CALLBACK (delete_entries),
-                                        GINT_TO_POINTER 
(DELETE_ACTION_DATABASE));
+           mi_delsep[type] = add_separator (menu[type]);
+           mi_delipod[type] =
+               hookup_mi (menu[type],
+                          _("Delete Including Tracks"),
+                          GTK_STOCK_DELETE,
+                          G_CALLBACK (delete_entries),
+                          GINT_TO_POINTER (DELETE_ACTION_IPOD));
+           mi_dellocal[type] =
+               hookup_mi (menu[type],
+                          _("Delete Including Tracks (Harddisk)"),
+                          GTK_STOCK_DELETE,
+                          G_CALLBACK (delete_entries),
+                          GINT_TO_POINTER (DELETE_ACTION_LOCAL));
+           mi_deldb[type] =
+               hookup_mi (menu[type],
+                          _("Delete Including Tracks (Database)"),
+                          GTK_STOCK_DELETE,
+                          G_CALLBACK (delete_entries),
+                          GINT_TO_POINTER (DELETE_ACTION_DATABASE));
+           mi_delpl[type] =
+               hookup_mi (menu[type],
+                          _("Delete But Keep Tracks"),
+                          GTK_STOCK_DELETE,
+                          G_CALLBACK (delete_entries),
+                          GINT_TO_POINTER (DELETE_ACTION_PLAYLIST));
+           mi_delipod_all[type] =
+               hookup_mi (menu[type],
+                          _("Remove All Tracks from iPod"),
+                          GTK_STOCK_DELETE,
+                          G_CALLBACK (delete_entries),
+                          GINT_TO_POINTER (DELETE_ACTION_IPOD));
+           mi_deldb_all[type] =
+               hookup_mi (menu[type],
+                          _("Remove All Tracks from Database"),
+                          GTK_STOCK_DELETE,
+                          G_CALLBACK (delete_entries),
+                          GINT_TO_POINTER (DELETE_ACTION_DATABASE));
+
+           mi_delpcipod[type] =
+               hookup_mi (menu[type],
+                          _("Remove All Podcasts from iPod"),
+                          GTK_STOCK_DELETE,
+                          G_CALLBACK (delete_entries),
+                          GINT_TO_POINTER (DELETE_ACTION_IPOD));
 
            mi_podcasts_sep[type] = add_separator (menu[type]);
 
@@ -433,107 +451,99 @@
        switch (type)
        {
        case CM_PM:
+           gtk_widget_hide (mi_spl[type]);
+           gtk_widget_hide (mi_dellocal[type]);
+           gtk_widget_hide (mi_delpl[type]);
+           gtk_widget_hide (mi_deldb[type]);
+           gtk_widget_hide (mi_deldb_all[type]);
+           gtk_widget_hide (mi_delsep[type]);
+           gtk_widget_hide (mi_delipod[type]);
+           gtk_widget_hide (mi_delipod_all[type]);
+           gtk_widget_hide (mi_delpcipod[type]);
+           gtk_widget_hide (mi_dellocal[type]);
+           gtk_widget_hide (mi_podcasts_sep[type]);
+           gtk_widget_hide (mi_podcasts_update[type]);
+           gtk_widget_hide (mi_podcasts_prefs[type]);
+
            if (pl->is_spl)
            {
                gtk_widget_show (mi_spl[type]);
            }
-           else
-           {
-               gtk_widget_hide (mi_spl[type]);
-           }
            if (itdb->usertype & GP_ITDB_TYPE_IPOD)
            {
-               gtk_widget_hide (mi_local [type]);
-               gtk_widget_hide (mi_db [type]);
-               gtk_widget_hide (mi_db_all [type]);
                if (itdb_playlist_is_mpl (pl))
                {
-                   gtk_widget_hide (mi_sep [type]);
-                   gtk_widget_hide (mi_ipod [type]);
-                   gtk_widget_hide (mi_pl [type]);
-                   gtk_widget_show (mi_ipod_all [type]);
+                   gtk_widget_show (mi_delipod_all[type]);
                }
                else
                {
-                   gtk_widget_show (mi_sep [type]);
-                   gtk_widget_show (mi_ipod [type]);
-                   gtk_widget_show (mi_pl [type]);
-                   gtk_widget_hide (mi_ipod_all [type]);
+                   if (itdb_playlist_is_podcasts (pl))
+                   {
+                       gtk_widget_show (mi_delpcipod[type]);
+                   }
+                   else
+                   {
+                       gtk_widget_show (mi_delsep[type]);
+                       gtk_widget_show (mi_delipod[type]);
+                       gtk_widget_show (mi_delpl[type]);
+                   }
                }
            }
            if (itdb->usertype & GP_ITDB_TYPE_LOCAL)
            {
-               gtk_widget_hide (mi_ipod [type]);
-               gtk_widget_hide (mi_ipod_all [type]);
                if (itdb_playlist_is_mpl (pl))
                {
-                   gtk_widget_hide (mi_sep [type]);
-                   gtk_widget_hide (mi_local [type]);
-                   gtk_widget_hide (mi_db [type]);
-                   gtk_widget_hide (mi_pl [type]);
-                   gtk_widget_show (mi_db_all [type]);
+                   gtk_widget_show (mi_deldb_all[type]);
                }
                else
                {
-                   gtk_widget_show (mi_sep [type]);
-                   gtk_widget_show (mi_local [type]);
-                   gtk_widget_show (mi_db [type]);
-                   gtk_widget_show (mi_pl [type]);
-                   gtk_widget_hide (mi_db_all [type]);
+                   gtk_widget_show (mi_delsep[type]);
+                   gtk_widget_show (mi_dellocal[type]);
+                   gtk_widget_show (mi_deldb[type]);
+                   gtk_widget_show (mi_delpl[type]);
                }
            }
+
            if (itdb->usertype & GP_ITDB_TYPE_PODCASTS)
            {
+               gtk_widget_show (mi_delsep[type]);
                gtk_widget_show (mi_podcasts_sep[type]);
                gtk_widget_show (mi_podcasts_update[type]);
                gtk_widget_show (mi_podcasts_prefs[type]);
            }
-           else
-           {
-               gtk_widget_hide (mi_podcasts_sep[type]);
-               gtk_widget_hide (mi_podcasts_update[type]);
-               gtk_widget_hide (mi_podcasts_prefs[type]);
-           }
            break;
        case CM_ST:
        case CM_TM:
+           gtk_widget_hide (mi_spl[type]);
+           gtk_widget_hide (mi_dellocal[type]);
+           gtk_widget_hide (mi_deldb[type]);
+           gtk_widget_hide (mi_delpl[type]);
+           gtk_widget_hide (mi_delipod[type]);
+
            if (pl->is_spl)
            {
                gtk_widget_show (mi_spl[type]);
            }
-           else
-           {
-               gtk_widget_hide (mi_spl[type]);
-           }
            if (itdb->usertype & GP_ITDB_TYPE_IPOD)
            {
-               gtk_widget_hide (mi_local [type]);
-               gtk_widget_hide (mi_db [type]);
-               if (itdb_playlist_is_mpl (pl))
-               {
-                   gtk_widget_show (mi_ipod [type]);
-                   gtk_widget_hide (mi_pl [type]);
-               }
-               else
+               gtk_widget_show (mi_delipod[type]);
+               if (!itdb_playlist_is_mpl (pl) &&
+                   !itdb_playlist_is_podcasts (pl))
                {
-                   gtk_widget_show (mi_ipod [type]);
-                   gtk_widget_show (mi_pl [type]);
+                   gtk_widget_show (mi_delpl[type]);
                }
            }
            if (itdb->usertype & GP_ITDB_TYPE_LOCAL)
            {
-               gtk_widget_hide (mi_ipod [type]);
-               if (itdb_playlist_is_mpl (pl))
-               {
-                   gtk_widget_show (mi_local [type]);
-                   gtk_widget_show (mi_db [type]);
-                   gtk_widget_hide (mi_pl [type]);
-               }
-               else
+               gtk_widget_show (mi_dellocal[type]);
+               gtk_widget_show (mi_deldb[type]);
+               /* actually, local repositories are not supposed to
+                  have podcasts playlists, but for completeness' sake
+                  I'll test anyway*/
+               if(!itdb_playlist_is_mpl (pl) &&
+                  !itdb_playlist_is_podcasts (pl))
                {
-                   gtk_widget_show (mi_local [type]);
-                   gtk_widget_show (mi_db [type]);
-                   gtk_widget_show (mi_pl [type]);
+                   gtk_widget_show (mi_delpl[type]);
                }
            }
            break;

Index: display_itdb.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/display_itdb.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- display_itdb.c      24 Oct 2005 14:58:02 -0000      1.33
+++ display_itdb.c      12 Nov 2005 16:54:15 -0000      1.34
@@ -1,4 +1,4 @@
-/* Time-stamp: <2005-10-24 23:49:51 jcs>
+/* Time-stamp: <2005-11-13 01:39:07 jcs>
 |
 |  Copyright (C) 2002-2005 Jorg Schuler <jcsjcs at users sourceforge net>
 |  Part of the gtkpod project.
@@ -462,6 +462,8 @@
                               DeleteAction deleteaction)
 {
     iTunesDB *itdb;
+    Playlist *mpl;
+    gboolean remove_track = FALSE;
 
     g_return_if_fail (track);
     itdb = track->itdb;
@@ -472,8 +474,10 @@
     case DELETE_ACTION_IPOD:
     case DELETE_ACTION_LOCAL:
     case DELETE_ACTION_DATABASE:
-       /* remove from MPL in these cases */
-       plitem = NULL;
+       /* remove from MPL in these cases (unless we are removing
+          podcasts) */
+       if (!(plitem && itdb_playlist_is_podcasts (plitem)))
+           plitem = NULL;
        break;
     case DELETE_ACTION_PLAYLIST:
        /* cannot remove from MPL */
@@ -481,7 +485,10 @@
        break;
     }
 
-    if (plitem == NULL)  plitem = itdb_playlist_mpl (track->itdb);
+    mpl = itdb_playlist_mpl (track->itdb);
+
+    if (plitem == NULL)
+       plitem = mpl;
     
     g_return_if_fail (plitem);
 
@@ -491,6 +498,17 @@
     /* remove track from playlist */
     itdb_playlist_remove_track (plitem, track);
 
+    /* if we removed a podcasts, remove it from memory as well, unless
+       it's present in the MPL (this happens if this podcast was on
+       the iPod as podcast as well as standard track) */
+    if (itdb_playlist_is_podcasts (plitem))
+    {
+       if (!itdb_playlist_contains_track (mpl, track))
+       {
+           remove_track = TRUE;
+       }
+    }
+
     if (itdb_playlist_is_mpl (plitem))
     { /* if it's the MPL, we remove the track permanently */
        GList *gl = g_list_nth (itdb->playlists, 1);
@@ -508,8 +526,12 @@
            }
            gl=gl->next;
        }
-       md5_track_remove (track);
+       remove_track = TRUE;
+    }
 
+    if (remove_track)
+    {
+       md5_track_remove (track);
        if (itdb->usertype & GP_ITDB_TYPE_IPOD)
        {
            switch (deleteaction)

Index: file.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/file.c,v
retrieving revision 1.144
retrieving revision 1.145
diff -u -d -r1.144 -r1.145
--- file.c      15 Oct 2005 17:04:38 -0000      1.144
+++ file.c      12 Nov 2005 16:54:15 -0000      1.145
@@ -1,4 +1,4 @@
-/* Time-stamp: <2005-10-16 01:59:05 jcs>
+/* Time-stamp: <2005-11-12 23:38:13 jcs>
 |
 |  Copyright (C) 2002-2005 Jorg Schuler <jcsjcs at users sourceforge net>
 |  Part of the gtkpod project.
@@ -1755,8 +1755,8 @@
  *                                                                  *
 \*------------------------------------------------------------------*/
 
-/* Append file @name to the list of tracks.
-   @name is in the current locale
+/* Append file @fname to the list of tracks.
+   @fname is in the current locale
    @plitem: if != NULL, add track to plitem as well (unless it's the MPL)
    descend: TRUE:  add directories recursively
             FALSE: add contents of directories passed but don't descend
@@ -1764,7 +1764,7 @@
 /* @addtrackfunc: if != NULL this will be called instead of
    "add_track_to_playlist () -- used for dropping tracks at a specific
    position in the track view */
-gboolean add_track_by_filename (iTunesDB *itdb, gchar *name,
+gboolean add_track_by_filename (iTunesDB *itdb, gchar *fname,
                                Playlist *plitem, gboolean descend,
                               AddTrackFunc addtrackfunc, gpointer data)
 {
@@ -1776,23 +1776,23 @@
   Playlist *mpl;
   gboolean result = TRUE;
 
-  g_return_val_if_fail (name, FALSE);
+  g_return_val_if_fail (fname, FALSE);
   g_return_val_if_fail (itdb, FALSE);
   mpl = itdb_playlist_mpl (itdb);
   g_return_val_if_fail (mpl, FALSE);
 
   if (!plitem)  plitem = mpl;
 
-  if (g_file_test (name, G_FILE_TEST_IS_DIR))
+  if (g_file_test (fname, G_FILE_TEST_IS_DIR))
   {
-      return add_directory_by_name (itdb, name, plitem, descend, addtrackfunc, 
data);
+      return add_directory_by_name (itdb, fname, plitem, descend, 
addtrackfunc, data);
   }
 
   /* check if file is a playlist */
-  switch (determine_file_type(name)) {
+  switch (determine_file_type(fname)) {
          case FILE_TYPE_M3U:
          case FILE_TYPE_PLS:
-             if (add_playlist_by_filename (itdb, name, plitem, -1,
+             if (add_playlist_by_filename (itdb, fname, plitem, -1,
                                            addtrackfunc, data))
                  return TRUE;
              return FALSE;
@@ -1805,7 +1805,7 @@
   }
 
   /* print a message about which file is being processed */
-  basename = g_path_get_basename (name);
+  basename = g_path_get_basename (fname);
   if (basename)
   {
       gchar *bn_utf8 = charset_to_utf8 (basename);
@@ -1817,7 +1817,7 @@
   C_FREE (basename);
 
   /* Check if there exists already a track with the same filename */
-  oldtrack = gp_track_by_filename (itdb, name);
+  oldtrack = gp_track_by_filename (itdb, fname);
   /* If a track already exists in the database, either update it or
      just add it to the current playlist (if it doesn't already exist) */
   if (oldtrack)
@@ -1839,9 +1839,8 @@
       }
   }
   else  /* oldtrack == NULL */
-  {  /* Only read the new track if there doesn't already exist an old
-       track with the same filename in the database */
-      Track *track = get_track_info_from_file (name, NULL);
+  {   /* OK, the same filename does not already exist */
+      Track *track = get_track_info_from_file (fname, NULL);
       if (track)
       {
           Track *added_track = NULL;
@@ -1851,25 +1850,26 @@
          track->id = 0;
          track->transferred = FALSE;
 
-         /* is 'name' on the iPod? */
+         /* is 'fname' on the iPod? -- if yes mark as transfered, if
+          * it's in the ipod_control directory */
          if (itdb->usertype & GP_ITDB_TYPE_IPOD)
          {
              g_return_val_if_fail (itdb->mountpoint, FALSE);
-             if (strstr (name, itdb->mountpoint) == name)
+             if (strstr (fname, itdb->mountpoint) == fname)
              {   /* Yes */
-                 /* is 'name' in the iPod_Control directory? */
-                 gchar *name_i = name + strlen (itdb->mountpoint);
-                 gchar *name_l;
-                 if (*name_i == G_DIR_SEPARATOR) ++name_i;
-                 name_l = g_ascii_strdown (name_i, -1);
-                 if (strstr (name_l, "ipod_control") == name_l)
+                 /* is 'fname' in the iPod_Control directory? */
+                 gchar *fname_i = fname + strlen (itdb->mountpoint);
+                 gchar *fname_l;
+                 if (*fname_i == G_DIR_SEPARATOR) ++fname_i;
+                 fname_l = g_ascii_strdown (fname_i, -1);
+                 if (strstr (fname_l, "ipod_control") == fname_l)
                  {   /* Yes */
                      track->transferred = TRUE;
                      track->ipod_path = g_strdup_printf (
-                         "%c%s", G_DIR_SEPARATOR, name_i);
+                         "%c%s", G_DIR_SEPARATOR, fname_i);
                      itdb_filename_fs2ipod (track->ipod_path);
                  }
-                 g_free (name_l);
+                 g_free (fname_l);
              }
          }
 
@@ -1886,17 +1886,19 @@
          if (addtrackfunc)
          {
              if (itdb_playlist_is_mpl (plitem))
-             {   /* add track to master playlist (if it wasn't a
+             {   /* add track to master playlist if it wasn't a
                     duplicate */
                  if (added_track == track)
                      addtrackfunc (plitem, added_track, data);
              }
              else
-             {   /* add track to master playlist (if it wasn't a
-                  * duplicate) */
+             {   /* add track to master playlist if it wasn't a
+                  * duplicate and plitem is not the podcasts playlist
+                  */
                  if (added_track == track)
                  {
-                     gp_playlist_add_track (mpl, added_track, TRUE);
+                     if (!itdb_playlist_is_podcasts (plitem))
+                         gp_playlist_add_track (mpl, added_track, TRUE);
                  }
                  /* add track to specified playlist */
                  addtrackfunc (plitem, added_track, data);
@@ -1904,14 +1906,27 @@
          }
          else  /* no addtrackfunc */
          {
-                 /* add track to master playlist (if it wasn't a
-                  * duplicate) */
+             if (itdb_playlist_is_mpl (plitem))
+             {
+                 /* add track to master playlist if it wasn't a
+                  * duplicate */
                  if (added_track == track)
-                     gp_playlist_add_track (mpl, added_track,
+                     gp_playlist_add_track (plitem, added_track,
                                             TRUE);
-                 /* add track to specified playlist, but not to MPL */
-                 if (!itdb_playlist_is_mpl (plitem))
-                     gp_playlist_add_track (plitem, added_track, TRUE);
+             }
+             else
+             {
+                 /* add track to master playlist if it wasn't a
+                  * duplicate and plitem is not the podcasts playlist
+                  */
+                 if (added_track == track)
+                 {
+                     if (!itdb_playlist_is_podcasts (plitem))
+                         gp_playlist_add_track (mpl, added_track, TRUE);
+                 }
+                 /* add track to specified playlist */
+                 gp_playlist_add_track (plitem, added_track, TRUE);
+             }
          }
          /* indicate that non-transferred files exist */
          data_changed (itdb);

Index: misc_confirm.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/misc_confirm.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- misc_confirm.c      24 Sep 2005 04:20:24 -0000      1.21
+++ misc_confirm.c      12 Nov 2005 16:54:15 -0000      1.22
@@ -1,4 +1,4 @@
-/* Time-stamp: <2005-09-24 13:17:12 jcs>
+/* Time-stamp: <2005-11-13 01:39:08 jcs>
 |
 |  Copyright (C) 2002-2005 Jorg Schuler <jcsjcs at users sourceforge net>
 |  Part of the gtkpod project.
@@ -541,6 +541,11 @@
                msg = g_strdup_printf (_("Removed all %d tracks from the 
iPod"), n);
                display_reset (0);
            }
+           else if (itdb_playlist_is_podcasts (dd->pl))
+           {
+               msg = g_strdup_printf (_("Removed all podcasts from the iPod"));
+               display_reset (0);
+           }
            else
            {
                /* remove playlist */
@@ -685,6 +690,11 @@
            {
                label = g_strdup_printf (_("Are you sure you want to remove all 
tracks from your iPod?"));
            }
+           else if (itdb_playlist_is_podcasts (pl))
+           {   /* podcasts playlist */
+               dd->selected_tracks = g_list_copy (pl->members);
+               label = g_strdup_printf (_("Are you sure you want to remove all 
podcasts from your iPod?"));
+           }
            else 
            {   /* normal playlist */
                /* we set selected_tracks to get a list printed by

Index: misc_track.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/misc_track.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- misc_track.c        24 Sep 2005 04:20:24 -0000      1.27
+++ misc_track.c        12 Nov 2005 16:54:15 -0000      1.28
@@ -1,4 +1,4 @@
-/* Time-stamp: <2005-09-24 13:17:17 jcs>
+/* Time-stamp: <2005-11-12 23:57:26 jcs>
 |
 |  Copyright (C) 2002-2005 Jorg Schuler <jcsjcs at users sourceforge net>
 |  Part of the gtkpod project.
@@ -647,9 +647,14 @@
 /*         printf ("add tr %p to pl: %p\n", track, pl); */
            if (from_itdb == to_itdb)
            {   /* DND within the same itdb */
+               if (!itdb_playlist_contains_track (to_mpl, track))
+               {   /* add to MPL if not already present (will happen
+                    * if dragged from the podcasts playlist */
+                   gp_playlist_add_track (to_mpl, track, TRUE);
+               }
                if (!itdb_playlist_is_mpl (pl))
-               {   /* not necessary to add to MPL as track has to be
-                    * present already */
+               {
+                   /* add to designated playlist */
                    gp_playlist_add_track (pl, track, TRUE);
                }
            }
@@ -663,11 +668,31 @@
                   same track already exists in the database, the already
                   existing track is returned and @duptr is freed */
                addtr = gp_track_add (to_itdb, duptr);
-               /* check if we need to add to the MPL */
+
                if (addtr == duptr)
-               {
-                   itdb_playlist_add_track (to_mpl, addtr, -1);
+               {   /* no duplicate */
+                   /* we need to add to the MPL if the track is no
+                      duplicate and will not be added to the podcasts
+                      playlist */
+                   if (!itdb_playlist_is_podcasts (pl))
+                   {   /* don't add to mpl if we add to the podcasts
+                          playlist */
+                       gp_playlist_add_track (to_mpl, addtr, TRUE);
+                   }
+               }
+               else
+               {   /* duplicate */
+                   /* we also need to add to the MPL if the track is a
+                      duplicate, does not yet exist in the MPL and will
+                      not be added to a podcast list (this happens if
+                      it's already in the podcast list) */
+                   if ((!itdb_playlist_contains_track (to_mpl, addtr)) &&
+                       (!itdb_playlist_is_podcasts (pl)))
+                   {
+                       gp_playlist_add_track (to_mpl, addtr, TRUE);
+                   }
                }
+               /* add to designated playlist (if not mpl) */
                if (!itdb_playlist_is_mpl (pl))
                {
                    gp_playlist_add_track (pl, addtr, TRUE);



-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
gtkpod-cvs2 mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to