[evince/gnome-3-24] thumbnailer: Also handle trash and recent files as local files
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince/gnome-3-24] thumbnailer: Also handle trash and recent files as local files
- Date: Mon, 27 Mar 2017 12:35:04 +0000 (UTC)
commit 4ecc65b085e905703ca5df2f0165e961f08a8125
Author: Bastien Nocera <hadess hadess net>
Date: Tue Mar 21 14:07:15 2017 +0100
thumbnailer: Also handle trash and recent files as local files
By searching for the target.
https://bugzilla.gnome.org/show_bug.cgi?id=780351
thumbnailer/evince-thumbnailer.c | 27 ++++++++++++++++++++++++++-
1 files changed, 26 insertions(+), 1 deletions(-)
---
diff --git a/thumbnailer/evince-thumbnailer.c b/thumbnailer/evince-thumbnailer.c
index f9a949a..14b8908 100644
--- a/thumbnailer/evince-thumbnailer.c
+++ b/thumbnailer/evince-thumbnailer.c
@@ -101,6 +101,31 @@ delete_temp_file (GFile *file)
g_object_unref (file);
}
+static char *
+get_target_uri (GFile *file)
+{
+ GFileInfo *info;
+ char *target;
+
+ info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_TARGET_URI, G_FILE_QUERY_INFO_NONE, NULL,
NULL);
+ if (info == NULL)
+ return NULL;
+ target = g_strdup (g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_TARGET_URI));
+ g_object_unref (info);
+
+ return target;
+}
+
+static char *
+get_local_path (GFile *file)
+{
+ if (g_file_has_uri_scheme (file, "trash") != FALSE ||
+ g_file_has_uri_scheme (file, "recent") != FALSE) {
+ return get_target_uri (file);
+ }
+ return g_file_get_path (file);
+}
+
static EvDocument *
evince_thumbnailer_get_document (GFile *file)
{
@@ -109,7 +134,7 @@ evince_thumbnailer_get_document (GFile *file)
GFile *tmp_file = NULL;
GError *error = NULL;
- path = g_file_get_path (file);
+ path = get_local_path (file);
if (!path) {
gchar *base_name, *template;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]