1 /*vim: set sw=4 ts=4 et: */
3 * This file is part of Live Wallpaper (livewp)
5 * Copyright (C) 2010 Vlad Vasiliev
6 * Copyright (C) 2010 Tanya Makova
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.
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.
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
24 /*******************************************************************************/
25 #include "livewp-actor.h"
28 realize (GtkWidget *widget)
31 screen = gtk_widget_get_screen (widget);
32 gtk_widget_set_colormap (widget, gdk_screen_get_rgba_colormap (screen));
36 expose_event (GtkWidget *widget,GdkEventExpose *event,
40 GdkPixbuf *pixbuf = (GdkPixbuf *) data;
42 cr = gdk_cairo_create(widget->window);
44 gdk_cairo_region(cr, event->region);
45 cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
46 gdk_cairo_set_source_pixbuf(cr, pixbuf, 0.0, 0.0);
54 destroy_hildon_actor(Actor *actor)
56 //fprintf(stderr, "destroy_hildon_actor %s\n",actor->name);
57 gtk_widget_destroy(actor->widget);
62 create_hildon_actor_text(Actor *actor, AWallpaperPlugin *desktop_plugin)
65 GtkWidget *label = NULL;
67 ha = hildon_animation_actor_new();
68 label = gtk_label_new(NULL);
71 //g_signal_connect(G_OBJECT(label), "expose_event", G_CALLBACK(expose_event), NULL);
73 gtk_container_add (GTK_CONTAINER (ha), label);
76 gtk_widget_show(label);
77 gtk_widget_show_all(ha);
82 //g_object_set_data(G_OBJECT(ha), "image", image);
84 hildon_animation_actor_set_parent (HILDON_ANIMATION_ACTOR (ha), GTK_WINDOW(desktop_plugin->priv->window));
86 set_actor_position(actor, actor->x, actor->y, actor->z, desktop_plugin);
87 set_actor_scale(actor, (double)actor->scale/100, (double)actor->scale/100);
88 set_actor_visible(actor, actor->visible);
92 create_hildon_actor(Actor *actor, AWallpaperPlugin *desktop_plugin)
95 GdkPixbuf *pixbuf = NULL;
96 GtkWidget *image = NULL;
99 ha = hildon_animation_actor_new();
100 str = g_strdup_printf( "%s/%s/%s", THEME_PATH,
101 desktop_plugin->priv->theme, actor->filename);
102 pixbuf = gdk_pixbuf_new_from_file_at_size (str,
106 /* fprintf(stderr, "create_hildon_actor %s %s\n", actor->name, str); */
110 image = gtk_image_new_from_pixbuf (pixbuf);
111 g_object_unref(G_OBJECT(pixbuf));
114 g_signal_connect(G_OBJECT(image), "expose_event",
115 G_CALLBACK(expose_event), pixbuf);
116 gtk_container_add (GTK_CONTAINER (ha), image);
119 gtk_widget_show_all(ha);
124 //g_object_set_data(G_OBJECT(ha), "image", image);
125 actor->image = image;
126 hildon_animation_actor_set_parent (HILDON_ANIMATION_ACTOR (ha), GTK_WINDOW(desktop_plugin->priv->window));
129 set_actor_position(actor, actor->x, actor->y, actor->z, desktop_plugin);
130 set_actor_scale(actor, (double)actor->scale/100, (double)actor->scale/100);
131 set_actor_visible(actor, actor->visible);
135 change_hildon_actor(Actor *actor, AWallpaperPlugin *desktop_plugin)
137 GtkWidget *image = NULL;
138 GdkPixbuf *pixbuf = NULL;
141 str = g_strdup_printf( "%s/%s/%s", THEME_PATH,
142 desktop_plugin->priv->theme, actor->filename);
144 pixbuf = gdk_pixbuf_new_from_file_at_size (str,
151 image = gtk_image_new_from_pixbuf (pixbuf);
152 g_object_unref(G_OBJECT(pixbuf));
155 g_signal_connect(G_OBJECT(image), "expose_event",
156 G_CALLBACK(expose_event), pixbuf);
157 //if (g_object_get_data(G_OBJECT(actor->widget), "image")){
159 gtk_container_remove(GTK_CONTAINER(actor->widget), actor->image);
161 //g_object_set_data(G_OBJECT(actor->widget), "image", image);
162 actor->image = image;
163 gtk_container_add (GTK_CONTAINER (actor->widget), image);
164 realize(actor->widget);
165 gtk_widget_show_all(actor->widget);
174 init_object(AWallpaperPlugin *desktop_plugin,
186 void (*pfunc_change)(Actor*),
187 void (*pfunc_probability)(Actor*),
192 actor = g_new0(Actor, 1);
196 actor->width = width;
197 actor->height = height;
198 actor->visible = visible;
199 actor->scale = scale;
200 actor->opacity = opacity;
201 actor->filename = g_strdup(filename);
202 actor->name = g_strdup(name);
203 actor->func_change = (gpointer)pfunc_change;
204 actor->func_probability = (gpointer)pfunc_probability;
205 actor->child = child;
207 create_hildon_actor(actor, desktop_plugin);
209 actor->widget = NULL;
210 actor->time_start_animation = 0;
211 actor->duration_animation = 0;
216 destroy_actor(Actor *actor)
220 g_ptr_array_free(actor->child, TRUE);
223 g_free(actor->filename);
226 gtk_widget_destroy(actor->widget);
227 //actor->widget = NULL;
232 path_line(gint x0, gint x1, double t)
235 return ((x1 - x0) * t + x0);
238 set_actor_scale(Actor *actor, double scalex, double scaley)
240 hildon_animation_actor_set_scale(
241 HILDON_ANIMATION_ACTOR(actor->widget),
248 set_actor_rotation(Actor *actor, gint axis, double degrees, gint x, gint y, gint z)
250 hildon_animation_actor_set_rotation(
251 HILDON_ANIMATION_ACTOR(actor->widget),
260 set_actor_visible(Actor *actor, gboolean visible)
262 hildon_animation_actor_set_show(HILDON_ANIMATION_ACTOR(actor->widget), visible);
266 set_actor_position(Actor *actor, gint x, gint y, gint z, AWallpaperPlugin *desktop_plugin)
268 hildon_animation_actor_set_position_full(HILDON_ANIMATION_ACTOR (actor->widget),
269 x-desktop_plugin->priv->xapplet,
270 y-desktop_plugin->priv->yapplet,
274 int get_notify_count(gchar *notify_type)
277 sqlite3_stmt *res = NULL;
278 gint rc = 0, result = 0;
281 rc = sqlite3_open("/home/user/.config/hildon-desktop/notifications.db", &db);
283 fprintf(stderr, "error open db %d %s\n", rc, sqlite3_errmsg(db));
285 snprintf(sql, sizeof(sql)-1, "select count(id) from notifications where icon_name='%s'", notify_type);
286 rc = sqlite3_prepare(db, sql, sizeof(sql)-1, &res, NULL);
287 if (rc != SQLITE_OK){
288 fprintf(stderr, "error prepare %d %s\n", rc, sql);
290 if (sqlite3_step(res) != SQLITE_ROW){
291 fprintf(stderr, "not sqlite_row\n");
293 result = sqlite3_column_int(res, 0);
294 //fprintf(stderr, "count missing calls = %d\n", call_count);
295 sqlite3_finalize(res);
301 gchar * read_notification()
306 fprintf(stderr, "read notification \n");
307 count = get_notify_count("general_missed");
309 message = g_strdup_printf("%s: %d", _("Missed calls"), count);
311 count = get_notify_count("general_sms");
314 message = g_strdup_printf("%s \n%s: %d", message, _("Missed sms"), count);
316 message = g_strdup_printf("%s: %d", _("Missed sms"), count);
319 count = get_notify_count("general_chat");
322 message = g_strdup_printf("%s \n%s: %d", message, _("Missed chat"), count);
324 message = g_strdup_printf("%s: %d", _("Missed chat"), count);
327 count = get_notify_count("qgn_list_messagin");
330 message = g_strdup_printf("%s \n%s: %d", message, _("Missed mail"), count);
332 message = g_strdup_printf("%s: %d", _("Missed mail"), count);
335 fprintf(stderr, "notify=%s\n", message);
340 change_obj(Actor *actor, AWallpaperPlugin *desktop_plugin)
342 char * accel_filename = "/sys/class/i2c-adapter/i2c-3/3-001d/coord";
343 //char * accel_filename = "/home/tanya/coord";
346 int rs, ax, ay, az, dx, dy;
347 fd = fopen(accel_filename, "r");
349 fprintf(stderr, "cannot open file\n");
352 rs = fscanf((FILE*)fd, "%i %i %i", &ax, &ay, &az);
355 fprintf(stderr, "cannot read information from file\n");
359 fprintf(stderr, "change obj %i %i %i\n", ax, ay, az);
363 actor->x = actor->x + dx;
364 actor->y = actor->y + dy;
366 if (actor->x > 800) actor->x = 0;
367 if (actor->x < 0) actor->x = 800;
369 if (actor->y > 480) actor->y = 0;
370 if (actor->y < 0) actor->y = 480;
372 set_actor_position(actor, actor->x, actor->y, actor->z, desktop_plugin);
378 change_billboard(Actor * actor, AWallpaperPlugin *desktop_plugin)
383 //fprintf(stderr, "change_billboard\n");
385 if (desktop_plugin->priv->scene->notification < time(NULL)){
386 count = get_notify_count("general_missed");
387 a = g_ptr_array_index(actor->child, 0);
389 set_actor_visible(a, TRUE);
391 set_actor_visible(a, FALSE);
393 count = get_notify_count("general_sms");
394 a = g_ptr_array_index(actor->child, 3);
396 set_actor_visible(a, TRUE);
398 set_actor_visible(a, FALSE);
400 count = get_notify_count("general_chat");
401 a = g_ptr_array_index(actor->child, 1);
403 set_actor_visible(a, TRUE);
405 set_actor_visible(a, FALSE);
407 count = get_notify_count("qgn_list_messagin");
408 a = g_ptr_array_index(actor->child, 2);
410 set_actor_visible(a, TRUE);
412 set_actor_visible(a, FALSE);
415 desktop_plugin->priv->scene->notification = FALSE;
417 actor->time_start_animation = time(NULL) + 20;
422 change_billboard1(Actor * actor, AWallpaperPlugin *desktop_plugin)
426 sqlite3_stmt *res = NULL;
427 gchar *errMsg = NULL, *message;
429 gint call_count=0, sms_count=0, rc=0;
430 GtkListStore *list = NULL;
431 PangoFontDescription *pfd = NULL;
433 rc = sqlite3_open("/home/user/.rtcom-eventlogger/el.db", &db);
435 fprintf(stderr, "error open db %d %s\n", rc, sqlite3_errmsg(db));
437 snprintf(sql, sizeof(sql)-1, "select count(id) from Events where event_type_id=%d", 3);
439 rc = sqlite3_prepare(db, sql, sizeof(sql)-1, &res, NULL);
440 if (rc != SQLITE_OK){
441 fprintf(stderr, "error prepare %d %s\n", rc, sql);
443 if (sqlite3_step(res) != SQLITE_ROW){
444 fprintf(stderr, "not sqlite_row\n");
446 call_count = sqlite3_column_int(res, 0);
447 //fprintf(stderr, "count missing calls = %d\n", call_count);
448 sqlite3_finalize(res);
450 snprintf(sql, sizeof(sql)-1, "select count(id) from Events where event_type_id=%d and is_read=%d", 7, 0);
451 rc = sqlite3_prepare(db, sql, sizeof(sql)-1, &res, NULL);
452 if (rc != SQLITE_OK){
453 fprintf(stderr, "error prepare %d %s\n", rc, sql);
455 if (sqlite3_step(res) != SQLITE_ROW){
456 fprintf(stderr, "not sqlite_row\n");
458 sms_count = sqlite3_column_int(res, 0);
459 //fprintf(stderr, "count sms = %d\n", sms_count);
460 sqlite3_finalize(res);
465 label = actor->image;
466 message = g_markup_printf_escaped("<span bgcolor=\"%s\" foreground=\"%s\">Missed calls: %d Unread sms: %d</span>", "#FFFFFF", "#000000", call_count, sms_count);
467 gtk_label_set_markup(GTK_LABEL(label), message);
469 pfd = pango_font_description_from_string("Sans 14");
470 gtk_widget_modify_font(GTK_WIDGET(label), NULL);
471 gtk_widget_modify_font(GTK_WIDGET(label), pfd);
472 pango_font_description_free(pfd);
473 actor->time_start_animation = time(NULL) + 20;
478 change_moon(Actor * actor, AWallpaperPlugin *desktop_plugin)
492 a = (double)(y2 - (double)(x2*(y1-y0) + x1*y0 - x0*y1)/(x1-x0))/(x2*(x2-x0-x1)+x0*x1);
493 b = (double)(y1-y0)/(x1-x0) - (double)a*(x0+x1);
494 c = (double)(x1*y0 - x0*y1)/(x1-x0) + (double)a*x0*x1;
495 fprintf(stderr, "a=%f, b=%f, c=%f\n", a, b, c);
497 gettimeofday(&tvb, NULL);
503 if (desktop_plugin->priv->scene->daytime == TIME_NIGHT){
504 if (!actor->visible){
505 actor->visible = TRUE;
506 phase = get_moon_phase();
507 newfile = g_strdup_printf( "%s%d.png", actor->name, phase);
509 g_free(actor->filename);
510 actor->filename = newfile;
511 actor->time_start_animation = sec - fast_rnd(60 * 60);
512 actor->duration_animation = 1 * 60 * 60;
513 create_hildon_actor(actor, desktop_plugin);
516 t = (double)((double)sec+(double)ms/1000000 - actor->time_start_animation) / actor->duration_animation;
518 x = path_line(x0, x1, t);
520 x = path_line(x1, x0, t-1);
521 y = 0.001920*x*x - 1.536*x + 337.2;
522 //y = a*x*x + b*x + c;
524 set_actor_position(actor, x, y, actor->z, desktop_plugin);
527 actor->time_start_animation = sec;
530 }else if (actor->visible){
531 actor->visible = FALSE;
532 fprintf(stderr, "destroy moon \n");
533 destroy_hildon_actor(actor);
534 actor->time_start_animation = 0;
541 change_sun(Actor * actor, AWallpaperPlugin *desktop_plugin)
546 //fprintf(stderr, "change sun\n");
548 if (desktop_plugin->priv->scene->daytime != TIME_NIGHT){
549 if (!actor->visible){
550 actor->visible = TRUE;
551 create_hildon_actor(actor, desktop_plugin);
553 get_sun_pos(&alt, &azm);
554 get_sun_screen_pos(alt, azm, &x, &y);
557 set_actor_position(actor, x, y, actor->z, desktop_plugin);
558 actor->time_start_animation = time(NULL) + 60;
559 }else if (actor->visible){
560 actor->visible = FALSE;
561 destroy_hildon_actor(actor);
562 actor->time_start_animation = 0;
569 change_tram(Actor * actor, AWallpaperPlugin *desktop_plugin)
571 gint x0 = -300, y0 = 225, scale0 = 100,
572 x1 = 800, y1 = 162, scale1 = 130,
579 //fprintf(stderr, "change tram\n");
580 gettimeofday(&tvb, NULL);
585 if (!actor->visible){
586 actor->visible = TRUE;
587 if (desktop_plugin->priv->scene->daytime == TIME_NIGHT){
589 g_free(actor->filename);
590 actor->filename = g_strdup("tram_dark.png");
593 g_free(actor->filename);
594 actor->filename = g_strdup("tram.png");
596 create_hildon_actor(actor, desktop_plugin);
598 t = (double)((double)sec+(double)ms/1000000 - actor->time_start_animation) / actor->duration_animation;
599 x = path_line(x0, x1, t);
600 y = path_line(y0, y1, t);
601 scale = path_line(scale0, scale1, t);
602 set_actor_position(actor, x, y, actor->z, desktop_plugin);
603 set_actor_scale(actor, (double)scale/100, (double)scale/100);
606 actor->visible = FALSE;
607 destroy_hildon_actor(actor);
608 actor->time_start_animation = sec + fast_rnd(60);
613 change_plane1(Actor *actor, AWallpaperPlugin *desktop_plugin)
615 gint x0 = 620, y0 = 233,
623 gettimeofday(&tvb, NULL);
627 // fprintf(stderr, "1 %f - %d\n", sec+(double)ms/100000, now);
629 if (desktop_plugin->priv->scene->daytime != TIME_NIGHT){
630 if (actor->time_start_animation == 0){
631 actor->time_start_animation = sec + fast_rnd(180);
635 if (!actor->visible){
636 actor->visible = TRUE;
637 create_hildon_actor(actor, desktop_plugin);
639 t = (double)((double)sec+(double)ms/1000000 - actor->time_start_animation) / actor->duration_animation;
640 x = path_line(x0, x1, t);
641 y = path_line(y0, y1, t);
642 //scale = path_line(scale0, scale1, t);
643 set_actor_position(actor, x, y, actor->z, desktop_plugin);
646 actor->visible = FALSE;
647 destroy_hildon_actor(actor);
648 if (desktop_plugin->priv->scene->daytime == TIME_NIGHT)
649 actor->time_start_animation = 0;
651 actor->time_start_animation = sec + fast_rnd(180);
657 change_plane2(Actor *actor, AWallpaperPlugin *desktop_plugin)
659 gint x0 = -actor->width, y0 = 45,
667 gettimeofday(&tvb, NULL);
671 // fprintf(stderr, "1 %f - %d\n", sec+(double)ms/100000, now);
672 if (desktop_plugin->priv->scene->daytime != TIME_NIGHT){
673 if (actor->time_start_animation == 0){
674 actor->time_start_animation = sec + fast_rnd(180);
678 if (!actor->visible){
679 actor->visible = TRUE;
680 create_hildon_actor(actor, desktop_plugin);
683 t = (double)((double)sec+(double)ms/1000000 - actor->time_start_animation) / actor->duration_animation;
684 x = path_line(x0, x1, t);
685 y = path_line(y0, y1, t);
686 //scale = path_line(scale0, scale1, t);
687 set_actor_position(actor, x, y, actor->z, desktop_plugin);
690 actor->visible = FALSE;
691 destroy_hildon_actor(actor);
692 if (desktop_plugin->priv->scene->daytime == TIME_NIGHT)
693 actor->time_start_animation = 0;
695 actor->time_start_animation = sec + fast_rnd(180);
701 change_cloud(Actor *actor, AWallpaperPlugin *desktop_plugin)
703 gint x0, y0 = 300, scale0 = 100,
704 x1, y1 = -actor->height, scale1 = 150,
712 //fprintf(stderr, "change cloud\n");
713 gettimeofday(&tvb, NULL);
718 if (!actor->visible){
719 actor->visible = TRUE;
720 if (desktop_plugin->priv->scene->daytime == TIME_NIGHT){
721 newfile = g_strdup_printf("%s_dark.png", actor->name);
723 newfile = g_strdup_printf("%s.png", actor->name);
726 g_free(actor->filename);
727 actor->filename = newfile;
729 create_hildon_actor(actor, desktop_plugin);
731 t = (double)((double)sec+(double)ms/1000000 - actor->time_start_animation) / actor->duration_animation;
733 if (desktop_plugin->priv->scene->wind_orientation == 1){
742 x = path_line(x0, x1, t);
743 y = -desktop_plugin->priv->scene->wind_angle * (x - x0) + actor->y;
744 scale = path_line(scale0, scale1, (double)(y - y0)/(y1 - y0));
746 set_actor_position(actor, x, y, actor->z, desktop_plugin);
747 set_actor_scale(actor, (double)scale/100, (double)scale/100);
748 if ((y < y1 || y > y0) || t >= 1){
750 actor->visible = FALSE;
751 destroy_hildon_actor(actor);
752 actor->time_start_animation = sec + fast_rnd(300);
753 actor->y = fast_rnd(300);
759 change_wind(Actor *actor, AWallpaperPlugin *desktop_plugin)
761 desktop_plugin->priv->scene->wind_orientation = fast_rnd(2);
762 if (desktop_plugin->priv->scene->wind_orientation == 0) desktop_plugin->priv->scene->wind_orientation = -1;
763 desktop_plugin->priv->scene->wind_angle = (double)(fast_rnd(200) - 100) / 100;
764 actor->time_start_animation = time(NULL) + (fast_rnd(10) + 10) * 60;
765 //fprintf(stderr, "change wind orient = %d angle = %f after = %d\n", scene.wind_orientation, scene.wind_angle, actor->time_start_animation-time(NULL));
769 change_window1(Actor * actor, AWallpaperPlugin *desktop_plugin)
771 gint now = time(NULL);
772 if (desktop_plugin->priv->scene->daytime == TIME_DAY){
774 actor->visible = FALSE;
775 destroy_hildon_actor(actor);
777 actor->time_start_animation = 0;
781 create_hildon_actor(actor, desktop_plugin);
782 if (actor->time_start_animation == 0){
783 actor->time_start_animation = now + fast_rnd(30);
789 actor->visible = TRUE;
791 actor->visible = FALSE;
792 set_actor_visible(actor, actor->visible);
793 actor->time_start_animation = now + fast_rnd(60) + 10;
798 change_signal(Actor * actor, AWallpaperPlugin *desktop_plugin)
800 gint now = time(NULL);
802 a = g_ptr_array_index(actor->child, 0);
807 set_actor_visible(a, a->visible);
809 a = g_ptr_array_index(actor->child, 1);
814 set_actor_visible(a, a->visible);
816 actor->time_start_animation = now + fast_rnd(30) + 10;
820 change_tape(Actor *actor, AWallpaperPlugin *desktop_plugin)
825 if (!desktop_plugin->priv->rich_animation) return;
827 char * accel_filename = "/sys/class/i2c-adapter/i2c-3/3-001d/coord";
828 //char * accel_filename = "/home/tanya/coord";
832 fd = fopen(accel_filename, "r");
834 //fprintf(stderr, "cannot open file\n");
835 fd = fopen("/home/user/coord", "r");
837 rs = fscanf((FILE*)fd, "%i %i %i", &ax, &ay, &az);
840 fprintf(stderr, "cannot read information from file\n");
845 //fprintf(stderr, "change obj %i %i %i angle rad=%f, deg=%f\n", ax, ay, az, atan2(ax, -ay), atan2(ax, -ay)*180/M_PI);
846 int ang = (int)floor(atan2(ay, ax)*180/M_PI);
847 if (ang < 0) ang = 360+ang;
849 if (!desktop_plugin->priv->rich_animation) return;
851 for (i=0; i<16; i++){
852 a = g_ptr_array_index(actor->child, i);
853 if (a->scale == 100) a->scale = ang;
854 if (abs(a->scale - ang) > 10){
856 if ((a->scale - ang) < (ang + (360-a->scale))) a->scale--;
859 if (a->scale < ang) {
860 if (ang - a->scale < (a->scale+(360-ang))) a->scale++;
863 if (a->scale > 360) a->scale = 0;
864 if (a->scale < 0) a->scale = 360;
867 x = a->x - (float)cos(a->scale*M_PI/180)*a->z;
868 y = a->y - (float)sin(a->scale*M_PI/180)*a->z;
869 //x = round(a->x - (float)cos(a->scale*M_PI/180)*a->z);
870 //y = round(a->y - (float)sin(a->scale*M_PI/180)*a->z);
871 //x = a->x - cos(angle)*a->z;
872 //y = a->y - sin(angle)*a->z;
873 if ((a->scale > 270 || a->scale < 90) && x < -a->width*cos(a->scale*M_PI/180)){
877 if ((a->scale > 90 && a->scale < 270) && x > 800 - a->width*cos(a->scale*M_PI/180)){
881 if (a->scale > 0 && a->scale < 180 && y < -a->width*sin(a->scale*M_PI/180)){
885 if (a->scale < 360 && a->scale > 180 && y > 480 - a->width*sin(a->scale*M_PI/180)){
889 //if (i ==0) fprintf(stderr, "x=%d y=%d ang=%d speed=%d\n", x, y, a->scale, a->z);
890 set_actor_rotation(a, HILDON_AA_Z_AXIS, a->scale, 0, 0, 0);
891 set_actor_position(a, x, y, a->z, desktop_plugin);
899 change_layer(Actor * actor, AWallpaperPlugin *desktop_plugin)
901 gint y, speed1 = 8, speed2 = 16;
904 if (!desktop_plugin->priv->rich_animation) return;
906 a = g_ptr_array_index(actor->child, 0);
908 if (y > 480) y = -480;
909 set_actor_position(a, a->x, y, a->z, desktop_plugin);
912 a = g_ptr_array_index(actor->child, 1);
914 if (y > 480) y = -480;
915 set_actor_position(a, a->x, y, a->z, desktop_plugin);
918 a = g_ptr_array_index(actor->child, 2);
920 if (y > 480) y = -480;
921 set_actor_position(a, a->x, y, a->z, desktop_plugin);
924 a = g_ptr_array_index(actor->child, 3);
926 if (y > 480) y = -480;
927 set_actor_position(a, a->x, y, a->z, desktop_plugin);
932 change_static_actor(Actor * actor, AWallpaperPlugin *desktop_plugin)
935 newfile = g_strdup_printf("%s%d.png", actor->name, desktop_plugin->priv->scene->daytime);
937 g_free(actor->filename);
938 actor->filename = newfile;
939 change_hildon_actor(actor, desktop_plugin);
943 change_static_actor_with_corner(Actor * actor, AWallpaperPlugin *desktop_plugin)
947 if (desktop_plugin->priv->right_corner)
948 gtk_widget_destroy(desktop_plugin->priv->right_corner);
949 snprintf(buffer, sizeof(buffer) - 1, "%s/%s/town%i_right_corner.png", \
950 THEME_PATH, desktop_plugin->priv->theme, desktop_plugin->priv->scene->daytime);
951 desktop_plugin->priv->right_corner = gtk_image_new_from_file (buffer);
952 if (desktop_plugin->priv->right_corner){
953 gtk_fixed_put(GTK_FIXED(desktop_plugin->priv->main_widget), desktop_plugin->priv->right_corner, 0, 0);
954 gtk_widget_show (desktop_plugin->priv->right_corner);
956 change_static_actor(actor, desktop_plugin);