/* Returns: FALSE if the plugin needed to be loaded and loading the plugin failed.  */
gboolean g_type_module_use(GTypeModule *module)
/* Returns: FALSE if the plugin needed to be loaded and loading the plugin failed.  */
gboolean g_type_module_use(GTypeModule *module)
{
  g_return_val_if_fail (G_IS_TYPE_MODULE (module), FALSE);
  module->use_count++;
  if (module->use_count == 1)
    {
      GSList *tmp_list;
      if (!G_TYPE_MODULE_GET_CLASS (module)->load (module))
	{
	  module->use_count--;
	  return FALSE;
	}
      tmp_list = module->type_infos;
      while (tmp_list)
	{
	  ModuleTypeInfo *type_info = tmp_list->data;
	  if (!type_info->loaded)
	    {
	      g_warning ("plugin '%s' failed to register type '%s'\n",
			 module->name ? module->name : "(unknown)",
			 g_type_name (type_info->type));
	      module->use_count--;
	      return FALSE;
	    }
	  tmp_list = tmp_list->next;
	}
    }
  return TRUE;
}