Commit Graph

106 Commits

Author SHA1 Message Date
Emmanuele Bassi
550168eee3 Clean up deprecated header inclusion
The build should not add deprecated/ into the default INCLUDE paths, so
that deprecated headers are clearly separated; this will make it easier
to get rid of them when we branch out for 2.0.
2012-06-23 08:23:11 +01:00
Emmanuele Bassi
63e909576a Deprecate State and Animator
The PropertyTransition, KeyframeTransition, and TransitionGroup classes
can effectively replace Animator and State in their common usage.
2012-04-27 12:30:48 +01:00
Emmanuele Bassi
2567049ce3 Fix missing/redundant declarations 2012-03-07 12:36:43 +00:00
Emmanuele Bassi
7646404196 script: Support translatable strings for properties
ClutterScript should be able to automatically call gettext() and friends
on strings loaded from a UI definition, prior to passing the string to
the object it is constructing.

The basic implementation is trivial:

  - set a translation domain on the ClutterScript instance
  - mark the translatable strings inside the JSON data, like:

      "property" : {
        "translatable" : true,
        "string" : "a translatable string"
      }

The hard part is now getting the tools we use to extract the
translatable strings to understand the JSON format we use inside
ClutterScript.
2012-03-06 14:23:33 +00:00
Emmanuele Bassi
8d8d4ae7e5 script: Add loading from a resource
GLib has gained support for compiling ancillary data files into the same
binary blob as a library or as an executable.

We should add this feature to ClutterScript, so that it's possible to
bundle UI definitions with an application.
2012-01-24 12:04:56 +00:00
Bastian Winkler
d82bf70d49 script: Don't skip introspection for connect_signals_full()
To allow language bindings to properly override Script.connect_signals()
they'll need access access to Script.connect_signals_full().

Thanks to Jeremy Moles for reporting.
2011-11-25 10:54:54 +01:00
Emmanuele Bassi
bcd37e2e3d script: Hide private symbols
A bunch of private functions we use when parsing got exposed accidentaly
to the list of public symbols by virtue of not having the leading '_'
that we use to filter them out of the shared object — all the while the
header that declares them is a private, non installed one.

Let's rectify this situation with a bit of minor surgery on the code.
2011-09-07 16:14:10 +01:00
Evan Nemerson
a6bd11ac62 introspection: add missing introspection data from Vala bindings
https://bugzilla.gnome.org/show_bug.cgi?id=655387
2011-07-29 13:06:51 +01:00
Emmanuele Bassi
78049c38bf docs: Fixes for building the API reference 2011-07-26 13:44:12 +01:00
Emmanuele Bassi
4f0769d69d docs: Update missing documentation 2011-06-13 13:47:09 +01:00
Emmanuele Bassi
8625f07c3b script: Plug a leak
The SignalInfo structure gained a couple of string fields that should be
deallocated when destroying the structure.
2011-06-13 13:47:09 +01:00
Emmanuele Bassi
a9dd5abfcc script: Allow warping to states
Do not just allow animating states connected to signals: add a "warp"
optional key that ends up calling clutter_state_warp_to_state(). This
is useful for debugging.
2011-06-13 13:47:09 +01:00
Emmanuele Bassi
d9c1a2ebbb script: Use a weak ref to remove the signal emission hook
When an object goes away we should remove the emission hook for the
state transitions, to avoid leaving hooks around.
2011-06-13 13:47:09 +01:00
Emmanuele Bassi
b33973f9f8 script: Rename "state" → "states"
Make it clear that the key used when defining a state-based signal is
linked to the states of a ClutterState.
2011-06-13 13:47:08 +01:00
Emmanuele Bassi
29d7c5a297 script: Allow resolving signals states added from code
Currently, defining states for object signals can only be done by
defining a ClutterState inside the ClutterScript definition. We should
allow creating a (named) ClutterState in code, and associating it to a
ClutterScript instance — and have the Script resolve the "state" field
of a signal definition correctly.
2011-06-13 13:47:08 +01:00
Emmanuele Bassi
dd8cf63a62 script: Allow connecting signal to ClutterState states
One of the uses of a ClutterState state machine along with ClutterScript
is to provide a quick way to transition from state to state in response
to signal emitted on specific instances.

