changed matrix behavior when rich_animation off
[livewp] / applet / src / livewp-home-widget.c
index 590cb2f..393673b 100644 (file)
@@ -185,10 +185,12 @@ init_object(AWallpaperPlugin *desktop_plugin,
             gint width, 
             gint height, 
             gboolean visible, 
+            gboolean load_image,
             gint scale, 
             gint opacity, 
             void (*pfunc_change)(Actor*),
-            void (*pfunc_probability)(Actor*)
+            void (*pfunc_probability)(Actor*),
+            GPtrArray *child
            )
 {
   Actor *actor = NULL;
@@ -205,7 +207,8 @@ init_object(AWallpaperPlugin *desktop_plugin,
   actor->name = g_strdup(name);
   actor->func_change = (gpointer)pfunc_change; 
   actor->func_probability = (gpointer)pfunc_probability;
-  if (visible)
+  actor->child = child;
+  if (load_image)
     create_hildon_actor(actor, desktop_plugin);
   else 
     actor->widget = NULL;
@@ -249,8 +252,8 @@ probability_sun()
 gint 
 probability_plane()
 {
-    return (fast_rnd(10) + 1) * 60;
-//    return 0;
+    //return (fast_rnd(10) + 1) * 60;
+    return fast_rnd(180);
 }
 
 void 
@@ -258,6 +261,25 @@ change_moon(Actor * actor, AWallpaperPlugin *desktop_plugin)
 {
     gint phase;
     char *newfile;
+    gint x0 = 150,
+         x1 = 650, 
+         x, y,
+         y0=150, y1 = 150, x2=400, y2=30;
+    double a, b, c;
+    struct timeval tvb;     
+    suseconds_t ms;
+    long sec;
+    double t;
+#if 0
+    a = (double)(y2 - (double)(x2*(y1-y0) + x1*y0 - x0*y1)/(x1-x0))/(x2*(x2-x0-x1)+x0*x1);
+    b = (double)(y1-y0)/(x1-x0) - (double)a*(x0+x1);
+    c = (double)(x1*y0 - x0*y1)/(x1-x0) + (double)a*x0*x1;
+    fprintf(stderr, "a=%f, b=%f, c=%f\n", a, b, c);
+#endif
+    gettimeofday(&tvb, NULL);
+    
+    ms = tvb.tv_usec;
+    sec = tvb.tv_sec;
 
     if (actor){
         if (scene.daytime == TIME_NIGHT){
@@ -268,14 +290,26 @@ change_moon(Actor * actor, AWallpaperPlugin *desktop_plugin)
                 if (actor->filename)
                     g_free(actor->filename);
                 actor->filename = newfile;
+                actor->time_start_animation = sec - fast_rnd(60 * 60);
+                actor->duration_animation = 1 * 60 * 60;
                 create_hildon_actor(actor, desktop_plugin);
 
             }
-            //actor->x = 400;
-            //actor->y = 10;
-           // actor_set_position_full(actor->widget, x, y, actor->z);
-            //probability_sun(actor);
-            //fprintf(stderr, "after change sun %d\n", actor->time_start_animation);
+            t = (double)((double)sec+(double)ms/1000000 - actor->time_start_animation) / actor->duration_animation;
+            if (t <= 1)
+                x = path_line(x0, x1, t);
+            else 
+                x = path_line(x1, x0, t-1);
+            //y = path_line(y0, y1, t);
+            y = 0.001920*x*x - 1.536*x + 337.2;
+            //y = a*x*x + b*x + c;
+
+            actor_set_position_full(actor->widget, x, y, actor->z);
+
+            if (t>=2){
+                actor->time_start_animation = sec;
+            }
+
          }else if (actor->visible){
             actor->visible = FALSE;
             fprintf(stderr, "destroy moon \n");
@@ -357,16 +391,16 @@ change_tram(Actor * actor, AWallpaperPlugin *desktop_plugin)
         /* stop animation */
         actor->visible = FALSE;
         destroy_hildon_actor(actor);
-        actor->time_start_animation = sec + fast_rnd(300);
+        actor->time_start_animation = sec + fast_rnd(60);
     }
 }
 
 void
 change_plane1(Actor *actor, AWallpaperPlugin *desktop_plugin)
 {
-    gint x0 = 620, y0 = 233, scale0 = 100,
-         x1 = 79, y1 = -146, scale1 = 100, 
-         x, y, scale;
+    gint x0 = 620, y0 = 233,
+         x1 = 79, y1 = -146, 
+         x, y;
     struct timeval tvb;     
     suseconds_t ms;
     long sec;
@@ -410,9 +444,9 @@ change_plane1(Actor *actor, AWallpaperPlugin *desktop_plugin)
 void
 change_plane2(Actor *actor, AWallpaperPlugin *desktop_plugin)
 {
-    gint x0 = -actor->width, y0 = 45, scale0 = 100,
-         x1 = 800, y1 = 20, scale1 = 100, 
-         x, y, scale;
+    gint x0 = -actor->width, y0 = 45,
+         x1 = 800, y1 = 20, 
+         x, y;
     struct timeval tvb;     
     suseconds_t ms;
     long sec;
@@ -483,7 +517,6 @@ change_cloud(Actor *actor, AWallpaperPlugin *desktop_plugin)
             g_free(actor->filename);
         actor->filename = newfile;
          
-
         create_hildon_actor(actor, desktop_plugin);
     }
     t = (double)((double)sec+(double)ms/1000000 - actor->time_start_animation) / actor->duration_animation;
@@ -527,35 +560,41 @@ change_wind(Actor *actor, AWallpaperPlugin *desktop_plugin)
 void 
 change_window1(Actor * actor, AWallpaperPlugin *desktop_plugin)
 {
-    
     gint now = time(NULL);
     if (scene.daytime == TIME_DAY){
-        if (actor->visible){
+        if (actor->widget){
             actor->visible = FALSE;
             destroy_hildon_actor(actor);
         }
         actor->time_start_animation = 0;
         return;
-    }else if (actor->time_start_animation == 0){
-        actor->time_start_animation = now + fast_rnd(30);
-        return;
+    }else {
+        if (!actor->widget)
+            create_hildon_actor(actor, desktop_plugin);
+        if (actor->time_start_animation == 0){
+            actor->time_start_animation = now + fast_rnd(30);
+            return;
+        }
     }
 
-    if (!actor->visible){
+    if (!actor->visible)
         actor->visible = TRUE;
-        create_hildon_actor(actor, desktop_plugin);
-        actor->time_start_animation = now + fast_rnd(60) + 10;
-    }else {
+    else 
         actor->visible = FALSE;
-        destroy_hildon_actor(actor);
-        actor->time_start_animation = now + fast_rnd(60) + 10;
-    }
-   
+    hildon_animation_actor_set_show(
+            HILDON_ANIMATION_ACTOR(actor->widget), 
+            actor->visible
+    );
+    actor->time_start_animation = now + fast_rnd(60) + 10;
+
 }
 
 void 
 change_signal(Actor * actor, AWallpaperPlugin *desktop_plugin)
 {
+    gint now = time(NULL);
+    Actor *a;
+#if 0
     gchar *newfile;
     gint now = time(NULL);
     newfile = g_strdup_printf("%s%d.png", actor->name, scene.daytime); 
@@ -567,6 +606,24 @@ change_signal(Actor * actor, AWallpaperPlugin *desktop_plugin)
     actor->filename = newfile;
     change_hildon_actor(actor, desktop_plugin);
     actor->time_start_animation = now + fast_rnd(30) + 10;
+#endif
+    a = g_ptr_array_index(actor->child, 0);
+    //fprintf(stderr, "actor name= %p \n", child->widget);
+    if (a->visible)
+        a->visible = FALSE;
+    else 
+        a->visible = TRUE;
+    hildon_animation_actor_set_show (HILDON_ANIMATION_ACTOR(a->widget), a->visible);
+    
+    a = g_ptr_array_index(actor->child, 1);
+    //fprintf(stderr, "actor name= %s \n", child->name);
+    if (a->visible)
+        a->visible = FALSE;
+    else 
+        a->visible = TRUE;
+    hildon_animation_actor_set_show (HILDON_ANIMATION_ACTOR(a->widget), a->visible);
+
+    actor->time_start_animation = now + fast_rnd(30) + 10;
 }
 
 void
@@ -577,7 +634,6 @@ create_hildon_actor(Actor *actor, AWallpaperPlugin *desktop_plugin)
   GtkWidget *image = NULL;
   gchar     *str = NULL;
 
-  /* fprintf(stderr, "create_hildon_actor %s\n", actor->name);*/
   ha = hildon_animation_actor_new();
   str = g_strdup_printf( "%s/%s/%s", THEME_PATH, 
                         desktop_plugin->priv->theme, actor->filename);
@@ -585,6 +641,7 @@ create_hildon_actor(Actor *actor, AWallpaperPlugin *desktop_plugin)
                                              actor->width, 
                                              actor->height, 
                                              NULL);
+  /*fprintf(stderr, "create_hildon_actor %s %s\n", actor->name, str);*/
   if (str)
       g_free(str);
   if (pixbuf){
@@ -597,10 +654,10 @@ create_hildon_actor(Actor *actor, AWallpaperPlugin *desktop_plugin)
     gtk_container_add (GTK_CONTAINER (ha), image);
   }  
   actor_set_position_full(ha, actor->x, actor->y, actor->z);
-  hildon_animation_actor_set_show (HILDON_ANIMATION_ACTOR(ha), actor->visible);
   hildon_animation_actor_set_scale(HILDON_ANIMATION_ACTOR(ha), (double)actor->scale/100, (double)actor->scale/100);
   realize(ha);
   gtk_widget_show_all(ha);
+  hildon_animation_actor_set_show (HILDON_ANIMATION_ACTOR(ha), actor->visible);
 
   /* TO DO check it */
   /*  gdk_flush (); */
@@ -677,8 +734,7 @@ change_static_actor(Actor * actor, AWallpaperPlugin *desktop_plugin)
 void 
 change_static_actor_with_corner(Actor * actor, AWallpaperPlugin *desktop_plugin)
 {
-    gchar *newfile;
-    gchar           buffer[2048];
+    gchar buffer[2048];
 
     if (desktop_plugin->priv->right_corner)
         gtk_widget_destroy(desktop_plugin->priv->right_corner);
@@ -694,6 +750,44 @@ change_static_actor_with_corner(Actor * actor, AWallpaperPlugin *desktop_plugin)
 }
 
 void
+change_layer(Actor * actor, AWallpaperPlugin *desktop_plugin)
+{
+    gint y;
+    Actor *a;
+
+    if (!desktop_plugin->priv->rich_animation) return;
+
+    a = g_ptr_array_index(actor->child, 0);
+    y = a->y + 10;
+    if (y > 480) y = -480;
+    //fprintf(stderr, "!! %s - %d\n", actor->name, y);
+    actor_set_position_full(a->widget, a->x, y, a->z);
+    a->y = y;
+    
+    a = g_ptr_array_index(actor->child, 1);
+    y = a->y + 10;
+    if (y > 480) y = -480;
+    //fprintf(stderr, "!! %s - %d\n", actor->name, y);
+    actor_set_position_full(a->widget, a->x, y, a->z);
+    a->y = y;
+
+    a = g_ptr_array_index(actor->child, 2);
+    y = a->y + 20;
+    if (y > 480) y = -480;
+    //fprintf(stderr, "!! %s - %d\n", actor->name, y);
+    actor_set_position_full(a->widget, a->x, y, a->z);
+    a->y = y;
+
+    a = g_ptr_array_index(actor->child, 3);
+    y = a->y + 20;
+    if (y > 480) y = -480;
+    //fprintf(stderr, "!! %s - %d\n", actor->name, y);
+    actor_set_position_full(a->widget, a->x, y, a->z);
+    a->y = y;
+
+}
+
+void
 change_layer1(Actor * actor, AWallpaperPlugin *desktop_plugin)
 {
     gint y;
@@ -729,6 +823,9 @@ destroy_scene(void){
     while (tmp != NULL){
         actor = tmp->data;
         if (actor){
+            if (actor->child){
+                g_ptr_array_free(actor->child, TRUE);
+            }
             if (actor->filename)
                 g_free(actor->filename);
             if (actor->name)
@@ -761,7 +858,17 @@ static void
 init_scene2(AWallpaperPlugin *desktop_plugin)
 {
   Actor *actor;
+  GPtrArray *child;
   gint now = time(NULL);
+  gint y1, y2;
+
+  if (desktop_plugin->priv->rich_animation){
+      y1 = -480;
+      y2 = -480-480;
+  }else {
+      y1 = 0;
+      y2 = -480;
+  }
 
   fprintf(stderr, "init scene2 \n");
   //scene.daytime = get_daytime();
@@ -770,43 +877,63 @@ init_scene2(AWallpaperPlugin *desktop_plugin)
   
   actor = init_object(desktop_plugin, "background", "bg.png", 
                       0, 0, 5, 800, 480, 
-                      TRUE, 100, 255, NULL, NULL);
+                      TRUE, TRUE, 100, 255, 
+                      NULL, NULL, NULL);
   scene.actors = g_slist_append(scene.actors, actor);
 
   actor = init_object(desktop_plugin, "symbols", "symbols.png", 
                       0, 0, 10, 800, 480, 
-                      TRUE, 100, 255, NULL, NULL);
+                      TRUE, TRUE, 100, 255, 
+                      NULL, NULL, NULL);
   scene.actors = g_slist_append(scene.actors, actor);
 
+  child = g_ptr_array_sized_new(4);
   actor = init_object(desktop_plugin, "layer1", "layer1_2.png", 
-                      0, -480, 6, 800, 960, 
-                      TRUE, 100, 255, (gpointer)&change_layer1, NULL);
-  actor->time_start_animation = now;
-  actor->duration_animation = G_MAXINT;
+                      0, y1, 6, 800, 960, 
+                      TRUE, TRUE, 100, 255, 
+                      NULL, NULL, NULL);
+  //actor->time_start_animation = now;
+  //actor->duration_animation = G_MAXINT;
   scene.actors = g_slist_append(scene.actors, actor);
+  g_ptr_array_add(child, actor);
 
   actor = init_object(desktop_plugin, "layer1", "layer1_1.png", 
-                      0, (-480 - 480), 7, 800, 960, 
-                      TRUE, 100, 255, (gpointer)&change_layer1, NULL);
-  actor->time_start_animation = now;
-  actor->duration_animation = G_MAXINT;
+                      0, y2, 7, 800, 960, 
+                      TRUE, TRUE, 100, 255, 
+                      NULL, NULL, NULL);
+  //actor->time_start_animation = now;
+  //actor->duration_animation = G_MAXINT;
   scene.actors = g_slist_append(scene.actors, actor);
+  g_ptr_array_add(child, actor);
 
   actor = init_object(desktop_plugin, "layer2", "layer2_2.png", 
-                      0, -480, 8, 800, 960, 
-                      TRUE, 100, 255, (gpointer)&change_layer2, NULL);
-  actor->time_start_animation = now;
-  actor->duration_animation = G_MAXINT;
+                      0, y1, 8, 800, 960, 
+                      TRUE, TRUE, 100, 255, 
+                      NULL, NULL, NULL);
+  //actor->time_start_animation = now;
+  //actor->duration_animation = G_MAXINT;
   scene.actors = g_slist_append(scene.actors, actor);
+  g_ptr_array_add(child, actor);
 
   actor = init_object(desktop_plugin, "layer2", "layer2_1.png", 
-                      0, (-480 - 480), 9, 800, 960, 
-                      TRUE, 100, 255, (gpointer)&change_layer2, NULL);
+                      0, y2, 9, 800, 960, 
+                      TRUE, TRUE, 100, 255, 
+                      NULL, NULL, NULL);
+  //actor->time_start_animation = now;
+  //actor->duration_animation = G_MAXINT;
+  scene.actors = g_slist_append(scene.actors, actor);
+  g_ptr_array_add(child, actor);
+
+  actor = init_object(desktop_plugin, "layers", "", 
+                      0, y2, 9, 800, 960, 
+                      FALSE, FALSE, 100, 255, 
+                      (gpointer)&change_layer, NULL, child);
   actor->time_start_animation = now;
   actor->duration_animation = G_MAXINT;
   scene.actors = g_slist_append(scene.actors, actor);
 
   run_long_timeout(desktop_plugin);
+
 }
 /* Init Modern Scene */
 static void
@@ -825,15 +952,17 @@ init_scene(AWallpaperPlugin *desktop_plugin)
   /* init value for random */
   scene.seed = time(NULL);
 
-  
-
-  actor = init_object(desktop_plugin, "sky", "sky0.png", 0, 0, 5, 800, 480, 
-                      TRUE, 100, 255, (gpointer)&change_static_actor, NULL);
+  actor = init_object(desktop_plugin, "sky", "sky0.png", 
+                      0, 0, 5, 800, 480, 
+                      TRUE , TRUE, 100, 255, 
+                      (gpointer)&change_static_actor, NULL, NULL);
   change_static_actor(actor, desktop_plugin);
   scene.actors = g_slist_append(scene.actors, actor);
 
-  actor = init_object(desktop_plugin, "sun", "sun.png", 0, 0, 6, 88, 88, 
-                      TRUE, 100, 255, (gpointer)&change_sun, &probability_sun);
+  actor = init_object(desktop_plugin, "sun", "sun.png", 
+                      0, 0, 6, 88, 88, 
+                      FALSE, FALSE, 100, 255, 
+                      (gpointer)&change_sun, (gpointer)&probability_sun, NULL);
   actor->time_start_animation = now;
   actor->duration_animation = G_MAXINT;
   change_sun(actor, desktop_plugin);
@@ -843,48 +972,64 @@ init_scene(AWallpaperPlugin *desktop_plugin)
     //                  TRUE, 100, 255, NULL, NULL);
   //scene.actors = g_slist_append(scene.actors, actor);
   
-  actor = init_object(desktop_plugin, "cloud1", "cloud1.png", 0, fast_rnd(300)-97, 7, 150, 97, 
-                      FALSE, 100, 255, (gpointer)&change_cloud, NULL);
-  actor->time_start_animation = now + fast_rnd(180);
+  actor = init_object(desktop_plugin, "cloud1", "cloud1.png", 
+                      0, fast_rnd(300)-97, 7, 150, 97, 
+                      FALSE, FALSE, 100, 255, 
+                      (gpointer)&change_cloud, NULL, NULL);
+  actor->time_start_animation = now + fast_rnd(20);
   actor->duration_animation = 3*60;
   scene.actors = g_slist_append(scene.actors, actor);
   
-  actor = init_object(desktop_plugin, "cloud2", "cloud2.png", 0, fast_rnd(300)-75, 7, 188, 75, 
-                      FALSE, 100, 255, (gpointer)&change_cloud, NULL);
-  actor->time_start_animation = now + fast_rnd(180);
+  actor = init_object(desktop_plugin, "cloud2", "cloud2.png", 
+                      0, fast_rnd(300)-75, 7, 188, 75, 
+                      FALSE, FALSE, 100, 255, 
+                      (gpointer)&change_cloud, NULL, NULL);
+  actor->time_start_animation = now + fast_rnd(40)+10;
   actor->duration_animation = 3*60;
   scene.actors = g_slist_append(scene.actors, actor);
 
-  actor = init_object(desktop_plugin, "cloud4", "cloud4.png", 0, fast_rnd(300)-75, 7, 150, 75, 
-                      FALSE, 100, 255, (gpointer)&change_cloud, NULL);
-  actor->time_start_animation = now + fast_rnd(180);
+  actor = init_object(desktop_plugin, "cloud4", "cloud4.png", 
+                      0, fast_rnd(300)-75, 7, 150, 75, 
+                      FALSE, FALSE, 100, 255, 
+                      (gpointer)&change_cloud, NULL, NULL);
+  actor->time_start_animation = now + fast_rnd(60) + 20;
   actor->duration_animation = 5*60;
   scene.actors = g_slist_append(scene.actors, actor);
 
 
-  actor = init_object(desktop_plugin, "town", "town0.png", 0, 0, 8, 800, 480, 
-                      TRUE, 100, 255, (gpointer)&change_static_actor, NULL);
+  actor = init_object(desktop_plugin, "town", "town0.png", 
+                      0, 0, 8, 800, 480, 
+                      TRUE, TRUE, 100, 255, 
+                      (gpointer)&change_static_actor, NULL, NULL);
   change_static_actor(actor, desktop_plugin);
   scene.actors = g_slist_append(scene.actors, actor);
 
-  actor = init_object(desktop_plugin, "tram", "tram.png", -300, 225, 9, 350, 210, 
-                      FALSE, 100, 255, (gpointer)&change_tram, NULL);
+  actor = init_object(desktop_plugin, "tram", "tram.png", 
+                      -300, 225, 9, 350, 210, 
+                      FALSE, FALSE, 100, 255, 
+                      (gpointer)&change_tram, NULL, NULL);
   actor->time_start_animation = time(NULL) + fast_rnd(10); 
   actor->duration_animation = 60;
   scene.actors = g_slist_append(scene.actors, actor);
 
-  actor = init_object(desktop_plugin, "border", "border0.png", 0, 480-79, 10, 800, 79,
-                      TRUE, 100, 255, (gpointer)&change_static_actor_with_corner, NULL);
+  actor = init_object(desktop_plugin, "border", "border0.png", 
+                      0, 480-79, 10, 800, 79,
+                      TRUE, TRUE, 100, 255, 
+                      (gpointer)&change_static_actor_with_corner, NULL, NULL);
   change_static_actor_with_corner(actor, desktop_plugin);
   scene.actors = g_slist_append(scene.actors, actor);
   
-  actor = init_object(desktop_plugin, "moon", "moon1.png", 400, 20, 6, 60, 60, 
-                      FALSE, 100, 255, (gpointer)&change_moon, NULL);
+  actor = init_object(desktop_plugin, "moon", "moon1.png", 
+                      400, 20, 6, 60, 60, 
+                      FALSE, FALSE, 100, 255, 
+                      (gpointer)&change_moon, NULL, NULL);
   change_moon(actor, desktop_plugin);
   scene.actors = g_slist_append(scene.actors, actor);
 
-  actor = init_object(desktop_plugin, "wind", "", 0, 0, 5, 0, 0, 
-                      FALSE, 100, 255, (gpointer)&change_wind, NULL);
+  actor = init_object(desktop_plugin, "wind", "", 
+                      0, 0, 5, 0, 0, 
+                      FALSE, FALSE, 100, 255, 
+                      (gpointer)&change_wind, NULL, NULL);
   change_wind(actor, desktop_plugin);
   scene.actors = g_slist_append(scene.actors, actor);
 
@@ -931,7 +1076,8 @@ init_scene(AWallpaperPlugin *desktop_plugin)
     for (i=0; i<13; i++){
         actor = init_object(desktop_plugin, "window1", "window1.png", 
                             winds[i][0], winds[i][1], 8, 8, 10, 
-                            FALSE, 100, 255, (gpointer)&change_window1, NULL);
+                            FALSE, FALSE, 100, 255, 
+                            (gpointer)&change_window1, NULL, NULL);
         //change_window1(actor, desktop_plugin);
         actor->time_start_animation = now + fast_rnd(30);
         scene.actors = g_slist_append(scene.actors, actor);
@@ -966,7 +1112,8 @@ init_scene(AWallpaperPlugin *desktop_plugin)
     for (i=0; i<8; i++){
         actor = init_object(desktop_plugin, "window2", "window2.png", 
                             winds[i][0], winds[i][1], 8, 8, 10, 
-                            FALSE, 100, 255, (gpointer)&change_window1, NULL);
+                            FALSE, FALSE, 100, 255, 
+                            (gpointer)&change_window1, NULL, NULL);
         //change_window1(actor, desktop_plugin);
         actor->time_start_animation = now + fast_rnd(30);
         scene.actors = g_slist_append(scene.actors, actor);
@@ -1008,7 +1155,8 @@ init_scene(AWallpaperPlugin *desktop_plugin)
     for (i=0; i<10; i++){
         actor = init_object(desktop_plugin, "window3", "window3.png", 
                             winds[i][0], winds[i][1], 8, 8, 10, 
-                            FALSE, 100, 255, (gpointer)&change_window1, NULL);
+                            FALSE, FALSE, 100, 255, 
+                            (gpointer)&change_window1, NULL, NULL);
         //change_window1(actor, desktop_plugin);
         actor->time_start_animation = now + fast_rnd(30);
         scene.actors = g_slist_append(scene.actors, actor);
@@ -1041,7 +1189,8 @@ init_scene(AWallpaperPlugin *desktop_plugin)
     for (i=0; i<7; i++){
         actor = init_object(desktop_plugin, "window4", "window4.png", 
                             winds[i][0], winds[i][1], 8, 8, 10, 
-                            FALSE, 100, 255, (gpointer)&change_window1, NULL);
+                            FALSE, FALSE, 100, 255, 
+                            (gpointer)&change_window1, NULL, NULL);
         //change_window1(actor, desktop_plugin);
         actor->time_start_animation = now + fast_rnd(30);
         scene.actors = g_slist_append(scene.actors, actor);
@@ -1071,7 +1220,8 @@ init_scene(AWallpaperPlugin *desktop_plugin)
     for (i=0; i<6; i++){
         actor = init_object(desktop_plugin, "window5", "window5.png", 
                             winds[i][0], winds[i][1], 8, 8, 10, 
-                            FALSE, 100, 255, (gpointer)&change_window1, NULL);
+                            FALSE, FALSE, 100, 255, 
+                            (gpointer)&change_window1, NULL, NULL);
         //change_window1(actor, desktop_plugin);
         actor->time_start_animation = now + fast_rnd(30);
         scene.actors = g_slist_append(scene.actors, actor);
@@ -1079,6 +1229,7 @@ init_scene(AWallpaperPlugin *desktop_plugin)
     }
 
     run_long_timeout(desktop_plugin);
