{
PROP_0,
PROP_DURATION,
- PROP_TARGET_STATE
+ PROP_STATE
};
enum
return pa->object - pb->object;
}
-static State * clutter_state_get_state (ClutterState *state,
- const gchar *state_name,
- gboolean force_creation);
+static State * clutter_state_fetch_state (ClutterState *state,
+ const gchar *state_name,
+ gboolean force_creation);
static void object_disappeared (gpointer data,
GObject *where_the_object_was);
property_name = g_intern_string (property_name);
if (source_state_name)
- source_state = clutter_state_get_state (this, source_state_name, FALSE);
+ source_state = clutter_state_fetch_state (this, source_state_name, FALSE);
if (target_state_name != NULL)
state_list = g_list_append (NULL, (gpointer) target_state_name);
for (s = state_list; s != NULL; s = s->next)
{
State *target_state;
- target_state = clutter_state_get_state (this, s->data, FALSE);
+ target_state = clutter_state_fetch_state (this, s->data, FALSE);
if (target_state)
{
priv->source_state_name = priv->target_state_name;
priv->target_state_name = target_state_name;
- g_object_notify (G_OBJECT (state), "target-state");
+ g_object_notify (G_OBJECT (state), "state");
duration = clutter_state_get_duration (state,
priv->source_state_name,
priv->target_state_name);
clutter_timeline_set_duration (priv->timeline, duration);
- new_state = clutter_state_get_state (state, target_state_name, FALSE);
+ new_state = clutter_state_fetch_state (state, target_state_name, FALSE);
if (new_state == NULL)
{
g_warning ("State '%s' not found", target_state_name);
}
/*
- * clutter_state_get_state:
+ * clutter_state_fetch_state:
* @state: a #ClutterState
* @state_name: the name of the state to be retrieved
- * @force_creation: %TRUE if the state should be forcibly created
- * if not found
+ * @create: %TRUE if the state should be instantiated if not found
*
* Retrieves the #State structure for @state_name inside the given
* #ClutterState instance
*
- * If @state_name is %NULL and @force_creation is %TRUE then the
- * #State for the default state name will be returned; if @force_creation
- * is %FALSE then %NULL will be returned
+ * If @state_name is %NULL and @create is %TRUE then NULL will
+ * be returned.
*
* Return value: a #State structure for the given name, or %NULL
*/
static State *
-clutter_state_get_state (ClutterState *state,
- const gchar *state_name,
- gboolean force_creation)
+clutter_state_fetch_state (ClutterState *state,
+ const gchar *state_name,
+ gboolean create)
{
ClutterStatePrivate *priv = state->priv;
State *retval;
state_name = g_intern_string (state_name);
retval = g_hash_table_lookup (priv->states, state_name);
- if (retval == NULL && force_creation)
+ if (retval == NULL && create)
{
retval = state_new (state, state_name);
g_hash_table_insert (priv->states, (gpointer) state_name, retval);
if (pspec == NULL)
return state;
- source_state = clutter_state_get_state (state, source_state_name, TRUE);
- target_state = clutter_state_get_state (state, target_state_name, TRUE);
+ source_state = clutter_state_fetch_state (state, source_state_name, TRUE);
+ target_state = clutter_state_fetch_state (state, target_state_name, TRUE);
property_name = g_intern_string (property_name);
state_key = clutter_state_key_new (target_state,
state_list = clutter_state_get_states (state);
if (source_state_name)
- source_state = clutter_state_get_state (state, source_state_name, FALSE);
+ source_state = clutter_state_fetch_state (state, source_state_name, FALSE);
for (s = state_list; s != NULL; s = s->next)
{
State *target_state;
- target_state = clutter_state_get_state (state, s->data, FALSE);
+ target_state = clutter_state_fetch_state (state, s->data, FALSE);
if (target_state != NULL)
{
GList *k;
switch (prop_id)
{
- case PROP_TARGET_STATE:
+ case PROP_STATE:
clutter_state_change (state, g_value_get_string (value), TRUE);
break;
case PROP_DURATION:
ClutterState *state = CLUTTER_STATE (object);
switch (prop_id)
{
- case PROP_TARGET_STATE:
+ case PROP_STATE:
g_value_set_string (value,
- clutter_state_get_target_state (state));
+ clutter_state_get_state (state));
break;
case PROP_DURATION:
g_value_set_uint (value, state->priv->duration);
G_TYPE_NONE, 0);
/**
- * ClutterState:target-state:
+ * ClutterState:state:
*
* The currently set target state, setting it causes the
* state machine to transition to the new state, use
- * clutter_state_change() directly to directly jump to
- * a state.
+ * clutter_state_change() with a final FALSE argument to
+ * change state without a transition.
*/
- pspec = g_param_spec_string ("target-state",
- "Target State",
- "Currently set state",
+ pspec = g_param_spec_string ("state",
+ "State",
+ "Currently set state, (transition to this state might not be complete)",
NULL,
CLUTTER_PARAM_READWRITE);
- g_object_class_install_property (gobject_class, PROP_TARGET_STATE, pspec);
+ g_object_class_install_property (gobject_class, PROP_STATE, pspec);
/**
* ClutterState:duration:
target_state_name = g_intern_string (target_state_name);
- target_state = clutter_state_get_state (state, target_state_name, FALSE);
+ target_state = clutter_state_fetch_state (state, target_state_name, FALSE);
if (target_state == NULL)
return NULL;
source_state_name = g_intern_string (source_state_name);
target_state_name = g_intern_string (target_state_name);
- target_state = clutter_state_get_state (state, target_state_name, FALSE);
+ target_state = clutter_state_fetch_state (state, target_state_name, FALSE);
if (target_state == NULL)
return;
return;
}
- target_state = clutter_state_get_state (state, target_state_name, FALSE);
+ target_state = clutter_state_fetch_state (state, target_state_name, FALSE);
if (target_state != NULL)
{
if (source_state_name != NULL)
if (target_state_name == NULL)
return state->priv->duration;
- target_state = clutter_state_get_state (state, target_state_name, FALSE);
+ target_state = clutter_state_fetch_state (state, target_state_name, FALSE);
if (target_state != NULL)
{
if (source_state_name)
}
/**
- * clutter_state_get_target_state:
+ * clutter_state_get_state:
* @state: a #ClutterState
*
* Queries the currently set target state.
*
- * During a transition this function will also return the current target.
+ * During a transition this function will return the target of the transition.
*
* This function is useful when called from handlers of the
* #ClutterState::completed signal.
* Since: 1.4
*/
G_CONST_RETURN gchar *
-clutter_state_get_target_state (ClutterState *state)
+clutter_state_get_state (ClutterState *state)
{
g_return_val_if_fail (CLUTTER_IS_STATE (state), NULL);
}
source_name = json_object_get_string_member (object, "source");
- source_state = clutter_state_get_state (clos->state, source_name, TRUE);
+ source_state = clutter_state_fetch_state (clos->state, source_name, TRUE);
target_name = json_object_get_string_member (object, "target");
- target_state = clutter_state_get_state (clos->state, target_name, TRUE);
+ target_state = clutter_state_fetch_state (clos->state, target_name, TRUE);
if (json_object_has_member (object, "duration"))
{
};
GType clutter_state_get_type (void) G_GNUC_CONST;
-ClutterState *clutter_state_new (void);
-
-
-ClutterTimeline * clutter_state_change (ClutterState *state,
- const gchar *target_state_name,
- gboolean animate);
-ClutterState * clutter_state_set_key (ClutterState *state,
- const gchar *source_state_name,
- const gchar *target_state_name,
- GObject *object,
- const gchar *property_name,
- guint mode,
- const GValue *value,
- gdouble pre_delay,
- gdouble post_delay);
-void clutter_state_set_duration (ClutterState *state,
- const gchar *source_state_name,
- const gchar *target_state_name,
- guint duration);
-guint clutter_state_get_duration (ClutterState *state,
- const gchar *source_state_name,
- const gchar *target_state_name);
-void clutter_state_set (ClutterState *state,
- const gchar *source_state_name,
- const gchar *target_state_name,
- gpointer first_object,
- const gchar *first_property_name,
- gulong first_mode,
- ...) G_GNUC_NULL_TERMINATED;
-GList * clutter_state_get_states (ClutterState *state);
-GList * clutter_state_get_keys (ClutterState *state,
- const gchar *source_state_name,
- const gchar *target_state_name,
- GObject *object,
- const gchar *property_name);
-void clutter_state_remove_key (ClutterState *state,
- const gchar *source_state_name,
- const gchar *target_state_name,
- GObject *object,
- const gchar *property_name);
-ClutterTimeline * clutter_state_get_timeline (ClutterState *state);
-void clutter_state_set_animator (ClutterState *state,
- const gchar *source_state_name,
- const gchar *target_state_name,
- ClutterAnimator *animator);
-ClutterAnimator * clutter_state_get_animator (ClutterState *state,
- const gchar *source_state_name,
- const gchar *target_state_name);
-G_CONST_RETURN gchar *clutter_state_get_target_state (ClutterState *state);
+ClutterState *clutter_state_new (void);
+
+
+ClutterTimeline * clutter_state_change (ClutterState *state,
+ const gchar *target_state_name,
+ gboolean animate);
+ClutterState * clutter_state_set_key (ClutterState *state,
+ const gchar *source_state_name,
+ const gchar *target_state_name,
+ GObject *object,
+ const gchar *property_name,
+ guint mode,
+ const GValue *value,
+ gdouble pre_delay,
+ gdouble post_delay);
+void clutter_state_set_duration (ClutterState *state,
+ const gchar *source_state_name,
+ const gchar *target_state_name,
+ guint duration);
+guint clutter_state_get_duration (ClutterState *state,
+ const gchar *source_state_name,
+ const gchar *target_state_name);
+void clutter_state_set (ClutterState *state,
+ const gchar *source_state_name,
+ const gchar *target_state_name,
+ gpointer first_object,
+ const gchar *first_property_name,
+ gulong first_mode,
+ ...) G_GNUC_NULL_TERMINATED;
+GList * clutter_state_get_states (ClutterState *state);
+GList * clutter_state_get_keys (ClutterState *state,
+ const gchar *source_state_name,
+ const gchar *target_state_name,
+ GObject *object,
+ const gchar *property_name);
+void clutter_state_remove_key (ClutterState *state,
+ const gchar *source_state_name,
+ const gchar *target_state_name,
+ GObject *object,
+ const gchar *property_name);
+ClutterTimeline * clutter_state_get_timeline (ClutterState *state);
+void clutter_state_set_animator (ClutterState *state,
+ const gchar *source_state_name,
+ const gchar *target_state_name,
+ ClutterAnimator *animator);
+ClutterAnimator * clutter_state_get_animator (ClutterState *state,
+ const gchar *source_state_name,
+ const gchar *target_state_name);
+G_CONST_RETURN gchar *clutter_state_get_state (ClutterState *state);
/*
* ClutterStateKey