1
0
mirror of https://github.com/dguglielmi/sunny-overlay.git synced 2025-12-07 02:52:38 +01:00

- Add fix for totem.

This commit is contained in:
2015-05-03 14:25:06 +02:00
parent a9e9aaf986
commit de52f801cf
18 changed files with 879 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
From 734936dbe166526a1e2ebdc1ffebbab64b2216ee Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Tue, 14 Oct 2014 19:30:36 +0200
Subject: bookmarks: Fix thumbnail URL not getting saved
A cut'n'paste error meant that we saved the description instead of
the thumbnail URL in that field.
diff --git a/src/bookmarks/grl-bookmarks.c b/src/bookmarks/grl-bookmarks.c
index d2b4797..b6b49f6 100644
--- a/src/bookmarks/grl-bookmarks.c
+++ b/src/bookmarks/grl-bookmarks.c
@@ -718,7 +718,7 @@ store_bookmark (GrlBookmarksSource *bookmarks_source,
GRLKEYID_TO_POINTER (GRL_METADATA_KEY_DESCRIPTION));
}
if (thumb) {
- g_object_set (G_OBJECT (resource), "thumbnail-url", desc, NULL);
+ g_object_set (G_OBJECT (resource), "thumbnail-url", thumb, NULL);
*keylist = g_list_remove (*keylist,
GRLKEYID_TO_POINTER (GRL_METADATA_KEY_THUMBNAIL));
}
--
cgit v0.10.2

View File

