mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 03:22:04 +00:00
2007-10-26 Emmanuele Bassi <ebassi@openedhand.com>
* 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.
This commit is contained in:
parent
736bbfb713
commit
6ab8c4d28a
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
||||
2007-10-26 Emmanuele Bassi <ebassi@openedhand.com>
|
||||
|
||||
* 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.
|
||||
|
||||
2007-10-25 Emmanuele Bassi <ebassi@openedhand.com>
|
||||
|
||||
* clutter/clutter-behaviour-path.c: Reverse the list of
|
||||
|
@ -512,6 +512,7 @@ clutter_script_get_object
|
||||
clutter_script_get_objects
|
||||
clutter_script_unmerge_objects
|
||||
clutter_script_ensure_objects
|
||||
clutter_script_get_type_from_name
|
||||
clutter_scriptable_get_type
|
||||
clutter_scriptable_set_name
|
||||
clutter_scriptable_get_name
|
||||
|
@ -1043,13 +1043,13 @@ clutter_script_construct_object (ClutterScript *script,
|
||||
|
||||
if (oinfo->gtype == G_TYPE_INVALID)
|
||||
{
|
||||
if (oinfo->type_func)
|
||||
if (G_UNLIKELY (oinfo->type_func))
|
||||
oinfo->gtype = clutter_script_get_type_from_symbol (oinfo->type_func);
|
||||
else
|
||||
oinfo->gtype = clutter_script_get_type_from_class (oinfo->class_name);
|
||||
oinfo->gtype = clutter_script_get_type_from_name (script, oinfo->class_name);
|
||||
}
|
||||
|
||||
if (oinfo->gtype == G_TYPE_INVALID)
|
||||
if (G_UNLIKELY (oinfo->gtype == G_TYPE_INVALID))
|
||||
return NULL;
|
||||
|
||||
if (oinfo->object)
|
||||
@ -1191,6 +1191,19 @@ json_parse_end (JsonParser *parser,
|
||||
g_hash_table_foreach (priv->objects, construct_each_object, script);
|
||||
}
|
||||
|
||||
static GType
|
||||
clutter_script_real_get_type_from_name (ClutterScript *script,
|
||||
const gchar *type_name)
|
||||
{
|
||||
GType gtype;
|
||||
|
||||
gtype = g_type_from_name (type_name);
|
||||
if (gtype != G_TYPE_INVALID)
|
||||
return gtype;
|
||||
|
||||
return clutter_script_get_type_from_class (type_name);
|
||||
}
|
||||
|
||||
void
|
||||
property_info_free (gpointer data)
|
||||
{
|
||||
@ -1263,6 +1276,8 @@ clutter_script_class_init (ClutterScriptClass *klass)
|
||||
|
||||
g_type_class_add_private (klass, sizeof (ClutterScriptPrivate));
|
||||
|
||||
klass->get_type_from_name = clutter_script_real_get_type_from_name;
|
||||
|
||||
gobject_class->finalize = clutter_script_finalize;
|
||||
}
|
||||
|
||||
@ -1567,6 +1582,30 @@ clutter_script_ensure_objects (ClutterScript *script)
|
||||
g_hash_table_foreach (priv->objects, construct_each_object, script);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_script_get_type_from_name:
|
||||
* @script: a #ClutterScript
|
||||
* @type_name: name of the type to look up
|
||||
*
|
||||
* Looks up a type by name, using the virtual function that
|
||||
* #ClutterScript has for that purpose. This function should
|
||||
* rarely be used.
|
||||
*
|
||||
* Return value: the type for the requested type name, or
|
||||
* %G_TYPE_INVALID if not corresponding type was found.
|
||||
*
|
||||
* Since: 0.6
|
||||
*/
|
||||
GType
|
||||
clutter_script_get_type_from_name (ClutterScript *script,
|
||||
const gchar *type_name)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_SCRIPT (script), G_TYPE_INVALID);
|
||||
g_return_val_if_fail (type_name != NULL, G_TYPE_INVALID);
|
||||
|
||||
return CLUTTER_SCRIPT_GET_CLASS (script)->get_type_from_name (script, type_name);
|
||||
}
|
||||
|
||||
GQuark
|
||||
clutter_script_error_quark (void)
|
||||
{
|
||||
|
@ -35,7 +35,7 @@ G_BEGIN_DECLS
|
||||
#define CLUTTER_IS_SCRIPT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_SCRIPT))
|
||||
#define CLUTTER_SCRIPT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_SCRIPT, ClutterScriptClass))
|
||||
#define CLUTTER_IS_SCRIPT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_SCRIPT))
|
||||
#define CLUTTER_SCRIPT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_SCRIPT, ClutterScript))
|
||||
#define CLUTTER_SCRIPT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_SCRIPT, ClutterScriptClass))
|
||||
|
||||
typedef struct _ClutterScript ClutterScript;
|
||||
typedef struct _ClutterScriptPrivate ClutterScriptPrivate;
|
||||
@ -71,6 +71,11 @@ struct _ClutterScriptClass
|
||||
/*< private >*/
|
||||
GObjectClass parent_class;
|
||||
|
||||
/*< public >*/
|
||||
GType (* get_type_from_name) (ClutterScript *script,
|
||||
const gchar *type_name);
|
||||
|
||||
/*< private >*/
|
||||
/* padding, for future expansion */
|
||||
void (*_clutter_reserved1) (void);
|
||||
void (*_clutter_reserved2) (void);
|
||||
@ -84,22 +89,25 @@ struct _ClutterScriptClass
|
||||
|
||||
GType clutter_script_get_type (void) G_GNUC_CONST;
|
||||
|
||||
ClutterScript *clutter_script_new (void);
|
||||
guint clutter_script_load_from_file (ClutterScript *script,
|
||||
const gchar *filename,
|
||||
GError **error);
|
||||
guint clutter_script_load_from_data (ClutterScript *script,
|
||||
const gchar *data,
|
||||
gsize length,
|
||||
GError **error);
|
||||
GObject * clutter_script_get_object (ClutterScript *script,
|
||||
const gchar *name);
|
||||
GList * clutter_script_get_objects (ClutterScript *script,
|
||||
const gchar *first_name,
|
||||
...) G_GNUC_NULL_TERMINATED;
|
||||
void clutter_script_unmerge_objects (ClutterScript *script,
|
||||
guint merge_id);
|
||||
void clutter_script_ensure_objects (ClutterScript *script);
|
||||
ClutterScript *clutter_script_new (void);
|
||||
guint clutter_script_load_from_file (ClutterScript *script,
|
||||
const gchar *filename,
|
||||
GError **error);
|
||||
guint clutter_script_load_from_data (ClutterScript *script,
|
||||
const gchar *data,
|
||||
gsize length,
|
||||
GError **error);
|
||||
GObject * clutter_script_get_object (ClutterScript *script,
|
||||
const gchar *name);
|
||||
GList * clutter_script_get_objects (ClutterScript *script,
|
||||
const gchar *first_name,
|
||||
...) G_GNUC_NULL_TERMINATED;
|
||||
void clutter_script_unmerge_objects (ClutterScript *script,
|
||||
guint merge_id);
|
||||
void clutter_script_ensure_objects (ClutterScript *script);
|
||||
|
||||
GType clutter_script_get_type_from_name (ClutterScript *script,
|
||||
const gchar *type_name);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -1100,6 +1100,7 @@ clutter_script_get_object
|
||||
clutter_script_get_objects
|
||||
clutter_script_unmerge_objects
|
||||
clutter_script_ensure_objects
|
||||
clutter_script_get_type_from_name
|
||||
<SUBSECTION Standard>
|
||||
CLUTTER_TYPE_SCRIPT
|
||||
CLUTTER_SCRIPT
|
||||
|
Loading…
Reference in New Issue
Block a user