+
 #if 0    
   anim = g_new0(Animation, 1);
   anim->count = 1;
@@ -1096,10 +1247,11 @@ init_scene(AWallpaperPlugin *desktop_plugin)
 static void
 init_scene1(AWallpaperPlugin *desktop_plugin)
 {
-  Actor *actor;
+  Actor *actor, *actor1, *actor2;
   gint now = time(NULL);
   gint i; 
   gint winds[13][2];
+  GPtrArray *child = NULL;
 
   scene.daytime = get_daytime();
   scene.actors = NULL;
@@ -1110,13 +1262,15 @@ init_scene1(AWallpaperPlugin *desktop_plugin)
 
   
   actor = init_object(desktop_plugin, "sky", "sky.png", 0, 0, 5, 800, 480, 
-                      TRUE, 100, 255, (gpointer)&change_static_actor, NULL);
+                      TRUE, TRUE, 100, 255, 
+                      (gpointer)&change_static_actor, NULL, NULL);
   change_static_actor(actor, desktop_plugin);
   scene.actors = g_slist_append(scene.actors, actor);
 
   
   actor = init_object(desktop_plugin, "sun", "sun.png", 0, 0, 6, 88, 88, 
-                      TRUE, 100, 255, (gpointer)&change_sun, &probability_sun);
+                      FALSE, FALSE, 100, 255, 
+                      (gpointer)&change_sun, (gpointer)&probability_sun, NULL);
   actor->time_start_animation = time(NULL);
   actor->duration_animation = G_MAXINT;
   change_sun(actor, desktop_plugin);
