2.13.1
[platform/upstream/glib.git] / gobject / gtypeplugin.c
1 /* GObject - GLib Type, Object, Parameter and Signal Library
2  * Copyright (C) 2000 Red Hat, Inc.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General
15  * Public License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 #include        "gtypeplugin.h"
20 #include        "gobjectalias.h"
21
22
23
24 /* --- functions --- */
25 GType
26 g_type_plugin_get_type (void)
27 {
28   static GType type_plugin_type = 0;
29   
30   if (!type_plugin_type)
31     {
32       static const GTypeInfo type_plugin_info = {
33         sizeof (GTypePluginClass),
34         NULL,           /* base_init */
35         NULL,           /* base_finalize */
36       };
37       
38       type_plugin_type = g_type_register_static (G_TYPE_INTERFACE, g_intern_static_string ("GTypePlugin"), &type_plugin_info, 0);
39     }
40   
41   return type_plugin_type;
42 }
43
44 void
45 g_type_plugin_use (GTypePlugin *plugin)
46 {
47   GTypePluginClass *iface;
48   
49   g_return_if_fail (G_IS_TYPE_PLUGIN (plugin));
50   
51   iface = G_TYPE_PLUGIN_GET_CLASS (plugin);
52   iface->use_plugin (plugin);
53 }
54
55 void
56 g_type_plugin_unuse (GTypePlugin *plugin)
57 {
58   GTypePluginClass *iface;
59   
60   g_return_if_fail (G_IS_TYPE_PLUGIN (plugin));
61   
62   iface = G_TYPE_PLUGIN_GET_CLASS (plugin);
63   iface->unuse_plugin (plugin);
64 }
65
66 void
67 g_type_plugin_complete_type_info (GTypePlugin     *plugin,
68                                   GType            g_type,
69                                   GTypeInfo       *info,
70                                   GTypeValueTable *value_table)
71 {
72   GTypePluginClass *iface;
73   
74   g_return_if_fail (G_IS_TYPE_PLUGIN (plugin));
75   g_return_if_fail (info != NULL);
76   g_return_if_fail (value_table != NULL);
77   
78   iface = G_TYPE_PLUGIN_GET_CLASS (plugin);
79   iface->complete_type_info (plugin,
80                              g_type,
81                              info,
82                              value_table);
83 }
84
85 void
86 g_type_plugin_complete_interface_info (GTypePlugin    *plugin,
87                                        GType           instance_type,
88                                        GType           interface_type,
89                                        GInterfaceInfo *info)
90 {
91   GTypePluginClass *iface;
92   
93   g_return_if_fail (G_IS_TYPE_PLUGIN (plugin));
94   g_return_if_fail (info != NULL);
95   
96   iface = G_TYPE_PLUGIN_GET_CLASS (plugin);
97   iface->complete_interface_info (plugin,
98                                   instance_type,
99                                   interface_type,
100                                   info);
101 }
102
103 #define __G_TYPE_PLUGIN_C__
104 #include "gobjectaliasdef.c"