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