[Xfce4-commits] <tumbler:master> Improve error messages and enforce local files.

Nick Schermer noreply at xfce.org
Thu Nov 3 17:04:05 CET 2011


Updating branch refs/heads/master
         to 848e62fc72259aeda1469f959ec8872a56cfc96f (commit)
       from a4f7caf924447e2c46066a44162d53d268a69106 (commit)

commit 848e62fc72259aeda1469f959ec8872a56cfc96f
Author: Nick Schermer <nick at xfce.org>
Date:   Thu Nov 3 16:54:41 2011 +0100

    Improve error messages and enforce local files.

 plugins/raw-thumbnailer/raw-thumbnailer-provider.c |   17 ++++++-----------
 plugins/raw-thumbnailer/raw-thumbnailer.c          |   15 ++++++++++++++-
 po/POTFILES.in                                     |    2 ++
 3 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/plugins/raw-thumbnailer/raw-thumbnailer-provider.c b/plugins/raw-thumbnailer/raw-thumbnailer-provider.c
index de1b04b..6468b93 100644
--- a/plugins/raw-thumbnailer/raw-thumbnailer-provider.c
+++ b/plugins/raw-thumbnailer/raw-thumbnailer-provider.c
@@ -100,10 +100,10 @@ raw_thumbnailer_provider_init (RawThumbnailerProvider *provider)
 static GList *
 raw_thumbnailer_provider_get_thumbnailers (TumblerThumbnailerProvider *provider)
 {
-  RawThumbnailer *thumbnailer;
-  GList          *thumbnailers = NULL;
-  GStrv           uri_schemes;
-  const gchar    *mime_types[] =
+  RawThumbnailer     *thumbnailer;
+  GList              *thumbnailers = NULL;
+  static const gchar *uri_schemes[] = { "file", NULL };
+  const gchar        *mime_types[] =
   {
     "image/x-adobe-dng",
     "image/x-canon-cr2",
@@ -120,17 +120,12 @@ raw_thumbnailer_provider_get_thumbnailers (TumblerThumbnailerProvider *provider)
     NULL
   };
 
-  /* determine which URI schemes are supported by GIO */
-  uri_schemes = tumbler_util_get_supported_uri_schemes ();
-
   /* create the raw thumbnailer */
   thumbnailer = g_object_new (TYPE_RAW_THUMBNAILER,
-                              "uri-schemes", uri_schemes, "mime-types", mime_types,
+                              "uri-schemes", uri_schemes,
+                              "mime-types", mime_types,
                               NULL);
 
-  /* free URI schemes and MIME types */
-  g_strfreev (uri_schemes);
-
   /* add the thumbnailer to the list */
   thumbnailers = g_list_append (thumbnailers, thumbnailer);
 
diff --git a/plugins/raw-thumbnailer/raw-thumbnailer.c b/plugins/raw-thumbnailer/raw-thumbnailer.c
index 22abefb..06e2bbc 100644
--- a/plugins/raw-thumbnailer/raw-thumbnailer.c
+++ b/plugins/raw-thumbnailer/raw-thumbnailer.c
@@ -176,7 +176,20 @@ raw_thumbnailer_create (TumblerAbstractThumbnailer *thumbnailer,
   /* libopenraw only handles local IO */
   path = g_file_get_path (file);
   if (path != NULL && g_path_is_absolute (path))
-    pixbuf = or_gdkpixbuf_extract_rotated_thumbnail (path, MIN (width, height));
+    {
+      pixbuf = or_gdkpixbuf_extract_rotated_thumbnail (path, MIN (width, height));
+
+      if (pixbuf == NULL)
+        {
+          g_set_error_literal (&error, TUMBLER_ERROR, TUMBLER_ERROR_NO_CONTENT,
+                               _("Thumbnail could not be inferred from file contents"));
+        }
+    }
+  else
+    {
+      g_set_error_literal (&error, TUMBLER_ERROR, TUMBLER_ERROR_UNSUPPORTED,
+                           _("Only local files are supported"));
+    }
 
   g_free (path);
   g_object_unref (file);
diff --git a/po/POTFILES.in b/po/POTFILES.in
index eb5e569..dd9aac7 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -35,6 +35,8 @@ plugins/ffmpeg-thumbnailer/ffmpeg-thumbnailer-plugin.c
 plugins/ffmpeg-thumbnailer/ffmpeg-thumbnailer-provider.c
 plugins/poppler-thumbnailer/poppler-thumbnailer-plugin.c
 plugins/poppler-thumbnailer/poppler-thumbnailer.c
+plugins/raw-thumbnailer/raw-thumbnailer.c
+plugins/raw-thumbnailer/raw-thumbnailer-plugin.c
 plugins/xdg-cache/xdg-cache-thumbnail.c
 plugins/xdg-cache/xdg-cache-plugin.c
 plugins/xdg-cache/xdg-cache-cache.c


More information about the Xfce4-commits mailing list