fixed first start for theme video
[livewp] / applet / src / livewp-scene.c
1 /* vim: set sw=4 ts=4 et: */
2 /*
3  * This file is part of Live Wallpaper (livewp)
4  * 
5  * Copyright (C) 2010 Vlad Vasiliev
6  * Copyright (C) 2010 Tanya Makova
7  *       for the code
8  * 
9  * This software is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public License
11  * as published by the Free Software Foundation; either version 2.1 of
12  * the License, or (at your option) any later version.
13  * 
14  * This software is distributed in the hope that it will be useful, but
15  * WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  * 
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this software; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
22  * 02110-1301 USA
23 */
24 /*******************************************************************************/
25 #include "livewp-scene.h" 
26
27 void 
28 destroy_scene(AWallpaperPlugin *desktop_plugin)
29 {
30     if (desktop_plugin->priv->scene){
31             GSList * tmp = desktop_plugin->priv->scene->actors;
32             while (tmp != NULL){
33                 destroy_actor(tmp->data);
34                 tmp = g_slist_next(tmp);
35             }
36             if (tmp)
37                 g_slist_free(tmp);
38             desktop_plugin->priv->scene->actors = NULL;
39             if (desktop_plugin->priv->scene){
40                 g_free(desktop_plugin->priv->scene);
41                 desktop_plugin->priv->scene = NULL;
42             }
43     }
44 }
45
46 void
47 reload_scene(AWallpaperPlugin *desktop_plugin)
48 {
49     fprintf(stderr,"Reload scene %s\n", desktop_plugin->priv->theme);  
50     destroy_scene(desktop_plugin);
51     init_scene_theme(desktop_plugin);
52 }
53
54 void  
55 parsestring(char *line, char **argv)
56 {
57    while (*line != '\0') {  
58           while (*line == ' ' || *line == '\n')
59                 *line++ = '\0';     /* replace white spaces with 0    */
60                  *argv++ = line;          /* save the argument position     */
61                  while (*line != '\0' && *line != ' ' && 
62                         *line != '\n') 
63                      line++;             /* skip the argument until ...    */
64    }
65                   *argv = '\0';                 /* mark the end of argument list  */
66 }
67
68 #if 0
69 GstBusSyncReply 
70 sync_handler(GstBus *bus, GstMessage *message, AWallpaperPlugin *desktop_plugin){
71
72     if (!desktop_plugin->priv->visible)
73         gst_element_set_state (desktop_plugin->priv->pipeline, GST_STATE_PAUSED);
74     if (GST_MESSAGE_TYPE(message) != GST_MESSAGE_ELEMENT){
75                 return (GST_BUS_PASS);
76         }
77     if (!gst_structure_has_name(message->structure, "prepare-xwindow-id")){
78         return (GST_BUS_PASS);
79     }
80     return (GST_BUS_DROP);
81
82 }
83 #endif
84 void
85 init_scene_Video(AWallpaperPlugin *desktop_plugin)
86 {
87     GstElement *bin;                                                                                                                                                           
88     GstElement *videosink;                                                                                                
89     GstFormat format; 
90     gchar *file_plus_uri;
91
92
93     desktop_plugin->priv->pipeline= gst_pipeline_new("gst-player");
94     bin = gst_element_factory_make ("playbin2", "bin");
95     videosink = gst_element_factory_make ("ximagesink", "videosink");
96     g_object_set (G_OBJECT (bin), "video-sink", videosink, NULL);
97     gst_bin_add (GST_BIN (desktop_plugin->priv->pipeline), bin);
98
99     {
100         GstBus *bus;
101         bus = gst_pipeline_get_bus (GST_PIPELINE (desktop_plugin->priv->pipeline));
102 //      gst_bus_add_watch(bus, bus_call, NULL);
103         gst_object_unref (bus);
104     }
105     file_plus_uri = g_strdup_printf("file://%s",desktop_plugin->priv->theme_string_parametr1);
106     g_object_set (G_OBJECT (bin), "uri", file_plus_uri, NULL );
107     g_object_set (G_OBJECT (videosink), "force-aspect-ratio", TRUE, NULL  );
108     if (GST_IS_X_OVERLAY (videosink))
109             gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (videosink), GDK_DRAWABLE_XID(desktop_plugin->priv->window->window));
110     if (desktop_plugin->priv->visible)
111         gst_element_set_state (desktop_plugin->priv->pipeline, GST_STATE_PLAYING);
112 }
113
114 void
115 init_scene_Matrix(AWallpaperPlugin *desktop_plugin)
116 {
117   Actor *actor;
118   Scene *scene;
119   GPtrArray *child;
120   gint now = time(NULL);
121   gint y1, y2;
122
123   if (desktop_plugin->priv->rich_animation){
124       y1 = -480;
125       y2 = -480-480;
126   }else {
127       y1 = 0;
128       y2 = -480;
129   }
130
131   /* fprintf(stderr, "init scene2 \n"); */
132   scene = g_new0(Scene, 1);
133   //scene.daytime = get_daytime();
134   scene->actors = NULL;
135   desktop_plugin->priv->scene = scene;
136   
137   actor = init_object(desktop_plugin, "background", "bg.png", 
138                       0, 0, 5, 800, 480, 
139                       TRUE, TRUE, 100, 255, 
140                       NULL, NULL, NULL);
141   scene->actors = g_slist_append(scene->actors, actor);
142
143   actor = init_object(desktop_plugin, "symbols", "symbols.png", 
144                       0, 0, 10, 800, 480, 
145                       TRUE, TRUE, 100, 255, 
146                       NULL, NULL, NULL);
147   scene->actors = g_slist_append(scene->actors, actor);
148
149   child = g_ptr_array_sized_new(4);
150   actor = init_object(desktop_plugin, "layer1", "layer1_2.png", 
151                       0, y1, 6, 800, 960, 
152                       TRUE, TRUE, 100, 255, 
153                       NULL, NULL, NULL);
154   //actor->time_start_animation = now;
155   //actor->duration_animation = G_MAXINT;
156   scene->actors = g_slist_append(scene->actors, actor);
157   g_ptr_array_add(child, actor);
158
159   actor = init_object(desktop_plugin, "layer1", "layer1_1.png", 
160                       0, y2, 7, 800, 960, 
161                       TRUE, TRUE, 100, 255, 
162                       NULL, NULL, NULL);
163   //actor->time_start_animation = now;
164   //actor->duration_animation = G_MAXINT;
165   scene->actors = g_slist_append(scene->actors, actor);
166   g_ptr_array_add(child, actor);
167
168   actor = init_object(desktop_plugin, "layer2", "layer2_2.png", 
169                       0, y1, 8, 800, 960, 
170                       TRUE, TRUE, 100, 255, 
171                       NULL, NULL, NULL);
172   //actor->time_start_animation = now;
173   //actor->duration_animation = G_MAXINT;
174   scene->actors = g_slist_append(scene->actors, actor);
175   g_ptr_array_add(child, actor);
176
177   actor = init_object(desktop_plugin, "layer2", "layer2_1.png", 
178                       0, y2, 9, 800, 960, 
179                       TRUE, TRUE, 100, 255, 
180                       NULL, NULL, NULL);
181   //actor->time_start_animation = now;
182   //actor->duration_animation = G_MAXINT;
183   scene->actors = g_slist_append(scene->actors, actor);
184   g_ptr_array_add(child, actor);
185
186   actor = init_object(desktop_plugin, "layers", "", 
187                       0, y2, 9, 800, 960, 
188                       FALSE, FALSE, 100, 255, 
189                       (gpointer)&change_layer, NULL, child);
190   actor->time_start_animation = now;
191   actor->duration_animation = G_MAXINT;
192   scene->actors = g_slist_append(scene->actors, actor);
193
194   run_long_timeout(desktop_plugin);
195
196 }
197
198 /* Init Modern Scene */
199 void
200 init_scene_Modern(AWallpaperPlugin *desktop_plugin)
201 {
202   Actor *actor;
203   Scene *scene;
204   gint now = time(NULL);
205   gint i;
206   gint winds[13][2];
207   GPtrArray *child; 
208
209   /* fprintf(stderr, "init scene \n"); */
210   scene = g_new0(Scene, 1);
211   scene->daytime = get_daytime();
212   scene->actors = NULL;
213   scene->wind_orientation = -1;
214   scene->wind_angle = 0.3;
215   /* init value for random */
216   scene->seed = time(NULL);
217   scene->notification = TRUE;
218   desktop_plugin->priv->scene = scene;
219   actor = init_object(desktop_plugin, "sky", "sky0.png", 
220                       0, 0, 5, 800, 480, 
221                       TRUE , TRUE, 100, 255, 
222                       (gpointer)&change_static_actor, NULL, NULL);
223   scene->actors = g_slist_append(scene->actors, actor);
224   change_static_actor(actor, desktop_plugin);
225   
226   actor = init_object(desktop_plugin, "sun", "sun.png", 
227                       0, 0, 6, 88, 88, 
228                       FALSE, FALSE, 100, 255, 
229                       (gpointer)&change_sun, NULL, NULL);
230   actor->time_start_animation = now;
231   actor->duration_animation = G_MAXINT;
232   change_sun(actor, desktop_plugin);
233   scene->actors = g_slist_append(scene->actors, actor);
234
235   //actor = init_object(desktop_plugin, "dot", "dot1.png", 0, 0, 11, 50, 50, 
236     //                  TRUE, 100, 255, NULL, NULL);
237   //scene.actors = g_slist_append(scene.actors, actor);
238   
239   actor = init_object(desktop_plugin, "cloud1", "cloud1.png", 
240                       0, fast_rnd(300)-97, 7, 150, 97, 
241                       FALSE, FALSE, 100, 255, 
242                       (gpointer)&change_cloud, NULL, NULL);
243   actor->time_start_animation = now + fast_rnd(20);
244   actor->duration_animation = 3*60;
245   scene->actors = g_slist_append(scene->actors, actor);
246   
247   actor = init_object(desktop_plugin, "cloud2", "cloud2.png", 
248                       0, fast_rnd(300)-75, 7, 188, 75, 
249                       FALSE, FALSE, 100, 255, 
250                       (gpointer)&change_cloud, NULL, NULL);
251   actor->time_start_animation = now + fast_rnd(40)+10;
252   actor->duration_animation = 3*60;
253   scene->actors = g_slist_append(scene->actors, actor);
254
255   actor = init_object(desktop_plugin, "cloud4", "cloud4.png", 
256                       0, fast_rnd(300)-75, 7, 150, 75, 
257                       FALSE, FALSE, 100, 255, 
258                       (gpointer)&change_cloud, NULL, NULL);
259   actor->time_start_animation = now + fast_rnd(60) + 20;
260   actor->duration_animation = 5*60;
261   scene->actors = g_slist_append(scene->actors, actor);
262
263
264   actor = init_object(desktop_plugin, "town", "town0.png", 
265                       0, 0, 8, 800, 480, 
266                       TRUE, TRUE, 100, 255, 
267                       (gpointer)&change_static_actor, NULL, NULL);
268   change_static_actor(actor, desktop_plugin);
269   scene->actors = g_slist_append(scene->actors, actor);
270
271   actor = init_object(desktop_plugin, "stend", "stend0.png", 
272                       452, 166, 9, 300, 305, 
273                       TRUE, TRUE, 100, 255, 
274                       (gpointer)&change_static_actor, NULL, NULL);
275   change_static_actor(actor, desktop_plugin);
276   scene->actors = g_slist_append(scene->actors, actor);
277
278
279   child = g_ptr_array_sized_new(4);
280   actor = init_object(desktop_plugin, "call", "call.png", 
281                       480, 190, 9, 50, 58, 
282                       FALSE, TRUE, 100, 255, 
283                       NULL, NULL, NULL);
284   scene->actors = g_slist_append(scene->actors, actor);
285   g_ptr_array_add(child, actor);
286
287   actor = init_object(desktop_plugin, "chat", "chat.png", 
288                       540, 190, 9, 50, 58, 
289                       FALSE, TRUE, 100, 255, 
290                       NULL, NULL, NULL);
291   scene->actors = g_slist_append(scene->actors, actor);
292   g_ptr_array_add(child, actor);
293
294   actor = init_object(desktop_plugin, "mail", "mail.png", 
295                       600, 190, 9, 50, 58, 
296                       FALSE, TRUE, 100, 255, 
297                       NULL, NULL, NULL);
298   scene->actors = g_slist_append(scene->actors, actor);
299   g_ptr_array_add(child, actor);
300   
301   actor = init_object(desktop_plugin, "sms", "sms.png", 
302                       660, 190, 9, 50, 58, 
303                       FALSE, TRUE, 100, 255, 
304                       NULL, NULL, NULL);
305   scene->actors = g_slist_append(scene->actors, actor);
306   g_ptr_array_add(child, actor);
307
308   actor = init_object(desktop_plugin, "billboard_text", "",
309                       470, 174, 9, 300, 108,
310                       FALSE, FALSE, 100, 255,
311                       (gpointer)&change_billboard, NULL, child);
312   create_hildon_actor_text(actor, desktop_plugin);
313   //actor->time_start_animation = time(NULL) + 20;
314   change_billboard(actor, desktop_plugin);
315   scene->actors = g_slist_append(scene->actors, actor);
316
317   actor = init_object(desktop_plugin, "tram", "tram.png", 
318                       -300, 225, 10, 350, 210, 
319                       FALSE, FALSE, 100, 255, 
320                       (gpointer)&change_tram, NULL, NULL);
321   actor->time_start_animation = time(NULL) + fast_rnd(10); 
322   actor->duration_animation = 60;
323   scene->actors = g_slist_append(scene->actors, actor);
324
325   actor = init_object(desktop_plugin, "border", "border0.png", 
326                       0, 480-79, 11, 800, 79,
327                       TRUE, TRUE, 100, 255, 
328                       (gpointer)&change_static_actor_with_corner, NULL, NULL);
329   change_static_actor_with_corner(actor, desktop_plugin);
330   scene->actors = g_slist_append(scene->actors, actor);
331   
332   actor = init_object(desktop_plugin, "moon", "moon1.png", 
333                       400, 20, 6, 60, 60, 
334                       FALSE, FALSE, 100, 255, 
335                       (gpointer)&change_moon, NULL, NULL);
336   change_moon(actor, desktop_plugin);
337   scene->actors = g_slist_append(scene->actors, actor);
338
339   actor = init_object(desktop_plugin, "wind", "", 
340                       0, 0, 5, 0, 0, 
341                       FALSE, FALSE, 100, 255, 
342                       (gpointer)&change_wind, NULL, NULL);
343   change_wind(actor, desktop_plugin);
344   scene->actors = g_slist_append(scene->actors, actor);
345
346     /* windows in 4-th house  */
347
348     winds[0][0] = 482;
349     winds[0][1] = 180;
350
351     winds[1][0] = 495;
352     winds[1][1] = 179;
353
354     winds[2][0] = 482;
355     winds[2][1] = 191;
356
357     winds[3][0] = 495;
358     winds[3][1] = 190;
359     
360     winds[4][0] = 482;
361     winds[4][1] = 201;
362     
363     winds[5][0] = 495;
364     winds[5][1] = 210;
365     
366     winds[6][0] = 482;
367     winds[6][1] = 222;
368     
369     winds[7][0] = 495;
370     winds[7][1] = 221;
371     
372     winds[8][0] = 459;
373     winds[8][1] = 203;
374     
375     winds[9][0] = 495;
376     winds[9][1] = 241;
377     
378     winds[10][0] = 495;
379     winds[10][1] = 252;
380     
381     winds[11][0] = 482;
382     winds[11][1] = 273;
383     
384     winds[12][0] = 495;
385     winds[12][1] = 303;
386     for (i=0; i<13; i++){
387         actor = init_object(desktop_plugin, "window1", "window1.png", 
388                             winds[i][0], winds[i][1], 8, 8, 10, 
389                             FALSE, FALSE, 100, 255, 
390                             (gpointer)&change_window1, NULL, NULL);
391         //change_window1(actor, desktop_plugin);
392         actor->time_start_animation = now + fast_rnd(30);
393         scene->actors = g_slist_append(scene->actors, actor);
394
395     }
396     
397     /* windows in 1-th house  */
398     
399     winds[0][0] = 86;
400     winds[0][1] = 321;
401
402     winds[1][0] = 86;
403     winds[1][1] = 363;
404
405     winds[2][0] = 86;
406     winds[2][1] = 385;
407
408     winds[3][0] = 86;
409     winds[3][1] = 286;
410     
411     winds[4][0] = 94;
412     winds[4][1] = 232;
413     
414     winds[5][0] = 94;
415     winds[5][1] = 243;
416     
417     winds[6][0] = 94;
418     winds[6][1] = 265;
419     
420     winds[7][0] = 94;
421     winds[7][1] = 331;
422     for (i=0; i<8; i++){
423         actor = init_object(desktop_plugin, "window2", "window2.png", 
424                             winds[i][0], winds[i][1], 8, 8, 10, 
425                             FALSE, FALSE, 100, 255, 
426                             (gpointer)&change_window1, NULL, NULL);
427         //change_window1(actor, desktop_plugin);
428         actor->time_start_animation = now + fast_rnd(30);
429         scene->actors = g_slist_append(scene->actors, actor);
430
431     }
432     
433     /* windows in 3-th house  */
434     
435     winds[0][0] = 251;
436     winds[0][1] = 162;
437
438     winds[1][0] = 251;
439     winds[1][1] = 196;
440
441     winds[2][0] = 251;
442     winds[2][1] = 278;
443
444     winds[3][0] = 251;
445     winds[3][1] = 289;
446     
447     winds[4][0] = 313;
448     winds[4][1] = 173;
449     
450     winds[5][0] = 322;
451     winds[5][1] = 160;
452     
453     winds[6][0] = 303;
454     winds[6][1] = 217;
455     
456     winds[7][0] = 322;
457     winds[7][1] = 224;
458     
459     winds[8][0] = 323;
460     winds[8][1] = 217;
461     
462     winds[9][0] = 322;
463     winds[9][1] = 288;
464     
465     for (i=0; i<10; i++){
466         actor = init_object(desktop_plugin, "window3", "window3.png", 
467                             winds[i][0], winds[i][1], 8, 8, 10, 
468                             FALSE, FALSE, 100, 255, 
469                             (gpointer)&change_window1, NULL, NULL);
470         //change_window1(actor, desktop_plugin);
471         actor->time_start_animation = now + fast_rnd(30);
472         scene->actors = g_slist_append(scene->actors, actor);
473
474     }
475
476     /* windows in 5-th house  */
477     
478     winds[0][0] = 610;
479     winds[0][1] = 224;
480
481     winds[1][0] = 602;
482     winds[1][1] = 245;
483
484     winds[2][0] = 602;
485     winds[2][1] = 264;
486
487     winds[3][0] = 610;
488     winds[3][1] = 301;
489     
490     winds[4][0] = 610;
491     winds[4][1] = 320;
492     
493     winds[5][0] = 593;
494     winds[5][1] = 352;
495     
496     winds[6][0] = 610;
497     winds[6][1] = 368;
498     
499     for (i=0; i<7; i++){
500         actor = init_object(desktop_plugin, "window4", "window4.png", 
501                             winds[i][0], winds[i][1], 8, 8, 10, 
502                             FALSE, FALSE, 100, 255, 
503                             (gpointer)&change_window1, NULL, NULL);
504         //change_window1(actor, desktop_plugin);
505         actor->time_start_animation = now + fast_rnd(30);
506         scene->actors = g_slist_append(scene->actors, actor);
507
508     }
509
510     /* windows in 6-th house  */
511     
512     winds[0][0] = 717;
513     winds[0][1] = 283;
514
515     winds[1][0] = 698;
516     winds[1][1] = 293;
517
518     winds[2][0] = 717;
519     winds[2][1] = 315;
520
521     winds[3][0] = 717;
522     winds[3][1] = 323;
523     
524     winds[4][0] = 698;
525     winds[4][1] = 362;
526     
527     winds[5][0] = 698;
528     winds[5][1] = 400;
529     
530     for (i=0; i<6; i++){
531         actor = init_object(desktop_plugin, "window5", "window5.png", 
532                             winds[i][0], winds[i][1], 8, 8, 10, 
533                             FALSE, FALSE, 100, 255, 
534                             (gpointer)&change_window1, NULL, NULL);
535         //change_window1(actor, desktop_plugin);
536         actor->time_start_animation = now + fast_rnd(30);
537         scene->actors = g_slist_append(scene->actors, actor);
538
539     }
540     run_long_timeout(desktop_plugin);
541
542 #if 0    
543   anim = g_new0(Animation, 1);
544   anim->count = 1;
545   anim->actor = actor;
546   anim->func_change = &change_tram;
547   anim->func_time = NULL;
548   anim->timestart = time(NULL); 
549   anim->timeall = 10;
550   
551   scene.dynamic_actors = g_slist_append(scene.dynamic_actors, anim);
552 #endif  
553 }
554
555 /* Init Berlin Scene */
556 void
557 init_scene_Berlin(AWallpaperPlugin *desktop_plugin)
558 {
559   Actor *actor, *actor1, *actor2;
560   Scene *scene;
561   gint now = time(NULL);
562   gint i; 
563   gint winds[13][2];
564   GPtrArray *child = NULL;
565
566   scene = g_new0(Scene, 1);
567   scene->daytime = get_daytime();
568   scene->actors = NULL;
569   scene->wind_orientation = -1;
570   scene->wind_angle = 0.3;
571   /* init value for random */
572   scene->seed = time(NULL);
573   desktop_plugin->priv->scene = scene;
574   
575   actor = init_object(desktop_plugin, "sky", "sky.png", 0, 0, 5, 800, 480, 
576                       TRUE, TRUE, 100, 255, 
577                       (gpointer)&change_static_actor, NULL, NULL);
578   change_static_actor(actor, desktop_plugin);
579   scene->actors = g_slist_append(scene->actors, actor);
580
581   
582   actor = init_object(desktop_plugin, "sun", "sun.png", 0, 0, 6, 88, 88, 
583                       FALSE, FALSE, 100, 255, 
584                       (gpointer)&change_sun, NULL, NULL);
585   actor->time_start_animation = time(NULL);
586   actor->duration_animation = G_MAXINT;
587   change_sun(actor, desktop_plugin);
588   scene->actors = g_slist_append(scene->actors, actor);
589
590 #if 0
591   actor = init_object(desktop_plugin, "dot", "dot1.png", 0, 0, 11, 50, 50, 
592                       TRUE, 100, 255, NULL, NULL);
593   scene.actors = g_slist_append(scene.actors, actor);
594 #endif
595
596   actor = init_object(desktop_plugin, "moon", "moon1.png", 400, 15, 6, 60, 60, 
597                       FALSE, FALSE, 100, 255, 
598                       (gpointer)&change_moon, NULL, NULL);
599   change_moon(actor, desktop_plugin);
600   scene->actors = g_slist_append(scene->actors, actor);
601   
602   actor = init_object(desktop_plugin, "cloud1", "cloud1.png", 0, fast_rnd(300)-97, 7, 150, 97, 
603                       FALSE, FALSE, 100, 255, 
604                       (gpointer)&change_cloud, NULL, NULL);
605   actor->time_start_animation = now + fast_rnd(30) + 10;
606   actor->duration_animation = 3*60;
607   scene->actors = g_slist_append(scene->actors, actor);
608   
609   actor = init_object(desktop_plugin, "cloud2", "cloud2.png", 0, fast_rnd(300)-75, 7, 188, 75, 
610                       FALSE, FALSE, 100, 255, 
611                       (gpointer)&change_cloud, NULL, NULL);
612   actor->time_start_animation = now + fast_rnd(10);
613   actor->duration_animation = 3*60;
614   scene->actors = g_slist_append(scene->actors, actor);
615
616   actor = init_object(desktop_plugin, "cloud4", "cloud4.png", 0, fast_rnd(300)-75, 7, 150, 75, 
617                       FALSE, FALSE, 100, 255, 
618                       (gpointer)&change_cloud, NULL, NULL);
619   actor->time_start_animation = now + fast_rnd(60) + 20;
620   actor->duration_animation = 5*60;
621   scene->actors = g_slist_append(scene->actors, actor);
622
623  
624   actor = init_object(desktop_plugin, "plane2", "plane3.png", 0, 45, 8, 160, 50, 
625                       FALSE, FALSE, 100, 255, 
626                       (gpointer)&change_plane2, NULL, NULL);
627   actor->time_start_animation = now + fast_rnd(40) + 20;
628   actor->duration_animation = 60;
629   scene->actors = g_slist_append(scene->actors, actor);
630   
631   actor = init_object(desktop_plugin, "plane1", "tu154.png", 620, 233, 9, 300, 116, 
632                       FALSE, FALSE, 100, 255, 
633                       (gpointer)&change_plane1, NULL, NULL);
634   actor->time_start_animation = now + fast_rnd(20);
635   actor->duration_animation = 30;
636   scene->actors = g_slist_append(scene->actors, actor);
637
638   actor = init_object(desktop_plugin, "town", "town.png", 0, 0, 10, 800, 480, 
639                       TRUE, TRUE, 100, 255, 
640                       (gpointer)&change_static_actor_with_corner, NULL, NULL);
641   change_static_actor_with_corner(actor, desktop_plugin);
642   scene->actors = g_slist_append(scene->actors, actor);
643
644   actor = init_object(desktop_plugin, "wind", "", 0, 0, 5, 0, 0, 
645                       FALSE, FALSE, 100, 255, 
646                       (gpointer)&change_wind, NULL, NULL);
647   change_wind(actor, desktop_plugin);
648   scene->actors = g_slist_append(scene->actors, actor);
649
650   actor1 = init_object(desktop_plugin, "signal_red", "red.png", 
651                       486, 425, 10, 18, 38, 
652                       FALSE, TRUE, 100, 255, NULL, NULL, NULL);
653   //actor->time_start_animation = now + fast_rnd(30) + 10;  
654   scene->actors = g_slist_append(scene->actors, actor1);
655    
656   actor2 = init_object(desktop_plugin, "signal_green", "green.png", 
657                       486, 425, 10, 18, 38, 
658                       TRUE, TRUE, 100, 255, NULL, NULL, NULL);
659   //actor->time_start_animation = now + fast_rnd(30) + 10;  
660   scene->actors = g_slist_append(scene->actors, actor2);
661   child = g_ptr_array_sized_new(2);
662   g_ptr_array_add(child, actor1);
663   g_ptr_array_add(child, actor2);
664   actor = init_object(desktop_plugin, "signal", "",
665                       486, 425, 10, 18, 38,
666                       FALSE, FALSE, 100, 255, 
667                       (gpointer)&change_signal, NULL, child);
668   actor->time_start_animation = now + fast_rnd(30) + 10;
669   scene->actors = g_slist_append(scene->actors, actor);
670     
671     winds[0][0] = 389;
672     winds[0][1] = 305;
673
674     winds[1][0] = 373;
675     winds[1][1] = 306;
676
677     winds[2][0] = 355;
678     winds[2][1] = 306;
679
680     winds[3][0] = 356;
681     winds[3][1] = 288;
682     
683     winds[4][0] = 337;
684     winds[4][1] = 269;
685     
686     winds[5][0] = 372;
687     winds[5][1] = 268;
688   
689     winds[6][0] = 372;
690     winds[6][1] = 249;
691     
692     winds[7][0] = 388;
693     winds[7][1] = 249;
694     
695     winds[8][0] = 387;
696     winds[8][1] = 230;
697     
698     winds[9][0] = 372;
699     winds[9][1] = 211;
700     
701     winds[10][0] = 355;
702     winds[10][1] = 159;
703     
704     winds[11][0] = 335;
705     winds[11][1] = 158;
706     
707     winds[12][0] = 386;
708     winds[12][1] = 119;
709   
710     for (i=0; i<13; i++){
711         actor = init_object(desktop_plugin, "window", "window.png", 
712                             winds[i][0], winds[i][1], 10, 8, 9, 
713                             FALSE, TRUE, 100, 255, 
714                             (gpointer)&change_window1, NULL, NULL);
715         //change_window1(actor, desktop_plugin);
716         actor->time_start_animation = now + fast_rnd(30);
717         scene->actors = g_slist_append(scene->actors, actor);
718
719     }
720     
721     run_long_timeout(desktop_plugin);
722
723 }
724
725 void 
726 init_scene_theme(AWallpaperPlugin *desktop_plugin)
727 {
728     void (*func)(gpointer);
729     func = g_hash_table_lookup(desktop_plugin->priv->hash_scene_func, desktop_plugin->priv->theme);
730     if (func){
731         (*func)(desktop_plugin);
732     }
733 }