mirror of
https://github.com/brl/mutter.git
synced 2024-11-29 19:40:43 -05:00
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:
parent
bbf57ee461
commit
b0e169d73c
20
ChangeLog
20
ChangeLog
@ -1,3 +1,23 @@
|
||||
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.
|
||||
|
||||
2007-11-14 Emmanuele Bassi <ebassi@openedhand.com>
|
||||
|
||||
* clutter/cutter-deprecated.h: Don't let everyone know from where
|
||||
|
@ -513,8 +513,9 @@ clutter_script_get_objects
|
||||
clutter_script_unmerge_objects
|
||||
clutter_script_ensure_objects
|
||||
clutter_script_get_type_from_name
|
||||
clutter_get_script_id
|
||||
clutter_scriptable_get_type
|
||||
clutter_scriptable_set_name
|
||||
clutter_scriptable_get_name
|
||||
clutter_scriptable_set_id
|
||||
clutter_scriptable_get_id
|
||||
clutter_scriptable_parse_custom_node
|
||||
clutter_scriptable_set_custom_property
|
||||
|
@ -75,13 +75,9 @@
|
||||
#include "clutter-units.h"
|
||||
#include "cogl.h"
|
||||
|
||||
static void clutter_scriptable_iface_init (ClutterScriptableIface *iface);
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (ClutterActor,
|
||||
G_DEFINE_ABSTRACT_TYPE (ClutterActor,
|
||||
clutter_actor,
|
||||
G_TYPE_INITIALLY_UNOWNED,
|
||||
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE,
|
||||
clutter_scriptable_iface_init));
|
||||
G_TYPE_INITIALLY_UNOWNED);
|
||||
|
||||
static guint32 __id = 0;
|
||||
|
||||
@ -148,26 +144,6 @@ enum
|
||||
|
||||
static guint actor_signals[LAST_SIGNAL] = { 0, };
|
||||
|
||||
static void
|
||||
clutter_actor_scriptable_set_name (ClutterScriptable *scriptable,
|
||||
const gchar *name)
|
||||
{
|
||||
clutter_actor_set_name (CLUTTER_ACTOR (scriptable), name);
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
clutter_actor_scriptable_get_name (ClutterScriptable *scriptable)
|
||||
{
|
||||
return clutter_actor_get_name (CLUTTER_ACTOR (scriptable));
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_scriptable_iface_init (ClutterScriptableIface *iface)
|
||||
{
|
||||
iface->set_name = clutter_actor_scriptable_set_name;
|
||||
iface->get_name = clutter_actor_scriptable_get_name;
|
||||
}
|
||||
|
||||
static void
|
||||
_clutter_actor_apply_modelview_transform (ClutterActor * self);
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -109,6 +109,8 @@ void clutter_script_ensure_objects (ClutterScript *script);
|
||||
GType clutter_script_get_type_from_name (ClutterScript *script,
|
||||
const gchar *type_name);
|
||||
|
||||
G_CONST_RETURN gchar *clutter_get_script_id (GObject *object);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_SCRIPT_H__ */
|
||||
|
@ -66,57 +66,61 @@ clutter_scriptable_get_type (void)
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_scriptable_set_name:
|
||||
* clutter_scriptable_set_id:
|
||||
* @scriptable: a #ClutterScriptable
|
||||
* @name: the name of the object
|
||||
* @id: the #ClutterScript id of the object
|
||||
*
|
||||
* Sets @name as the name for this instance of #ClutterScriptableIface.
|
||||
* This name can be used by user interface designer applications.
|
||||
* Sets @id as the unique Clutter script it for this instance of
|
||||
* #ClutterScriptableIface.
|
||||
*
|
||||
* This name can be used by user interface designer applications to
|
||||
* define a unique name for an object constructable using the UI
|
||||
* definition language parsed by #ClutterScript.
|
||||
*
|
||||
* Since: 0.6
|
||||
*/
|
||||
void
|
||||
clutter_scriptable_set_name (ClutterScriptable *scriptable,
|
||||
const gchar *name)
|
||||
clutter_scriptable_set_id (ClutterScriptable *scriptable,
|
||||
const gchar *id)
|
||||
{
|
||||
ClutterScriptableIface *iface;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_SCRIPTABLE (scriptable));
|
||||
g_return_if_fail (name != NULL);
|
||||
g_return_if_fail (id != NULL);
|
||||
|
||||
iface = CLUTTER_SCRIPTABLE_GET_IFACE (scriptable);
|
||||
if (iface->set_name)
|
||||
iface->set_name (scriptable, name);
|
||||
if (iface->set_id)
|
||||
iface->set_id (scriptable, id);
|
||||
else
|
||||
g_object_set_data_full (G_OBJECT (scriptable),
|
||||
"clutter-script-name",
|
||||
g_strdup (name),
|
||||
"clutter-script-id",
|
||||
g_strdup (id),
|
||||
g_free);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_scriptable_get_name:
|
||||
* clutter_scriptable_get_id:
|
||||
* @scriptable: a #ClutterScriptable
|
||||
*
|
||||
* Retrieves the name of @scriptable set using clutter_scriptable_set_name().
|
||||
* Retrieves the id of @scriptable set using clutter_scriptable_set_id().
|
||||
*
|
||||
* Return value: the name of the object. The returned string is owned by
|
||||
* Return value: the id of the object. The returned string is owned by
|
||||
* the scriptable object and should never be modified of freed
|
||||
*
|
||||
* Since: 0.6
|
||||
*/
|
||||
G_CONST_RETURN gchar *
|
||||
clutter_scriptable_get_name (ClutterScriptable *scriptable)
|
||||
clutter_scriptable_get_id (ClutterScriptable *scriptable)
|
||||
{
|
||||
ClutterScriptableIface *iface;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_SCRIPTABLE (scriptable), NULL);
|
||||
|
||||
iface = CLUTTER_SCRIPTABLE_GET_IFACE (scriptable);
|
||||
if (iface->get_name)
|
||||
return iface->get_name (scriptable);
|
||||
if (iface->get_id)
|
||||
return iface->get_id (scriptable);
|
||||
else
|
||||
return g_object_get_data (G_OBJECT (scriptable), "clutter-script-name");
|
||||
return g_object_get_data (G_OBJECT (scriptable), "clutter-script-id");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -43,8 +43,8 @@ typedef struct _ClutterScriptableIface ClutterScriptableIface;
|
||||
|
||||
/**
|
||||
* ClutterScriptableIface:
|
||||
* @set_name: virtual function for setting the name of a scriptable object
|
||||
* @get_name: virtual function for getting the name of a scriptable object
|
||||
* @set_id: virtual function for setting the id of a scriptable object
|
||||
* @get_id: virtual function for getting the id of a scriptable object
|
||||
* @parse_custom_node: virtual function for parsing complex data containers
|
||||
* into GObject properties
|
||||
* @set_custom_property: virtual function for setting a custom property
|
||||
@ -59,9 +59,9 @@ struct _ClutterScriptableIface
|
||||
{
|
||||
GTypeInterface g_iface;
|
||||
|
||||
void (* set_name) (ClutterScriptable *scriptable,
|
||||
void (* set_id) (ClutterScriptable *scriptable,
|
||||
const gchar *name);
|
||||
const gchar *(* get_name) (ClutterScriptable *scriptable);
|
||||
const gchar *(* get_id) (ClutterScriptable *scriptable);
|
||||
|
||||
gboolean (* parse_custom_node) (ClutterScriptable *scriptable,
|
||||
ClutterScript *script,
|
||||
@ -76,9 +76,9 @@ struct _ClutterScriptableIface
|
||||
|
||||
GType clutter_scriptable_get_type (void) G_GNUC_CONST;
|
||||
|
||||
void clutter_scriptable_set_name (ClutterScriptable *scriptable,
|
||||
const gchar *name);
|
||||
G_CONST_RETURN gchar *clutter_scriptable_get_name (ClutterScriptable *scriptable);
|
||||
void clutter_scriptable_set_id (ClutterScriptable *scriptable,
|
||||
const gchar *id);
|
||||
G_CONST_RETURN gchar *clutter_scriptable_get_id (ClutterScriptable *scriptable);
|
||||
gboolean clutter_scriptable_parse_custom_node (ClutterScriptable *scriptable,
|
||||
ClutterScript *script,
|
||||
GValue *value,
|
||||
|
@ -1,3 +1,8 @@
|
||||
2007-11-14 Emmanuele Bassi <ebassi@openedhand.com>
|
||||
|
||||
* clutter-sections.txt: Update with the ClutterScriptable changes
|
||||
and add clutter_get_script_id().
|
||||
|
||||
2007-10-28 Matthew Allum <mallum@openedhand.com>
|
||||
|
||||
* clutter-animation.sgml:
|
||||
|
@ -1101,6 +1101,7 @@ clutter_script_get_objects
|
||||
clutter_script_unmerge_objects
|
||||
clutter_script_ensure_objects
|
||||
clutter_script_get_type_from_name
|
||||
clutter_get_script_id
|
||||
<SUBSECTION Standard>
|
||||
CLUTTER_TYPE_SCRIPT
|
||||
CLUTTER_SCRIPT
|
||||
@ -1119,8 +1120,8 @@ clutter_script_error_quark
|
||||
<FILE>clutter-scriptable</FILE>
|
||||
<TITLE>ClutterScriptable</TITLE>
|
||||
ClutterScriptableIface
|
||||
clutter_scriptable_set_name
|
||||
clutter_scriptable_get_name
|
||||
clutter_scriptable_set_id
|
||||
clutter_scriptable_get_id
|
||||
clutter_scriptable_parse_custom_node
|
||||
clutter_scriptable_set_custom_property
|
||||
<SUBSECTION Standard>
|
||||
|
@ -66,6 +66,7 @@ blue_button_press (ClutterActor *actor,
|
||||
ClutterButtonEvent *event,
|
||||
gpointer data)
|
||||
{
|
||||
g_print ("[*] Pressed `%s'\n", clutter_get_script_id (G_OBJECT (actor)));
|
||||
g_print ("[*] Unmerging objects with merge id: %d\n", merge_id);
|
||||
|
||||
clutter_script_unmerge_objects (script, merge_id);
|
||||
@ -80,6 +81,8 @@ red_button_press (ClutterActor *actor,
|
||||
{
|
||||
GObject *timeline;
|
||||
|
||||
g_print ("[*] Pressed `%s'\n", clutter_get_script_id (G_OBJECT (actor)));
|
||||
|
||||
timeline = clutter_script_get_object (script, "main-timeline");
|
||||
g_assert (CLUTTER_IS_TIMELINE (timeline));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user