示例#1
0
/* This only will ever be called if an error occurs during
 * initialization
 */
static void
pango_module_finalize (GObject *object)
{
  PangoModule *module = PANGO_MODULE (object);

  g_free (module->path);

  G_OBJECT_CLASS (pango_module_parent_class)->finalize (object);
}
示例#2
0
文件: modules.c 项目: soubok/libset
/* This only will ever be called if an error occurs during
 * initialization
 */
static void
pango_module_finalize (GObject *object)
{
  PangoModule *module = PANGO_MODULE (object);

  g_free (module->path);

  parent_class->finalize (object);
}
示例#3
0
static gboolean
pango_module_load (GTypeModule *module)
{
  PangoModule *pango_module = PANGO_MODULE (module);

  if (pango_module->path)
    {
      pango_module->library = g_module_open (pango_module->path, G_MODULE_BIND_LOCAL);
      if (!pango_module->library)
	{
	  GQuark warned_quark = get_warned_quark ();
	  if (!g_object_get_qdata (G_OBJECT (pango_module), warned_quark))
	    {
	      g_warning ("%s", g_module_error());
	      g_object_set_qdata_full (G_OBJECT (pango_module), warned_quark,
				       GINT_TO_POINTER (1), NULL);
	    }
	  return FALSE;
	}

      /* extract symbols from the lib */
      if (!g_module_symbol (pango_module->library, "script_engine_init",
			    (gpointer *)(void *)&pango_module->init) ||
	  !g_module_symbol (pango_module->library, "script_engine_exit",
			    (gpointer *)(void *)&pango_module->exit) ||
	  !g_module_symbol (pango_module->library, "script_engine_list",
			    (gpointer *)(void *)&pango_module->list) ||
	  !g_module_symbol (pango_module->library, "script_engine_create",
			    (gpointer *)(void *)&pango_module->create))
	{
	  GQuark warned_quark = get_warned_quark ();
	  if (!g_object_get_qdata (G_OBJECT (pango_module), warned_quark))
	    {
	      g_warning ("%s", g_module_error());
	      g_object_set_qdata_full (G_OBJECT (pango_module), warned_quark,
				       GINT_TO_POINTER (1), NULL);
	    }

	  g_module_close (pango_module->library);

	  return FALSE;
	}
    }

  /* call the module's init function to let it */
  /* setup anything it needs to set up. */
  pango_module->init (module);

  return TRUE;
}
示例#4
0
static void
pango_module_unload (GTypeModule *module)
{
  PangoModule *pango_module = PANGO_MODULE (module);

  pango_module->exit();

  if (pango_module->path)
    {
      g_module_close (pango_module->library);
      pango_module->library = NULL;

      pango_module->init = NULL;
      pango_module->exit = NULL;
      pango_module->list = NULL;
      pango_module->create = NULL;
    }
}
示例#5
0
文件: modules.c 项目: soubok/libset
static gboolean
pango_module_load (GTypeModule *module)
{
  PangoModule *pango_module = PANGO_MODULE (module);

  if (pango_module->path)
    {
      pango_module->library = g_module_open (pango_module->path, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);
      if (!pango_module->library)
	{
	  g_warning ("%s", g_module_error());
	  return FALSE;
	}

      /* extract symbols from the lib */
      if (!g_module_symbol (pango_module->library, "script_engine_init",
			    (gpointer *)&pango_module->init) ||
	  !g_module_symbol (pango_module->library, "script_engine_exit",
			    (gpointer *)&pango_module->exit) ||
	  !g_module_symbol (pango_module->library, "script_engine_list",
			    (gpointer *)&pango_module->list) ||
	  !g_module_symbol (pango_module->library, "script_engine_create",
			    (gpointer *)&pango_module->create))
	{
	  g_warning ("%s", g_module_error());
	  g_module_close (pango_module->library);

	  return FALSE;
	}
    }

  /* call the module's init function to let it */
  /* setup anything it needs to set up. */
  pango_module->init (module);

  return TRUE;
}