2008-08-27 Emmanuele Bassi <ebassi@openedhand.com>

Bug 1099 - No ClutterScript API to get a list of IDs in a given file

	* clutter/clutter-script.[ch]: Add clutter_script_list_objects(),
	a function for retrieving all the objects built by a ClutterScript
	instance. (Based on a patch by Noah Gibbs)
This commit is contained in:
Emmanuele Bassi 2008-08-27 12:16:56 +00:00
parent d03ad3dd41
commit c34e17163d
5 changed files with 58 additions and 0 deletions

View File

@ -1,3 +1,11 @@
2008-08-27 Emmanuele Bassi <ebassi@openedhand.com>
Bug 1099 - No ClutterScript API to get a list of IDs in a given file
* clutter/clutter-script.[ch]: Add clutter_script_list_objects(),
a function for retrieving all the objects built by a ClutterScript
instance. (Based on a patch by Noah Gibbs)
2008-08-26 Emmanuele Bassi <ebassi@openedhand.com> 2008-08-26 Emmanuele Bassi <ebassi@openedhand.com>
Bug 1090 - Label somtimes returns natural_width < min_width Bug 1090 - Label somtimes returns natural_width < min_width

View File

@ -2424,3 +2424,44 @@ clutter_script_lookup_filename (ClutterScript *script,
return retval; return retval;
} }
/**
* clutter_script_list_objects:
* @script: a #ClutterScript
*
* Retrieves all the objects created by @script.
*
* Note: this function does not increment the reference count of the
* objects it returns.
*
* Return value: a list of #GObject<!-- -->s, or %NULL. The objects are
* owned by the #ClutterScript instance. Use g_list_free() on the
* returned value when done.
*
* Since: 0.8.2
*/
GList *
clutter_script_list_objects (ClutterScript *script)
{
GList *objects, *l;
GList *retval;
g_return_val_if_fail (CLUTTER_IS_SCRIPT (script), NULL);
clutter_script_ensure_objects (script);
if (!script->priv->objects)
return NULL;
retval = NULL;
objects = g_hash_table_get_values (script->priv->objects);
for (l = objects; l != NULL; l = l->next)
{
ObjectInfo *oinfo = l->data;
if (oinfo->object)
retval = g_list_prepend (retval, oinfo->object);
}
g_list_free (objects);
return retval;
}

View File

@ -125,11 +125,14 @@ guint clutter_script_load_from_data (ClutterScript *script,
const gchar *data, const gchar *data,
gssize length, gssize length,
GError **error); GError **error);
GObject * clutter_script_get_object (ClutterScript *script, GObject * clutter_script_get_object (ClutterScript *script,
const gchar *name); const gchar *name);
gint clutter_script_get_objects (ClutterScript *script, gint clutter_script_get_objects (ClutterScript *script,
const gchar *first_name, const gchar *first_name,
...) G_GNUC_NULL_TERMINATED; ...) G_GNUC_NULL_TERMINATED;
GList * clutter_script_list_objects (ClutterScript *script);
void clutter_script_unmerge_objects (ClutterScript *script, void clutter_script_unmerge_objects (ClutterScript *script,
guint merge_id); guint merge_id);
void clutter_script_ensure_objects (ClutterScript *script); void clutter_script_ensure_objects (ClutterScript *script);

View File

@ -1,3 +1,8 @@
2008-08-27 Emmanuele Bassi <ebassi@openedhand.com>
* doc/reference/clutter/clutter-sections.txt: Add
clutter_script_list_objects().
2008-07-30 Ross Burton <ross@openedhand.com> 2008-07-30 Ross Burton <ross@openedhand.com>
* clutter/version.xml.in: * clutter/version.xml.in:

View File

@ -1288,6 +1288,7 @@ clutter_script_get_object
clutter_script_get_objects clutter_script_get_objects
clutter_script_unmerge_objects clutter_script_unmerge_objects
clutter_script_ensure_objects clutter_script_ensure_objects
clutter_script_list_objects
<SUBSECTION> <SUBSECTION>
ClutterScriptConnectFunc ClutterScriptConnectFunc