[maemo-commits] [maemo-commits] r16524 - in projects/haf/trunk/hildon-thumbnail: . daemon
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Wed Oct 29 12:01:19 EET 2008
- Previous message: [maemo-commits] r16523 - projects/haf/doc/mvo
- Next message: [maemo-commits] r16525 - in projects/haf/trunk/hildon-thumbnail: . daemon
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: pvanhoof Date: 2008-10-29 12:01:17 +0200 (Wed, 29 Oct 2008) New Revision: 16524 Modified: projects/haf/trunk/hildon-thumbnail/ChangeLog projects/haf/trunk/hildon-thumbnail/daemon/thumbnail-manager.c Log: 2008-10-29 Philip Van Hoof <philip at codeminded.be> * daemon/thumbnail-manager.c: Refactoring for grouping per URI scheme. Same as yesterday but now for 3th party external specialized plugins. Modified: projects/haf/trunk/hildon-thumbnail/ChangeLog =================================================================== --- projects/haf/trunk/hildon-thumbnail/ChangeLog 2008-10-29 00:14:02 UTC (rev 16523) +++ projects/haf/trunk/hildon-thumbnail/ChangeLog 2008-10-29 10:01:17 UTC (rev 16524) @@ -1,3 +1,8 @@ +2008-10-29 Philip Van Hoof <philip at codeminded.be> + + * daemon/thumbnail-manager.c: Refactoring for grouping per URI scheme. + Same as yesterday but now for 3th party external specialized plugins. + 2008-10-28 Philip Van Hoof <philip at codeminded.be> * albumart-providers/googleimages/Makefile.am: Bugfix for make Modified: projects/haf/trunk/hildon-thumbnail/daemon/thumbnail-manager.c =================================================================== --- projects/haf/trunk/hildon-thumbnail/daemon/thumbnail-manager.c 2008-10-29 00:14:02 UTC (rev 16523) +++ projects/haf/trunk/hildon-thumbnail/daemon/thumbnail-manager.c 2008-10-29 10:01:17 UTC (rev 16524) @@ -62,15 +62,16 @@ { ThumbnailManagerPrivate *priv = THUMBNAIL_MANAGER_GET_PRIVATE (object); DBusGProxy *proxy; + gchar *query = g_strdup_printf ("%s-%s", uri_scheme, mime_type); - // TODO: take into account uri_scheme - g_mutex_lock (priv->mutex); - proxy = g_hash_table_lookup (priv->handlers, mime_type); + proxy = g_hash_table_lookup (priv->handlers, query); if (proxy) g_object_ref (proxy); g_mutex_unlock (priv->mutex); + g_free (query); + return proxy; } @@ -139,8 +140,9 @@ gchar *fullfilen; gchar *value; GStrv values; + GStrv uri_schemes; GError *error = NULL; - guint i = 0; + guint i = 0, y = 0; guint64 mtime; GFileInfo *info; GFile *file; @@ -183,6 +185,16 @@ continue; } + /* Get the supported uri-schemes, if none we default to just `file` */ + + uri_schemes = g_key_file_get_string_list (keyfile, "D-BUS Thumbnailer", "UriSchemes", NULL, NULL); + + if (!uri_schemes) { + uri_schemes = (GStrv) g_malloc0 (sizeof (gchar *) * 2); + uri_schemes[0] = g_strdup ("file"); + uri_schemes[1] = NULL; + } + /* Else, get the modificiation time, we'll need it later */ file = g_file_new_for_path (fullfilen); @@ -202,6 +214,7 @@ g_object_unref (file); g_free (value); g_strfreev (values); + g_strfreev (uri_schemes); g_key_file_free (keyfile); continue; } @@ -210,7 +223,13 @@ /* And register it in the temporary hashtable that is being formed */ - while (values[i] != NULL) { + y = 0; + + while (uri_schemes[y] != NULL) { + + i = 0; + + while (values[i] != NULL) { ValueInfo *info; info = g_hash_table_lookup (pre, values[i]); @@ -233,11 +252,13 @@ info->prio = FALSE; g_hash_table_replace (pre, - g_strdup (values[i]), + g_strdup_printf ("%s-%s", uri_schemes[y], values[i]), info); } i++; + } + y++; } if (info) @@ -246,6 +267,7 @@ g_object_unref (file); g_free (value); + g_strfreev (uri_schemes); g_strfreev (values); g_key_file_free (keyfile); } @@ -260,13 +282,14 @@ keyfile = g_key_file_new (); if (g_key_file_load_from_file (keyfile, fullfilen, G_KEY_FILE_NONE, NULL)) { - gchar **mimes = g_key_file_get_groups (keyfile, &length); + gchar **urisch_and_mimes = g_key_file_get_groups (keyfile, &length); guint i; for (i = 0; i< length; i++) { ValueInfo *info = g_slice_new (ValueInfo); - info->name = g_key_file_get_string (keyfile, mimes[i], "Name", NULL); + info->name = g_key_file_get_string (keyfile, urisch_and_mimes[i], + "Name", NULL); /* This is atm unused for items in overrides. */ @@ -277,10 +300,10 @@ info->prio = TRUE; g_hash_table_replace (pre, - g_strdup (mimes[i]), + g_strdup (urisch_and_mimes[i]), info); } - g_strfreev (mimes); + g_strfreev (urisch_and_mimes); } g_free (fullfilen);
- Previous message: [maemo-commits] r16523 - projects/haf/doc/mvo
- Next message: [maemo-commits] r16525 - in projects/haf/trunk/hildon-thumbnail: . daemon
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]