[totem/wip/hadess/more-save-file-fixes: 1/4] grilo: Fix removing saved streams



commit 32aeacd9f0980d8021725a5812ffbe5f35c4af90
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Feb 7 10:49:35 2019 +0100

    grilo: Fix removing saved streams
    
    When a cached stream is created in the cache dir after a "Make available
    offline" click, we need to make sure, in delete_foreach() that the file
    is trashed as well as the bookmarks entry removed, otherwise "Make
    available offline" would fail later for that same stream.
    
    Closes: #294

 src/totem-grilo.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/totem-grilo.c b/src/totem-grilo.c
index d0a57e420..50f91a09b 100644
--- a/src/totem-grilo.c
+++ b/src/totem-grilo.c
@@ -2096,6 +2096,7 @@ delete_foreach (gpointer data,
        GtkTreeIter iter;
        GrlSource *source;
        GrlMedia *media;
+       gboolean source_supports_remove;
        gboolean success;
        GError *error = NULL;
 
@@ -2114,13 +2115,18 @@ delete_foreach (gpointer data,
                            MODEL_RESULTS_SOURCE, &source,
                            -1);
 
+       source_supports_remove = (grl_source_supported_operations (source) & GRL_OP_REMOVE);
        success = TRUE;
-       if (grl_source_supported_operations (source) & GRL_OP_REMOVE) {
+
+       if (source_supports_remove) {
                g_debug ("Removing item '%s' through Grilo",
                         grl_media_get_id (media));
                grl_source_remove_sync (source, media, &error);
                success = (error == NULL);
-       } else {
+       }
+
+       if (!source_supports_remove ||
+           g_strcmp0 (grl_source_get_id (source), "grl-bookmarks") == 0) {
                const char *uri;
 
                uri = grl_media_get_url (media);
@@ -2136,6 +2142,7 @@ delete_foreach (gpointer data,
                        g_object_unref (file);
                }
        }
+
        if (!success) {
                g_warning ("Couldn't remove item '%s' (%s): %s",
                           grl_media_get_title (media),


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