[maemo-commits] [maemo-commits] r16435 - in projects/haf/trunk/hildon-thumbnail: . daemon daemon/plugins thumbs
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Fri Oct 17 17:30:54 EEST 2008
- Previous message: [maemo-commits] r16434 - projects/haf/trunk/hildon-thumbnail/thumbs
- Next message: [maemo-commits] r16436 - projects/haf/trunk/hildon-thumbnail
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: pvanhoof Date: 2008-10-17 17:30:50 +0300 (Fri, 17 Oct 2008) New Revision: 16435 Modified: projects/haf/trunk/hildon-thumbnail/ChangeLog projects/haf/trunk/hildon-thumbnail/daemon/hildon-thumbnail-plugin.h projects/haf/trunk/hildon-thumbnail/daemon/manager.xml projects/haf/trunk/hildon-thumbnail/daemon/plugin-runner.c projects/haf/trunk/hildon-thumbnail/daemon/plugins/exec-plugin.c projects/haf/trunk/hildon-thumbnail/daemon/plugins/gdkpixbuf-plugin.c projects/haf/trunk/hildon-thumbnail/daemon/plugins/gstreamer-video-plugin.c projects/haf/trunk/hildon-thumbnail/daemon/thumbnail-manager.c projects/haf/trunk/hildon-thumbnail/daemon/thumbnail-manager.h projects/haf/trunk/hildon-thumbnail/daemon/thumbnailer.c projects/haf/trunk/hildon-thumbnail/daemon/thumbnailer.h projects/haf/trunk/hildon-thumbnail/daemon/thumbnailer.xml projects/haf/trunk/hildon-thumbnail/thumbs/hildon-thumbnail-factory.c projects/haf/trunk/hildon-thumbnail/thumbs/hildon-thumbnail-factory.h projects/haf/trunk/hildon-thumbnail/thumbs/hildon-thumbnail-obj.c Log: 2008-10-17 Philip Van Hoof <philip at codeminded.be> * thumbs/hildon-thumbnail-factory.c * thumbs/hildon-thumbnail-obj.c * thumbs/hildon-thumbnail-factory.h * daemon/hildon-thumbnail-plugin.h * daemon/plugins/gdkpixbuf-plugin.c * daemon/plugins/exec-plugin.c * daemon/plugins/gstreamer-video-plugin.c * daemon/thumbnail-manager.h * daemon/plugin-runner.c * daemon/thumbnailer.c * daemon/thumbnailer.h * daemon/manager.xml * daemon/thumbnailer.xml * daemon/thumbnail-manager.c: VFS and MimeType hinting Modified: projects/haf/trunk/hildon-thumbnail/ChangeLog =================================================================== --- projects/haf/trunk/hildon-thumbnail/ChangeLog 2008-10-17 12:49:03 UTC (rev 16434) +++ projects/haf/trunk/hildon-thumbnail/ChangeLog 2008-10-17 14:30:50 UTC (rev 16435) @@ -1,3 +1,20 @@ +2008-10-17 Philip Van Hoof <philip at codeminded.be> + + * thumbs/hildon-thumbnail-factory.c + * thumbs/hildon-thumbnail-obj.c + * thumbs/hildon-thumbnail-factory.h + * daemon/hildon-thumbnail-plugin.h + * daemon/plugins/gdkpixbuf-plugin.c + * daemon/plugins/exec-plugin.c + * daemon/plugins/gstreamer-video-plugin.c + * daemon/thumbnail-manager.h + * daemon/plugin-runner.c + * daemon/thumbnailer.c + * daemon/thumbnailer.h + * daemon/manager.xml + * daemon/thumbnailer.xml + * daemon/thumbnail-manager.c: VFS and MimeType hinting + 2008-10-16 Philip Van Hoof <philip at codeminded.be> * thumbs/hildon-albumart-obj.c Modified: projects/haf/trunk/hildon-thumbnail/daemon/hildon-thumbnail-plugin.h =================================================================== --- projects/haf/trunk/hildon-thumbnail/daemon/hildon-thumbnail-plugin.h 2008-10-17 12:49:03 UTC (rev 16434) +++ projects/haf/trunk/hildon-thumbnail/daemon/hildon-thumbnail-plugin.h 2008-10-17 14:30:50 UTC (rev 16435) @@ -31,7 +31,7 @@ G_BEGIN_DECLS -typedef void (*register_func) (gpointer self, const gchar *mime_type, GModule *module); +typedef void (*register_func) (gpointer self, const gchar *mime_type, const gchar *VFS_id, GModule *module); GModule * hildon_thumbnail_plugin_load (const gchar *module_name); GStrv hildon_thumbnail_plugin_get_supported (GModule *module); Modified: projects/haf/trunk/hildon-thumbnail/daemon/manager.xml =================================================================== --- projects/haf/trunk/hildon-thumbnail/daemon/manager.xml 2008-10-17 12:49:03 UTC (rev 16434) +++ projects/haf/trunk/hildon-thumbnail/daemon/manager.xml 2008-10-17 14:30:50 UTC (rev 16435) @@ -4,6 +4,7 @@ <method name="Register"> <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/> <arg type="s" name="mime_type" direction="in" /> + <arg type="s" name="VFS_id" direction="in" /> </method> <method name="GetSupported"> <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/> Modified: projects/haf/trunk/hildon-thumbnail/daemon/plugin-runner.c =================================================================== --- projects/haf/trunk/hildon-thumbnail/daemon/plugin-runner.c 2008-10-17 12:49:03 UTC (rev 16434) +++ projects/haf/trunk/hildon-thumbnail/daemon/plugin-runner.c 2008-10-17 14:30:50 UTC (rev 16435) @@ -38,6 +38,12 @@ #define DAEMON_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), TYPE_DAEMON, DaemonClass)) #define DAEMON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_DAEMON, DaemonClass)) +static gchar *module_name; +static gboolean dynamic_register = FALSE; +static gchar *bus_name; +static gchar *bus_path; +static gint timeout = 600; + typedef struct Daemon Daemon; typedef struct DaemonClass DaemonClass; @@ -210,13 +216,13 @@ static void -daemon_register_func (gpointer self, const gchar *mime_type, GModule *module) +daemon_register_func (gpointer self, const gchar *mime_type, const gchar *VFS_id, GModule *module) { GError *nerror = NULL; dbus_g_proxy_call (self, "Register", &nerror, G_TYPE_STRING, - mime_type, + mime_type, VFS_id, G_TYPE_INVALID, G_TYPE_INVALID); @@ -239,7 +245,7 @@ MANAGER_PATH, MANAGER_INTERFACE); - hildon_thumbnail_plugin_do_init (module, &priv->cropping, + hildon_thumbnail_plugin_do_init (module, &priv->cropping, daemon_register_func, manager_proxy, &error); @@ -253,11 +259,6 @@ } -static gchar *module_name; -static gboolean dynamic_register = FALSE; -static gchar *bus_name; -static gchar *bus_path; -static gint timeout = 600; static GOptionEntry entries_daemon[] = { { "module-name", 'm', G_OPTION_FLAG_REVERSE|G_OPTION_FLAG_OPTIONAL_ARG, Modified: projects/haf/trunk/hildon-thumbnail/daemon/plugins/exec-plugin.c =================================================================== --- projects/haf/trunk/hildon-thumbnail/daemon/plugins/exec-plugin.c 2008-10-17 12:49:03 UTC (rev 16434) +++ projects/haf/trunk/hildon-thumbnail/daemon/plugins/exec-plugin.c 2008-10-17 14:30:50 UTC (rev 16435) @@ -399,7 +399,7 @@ supported = hildon_thumbnail_plugin_supported (); if (supported) { while (supported[i] != NULL) { - func (thumbnailer, supported[i], module); + func (thumbnailer, supported[i], "GIO", module); i++; } } Modified: projects/haf/trunk/hildon-thumbnail/daemon/plugins/gdkpixbuf-plugin.c =================================================================== --- projects/haf/trunk/hildon-thumbnail/daemon/plugins/gdkpixbuf-plugin.c 2008-10-17 12:49:03 UTC (rev 16434) +++ projects/haf/trunk/hildon-thumbnail/daemon/plugins/gdkpixbuf-plugin.c 2008-10-17 14:30:50 UTC (rev 16435) @@ -408,7 +408,7 @@ supported = hildon_thumbnail_plugin_supported (); if (supported) { while (supported[i] != NULL) { - func (thumbnailer, supported[i], module); + func (thumbnailer, supported[i], "GIO", module); i++; } } Modified: projects/haf/trunk/hildon-thumbnail/daemon/plugins/gstreamer-video-plugin.c =================================================================== --- projects/haf/trunk/hildon-thumbnail/daemon/plugins/gstreamer-video-plugin.c 2008-10-17 12:49:03 UTC (rev 16434) +++ projects/haf/trunk/hildon-thumbnail/daemon/plugins/gstreamer-video-plugin.c 2008-10-17 14:30:50 UTC (rev 16435) @@ -540,7 +540,7 @@ supported = hildon_thumbnail_plugin_supported (); if (supported) { while (supported[i] != NULL) { - func (thumbnailer, supported[i], module); + func (thumbnailer, supported[i], "GIO", module); i++; } } Modified: projects/haf/trunk/hildon-thumbnail/daemon/thumbnail-manager.c =================================================================== --- projects/haf/trunk/hildon-thumbnail/daemon/thumbnail-manager.c 2008-10-17 12:49:03 UTC (rev 16434) +++ projects/haf/trunk/hildon-thumbnail/daemon/thumbnail-manager.c 2008-10-17 14:30:50 UTC (rev 16435) @@ -58,22 +58,28 @@ }; DBusGProxy* -thumbnail_manager_get_handler (ThumbnailManager *object, const gchar *mime_type) +thumbnail_manager_get_handler (ThumbnailManager *object, const gchar *mime_type, const gchar *VFS_id) { ThumbnailManagerPrivate *priv = THUMBNAIL_MANAGER_GET_PRIVATE (object); DBusGProxy *proxy; + gchar *query = NULL; + if (VFS_id) + query = g_strdup_printf ("%s-%s", mime_type, VFS_id); + g_mutex_lock (priv->mutex); - proxy = g_hash_table_lookup (priv->handlers, mime_type); + proxy = g_hash_table_lookup (priv->handlers, query?query:mime_type); if (proxy) g_object_ref (proxy); g_mutex_unlock (priv->mutex); + g_free (query); + return proxy; } static void -thumbnail_manager_add (ThumbnailManager *object, gchar *mime_type, gchar *name) +thumbnail_manager_add (ThumbnailManager *object, gchar *key, gchar *name) { ThumbnailManagerPrivate *priv = THUMBNAIL_MANAGER_GET_PRIVATE (object); DBusGProxy *mime_proxy; @@ -95,7 +101,7 @@ g_free (path); g_hash_table_replace (priv->handlers, - g_strdup (mime_type), + g_strdup (key), mime_proxy); } @@ -136,9 +142,9 @@ GKeyFile *keyfile; gchar *fullfilen; gchar *value; - GStrv values; + GStrv values, VFS_ids; + GList *all = NULL, *copy; GError *error = NULL; - guint i = 0; guint64 mtime; GFileInfo *info; GFile *file; @@ -181,6 +187,29 @@ continue; } + VFS_ids = g_key_file_get_string_list (keyfile, "D-BUS Thumbnailer", "SupportedVFS", NULL, NULL); + + if (VFS_ids) { + guint t = 0, y; + while (VFS_ids[t] != NULL) { + y = 0; + while (values[y] != NULL) { + gchar *key = g_strdup_printf ("%s-%s", values[y], VFS_ids[t]); + all = g_list_prepend (all, key); + y++; + } + t++; + } + g_strfreev (VFS_ids); + } else { + guint y = 0; + while (values[y] != NULL) { + gchar *key = g_strdup (values[y]); + all = g_list_prepend (all, key); + y++; + } + } + /* Else, get the modificiation time, we'll need it later */ file = g_file_new_for_path (fullfilen); @@ -208,10 +237,12 @@ /* And register it in the temporary hashtable that is being formed */ - while (values[i] != NULL) { + copy = all; + + while (copy) { ValueInfo *info; - info = g_hash_table_lookup (pre, values[i]); + info = g_hash_table_lookup (pre, copy->data); if (!info || info->mtime < mtime) { @@ -231,13 +262,16 @@ info->prio = FALSE; g_hash_table_replace (pre, - g_strdup (values[i]), + g_strdup (copy->data), info); } - i++; + copy = g_list_next (copy); } + g_list_foreach (all, (GFunc) g_free, NULL); + g_list_free (all); + if (info) g_object_unref (info); if (file) @@ -262,21 +296,35 @@ guint i; for (i = 0; i< length; i++) { - ValueInfo *info = g_slice_new (ValueInfo); + GStrv VFS_ids; + guint o = 0; - info->name = g_key_file_get_string (keyfile, mimes[i], "Name", NULL); + VFS_ids = g_key_file_get_string_list (keyfile, mimes[i], "SupportedVFS", NULL, NULL); - /* This is atm unused for items in overrides. */ - - info->mtime = time (NULL); - - /* Items in overrides are prioritized. */ - - info->prio = TRUE; - - g_hash_table_replace (pre, - g_strdup (mimes[i]), - info); + if (VFS_ids) { + while (VFS_ids[o] != NULL) { + ValueInfo *info = g_slice_new (ValueInfo); + info->name = g_key_file_get_string (keyfile, mimes[i], "Name", NULL); + /* This is atm unused for items in overrides. */ + info->mtime = time (NULL); + /* Items in overrides are prioritized. */ + info->prio = TRUE; + g_hash_table_replace (pre, + g_strdup_printf ("%s-%s", mimes[i], VFS_ids[o]), + info); + o++; + } + } else { + ValueInfo *info = g_slice_new (ValueInfo); + info->name = g_key_file_get_string (keyfile, mimes[i], "Name", NULL); + /* This is atm unused for items in overrides. */ + info->mtime = time (NULL); + /* Items in overrides are prioritized. */ + info->prio = TRUE; + g_hash_table_replace (pre, + g_strdup (mimes[i]), + info); + } } g_strfreev (mimes); } @@ -407,7 +455,7 @@ * Consult thumbnail_manager.xml for more information about this custom spec addition. */ void -thumbnail_manager_register (ThumbnailManager *object, gchar *mime_type, DBusGMethodInvocation *context) +thumbnail_manager_register (ThumbnailManager *object, gchar *mime_type, gchar *VFS_id, DBusGMethodInvocation *context) { ThumbnailManagerPrivate *priv = THUMBNAIL_MANAGER_GET_PRIVATE (object); DBusGProxy *mime_proxy; Modified: projects/haf/trunk/hildon-thumbnail/daemon/thumbnail-manager.h =================================================================== --- projects/haf/trunk/hildon-thumbnail/daemon/thumbnail-manager.h 2008-10-17 12:49:03 UTC (rev 16434) +++ projects/haf/trunk/hildon-thumbnail/daemon/thumbnail-manager.h 2008-10-17 14:30:50 UTC (rev 16435) @@ -50,11 +50,11 @@ #define manager_register thumbnail_manager_register #define manager_get_supported thumbnail_manager_get_supported -void thumbnail_manager_register (ThumbnailManager *object, gchar *mime_type, DBusGMethodInvocation *context); +void thumbnail_manager_register (ThumbnailManager *object, gchar *mime_type, gchar *VFS_id, DBusGMethodInvocation *context); void thumbnail_manager_get_supported (ThumbnailManager *object, DBusGMethodInvocation *context); void thumbnail_manager_i_have (ThumbnailManager *object, const gchar *mime_type); -DBusGProxy* thumbnail_manager_get_handler (ThumbnailManager *object, const gchar *mime_type); +DBusGProxy* thumbnail_manager_get_handler (ThumbnailManager *object, const gchar *mime_type, const gchar *VFS_id); void thumbnail_manager_do_stop (void); void thumbnail_manager_do_init (DBusGConnection *connection, ThumbnailManager **thumbnail_manager, GError **error); Modified: projects/haf/trunk/hildon-thumbnail/daemon/thumbnailer.c =================================================================== --- projects/haf/trunk/hildon-thumbnail/daemon/thumbnailer.c 2008-10-17 12:49:03 UTC (rev 16434) +++ projects/haf/trunk/hildon-thumbnail/daemon/thumbnailer.c 2008-10-17 14:30:50 UTC (rev 16435) @@ -74,13 +74,13 @@ static guint signals[LAST_SIGNAL] = { 0, }; void -thumbnailer_register_plugin (Thumbnailer *object, const gchar *mime_type, GModule *plugin) +thumbnailer_register_plugin (Thumbnailer *object, const gchar *mime_type, const gchar *VFS_id, GModule *plugin) { ThumbnailerPrivate *priv = THUMBNAILER_GET_PRIVATE (object); g_mutex_lock (priv->mutex); g_hash_table_insert (priv->plugins, - g_strdup (mime_type), + VFS_id?g_strdup_printf ("%s-%s", mime_type, VFS_id):g_strdup (mime_type), plugin); thumbnail_manager_i_have (priv->manager, mime_type); g_mutex_unlock (priv->mutex); @@ -108,7 +108,7 @@ static void -get_some_file_infos (const gchar *uri, gchar **mime_type, gboolean *has_thumb, GError **error) +get_some_file_infos (const gchar *uri, gchar **mime_type, gchar *mime_hint, gboolean *has_thumb, GError **error) { const gchar *content_type; GFileInfo *info; @@ -126,7 +126,12 @@ if (info) { content_type = g_file_info_get_content_type (info); - *mime_type = content_type?g_strdup (content_type):g_strdup ("unknown/unknown"); + if (content_type) + *mime_type = g_strdup (content_type); + else if (mime_hint) + content_type = g_strdup (mime_hint); + else + content_type = g_strdup ("unknown/unknown"); g_object_unref (info); } @@ -145,7 +150,8 @@ typedef struct { Thumbnailer *object; - GStrv urls; + GStrv urls, mime_types; + gchar *VFS_id; guint num; gboolean unqueued; } WorkTask; @@ -182,7 +188,7 @@ } void -thumbnailer_queue (Thumbnailer *object, GStrv urls, guint handle_to_unqueue, DBusGMethodInvocation *context) +thumbnailer_queue (Thumbnailer *object, GStrv urls, GStrv mime_hints, gchar *VFS_id, guint handle_to_unqueue, DBusGMethodInvocation *context) { ThumbnailerPrivate *priv = THUMBNAILER_GET_PRIVATE (object); WorkTask *task; @@ -190,6 +196,9 @@ dbus_async_return_if_fail (urls != NULL, context); + if (mime_hints) + dbus_async_return_if_fail (g_strv_length (urls) == g_strv_length (mime_hints), context); + task = g_slice_new (WorkTask); keep_alive (); @@ -199,6 +208,16 @@ task->object = g_object_ref (object); task->urls = g_strdupv (urls); + if (mime_hints) + task->mime_types = g_strdupv (mime_hints); + else + task->mime_types = NULL; + + if (VFS_id) + task->VFS_id = g_strdup (VFS_id); + else + task->VFS_id = NULL; + g_mutex_lock (priv->mutex); g_list_foreach (priv->tasks, (GFunc) mark_unqueued, (gpointer) handle_to_unqueue); priv->tasks = g_list_prepend (priv->tasks, task); @@ -226,6 +245,8 @@ ThumbnailerPrivate *priv = THUMBNAILER_GET_PRIVATE (task->object); GHashTable *hash; GStrv urls = task->urls; + GStrv mime_types = task->mime_types; + gchar *VFS_id = task->VFS_id; guint i; GHashTableIter iter; gpointer key, value; @@ -255,7 +276,7 @@ gboolean has_thumb = FALSE; GError *error = NULL; - get_some_file_infos (urls[i], &mime_type, &has_thumb, &error); + get_some_file_infos (urls[i], &mime_type, mime_types?mime_types[i]:NULL, &has_thumb, &error); if (error) { @@ -326,7 +347,7 @@ /* If we have a third party thumbnailer for this mime-type, we * proxy the call */ - proxy = thumbnail_manager_get_handler (priv->manager, mime_type); + proxy = thumbnail_manager_get_handler (priv->manager, mime_type, VFS_id); if (proxy) { GError *error = NULL; @@ -355,9 +376,13 @@ } else { GModule *module; + gchar *query = NULL; + if (VFS_id) + query = g_strdup_printf ("%s-%s", mime_type, VFS_id); + g_mutex_lock (priv->mutex); - module = g_hash_table_lookup (priv->plugins, key); + module = g_hash_table_lookup (priv->plugins, query?query:key); g_mutex_unlock (priv->mutex); if (module) { @@ -402,6 +427,10 @@ g_object_unref (task->object); g_strfreev (task->urls); + if (task->mime_types) + g_strfreev (task->mime_types); + g_free (task->VFS_id); + g_slice_free (WorkTask, task); return; Modified: projects/haf/trunk/hildon-thumbnail/daemon/thumbnailer.h =================================================================== --- projects/haf/trunk/hildon-thumbnail/daemon/thumbnailer.h 2008-10-17 12:49:03 UTC (rev 16434) +++ projects/haf/trunk/hildon-thumbnail/daemon/thumbnailer.h 2008-10-17 14:30:50 UTC (rev 16435) @@ -57,13 +57,13 @@ GType thumbnailer_get_type (void); -void thumbnailer_queue (Thumbnailer *object, GStrv urls, guint handle_to_unqueue, DBusGMethodInvocation *context); +void thumbnailer_queue (Thumbnailer *object, GStrv urls, GStrv mime_hints, gchar *VFS_id, guint handle_to_unqueue, DBusGMethodInvocation *context); void thumbnailer_unqueue (Thumbnailer *object, guint handle, DBusGMethodInvocation *context); void thumbnailer_move (Thumbnailer *object, GStrv from_urls, GStrv to_urls, DBusGMethodInvocation *context); void thumbnailer_copy (Thumbnailer *object, GStrv from_urls, GStrv to_urls, DBusGMethodInvocation *context); void thumbnailer_delete (Thumbnailer *object, GStrv urls, DBusGMethodInvocation *context); -void thumbnailer_register_plugin (Thumbnailer *object, const gchar *mime_type, GModule *plugin); +void thumbnailer_register_plugin (Thumbnailer *object, const gchar *mime_type, const gchar *VFS_id, GModule *plugin); void thumbnailer_unregister_plugin (Thumbnailer *object, GModule *plugin); void thumbnailer_do_stop (void); Modified: projects/haf/trunk/hildon-thumbnail/daemon/thumbnailer.xml =================================================================== --- projects/haf/trunk/hildon-thumbnail/daemon/thumbnailer.xml 2008-10-17 12:49:03 UTC (rev 16434) +++ projects/haf/trunk/hildon-thumbnail/daemon/thumbnailer.xml 2008-10-17 14:30:50 UTC (rev 16435) @@ -5,6 +5,8 @@ <method name="Queue"> <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/> <arg type="as" name="uris" direction="in" /> + <arg type="as" name="mime_hints" direction="in" /> + <arg type="s" name="VFS_id" direction="in" /> <arg type="u" name="handle_to_unqueue" direction="in" /> <arg type="u" name="handle" direction="out" /> </method> Modified: projects/haf/trunk/hildon-thumbnail/thumbs/hildon-thumbnail-factory.c =================================================================== --- projects/haf/trunk/hildon-thumbnail/thumbs/hildon-thumbnail-factory.c 2008-10-17 12:49:03 UTC (rev 16434) +++ projects/haf/trunk/hildon-thumbnail/thumbs/hildon-thumbnail-factory.c 2008-10-17 14:30:50 UTC (rev 16435) @@ -353,6 +353,7 @@ gchar *large, *normal, *cropped; ThumbsItem *item; GStrv uris; + GStrv mimes; gboolean have_all = FALSE; g_return_val_if_fail(uri != NULL && mime_type != NULL && callback != NULL, @@ -379,8 +380,11 @@ item = g_new (ThumbsItem, 1); - item->uri = g_strdup(uri); - item->mime_type = g_strdup(mime_type); + item->uri = g_strdup (uri); + if (mime_type) + item->mime_type = g_strdup (mime_type); + else + item->mime_type = NULL; item->width = width; item->height = height; item->callback = callback; @@ -412,10 +416,22 @@ init (); uris = (GStrv) g_malloc0 (sizeof (gchar *) * 2); uris[0] = g_strdup (uri); - org_freedesktop_thumbnailer_Generic_queue_async (proxy, (const char **) uris, 0, - on_got_handle, item); + if (mime_type) { + mimes = (GStrv) g_malloc0 (sizeof (gchar *) * 2); + mimes[0] = g_strdup (mime_type); + } else + mimes = NULL; + + org_freedesktop_thumbnailer_Generic_queue_async (proxy, + (const char **) uris, + (const char **) mimes, + "GIO", 0, + on_got_handle, item); + g_strfreev (uris); + if (mimes) + g_strfreev (mimes); } return THUMBS_HANDLE (item); Modified: projects/haf/trunk/hildon-thumbnail/thumbs/hildon-thumbnail-factory.h =================================================================== --- projects/haf/trunk/hildon-thumbnail/thumbs/hildon-thumbnail-factory.h 2008-10-17 12:49:03 UTC (rev 16434) +++ projects/haf/trunk/hildon-thumbnail/thumbs/hildon-thumbnail-factory.h 2008-10-17 14:30:50 UTC (rev 16435) @@ -77,6 +77,7 @@ const gchar *uri, guint width, guint height, gboolean cropped, + const gchar *mime_type, HildonThumbnailRequestCallback callback, gpointer user_data, GDestroyNotify destroy); Modified: projects/haf/trunk/hildon-thumbnail/thumbs/hildon-thumbnail-obj.c =================================================================== --- projects/haf/trunk/hildon-thumbnail/thumbs/hildon-thumbnail-obj.c 2008-10-17 12:49:03 UTC (rev 16434) +++ projects/haf/trunk/hildon-thumbnail/thumbs/hildon-thumbnail-obj.c 2008-10-17 14:30:50 UTC (rev 16435) @@ -273,6 +273,7 @@ const gchar *uri, guint width, guint height, gboolean cropped, + const gchar *mime_type, HildonThumbnailRequestCallback callback, gpointer user_data, GDestroyNotify destroy) @@ -282,6 +283,7 @@ HildonThumbnailFactoryPrivate *f_priv = FACTORY_GET_PRIVATE (self); guint i; gboolean have = TRUE; + GStrv mime_types = NULL; hildon_thumbnail_util_get_thumb_paths (uri, &r_priv->paths[0], &r_priv->paths[1], @@ -298,9 +300,16 @@ r_priv->destroy = destroy; r_priv->cropped = cropped; + if (mime_type) { + mime_types = (GStrv) g_malloc0 (sizeof (gchar *) * 2); + mime_types[0] = g_strdup (mime_type); + } + if (!have) { org_freedesktop_thumbnailer_Generic_queue_async (f_priv->proxy, - (const char **) r_priv->uris, 0, + (const char **) r_priv->uris, + (const char **) mime_types, + "GIO", 0, on_got_handle, g_object_ref (request)); } else { @@ -309,6 +318,9 @@ (GDestroyNotify) g_object_unref); } + if (mime_types) + g_strfreev (mime_types); + return request; }
- Previous message: [maemo-commits] r16434 - projects/haf/trunk/hildon-thumbnail/thumbs
- Next message: [maemo-commits] r16436 - projects/haf/trunk/hildon-thumbnail
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]