@@ -1129,55 +1283,79 @@ init_scene1(AWallpaperPlugin *desktop_plugin)
 #endif
 
   actor = init_object(desktop_plugin, "moon", "moon1.png", 400, 15, 6, 60, 60, 
-                      FALSE, 100, 255, (gpointer)&change_moon, NULL);
+                      FALSE, FALSE, 100, 255, 
+                      (gpointer)&change_moon, NULL, NULL);
   change_moon(actor, desktop_plugin);
   scene.actors = g_slist_append(scene.actors, actor);
   
   actor = init_object(desktop_plugin, "cloud1", "cloud1.png", 0, fast_rnd(300)-97, 7, 150, 97, 
-                      FALSE, 100, 255, (gpointer)&change_cloud, NULL);
-  actor->time_start_animation = now + fast_rnd(180);
+                      FALSE, FALSE, 100, 255, 
+                      (gpointer)&change_cloud, NULL, NULL);
+  actor->time_start_animation = now + fast_rnd(30) + 10;
   actor->duration_animation = 3*60;
   scene.actors = g_slist_append(scene.actors, actor);
   
   actor = init_object(desktop_plugin, "cloud2", "cloud2.png", 0, fast_rnd(300)-75, 7, 188, 75, 
-                      FALSE, 100, 255, (gpointer)&change_cloud, NULL);
-  actor->time_start_animation = now + fast_rnd(180);
+                      FALSE, FALSE, 100, 255, 
+                      (gpointer)&change_cloud, NULL, NULL);
+  actor->time_start_animation = now + fast_rnd(10);
   actor->duration_animation = 3*60;
   scene.actors = g_slist_append(scene.actors, actor);
 
   actor = init_object(desktop_plugin, "cloud4", "cloud4.png", 0, fast_rnd(300)-75, 7, 150, 75, 
-                      FALSE, 100, 255, (gpointer)&change_cloud, NULL);
-  actor->time_start_animation = now + fast_rnd(180);
+                      FALSE, FALSE, 100, 255, 
+                      (gpointer)&change_cloud, NULL, NULL);
+  actor->time_start_animation = now + fast_rnd(60) + 20;
   actor->duration_animation = 5*60;
   scene.actors = g_slist_append(scene.actors, actor);
 
  
   actor = init_object(desktop_plugin, "plane2", "plane3.png", 0, 45, 8, 160, 50, 
-                      FALSE, 100, 255, (gpointer)&change_plane2, NULL);
-  actor->time_start_animation = now + probability_plane();
+                      FALSE, FALSE, 100, 255, 
+                      (gpointer)&change_plane2, NULL, NULL);
+  actor->time_start_animation = now + fast_rnd(40) + 20;
   actor->duration_animation = 60;
   scene.actors = g_slist_append(scene.actors, actor);
   
   actor = init_object(desktop_plugin, "plane1", "tu154.png", 620, 233, 9, 300, 116, 
-                      FALSE, 100, 255, (gpointer)&change_plane1, NULL);
-  actor->time_start_animation = now + probability_plane();
+                      FALSE, FALSE, 100, 255, 
+                      (gpointer)&change_plane1, NULL, NULL);
+  actor->time_start_animation = now + fast_rnd(20);
   actor->duration_animation = 30;
   scene.actors = g_slist_append(scene.actors, actor);
 
   actor = init_object(desktop_plugin, "town", "town.png", 0, 0, 10, 800, 480, 
-                      TRUE, 100, 255, (gpointer)&change_static_actor_with_corner, NULL);
+                      TRUE, TRUE, 100, 255, 
+                      (gpointer)&change_static_actor_with_corner, NULL, NULL);
   change_static_actor_with_corner(actor, desktop_plugin);
   scene.actors = g_slist_append(scene.actors, actor);
 
   actor = init_object(desktop_plugin, "wind", "", 0, 0, 5, 0, 0, 
-                      FALSE, 100, 255, (gpointer)&change_wind, NULL);
+                      FALSE, FALSE, 100, 255, 
+                      (gpointer)&change_wind, NULL, NULL);
   change_wind(actor, desktop_plugin);
   scene.actors = g_slist_append(scene.actors, actor);
 
