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

« back to all changes in this revision

Viewing changes to plugins/font-thumbnailer/font-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 <font-thumbnailer/font-thumbnailer-provider.h>
 
33
#include <font-thumbnailer/font-thumbnailer.h>
 
34
 
 
35
 
 
36
 
 
37
static void   font_thumbnailer_provider_thumbnailer_provider_init (TumblerThumbnailerProviderIface *iface);
 
38
static GList *font_thumbnailer_provider_get_thumbnailers          (TumblerThumbnailerProvider      *provider);
 
39
 
 
40
 
 
41
 
 
42
struct _FontThumbnailerProviderClass
 
43
{
 
44
  GObjectClass __parent__;
 
45
};
 
46
 
 
47
struct _FontThumbnailerProvider
 
48
{
 
49
  GObject __parent__;
 
50
};
 
51
 
 
52
 
 
53
 
 
54
G_DEFINE_DYNAMIC_TYPE_EXTENDED (FontThumbnailerProvider,
 
55
                                font_thumbnailer_provider,
 
56
                                G_TYPE_OBJECT,
 
57
                                0,
 
58
                                TUMBLER_ADD_INTERFACE (TUMBLER_TYPE_THUMBNAILER_PROVIDER,
 
59
                                                       font_thumbnailer_provider_thumbnailer_provider_init));
 
60
 
 
61
 
 
62
 
 
63
void
 
64
font_thumbnailer_provider_register (TumblerProviderPlugin *plugin)
 
65
{
 
66
  font_thumbnailer_provider_register_type (G_TYPE_MODULE (plugin));
 
67
}
 
68
 
 
69
 
 
70
 
 
71
static void
 
72
font_thumbnailer_provider_class_init (FontThumbnailerProviderClass *klass)
 
73
{
 
74
  GObjectClass *gobject_class;
 
75
 
 
76
  gobject_class = G_OBJECT_CLASS (klass);
 
77
}
 
78
 
 
79
 
 
80
 
 
81
static void
 
82
font_thumbnailer_provider_class_finalize (FontThumbnailerProviderClass *klass)
 
83
{
 
84
}
 
85
 
 
86
 
 
87
 
 
88
static void
 
89
font_thumbnailer_provider_thumbnailer_provider_init (TumblerThumbnailerProviderIface *iface)
 
90
{
 
91
  iface->get_thumbnailers = font_thumbnailer_provider_get_thumbnailers;
 
92
}
 
93
 
 
94
 
 
95
 
 
96
static void
 
97
font_thumbnailer_provider_init (FontThumbnailerProvider *provider)
 
98
{
 
99
}
 
100
 
 
101
 
 
102
 
 
103
static GList *
 
104
font_thumbnailer_provider_get_thumbnailers (TumblerThumbnailerProvider *provider)
 
105
{
 
106
  static const gchar *mime_types[] = 
 
107
  { 
 
108
    "application/x-font-otf",
 
109
    "application/x-font-pcf",
 
110
    "application/x-font-ttf",
 
111
    "application/x-font-type1",
 
112
    NULL,
 
113
  };
 
114
  FontThumbnailer    *thumbnailer;
 
115
  GList              *thumbnailers = NULL;
 
116
  GStrv               uri_schemes;
 
117
 
 
118
  /* determine the URI schemes supported by GIO */
 
119
  uri_schemes = tumbler_util_get_supported_uri_schemes ();
 
120
 
 
121
  /* create the pixbuf thumbnailer */
 
122
  thumbnailer = g_object_new (TYPE_FONT_THUMBNAILER, 
 
123
                              "uri-schemes", uri_schemes, "mime-types", mime_types, 
 
124
                              NULL);
 
125
 
 
126
  /* add the thumbnailer to the list */
 
127
  thumbnailers = g_list_append (thumbnailers, thumbnailer);
 
128
 
 
129
  /* free URI schemes */
 
130
  g_strfreev (uri_schemes);
 
131
 
 
132
  return thumbnailers;
 
133
}