1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/glib/tests/gobject/testmodule.c Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,69 @@
1.4 +/* GObject - GLib Type, Object, Parameter and Signal Library
1.5 + * testmodule.c: Dummy dynamic type module
1.6 + * Copyright (C) 2003 Red Hat, Inc.
1.7 + *
1.8 + * This library is free software; you can redistribute it and/or
1.9 + * modify it under the terms of the GNU Lesser General Public
1.10 + * License as published by the Free Software Foundation; either
1.11 + * version 2 of the License, or (at your option) any later version.
1.12 + *
1.13 + * This library is distributed in the hope that it will be useful,
1.14 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.15 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1.16 + * Lesser General Public License for more details.
1.17 + *
1.18 + * You should have received a copy of the GNU Lesser General Public
1.19 + * License along with this library; if not, write to the
1.20 + * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
1.21 + * Boston, MA 02111-1307, USA.
1.22 + */
1.23 +
1.24 +#include "testmodule.h"
1.25 +#include "testcommon.h"
1.26 +
1.27 +static gboolean test_module_load (GTypeModule *module);
1.28 +static void test_module_unload (GTypeModule *module);
1.29 +
1.30 +static void
1.31 +test_module_class_init (TestModuleClass *class)
1.32 +{
1.33 + GTypeModuleClass *module_class = G_TYPE_MODULE_CLASS (class);
1.34 +
1.35 + module_class->load = test_module_load;
1.36 + module_class->unload = test_module_unload;
1.37 +}
1.38 +
1.39 +DEFINE_TYPE (TestModule, test_module,
1.40 + test_module_class_init, NULL, NULL,
1.41 + G_TYPE_TYPE_MODULE)
1.42 +
1.43 +static gboolean
1.44 +test_module_load (GTypeModule *module)
1.45 +{
1.46 + TestModule *test_module = TEST_MODULE (module);
1.47 +
1.48 + test_module->register_func (module);
1.49 +
1.50 + return TRUE;
1.51 +}
1.52 +
1.53 +static void
1.54 +test_module_unload (GTypeModule *module)
1.55 +{
1.56 +}
1.57 +
1.58 +GTypeModule *
1.59 +test_module_new (TestModuleRegisterFunc register_func)
1.60 +{
1.61 + TestModule *test_module = g_object_new (TEST_TYPE_MODULE, NULL);
1.62 + GTypeModule *module = G_TYPE_MODULE (test_module);
1.63 +
1.64 + test_module->register_func = register_func;
1.65 +
1.66 + /* Register the types initially */
1.67 + g_type_module_use (module);
1.68 + g_type_module_unuse (module);
1.69 +
1.70 + return G_TYPE_MODULE (module);
1.71 +}
1.72 +