Connecting a real function, in code, to a specific signal does not
improve the ease of use of ClutterScript to define scenes.

By adding a new signal definition to the current one we can have both a
simple way to define application logic in code and in the UI definition
file.

The new syntax is trivial:

  {
    "name" : <signal name>,
    "state" : <state machine script id>,
    "target-state" : <target state>
  }

The ClutterState instance is identified by its script id, and the target
state is resolved at run-time, so it can be defined both in
ClutterScript or in code. Ideally, we should find a way to associate a
default ClutterState instance to the ClutterScript one that parses the
definition; this way we would be able to remove the "state" member, or
even "style" the behaviour of an object by replacing the ClutterState
instance.

The implementation uses a signal emission hook, to avoid knowing the
signal signature; we check the emitter of the signal against the object
that defined the signal, to avoid erroneous state changes.
2011-06-13 13:47:08 +01:00
Emmanuele Bassi
2b81d90dd7 Eliminate G_CONST_RETURN
The G_CONST_RETURN define in GLib is, and has always been, a bit fuzzy.

We always used it to conform to the platform, at least for public-facing
API.

At first I assumed it has something to do with brain-damaged compilers
or with weird platforms where const was not really supported; sadly,
it's something much, much worse: it's a define that can be toggled at
compile-time to remove const from the signature of public API. This is a
truly terrifying feature that I assume was added in the past century,
and whose inception clearly had something to do with massive doses of
absynthe and opium — because any other explanation would make the
existence of such a feature even worse than assuming drugs had anything
to do with it.

Anyway, and pleasing the gods, this dubious feature is being
removed/deprecated in GLib; see bug:

  https://bugzilla.gnome.org/show_bug.cgi?id=644611

Before deprecation, though, we should just remove its usage from the
whole API. We should especially remove its usage from Cally's internals,
since there it never made sense in the first place.
2011-06-07 16:06:24 +01:00
Robert Bragg
589c80e41e Remove last dependency on the GdkPixbuf API
In test-pixmap.c instead of using the GdkPixbuf API to load the
redhand.png image we now use the cairo API to load the png into a xlib
surface which wraps our Pixmap.

This test was the last thing that depended on the gdk API and since
it's more concise to use Cairo here which is a hard dependency for
Clutter this change means we avoid depending on GdkPixbuf directly.
2011-05-06 15:44:13 +01:00
Jasper St. Pierre
0c576c0c33 Remove private helper #define's
Finish off the second half of 09a830d294.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2596
2011-03-03 11:47:49 +00:00
Emmanuele Bassi
5c398c18ad More ISO C90 warning fixes in Clutter
This time, in Clutter core.

The ObjC standard library provides a type called 'id', which obviously
requires any library to either drop the useful shadowed variable warning
or stop using 'id' as a variable name.

Yes, it's almost unbearably stupid. Well, at least it's not 'index' in
string.h, or 'y2' in math.h.
2011-02-15 12:40:11 +00:00
Emmanuele Bassi
63cef64d17 docs: Fix some wrong function/signal/property names 2010-11-18 15:21:16 +00:00
Emmanuele Bassi
21eb49098a script: Fix the memory management
Currently, the memory management in ClutterScript is overly complicated.
The basic design tenet should be:

  - ClutterScript owns a reference on every object it creates

This allows the Script instance to reliably handle the lifetime of the
instances from creation to disposal.

In case of unmerge, the Script instance should destroy any Actor
instance, except for the Stage, and release the reference it owns. The
Stage is special because it's really owned by Clutter itself, and it
should be destroyed explicitly.

When disposing the Script itself, it should just release the reference;
any parented actor, or any InitiallyUnowned instance, will then be
managed by the parent object, as they should, while every GObject
instance will go away, as documented.

This commit is based on a patch by:

  Henrik Hedberg <hhedberg@innologies.fi>

