summaryrefslogtreecommitdiff
path: root/tumbler
diff options
context:
space:
mode:
authorJannis Pohlmann <jannis@xfce.org>2009-10-21 17:57:20 +0200
committerJannis Pohlmann <jannis@xfce.org>2009-11-16 14:53:18 +0100
commit47b8b19d478b6f0846454aeecb25fc67c7113a20 (patch)
tree83c038703ba1a6674d443e9deea2d08876e1b87c /tumbler
parenta13a6b37a203cf03937d714a5faa40879d9a696c (diff)
downloadtumbler-47b8b19d478b6f0846454aeecb25fc67c7113a20.tar.gz
Support specialized thumbnailers and overrides files properly.
This required some major changes, most of which are documented in the source code. It still needs to be tested but it should be fine. The mutex locks in TumblerManager could probably be optimized and some other parts are not optimal with regards to speed and memory usage yet. All in all, what's done now is: - overrides files are parsed into override info structs and kept in a (hashkey -> override info list) hash table - each of these override info lists is sorted in the order of the directories the overrides files are located in (with higher priority directories coming first) - the first override info in each list determines which specialized thumbnailer is set as preferred for the corresponding hash key in the registry - thumbnailer service files are parsed into thumbnailer info structs and kept in a (basename -> thumbnailer info list) hash table - each of these thumbnailer info lists is sorted in the order of the directories the thumbnailer service infos come from - the first thumbnailers in each list are added to the registry - whenever something changes on the disk, this internal representation is updated
Diffstat (limited to 'tumbler')
-rw-r--r--tumbler/tumbler-thumbnailer.c24
-rw-r--r--tumbler/tumbler-thumbnailer.h30
2 files changed, 39 insertions, 15 deletions
diff --git a/tumbler/tumbler-thumbnailer.c b/tumbler/tumbler-thumbnailer.c
index 588cfa2..d40c1b8 100644
--- a/tumbler/tumbler-thumbnailer.c
+++ b/tumbler/tumbler-thumbnailer.c
@@ -125,7 +125,7 @@ tumbler_thumbnailer_class_init (TumblerThumbnailerIface *klass)
tumbler_thumbnailer_signals[SIGNAL_UNREGISTER] =
g_signal_new ("unregister",
TUMBLER_TYPE_THUMBNAILER,
- G_SIGNAL_RUN_LAST,
+ G_SIGNAL_RUN_LAST | G_SIGNAL_NO_HOOKS,
G_STRUCT_OFFSET (TumblerThumbnailerIface, unregister),
NULL,
NULL,
@@ -191,6 +191,28 @@ tumbler_thumbnailer_get_uri_schemes (TumblerThumbnailer *thumbnailer)
+gboolean
+tumbler_thumbnailer_supports_hash_key (TumblerThumbnailer *thumbnailer,
+ const gchar *hash_key)
+{
+ gboolean supported = FALSE;
+ GStrv hash_keys;
+ guint n;
+
+ g_return_val_if_fail (TUMBLER_IS_THUMBNAILER (thumbnailer), FALSE);
+ g_return_val_if_fail (hash_key != NULL && *hash_key != '\0', FALSE);
+
+ hash_keys = tumbler_thumbnailer_get_hash_keys (thumbnailer);
+
+ for (n = 0; !supported && hash_keys != NULL && hash_keys[n] != NULL; ++n)
+ if (g_strcmp0 (hash_keys[n], hash_key) == 0)
+ supported = TRUE;
+
+ return supported;
+}
+
+
+
TumblerThumbnailer **
tumbler_thumbnailer_array_copy (TumblerThumbnailer **thumbnailers,
guint length)
diff --git a/tumbler/tumbler-thumbnailer.h b/tumbler/tumbler-thumbnailer.h
index 9194fe4..36adf6d 100644
--- a/tumbler/tumbler-thumbnailer.h
+++ b/tumbler/tumbler-thumbnailer.h
@@ -54,25 +54,27 @@ struct _TumblerThumbnailerIface
void (*unregister) (TumblerThumbnailer *thumbnailer);
/* virtual methods */
- void (*create) (TumblerThumbnailer *thumbnailer,
- GCancellable *cancellable,
- TumblerFileInfo *info);
+ void (*create) (TumblerThumbnailer *thumbnailer,
+ GCancellable *cancellable,
+ TumblerFileInfo *info);
};
-GType tumbler_thumbnailer_get_type (void) G_GNUC_CONST;
+GType tumbler_thumbnailer_get_type (void) G_GNUC_CONST;
-void tumbler_thumbnailer_create (TumblerThumbnailer *thumbnailer,
- GCancellable *cancellable,
- TumblerFileInfo *info);
+void tumbler_thumbnailer_create (TumblerThumbnailer *thumbnailer,
+ GCancellable *cancellable,
+ TumblerFileInfo *info);
-GStrv tumbler_thumbnailer_get_hash_keys (TumblerThumbnailer *thumbnailer);
-GStrv tumbler_thumbnailer_get_mime_types (TumblerThumbnailer *thumbnailer);
-GStrv tumbler_thumbnailer_get_uri_schemes (TumblerThumbnailer *thumbnailer);
+GStrv tumbler_thumbnailer_get_hash_keys (TumblerThumbnailer *thumbnailer);
+GStrv tumbler_thumbnailer_get_mime_types (TumblerThumbnailer *thumbnailer);
+GStrv tumbler_thumbnailer_get_uri_schemes (TumblerThumbnailer *thumbnailer);
+gboolean tumbler_thumbnailer_supports_hash_key (TumblerThumbnailer *thumbnailer,
+ const gchar *hash_key);
-TumblerThumbnailer **tumbler_thumbnailer_array_copy (TumblerThumbnailer **thumbnailers,
- guint length);
-void tumbler_thumbnailer_array_free (TumblerThumbnailer **thumbnailers,
- guint length);
+TumblerThumbnailer **tumbler_thumbnailer_array_copy (TumblerThumbnailer **thumbnailers,
+ guint length);
+void tumbler_thumbnailer_array_free (TumblerThumbnailer **thumbnailers,
+ guint length);
G_END_DECLS