/** * gtk_timeline_start: * @timeline: A #GtkTimeline * * Runs the timeline from the current frame. **/ void _gtk_timeline_start (GtkTimeline *timeline) { GtkTimelinePriv *priv; GtkSettings *settings; gboolean enable_animations = FALSE; g_return_if_fail (GTK_IS_TIMELINE (timeline)); priv = timeline->priv; if (!priv->source_id) { if (priv->timer) g_timer_continue (priv->timer); else priv->timer = g_timer_new (); /* sanity check */ g_assert (priv->fps > 0); if (priv->screen) { settings = gtk_settings_get_for_screen (priv->screen); g_object_get (settings, "gtk-enable-animations", &enable_animations, NULL); } priv->animations_enabled = enable_animations; g_signal_emit (timeline, signals [STARTED], 0); if (enable_animations) priv->source_id = gdk_threads_add_timeout (FRAME_INTERVAL (priv->fps), (GSourceFunc) gtk_timeline_run_frame, timeline); else priv->source_id = gdk_threads_add_idle ((GSourceFunc) gtk_timeline_run_frame, timeline); } }
static void ev_timeline_real_start (EvTimeline *timeline) { EvTimelinePriv *priv; priv = EV_TIMELINE_GET_PRIV (timeline); if (!priv->source_id) { if (priv->timer) g_timer_continue (priv->timer); else priv->timer = g_timer_new (); /* sanity check */ g_assert (priv->fps > 0); g_signal_emit (timeline, signals [STARTED], 0); priv->source_id = g_timeout_add (FRAME_INTERVAL (priv->fps), (GSourceFunc) ev_timeline_run_frame, timeline); } }
/** * gtk_timeline_set_fps: * @timeline: A #GtkTimeline * @fps: frames per second * * Sets the number of frames per second that * the timeline will play. **/ void _gtk_timeline_set_fps (GtkTimeline *timeline, guint fps) { GtkTimelinePriv *priv; g_return_if_fail (GTK_IS_TIMELINE (timeline)); g_return_if_fail (fps > 0); priv = timeline->priv; priv->fps = fps; if (_gtk_timeline_is_running (timeline)) { g_source_remove (priv->source_id); priv->source_id = gdk_threads_add_timeout (FRAME_INTERVAL (priv->fps), (GSourceFunc) gtk_timeline_run_frame, timeline); } g_object_notify (G_OBJECT (timeline), "fps"); }