[rhythmbox] media-player-source: convert delete_entries to use GTasks



commit 9dbb10870421f3327389c32aa3a0913873857b05
Author: Jonathan Matthew <jonathan d14n org>
Date:   Mon Sep 26 23:22:12 2016 +1000

    media-player-source: convert delete_entries to use GTasks
    
    Previously only the ipod implementation of this was actually asynchronous.
    This part of the sync process doesn't need to be done on the main thread,
    so moving it to a task thread should improve responsiveness a bit.

 plugins/android/rb-android-source.c               |   53 ++++----
 plugins/generic-player/rb-generic-player-source.c |  145 +++++++++++----------
 plugins/ipod/rb-ipod-source.c                     |   60 ++++------
 plugins/mtpdevice/rb-mtp-source.c                 |   81 ++++--------
 sources/rb-media-player-source.c                  |   16 +--
 sources/rb-media-player-source.h                  |   12 +-
 6 files changed, 163 insertions(+), 204 deletions(-)
---
diff --git a/plugins/android/rb-android-source.c b/plugins/android/rb-android-source.c
index 2d905d2..19c2d62 100644
--- a/plugins/android/rb-android-source.c
+++ b/plugins/android/rb-android-source.c
@@ -409,6 +409,12 @@ ensure_loaded (RBAndroidSource *source)
        return FALSE;
 }
 
+static void
+delete_data_destroy (gpointer data)
+{
+       g_list_free_full (data, (GDestroyNotify) rhythmdb_entry_unref);
+}
+
 
 static gboolean
 can_delete_directory (RBAndroidSource *source, GFile *dir)
@@ -438,18 +444,19 @@ can_delete_directory (RBAndroidSource *source, GFile *dir)
 }
 
 static void
-delete_entries (RBAndroidSource *source, GList *entries)
+delete_entries_task (GTask *task, gpointer source_object, gpointer task_data, GCancellable *cancellable)
 {
+       RBAndroidSource *source = RB_ANDROID_SOURCE (source_object);
        RBAndroidSourcePrivate *priv = GET_PRIVATE (source);
-       GList *tem;
+       GList *l;
 
-       for (tem = entries; tem != NULL; tem = tem->next) {
+       for (l = task_data; l != NULL; l = l->next) {
                RhythmDBEntry *entry;
                const char *uri;
                GFile *file;
                GFile *dir;
 
-               entry = tem->data;
+               entry = l->data;
                uri = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION);
                file = g_file_new_for_uri (uri);
                g_file_delete (file, NULL, NULL);
@@ -480,6 +487,21 @@ delete_entries (RBAndroidSource *source, GList *entries)
        }
 
        rhythmdb_commit (priv->db);
+
+       g_task_return_boolean (task, TRUE);
+       g_object_unref (task);
+}
+
+static void
+impl_delete_entries (RBMediaPlayerSource *source, GList *entries, GAsyncReadyCallback callback, gpointer 
data)
+{
+       GTask *task;
+       GList *task_entries;
+
+       task = g_task_new (source, NULL, callback, data);
+       task_entries = g_list_copy_deep (entries, (GCopyFunc) rhythmdb_entry_ref, NULL);
+       g_task_set_task_data (task, task_entries, delete_data_destroy);
+       g_task_run_in_thread (task, delete_entries_task);
 }
 
 static void
@@ -543,24 +565,6 @@ impl_get_entries (RBMediaPlayerSource *source,
        g_object_unref (model);
 }
 
