[Xfce4-commits] <tumbler:master> Always add "file" to the supported URI schemes. Fix compiler warnings.
Jannis Pohlmann
noreply at xfce.org
Wed Sep 30 14:50:01 CEST 2009
Updating branch refs/heads/master
to 7d6875461d59e7b7c558f5586ceb4df92b3c57a9 (commit)
from 5162982c8acaaf3b7677e0627e9fc4a757ac9213 (commit)
commit 7d6875461d59e7b7c558f5586ceb4df92b3c57a9
Author: Jannis Pohlmann <jannis at xfce.org>
Date: Wed Sep 30 14:48:25 2009 +0200
Always add "file" to the supported URI schemes. Fix compiler warnings.
There's a bug in GIO/GVfs which doesn't include "file" in the URI
schemes returned by g_vfs_get_supported_uri_schemes(). Bug filed
upstream on http://bugzilla.gnome.org/show_bug.cgi?id=596867.
.../font-thumbnailer/font-thumbnailer-provider.c | 20 +++++++++++++++++-
plugins/font-thumbnailer/font-thumbnailer.c | 4 +-
.../pixbuf-thumbnailer-provider.c | 21 ++++++++++++++++---
3 files changed, 37 insertions(+), 8 deletions(-)
diff --git a/plugins/font-thumbnailer/font-thumbnailer-provider.c b/plugins/font-thumbnailer/font-thumbnailer-provider.c
index 487646f..4e5b669 100644
--- a/plugins/font-thumbnailer/font-thumbnailer-provider.c
+++ b/plugins/font-thumbnailer/font-thumbnailer-provider.c
@@ -111,14 +111,27 @@ font_thumbnailer_provider_get_thumbnailers (TumblerThumbnailerProvider *provider
"application/x-font-type1",
NULL,
};
- const gchar *const *uri_schemes;
+ const gchar *const *supported_schemes;
FontThumbnailer *thumbnailer;
GList *thumbnailers = NULL;
+ GStrv uri_schemes;
+ guint length;
+ guint n;
GVfs *vfs;
/* determine the URI schemes supported by GIO */
vfs = g_vfs_get_default ();
- uri_schemes = g_vfs_get_supported_uri_schemes (vfs);
+ supported_schemes = g_vfs_get_supported_uri_schemes (vfs);
+
+ /* copy the supported schemes array and add the file scheme, which for
+ * some odd reason is not included by default. Bug filed on
+ * http://bugzilla.gnome.org/show_bug.cgi?id=596867 */
+ length = g_strv_length ((gchar **)supported_schemes);
+ uri_schemes = g_new0 (gchar *, length + 1);
+ uri_schemes[0] = (gchar *)"file";
+ for (n = 0; n < length; ++n)
+ uri_schemes[1+n] = (gchar *)supported_schemes[n];
+ uri_schemes[n] = NULL;
/* create the pixbuf thumbnailer */
thumbnailer = g_object_new (TYPE_FONT_THUMBNAILER,
@@ -128,5 +141,8 @@ font_thumbnailer_provider_get_thumbnailers (TumblerThumbnailerProvider *provider
/* add the thumbnailer to the list */
thumbnailers = g_list_append (thumbnailers, thumbnailer);
+ /* free URI schemes array (not its contents) */
+ g_free (uri_schemes);
+
return thumbnailers;
}
diff --git a/plugins/font-thumbnailer/font-thumbnailer.c b/plugins/font-thumbnailer/font-thumbnailer.c
index d7b089b..958568e 100644
--- a/plugins/font-thumbnailer/font-thumbnailer.c
+++ b/plugins/font-thumbnailer/font-thumbnailer.c
@@ -501,8 +501,8 @@ font_thumbnailer_create (TumblerAbstractThumbnailer *thumbnailer,
g_object_unref (file);
/* try to open the font file */
- ft_error = FT_New_Memory_Face (font_thumbnailer->library, font_data, length,
- 0, &face);
+ ft_error = FT_New_Memory_Face (font_thumbnailer->library, (const FT_Byte *)font_data,
+ length, 0, &face);
if (G_UNLIKELY (ft_error != 0))
{
/* the font file could not be loaded, emit an error signal */
diff --git a/plugins/pixbuf-thumbnailer/pixbuf-thumbnailer-provider.c b/plugins/pixbuf-thumbnailer/pixbuf-thumbnailer-provider.c
index d0deebd..320503a 100644
--- a/plugins/pixbuf-thumbnailer/pixbuf-thumbnailer-provider.c
+++ b/plugins/pixbuf-thumbnailer/pixbuf-thumbnailer-provider.c
@@ -104,7 +104,7 @@ static GList *
pixbuf_thumbnailer_provider_get_thumbnailers (TumblerThumbnailerProvider *provider)
{
PixbufThumbnailer *thumbnailer;
- const gchar *const *uri_schemes;
+ const gchar *const *supported_schemes;
GHashTable *types;
GSList *formats;
GSList *fp;
@@ -113,12 +113,24 @@ pixbuf_thumbnailer_provider_get_thumbnailers (TumblerThumbnailerProvider *provid
GList *thumbnailers = NULL;
GStrv format_types;
GStrv mime_types;
+ GStrv uri_schemes;
GVfs *vfs;
- gint n;
+ guint length;
+ guint n;
/* determine which URI schemes are supported by GIO */
vfs = g_vfs_get_default ();
- uri_schemes = g_vfs_get_supported_uri_schemes (vfs);
+ supported_schemes = g_vfs_get_supported_uri_schemes (vfs);
+
+ /* copy the supported schemes array and add the file scheme, which for
+ * some odd reason is not included by default. Bug filed on
+ * http://bugzilla.gnome.org/show_bug.cgi?id=596867 */
+ length = g_strv_length ((gchar **)supported_schemes);
+ uri_schemes = g_new0 (gchar *, length + 1);
+ uri_schemes[0] = (gchar *)"file";
+ for (n = 0; n < length; ++n)
+ uri_schemes[1+n] = (gchar *)supported_schemes[n];
+ uri_schemes[n] = NULL;
/* create a hash table to collect unique MIME types */
types = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
@@ -165,7 +177,8 @@ pixbuf_thumbnailer_provider_get_thumbnailers (TumblerThumbnailerProvider *provid
"uri-schemes", uri_schemes, "mime-types", mime_types,
NULL);
- /* free MIME types */
+ /* free URI schemes array (not its contents) and MIME types */
+ g_free (uri_schemes);
g_strfreev (mime_types);
/* add the thumbnailer to the list */
More information about the Xfce4-commits
mailing list