refactoried of code
authortanya <tanyshk@gmail.com>
Fri, 6 Aug 2010 09:17:58 +0000 (12:17 +0300)
committertanya <tanyshk@gmail.com>
Fri, 6 Aug 2010 09:17:58 +0000 (12:17 +0300)
applet/src/Makefile.am
applet/src/livewp-actor.c
applet/src/livewp-actor.h
applet/src/livewp-home-widget.c
applet/src/livewp-home-widget.h
applet/src/livewp-main.c

index 6d37264..22c6152 100644 (file)
@@ -22,13 +22,9 @@ desktoplib_LTLIBRARIES =  liblivewp-home-widget.la
 desktoplibdir = $(HILDON_DESKTOP_LIB_DIR)
 
 liblivewp_home_widget_la_SOURCES = livewp-home-widget.c livewp-home-widget.h \
-                                  livewp-astro.c livewp-astro.h \
-                                  livewp-rules.c livewp-rules.h \
-                                  livewp-settings.c livewp-settings.h livewp-common.h \
+                                  livewp-common.h \
                                   livewp-config.c livewp-config.h \
-                                  livewp-dbus.c livewp-dbus.h \
-                                  livewp-actor.c livewp-actor.h \
-                                  livewp-scene.c livewp-scene.h
+                                  livewp-dbus.c livewp-dbus.h 
 liblivewp_home_widget_la_LIBADD = $(MAEMO_LIBS) $(OSSO_LIBS)  $(SQLITE_LIBS) 
 
 AM_CFLAGS = -Wall $(MAEMO_CFLAGS) $(OSSO_CFLAGS) $(SQLITE_CFLAGS) 
index ad6ffcd..a1da1d9 100644 (file)
 /*******************************************************************************/
 #include "livewp-actor.h"
 
