• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* GObject - GLib Type, Object, Parameter and Signal Library
2  * testmodule.c: Dummy dynamic type module
3  * Copyright (C) 2003 Red Hat, Inc.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 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 GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #include "testmodule.h"
20 #include "testcommon.h"
21 
22 static gboolean test_module_load   (GTypeModule *module);
23 static void     test_module_unload (GTypeModule *module);
24 
25 static void
test_module_class_init(TestModuleClass * class)26 test_module_class_init (TestModuleClass *class)
27 {
28   GTypeModuleClass *module_class = G_TYPE_MODULE_CLASS (class);
29 
30   module_class->load = test_module_load;
31   module_class->unload = test_module_unload;
32 }
33 
DEFINE_TYPE(TestModule,test_module,test_module_class_init,NULL,NULL,G_TYPE_TYPE_MODULE)34 DEFINE_TYPE (TestModule, test_module,
35 	     test_module_class_init, NULL, NULL,
36 	     G_TYPE_TYPE_MODULE)
37 
38 static gboolean
39 test_module_load (GTypeModule *module)
40 {
41   TestModule *test_module = TEST_MODULE (module);
42 
43   test_module->register_func (module);
44 
45   return TRUE;
46 }
47 
48 static void
test_module_unload(GTypeModule * module)49 test_module_unload (GTypeModule *module)
50 {
51 }
52 
53 GTypeModule *
test_module_new(TestModuleRegisterFunc register_func)54 test_module_new (TestModuleRegisterFunc register_func)
55 {
56   TestModule *test_module = g_object_new (TEST_TYPE_MODULE, NULL);
57   GTypeModule *module = G_TYPE_MODULE (test_module);
58 
59   test_module->register_func = register_func;
60 
61   /* Register the types initially */
62   g_type_module_use (module);
63   g_type_module_unuse (module);
64 
65   return G_TYPE_MODULE (module);
66 }
67