[rhythmbox] import-dialog: clean up old entries better



commit c8953d3069bd87b32abee3ec99a59dab0c416ce0
Author: Jonathan Matthew <jonathan d14n org>
Date:   Tue Nov 12 22:34:50 2013 +1000

    import-dialog: clean up old entries better
    
    If the previous import job is still running when we get a new
    folder to scan, it'll add any entries that are still working their
    way through the various queues, so we need to delete all its entries
    when it's completely cancelled.

 widgets/rb-import-dialog.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/widgets/rb-import-dialog.c b/widgets/rb-import-dialog.c
index 7c79a05..65472c3 100644
--- a/widgets/rb-import-dialog.c
+++ b/widgets/rb-import-dialog.c
@@ -327,6 +327,10 @@ start_scanning (RBImportDialog *dialog)
 {
        RBTaskList *tasklist;
 
+       rhythmdb_entry_delete_by_type (dialog->priv->db, dialog->priv->entry_type);
+       rhythmdb_entry_delete_by_type (dialog->priv->db, dialog->priv->ignore_type);
+       rhythmdb_commit (dialog->priv->db);
+
        rb_debug ("starting %s", dialog->priv->current_uri);
        dialog->priv->import_job = rhythmdb_import_job_new (dialog->priv->db,
                                                            dialog->priv->entry_type,
@@ -383,10 +387,6 @@ current_folder_changed_cb (GtkFileChooser *chooser, RBImportDialog *dialog)
                rhythmdb_import_job_cancel (dialog->priv->import_job);
        }
 
-       rhythmdb_entry_delete_by_type (dialog->priv->db, dialog->priv->entry_type);
-       rhythmdb_entry_delete_by_type (dialog->priv->db, dialog->priv->ignore_type);
-       rhythmdb_commit (dialog->priv->db);
-
        clear_info_bar (dialog);
 
        source = rb_shell_guess_source_for_uri (dialog->priv->shell, uri);
@@ -396,6 +396,10 @@ current_folder_changed_cb (GtkFileChooser *chooser, RBImportDialog *dialog)
                        char *name;
                        GtkWidget *content;
 
+                       rhythmdb_entry_delete_by_type (dialog->priv->db, dialog->priv->entry_type);
+                       rhythmdb_entry_delete_by_type (dialog->priv->db, dialog->priv->ignore_type);
+                       rhythmdb_commit (dialog->priv->db);
+
                        dialog->priv->info_bar = gtk_info_bar_new ();
                        g_object_set (dialog->priv->info_bar, "hexpand", TRUE, NULL);
 


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