1 /* vi:set et ai sw=2 sts=2 ts=2: */
2 /*-
3  * Copyright (c) 2009 Jannis Pohlmann <jannis@xfce.org>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General
16  * Public License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 #ifdef HAVE_CONFIG_H
22 #include <config.h>
23 #endif
24 
25 #include <glib.h>
26 #include <glib/gi18n.h>
27 #include <glib-object.h>
28 
29 #include <tumbler/tumbler.h>
30 
31 #include <jpeg-thumbnailer/jpeg-thumbnailer-provider.h>
32 #include <jpeg-thumbnailer/jpeg-thumbnailer.h>
33 
34 
35 
36 G_MODULE_EXPORT void tumbler_plugin_initialize (TumblerProviderPlugin *plugin);
37 G_MODULE_EXPORT void tumbler_plugin_shutdown   (void);
38 G_MODULE_EXPORT void tumbler_plugin_get_types  (const GType          **types,
39                                                 gint                  *n_types);
40 
41 
42 
43 static GType type_list[1];
44 
45 
46 
47 void
tumbler_plugin_initialize(TumblerProviderPlugin * plugin)48 tumbler_plugin_initialize (TumblerProviderPlugin *plugin)
49 {
50   const gchar *mismatch;
51 
52   /* verify that the tumbler versions are compatible */
53   mismatch = tumbler_check_version (TUMBLER_MAJOR_VERSION, TUMBLER_MINOR_VERSION,
54                                     TUMBLER_MICRO_VERSION);
55   if (G_UNLIKELY (mismatch != NULL))
56     {
57       g_warning (_("Version mismatch: %s"), mismatch);
58       return;
59     }
60 
61 #ifdef DEBUG
62   g_print ("Initializing the Tumbler JPEG Thumbnailer plugin\n");
63 #endif
64 
65   /* register the types provided by this plugin */
66   jpeg_thumbnailer_register (plugin);
67   jpeg_thumbnailer_provider_register (plugin);
68 
69   /* set up the plugin provider type list */
70   type_list[0] = TYPE_JPEG_THUMBNAILER_PROVIDER;
71 }
72 
73 
74 
75 void
tumbler_plugin_shutdown(void)76 tumbler_plugin_shutdown (void)
77 {
78 #ifdef DEBUG
79   g_print ("Shutting down the Tumbler JPEG Thumbnailer plugin\n");
80 #endif
81 }
82 
83 
84 
85 void
tumbler_plugin_get_types(const GType ** types,gint * n_types)86 tumbler_plugin_get_types (const GType **types,
87                           gint         *n_types)
88 {
89   *types = type_list;
90   *n_types = G_N_ELEMENTS (type_list);
91 }
92