-static void
-impl_delete_entries (RBMediaPlayerSource *source,
-                    GList *entries,
-                    RBMediaPlayerSourceDeleteCallback callback,
-                    gpointer callback_data,
-                    GDestroyNotify destroy_data)
-{
-       delete_entries (RB_ANDROID_SOURCE (source), entries);
-
-       if (callback) {
-               callback (source, callback_data);
-       }
-       if (destroy_data) {
-               destroy_data (callback_data);
-       }
-}
-
-
 static guint64
 impl_get_capacity (RBMediaPlayerSource *source)
 {
@@ -610,9 +614,8 @@ impl_delete_selected (RBSource *source)
        view = rb_source_get_entry_view (source);
        sel = rb_entry_view_get_selected_entries (view);
 
-       delete_entries (RB_ANDROID_SOURCE (source), sel);
-       g_list_foreach (sel, (GFunc)rhythmdb_entry_unref, NULL);
-       g_list_free (sel);
+       impl_delete_entries (RB_MEDIA_PLAYER_SOURCE (source), sel, NULL, NULL);
+       g_list_free_full (sel, (GDestroyNotify) rhythmdb_entry_unref);
 }
 
 
diff --git a/plugins/generic-player/rb-generic-player-source.c 
b/plugins/generic-player/rb-generic-player-source.c
index 4256704..03e5991 100644
--- a/plugins/generic-player/rb-generic-player-source.c
+++ b/plugins/generic-player/rb-generic-player-source.c
@@ -94,9 +94,8 @@ static guint64 impl_get_free_space (RBMediaPlayerSource *source);
 static void impl_get_entries (RBMediaPlayerSource *source, const char *category, GHashTable *map);
 static void impl_delete_entries (RBMediaPlayerSource *source,
                                 GList *entries,
-                                RBMediaPlayerSourceDeleteCallback callback,
-                                gpointer data,
-                                GDestroyNotify destroy_data);
+                                GAsyncReadyCallback callback,
+                                gpointer data);
 static void impl_show_properties (RBMediaPlayerSource *source, GtkWidget *info_box, GtkWidget *notebook);
 static void impl_add_playlist (RBMediaPlayerSource *source, char *name, GList *entries);
 static void impl_remove_playlists (RBMediaPlayerSource *source);
@@ -949,59 +948,6 @@ can_delete_directory (RBGenericPlayerSource *source, GFile *dir)
        return result;
 }
 
-void
-rb_generic_player_source_delete_entries (RBGenericPlayerSource *source, GList *entries)
-{
-       RBGenericPlayerSourcePrivate *priv = GET_PRIVATE (source);
-       GList *tem;
-
-       if (priv->read_only != FALSE)
-               return;
-
-       for (tem = entries; tem != NULL; tem = tem->next) {
-               RhythmDBEntry *entry;
-               const char *uri;
-               GFile *file;
-               GFile *dir;
-
-               entry = tem->data;
-               uri = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION);
-               file = g_file_new_for_uri (uri);
-               g_file_delete (file, NULL, NULL);
-
-               /* now walk up the directory structure and delete empty dirs
-                * until we reach the root or one of the device's audio folders.
-                */
-               dir = g_file_get_parent (file);
-               while (can_delete_directory (source, dir)) {
-                       GFile *parent;
-                       char *path;
-
-                       path = g_file_get_path (dir);
-                       rb_debug ("trying to delete %s", path);
-                       g_free (path);
-
-                       if (g_file_delete (dir, NULL, NULL) == FALSE) {
-                               break;
-                       }
-
-                       parent = g_file_get_parent (dir);
-                       if (parent == NULL) {
-                               break;
-                       }
-                       g_object_unref (dir);
-                       dir = parent;
-               }
-
-               g_object_unref (dir);
-               g_object_unref (file);
-
-               rhythmdb_entry_delete (priv->db, entry);
-       }
-
-       rhythmdb_commit (priv->db);
-}
-
 static void
 impl_delete_selected (RBSource *source)
 {
@@ -1011,9 +957,8 @@ impl_delete_selected (RBSource *source)
        view = rb_source_get_entry_view (source);
        sel = rb_entry_view_get_selected_entries (view);
 
-       rb_generic_player_source_delete_entries (RB_GENERIC_PLAYER_SOURCE (source), sel);
-       g_list_foreach (sel, (GFunc)rhythmdb_entry_unref, NULL);
-       g_list_free (sel);
+       impl_delete_entries (RB_MEDIA_PLAYER_SOURCE (source), sel, NULL, NULL);
+       g_list_free_full (sel, (GDestroyNotify) rhythmdb_entry_unref);
 }
 
 
