[easytag] Automatically match unselected CDDB results



commit cafc9ffc8832ca1826ed986702851eb23050b73c
Author: David King <amigadave amigadave com>
Date:   Mon Jun 27 17:53:36 2016 +0100

    Automatically match unselected CDDB results
    
    In the case that a CDDB result for an individual track does not have an
    associated file, match up the file against the current browser
    selection.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=766499

 src/cddb_dialog.c |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/src/cddb_dialog.c b/src/cddb_dialog.c
index 7a2c9f1..96f7f25 100644
--- a/src/cddb_dialog.c
+++ b/src/cddb_dialog.c
@@ -2522,10 +2522,18 @@ Cddb_Set_Track_Infos_To_File_List (EtCDDBDialog *self)
             ET_File *etfile = NULL;
             guint set_fields;
 
-            /* FIXME: The model could have a NULL ET_File *, in which case the
-             * file should be retrieved from the browser selection instead. */
-            gtk_tree_model_get(GTK_TREE_MODEL(priv->track_list_model), &currentIter,
-                               CDDB_TRACK_LIST_ETFILE, &etfile, -1);
+            gtk_tree_model_get (GTK_TREE_MODEL (priv->track_list_model),
+                                &currentIter, CDDB_TRACK_LIST_ETFILE, &etfile,
+                                -1);
+
+            /* If the row in the model does not already have an ET_File
+             * associated with it, take one from the browser selection. */
+            if (!etfile)
+            {
+                fileIter = (GtkTreeIter*) file_iterlist->data;
+                etfile = et_application_window_browser_get_et_file_from_iter (ET_APPLICATION_WINDOW 
(MainWindow),
+                                                                              fileIter);
+            }
 
             /* Tag fields. */
             set_fields = g_settings_get_flags (MainSettings, "cddb-set-fields");
@@ -2533,7 +2541,7 @@ Cddb_Set_Track_Infos_To_File_List (EtCDDBDialog *self)
             set_et_file_from_cddb_album (etfile, cddbtrackalbum, set_fields,
                                          list_length);
         }
-        else if (cddbtrackalbum && file_iterlist && file_iterlist->data)
+        else if (cddbtrackalbum)
         {
             ET_File *etfile;
             guint set_fields;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]