diff options
author | Jannis Pohlmann <jannis@xfce.org> | 2009-05-21 13:31:29 +0200 |
---|---|---|
committer | Jannis Pohlmann <jannis@xfce.org> | 2009-05-21 13:31:29 +0200 |
commit | 28e782dfe7df25e2e41a319d44c32a61644ae44e (patch) | |
tree | 630e0896a9c6c75dfa9dcbc013df091b7df4979a /tumbler/tumbler-thumbnailer.c | |
parent | 233d958a6630d4972fdd2c24c72bab6b9a7b5d01 (diff) | |
download | tumbler-28e782dfe7df25e2e41a319d44c32a61644ae44e.tar.gz |
Add tumbler utility library, rename the service to tumblerd.
There's a library called tumbler (or tumbler-1) now which provides
utility classes and functions for writing specialized thumbnailers. The
libary is LGPL while the D-Bus service itself is GPL.
The tumbler service was renamed to tumblerd and the marshallers
were moved into the library.
Diffstat (limited to 'tumbler/tumbler-thumbnailer.c')
-rw-r--r-- | tumbler/tumbler-thumbnailer.c | 224 |
1 files changed, 0 insertions, 224 deletions
diff --git a/tumbler/tumbler-thumbnailer.c b/tumbler/tumbler-thumbnailer.c deleted file mode 100644 index d3d39eb..0000000 --- a/tumbler/tumbler-thumbnailer.c +++ /dev/null @@ -1,224 +0,0 @@ -/* vi:set et ai sw=2 sts=2 ts=2: */ -/*- - * Copyright (c) 2009 Jannis Pohlmann <jannis@xfce.org> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the Free - * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <tumbler/tumbler-marshal.h> -#include <tumbler/tumbler-thumbnailer.h> - - - -/* signal identifiers */ -enum -{ - SIGNAL_READY, - SIGNAL_ERROR, - SIGNAL_UNREGISTER, - LAST_SIGNAL, -}; - - - -static void tumbler_thumbnailer_class_init (TumblerThumbnailerIface *klass); - - - -static guint tumbler_thumbnailer_signals[LAST_SIGNAL]; - - - -GType -tumbler_thumbnailer_get_type (void) -{ - static GType type = G_TYPE_INVALID; - - if (G_UNLIKELY (type == G_TYPE_INVALID)) - { - type = g_type_register_static_simple (G_TYPE_INTERFACE, - "TumblerThumbnailer", - sizeof (TumblerThumbnailerIface), - (GClassInitFunc) tumbler_thumbnailer_class_init, - 0, - NULL, - 0); - - g_type_interface_add_prerequisite (type, G_TYPE_OBJECT); - } - - return type; -} - - - -static void -tumbler_thumbnailer_class_init (TumblerThumbnailerIface *klass) -{ - g_object_interface_install_property (klass, - g_param_spec_pointer ("mime-types", - "mime-types", - "mime-types", - G_PARAM_CONSTRUCT_ONLY | - G_PARAM_READWRITE)); - - g_object_interface_install_property (klass, - g_param_spec_pointer ("uri-schemes", - "uri-schemes", - "uri-schemes", - G_PARAM_CONSTRUCT_ONLY | - G_PARAM_READWRITE)); - - g_object_interface_install_property (klass, - g_param_spec_pointer ("hash-keys", - "hash-keys", - "hash-keys", - G_PARAM_READABLE)); - - tumbler_thumbnailer_signals[SIGNAL_READY] = - g_signal_new ("ready", - TUMBLER_TYPE_THUMBNAILER, - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (TumblerThumbnailerIface, ready), - NULL, - NULL, - g_cclosure_marshal_VOID__STRING, - G_TYPE_NONE, - 1, - G_TYPE_STRING); - - tumbler_thumbnailer_signals[SIGNAL_ERROR] = - g_signal_new ("error", - TUMBLER_TYPE_THUMBNAILER, - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (TumblerThumbnailerIface, error), - NULL, - NULL, - tumbler_marshal_VOID__STRING_INT_STRING, - G_TYPE_NONE, - 1, - G_TYPE_STRING, - G_TYPE_INT, - G_TYPE_STRING); - - tumbler_thumbnailer_signals[SIGNAL_UNREGISTER] = - g_signal_new ("unregister", - TUMBLER_TYPE_THUMBNAILER, - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (TumblerThumbnailerIface, unregister), - NULL, - NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, - 0); -} - - - -void -tumbler_thumbnailer_create (TumblerThumbnailer *thumbnailer, - const gchar *uri, - const gchar *mime_hint) -{ - g_return_if_fail (TUMBLER_IS_THUMBNAILER (thumbnailer)); - g_return_if_fail (uri != NULL); - g_return_if_fail (mime_hint != NULL); - - return (*TUMBLER_THUMBNAILER_GET_IFACE (thumbnailer)->create) (thumbnailer, - uri, - mime_hint); -} - - - -GStrv -tumbler_thumbnailer_get_hash_keys (TumblerThumbnailer *thumbnailer) -{ - GStrv hash_keys; - - g_return_val_if_fail (TUMBLER_IS_THUMBNAILER (thumbnailer), NULL); - - g_object_get (thumbnailer, "hash-keys", &hash_keys, NULL); - return hash_keys; -} - - - -GStrv -tumbler_thumbnailer_get_mime_types (TumblerThumbnailer *thumbnailer) -{ - GStrv mime_types; - - g_return_val_if_fail (TUMBLER_IS_THUMBNAILER (thumbnailer), NULL); - - g_object_get (thumbnailer, "mime-types", &mime_types, NULL); - return mime_types; -} - - - -GStrv -tumbler_thumbnailer_get_uri_schemes (TumblerThumbnailer *thumbnailer) -{ - GStrv uri_schemes; - - g_return_val_if_fail (TUMBLER_IS_THUMBNAILER (thumbnailer), NULL); - - 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+1); - - for (n = 0; n < length; ++n) - if (thumbnailers[n] != NULL) - copy[n] = g_object_ref (thumbnailers[n]); - - copy[n] = 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); -} |