@@ -1294,20 +1239,82 @@ impl_get_entries (RBMediaPlayerSource *source,
 }
 
 static void
+delete_data_destroy (gpointer data)
+{
+       g_list_free_full (data, (GDestroyNotify) rhythmdb_entry_unref);
+}
+
+static void
+delete_entries_task (GTask *task, gpointer source_object, gpointer task_data, GCancellable *cancellable)
+{
+       RBGenericPlayerSource *source = RB_GENERIC_PLAYER_SOURCE (source_object);
+       RBGenericPlayerSourcePrivate *priv = GET_PRIVATE (source);
+       GList *l;
+
+       for (l = task_data; l != NULL; l = l->next) {
+               RhythmDBEntry *entry;
+               const char *uri;
+               GFile *file;
+               GFile *dir;
+
+               entry = l->data;
+               uri = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION);
+               file = g_file_new_for_uri (uri);
+               g_file_delete (file, NULL, NULL);
+
+               /* now walk up the directory structure and delete empty dirs
+                * until we reach the root or one of the device's audio folders.
+                */
+               dir = g_file_get_parent (file);
+               while (can_delete_directory (source, dir)) {
+                       GFile *parent;
+                       char *path;
+
+                       path = g_file_get_path (dir);
+                       rb_debug ("trying to delete %s", path);
+                       g_free (path);
+
+                       if (g_file_delete (dir, NULL, NULL) == FALSE) {
+                               break;
+                       }
+
+                       parent = g_file_get_parent (dir);
+                       if (parent == NULL) {
+                               break;
+                       }
+                       g_object_unref (dir);
+                       dir = parent;
+               }
+
+               g_object_unref (dir);
+               g_object_unref (file);
+
+               rhythmdb_entry_delete (priv->db, entry);
+       }
+
+       rhythmdb_commit (priv->db);
+
+       g_task_return_boolean (task, TRUE);
+       g_object_unref (task);
+}
+
+static void
 impl_delete_entries (RBMediaPlayerSource *source,
                     GList *entries,
-                    RBMediaPlayerSourceDeleteCallback callback,
-                    gpointer callback_data,
-                    GDestroyNotify destroy_data)
+                    GAsyncReadyCallback callback,
+                    gpointer data)
 {
-       rb_generic_player_source_delete_entries (RB_GENERIC_PLAYER_SOURCE (source), entries);
+       RBGenericPlayerSourcePrivate *priv = GET_PRIVATE (source);
+       GTask *task;
+       GList *task_entries;
 
-       if (callback) {
-               callback (source, callback_data);
-       }
-       if (destroy_data) {
-               destroy_data (callback_data);
-       }
+       if (priv->read_only != FALSE)
+               return;
+
+       task = g_task_new (source, NULL, callback, data);
+       task_entries = g_list_copy_deep (entries, (GCopyFunc) rhythmdb_entry_ref, NULL);
+       g_task_set_task_data (task, task_entries, delete_data_destroy);
+       g_task_run_in_thread (task, delete_entries_task);
 }
 
 
diff --git a/plugins/ipod/rb-ipod-source.c b/plugins/ipod/rb-ipod-source.c
index 8a02890..be8b268 100644
--- a/plugins/ipod/rb-ipod-source.c
+++ b/plugins/ipod/rb-ipod-source.c
@@ -93,7 +93,7 @@ static gchar* ipod_path_from_unix_path (const gchar *mount_point,
 static guint64 impl_get_capacity (RBMediaPlayerSource *source);
 static guint64 impl_get_free_space (RBMediaPlayerSource *source);
 static void impl_get_entries (RBMediaPlayerSource *source, const char *category, GHashTable *map);
-static void impl_delete_entries (RBMediaPlayerSource *source, GList *entries, 
RBMediaPlayerSourceDeleteCallback callback, gpointer callback_data, GDestroyNotify destroy_data);
+static void impl_delete_entries (RBMediaPlayerSource *source, GList *entries, GAsyncReadyCallback callback, 
gpointer callback_data);
 static void impl_add_playlist (RBMediaPlayerSource *source, gchar *name, GList *entries);
 static void impl_remove_playlists (RBMediaPlayerSource *source);
 static void impl_show_properties (RBMediaPlayerSource *source, GtkWidget *info_box, GtkWidget *notebook);
@@ -1284,49 +1284,39 @@ rb_ipod_load_songs (RBiPodSource *source)
        }
 }
 
