/** * clutter_score_append_at_marker: * @score: a #ClutterScore * @parent: the parent #ClutterTimeline * @marker_name: the name of the marker to use * @timeline: the #ClutterTimeline to append * * Appends @timeline at the given @marker_name on the @parent * #ClutterTimeline. * * If you want to append @timeline at the end of @parent, use * clutter_score_append(). * * The #ClutterScore will take a reference on @timeline. * * Return value: the id of the #ClutterTimeline inside the score, or * 0 on failure. The returned id can be used with clutter_score_remove() * or clutter_score_get_timeline(). * * Since: 0.8 * Deprecated: 1.8 */ gulong clutter_score_append_at_marker (ClutterScore *score, ClutterTimeline *parent, const gchar *marker_name, ClutterTimeline *timeline) { ClutterScorePrivate *priv; GNode *node; ClutterScoreEntry *entry; gchar *marker_reached_signal; g_return_val_if_fail (CLUTTER_IS_SCORE (score), 0); g_return_val_if_fail (CLUTTER_IS_TIMELINE (parent), 0); g_return_val_if_fail (marker_name != NULL, 0); g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), 0); if (!clutter_timeline_has_marker (parent, marker_name)) { g_warning ("The parent timeline has no marker '%s'", marker_name); return 0; } priv = score->priv; node = find_entry_by_timeline (score, parent); if (G_UNLIKELY (!node)) { g_warning ("Unable to find the parent timeline inside the score."); return 0; } entry = g_slice_new (ClutterScoreEntry); entry->timeline = g_object_ref (timeline); entry->parent = parent; entry->marker = g_strdup (marker_name); entry->id = priv->last_id; entry->score = score; entry->complete_id = 0; marker_reached_signal = g_strdup_printf ("marker-reached::%s", marker_name); entry->marker_id = g_signal_connect (entry->parent, marker_reached_signal, G_CALLBACK (on_timeline_marker), entry); entry->node = g_node_append_data (node, entry); g_free (marker_reached_signal); priv->last_id += 1; return entry->id; }
static void mex_column_notify_focused_cb (MxFocusManager *manager, GParamSpec *pspec, MexColumn *self) { GList *c; guint offset, increment; ClutterActor *focused, *focused_cell; gboolean cell_has_focus, has_focus, open, set_tile_important; MexColumnPrivate *priv = self->priv; focused = (ClutterActor *)mx_focus_manager_get_focused (manager); /* Check if we have focus, and what child is focused */ focused_cell = NULL; set_tile_important = FALSE; cell_has_focus = has_focus = FALSE; if (focused) { gboolean contains_column = FALSE; ClutterActor *parent = clutter_actor_get_parent (focused); while (parent) { if (parent == (ClutterActor *)self) { has_focus = TRUE; if (!priv->has_focus) { set_tile_important = TRUE; priv->has_focus = TRUE; } if (focused != priv->header) { cell_has_focus = TRUE; focused_cell = focused; } break; } else if (MEX_IS_COLUMN (parent)) { contains_column = TRUE; } focused = parent; parent = clutter_actor_get_parent (focused); } if (!contains_column) has_focus = TRUE; } if (!has_focus && priv->has_focus) { priv->has_focus = FALSE; set_tile_important = TRUE; } /* Scroll the adjustment to the top */ if (!cell_has_focus && priv->adjustment) mx_adjustment_interpolate (priv->adjustment, 0, 250, CLUTTER_EASE_OUT_CUBIC); /* Open/close boxes as appropriate */ offset = 0; increment = 150; /* If we're changing the tile importance, initialise the state manager */ if (set_tile_important && priv->n_items > 0) { if (priv->expand_timeline) g_object_unref (priv->expand_timeline); priv->expand_timeline = clutter_timeline_new (priv->n_items * increment); clutter_timeline_set_delay (priv->expand_timeline, 350); } /* Loop through children and set the expander box important/unimportant * as necessary, and if necessary, do the same for the tile inside the * expander-box. */ open = has_focus && !cell_has_focus; for (c = priv->children; c; c = c->next) { gchar signal_name[32+16]; ClutterActor *child = c->data; if ((!priv->collapse && priv->has_focus) || (child == focused_cell)) open = TRUE; if (!MEX_IS_EXPANDER_BOX (child)) continue; /* Note, 'marker-reached::' is 16 characters long */ g_snprintf (signal_name, G_N_ELEMENTS (signal_name), "marker-reached::%p", child); if (MEX_IS_CONTENT_BOX (child)) { ClutterActor *tile = mex_content_box_get_tile (MEX_CONTENT_BOX (child)); mex_tile_set_important (MEX_TILE (tile), priv->has_focus); } if (!open) { if (priv->expand_timeline) { if (clutter_timeline_has_marker (priv->expand_timeline, signal_name + 16)) clutter_timeline_remove_marker (priv->expand_timeline, signal_name + 16); g_signal_handlers_disconnect_by_func (priv->expand_timeline, mex_column_expand_drawer_cb, child); } mex_expander_box_set_important (MEX_EXPANDER_BOX (child), FALSE); } else if (set_tile_important) { mex_expander_box_set_important (MEX_EXPANDER_BOX (child), FALSE); clutter_timeline_add_marker_at_time (priv->expand_timeline, signal_name + 16, offset); g_signal_connect_swapped (priv->expand_timeline, signal_name, G_CALLBACK (mex_column_expand_drawer_cb), child); offset += increment; } else mex_expander_box_set_important (MEX_EXPANDER_BOX (child), TRUE); } if (priv->expand_timeline && set_tile_important && (offset >= increment)) clutter_timeline_start (priv->expand_timeline); }