Merge branch 'master' of https://vcs.maemo.org/git/livewp
[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 #if 0
52     if (!strcmp(desktop_plugin->priv->theme,"Modern"))
53         init_scene_Modern(desktop_plugin);
54     else if (!strcmp(desktop_plugin->priv->theme,"Berlin")) 
55         init_scene_Berlin(desktop_plugin);
56     else if (!strcmp(desktop_plugin->priv->theme,"Matrix")) 
57         init_scene_Matrix(desktop_plugin);
58 #endif
59     init_scene_theme(desktop_plugin);
60 }
61
62 void
63 init_scene_Matrix(AWallpaperPlugin *desktop_plugin)
64 {
65   Actor *actor;
66   Scene *scene;
67   GPtrArray *child;
68   gint now = time(NULL);
69   gint y1, y2;
70
71   if (desktop_plugin->priv->rich_animation){
72       y1 = -480;
73       y2 = -480-480;
74   }else {
75       y1 = 0;
76       y2 = -480;
77   }
78
79   fprintf(stderr, "init scene2 \n");
80   scene = g_new0(Scene, 1);
81   //scene.daytime = get_daytime();
82   scene->actors = NULL;
83   desktop_plugin->priv->scene = scene;
84   
85   actor = init_object(desktop_plugin, "background", "bg.png", 
86                       0, 0, 5, 800, 480, 
87                       TRUE, TRUE, 100, 255, 
88                       NULL, NULL, NULL);
89   scene->actors = g_slist_append(scene->actors, actor);
90
91   actor = init_object(desktop_plugin, "symbols", "symbols.png", 
92                       0, 0, 10, 800, 480, 
93                       TRUE, TRUE, 100, 255, 
94                       NULL, NULL, NULL);
95   scene->actors = g_slist_append(scene->actors, actor);
96
97   child = g_ptr_array_sized_new(4);
98   actor = init_object(desktop_plugin, "layer1", "layer1_2.png", 
99                       0, y1, 6, 800, 960, 
100                       TRUE, TRUE, 100, 255, 
101                       NULL, NULL, NULL);
102   //actor->time_start_animation = now;
103   //actor->duration_animation = G_MAXINT;
104   scene->actors = g_slist_append(scene->actors, actor);
105   g_ptr_array_add(child, actor);
106
107   actor = init_object(desktop_plugin, "layer1", "layer1_1.png", 
108                       0, y2, 7, 800, 960, 
109                       TRUE, TRUE, 100, 255, 
110                       NULL, NULL, NULL);
111   //actor->time_start_animation = now;
112   //actor->duration_animation = G_MAXINT;
113   scene->actors = g_slist_append(scene->actors, actor);
114   g_ptr_array_add(child, actor);
115
116   actor = init_object(desktop_plugin, "layer2", "layer2_2.png", 
117                       0, y1, 8, 800, 960, 
118                       TRUE, TRUE, 100, 255, 
119                       NULL, NULL, NULL);
120   //actor->time_start_animation = now;
121   //actor->duration_animation = G_MAXINT;
122   scene->actors = g_slist_append(scene->actors, actor);
123   g_ptr_array_add(child, actor);
124
125   actor = init_object(desktop_plugin, "layer2", "layer2_1.png", 
126                       0, y2, 9, 800, 960, 
127                       TRUE, TRUE, 100, 255, 
128                       NULL, NULL, NULL);
129   //actor->time_start_animation = now;
130   //actor->duration_animation = G_MAXINT;
131   scene->actors = g_slist_append(scene->actors, actor);
132   g_ptr_array_add(child, actor);
133
134   actor = init_object(desktop_plugin, "layers", "", 
135                       0, y2, 9, 800, 960, 
136                       FALSE, FALSE, 100, 255, 
137                       (gpointer)&change_layer, NULL, child);
138   actor->time_start_animation = now;
139   actor->duration_animation = G_MAXINT;
140   scene->actors = g_slist_append(scene->actors, actor);
141
142   run_long_timeout(desktop_plugin);
143
144 }
145
146 /* Init Modern Scene */
147 void
148 init_scene_Modern(AWallpaperPlugin *desktop_plugin)
149 {
150   Actor *actor;
151   Scene *scene;
152   gint now = time(NULL);
153   gint i;
154   gint winds[13][2];
155
156   //fprintf(stderr, "init scene \n");
157   scene = g_new0(Scene, 1);
158   scene->daytime = get_daytime();
159   scene->actors = NULL;
160   scene->wind_orientation = -1;
161   scene->wind_angle = 0.3;
162   /* init value for random */
163   scene->seed = time(NULL);
164   desktop_plugin->priv->scene = scene;
165   actor = init_object(desktop_plugin, "sky", "sky0.png", 
166                       0, 0, 5, 800, 480, 
167                       TRUE , TRUE, 100, 255, 
168                       (gpointer)&change_static_actor, NULL, NULL);
169   scene->actors = g_slist_append(scene->actors, actor);
170   change_static_actor(actor, desktop_plugin);
171   
172   actor = init_object(desktop_plugin, "sun", "sun.png", 
173                       0, 0, 6, 88, 88, 
174                       FALSE, FALSE, 100, 255, 
175                       (gpointer)&change_sun, NULL, NULL);
176   actor->time_start_animation = now;
177   actor->duration_animation = G_MAXINT;
178   change_sun(actor, desktop_plugin);
179   scene->actors = g_slist_append(scene->actors, actor);
180
181   //actor = init_object(desktop_plugin, "dot", "dot1.png", 0, 0, 11, 50, 50, 
182     //                  TRUE, 100, 255, NULL, NULL);
183   //scene.actors = g_slist_append(scene.actors, actor);
184   
185   actor = init_object(desktop_plugin, "cloud1", "cloud1.png", 
186                       0, fast_rnd(300)-97, 7, 150, 97, 
187                       FALSE, FALSE, 100, 255, 
188                       (gpointer)&change_cloud, NULL, NULL);
189   actor->time_start_animation = now + fast_rnd(20);
190   actor->duration_animation = 3*60;
191   scene->actors = g_slist_append(scene->actors, actor);
192   
193   actor = init_object(desktop_plugin, "cloud2", "cloud2.png", 
194                       0, fast_rnd(300)-75, 7, 188, 75, 
195                       FALSE, FALSE, 100, 255, 
196                       (gpointer)&change_cloud, NULL, NULL);
197   actor->time_start_animation = now + fast_rnd(40)+10;
198   actor->duration_animation = 3*60;
199   scene->actors = g_slist_append(scene->actors, actor);
200
201   actor = init_object(desktop_plugin, "cloud4", "cloud4.png", 
202                       0, fast_rnd(300)-75, 7, 150, 75, 
203                       FALSE, FALSE, 100, 255, 
204                       (gpointer)&change_cloud, NULL, NULL);
205   actor->time_start_animation = now + fast_rnd(60) + 20;
206   actor->duration_animation = 5*60;
207   scene->actors = g_slist_append(scene->actors, actor);
208
209
210   actor = init_object(desktop_plugin, "town", "town0.png", 
211                       0, 0, 8, 800, 480, 
212                       TRUE, TRUE, 100, 255, 
213                       (gpointer)&change_static_actor, NULL, NULL);
214   change_static_actor(actor, desktop_plugin);
215   scene->actors = g_slist_append(scene->actors, actor);
216
217   actor = init_object(desktop_plugin, "stend", "stend0.png", 
218                       482, 146, 9, 300, 305, 
219                       TRUE, TRUE, 100, 255, 
220                       (gpointer)&change_static_actor, NULL, NULL);
221   change_static_actor(actor, desktop_plugin);
222   scene->actors = g_slist_append(scene->actors, actor);
223
224   actor = init_object(desktop_plugin, "tram", "tram.png", 
225                       -300, 225, 10, 350, 210, 
226                       FALSE, FALSE, 100, 255, 
227                       (gpointer)&change_tram, NULL, NULL);
228   actor->time_start_animation = time(NULL) + fast_rnd(10); 
229   actor->duration_animation = 60;
230   scene->actors = g_slist_append(scene->actors, actor);
231
232   actor = init_object(desktop_plugin, "border", "border0.png", 
233                       0, 480-79, 11, 800, 79,
234                       TRUE, TRUE, 100, 255, 
235                       (gpointer)&change_static_actor_with_corner, NULL, NULL);
236   change_static_actor_with_corner(actor, desktop_plugin);
237   scene->actors = g_slist_append(scene->actors, actor);
238   
239   actor = init_object(desktop_plugin, "moon", "moon1.png", 
240                       400, 20, 6, 60, 60, 
241                       FALSE, FALSE, 100, 255, 
242                       (gpointer)&change_moon, NULL, NULL);
243   change_moon(actor, desktop_plugin);
244   scene->actors = g_slist_append(scene->actors, actor);
245
246   actor = init_object(desktop_plugin, "wind", "", 
247                       0, 0, 5, 0, 0, 
248                       FALSE, FALSE, 100, 255, 
249                       (gpointer)&change_wind, NULL, NULL);
250   change_wind(actor, desktop_plugin);
251   scene->actors = g_slist_append(scene->actors, actor);
252
253     /* windows in 4-th house  */
254
255     winds[0][0] = 482;
256     winds[0][1] = 180;
257
258     winds[1][0] = 495;
259     winds[1][1] = 179;
260
261     winds[2][0] = 482;
262     winds[2][1] = 191;
263
264     winds[3][0] = 495;
265     winds[3][1] = 190;
266     
267     winds[4][0] = 482;
268     winds[4][1] = 201;
269     
270     winds[5][0] = 495;
271     winds[5][1] = 210;
272     
273     winds[6][0] = 482;
274     winds[6][1] = 222;
275     
276     winds[7][0] = 495;
277     winds[7][1] = 221;
278     
279     winds[8][0] = 459;
280     winds[8][1] = 203;
281     
282     winds[9][0] = 495;
283     winds[9][1] = 241;
284     
285     winds[10][0] = 495;
286     winds[10][1] = 252;
287     
288     winds[11][0] = 482;
289     winds[11][1] = 273;
290     
291     winds[12][0] = 495;
292     winds[12][1] = 303;
293     for (i=0; i<13; i++){
294         actor = init_object(desktop_plugin, "window1", "window1.png", 
295                             winds[i][0], winds[i][1], 8, 8, 10, 
296                             FALSE, FALSE, 100, 255, 
297                             (gpointer)&change_window1, NULL, NULL);
298         //change_window1(actor, desktop_plugin);
299         actor->time_start_animation = now + fast_rnd(30);
300         scene->actors = g_slist_append(scene->actors, actor);
301
302     }
303     
304     /* windows in 1-th house  */
305     
306     winds[0][0] = 86;
307     winds[0][1] = 321;
308
309     winds[1][0] = 86;
310     winds[1][1] = 363;
311
312     winds[2][0] = 86;
313     winds[2][1] = 385;
314
315     winds[3][0] = 86;
316     winds[3][1] = 286;
317     
318     winds[4][0] = 94;
319     winds[4][1] = 232;
320     
321     winds[5][0] = 94;
322     winds[5][1] = 243;
323     
324     winds[6][0] = 94;
325     winds[6][1] = 265;
326     
327     winds[7][0] = 94;
328     winds[7][1] = 331;
329     for (i=0; i<8; i++){
330         actor = init_object(desktop_plugin, "window2", "window2.png", 
331                             winds[i][0], winds[i][1], 8, 8, 10, 
332                             FALSE, FALSE, 100, 255, 
333                             (gpointer)&change_window1, NULL, NULL);
334         //change_window1(actor, desktop_plugin);
335         actor->time_start_animation = now + fast_rnd(30);
336         scene->actors = g_slist_append(scene->actors, actor);
337
338     }
339     
340     /* windows in 3-th house  */
341     
342     winds[0][0] = 251;
343     winds[0][1] = 162;
344
345     winds[1][0] = 251;
346     winds[1][1] = 196;
347
348     winds[2][0] = 251;
349     winds[2][1] = 278;
350
351     winds[3][0] = 251;
352     winds[3][1] = 289;
353     
354     winds[4][0] = 313;
355     winds[4][1] = 173;
356     
357     winds[5][0] = 322;
358     winds[5][1] = 160;
359     
360     winds[6][0] = 303;
361     winds[6][1] = 217;
362     
363     winds[7][0] = 322;
364     winds[7][1] = 224;
365     
366     winds[8][0] = 323;
367     winds[8][1] = 217;
368     
369     winds[9][0] = 322;
370     winds[9][1] = 288;
371     
372     for (i=0; i<10; i++){
373         actor = init_object(desktop_plugin, "window3", "window3.png", 
374                             winds[i][0], winds[i][1], 8, 8, 10, 
375                             FALSE, FALSE, 100, 255, 
376                             (gpointer)&change_window1, NULL, NULL);
377         //change_window1(actor, desktop_plugin);
378         actor->time_start_animation = now + fast_rnd(30);
379         scene->actors = g_slist_append(scene->actors, actor);
380
381     }
382
383     /* windows in 5-th house  */
384     
385     winds[0][0] = 610;
386     winds[0][1] = 224;
387
388     winds[1][0] = 602;
389     winds[1][1] = 245;
390
391     winds[2][0] = 602;
392     winds[2][1] = 264;
393
394     winds[3][0] = 610;
395     winds[3][1] = 301;
396     
397     winds[4][0] = 610;
398     winds[4][1] = 320;
399     
400     winds[5][0] = 593;
401     winds[5][1] = 352;
402     
403     winds[6][0] = 610;
404     winds[6][1] = 368;
405     
406     for (i=0; i<7; i++){
407         actor = init_object(desktop_plugin, "window4", "window4.png", 
408                             winds[i][0], winds[i][1], 8, 8, 10, 
409                             FALSE, FALSE, 100, 255, 
410                             (gpointer)&change_window1, NULL, NULL);
411         //change_window1(actor, desktop_plugin);
412         actor->time_start_animation = now + fast_rnd(30);
413         scene->actors = g_slist_append(scene->actors, actor);
414
415     }
416
417     /* windows in 6-th house  */
418     
419     winds[0][0] = 717;
420     winds[0][1] = 283;
421
422     winds[1][0] = 698;
423     winds[1][1] = 293;
424
425     winds[2][0] = 717;
426     winds[2][1] = 315;
427
428     winds[3][0] = 717;
429     winds[3][1] = 323;
430     
431     winds[4][0] = 698;
432     winds[4][1] = 362;
433     
434     winds[5][0] = 698;
435     winds[5][1] = 400;
436     
437     for (i=0; i<6; i++){
438         actor = init_object(desktop_plugin, "window5", "window5.png", 
439                             winds[i][0], winds[i][1], 8, 8, 10, 
440                             FALSE, FALSE, 100, 255, 
441                             (gpointer)&change_window1, NULL, NULL);
442         //change_window1(actor, desktop_plugin);
443         actor->time_start_animation = now + fast_rnd(30);
444         scene->actors = g_slist_append(scene->actors, actor);
445
446     }
447     run_long_timeout(desktop_plugin);
448
449 #if 0    
450   anim = g_new0(Animation, 1);
451   anim->count = 1;
452   anim->actor = actor;
453   anim->func_change = &change_tram;
454   anim->func_time = NULL;
455   anim->timestart = time(NULL); 
456   anim->timeall = 10;
457   
458   scene.dynamic_actors = g_slist_append(scene.dynamic_actors, anim);
459 #endif  
460 }
461
462 /* Init Berlin Scene */
463 void
464 init_scene_Berlin(AWallpaperPlugin *desktop_plugin)
465 {
466   Actor *actor, *actor1, *actor2;
467   Scene *scene;
468   gint now = time(NULL);
469   gint i; 
470   gint winds[13][2];
471   GPtrArray *child = NULL;
472
473   scene = g_new0(Scene, 1);
474   scene->daytime = get_daytime();
475   scene->actors = NULL;
476   scene->wind_orientation = -1;
477   scene->wind_angle = 0.3;
478   /* init value for random */
479   scene->seed = time(NULL);
480   desktop_plugin->priv->scene = scene;
481   
482   actor = init_object(desktop_plugin, "sky", "sky.png", 0, 0, 5, 800, 480, 
483                       TRUE, TRUE, 100, 255, 
484                       (gpointer)&change_static_actor, NULL, NULL);
485   change_static_actor(actor, desktop_plugin);
486   scene->actors = g_slist_append(scene->actors, actor);
487
488   
489   actor = init_object(desktop_plugin, "sun", "sun.png", 0, 0, 6, 88, 88, 
490                       FALSE, FALSE, 100, 255, 
491                       (gpointer)&change_sun, NULL, NULL);
492   actor->time_start_animation = time(NULL);
493   actor->duration_animation = G_MAXINT;
494   change_sun(actor, desktop_plugin);
495   scene->actors = g_slist_append(scene->actors, actor);
496
497 #if 0
498   actor = init_object(desktop_plugin, "dot", "dot1.png", 0, 0, 11, 50, 50, 
499                       TRUE, 100, 255, NULL, NULL);
500   scene.actors = g_slist_append(scene.actors, actor);
501 #endif
502
503   actor = init_object(desktop_plugin, "moon", "moon1.png", 400, 15, 6, 60, 60, 
504                       FALSE, FALSE, 100, 255, 
505                       (gpointer)&change_moon, NULL, NULL);
506   change_moon(actor, desktop_plugin);
507   scene->actors = g_slist_append(scene->actors, actor);
508   
509   actor = init_object(desktop_plugin, "cloud1", "cloud1.png", 0, fast_rnd(300)-97, 7, 150, 97, 
510                       FALSE, FALSE, 100, 255, 
511                       (gpointer)&change_cloud, NULL, NULL);
512   actor->time_start_animation = now + fast_rnd(30) + 10;
513   actor->duration_animation = 3*60;
514   scene->actors = g_slist_append(scene->actors, actor);
515   
516   actor = init_object(desktop_plugin, "cloud2", "cloud2.png", 0, fast_rnd(300)-75, 7, 188, 75, 
517                       FALSE, FALSE, 100, 255, 
518                       (gpointer)&change_cloud, NULL, NULL);
519   actor->time_start_animation = now + fast_rnd(10);
520   actor->duration_animation = 3*60;
521   scene->actors = g_slist_append(scene->actors, actor);
522
523   actor = init_object(desktop_plugin, "cloud4", "cloud4.png", 0, fast_rnd(300)-75, 7, 150, 75, 
524                       FALSE, FALSE, 100, 255, 
525                       (gpointer)&change_cloud, NULL, NULL);
526   actor->time_start_animation = now + fast_rnd(60) + 20;
527   actor->duration_animation = 5*60;
528   scene->actors = g_slist_append(scene->actors, actor);
529
530  
531   actor = init_object(desktop_plugin, "plane2", "plane3.png", 0, 45, 8, 160, 50, 
532                       FALSE, FALSE, 100, 255, 
533                       (gpointer)&change_plane2, NULL, NULL);
534   actor->time_start_animation = now + fast_rnd(40) + 20;
535   actor->duration_animation = 60;
536   scene->actors = g_slist_append(scene->actors, actor);
537   
538   actor = init_object(desktop_plugin, "plane1", "tu154.png", 620, 233, 9, 300, 116, 
539                       FALSE, FALSE, 100, 255, 
540                       (gpointer)&change_plane1, NULL, NULL);
541   actor->time_start_animation = now + fast_rnd(20);
542   actor->duration_animation = 30;
543   scene->actors = g_slist_append(scene->actors, actor);
544
545   actor = init_object(desktop_plugin, "town", "town.png", 0, 0, 10, 800, 480, 
546                       TRUE, TRUE, 100, 255, 
547                       (gpointer)&change_static_actor_with_corner, NULL, NULL);
548   change_static_actor_with_corner(actor, desktop_plugin);
549   scene->actors = g_slist_append(scene->actors, actor);
550
551   actor = init_object(desktop_plugin, "wind", "", 0, 0, 5, 0, 0, 
552                       FALSE, FALSE, 100, 255, 
553                       (gpointer)&change_wind, NULL, NULL);
554   change_wind(actor, desktop_plugin);
555   scene->actors = g_slist_append(scene->actors, actor);
556
557   actor1 = init_object(desktop_plugin, "signal_red", "red.png", 
558                       486, 425, 10, 18, 38, 
559                       FALSE, TRUE, 100, 255, NULL, NULL, NULL);
560   //actor->time_start_animation = now + fast_rnd(30) + 10;  
561   scene->actors = g_slist_append(scene->actors, actor1);
562    
563   actor2 = init_object(desktop_plugin, "signal_green", "green.png", 
564                       486, 425, 10, 18, 38, 
565                       TRUE, TRUE, 100, 255, NULL, NULL, NULL);
566   //actor->time_start_animation = now + fast_rnd(30) + 10;  
567   scene->actors = g_slist_append(scene->actors, actor2);
568   child = g_ptr_array_sized_new(2);
569   g_ptr_array_add(child, actor1);
570   g_ptr_array_add(child, actor2);
571   actor = init_object(desktop_plugin, "signal", "",
572                       486, 425, 10, 18, 38,
573                       FALSE, FALSE, 100, 255, 
574                       (gpointer)&change_signal, NULL, child);
575   actor->time_start_animation = now + fast_rnd(30) + 10;
576   scene->actors = g_slist_append(scene->actors, actor);
577     
578     winds[0][0] = 389;
579     winds[0][1] = 305;
580
581     winds[1][0] = 373;
582     winds[1][1] = 306;
583
584     winds[2][0] = 355;
585     winds[2][1] = 306;
586
587     winds[3][0] = 356;
588     winds[3][1] = 288;
589     
590     winds[4][0] = 337;
591     winds[4][1] = 269;
592     
593     winds[5][0] = 372;
594     winds[5][1] = 268;
595   
596     winds[6][0] = 372;
597     winds[6][1] = 249;
598     
599     winds[7][0] = 388;
600     winds[7][1] = 249;
601     
602     winds[8][0] = 387;
603     winds[8][1] = 230;
604     
605     winds[9][0] = 372;
606     winds[9][1] = 211;
607     
608     winds[10][0] = 355;
609     winds[10][1] = 159;
610     
611     winds[11][0] = 335;
612     winds[11][1] = 158;
613     
614     winds[12][0] = 386;
615     winds[12][1] = 119;
616   
617     for (i=0; i<13; i++){
618         actor = init_object(desktop_plugin, "window", "window.png", 
619                             winds[i][0], winds[i][1], 10, 8, 9, 
620                             FALSE, TRUE, 100, 255, 
621                             (gpointer)&change_window1, NULL, NULL);
622         //change_window1(actor, desktop_plugin);
623         actor->time_start_animation = now + fast_rnd(30);
624         scene->actors = g_slist_append(scene->actors, actor);
625
626     }
627     
628     run_long_timeout(desktop_plugin);
629
630 }
631
632 void 
633 init_scene_theme(AWallpaperPlugin *desktop_plugin)
634 {
635     void (*func)(gpointer);
636     func = g_hash_table_lookup(desktop_plugin->priv->hash_scene_func, desktop_plugin->priv->theme);
637     if (func){
638         (*func)(desktop_plugin);
639     }
640 }