Ejemplo n.º 1
0
ClutterScript *
gnome_app_script_new_from_file (const gchar *script_name)
{
	ClutterScript *script;
	GError *error;
	gchar *filename;
	gint i, len;

	const gchar *path [] = {
		PIXMAPSDIR,
		NULL};

	filename = open_app_get_ui_uri (script_name);
	if (!filename)
		return NULL;

	script = clutter_script_new ();
	for (len = 0; path [len]; len++) {
	}
        clutter_script_add_search_paths (script, path, len);
	error = NULL;
	clutter_script_load_from_file (script, filename, &error);
	if (error) {
		g_error ("fail to load app login script %s\n", error->message);
		g_error_free (error);
		g_object_unref (script);
		script = NULL;
	}
	gnome_app_script_preload (script);
	g_free (filename);

	return script;
}
Ejemplo n.º 2
0
static VALUE
rbclt_script_add_search_paths (int argc, VALUE *argv, VALUE self)
{
  ClutterScript *script = CLUTTER_SCRIPT (RVAL2GOBJ (self));
  int i;
  const gchar **paths;

  /* Make sure all of the arguments are strings before allocating the
     array */
  for (i = 0; i < argc; i++)
    StringValuePtr (argv[i]);

  paths = g_malloc (sizeof (const gchar *) * argc);

  for (i = 0; i < argc; i++)
    paths[i] = StringValuePtr (argv[i]);

  clutter_script_add_search_paths (script, paths, argc);

  g_free (paths);

  return self;
}