adde images for notifications
[livewp] / applet / src / livewp-actor.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-actor.h"
26
27 Actor* 
28 init_object(AWallpaperPlugin *desktop_plugin, 
29             gchar * name, 
30             gchar * filename, 
31             gint x, 
32             gint y, 
33             gint z, 
34             gint width, 
35             gint height, 
36             gboolean visible, 
37             gboolean load_image,
38             gint scale, 
39             gint opacity, 
40             void (*pfunc_change)(Actor*),
41             void (*pfunc_probability)(Actor*),
42             GPtrArray *child
43            )
44 {
45     Actor *actor = NULL;
46     actor = g_new0(Actor, 1);
47     actor->x = x;
48     actor->y = y;
49     actor->z = z;
50     actor->width = width;
51     actor->height = height;
52     actor->visible = visible;
53     actor->scale = scale;
54     actor->opacity = opacity;
55     actor->filename = g_strdup(filename);
56     actor->name = g_strdup(name);
57     actor->func_change = (gpointer)pfunc_change; 
58     actor->func_probability = (gpointer)pfunc_probability;
59     actor->child = child;
60     if (load_image)
61         create_hildon_actor(actor, desktop_plugin);
62     else 
63          actor->widget = NULL;
64     actor->time_start_animation = 0;
65     actor->duration_animation = 0;
66     return actor;
67 }
68
69 void 
70 destroy_actor(Actor *actor)
71 {
72     if (actor){
73         if (actor->child){
74             g_ptr_array_free(actor->child, TRUE);
75         }
76         if (actor->filename)
77             g_free(actor->filename);
78         if (actor->name)
79             g_free(actor->name);
80         gtk_widget_destroy(actor->widget);
81         //actor->widget = NULL;
82         g_free(actor);
83     }
84 }
85 static gint 
86 path_line(gint x0, gint x1, double t)
87 {
88     // уравниение прямой
89     return ((x1 - x0) * t + x0);
90 }
91 void
92 set_actor_scale(Actor *actor, double scalex, double scaley)
93 {
94     hildon_animation_actor_set_scale(
95             HILDON_ANIMATION_ACTOR(actor->widget), 
96             scalex, 
97             scaley
98     );
99
100 }
101
102 void 
103 set_actor_visible(Actor *actor, gboolean visible)
104 {
105     hildon_animation_actor_set_show(HILDON_ANIMATION_ACTOR(actor->widget), visible);
106 }
107
108 void
109 set_actor_position(Actor *actor, gint x, gint y, gint z, AWallpaperPlugin *desktop_plugin)
110 {
111     hildon_animation_actor_set_position_full(HILDON_ANIMATION_ACTOR (actor->widget), 
112                                              x-desktop_plugin->priv->xapplet, 
113                                              y-desktop_plugin->priv->yapplet, 
114                                              z);
115 }
116
117 int get_notify_count(gchar *notify_type)
118 {
119     sqlite3 *db = NULL;
120     sqlite3 *res = NULL;
121     gint rc = 0, result = 0;
122     gchar sql[1024];
123
124     rc = sqlite3_open("/home/user/.config/hildon-desktop/notifications.db", &db);
125     if (rc){
126         fprintf(stderr, "error open db %d %s\n", rc, sqlite3_errmsg(db));
127     }else {
128         snprintf(sql, sizeof(sql)-1, "select count(id) from notifications where icon_name='%s'", notify_type);
129         rc = sqlite3_prepare(db, sql, sizeof(sql)-1, &res, NULL);
130         if (rc != SQLITE_OK){
131             fprintf(stderr, "error prepare %d %s\n", rc, sql);
132         }
133         if (sqlite3_step(res) != SQLITE_ROW){
134             fprintf(stderr, "not sqlite_row\n");
135         }
136         result = sqlite3_column_int(res, 0);
137         //fprintf(stderr, "count missing calls = %d\n", call_count);
138         sqlite3_finalize(res);
139
140         sqlite3_close(db);
141     }
142     return result;
143 }
144 gchar * read_notification()
145 {
146     gchar *message = "";
147     gint count = 0;
148     
149     fprintf(stderr, "read notification \n");
150     count = get_notify_count("general_missed");
151     if (count > 0){
152         message = g_strdup_printf("%s: %d", _("Missed calls"), count);
153     }
154     count = get_notify_count("general_sms");
155     if (count > 0){
156         if (message){
157             message = g_strdup_printf("%s \n%s: %d", message, _("Missed sms"), count);
158         }else {
159             message = g_strdup_printf("%s: %d", _("Missed sms"), count);
160         }
161     }
162     count = get_notify_count("general_chat");
163     if (count > 0){
164         if (message){
165             message = g_strdup_printf("%s \n%s: %d", message, _("Missed chat"), count);
166         }else {
167             message = g_strdup_printf("%s: %d", _("Missed chat"), count);
168         }
169     }
170     count = get_notify_count("qgn_list_messagin");
171     if (count > 0){
172         if (message){
173             message = g_strdup_printf("%s \n%s: %d", message, _("Missed mail"), count);
174         }else {
175             message = g_strdup_printf("%s: %d", _("Missed mail"), count);
176         }
177     }
178     fprintf(stderr, "notify=%s\n", message);
179     return message;
180 }
181
182 void 
183 change_billboard(Actor * actor, AWallpaperPlugin *desktop_plugin)
184 {
185     GtkWidget *label;
186     gchar *mes = NULL, *message = NULL;
187     PangoFontDescription *pfd = NULL;
188     gint count = 0;
189     Actor *a = NULL;
190      
191     fprintf(stderr, "change_billboard\n");   
192     
193     if (desktop_plugin->priv->scene->notification < time(NULL)){
194         count = get_notify_count("general_missed");
195         a = g_ptr_array_index(actor->child, 0);
196         if (count > 0){
197             set_actor_visible(a, TRUE);            
198         }else {
199             set_actor_visible(a, FALSE);
200         }
201         count = get_notify_count("general_sms");
202         a = g_ptr_array_index(actor->child, 3);
203         if (count > 0){
204             set_actor_visible(a, TRUE);            
205         }else {
206             set_actor_visible(a, FALSE);
207         }
208         count = get_notify_count("general_chat");
209         a = g_ptr_array_index(actor->child, 1);
210         if (count > 0){
211             set_actor_visible(a, TRUE);            
212         }else {
213             set_actor_visible(a, FALSE);
214         }
215         count = get_notify_count("qgn_list_messagin");
216         a = g_ptr_array_index(actor->child, 2);
217         if (count > 0){
218             set_actor_visible(a, TRUE);            
219         }else {
220             set_actor_visible(a, FALSE);
221         }
222
223         #if 0
224         message = read_notification();
225         label = actor->image;
226         mes = g_markup_printf_escaped("<span bgcolor=\"%s\" foreground=\"%s\">%s</span>", "#FFFFFF", "#000000", message);
227         gtk_label_set_markup(GTK_LABEL(label), mes);
228         pfd = pango_font_description_from_string("Sans 16");
229         gtk_widget_modify_font(GTK_WIDGET(label), NULL);
230         gtk_widget_modify_font(GTK_WIDGET(label), pfd);
231         pango_font_description_free(pfd);
232 #endif
233         desktop_plugin->priv->scene->notification = FALSE;
234     }
235     actor->time_start_animation = time(NULL) + 20;    
236 }
237
238
239 void 
240 change_billboard1(Actor * actor, AWallpaperPlugin *desktop_plugin)
241 {
242     GtkWidget *label;
243     sqlite3 *db = NULL;
244     sqlite3_stmt *res = NULL;
245     gchar *errMsg = NULL, *message;
246     gchar sql[1024];
247     gint call_count=0, sms_count=0, rc=0;
248     GtkListStore *list = NULL;
249     PangoFontDescription *pfd = NULL;
250     
251     rc = sqlite3_open("/home/user/.rtcom-eventlogger/el.db", &db);
252     if (rc){
253         fprintf(stderr, "error open db %d %s\n", rc, sqlite3_errmsg(db));
254     }else {
255         snprintf(sql, sizeof(sql)-1, "select count(id) from Events where event_type_id=%d", 3);
256 //#if 0
257         rc = sqlite3_prepare(db, sql, sizeof(sql)-1, &res, NULL);
258         if (rc != SQLITE_OK){
259             fprintf(stderr, "error prepare %d %s\n", rc, sql);
260         }
261         if (sqlite3_step(res) != SQLITE_ROW){
262             fprintf(stderr, "not sqlite_row\n");
263         }
264         call_count = sqlite3_column_int(res, 0);
265         //fprintf(stderr, "count missing calls = %d\n", call_count);
266         sqlite3_finalize(res);
267
268         snprintf(sql, sizeof(sql)-1, "select count(id) from Events where event_type_id=%d and is_read=%d", 7, 0);
269         rc = sqlite3_prepare(db, sql, sizeof(sql)-1, &res, NULL);
270         if (rc != SQLITE_OK){
271             fprintf(stderr, "error prepare %d %s\n", rc, sql);
272         }
273         if (sqlite3_step(res) != SQLITE_ROW){
274             fprintf(stderr, "not sqlite_row\n");
275         }
276         sms_count = sqlite3_column_int(res, 0);
277         //fprintf(stderr, "count sms = %d\n", sms_count);
278         sqlite3_finalize(res);
279
280 //#endif
281         sqlite3_close(db);
282     }
283     label = actor->image;
284     message = g_markup_printf_escaped("<span bgcolor=\"%s\" foreground=\"%s\">Missed calls: %d Unread sms: %d</span>", "#FFFFFF", "#000000", call_count, sms_count);
285     gtk_label_set_markup(GTK_LABEL(label), message);
286     g_free(message);
287     pfd = pango_font_description_from_string("Sans 14");
288     gtk_widget_modify_font(GTK_WIDGET(label), NULL);
289     gtk_widget_modify_font(GTK_WIDGET(label), pfd);
290     pango_font_description_free(pfd);
291     actor->time_start_animation = time(NULL) + 20;    
292 }
293
294
295 void 
296 change_moon(Actor * actor, AWallpaperPlugin *desktop_plugin)
297 {
298     gint phase;
299     char *newfile;
300     gint x0 = 150,
301          x1 = 650, 
302          x, y;
303     struct timeval tvb;     
304     suseconds_t ms;
305     long sec;
306     double t;
307 #if 0
308     gint y0, y1, x2, y2;
309     double a, b, c;
310     a = (double)(y2 - (double)(x2*(y1-y0) + x1*y0 - x0*y1)/(x1-x0))/(x2*(x2-x0-x1)+x0*x1);
311     b = (double)(y1-y0)/(x1-x0) - (double)a*(x0+x1);
312     c = (double)(x1*y0 - x0*y1)/(x1-x0) + (double)a*x0*x1;
313     fprintf(stderr, "a=%f, b=%f, c=%f\n", a, b, c);
314 #endif
315     gettimeofday(&tvb, NULL);
316     
317     ms = tvb.tv_usec;
318     sec = tvb.tv_sec;
319
320     if (actor){
321         if (desktop_plugin->priv->scene->daytime == TIME_NIGHT){
322             if (!actor->visible){
323                 actor->visible = TRUE;
324                 phase = get_moon_phase();
325                 newfile = g_strdup_printf( "%s%d.png", actor->name, phase);
326                 if (actor->filename)
327                     g_free(actor->filename);
328                 actor->filename = newfile;
329                 actor->time_start_animation = sec - fast_rnd(60 * 60);
330                 actor->duration_animation = 1 * 60 * 60;
331                 create_hildon_actor(actor, desktop_plugin);
332
333             }
334             t = (double)((double)sec+(double)ms/1000000 - actor->time_start_animation) / actor->duration_animation;
335             if (t <= 1)
336                 x = path_line(x0, x1, t);
337             else 
338                 x = path_line(x1, x0, t-1);
339             y = 0.001920*x*x - 1.536*x + 337.2;
340             //y = a*x*x + b*x + c;
341
342             set_actor_position(actor, x, y, actor->z, desktop_plugin);
343
344             if (t>=2){
345                 actor->time_start_animation = sec;
346             }
347
348          }else if (actor->visible){
349             actor->visible = FALSE;
350             fprintf(stderr, "destroy moon \n");
351             destroy_hildon_actor(actor);
352             actor->time_start_animation = 0;
353         } 
354     }
355     
356 }
357
358 void 
359 change_sun(Actor * actor, AWallpaperPlugin *desktop_plugin)
360 {
361     double alt, azm;
362     gint x, y;
363
364     //fprintf(stderr, "change sun\n");
365     if (actor){
366         if (desktop_plugin->priv->scene->daytime != TIME_NIGHT){
367             if (!actor->visible){
368                 actor->visible = TRUE;
369                 create_hildon_actor(actor, desktop_plugin);
370             }
371             get_sun_pos(&alt, &azm);
372             get_sun_screen_pos(alt, azm, &x, &y);
373             actor->x = x;
374             actor->y = y;
375             set_actor_position(actor, x, y, actor->z, desktop_plugin);
376             actor->time_start_animation = time(NULL) + 60;
377          }else if (actor->visible){
378             actor->visible = FALSE;
379             destroy_hildon_actor(actor);
380             actor->time_start_animation = 0;
381         } 
382     }
383     
384 }
385
386 void 
387 change_tram(Actor * actor, AWallpaperPlugin *desktop_plugin)
388 {
389     gint x0 = -300, y0 = 225, scale0 = 100,
390          x1 = 800, y1 = 162, scale1 = 130, 
391          x, y, scale;
392     struct timeval tvb;     
393     suseconds_t ms;
394     long sec;
395     double t;
396
397     //fprintf(stderr, "change tram\n");
398     gettimeofday(&tvb, NULL);
399     
400     ms = tvb.tv_usec;
401     sec = tvb.tv_sec;
402     
403     if (!actor->visible){
404         actor->visible = TRUE;
405         if (desktop_plugin->priv->scene->daytime == TIME_NIGHT){
406             if (actor->filename)
407                 g_free(actor->filename);
408             actor->filename = g_strdup("tram_dark.png");
409         } else{
410             if (actor->filename)
411                 g_free(actor->filename);
412             actor->filename = g_strdup("tram.png");
413         }
414         create_hildon_actor(actor, desktop_plugin);
415     }
416     t = (double)((double)sec+(double)ms/1000000 - actor->time_start_animation) / actor->duration_animation;
417     x = path_line(x0, x1, t);
418     y = path_line(y0, y1, t);
419     scale = path_line(scale0, scale1, t);
420     set_actor_position(actor, x, y, actor->z, desktop_plugin);
421     set_actor_scale(actor, (double)scale/100, (double)scale/100);
422     if (t >= 1){
423         /* stop animation */
424         actor->visible = FALSE;
425         destroy_hildon_actor(actor);
426         actor->time_start_animation = sec + fast_rnd(60);
427     }
428 }
429
430 void
431 change_plane1(Actor *actor, AWallpaperPlugin *desktop_plugin)
432 {
433     gint x0 = 620, y0 = 233,
434          x1 = 79, y1 = -146, 
435          x, y;
436     struct timeval tvb;     
437     suseconds_t ms;
438     long sec;
439     double t;
440
441     gettimeofday(&tvb, NULL);
442     
443     ms = tvb.tv_usec;
444     sec = tvb.tv_sec;
445 //    fprintf(stderr, "1 %f - %d\n", sec+(double)ms/100000, now);
446    
447     if (desktop_plugin->priv->scene->daytime != TIME_NIGHT){
448         if (actor->time_start_animation == 0){
449             actor->time_start_animation = sec + fast_rnd(180);
450             return;
451         }
452     }
453     if (!actor->visible){
454         actor->visible = TRUE;
455         create_hildon_actor(actor, desktop_plugin);
456     }
457     t = (double)((double)sec+(double)ms/1000000 - actor->time_start_animation) / actor->duration_animation;
458     x = path_line(x0, x1, t);
459     y = path_line(y0, y1, t);
460     //scale = path_line(scale0, scale1, t);
461     set_actor_position(actor, x, y, actor->z, desktop_plugin);
462     if (t >= 1){
463         /* stop animation */
464         actor->visible = FALSE;
465         destroy_hildon_actor(actor);
466         if (desktop_plugin->priv->scene->daytime == TIME_NIGHT) 
467             actor->time_start_animation = 0;
468         else 
469             actor->time_start_animation = sec + fast_rnd(180);
470     }
471
472 }
473
474 void
475 change_plane2(Actor *actor, AWallpaperPlugin *desktop_plugin)
476 {
477     gint x0 = -actor->width, y0 = 45,
478          x1 = 800, y1 = 20, 
479          x, y;
480     struct timeval tvb;     
481     suseconds_t ms;
482     long sec;
483     double t;
484
485     gettimeofday(&tvb, NULL);
486     
487     ms = tvb.tv_usec;
488     sec = tvb.tv_sec;
489 //    fprintf(stderr, "1 %f - %d\n", sec+(double)ms/100000, now);
490     if (desktop_plugin->priv->scene->daytime != TIME_NIGHT){
491         if (actor->time_start_animation == 0){
492             actor->time_start_animation = sec + fast_rnd(180);
493             return;
494         }
495     }
496     if (!actor->visible){
497         actor->visible = TRUE;
498         create_hildon_actor(actor, desktop_plugin);
499     }
500
501     t = (double)((double)sec+(double)ms/1000000 - actor->time_start_animation) / actor->duration_animation;
502     x = path_line(x0, x1, t);
503     y = path_line(y0, y1, t);
504     //scale = path_line(scale0, scale1, t);
505     set_actor_position(actor, x, y, actor->z, desktop_plugin);
506     if (t >= 1){
507         /* stop animation */
508         actor->visible = FALSE;
509         destroy_hildon_actor(actor);
510         if (desktop_plugin->priv->scene->daytime == TIME_NIGHT) 
511             actor->time_start_animation = 0;
512         else 
513             actor->time_start_animation = sec + fast_rnd(180);
514     }
515
516 }
517
518 void
519 change_cloud(Actor *actor, AWallpaperPlugin *desktop_plugin)
520 {
521     gint x0, y0 = 300, scale0 = 100,
522          x1, y1 = -actor->height, scale1 = 150, 
523          x, y, scale;
524     struct timeval tvb;     
525     suseconds_t ms;
526     long sec;
527     double t;
528     gchar *newfile;
529
530     //fprintf(stderr, "change cloud\n");
531     gettimeofday(&tvb, NULL);
532     
533     ms = tvb.tv_usec;
534     sec = tvb.tv_sec;
535    
536     if (!actor->visible){
537         actor->visible = TRUE;
538         if (desktop_plugin->priv->scene->daytime == TIME_NIGHT){
539             newfile = g_strdup_printf("%s_dark.png", actor->name);
540         }else{
541             newfile = g_strdup_printf("%s.png", actor->name);
542         } 
543         if (actor->filename)
544             g_free(actor->filename);
545         actor->filename = newfile;
546          
547         create_hildon_actor(actor, desktop_plugin);
548     }
549     t = (double)((double)sec+(double)ms/1000000 - actor->time_start_animation) / actor->duration_animation;
550     
551     if (desktop_plugin->priv->scene->wind_orientation == 1){
552         x0 = -actor->width;
553         x1 = 800;
554     }
555     else {
556         x0 = 800;
557         x1 = -actor->width;
558     }
559
560     x = path_line(x0, x1, t);    
561     y = -desktop_plugin->priv->scene->wind_angle * (x - x0) + actor->y;
562     scale = path_line(scale0, scale1, (double)(y - y0)/(y1 - y0));
563
564     set_actor_position(actor, x, y, actor->z, desktop_plugin);
565     set_actor_scale(actor, (double)scale/100, (double)scale/100);
566     if ((y < y1 || y > y0) || t >= 1){
567         /* stop animation */
568         actor->visible = FALSE;
569         destroy_hildon_actor(actor);
570         actor->time_start_animation = sec + fast_rnd(300);
571         actor->y = fast_rnd(300);
572     }
573
574 }
575
576 void
577 change_wind(Actor *actor, AWallpaperPlugin *desktop_plugin)
578 {
579     desktop_plugin->priv->scene->wind_orientation = fast_rnd(2);
580     if (desktop_plugin->priv->scene->wind_orientation == 0) desktop_plugin->priv->scene->wind_orientation = -1;
581     desktop_plugin->priv->scene->wind_angle = (double)(fast_rnd(200) - 100) / 100;
582     actor->time_start_animation = time(NULL) + (fast_rnd(10) + 10) * 60;
583     //fprintf(stderr, "change wind orient = %d angle = %f after = %d\n", scene.wind_orientation, scene.wind_angle, actor->time_start_animation-time(NULL));
584 }
585
586 void 
587 change_window1(Actor * actor, AWallpaperPlugin *desktop_plugin)
588 {
589     gint now = time(NULL);
590     if (desktop_plugin->priv->scene->daytime == TIME_DAY){
591         if (actor->widget){
592             actor->visible = FALSE;
593             destroy_hildon_actor(actor);
594         }
595         actor->time_start_animation = 0;
596         return;
597     }else {
598         if (!actor->widget)
599             create_hildon_actor(actor, desktop_plugin);
600         if (actor->time_start_animation == 0){
601             actor->time_start_animation = now + fast_rnd(30);
602             return;
603         }
604     }
605
606     if (!actor->visible)
607         actor->visible = TRUE;
608     else 
609         actor->visible = FALSE;
610     set_actor_visible(actor, actor->visible);
611     actor->time_start_animation = now + fast_rnd(60) + 10;
612
613 }
614
615 void 
616 change_signal(Actor * actor, AWallpaperPlugin *desktop_plugin)
617 {
618     gint now = time(NULL);
619     Actor *a;
620     a = g_ptr_array_index(actor->child, 0);
621     if (a->visible)
622         a->visible = FALSE;
623     else 
624         a->visible = TRUE;
625     set_actor_visible(a, a->visible);
626     
627     a = g_ptr_array_index(actor->child, 1);
628     if (a->visible)
629         a->visible = FALSE;
630     else 
631         a->visible = TRUE;
632     set_actor_visible(a, a->visible);
633
634     actor->time_start_animation = now + fast_rnd(30) + 10;
635 }
636
637 void
638 change_layer(Actor * actor, AWallpaperPlugin *desktop_plugin)
639 {
640     gint y, speed1 = 8, speed2 = 16;
641     Actor *a;
642
643     if (!desktop_plugin->priv->rich_animation) return;
644
645     a = g_ptr_array_index(actor->child, 0);
646     y = a->y + speed1;
647     if (y > 480) y = -480;
648     set_actor_position(a, a->x, y, a->z, desktop_plugin);
649     a->y = y;
650     
651     a = g_ptr_array_index(actor->child, 1);
652     y = a->y + speed1;
653     if (y > 480) y = -480;
654     set_actor_position(a, a->x, y, a->z, desktop_plugin);
655     a->y = y;
656
657     a = g_ptr_array_index(actor->child, 2);
658     y = a->y + speed2;
659     if (y > 480) y = -480;
660     set_actor_position(a, a->x, y, a->z, desktop_plugin);
661     a->y = y;
662
663     a = g_ptr_array_index(actor->child, 3);
664     y = a->y + speed2;
665     if (y > 480) y = -480;
666     set_actor_position(a, a->x, y, a->z, desktop_plugin);
667     a->y = y;
668 }
669
670 void 
671 change_static_actor(Actor * actor, AWallpaperPlugin *desktop_plugin)
672 {
673     gchar *newfile;
674     newfile = g_strdup_printf("%s%d.png", actor->name, desktop_plugin->priv->scene->daytime); 
675     if (actor->filename)
676             g_free(actor->filename);
677     actor->filename = newfile;
678     change_hildon_actor(actor, desktop_plugin);
679 }
680
681 void 
682 change_static_actor_with_corner(Actor * actor, AWallpaperPlugin *desktop_plugin)
683 {
684     gchar buffer[2048];
685
686     if (desktop_plugin->priv->right_corner)
687         gtk_widget_destroy(desktop_plugin->priv->right_corner);
688     snprintf(buffer, sizeof(buffer) - 1, "%s/%s/town%i_right_corner.png", \
689                                   THEME_PATH, desktop_plugin->priv->theme, desktop_plugin->priv->scene->daytime);
690     desktop_plugin->priv->right_corner = gtk_image_new_from_file (buffer);
691     if (desktop_plugin->priv->right_corner){
692         gtk_fixed_put(GTK_FIXED(desktop_plugin->priv->main_widget), desktop_plugin->priv->right_corner, 0, 0);
693         gtk_widget_show (desktop_plugin->priv->right_corner);
694     }
695     change_static_actor(actor, desktop_plugin);
696
697 }