2007-11-14 Emmanuele Bassi <ebassi@openedhand.com>

* clutter/clutter-scriptable.[ch]: Rename ::set_name and ::get_name
	to ::set_id and ::get_id, to avoid potential confusion with the
	ClutterActor:name property.

	* clutter/clutter-script.h:
	* clutter/clutter-script.c (clutter_script_construct_object): Use
	clutter_scriptable_set_id().

	(clutter_get_script_id): Add a public function to retrieve the ID
	used in the UI definition files from an object.

	* clutter/clutter-actor.c: Do not set the name of the actor with
	the ID set in the UI definition files.

	* tests/test-script.c: Test clutter_get_script_id().

	* clutter.symbols: Update with the new symbols.
This commit is contained in:
Emmanuele Bassi
2007-11-14 11:32:24 +00:00
parent bbf57ee461
commit b0e169d73c
10 changed files with 93 additions and 58 deletions

View File

@ -1168,9 +1168,9 @@ clutter_script_construct_object (ClutterScript *script,
oinfo->has_unresolved = FALSE;
if (scriptable)
clutter_scriptable_set_name (scriptable, oinfo->id);
clutter_scriptable_set_id (scriptable, oinfo->id);
else
g_object_set_data_full (object, "clutter-script-name",
g_object_set_data_full (object, "clutter-script-id",
g_strdup (oinfo->id),
g_free);
@ -1688,6 +1688,29 @@ clutter_script_get_type_from_name (ClutterScript *script,
return CLUTTER_SCRIPT_GET_CLASS (script)->get_type_from_name (script, type_name);
}
/**
* clutter_get_script_id:
* @gobject: a #GObject
*
* Retrieves the Clutter script id, if any.
*
* Return value: the script id, or %NULL if @object was not defined inside
* a UI definition file. The returned string is owned by the object and
* should never be modified or freed.
*
* Since: 0.6
*/
G_CONST_RETURN gchar *
clutter_get_script_id (GObject *gobject)
{
g_return_val_if_fail (G_IS_OBJECT (gobject), NULL);
if (CLUTTER_IS_SCRIPTABLE (gobject))
return clutter_scriptable_get_id (CLUTTER_SCRIPTABLE (gobject));
else
return g_object_get_data (gobject, "clutter-script-id");
}
GQuark
clutter_script_error_quark (void)
{