-typedef struct {
-       RBMediaPlayerSource *source;
-       RBMediaPlayerSourceDeleteCallback callback;
-       gpointer callback_data;
-       GDestroyNotify destroy_data;
-       GList *files;
-} DeleteFileData;
-
-static gboolean
-delete_done_cb (DeleteFileData *data)
+static void
+delete_destroy_data (gpointer data)
 {
-       if (data->callback) {
-               data->callback (data->source, data->callback_data);
-       }
-       if (data->destroy_data) {
-               data->destroy_data (data->callback_data);
-       }
-       g_object_unref (data->source);
-       rb_list_deep_free (data->files);
-       return FALSE;
+       g_list_free_full (data, (GDestroyNotify) g_free);
 }
 
-static gpointer
-delete_thread (DeleteFileData *data)
+static void
+delete_task (GTask *task, gpointer source_object, gpointer task_data, GCancellable *cancellable)
 {
+       GList *filenames;
        GList *i;
-       rb_debug ("deleting %d files", g_list_length (data->files));
-       for (i = data->files; i != NULL; i = i->next) {
+
+       filenames = task_data;
+       rb_debug ("deleting %d files", g_list_length (filenames));
+       for (i = filenames; i != NULL; i = i->next) {
                g_unlink ((const char *)i->data);
        }
-       rb_debug ("done deleting %d files", g_list_length (data->files));
-       g_idle_add ((GSourceFunc) delete_done_cb, data);
-       return NULL;
+       rb_debug ("done deleting %d files", g_list_length (filenames));
+       g_task_return_boolean (task, TRUE);
+       g_object_unref (task);
 }
 
 static void
-impl_delete_entries (RBMediaPlayerSource *source, GList *entries, RBMediaPlayerSourceDeleteCallback 
callback, gpointer cb_data, GDestroyNotify destroy_data)
+impl_delete_entries (RBMediaPlayerSource *source,
+                    GList *entries,
+                    GAsyncReadyCallback callback,
+                    gpointer data)
 {
        RBiPodSourcePrivate *priv = IPOD_SOURCE_GET_PRIVATE (source);
        RhythmDB *db = get_db_for_source ((RBiPodSource *)source);
        GList *i;
        GList *filenames = NULL;
-       DeleteFileData *data = g_new0 (DeleteFileData, 1);
+       GTask *task;
 
        for (i = entries; i != NULL; i = i->next) {
                const char *uri;
@@ -1355,13 +1345,9 @@ impl_delete_entries (RBMediaPlayerSource *source, GList *entries, RBMediaPlayerS
        rhythmdb_commit (db);
        g_object_unref (db);
 
-       data->source = g_object_ref (source);
-       data->callback = callback;
-       data->callback_data = cb_data;
-       data->destroy_data = destroy_data;
-       data->files = filenames;
-
-       g_thread_new ("ipod-delete", (GThreadFunc) delete_thread, data);
+       task = g_task_new (source, NULL, callback, data);
+       g_task_set_task_data (task, filenames, (GDestroyNotify) delete_destroy_data);
+       g_task_run_in_thread (task, delete_task);
 }
 
 static RBTrackTransferBatch *
@@ -1387,7 +1373,7 @@ impl_delete_selected (RBSource *source)
 
        songs = rb_source_get_entry_view (source);
        sel = rb_entry_view_get_selected_entries (songs);
-       impl_delete_entries (RB_MEDIA_PLAYER_SOURCE (source), sel, NULL, NULL, NULL);
+       impl_delete_entries (RB_MEDIA_PLAYER_SOURCE (source), sel, NULL, NULL);
        rb_list_destroy_free (sel, (GDestroyNotify) rhythmdb_entry_unref);
 }
 
diff --git a/plugins/mtpdevice/rb-mtp-source.c b/plugins/mtpdevice/rb-mtp-source.c
index 83104a1..8441821 100644
--- a/plugins/mtpdevice/rb-mtp-source.c
+++ b/plugins/mtpdevice/rb-mtp-source.c
@@ -106,9 +106,8 @@ static guint64              impl_get_capacity       (RBMediaPlayerSource *source);
 static guint64         impl_get_free_space     (RBMediaPlayerSource *source);
 static void            impl_delete_entries     (RBMediaPlayerSource *source,
                                                 GList *entries,
-                                                RBMediaPlayerSourceDeleteCallback callback,
-                                                gpointer callback_data,
-                                                GDestroyNotify destroy_data);
+                                                GAsyncReadyCallback callback,
+                                                gpointer callback_data);
 static void            impl_show_properties    (RBMediaPlayerSource *source, GtkWidget *info_box, GtkWidget 
*notebook);
 
 static void prepare_player_source_cb (RBPlayer *player,
@@ -1056,8 +1055,8 @@ impl_delete_selected (RBSource *source)
 
        songs = rb_source_get_entry_view (source);
        sel = rb_entry_view_get_selected_entries (songs);
-       impl_delete_entries (RB_MEDIA_PLAYER_SOURCE (source), sel, NULL, NULL, NULL);
-       rb_list_destroy_free (sel, (GDestroyNotify) rhythmdb_entry_unref);
+       impl_delete_entries (RB_MEDIA_PLAYER_SOURCE (source), sel, NULL, NULL);
+       g_list_free_full (sel, (GDestroyNotify) rhythmdb_entry_unref);
 }
 
 static gboolean
@@ -1362,50 +1361,22 @@ impl_get_free_space     (RBMediaPlayerSource *source)
        return priv->free_space;
 }
 
