[gnome-kra-ora-thumbnailer/f20] Add patch actually

Yanko Kaneti yaneti at fedoraproject.org
Mon Jan 6 13:56:15 UTC 2014


commit cac93fa1bb1e51316348c6fcce15d5b72731e9af
Author: Yanko Kaneti <yaneti at declera.com>
Date:   Mon Jan 6 15:56:20 2014 +0200

    Add patch actually

 ...eton-to-fix-crash-with-trash-recent-files.patch |   73 ++++++++++++++++++++
 1 files changed, 73 insertions(+), 0 deletions(-)
---
diff --git a/0001-Update-skeleton-to-fix-crash-with-trash-recent-files.patch b/0001-Update-skeleton-to-fix-crash-with-trash-recent-files.patch
new file mode 100644
index 0000000..e4db0b8
--- /dev/null
+++ b/0001-Update-skeleton-to-fix-crash-with-trash-recent-files.patch
@@ -0,0 +1,73 @@
+From 4a6801b7567a2b617b62905cf53e4780a76c148c Mon Sep 17 00:00:00 2001
+From: Bastien Nocera <hadess at hadess.net>
+Date: Mon, 6 Jan 2014 12:46:23 +0100
+Subject: [PATCH] Update skeleton to fix crash with trash/recent files
+
+---
+ gnome-thumbnailer-skeleton.c | 41 ++++++++++++++++++++++++++++++++++++++++-
+ 1 file changed, 40 insertions(+), 1 deletion(-)
+
+diff --git a/gnome-thumbnailer-skeleton.c b/gnome-thumbnailer-skeleton.c
+index b7ec3ec..e4c11a6 100644
+--- a/gnome-thumbnailer-skeleton.c
++++ b/gnome-thumbnailer-skeleton.c
+@@ -34,6 +34,40 @@ static int output_size = 256;
+ static gboolean g_fatal_warnings = FALSE;
+ static char **filenames = NULL;
+ 
++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_target_path (GFile *input)
++{
++	if (g_file_has_uri_scheme (input, "trash") != FALSE ||
++	    g_file_has_uri_scheme (input, "recent") != FALSE) {
++		GFile *file;
++		char *input_uri;
++		char *input_path;
++
++		input_uri = get_target_uri (input);
++		file = g_file_new_for_uri (input_uri);
++		g_free (input_uri);
++		input_path = g_file_get_path (file);
++		g_object_unref (file);
++		return input_path;
++	}
++	return g_file_get_path (input);
++}
++
+ static const GOptionEntry entries[] = {
+ 	{ "size", 's', 0, G_OPTION_ARG_INT, &output_size, "Size of the thumbnail in pixels", NULL },
+ 	{"g-fatal-warnings", 0, 0, G_OPTION_ARG_NONE, &g_fatal_warnings, "Make all warnings fatal", NULL},
+@@ -84,9 +118,14 @@ int main (int argc, char **argv)
+ 	}
+ 
+ 	input = g_file_new_for_commandline_arg (filenames[0]);
+-	input_filename = g_file_get_path (input);
++	input_filename = get_target_path (input);
+ 	g_object_unref (input);
+ 
++	if (input_filename == NULL) {
++		g_warning ("Could not get file path for %s", filenames[0]);
++		return 1;
++	}
++
+ 	output = filenames[1];
+ 
+ #ifdef THUMBNAILER_RETURNS_PIXBUF
+-- 
+1.8.5.2
+


More information about the scm-commits mailing list