@@ -0,0 +1,76 @@
From a85c242337e90eef5bc9fa272f8f43853deae322 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Tue, 14 Oct 2014 19:32:10 +0200
Subject: bookmarks: Fix updating bookmarks
Our use of gom meant that we always ended up with a new item instead of
updating an existing one. We need to load the item from the DB to be
able to offer that.
diff --git a/src/bookmarks/grl-bookmarks.c b/src/bookmarks/grl-bookmarks.c
index b6b49f6..77ff593 100644
--- a/src/bookmarks/grl-bookmarks.c
+++ b/src/bookmarks/grl-bookmarks.c
@@ -635,6 +635,31 @@ remove_bookmark (GrlBookmarksSource *bookmarks_source,
}
}
+static GomResource *
+find_resource (const gchar *id,
+ GomRepository *repository)
+{
+ GomResource *resource;
+ GomFilter *filter;
+ GValue value = { 0, };
+
+ if (id == NULL)
+ return NULL;
+
+ g_value_init(&value, G_TYPE_INT64);
+ g_value_set_int64 (&value, g_ascii_strtoll (id, NULL, 0));
+ filter = gom_filter_new_eq (BOOKMARKS_TYPE_RESOURCE, "id", &value);
+ g_value_unset(&value);
+
+ resource = gom_repository_find_one_sync (repository,
+ BOOKMARKS_TYPE_RESOURCE,
+ filter,
+ NULL);
+ g_object_unref (filter);
+
+ return resource;
+}
+
static void
store_bookmark (GrlBookmarksSource *bookmarks_source,
GList **keylist,
@@ -659,6 +684,7 @@ store_bookmark (GrlBookmarksSource *bookmarks_source,
GRL_DEBUG ("store_bookmark");
+ str_id = (gchar *) grl_media_get_id (bookmark);
title = grl_media_get_title (bookmark);
url = grl_media_get_url (bookmark);
thumb = grl_media_get_thumbnail (bookmark);
@@ -684,11 +710,14 @@ store_bookmark (GrlBookmarksSource *bookmarks_source,
type = BOOKMARK_TYPE_STREAM;
}
- resource = g_object_new (BOOKMARKS_TYPE_RESOURCE,
- "repository", bookmarks_source->priv->repository,
- "parent", parent_id,
- "type", type,
- NULL);
+ resource = find_resource (str_id, bookmarks_source->priv->repository);
+ if (!resource) {
+ resource = g_object_new (BOOKMARKS_TYPE_RESOURCE,
+ "repository", bookmarks_source->priv->repository,
+ "parent", parent_id,
+ "type", type,
+ NULL);
+ }
if (type == BOOKMARK_TYPE_STREAM) {
g_object_set (G_OBJECT (resource), "url", url, NULL);
--
cgit v0.10.2

View File

@@ -0,0 +1,85 @@
From ff9afc6bb2d6515c773a77b1d8ed1a985a635b17 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Wed, 26 Nov 2014 15:45:39 +0100
Subject: tracker: Correctly set "title-from-filename"
Tracker usually provides us with a title that's derived from the
filename. Replicate its process to create a title from a filename
to check if the title is actually set from the filename.
This allows the local-metadata plugin to parse it to remove gunk, and
other plugins to override its throwaway title.
https://bugzilla.gnome.org/show_bug.cgi?id=740756
diff --git a/src/tracker/grl-tracker-source-api.c b/src/tracker/grl-tracker-source-api.c
index 8c9fd55..fbc69a3 100644
--- a/src/tracker/grl-tracker-source-api.c
+++ b/src/tracker/grl-tracker-source-api.c
@@ -203,6 +203,39 @@ static GHashTable *grl_tracker_operations;
/**/
static void
+set_title_from_filename (GrlMedia *media)
+{
+ const gchar *url;
+ gchar *path, *display_name, *ext, *title;
+ guint suffix_len;
+
+ url = grl_media_get_url (media);
+ if (url == NULL)
+ return;
+
+ path = g_filename_from_uri (url, NULL, NULL);
+ if (!path)
+ return;
+ display_name = g_filename_display_basename (path);
+ g_free (path);
+ ext = strrchr (display_name, '.');
+ if (!ext)
+ goto out;
+
+ suffix_len = strlen (ext);
+ if (suffix_len != 4 && suffix_len != 5)
+ goto out;
+
+ title = g_strndup (display_name, ext - display_name);
+ if (g_strcmp0 (grl_media_get_title (media), title) == 0)
+ grl_data_set_boolean (GRL_DATA (media), GRL_METADATA_KEY_TITLE_FROM_FILENAME, TRUE);
+ g_free (title);
+
+out:
+ g_free (display_name);
+}
+
+static void
fill_grilo_media_from_sparql (GrlTrackerSource *source,
GrlMedia *media,
TrackerSparqlCursor *cursor,
@@ -402,6 +435,7 @@ get_sparql_type_filter (GrlOperationOptions *options,
fill_grilo_media_from_sparql (GRL_TRACKER_SOURCE (spec->source), \
media, os->cursor, col); \
} \
+ set_title_from_filename (media); \
\
spec->callback (spec->source, \
spec->operation_id, \
@@ -507,6 +541,7 @@ tracker_resolve_cb (GObject *source_object,
fill_grilo_media_from_sparql (GRL_TRACKER_SOURCE (rs->source),
rs->media, cursor, col);
}
+ set_title_from_filename (rs->media);
rs->callback (rs->source, rs->operation_id, rs->media, rs->user_data, NULL);
} else {
@@ -565,6 +600,7 @@ tracker_media_from_uri_cb (GObject *source_object,
fill_grilo_media_from_sparql (GRL_TRACKER_SOURCE (mfus->source),
media, cursor, col);
}
+ set_title_from_filename (media);
mfus->callback (mfus->source, mfus->operation_id, media, mfus->user_data, NULL);
} else {
--
cgit v0.10.2

View File

@@ -0,0 +1,22 @@
From ae10b48dff54a07ea638421554cab207b8bb1ced Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Tue, 2 Dec 2014 18:28:39 +0100
Subject: bookmarks: Only emit "item removed" if actually removed
diff --git a/src/bookmarks/grl-bookmarks.c b/src/bookmarks/grl-bookmarks.c
index 46e9c30..c7f0109 100644
--- a/src/bookmarks/grl-bookmarks.c
+++ b/src/bookmarks/grl-bookmarks.c
@@ -631,7 +631,7 @@ remove_bookmark (GrlBookmarksSource *bookmarks_source,
g_object_unref (resource);
- if (bookmarks_source->priv->notify_changes) {
+ if (*error != NULL && bookmarks_source->priv->notify_changes) {
/* We can improve accuracy computing the parent container of removed
element */
grl_source_notify_change (GRL_SOURCE (bookmarks_source),
--
cgit v0.10.2