small change timer logic
[livewp] / applet / src / livewp-home-widget.c
index aa3dbc8..ddef6ba 100644 (file)
@@ -170,7 +170,7 @@ path_line(gint x0, gint x1, double t)
 void
 destroy_hildon_actor(Actor *actor)
 {
-    fprintf(stderr, "destroy_hildon_actor %s\n",actor->name);
+    //fprintf(stderr, "destroy_hildon_actor %s\n",actor->name);
     gtk_widget_destroy(actor->widget);
     actor->widget = NULL;
 }
@@ -326,6 +326,7 @@ change_tram(Actor * actor, AWallpaperPlugin *desktop_plugin)
     long sec;
     double t;
 
+    //fprintf(stderr, "change tram\n");
     gettimeofday(&tvb, NULL);
     
     ms = tvb.tv_usec;
@@ -462,6 +463,7 @@ change_cloud(Actor *actor, AWallpaperPlugin *desktop_plugin)
     long sec;
     double t;
 
+    //fprintf(stderr, "change cloud\n");
     gettimeofday(&tvb, NULL);
     
     ms = tvb.tv_usec;
@@ -511,7 +513,7 @@ change_wind(Actor *actor, AWallpaperPlugin *desktop_plugin)
     if (scene.wind_orientation == 0) scene.wind_orientation = -1;
     scene.wind_angle = (double)(fast_rnd(200) - 100) / 100;
     actor->time_start_animation = time(NULL) + (fast_rnd(10) + 10) * 60;
-    fprintf(stderr, "change wind orient = %d angle = %f after = %d\n", scene.wind_orientation, scene.wind_angle, actor->time_start_animation-time(NULL));
+    //fprintf(stderr, "change wind orient = %d angle = %f after = %d\n", scene.wind_orientation, scene.wind_angle, actor->time_start_animation-time(NULL));
 }
 
 void 
@@ -535,11 +537,11 @@ change_window1(Actor * actor, AWallpaperPlugin *desktop_plugin)
     if (!actor->visible){
         actor->visible = TRUE;
         create_hildon_actor(actor, desktop_plugin);
-        actor->time_start_animation = now + fast_rnd(20) + 10;
+        actor->time_start_animation = now + fast_rnd(60) + 10;
     }else {
         actor->visible = FALSE;
         destroy_hildon_actor(actor);
-        actor->time_start_animation = now + fast_rnd(20) + 10;
+        actor->time_start_animation = now + fast_rnd(60) + 10;
     }
    
 }
@@ -746,13 +748,13 @@ init_scene(AWallpaperPlugin *desktop_plugin)
   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->duration_animation = 5*60;
+  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->duration_animation = 5*60;
+  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, 
@@ -1021,11 +1023,11 @@ init_scene1(AWallpaperPlugin *desktop_plugin)
   change_sun(actor, desktop_plugin);
   scene.actors = g_slist_append(scene.actors, actor);
 
-
+#if 0
   actor = init_object(desktop_plugin, "dot", "dot1.png", 0, 0, 11, 50, 50, 
                       TRUE, 100, 255, NULL, NULL);
   scene.actors = g_slist_append(scene.actors, actor);
-
+#endif
 
   actor = init_object(desktop_plugin, "moon", "moon1.png", 400, 15, 6, 60, 60, 
                       FALSE, 100, 255, (gpointer)&change_moon, NULL);
@@ -1035,13 +1037,13 @@ init_scene1(AWallpaperPlugin *desktop_plugin)
   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->duration_animation = 5*60;
+  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->duration_animation = 5*60;
+  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, 
@@ -1239,10 +1241,14 @@ long_timeout (AWallpaperPlugin *desktop_plugin)
         if (now >= actor->time_start_animation  
             && actor->time_start_animation > 0
             && desktop_plugin->priv->short_timer == 0){
-            actor->time_start_animation = now;
             /* fprintf(stderr, "start short timer act = %s %d\n", actor->name, now); */
-            if (desktop_plugin->priv->rich_animation)
+            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);
     }