diff options
author | Jannis Pohlmann <jannis@xfce.org> | 2009-05-20 14:33:46 +0200 |
---|---|---|
committer | Jannis Pohlmann <jannis@xfce.org> | 2009-05-20 14:33:46 +0200 |
commit | 872604a7f03e626883915bda32c4d879a5753e98 (patch) | |
tree | 5ad8789896032923483a26284da9e000c06b8985 /tumbler/tumbler-thumbnailer.c | |
parent | 56a8413db94ca274405750d60e1076d4cc27ccce (diff) | |
download | tumbler-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.c | 38 |
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); +} |