-typedef struct {
-       gboolean actually_free;
-       GHashTable *check_folders;
-       RBMediaPlayerSource *source;
-       RBMediaPlayerSourceDeleteCallback callback;
-       gpointer callback_data;
-       GDestroyNotify destroy_data;
-} TracksDeletedCallbackData;
-
 static void
-free_delete_data (TracksDeletedCallbackData *data)
+delete_destroy_data (gpointer data)
 {
-       if (data->actually_free == FALSE) {
-               return;
-       }
-
-       g_hash_table_destroy (data->check_folders);
-       g_object_unref (data->source);
-       if (data->destroy_data) {
-               data->destroy_data (data->callback_data);
-       }
-       g_free (data);
-}
-
-static gboolean
-delete_done_idle_cb (TracksDeletedCallbackData *data)
-{
-       if (data->callback) {
-               data->callback (data->source, data->callback_data);
-       }
-
-       data->actually_free = TRUE;
-       free_delete_data (data);
-       return FALSE;
+       GTask *task = data;
+       g_task_return_boolean (task, FALSE);
+       g_object_unref (task);
 }
 
 static void
-delete_done_cb (LIBMTP_mtpdevice_t *device, TracksDeletedCallbackData *data)
+delete_done_cb (LIBMTP_mtpdevice_t *device, GTask *task)
 {
+       GHashTable *check_folders = g_task_get_task_data (task);
        LIBMTP_folder_t *folders;
        LIBMTP_file_t *files;
 
-       data->actually_free = FALSE;
-       update_free_space_cb (device, RB_MTP_SOURCE (data->source));
+       update_free_space_cb (device, RB_MTP_SOURCE (g_task_get_source_object (task)));
 
        /* if any of the folders we just deleted from are now empty, delete them */
        folders = LIBMTP_Get_Folder_List (device);
@@ -1413,7 +1384,7 @@ delete_done_cb (LIBMTP_mtpdevice_t *device, TracksDeletedCallbackData *data)
        if (folders != NULL) {
                GHashTableIter iter;
                gpointer key;
-               g_hash_table_iter_init (&iter, data->check_folders);
+               g_hash_table_iter_init (&iter, check_folders);
                while (g_hash_table_iter_next (&iter, &key, NULL)) {
                        LIBMTP_folder_t *f;
                        LIBMTP_folder_t *c;
@@ -1430,7 +1401,7 @@ delete_done_cb (LIBMTP_mtpdevice_t *device, TracksDeletedCallbackData *data)
 
                                /* don't delete folders with children that we didn't just delete */
                                for (c = f->child; c != NULL; c = c->sibling) {
-                                       if (g_hash_table_lookup (data->check_folders,
+                                       if (g_hash_table_lookup (check_folders,
                                                                 GUINT_TO_POINTER (c->folder_id)) == NULL) {
                                                break;
                                        }
@@ -1481,27 +1452,25 @@ delete_done_cb (LIBMTP_mtpdevice_t *device, TracksDeletedCallbackData *data)
                files = n;
        }
 
-       g_idle_add ((GSourceFunc) delete_done_idle_cb, data);
+       g_task_return_boolean (task, TRUE);
+       g_object_unref (task);
 }
 
 static void
 impl_delete_entries    (RBMediaPlayerSource *source,
                         GList *entries,
-                        RBMediaPlayerSourceDeleteCallback callback,
-                        gpointer user_data,
-                        GDestroyNotify destroy_data)
+                        GAsyncReadyCallback callback,
+                        gpointer user_data)
 {
        RBMtpSourcePrivate *priv = MTP_SOURCE_GET_PRIVATE (source);
        RhythmDB *db;
        GList *i;
-       TracksDeletedCallbackData *cb_data;
+       GHashTable *check_folders;
+       GTask *task;
 
-       cb_data = g_new0 (TracksDeletedCallbackData, 1);
-       cb_data->source = g_object_ref (source);
-       cb_data->callback_data = user_data;
-       cb_data->callback = callback;
-       cb_data->destroy_data = destroy_data;
-       cb_data->check_folders = g_hash_table_new (g_direct_hash, g_direct_equal);
+       task = g_task_new (source, NULL, callback, user_data);
+       check_folders = g_hash_table_new (g_direct_hash, g_direct_equal);
+       g_task_set_task_data (task, check_folders, (GDestroyNotify) g_hash_table_destroy);
 
        db = get_db_for_source (RB_MTP_SOURCE (source));
        for (i = entries; i != NULL; i = i->next) {
@@ -1524,7 +1493,7 @@ impl_delete_entries       (RBMediaPlayerSource *source,
                }
                rb_mtp_thread_delete_track (priv->device_thread, track);
 
-               g_hash_table_insert (cb_data->check_folders,
+               g_hash_table_insert (check_folders,
                                     GUINT_TO_POINTER (track->parent_id),
                                     GINT_TO_POINTER (1));
 
@@ -1535,8 +1504,8 @@ impl_delete_entries       (RBMediaPlayerSource *source,
        /* callback when all tracks have been deleted */
        rb_mtp_thread_queue_callback (priv->device_thread,
                                      (RBMtpThreadCallback) delete_done_cb,
-                                     cb_data,
-                                     (GDestroyNotify) free_delete_data);
+                                     task,
+                                     delete_destroy_data);
 
        rhythmdb_commit (db);
 }
diff --git a/sources/rb-media-player-source.c b/sources/rb-media-player-source.c
index 68865c9..cb8eade 100644
--- a/sources/rb-media-player-source.c
+++ b/sources/rb-media-player-source.c
@@ -498,19 +498,17 @@ rb_media_player_source_get_entries (RBMediaPlayerSource *source,
  * @source: the #RBMediaPlayerSource
  * @entries: (element-type RB.RhythmDBEntry) (transfer full): list of entries to delete
  * @callback: callback to call on completion
- * @data: (closure) (scope notified): data for callback
- * @destroy_data: callback to free the callback data
+ * @data: data for callback
  */
 void
 rb_media_player_source_delete_entries  (RBMediaPlayerSource *source,
                                         GList *entries,
-                                        RBMediaPlayerSourceDeleteCallback callback,
-                                        gpointer data,
-                                        GDestroyNotify destroy_data)
+                                        GAsyncReadyCallback callback,
+                                        gpointer data)
 {
        RBMediaPlayerSourceClass *klass = RB_MEDIA_PLAYER_SOURCE_GET_CLASS (source);
 
-       klass->delete_entries (source, entries, callback, data, destroy_data);
+       klass->delete_entries (source, entries, callback, data);
 }
 
 static void
@@ -755,8 +753,9 @@ transfer_batch_cancelled_cb (RBTrackTransferBatch *batch, RBMediaPlayerSource *s
 
 
 static void
-sync_delete_done_cb (RBMediaPlayerSource *source, gpointer dontcare)
+sync_delete_done_cb (GObject *source_object, GAsyncResult *result, gpointer data)
 {
+       RBMediaPlayerSource *source = RB_MEDIA_PLAYER_SOURCE (source_object);
        RBMediaPlayerSourcePrivate *priv = MEDIA_PLAYER_SOURCE_GET_PRIVATE (source);
        rb_debug ("finished deleting %d files from media player", priv->sync_state->sync_remove_count);
 
@@ -955,8 +954,7 @@ sync_idle_delete_entries (RBMediaPlayerSource *source)
        rb_debug ("deleting %d files from media player", priv->sync_state->sync_remove_count);
        rb_media_player_source_delete_entries (source,
                                               priv->sync_state->sync_to_remove,
-                                              (RBMediaPlayerSourceDeleteCallback) sync_delete_done_cb,
-                                              NULL,
+                                              sync_delete_done_cb,
                                               NULL);
        return FALSE;
 }
diff --git a/sources/rb-media-player-source.h b/sources/rb-media-player-source.h
index c24c93f..67a34f9 100644
--- a/sources/rb-media-player-source.h
+++ b/sources/rb-media-player-source.h
@@ -56,8 +56,6 @@ typedef struct _RBMediaPlayerSourceClass RBMediaPlayerSourceClass;
 typedef struct _RhythmDBEntryType RBMediaPlayerEntryType;
 typedef struct _RhythmDBEntryTypeClass RBMediaPlayerEntryTypeClass;
 
-typedef void (*RBMediaPlayerSourceDeleteCallback) (RBMediaPlayerSource *source, gpointer data);
-
 struct _RBMediaPlayerSource
 {
        RBBrowserSource parent_instance;
@@ -73,9 +71,8 @@ struct _RBMediaPlayerSourceClass
        guint64         (*get_free_space)       (RBMediaPlayerSource *source);
        void            (*delete_entries)       (RBMediaPlayerSource *source,
                                                 GList *entries,
-                                                RBMediaPlayerSourceDeleteCallback callback,
-                                                gpointer data,
-                                                GDestroyNotify destroy_data);
+                                                GAsyncReadyCallback callback,
+                                                gpointer data);
        void            (*add_playlist) (RBMediaPlayerSource *source, gchar *name, GList *entries);
        void            (*remove_playlists) (RBMediaPlayerSource *source);
        void            (*show_properties)      (RBMediaPlayerSource *source, GtkWidget *info_box, GtkWidget 
*notebook);
@@ -95,9 +92,8 @@ void  rb_media_player_source_get_entries      (RBMediaPlayerSource *source,
 
 void   rb_media_player_source_delete_entries   (RBMediaPlayerSource *source,
                                                 GList *entries,
-                                                RBMediaPlayerSourceDeleteCallback callback,
-                                                gpointer data,
-                                                GDestroyNotify destroy_data);
+                                                GAsyncReadyCallback callback,
+                                                gpointer data);
 
 void   rb_media_player_source_show_properties (RBMediaPlayerSource *source);
 


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