summaryrefslogtreecommitdiff
path: root/tumbler/tumbler-thumbnailer.c
diff options
context:
space:
mode:
authorJannis Pohlmann <jannis@xfce.org>2009-05-20 14:33:46 +0200
committerJannis Pohlmann <jannis@xfce.org>2009-05-20 14:33:46 +0200
commit872604a7f03e626883915bda32c4d879a5753e98 (patch)
tree5ad8789896032923483a26284da9e000c06b8985 /tumbler/tumbler-thumbnailer.c
parent56a8413db94ca274405750d60e1076d4cc27ccce (diff)
downloadtumbler-872604a7f03e626883915bda32c4d879a5753e98.tar.gz
Implement tumbler_service_queue() based on TumblerSchedulerRequest.
When an org.freedesktop.thumbnailer.Generic.Queue request is sent to TumblerService, it does three things: 1. It requests a TumblerThumbnailer array from its TumblerRegistry. This array has the same length as the URIs and mime hints arrays passed to org.freedesktop.thumbnailer.Generic.Queue. The Nth thumbnailer in the array is responsible for generating the thumbnailer for the Nth URI. 2. It allocates a TumblerSchedulerRequest. 3. It asks the TumblerScheduler to push the request. Amongst others, the following functions were added in this commit: - tumbler_registry_get_thumbnailer_array() - tumbler_registry_lookup() (private function) - tumbler_scheduler_request_new() - tumbler_schedulre_request_free() - tumbler_thumbnailer_array_copy() - tumbler_thumbnailer_array_free()
Diffstat (limited to 'tumbler/tumbler-thumbnailer.c')
-rw-r--r--tumbler/tumbler-thumbnailer.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/tumbler/tumbler-thumbnailer.c b/tumbler/tumbler-thumbnailer.c
index f9d4a2a..e428cd9 100644
--- a/tumbler/tumbler-thumbnailer.c
+++ b/tumbler/tumbler-thumbnailer.c
@@ -184,3 +184,41 @@ tumbler_thumbnailer_get_uri_schemes (TumblerThumbnailer *thumbnailer)
g_object_get (thumbnailer, "uri-schemes", &uri_schemes, NULL);
return uri_schemes;
}
+
+
+
+TumblerThumbnailer **
+tumbler_thumbnailer_array_copy (TumblerThumbnailer **thumbnailers)
+{
+ TumblerThumbnailer **copy;
+ gint length;
+ gint n;
+
+ g_return_val_if_fail (thumbnailers != NULL, NULL);
+
+ for (length = 0; thumbnailers[length] != NULL; ++length);
+
+ copy = g_new0 (TumblerThumbnailer *, length);
+
+ for (n = 0; n < length-1; ++n)
+ if (thumbnailers[n] != NULL)
+ copy[n] = g_object_ref (thumbnailers[n]);
+
+ copy[length-1] = NULL;
+
+ return copy;
+}
+
+
+
+void
+tumbler_thumbnailer_array_free (TumblerThumbnailer **thumbnailers)
+{
+ gint n;
+
+ for (n = 0; thumbnailers != NULL && thumbnailers[n] != NULL; ++n)
+ if (thumbnailers[n] != NULL)
+ g_object_unref (thumbnailers[n]);
+
+ g_free (thumbnailers);
+}