+static void
+realize (GtkWidget *widget)
+{
+    GdkScreen *screen;
+    screen = gtk_widget_get_screen (widget);
+    gtk_widget_set_colormap (widget, gdk_screen_get_rgba_colormap (screen));
+}
+
+static gboolean
+expose_event (GtkWidget *widget,GdkEventExpose *event,
+     gpointer data)
+{
+    cairo_t *cr;
+    GdkPixbuf *pixbuf = (GdkPixbuf *) data;
+       
+    cr = gdk_cairo_create(widget->window);
+    if (cr){
+        gdk_cairo_region(cr, event->region);
+        cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
+        gdk_cairo_set_source_pixbuf(cr, pixbuf, 0.0, 0.0);
+        cairo_paint(cr);
+        cairo_destroy(cr);
+    }
+    return TRUE;
+}
+
+void
+destroy_hildon_actor(Actor *actor)
+{
+    //fprintf(stderr, "destroy_hildon_actor %s\n",actor->name);
+    gtk_widget_destroy(actor->widget);
+    actor->widget = NULL;
+}
+
+void
+create_hildon_actor_text(Actor *actor, AWallpaperPlugin *desktop_plugin) 
+{
+  GtkWidget *ha = NULL;
+  GtkWidget *label = NULL;
+
+  ha = hildon_animation_actor_new();
+  label = gtk_label_new(NULL);  
+
+  if (label){
+    //g_signal_connect(G_OBJECT(label), "expose_event", G_CALLBACK(expose_event), NULL);
+
+    gtk_container_add (GTK_CONTAINER (ha), label);
+  }  
+  realize(ha);
+  gtk_widget_show(label);
+  gtk_widget_show_all(ha);
+  
+  /* TO DO check it */
+  /*  gdk_flush (); */
+
+  //g_object_set_data(G_OBJECT(ha), "image", image);
+  actor->image = label;
+  hildon_animation_actor_set_parent (HILDON_ANIMATION_ACTOR (ha), GTK_WINDOW(desktop_plugin->priv->window));
+  actor->widget = ha;
+  set_actor_position(actor, actor->x, actor->y, actor->z, desktop_plugin);
+  set_actor_scale(actor, (double)actor->scale/100, (double)actor->scale/100);
+  set_actor_visible(actor, actor->visible);
+}
+
+void
+create_hildon_actor(Actor *actor, AWallpaperPlugin *desktop_plugin) 
+{
+  GtkWidget *ha = NULL;
+  GdkPixbuf *pixbuf = NULL;
+  GtkWidget *image = NULL;
+  gchar     *str = NULL;
+
+  ha = hildon_animation_actor_new();
+  str = g_strdup_printf( "%s/%s/%s", THEME_PATH, 
+                        desktop_plugin->priv->theme, actor->filename);
+  pixbuf = gdk_pixbuf_new_from_file_at_size (str, 
+                                             actor->width, 
+                                             actor->height, 
+                                             NULL);
+  /* fprintf(stderr, "create_hildon_actor %s %s\n", actor->name, str); */
+  if (str)
+      g_free(str);
+  if (pixbuf){
+      image = gtk_image_new_from_pixbuf (pixbuf);
+      g_object_unref(G_OBJECT(pixbuf));
+  }
+  if (image){
+    g_signal_connect(G_OBJECT(image), "expose_event",
+                           G_CALLBACK(expose_event), pixbuf);
+    gtk_container_add (GTK_CONTAINER (ha), image);
+  }  
+  realize(ha);
+  gtk_widget_show_all(ha);
+  
+  /* TO DO check it */
+  /*  gdk_flush (); */
+
+  //g_object_set_data(G_OBJECT(ha), "image", image);
+  actor->image = image;
+  hildon_animation_actor_set_parent (HILDON_ANIMATION_ACTOR (ha), GTK_WINDOW(desktop_plugin->priv->window));
+
+  actor->widget = ha;
+  set_actor_position(actor, actor->x, actor->y, actor->z, desktop_plugin);
+  set_actor_scale(actor, (double)actor->scale/100, (double)actor->scale/100);
+  set_actor_visible(actor, actor->visible);
+}
+
+void
+change_hildon_actor(Actor *actor, AWallpaperPlugin *desktop_plugin)
+{
+    GtkWidget *image = NULL;
+    GdkPixbuf *pixbuf = NULL;
+    gchar     *str = NULL;
+
+    str = g_strdup_printf( "%s/%s/%s", THEME_PATH, 
+                            desktop_plugin->priv->theme, actor->filename);
+    pixbuf = gdk_pixbuf_new_from_file_at_size (str, 
+                                               actor->width, 
+                                               actor->height, 
+                                               NULL);
+    if(str)
+        g_free(str);
+    if (pixbuf){
+        image = gtk_image_new_from_pixbuf (pixbuf);
+        g_object_unref(G_OBJECT(pixbuf));
+    }
+    if (image){ 
+        g_signal_connect(G_OBJECT(image), "expose_event",
+                                       G_CALLBACK(expose_event), pixbuf);
+        //if (g_object_get_data(G_OBJECT(actor->widget), "image")){
+        if (actor->image){
+            gtk_container_remove(GTK_CONTAINER(actor->widget), actor->image);  
+        }
+        //g_object_set_data(G_OBJECT(actor->widget), "image", image);
+        actor->image = image;
+        gtk_container_add (GTK_CONTAINER (actor->widget), image);
+        realize(actor->widget);
+        gtk_widget_show_all(actor->widget);
+        /* TO DO check it */
+       /*  gdk_flush (); */
+
+
+    }
+}
+
 Actor* 
 init_object(AWallpaperPlugin *desktop_plugin, 
             gchar * name, 
index d385a70..8f86aac 100644 (file)
@@ -70,6 +70,10 @@ Actor* init_object(AWallpaperPlugin *desktop_plugin,
             void (*pfunc_probability)(Actor*),
             GPtrArray *child
            );
+void destroy_hildon_actor(Actor *actor);
+void create_hildon_actor_text(Actor *actor, AWallpaperPlugin *desktop_plugin); 
+void create_hildon_actor(Actor *actor, AWallpaperPlugin *desktop_plugin);
+void change_hildon_actor(Actor *actor, AWallpaperPlugin *desktop_plugin);
 void destroy_actor(Actor *actor);
 void set_actor_position(Actor *actor, gint x, gint y, gint z, AWallpaperPlugin *desktop_plugin);
 void set_actor_scale(Actor *actor, double scalex, double scaley);
index 60f31c9..14c86a9 100644 (file)
@@ -92,31 +92,6 @@ lw_applet_realize (GtkWidget *widget)
     GTK_WIDGET_CLASS (animation_wallpaper_plugin_parent_class)->realize (widget);
 }
 