http://bugzilla.clutter-project.org/show_bug.cgi?id=2316
2010-10-19 01:42:19 +01:00
Emmanuele Bassi
78d4073f8e Remove unused variables 2010-10-19 01:42:19 +01:00
Emmanuele Bassi
050e775da2 Move more classes to install_properties() 2010-10-18 11:26:45 +01:00
Emmanuele Bassi
2f21c851ea script: Fix annotation for get_object()'s return value 2010-10-11 15:39:19 +01:00
Emmanuele Bassi
e8d3ab4fd3 introspection: Skip Script.connect_signals_full()
It's meant to be used by language bindings, not by applications.
2010-10-03 15:16:41 +01:00
Emmanuele Bassi
66b0c1969c Remove the internal copy of JSON-GLib
The internal copy of JSON-GLib was meant to go away right after the 1.0
release, given that JSON-GLib was still young and relatively unknown.

Nowadays, many projects started depending on this little library, and
distributions ship it and keep it up to date.

Keeping a copy of JSON-GLib means keeping it up to date; unfortunately,
this would also imply updating the code not just for the API but for the
internal implementations.

Starting with the 1.2 release, Clutter preferably dependend on the
system copy; with the 1.4 release we stopped falling back automatically.
The 1.6 cycle finally removes the internal copy and requires a copy of
JSON-GLib installed on the target system in order to compile Clutter.
2010-09-29 15:57:28 +01:00
Emmanuele Bassi
8a5686d835 Further annotation fixes 2010-09-08 16:41:47 +01:00
Emmanuele Bassi
3e74f42f07 introspection: Add annotations
Reduce the amount of warnings coming from g-ir-scanner.
2010-09-03 12:14:50 +01:00
Emmanuele Bassi
ad0c36e1a1 docs: Fixes to avoid gtk-doc warnings 2010-08-17 14:54:20 +01:00
Neil Roberts
8d51617979 Conditionally use g_object_notify_by_pspec
This adds a wrapper macro to clutter-private that will use
g_object_notify_by_pspec if it's compiled against a version of GLib
that is sufficiently new. Otherwise it will notify by the property
name as before by extracting the name from the pspec. The objects can
then store a static array of GParamSpecs and notify using those as
suggested in the documentation for g_object_notify_by_pspec.

Note that the name of the variable used for storing the array of
GParamSpecs is obj_props instead of properties as used in the
documentation because some places in Clutter uses 'properties' as the
name of a local variable.

Mose of the classes in Clutter have been converted using the script in
the bug report. Some classes have not been modified even though the
script picked them up as described here:

json-generator:

 We probably don't want to modify the internal copy of JSON

behaviour-depth:
rectangle:
score:
stage-manager:

 These aren't using the separate GParamSpec* variable style.

blur-effect:
win32/device-manager:

 Don't actually define any properties even though it has the enum.

box-layout:
flow-layout:

  Have some per-child properties that don't work automatically with
  the script.

clutter-model:

  The script gets confused with ClutterModelIter

stage:

  Script gets confused because PROP_USER_RESIZE doesn't match
  "user-resizable"

test-layout:

  Don't really want to modify the tests

http://bugzilla.clutter-project.org/show_bug.cgi?id=2150
2010-08-10 17:12:06 +01:00
Emmanuele Bassi
fd27ca7398 Mark property strings for translation
Both the nick and the blurb fields should be translatable, for UI
builders and other introspection-based tools.
2010-07-15 14:07:07 +01:00
Emmanuele Bassi
b7f99ddd3c script: Let ClutterActor parse behaviours
Up until now, the "behaviours" member of an actor definition was parsed
by the ClutterScript parser itself - even though it's not strictly
necessary.

In an effort to minimize the ad hoc code in the Script parser, we should
let ClutterActor handle all the special cases that involve
actor-specific members.
2010-07-09 14:59:32 +01:00
Emmanuele Bassi
4ed4e86e75 docs: Various fixes for gtk-doc 2010-06-30 15:51:12 +01:00
Damien Lespiau
52a78a7220 analysis: FALSE/0 used in pointer context
While this is totally fine (0 in the pointer context will be converted
in the right internal NULL representation, which could be a value with
some bits to 1), I believe it's clearer to use NULL in the pointer
context.

It seems that, in most case, it's more an overlook than a deliberate
choice to use FALSE/0 as NULL, eg. copying a _COGL_GET_CONTEXT (ctx, 0)
or a g_return_val_if_fail (cond, 0) from a function returning a
gboolean.
2010-06-01 12:08:18 +01:00
Emmanuele Bassi
79acb088e7 Remove mentions of the FSF address
Since using addresses that might change is something that finally
the FSF acknowledge as a plausible scenario (after changing address
twice), the license blurb in the source files should use the URI
for getting the license in case the library did not come with it.

