~ubuntu-branches/ubuntu/precise/tumbler/precise

« back to all changes in this revision

Viewing changes to plugins/jpeg-thumbnailer/jpeg-thumbnailer-provider.c

  • Committer: Bazaar Package Importer
  • Author(s): Lionel Le Folgoc
  • Date: 2010-11-07 16:34:58 UTC
  • Revision ID: james.westby@ubuntu.com-20101107163458-skwfq34vnuavipne
Tags: upstream-0.1.4
ImportĀ upstreamĀ versionĀ 0.1.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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-object.h>
 
27
 
 
28
#include <gdk-pixbuf/gdk-pixbuf.h>
 
29
 
 
30
#include <tumbler/tumbler.h>
 
31
 
 
32
#include <jpeg-thumbnailer/jpeg-thumbnailer-provider.h>
 
33
#include <jpeg-thumbnailer/jpeg-thumbnailer.h>
 
34
 
 
35
 
 
36
 
 
37
static void   jpeg_thumbnailer_provider_thumbnailer_provider_init (TumblerThumbnailerProviderIface *iface);
 
38
static GList *jpeg_thumbnailer_provider_get_thumbnailers          (TumblerThumbnailerProvider      *provider);
 
39
 
 
40
 
 
41
 
 
42
struct _JPEGThumbnailerProviderClass
 
43
{
 
44
  GObjectClass __parent__;
 
45
};
 
46
 
 
47
struct _JPEGThumbnailerProvider
 
48
{
 
49
  GObject __parent__;
 
50
};
 
51
 
 
52
 
 
53
 
 
54
G_DEFINE_DYNAMIC_TYPE_EXTENDED (JPEGThumbnailerProvider,
 
55
                                jpeg_thumbnailer_provider,
 
56
                                G_TYPE_OBJECT,
 
57
                                0,
 
58
                                TUMBLER_ADD_INTERFACE (TUMBLER_TYPE_THUMBNAILER_PROVIDER,
 
59
                                                       jpeg_thumbnailer_provider_thumbnailer_provider_init));
 
60
 
 
61
 
 
62
 
 
63
void
 
64
jpeg_thumbnailer_provider_register (TumblerProviderPlugin *plugin)
 
65
{
 
66
  jpeg_thumbnailer_provider_register_type (G_TYPE_MODULE (plugin));
 
67
}
 
68
 
 
69
 
 
70
 
 
71
static void
 
72
jpeg_thumbnailer_provider_class_init (JPEGThumbnailerProviderClass *klass)
 
73
{
 
74
  GObjectClass *gobject_class;
 
75
 
 
76
  gobject_class = G_OBJECT_CLASS (klass);
 
77
}
 
78
 
 
79
 
 
80
 
 
81
static void
 
82
jpeg_thumbnailer_provider_class_finalize (JPEGThumbnailerProviderClass *klass)
 
83
{
 
84
}
 
85
 
 
86
 
 
87
 
 
88
static void
 
89
jpeg_thumbnailer_provider_thumbnailer_provider_init (TumblerThumbnailerProviderIface *iface)
 
90
{
 
91
  iface->get_thumbnailers = jpeg_thumbnailer_provider_get_thumbnailers;
 
92
}
 
93
 
 
94
 
 
95
 
 
96
static void
 
97
jpeg_thumbnailer_provider_init (JPEGThumbnailerProvider *provider)
 
98
{
 
99
}
 
100
 
 
101
 
 
102
 
 
103
static GList *
 
104
jpeg_thumbnailer_provider_get_thumbnailers (TumblerThumbnailerProvider *provider)
 
105
{
 
106
  JPEGThumbnailer *thumbnailer;
 
107
  const gchar     *mime_types[] = { "image/jpeg", NULL };
 
108
  GList           *thumbnailers = NULL;
 
109
  GStrv            uri_schemes;
 
110
 
 
111
  /* determine which URI schemes are supported by GIO */
 
112
  uri_schemes = tumbler_util_get_supported_uri_schemes ();
 
113
 
 
114
  /* create the pixbuf thumbnailer */
 
115
  thumbnailer = g_object_new (TYPE_JPEG_THUMBNAILER, 
 
116
                              "uri-schemes", uri_schemes, "mime-types", mime_types, 
 
117
                              NULL);
 
118
 
 
119
  /* free URI schemes and MIME types */
 
120
  g_strfreev (uri_schemes);
 
121
 
 
122
  /* add the thumbnailer to the list */
 
123
  thumbnailers = g_list_append (thumbnailers, thumbnailer);
 
124
 
 
125
  return thumbnailers;
 
126
}