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