-  actor = init_object(desktop_plugin, "signal", "red.png", 486, 425, 10, 18, 38, 
-                      TRUE, 100, 255, (gpointer)&change_signal, NULL);
-  actor->time_start_animation = now + fast_rnd(30) + 10;  
-  scene.actors = g_slist_append(scene.actors, actor);winds[0][0] = 717;
+  actor1 = init_object(desktop_plugin, "signal_red", "red.png", 
+                      486, 425, 10, 18, 38, 
+                      FALSE, TRUE, 100, 255, NULL, NULL, NULL);
+  //actor->time_start_animation = now + fast_rnd(30) + 10;  
+  scene.actors = g_slist_append(scene.actors, actor1);
+   
+  actor2 = init_object(desktop_plugin, "signal_green", "green.png", 
+                      486, 425, 10, 18, 38, 
+                      TRUE, TRUE, 100, 255, NULL, NULL, NULL);
+  //actor->time_start_animation = now + fast_rnd(30) + 10;  
+  scene.actors = g_slist_append(scene.actors, actor2);
+  child = g_ptr_array_sized_new(2);
+  g_ptr_array_add(child, actor1);
+  g_ptr_array_add(child, actor2);
+  actor = init_object(desktop_plugin, "signal", "",
+                      486, 425, 10, 18, 38,
+                      FALSE, FALSE, 100, 255, 
+                      (gpointer)&change_signal, NULL, child);
+  actor->time_start_animation = now + fast_rnd(30) + 10;
+  scene.actors = g_slist_append(scene.actors, actor);
     
     winds[0][0] = 389;
     winds[0][1] = 305;
