Blame tests/gobject/testmodule.c

Packit ae235b
/* GObject - GLib Type, Object, Parameter and Signal Library
Packit ae235b
 * testmodule.c: Dummy dynamic type module
Packit ae235b
 * Copyright (C) 2003 Red Hat, Inc.
Packit ae235b
 *
Packit ae235b
 * This library is free software; you can redistribute it and/or
Packit ae235b
 * modify it under the terms of the GNU Lesser General Public
Packit ae235b
 * License as published by the Free Software Foundation; either
Packit ae235b
 * version 2.1 of the License, or (at your option) any later version.
Packit ae235b
 *
Packit ae235b
 * This library is distributed in the hope that it will be useful,
Packit ae235b
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit ae235b
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit ae235b
 * Lesser General Public License for more details.
Packit ae235b
 *
Packit ae235b
 * You should have received a copy of the GNU Lesser General Public
Packit ae235b
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
Packit ae235b
 */
Packit ae235b
Packit ae235b
#include "testmodule.h"
Packit ae235b
#include "testcommon.h"
Packit ae235b
Packit ae235b
static gboolean test_module_load   (GTypeModule *module);
Packit ae235b
static void     test_module_unload (GTypeModule *module);
Packit ae235b
Packit ae235b
static void
Packit ae235b
test_module_class_init (TestModuleClass *class)
Packit ae235b
{
Packit ae235b
  GTypeModuleClass *module_class = G_TYPE_MODULE_CLASS (class);
Packit ae235b
Packit ae235b
  module_class->load = test_module_load;
Packit ae235b
  module_class->unload = test_module_unload;
Packit ae235b
}
Packit ae235b
Packit ae235b
DEFINE_TYPE (TestModule, test_module,
Packit ae235b
	     test_module_class_init, NULL, NULL,
Packit ae235b
	     G_TYPE_TYPE_MODULE)
Packit ae235b
Packit ae235b
static gboolean
Packit ae235b
test_module_load (GTypeModule *module)
Packit ae235b
{
Packit ae235b
  TestModule *test_module = TEST_MODULE (module);
Packit ae235b
Packit ae235b
  test_module->register_func (module);
Packit ae235b
  
Packit ae235b
  return TRUE;
Packit ae235b
}
Packit ae235b
Packit ae235b
static void
Packit ae235b
test_module_unload (GTypeModule *module)
Packit ae235b
{
Packit ae235b
}
Packit ae235b
Packit ae235b
GTypeModule *
Packit ae235b
test_module_new (TestModuleRegisterFunc register_func)
Packit ae235b
{
Packit ae235b
  TestModule *test_module = g_object_new (TEST_TYPE_MODULE, NULL);
Packit ae235b
  GTypeModule *module = G_TYPE_MODULE (test_module);
Packit ae235b
  
Packit ae235b
  test_module->register_func = register_func;
Packit ae235b
Packit ae235b
  /* Register the types initially */
Packit ae235b
  g_type_module_use (module);
Packit ae235b
  g_type_module_unuse (module);
Packit ae235b
Packit ae235b
  return G_TYPE_MODULE (module);
Packit ae235b
}
Packit ae235b