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