Not that URIs cannot possibly change, but at least it's easier to
set up a redirection at the same place.

As a side note: this commit closes the oldes bug in Clutter's bug
report tool.

http://bugzilla.openedhand.com/show_bug.cgi?id=521
2010-03-01 12:56:10 +00:00
Emmanuele Bassi
5c67e8e0c0 script: Coding style clean-ups 2009-11-06 14:07:46 +00:00
Emmanuele Bassi
179a66c922 script: Document private functions 2009-11-06 14:07:26 +00:00
Emmanuele Bassi
30bc36082e Do not pass flags to g_module_open(NULL)
The flags are ignored when opening the main module, so we
should pass 0 to avoid confusion when reading the source.
2009-11-06 14:06:18 +00:00
Emmanuele Bassi
4df59d330c script: Separate construction from properties application
Currently, ClutterScriptParser will construct the object (using the
construct-only and construct parameters), apply the properties from
the ClutterScript definition, and eventuall will add children and
behaviours.

The construction phase should be more compartimentalized: the objects
should be constructed first and eventual children and behaviours
added. Then, once an object is requested or when the parsing process
has terminated, all the properties should be applied.

This change allows us to set up the actors before setting their
non-construct properties.
2009-11-04 14:18:43 +00:00
Emmanuele Bassi
31e5dadb68 script: Move all parser code inside ClutterScriptParser
ClutterScript is currently a mix of parser-related code and
the ClutterScript object. All the parser-related code should
be moved inside a private class, ClutterScriptParser, inheriting
from JsonParser.
2009-11-04 13:32:26 +00:00
Emmanuele Bassi
6e571928a4 script: Take a copy of property nodes
Instead of counting on a JsonNode pointer to survive we should take
a copy. This allows keeping unresolved properties across different
ClutterScript passes.
2009-11-04 10:43:11 +00:00
Emmanuele Bassi
4ad57aa3e4 script: Use JsonObject direct accessors
Instead of getting the JsonNode for a member of which we mandate
the type we can use the typed accessors of JsonObject.
2009-11-04 10:43:11 +00:00
Emmanuele Bassi
7a52fddcd6 alpha: Manually parse the :mode property in ClutterScript
The :mode property for a ClutterAlpha can either be an integer, for
an easing mode logical id, or a string for the easing mode "nickname".
2009-10-21 16:14:40 +01:00
Emmanuele Bassi
01bc3fa2c8 script, docs: Update documentation for alphas
It is now possible to have Alpha instances defined explicitly for
behaviours, so we need to fix the documentation.
2009-10-21 15:43:01 +01:00
Emmanuele Bassi
50aec3c540 script: Always allow setting object properties by id reference
The block that allows setting a GObject property holding an object
instance is conditionally depending on the USE_PIXBUF define. This
makes it impossible to reference an object inside ClutterScript on
platforms not using GdkPixbuf.
2009-10-21 15:17:50 +01:00
Emmanuele Bassi
2ffebad3d9 [script] Convert double to float when parsing
The default floating point type for JSON is double precision; this means
that we need to conver to single precision when setting a property with
type G_TYPE_FLOAT.
2009-08-26 16:48:32 +01:00
Emmanuele Bassi
cfbbacb807 [script] Fix the default deserialization
Properties parsed from ClutterScript should now use G_TYPE_INT64
and automatically convert between G_TYPE_INT and G_TYPE_INT64.
2009-08-12 16:01:25 +01:00
Emmanuele Bassi
df572d089c [script] Simplify the parser code
JSON-GLib provides simple accessors for basic types so that we
can avoid getting the JsonNode out of a complex type. This makes
the code simpler to understand.
2009-06-29 17:01:15 +01:00
Emmanuele Bassi
d743aeaa21 [json] Update the internal JSON-GLib copy
There have been changes in JSON-GLib upstream to clean up the
data structures, and facilitate introspection.

We still not use the updated JsonParser with the (private) JsonScanner
code, since it's a fork of GLib's GScanner.
2009-06-09 14:07:22 +01:00