-static gboolean
-expose_event (GtkWidget *widget,GdkEventExpose *event,
-     gpointer data)
-{
-    cairo_t *cr;
-    GdkPixbuf *pixbuf = (GdkPixbuf *) data;
-       
-    cr = gdk_cairo_create(widget->window);
-    if (cr){
-        gdk_cairo_region(cr, event->region);
-        cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
-        gdk_cairo_set_source_pixbuf(cr, pixbuf, 0.0, 0.0);
-        cairo_paint(cr);
-        cairo_destroy(cr);
-    }
-    return TRUE;
-}
-
-static void
-realize (GtkWidget *widget)
-{
-    GdkScreen *screen;
-    screen = gtk_widget_get_screen (widget);
-    gtk_widget_set_colormap (widget, gdk_screen_get_rgba_colormap (screen));
-}
 /* Set position of widget on desktop */
 static void
 init_applet_position(gint *xapplet, gint *yapplet)
@@ -169,259 +144,6 @@ init_applet_position(gint *xapplet, gint *yapplet)
   gconf_client_clear_cache(gconf_client);
   g_object_unref(gconf_client);
 }
-#if 0
-void
-actor_set_position_full(GtkWidget *actor, gint x, gint y, gint z)
-{
-/*  fprintf(stderr, "actor_set_position_full z=%d\n", z); */
-    hildon_animation_actor_set_position_full (HILDON_ANIMATION_ACTOR (actor),x-0, y-0, z);
-}
-#endif
-
-void
-destroy_hildon_actor(Actor *actor)
-{
-    //fprintf(stderr, "destroy_hildon_actor %s\n",actor->name);
-    gtk_widget_destroy(actor->widget);
-    actor->widget = NULL;
-}
-
-void
-create_hildon_actor_text(Actor *actor, AWallpaperPlugin *desktop_plugin) 
-{
-  GtkWidget *ha = NULL;
-  GtkWidget *label = NULL;
-
-  ha = hildon_animation_actor_new();
-  label = gtk_label_new(NULL);  
-
-  if (label){
-    //g_signal_connect(G_OBJECT(label), "expose_event", G_CALLBACK(expose_event), NULL);
-
-    gtk_container_add (GTK_CONTAINER (ha), label);
-  }  
-  realize(ha);
-  gtk_widget_show(label);
-  gtk_widget_show_all(ha);
-  
-  /* TO DO check it */
-  /*  gdk_flush (); */
-
-  //g_object_set_data(G_OBJECT(ha), "image", image);
-  actor->image = label;
-  hildon_animation_actor_set_parent (HILDON_ANIMATION_ACTOR (ha), GTK_WINDOW(desktop_plugin->priv->window));
-  actor->widget = ha;
-  set_actor_position(actor, actor->x, actor->y, actor->z, desktop_plugin);
-  set_actor_scale(actor, (double)actor->scale/100, (double)actor->scale/100);
-  set_actor_visible(actor, actor->visible);
-}
-
-
-
-void
-create_hildon_actor(Actor *actor, AWallpaperPlugin *desktop_plugin) 
-{
-  GtkWidget *ha = NULL;
-  GdkPixbuf *pixbuf = NULL;
-  GtkWidget *image = NULL;
-  gchar     *str = NULL;
-
-  ha = hildon_animation_actor_new();
-  str = g_strdup_printf( "%s/%s/%s", THEME_PATH, 
-                        desktop_plugin->priv->theme, actor->filename);
-  pixbuf = gdk_pixbuf_new_from_file_at_size (str, 
-                                             actor->width, 
-                                             actor->height, 
-                                             NULL);
-  /* fprintf(stderr, "create_hildon_actor %s %s\n", actor->name, str); */
-  if (str)
-      g_free(str);
-  if (pixbuf){
-      image = gtk_image_new_from_pixbuf (pixbuf);
-      g_object_unref(G_OBJECT(pixbuf));
-  }
-  if (image){
-    g_signal_connect(G_OBJECT(image), "expose_event",
-                           G_CALLBACK(expose_event), pixbuf);
-    gtk_container_add (GTK_CONTAINER (ha), image);
-  }  
-  realize(ha);
-  gtk_widget_show_all(ha);
-  
-  /* TO DO check it */
-  /*  gdk_flush (); */
-
-  //g_object_set_data(G_OBJECT(ha), "image", image);
-  actor->image = image;
-  hildon_animation_actor_set_parent (HILDON_ANIMATION_ACTOR (ha), GTK_WINDOW(desktop_plugin->priv->window));
-
-  actor->widget = ha;
-  set_actor_position(actor, actor->x, actor->y, actor->z, desktop_plugin);
-  set_actor_scale(actor, (double)actor->scale/100, (double)actor->scale/100);
-  set_actor_visible(actor, actor->visible);
-}
-
-
-void
-change_hildon_actor(Actor *actor, AWallpaperPlugin *desktop_plugin)
-{
-    GtkWidget *image = NULL;
-    GdkPixbuf *pixbuf = NULL;
-    gchar     *str = NULL;
-
-    str = g_strdup_printf( "%s/%s/%s", THEME_PATH, 
-                            desktop_plugin->priv->theme, actor->filename);
-    pixbuf = gdk_pixbuf_new_from_file_at_size (str, 
-                                               actor->width, 
-                                               actor->height, 
-                                               NULL);
-    if(str)
-        g_free(str);
-    if (pixbuf){
-        image = gtk_image_new_from_pixbuf (pixbuf);
-        g_object_unref(G_OBJECT(pixbuf));
-    }
-    if (image){ 
-        g_signal_connect(G_OBJECT(image), "expose_event",
-                                       G_CALLBACK(expose_event), pixbuf);
-        //if (g_object_get_data(G_OBJECT(actor->widget), "image")){
-        if (actor->image){
-            gtk_container_remove(GTK_CONTAINER(actor->widget), actor->image);  
-        }
-        //g_object_set_data(G_OBJECT(actor->widget), "image", image);
-        actor->image = image;
-        gtk_container_add (GTK_CONTAINER (actor->widget), image);
-        realize(actor->widget);
-        gtk_widget_show_all(actor->widget);
-        /* TO DO check it */
-       /*  gdk_flush (); */
-
-
-    }
-
-}
-
-
-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;
-    }
-
-    run_long_timeout(desktop_plugin);
-    return TRUE; /* keep running this event */
-}
 
 void
 desktop_plugin_visible_notify (GObject    *object,
@@ -468,13 +190,6 @@ desktop_plugin_visible_notify (GObject    *object,
 }
 
 gboolean
-rich_animation_press(GtkWidget *widget, GdkEvent *event,
-                                            gpointer user_data){
-    fprintf(stderr,"gggggggggggggggggggg2222\n");
-    return FALSE;
-}    
-
-gboolean
 send_alive_event(Animation_WallpaperPrivate *priv) 
 {
     switch (priv->view + 1){
@@ -515,16 +230,6 @@ animation_wallpaper_plugin_init (AWallpaperPlugin *desktop_plugin)
     priv->yapplet = 0;
     priv->scene = NULL;
     priv->theme = g_strdup("Modern");
-//#if 0 
-    priv->hash_scene_func = g_hash_table_new(g_str_hash, g_str_equal);
-    
-    g_hash_table_insert(priv->hash_scene_func, g_strdup("Berlin"), (gpointer)&init_scene_Berlin);
-    g_hash_table_insert(priv->hash_scene_func, g_strdup("Modern"), (gpointer)&init_scene_Modern);
-    g_hash_table_insert(priv->hash_scene_func, g_strdup("Matrix"), (gpointer)&init_scene_Matrix);
-    g_hash_table_insert(priv->hash_scene_func, g_strdup("Accel"), (gpointer)&init_scene_Accel);
-    g_hash_table_insert(priv->hash_scene_func, g_strdup("Video"), (gpointer)&init_scene_Video);
-    g_hash_table_insert(priv->hash_scene_func, g_strdup("Xsnow"), (gpointer)&init_scene_Video);
-//#endif
     //priv->theme = g_strdup("Accel");
     desktop_plugin->priv->main_widget = gtk_fixed_new();
 
index dbff73b..c82e5e1 100644 (file)
@@ -65,20 +65,15 @@ GType animation_wallpaper_plugin_get_type(void);
 Animation_WallpaperPrivate* animation_wallpaper_plugin_new (void);
 G_END_DECLS
 void lw_settings(gpointer user_data, gpointer data);
-//void actor_set_position_full(GtkWidget *actor, gint x, gint y, gint z);
 gint read_config(Animation_WallpaperPrivate *priv);
 void save_config(Animation_WallpaperPrivate *priv);
-void run_long_timeout(AWallpaperPlugin *desktop_plugin);
-//void set_actor_visible(Actor *actor, gboolean visible);
-//void set_actor_scale(Actor *actor, double scalex, double scaley);
-void create_hildon_actor(Actor *actor, AWallpaperPlugin *desktop_plugin);
-void create_hildon_actor_text(Actor *actor, AWallpaperPlugin *desktop_plugin); 
+//void run_long_timeout(AWallpaperPlugin *desktop_plugin);
 void get_sun_screen_pos(double alt, double azm, gint * x, gint * y);
 void show_settings(GtkWidget *widget, Animation_WallpaperPrivate *priv);
 void livewp_initialize_dbus(Animation_WallpaperPrivate *priv);
 void livewp_deinitialize_dbus(Animation_WallpaperPrivate *priv);
 gint current_active_view(void);
-gboolean long_timeout (AWallpaperPlugin *desktop_plugin);
+//gboolean long_timeout (AWallpaperPlugin *desktop_plugin);
 void desktop_plugin_visible_notify (GObject *object, GParamSpec *spec, AWallpaperPlugin *desktop_plugin);
 void send_dbus_signal (Animation_WallpaperPrivate *priv, const gchar *interface, const gchar *path, const gchar *member);
 
index dd43f03..ba880b9 100644 (file)
@@ -31,6 +31,9 @@
 static void set_live_bg (Display *display, Window xwindow, int mode);
 void quit_from_program (Animation_WallpaperPrivate *priv);
 void view_state_changed (Animation_WallpaperPrivate *priv);
+static gboolean short_timeout (AWallpaperPlugin *desktop_plugin);
+void run_long_timeout(AWallpaperPlugin *desktop_plugin);
+gboolean long_timeout (AWallpaperPlugin *desktop_plugin);
 
 static 
 void set_live_bg (Display *display, Window xwindow, int mode)
@@ -141,6 +144,127 @@ quit_from_program (Animation_WallpaperPrivate *priv)
      gtk_main_quit();;
 }
 /*******************************************************************************/
+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;
+    }
+
+    run_long_timeout(desktop_plugin);
+    return TRUE; /* keep running this event */
+}
+
+/*******************************************************************************/
 int
 main(int argc, char *argv[])
 {