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

Modified Files:
        details.c display_itdb.c display_itdb.h fileselection.c 
Log Message:
         * details.c: copy artwork_count and _size when copying
artwork, remember last directory




Index: details.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/details.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- details.c   3 Dec 2005 16:36:26 -0000       1.4
+++ details.c   4 Dec 2005 10:24:38 -0000       1.5
@@ -1,4 +1,4 @@
-/* Time-stamp: <2005-12-04 01:10:10 jcs>
+/* Time-stamp: <2005-12-04 19:12:35 jcs>
 |
 |  Copyright (C) 2002-2005 Jorg Schuler <jcsjcs at users sourceforge net>
 |  Part of the gtkpod project.
@@ -172,6 +172,13 @@
 }
 
 
+static void details_writethrough_toggled (GtkCheckButton *button,
+                                         Detail *detail)
+{
+    details_update_buttons (detail);
+}
+
+
 /****** Navigation *****/
 void details_button_first_clicked (GtkCheckButton *button,
                                   Detail *detail)
@@ -276,16 +283,31 @@
 static void details_button_remove_artwork_clicked (GtkButton *button,
                                                   Detail *detail)
 {
-    ExtraTrackData *etr;
-
     g_return_if_fail (detail);
     g_return_if_fail (detail->track);
-    etr = detail->track->userdata;
-    g_return_if_fail (etr);
 
-    gp_track_remove_thumbnails (detail->track);
-    etr->tchanged = TRUE;
-    detail->changed = TRUE;
+    if (details_writethrough (detail))
+    {   /* Remove thumbnail on all tracks */
+       GList *gl;
+       for (gl=detail->tracks; gl; gl=gl->next)
+       {
+           ExtraTrackData *etr;
+           Track *tr = gl->data;
+           g_return_if_fail (tr);
+           etr = tr->userdata;
+           g_return_if_fail (etr);
+
+           etr->tchanged |= gp_track_remove_thumbnails (tr);
+           detail->changed |= etr->tchanged;
+       }
+    }
+    else
+    {   /* Only change current track */
+       ExtraTrackData *etr = detail->track->userdata;
+       g_return_if_fail (etr);
+       etr->tchanged |= gp_track_remove_thumbnails (detail->track);
+       detail->changed |= etr->tchanged;
+    }
 
     details_update_thumbnail (detail);
 
@@ -458,6 +480,8 @@
     {
        itdb_artwork_free (totrack->artwork);
        totrack->artwork = itdb_artwork_duplicate (frtrack->artwork);
+       totrack->artwork_size = frtrack->artwork_size;
+       totrack->artwork_count = frtrack->artwork_count;
        g_free (toetr->thumb_path_locale);
        g_free (toetr->thumb_path_utf8);
        toetr->thumb_path_locale = g_strdup (fretr->thumb_path_locale);
@@ -910,6 +934,8 @@
     etr = detail->track->userdata;
     g_return_if_fail (etr);
 
+    details_update_changed_state (detail);
+
     w = gtkpod_xml_get_widget (detail->xml, "details_button_apply");
     gtk_widget_set_sensitive (w, detail->changed);
 
@@ -921,10 +947,24 @@
 
     w = gtkpod_xml_get_widget (detail->xml,
                               "details_button_remove_artwork");
-    gtk_widget_set_sensitive (w, (detail->track->artwork->thumbnails != NULL));
+    if (!details_writethrough (detail))
+    {
+       gtk_widget_set_sensitive (w, (detail->track->artwork->thumbnails != 
NULL));
+    }
+    else
+    {
+       gboolean sensitive = FALSE;
+       GList *gl;
+       for (gl=detail->tracks; gl && !sensitive; gl=gl->next)
+       {
+           Track *tr = gl->data;
+           g_return_if_fail (tr);
+           sensitive |= (tr->artwork->thumbnails != NULL);
+       }
+       gtk_widget_set_sensitive (w, sensitive);
+    }
 }
 
-
 /* Update the displayed thumbnail */
 static void details_update_thumbnail (Detail *detail)
 {
@@ -1172,6 +1212,13 @@
                      G_CALLBACK (details_button_undo_track_clicked),
                      detail);
 
+    w = gtkpod_xml_get_widget (detail->xml,
+                              "details_checkbutton_writethrough");
+    g_signal_connect (w, "toggled",
+                     G_CALLBACK (details_writethrough_toggled),
+                     detail);
+
+
 
     g_signal_connect (detail->window, "delete_event",
                      G_CALLBACK (details_delete_event), detail);

Index: display_itdb.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/display_itdb.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- display_itdb.c      3 Dec 2005 16:36:26 -0000       1.37
+++ display_itdb.c      4 Dec 2005 10:24:38 -0000       1.38
@@ -1,4 +1,4 @@
-/* Time-stamp: <2005-12-03 02:10:13 jcs>
+/* Time-stamp: <2005-12-04 14:12:38 jcs>
 |
 |  Copyright (C) 2002-2005 Jorg Schuler <jcsjcs at users sourceforge net>
 |  Part of the gtkpod project.
@@ -295,18 +295,28 @@
 }
 
 /* Remove a thumbnail and remove the filename in ExtraTrackData */
-void gp_track_remove_thumbnails (Track *track)
+/* Return value:
+   FALSE: track did not have any thumbnails, so no change was done
+   TRUE: track did have thumbnails which were removed */
+gboolean gp_track_remove_thumbnails (Track *track)
 {
+    gboolean changed=FALSE;
+
     ExtraTrackData *etr;
-    g_return_if_fail (track);
+    g_return_val_if_fail (track, FALSE);
     etr = track->userdata;
-    g_return_if_fail (etr);
+    g_return_val_if_fail (etr, FALSE);
+
+    if (track->artwork->thumbnails)
+       changed = TRUE;
 
     itdb_track_remove_thumbnails (track);
     g_free (etr->thumb_path_locale);
     g_free (etr->thumb_path_utf8);
     etr->thumb_path_locale = g_strdup ("");
     etr->thumb_path_utf8 = g_strdup ("");
+
+    return changed;
 }
 
 

Index: display_itdb.h
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/display_itdb.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- display_itdb.h      3 Dec 2005 16:36:26 -0000       1.22
+++ display_itdb.h      4 Dec 2005 10:24:38 -0000       1.23
@@ -1,4 +1,4 @@
-/* Time-stamp: <2005-12-03 17:39:09 jcs>
+/* Time-stamp: <2005-12-04 14:11:57 jcs>
 |
 |  Copyright (C) 2002-2005 Jorg Schuler <jcsjcs at users sourceforge net>
 |  Part of the gtkpod project.
@@ -126,7 +126,7 @@
 void gp_track_add_extra (Track *track);
 void gp_track_validate_entries (Track *track);
 gboolean gp_track_set_thumbnails (Track *track, const gchar *filename);
-void gp_track_remove_thumbnails (Track *track);
+gboolean gp_track_remove_thumbnails (Track *track);
 
 Playlist *gp_playlist_new (const gchar *title, gboolean spl);
 void gp_playlist_add (iTunesDB *itdb, Playlist *pl, gint32 pos);

Index: fileselection.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/fileselection.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- fileselection.c     28 Nov 2005 16:25:34 -0000      1.3
+++ fileselection.c     4 Dec 2005 10:24:38 -0000       1.4
@@ -1,4 +1,4 @@
-/* Time-stamp: <2005-11-27 19:08:07 jcs>
+/* Time-stamp: <2005-12-04 17:02:33 jcs>
 |
 |  Copyright (C) 2002-2005 Jorg Schuler <jcsjcs at users.sourceforge.net>
 |  Part of the gtkpod project.
@@ -263,6 +263,8 @@
     GtkWidget* fc;  /* The file chooser dialog */
     gint response;  /* The response of the filechooser */
     gchar *filename = NULL; /* The chosen file */
+    const gchar *dir1;
+    gchar *dir2;
 
     /* Create the file chooser, and handle the response */
     fc = gtk_file_chooser_dialog_new (_("Set Cover"),
@@ -275,14 +277,18 @@
                                      NULL);
 
     gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (fc), FALSE);
-    gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (fc),
-                                        prefs_get_last_dir_browse ());
+
+    dir1 = prefs_get_last_dir_browse ();
+    gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (fc), dir1);
 
     response = gtk_dialog_run(GTK_DIALOG(fc));
-       
+
     switch (response)
     {
     case GTK_RESPONSE_ACCEPT:
+       dir2 = gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER (fc));
+       prefs_set_last_dir_browse (dir2);
+       g_free (dir2);
        filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (fc));
        break;
     case GTK_RESPONSE_CANCEL:



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
gtkpod-cvs2 mailing list
gtkpod-cvs2@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to