sl@0
|
1 |
/* GObject - GLib Type, Object, Parameter and Signal Library
|
sl@0
|
2 |
* testmodule.c: Dummy dynamic type module
|
sl@0
|
3 |
* Copyright (C) 2003 Red Hat, Inc.
|
sl@0
|
4 |
*
|
sl@0
|
5 |
* This library is free software; you can redistribute it and/or
|
sl@0
|
6 |
* modify it under the terms of the GNU Lesser General Public
|
sl@0
|
7 |
* License as published by the Free Software Foundation; either
|
sl@0
|
8 |
* version 2 of the License, or (at your option) any later version.
|
sl@0
|
9 |
*
|
sl@0
|
10 |
* This library is distributed in the hope that it will be useful,
|
sl@0
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
sl@0
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
sl@0
|
13 |
* Lesser General Public License for more details.
|
sl@0
|
14 |
*
|
sl@0
|
15 |
* You should have received a copy of the GNU Lesser General Public
|
sl@0
|
16 |
* License along with this library; if not, write to the
|
sl@0
|
17 |
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
sl@0
|
18 |
* Boston, MA 02111-1307, USA.
|
sl@0
|
19 |
*/
|
sl@0
|
20 |
|
sl@0
|
21 |
#include "testmodule.h"
|
sl@0
|
22 |
#include "testcommon.h"
|
sl@0
|
23 |
|
sl@0
|
24 |
static gboolean test_module_load (GTypeModule *module);
|
sl@0
|
25 |
static void test_module_unload (GTypeModule *module);
|
sl@0
|
26 |
|
sl@0
|
27 |
static void
|
sl@0
|
28 |
test_module_class_init (TestModuleClass *class)
|
sl@0
|
29 |
{
|
sl@0
|
30 |
GTypeModuleClass *module_class = G_TYPE_MODULE_CLASS (class);
|
sl@0
|
31 |
|
sl@0
|
32 |
module_class->load = test_module_load;
|
sl@0
|
33 |
module_class->unload = test_module_unload;
|
sl@0
|
34 |
}
|
sl@0
|
35 |
|
sl@0
|
36 |
DEFINE_TYPE (TestModule, test_module,
|
sl@0
|
37 |
test_module_class_init, NULL, NULL,
|
sl@0
|
38 |
G_TYPE_TYPE_MODULE)
|
sl@0
|
39 |
|
sl@0
|
40 |
static gboolean
|
sl@0
|
41 |
test_module_load (GTypeModule *module)
|
sl@0
|
42 |
{
|
sl@0
|
43 |
TestModule *test_module = TEST_MODULE (module);
|
sl@0
|
44 |
|
sl@0
|
45 |
test_module->register_func (module);
|
sl@0
|
46 |
|
sl@0
|
47 |
return TRUE;
|
sl@0
|
48 |
}
|
sl@0
|
49 |
|
sl@0
|
50 |
static void
|
sl@0
|
51 |
test_module_unload (GTypeModule *module)
|
sl@0
|
52 |
{
|
sl@0
|
53 |
}
|
sl@0
|
54 |
|
sl@0
|
55 |
GTypeModule *
|
sl@0
|
56 |
test_module_new (TestModuleRegisterFunc register_func)
|
sl@0
|
57 |
{
|
sl@0
|
58 |
TestModule *test_module = g_object_new (TEST_TYPE_MODULE, NULL);
|
sl@0
|
59 |
GTypeModule *module = G_TYPE_MODULE (test_module);
|
sl@0
|
60 |
|
sl@0
|
61 |
test_module->register_func = register_func;
|
sl@0
|
62 |
|
sl@0
|
63 |
/* Register the types initially */
|
sl@0
|
64 |
g_type_module_use (module);
|
sl@0
|
65 |
g_type_module_unuse (module);
|
sl@0
|
66 |
|
sl@0
|
67 |
return G_TYPE_MODULE (module);
|
sl@0
|
68 |
}
|
sl@0
|
69 |
|