@@ -1221,7 +1399,8 @@ init_scene1(AWallpaperPlugin *desktop_plugin)
     for (i=0; i<13; i++){
         actor = init_object(desktop_plugin, "window", "window.png", 
                             winds[i][0], winds[i][1], 10, 8, 9, 
-                            FALSE, 100, 255, (gpointer)&change_window1, NULL);
+                            FALSE, TRUE, 100, 255, 
+                            (gpointer)&change_window1, NULL, NULL);
         //change_window1(actor, desktop_plugin);
         actor->time_start_animation = now + fast_rnd(30);
         scene.actors = g_slist_append(scene.actors, actor);
@@ -1317,7 +1496,7 @@ change_actor(GtkWidget * actor)
 static gboolean
 short_timeout (AWallpaperPlugin *desktop_plugin)
 {
-    gint daytime = get_daytime();
+    //gint daytime = get_daytime();
     GSList * tmp;
     void (*pfunc)(gpointer, gpointer);
     time_t now;
@@ -1447,6 +1626,7 @@ gboolean
 rich_animation_press(GtkWidget *widget, GdkEvent *event,
                                             gpointer user_data){
     fprintf(stderr,"gggggggggggggggggggg2222\n");
+    return FALSE;
 }    
 static void
 animation_wallpaper_plugin_init (AWallpaperPlugin *desktop_plugin)
@@ -1458,13 +1638,17 @@ animation_wallpaper_plugin_init (AWallpaperPlugin *desktop_plugin)
     fprintf(stderr, "!!!!!!!plugin init \n");
     Animation_WallpaperPrivate *priv =  Animation_Wallpaper_HOME_PLUGIN_GET_PRIVATE (desktop_plugin);
     desktop_plugin->priv =  Animation_Wallpaper_HOME_PLUGIN_GET_PRIVATE (desktop_plugin);
+    priv->osso = osso_initialize(PACKAGE, VERSION, TRUE, NULL);
 
     /* Load config */
     read_config(priv);
+    /* Initialize DBUS */
+    livewp_initialize_dbus(priv);
+
     priv->desktop_plugin = desktop_plugin;
     priv->visible = TRUE;
     priv->short_timer = 0;
-    priv->theme = g_strdup("Berlin");
+    //priv->theme = g_strdup("Modern");
     desktop_plugin->priv->main_widget = gtk_fixed_new();
 
     gtk_widget_set_size_request(desktop_plugin->priv->main_widget, 100, 32);
@@ -1494,7 +1678,7 @@ animation_wallpaper_plugin_init (AWallpaperPlugin *desktop_plugin)
 */
     hd_home_plugin_item_set_settings (HD_HOME_PLUGIN_ITEM (desktop_plugin), TRUE);
     g_signal_connect (desktop_plugin, "show-settings",
-                            G_CALLBACK (lw_settings), priv);
+                            G_CALLBACK (show_settings), priv);
     gtk_widget_show (desktop_plugin->priv->main_widget);
     gtk_container_add (GTK_CONTAINER (desktop_plugin), desktop_plugin->priv->main_widget);
     init_applet_position();