+/*******************************************************************************/
+static gboolean
+short_timeout (AWallpaperPlugin *desktop_plugin)
+{
+ //gint daytime = get_daytime();
+ GSList * tmp;
+ void (*pfunc)(gpointer, gpointer);
+ time_t now;
+ Actor *actor;
+ gboolean stop_flag = TRUE;
+
+ if (!desktop_plugin->priv->visible || !desktop_plugin->priv->rich_animation){
+ desktop_plugin->priv->short_timer = 0;
+ return FALSE;
+ }
+
+ now = time(NULL);
+ //scene.daytime = daytime;
+ /* fprintf(stderr, "Short timer %d\n", now); */
+ tmp = desktop_plugin->priv->scene->actors;
+ while (tmp != NULL){
+ actor = tmp->data;
+ if (now >= actor->time_start_animation
+ && actor->time_start_animation > 0
+ /* && now - actor->time_start_animation <= actor->duration_animation*/){
+ pfunc = actor->func_change;
+ if (pfunc){
+ (*pfunc)(actor, desktop_plugin);
+ stop_flag = FALSE;
+ }
+ }
+ tmp = g_slist_next(tmp);
+ }
+ if (stop_flag){
+ desktop_plugin->priv->short_timer = 0;
+ return FALSE;
+ }else
+ return TRUE; /* keep running this event */
+}
+/*******************************************************************************/
+void
+run_long_timeout(AWallpaperPlugin *desktop_plugin)
+{
+
+ gint daytime = get_daytime();
+ GSList * tmp;
+ void (*pfunc)(gpointer, gpointer);
+ time_t now;
+ Actor *actor;
+
+ if (!desktop_plugin->priv->scene)
+ return;
+ /*ifprintf(stderr, "!!!run long timeout short_timer=%d\n", desktop_plugin->priv->short_timer); */
+ if (desktop_plugin->priv->scene->daytime != daytime){
+ desktop_plugin->priv->scene->daytime = daytime;
+ tmp = desktop_plugin->priv->scene->actors;
+ while (tmp != NULL){
+ //change_actor(tmp->data);
+ pfunc =((Actor*)tmp->data)->func_change;
+ if (pfunc){
+ (*pfunc)(tmp->data, desktop_plugin);
+ }
+ tmp = g_slist_next(tmp);
+ }
+ }
+
+ now = time(NULL);
+ //fprintf(stderr, "Now %d\n", now);
+ tmp = desktop_plugin->priv->scene->actors;
+ while (tmp != NULL){
+ actor = tmp->data;
+ if (now >= actor->time_start_animation
+ && actor->time_start_animation > 0
+ && desktop_plugin->priv->short_timer == 0){
+ /* fprintf(stderr, "start short timer act = %s %d\n", actor->name, now); */
+ if (desktop_plugin->priv->rich_animation){
+ actor->time_start_animation = now;
+ desktop_plugin->priv->short_timer = g_timeout_add(SHORT_TIMER, (GtkFunction)short_timeout, desktop_plugin);
+ }
+ else {
+ (*actor->func_change)(actor, desktop_plugin);
+ }
+ }
+ tmp = g_slist_next(tmp);
+ }
+
+}
+/*******************************************************************************/
+gboolean
+long_timeout (AWallpaperPlugin *desktop_plugin)
+{
+ GstFormat fmt = GST_FORMAT_TIME;
+ gint64 p;
+
+ /*fprintf(stderr, "long_timeout %i\n", desktop_plugin->priv->long_timer); */
+ if (desktop_plugin->priv->pipeline){
+ if (!desktop_plugin->priv->visible){
+ gst_element_query_position(desktop_plugin->priv->pipeline, &fmt, &p);
+ desktop_plugin->priv->theme_int_parametr1 = p / GST_SECOND;
+ gst_element_set_state (desktop_plugin->priv->pipeline, GST_STATE_NULL);
+ gst_object_unref (GST_OBJECT (desktop_plugin->priv->pipeline));
+ desktop_plugin->priv->pipeline = NULL;
+ }
+ return TRUE;
+ }
+
+ if (desktop_plugin->priv->long_timer == 0 )
+ return FALSE;
+ if (!desktop_plugin->priv->visible){
+ if(desktop_plugin->priv->short_timer != 0){
+ g_source_remove(desktop_plugin->priv->short_timer);
+ desktop_plugin->priv->short_timer = 0;
+ }
+ desktop_plugin->priv->long_timer = 0;
+ return FALSE;
+ }