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)
* clutter/clutter-script-parser.c:
* clutter/clutter-script-private.h: Clean up the code; add a
conversion function for reading a ClutterColor out of a
JSON object or array definition.
* clutter/clutter-script.c: Clean up the code; document properly
how we translate from type name to type function.
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.
* clutter/clutter-script.c: Be more explicit about the fact that
the script id is not the name of an actor, and that it is retrieved
by using clutter_get_script_id().
Fix merging of objects with the same id.
* clutter/clutter-script.c:
(json_object_end): If there already is an ObjectInfo under the
parsed id, merge the construction with the currently stored
state.
(parse_children), (parse_signals),
(parse_behaviours): Append the newly parsed children, signals
and behaviours, in case the ObjectInfo already has unresolved
items.
(clutter_script_construct_object): Fix a typo in the type check.
(clutter_script_init): Do not copy the key inside the hash
table holding the objects - we are already holding it inside
the value.
* clutter/clutter-script.c:
(clutter_script_construct_object): Mark top-level objects,
that is objects that don't have their ownership transferred
when building up a ClutterScript.
(object_info_free): Merge a fix from the stable branch, but
do not check the type - check whether the object is a top
level (we still need the ClutterActor type check in order to
call clutter_actor_destroy()).
* clutter/clutter-script-private.h: Add a flag for the
default stage.
* clutter/clutter-script.c:
(json_object_end): If the "type" member is "ClutterStage"
and we have a "is-default" member set to true then this
is the default stage.
(clutter_script_construct_object): Special case the default
stage instead of each ClutterStage.
(object_info_free): Ditto as above.
* tests/test-script.json: Test the creation of a non-default
stage and the ::destroy handler to quit.
* clutter/clutter-script.c:
(resolve_alpha_func): Use a whitelist containing the alpha function
provided by Clutter, as a fallback in case g_module_open() does not
work.
(clutter_script_parse_alpha): Add an explicit warning in case we
cannot find the alpha function used inside a UI definition.
* clutter/clutter-script-parser.c:
(clutter_script_get_type_from_symbol),
(clutter_script_get_type_from_class): Use BIND_LAZY flag
when looking at the symbols, so we don't load them all up.
* clutter/clutter-script.c (resolve_alpha_func): Ditto as above.
reviewed by: <delete if not using a buddy>
* clutter/clutter-actor.c:
(parse_rotation_array): Inline, and get the JsonArray as a parameter
(parse_rotation): Update
* clutter/clutter-script.c:
(warn_missing_attribute): Fix for emacs-style warnings
(clutter_script_parse_node): Remove an ifdeffed out section
(clutter_script_construct_parameters),
(clutter_script_construct_object): Rename get_parameters, so
it's obvious what it does
* clutter/json/json-parser.[ch]: Use gssize, size we allow -1
as a length (meaning "use the whole string").
(json_parser_load_from_data): Use the passed length instead of
using strlen() all the time.
* clutter/clutter-script.[ch]: Ditto as above.
* clutter/clutter-actor.c (parse_units),
(clutter_actor_parse_custom_node): Do not allow using percentages
of the stage on the stage itself, as it makes little to no
sense.
* clutter/clutter-script.c:
(clutter_script_construct_object): Rearrange code.
* tests/test-script.json: Do not set the size of the stage, to
test for the stage size percentage.
Remove the layout containers: they will be moved to a
high-level library.
* clutter/clutter.h:
* clutter/Makefile.am: Remove layout and boxes from the
build.
* clutter/clutter-layout.[ch]: Remove the ClutterLayout
interface.
* clutter/clutter-box.[ch]:
* clutter/clutter-hbox.[ch]:
* clutter/clutter-vbox.[ch]: Remove ClutterBox and its
subclasses.
* clutter/clutter-label.c: Remove ClutterLayout implementation
* clutter/clutter-script-private.h:
* clutter/clutter-script-parser.c:
* clutter/clutter-script.c:
(clutter_script_parse_node): Remove special parsing for
ClutterMargin and ClutterPadding.
* clutter/clutter-types.h: Remove ClutterPadding and ClutterMargin.
* tests/Makefile.am:
* tests/test-boxes.c: Remove the boxes test case.
* clutter.symbols: Update with the new public symbols
* clutter/clutter-script.h:
* clutter/clutter-script-private.h:
* clutter/clutter-script.c:
(parse_signals), (json_object_end),
(signal_info_free), (object_info_free): Parse the "signals"
member for GObjects.
(clutter_script_connect_signals),
(clutter_script_connect_signals_full): Add new API for autoconnecting
signal handlers using the UI definition files.
* tests/test-script.c:
* tests/test-script.json: Test signal autoconnection.
* 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.
* clutter/clutter-script.c: Add the :filename and :filename-set
properties, to retrieve the path of the currently parsed file (if
:filename-set is TRUE) from the ClutterScriptable implementations.
* clutter/clutter-script.[ch]: Slight API change in the
clutter_script_get_objects() function: now it takes
object name/object return location pairs and returns the
number of objects found and returned.
* tests/test-script.c: Exercise the clutter_script_get_objects()
function.
* clutter/clutter-script.h:
* clutter/clutter-script.c: Add a ::get_type_from_name() virtual
function for bindings to override. The current implementation
calls g_type_from_name() and our lazy class resolver.
* clutter.symbols: Update.
* doc/reference/clutter-sections.txt: Update.
* clutter/Makefile.am:
* clutter/clutter.h:
* clutter/clutter-scriptable.[ch]: Add the ClutterScriptable
interface; by implementing this interface, a class can
override the UI definition parsing and transform complex data
types into GObject properties, or allow custom properties.
* clutter/clutter-script.c:
* clutter/clutter-script-parser.c:
* clutter/clutter-script-private.h: Rearrange the code and
use the ClutterScriptable interface to parse and build the
custom properties. This cleans up the code and also it makes
it more reliable (the complex type parsing is now done using
the target type and not just the name of the property).
* clutter/clutter-script-private.h:
* clutter/clutter-script.h:
* clutter/clutter-script.c: Allow id-less objects: as long
as they have a "type" member, a unique id will be provided.
(json_object_end): Add merge id to the object information
structure.
(apply_behaviours), (add_children): Keep the unresolved
objects around.
(construct_stage), (clutter_script_construct_object): If an
object has unresolved children or behaviours try resolving
them when we ask for it.
(json_parse_end), (clutter_script_ensure_objects): Ensure
that the objects are fully constructed as best as we can when
finished parsing.
(object_info_free), (remove_by_merge_id):
(clutter_script_unmerge_objects): Remove objects under the
same merge id returned by the loading functions. (Fixes
bug #558)
* clutter/json/json-object.c: Automatically transform every
delimiter into an underscore.
* clutter/clutter-script.c: Implement the "parent_texture"
property translation for ClutterCloneTextures, using the
passed id of the parent texture.
* clutter.symbols:
Added a bunch of missing symbols.
* clutter/clutter-script.c:
* json/json-node.c:
Use g_slice_new0 instead of g_slice_new to avoid passing garbage to functions.
* tests/test-threads.c:
Replaced non-portable sleep() with g_usleep().
* clutter/clutter-script.c (construct_timline),
(parse_member_to_property): Transfer ownership of the
implicit timelines to the behaviour, so that they get
unreferenced when the behaviour is destroyed.
(parse_member_to_property): Reverse the list of children
and behaviours.
* clutter/clutter-actor.c: Remove the ::event-after signal:
three event layers to connect to seems a bit overkill.
(clutter_actor_event): Return FALSE, not TRUE by default,
as g_signal_emit() will change the return value if no
handlers are connected
* clutter/clutter-stage.c: Emit ::notify when we change
the fullscreen property.
* clutter/clutter-script.c: Add more documentation for the
definition format and keywords.
(translate_property): Collapse the G_TYPE_ENUM and G_TYPE_FLAGS
cases into one, to simplify the code.
* tests/test-script.c: Test enumeration conversion by using
a value different from the default.
* clutter/json/json-types.h:
* clutter/json/json-array.c:
* clutter/json/json-object.c: Resync with the upstream copy
of JSON-GLib; add json_object_remove_member() and
json_array_remove_element() and fix the g_hash_table_get_keys()
replacement for GLib 2.12.
* clutter/clutter-script.c: Clean up the complex properties
parsing code.
* clutter/json/json-parser.c: Use the commodity JsonNode API
and accept bare values as root nodes.
* clutter/clutter-script-private.h:
* clutter/clutter-script.c: Unreference the created objects
only if they are top-levels, like ClutterBehaviour and
ClutterTimelines. Actors have floating references, so we
just transfer ownership to their containers, and the stage
is owned by the backend. Add the "type_func" key to the
object definition, so the user can supply its own GType
function if the class name doesn't follow the GObject rules.
Document the ClutterScript public API.
* clutter/clutter-script.c (clutter_script_get_object): Construct
the requested object if it hasn't been already. This allows
referencing objects within the same snippet.
* tests/test-script.c: Declare a timeline and use it inside
multiple behaviours; apply multiple behaviours to various
actors, then retrieve the timeline to start it when the test
runs.
* clutter/clutter-script-private.h:
* clutter/clutter-script.h:
* clutter/clutter-script.c: Add licensing information to
the newly added files.
* clutter/clutter-script.c: Support creating behaviours with
ClutterScript. ClutterAlpha objects are implicit, but
timelines can be both explicit objects using their id or
implicit objects. Make the property resolution and translation
more robust. Support the pixbuf property.
* tests/test-script.c: Test the newly added features.
* docs/reference/clutter-docs.sgml:
* docs/reference/clutter-sections.txt: Add ClutterScript.
* clutter/clutter-script.c (json_parse_end):
* clutter/json/json-object.c (json_object_get_members): Replace
the GLib 2.14 API with the equivalent code for GLib < 2.14.
* configure.ac: Revert the dependency bump.
Initial implementation of the UI definition files. (#424)
* clutter/json/Makefile.am:
* clutter/json/*.[ch]: In-tree copy of JSON-GLib, a GLib-based
JSON parser/generator library. We use it in-tree because we might
need to change the API. Ideally, we'd depend on it.
* clutter/clutter.h:
* clutter/clutter-script-private.h:
* clutter/clutter-script.[ch]: ClutterScript, the scenegraph
generator class. It parses JSON streams in form of buffers and
files and builds the scene.
* clutter/clutter-debug.h:
* clutter/clutter-main.c: Add a "script" debug flag
* clutter/Makefile.am: Build glue.
* tests/Makefile.am:
* tests/test-script.c: Add a test case for the ClutterScript.
* configure.ac: Depend on GLib 2.14, so we can use the
g_hash_table_get_key() and g_hash_table_get_values() functions
for the time being; we can probably reimplement those, but we
are going to need 2.14 anyway if we are going to implement a
list model using GSequence.