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