2008-06-24 Emmanuele Bassi <ebassi@openedhand.com>
Bug 989 - Add a search path for clutter script assets * clutter/clutter-script.h: * clutter/clutter-script.c: (clutter_script_finalize), (clutter_script_add_search_paths), (clutter_script_lookup_filename): Add the ability to define multiple search paths inside ClutterScript and to look up a specific filename inside those search paths. This is useful to define a set of directories where the assets for a UI definition are and still reference those assets by their name instead of the full path. (989, based on a patch by Matthew Allum) * clutter/clutter-texture.c: (clutter_texture_set_custom_property): Use the newly added clutter_script_lookup_filename() function.
This commit is contained in:
@ -807,29 +807,9 @@ clutter_texture_set_custom_property (ClutterScriptable *scriptable,
|
||||
gchar *path;
|
||||
GError *error;
|
||||
|
||||
if (g_path_is_absolute (str))
|
||||
path = g_strdup (str);
|
||||
else
|
||||
{
|
||||
gchar *dirname = NULL;
|
||||
gboolean is_filename = FALSE;
|
||||
|
||||
g_object_get (script, "filename-set", &is_filename, NULL);
|
||||
if (is_filename)
|
||||
{
|
||||
gchar *filename = NULL;
|
||||
|
||||
g_object_get (script, "filename", &filename, NULL);
|
||||
dirname = g_path_get_dirname (filename);
|
||||
|
||||
g_free (filename);
|
||||
}
|
||||
else
|
||||
dirname = g_get_current_dir ();
|
||||
|
||||
path = g_build_filename (dirname, str, NULL);
|
||||
g_free (dirname);
|
||||
}
|
||||
path = clutter_script_lookup_filename (script, str);
|
||||
if (G_UNLIKELY (!path))
|
||||
return;
|
||||
|
||||
error = NULL;
|
||||
clutter_texture_set_from_file (texture, path, &error);
|
||||
|
Reference in New Issue
Block a user