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-common.h"
26 #include "livewp-home-widget.h"
27 #include <gconf/gconf-client.h>
28 #include "livewp-rules.h"
32 #define PLUGIN_NAME "livewp-home-widget.desktop-0"
33 #define GCONF_KEY_POSITION "/apps/osso/hildon-desktop/applets/%s/position"
34 #define GCONF_KEY_MODIFIED "/apps/osso/hildon-desktop/applets/%s/modified"
35 #define GCONF_KEY_VIEW "/apps/osso/hildon-desktop/applets/%s/view"
37 HD_DEFINE_PLUGIN_MODULE (AWallpaperPlugin, animation_wallpaper_plugin, HD_TYPE_HOME_PLUGIN_ITEM)
38 #define Animation_Wallpaper_HOME_PLUGIN_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE (obj,\
39 Animation_Wallpaper_TYPE_HOME_PLUGIN,\
40 Animation_WallpaperPrivate))
42 /* Position of plugin on desktop */
43 #define Xstartposition 700
44 #define Ystartposition 448
46 gint xapplet = 0, yapplet = 0;
50 lw_applet_realize (GtkWidget *widget)
54 screen = gtk_widget_get_screen (widget);
55 gtk_widget_set_colormap (widget,
56 gdk_screen_get_rgba_colormap (screen));
57 gtk_widget_set_app_paintable (widget,
59 GTK_WIDGET_CLASS (animation_wallpaper_plugin_parent_class)->realize (widget);
64 lw_applet_expose_event(GtkWidget *widget,
65 GdkEventExpose *event)
69 /* Create cairo context */
70 cr = gdk_cairo_create (GDK_DRAWABLE (widget->window));
71 gdk_cairo_region (cr, event->region);
74 /* Draw alpha background */
75 cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
76 cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 0.0);
82 return GTK_WIDGET_CLASS (animation_wallpaper_plugin_parent_class)->expose_event (widget,
87 expose_event (GtkWidget *widget,GdkEventExpose *event,
91 GdkPixbuf *pixbuf = (GdkPixbuf *) data;
93 cr = gdk_cairo_create(widget->window);
95 gdk_cairo_region(cr, event->region);
96 cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
97 gdk_cairo_set_source_pixbuf(cr, pixbuf, 0.0, 0.0);
105 realize (GtkWidget *widget)
108 screen = gtk_widget_get_screen (widget);
109 gtk_widget_set_colormap (widget, gdk_screen_get_rgba_colormap (screen));
112 /* Set position of widget on desktop */
114 init_applet_position(void)
116 GSList *position = NULL;
120 GError *error = NULL;
121 GConfClient *gconf_client = gconf_client_get_default ();
122 position_key = g_strdup_printf (GCONF_KEY_POSITION, PLUGIN_NAME);
123 position = gconf_client_get_list (gconf_client,
127 if (position && position->data && position->next->data){
128 xapplet = GPOINTER_TO_INT (position->data);
129 yapplet = GPOINTER_TO_INT (position->next->data);
131 position = g_slist_prepend (g_slist_prepend (NULL,
132 GINT_TO_POINTER (Ystartposition)),
133 GINT_TO_POINTER (Xstartposition));
134 gconf_client_set_list (gconf_client,
139 xapplet = Xstartposition;
140 yapplet = Ystartposition;
142 g_free (position_key);
143 modified = g_strdup_printf ("%i", 0);
144 modified_key = g_strdup_printf (GCONF_KEY_MODIFIED, PLUGIN_NAME);
145 gconf_client_set_string (gconf_client,
150 g_free(modified_key);
151 gconf_client_clear_cache(gconf_client);
152 g_object_unref(gconf_client);
156 actor_set_position_full(GtkWidget *actor, gint x, gint y, gint z)
158 /* fprintf(stderr, "actor_set_position_full z=%d\n", z); */
159 hildon_animation_actor_set_position_full (HILDON_ANIMATION_ACTOR (actor),x-xapplet, y-yapplet, z);
163 path_line(gint x0, gint x1, double t)
166 return ((x1 - x0) * t + x0);
171 destroy_hildon_actor(Actor *actor)
173 //fprintf(stderr, "destroy_hildon_actor %s\n",actor->name);
174 gtk_widget_destroy(actor->widget);
175 actor->widget = NULL;
179 init_object(AWallpaperPlugin *desktop_plugin,
191 void (*pfunc_change)(Actor*),
192 void (*pfunc_probability)(Actor*),
197 actor = g_new0(Actor, 1);
201 actor->width = width;
202 actor->height = height;
203 actor->visible = visible;
204 actor->scale = scale;
205 actor->opacity = opacity;
206 actor->filename = g_strdup(filename);
207 actor->name = g_strdup(name);
208 actor->func_change = (gpointer)pfunc_change;
209 actor->func_probability = (gpointer)pfunc_probability;
210 actor->child = child;
212 create_hildon_actor(actor, desktop_plugin);
214 actor->widget = NULL;
215 actor->time_start_animation = 0;
216 actor->duration_animation = 0;
224 //objects_list = g_slist_append(objects_list, G_OBJECT(actor));
225 //objects_list = g_slist_append(objects_list, G_OBJECT(a));
235 gint fast_rnd(gint max)
237 guint offset = 12923;
238 guint multiplier = 4079;
240 scene.seed = scene.seed * multiplier + offset;
241 return (gint)(scene.seed % max);
247 /* update sun position after ... second */
255 return (fast_rnd(10) + 1) * 60;
260 change_moon(Actor * actor, AWallpaperPlugin *desktop_plugin)
267 y0=150, y1 = 150, x2=400, y2=30;
274 a = (double)(y2 - (double)(x2*(y1-y0) + x1*y0 - x0*y1)/(x1-x0))/(x2*(x2-x0-x1)+x0*x1);
275 b = (double)(y1-y0)/(x1-x0) - (double)a*(x0+x1);
276 c = (double)(x1*y0 - x0*y1)/(x1-x0) + (double)a*x0*x1;
277 fprintf(stderr, "a=%f, b=%f, c=%f\n", a, b, c);
279 gettimeofday(&tvb, NULL);
285 if (scene.daytime == TIME_NIGHT){
286 if (!actor->visible){
287 actor->visible = TRUE;
288 phase = get_moon_phase();
289 newfile = g_strdup_printf( "%s%d.png", actor->name, phase);
291 g_free(actor->filename);
292 actor->filename = newfile;
293 actor->time_start_animation = sec - fast_rnd(60 * 60);
294 actor->duration_animation = 1 * 60 * 60;
295 create_hildon_actor(actor, desktop_plugin);
298 t = (double)((double)sec+(double)ms/1000000 - actor->time_start_animation) / actor->duration_animation;
300 x = path_line(x0, x1, t);
302 x = path_line(x1, x0, t-1);
303 //y = path_line(y0, y1, t);
304 y = 0.001920*x*x - 1.536*x + 337.2;
305 //y = a*x*x + b*x + c;
307 actor_set_position_full(actor->widget, x, y, actor->z);
310 actor->time_start_animation = sec;
313 }else if (actor->visible){
314 actor->visible = FALSE;
315 fprintf(stderr, "destroy moon \n");
316 destroy_hildon_actor(actor);
317 /* TO DO make moonrise*/
318 actor->time_start_animation = 0;
325 change_sun(Actor * actor, AWallpaperPlugin *desktop_plugin)
330 //fprintf(stderr, "change sun\n");
332 if (scene.daytime != TIME_NIGHT){
333 if (!actor->visible){
334 actor->visible = TRUE;
335 create_hildon_actor(actor, desktop_plugin);
337 get_sun_pos(&alt, &azm);
338 get_sun_screen_pos(alt, azm, &x, &y);
341 actor_set_position_full(actor->widget, x, y, actor->z);
342 //probability_sun(actor);
343 actor->time_start_animation = time(NULL) + probability_sun();
344 }else if (actor->visible){
345 actor->visible = FALSE;
346 destroy_hildon_actor(actor);
347 actor->time_start_animation = 0;
354 change_tram(Actor * actor, AWallpaperPlugin *desktop_plugin)
356 gint x0 = -300, y0 = 225, scale0 = 100,
357 x1 = 800, y1 = 162, scale1 = 130,
364 //fprintf(stderr, "change tram\n");
365 gettimeofday(&tvb, NULL);
370 if (!actor->visible){
371 actor->visible = TRUE;
372 if (scene.daytime == TIME_NIGHT){
374 g_free(actor->filename);
375 actor->filename = g_strdup("tram_dark.png");
378 g_free(actor->filename);
379 actor->filename = g_strdup("tram.png");
381 create_hildon_actor(actor, desktop_plugin);
383 t = (double)((double)sec+(double)ms/1000000 - actor->time_start_animation) / actor->duration_animation;
384 x = path_line(x0, x1, t);
385 y = path_line(y0, y1, t);
386 scale = path_line(scale0, scale1, t);
387 //fprintf(stderr, "change tram t=%f x=%d y=%d scale=%d\n", t, x, y, scale);
388 actor_set_position_full(actor->widget, x, y, actor->z);
389 hildon_animation_actor_set_scale(HILDON_ANIMATION_ACTOR(actor->widget), (double)scale/100, (double)scale/100);
392 actor->visible = FALSE;
393 destroy_hildon_actor(actor);
394 actor->time_start_animation = sec + fast_rnd(60);
399 change_plane1(Actor *actor, AWallpaperPlugin *desktop_plugin)
401 gint x0 = 620, y0 = 233,
409 gettimeofday(&tvb, NULL);
413 // fprintf(stderr, "1 %f - %d\n", sec+(double)ms/100000, now);
415 if (scene.daytime != TIME_NIGHT){
416 if (actor->time_start_animation == 0){
417 actor->time_start_animation = sec + probability_plane();
421 if (!actor->visible){
422 actor->visible = TRUE;
423 create_hildon_actor(actor, desktop_plugin);
425 t = (double)((double)sec+(double)ms/1000000 - actor->time_start_animation) / actor->duration_animation;
426 x = path_line(x0, x1, t);
427 y = path_line(y0, y1, t);
428 //scale = path_line(scale0, scale1, t);
429 //fprintf(stderr, "change tram t=%f x=%d y=%d scale=%d\n", t, x, y, scale);
430 actor_set_position_full(actor->widget, x, y, actor->z);
431 //hildon_animation_actor_set_scale(HILDON_ANIMATION_ACTOR(actor->widget), (double)scale/100, (double)scale/100);
434 actor->visible = FALSE;
435 destroy_hildon_actor(actor);
436 if (scene.daytime == TIME_NIGHT)
437 actor->time_start_animation = 0;
439 actor->time_start_animation = sec + probability_plane();
445 change_plane2(Actor *actor, AWallpaperPlugin *desktop_plugin)
447 gint x0 = -actor->width, y0 = 45,
455 gettimeofday(&tvb, NULL);
459 // fprintf(stderr, "1 %f - %d\n", sec+(double)ms/100000, now);
460 if (scene.daytime != TIME_NIGHT){
461 if (actor->time_start_animation == 0){
462 actor->time_start_animation = sec + probability_plane();
466 if (!actor->visible){
467 actor->visible = TRUE;
468 create_hildon_actor(actor, desktop_plugin);
471 t = (double)((double)sec+(double)ms/1000000 - actor->time_start_animation) / actor->duration_animation;
472 x = path_line(x0, x1, t);
473 y = path_line(y0, y1, t);
474 //scale = path_line(scale0, scale1, t);
475 //fprintf(stderr, "change tram t=%f x=%d y=%d scale=%d\n", t, x, y, scale);
476 actor_set_position_full(actor->widget, x, y, actor->z);
477 //hildon_animation_actor_set_scale(HILDON_ANIMATION_ACTOR(actor->widget), (double)scale/100, (double)scale/100);
480 actor->visible = FALSE;
481 destroy_hildon_actor(actor);
482 if (scene.daytime == TIME_NIGHT)
483 actor->time_start_animation = 0;
485 actor->time_start_animation = sec + probability_plane();
491 change_cloud(Actor *actor, AWallpaperPlugin *desktop_plugin)
493 gint x0, y0 = 300, scale0 = 100,
494 x1, y1 = -actor->height, scale1 = 150,
502 //fprintf(stderr, "change cloud\n");
503 gettimeofday(&tvb, NULL);
507 //fprintf(stderr, "c1oud %s - y0=%d\n", actor->name, actor->y);
509 if (!actor->visible){
510 actor->visible = TRUE;
511 if (scene.daytime == TIME_NIGHT){
512 newfile = g_strdup_printf("%s_dark.png", actor->name);
514 newfile = g_strdup_printf("%s.png", actor->name);
517 g_free(actor->filename);
518 actor->filename = newfile;
520 create_hildon_actor(actor, desktop_plugin);
522 t = (double)((double)sec+(double)ms/1000000 - actor->time_start_animation) / actor->duration_animation;
524 if (scene.wind_orientation == 1){
533 x = path_line(x0, x1, t);
534 y = -scene.wind_angle * (x - x0) + actor->y;
535 scale = path_line(scale0, scale1, (double)(y - y0)/(y1 - y0));
537 //fprintf(stderr, "change cloud t=%f x=%d y=%d scale=%d\n", t, x, y, scale);
538 actor_set_position_full(actor->widget, x, y, actor->z);
539 hildon_animation_actor_set_scale(HILDON_ANIMATION_ACTOR(actor->widget), (double)scale/100, (double)scale/100);
540 if ((y < y1 || y > y0) || t >= 1){
542 actor->visible = FALSE;
543 destroy_hildon_actor(actor);
544 actor->time_start_animation = sec + fast_rnd(300);
545 actor->y = fast_rnd(300);
551 change_wind(Actor *actor, AWallpaperPlugin *desktop_plugin)
553 scene.wind_orientation = fast_rnd(2);
554 if (scene.wind_orientation == 0) scene.wind_orientation = -1;
555 scene.wind_angle = (double)(fast_rnd(200) - 100) / 100;
556 actor->time_start_animation = time(NULL) + (fast_rnd(10) + 10) * 60;
557 //fprintf(stderr, "change wind orient = %d angle = %f after = %d\n", scene.wind_orientation, scene.wind_angle, actor->time_start_animation-time(NULL));
561 change_window1(Actor * actor, AWallpaperPlugin *desktop_plugin)
563 gint now = time(NULL);
564 if (scene.daytime == TIME_DAY){
566 actor->visible = FALSE;
567 destroy_hildon_actor(actor);
569 actor->time_start_animation = 0;
573 create_hildon_actor(actor, desktop_plugin);
574 if (actor->time_start_animation == 0){
575 actor->time_start_animation = now + fast_rnd(30);
581 actor->visible = TRUE;
583 actor->visible = FALSE;
584 hildon_animation_actor_set_show(
585 HILDON_ANIMATION_ACTOR(actor->widget),
588 actor->time_start_animation = now + fast_rnd(60) + 10;
593 change_signal(Actor * actor, AWallpaperPlugin *desktop_plugin)
595 gint now = time(NULL);
599 gint now = time(NULL);
600 newfile = g_strdup_printf("%s%d.png", actor->name, scene.daytime);
601 if (!strcmp(actor->filename, "red.png"))
602 newfile = g_strdup_printf("%s", "green.png");
604 newfile = g_strdup_printf("%s", "red.png");
605 g_free(actor->filename);
606 actor->filename = newfile;
607 change_hildon_actor(actor, desktop_plugin);
608 actor->time_start_animation = now + fast_rnd(30) + 10;
610 a = g_ptr_array_index(actor->child, 0);
611 //fprintf(stderr, "actor name= %p \n", child->widget);
616 hildon_animation_actor_set_show (HILDON_ANIMATION_ACTOR(a->widget), a->visible);
618 a = g_ptr_array_index(actor->child, 1);
619 //fprintf(stderr, "actor name= %s \n", child->name);
624 hildon_animation_actor_set_show (HILDON_ANIMATION_ACTOR(a->widget), a->visible);
626 actor->time_start_animation = now + fast_rnd(30) + 10;
630 create_hildon_actor(Actor *actor, AWallpaperPlugin *desktop_plugin)
632 GtkWidget *ha = NULL;
633 GdkPixbuf *pixbuf = NULL;
634 GtkWidget *image = NULL;
637 ha = hildon_animation_actor_new();
638 str = g_strdup_printf( "%s/%s/%s", THEME_PATH,
639 desktop_plugin->priv->theme, actor->filename);
640 pixbuf = gdk_pixbuf_new_from_file_at_size (str,
644 /*fprintf(stderr, "create_hildon_actor %s %s\n", actor->name, str);*/
648 image = gtk_image_new_from_pixbuf (pixbuf);
649 g_object_unref(G_OBJECT(pixbuf));
652 g_signal_connect(G_OBJECT(image), "expose_event",
653 G_CALLBACK(expose_event), pixbuf);
654 gtk_container_add (GTK_CONTAINER (ha), image);
656 actor_set_position_full(ha, actor->x, actor->y, actor->z);
657 hildon_animation_actor_set_scale(HILDON_ANIMATION_ACTOR(ha), (double)actor->scale/100, (double)actor->scale/100);
659 gtk_widget_show_all(ha);
660 hildon_animation_actor_set_show (HILDON_ANIMATION_ACTOR(ha), actor->visible);
665 //g_object_set_data(G_OBJECT(ha), "name", name);
666 //g_object_set_data(G_OBJECT(ha), "filename", filename);
667 g_object_set_data(G_OBJECT(ha), "image", image);
669 g_object_set_data(G_OBJECT(ha), "x", x);
670 g_object_set_data(G_OBJECT(ha), "y", y);
671 g_object_set_data(G_OBJECT(ha), "z", z);
672 g_object_set_data(G_OBJECT(ha), "width", width);
673 g_object_set_data(G_OBJECT(ha), "height", height);
674 g_object_set_data(G_OBJECT(ha), "scale", scale);
675 g_object_set_data(G_OBJECT(ha), "visible", visible);
676 g_object_set_data(G_OBJECT(ha), "opacity", opacity);
677 g_object_set_data(G_OBJECT(ha), "func", pfunc);
679 hildon_animation_actor_set_parent (HILDON_ANIMATION_ACTOR (ha), GTK_WINDOW(desktop_plugin));
685 change_hildon_actor(Actor *actor, AWallpaperPlugin *desktop_plugin)
687 GtkWidget *image = NULL;
688 GdkPixbuf *pixbuf = NULL;
691 str = g_strdup_printf( "%s/%s/%s", THEME_PATH,
692 desktop_plugin->priv->theme, actor->filename);
694 pixbuf = gdk_pixbuf_new_from_file_at_size (str,
701 image = gtk_image_new_from_pixbuf (pixbuf);
702 g_object_unref(G_OBJECT(pixbuf));
705 g_signal_connect(G_OBJECT(image), "expose_event",
706 G_CALLBACK(expose_event), pixbuf);
707 if (g_object_get_data(G_OBJECT(actor->widget), "image")){
708 gtk_container_remove(GTK_CONTAINER(actor->widget), g_object_get_data(G_OBJECT(actor->widget), "image"));
710 g_object_set_data(G_OBJECT(actor->widget), "image", image);
711 gtk_container_add (GTK_CONTAINER (actor->widget), image);
712 realize(actor->widget);
713 gtk_widget_show_all(actor->widget);
724 change_static_actor(Actor * actor, AWallpaperPlugin *desktop_plugin)
727 newfile = g_strdup_printf("%s%d.png", actor->name, scene.daytime);
729 g_free(actor->filename);
730 actor->filename = newfile;
731 change_hildon_actor(actor, desktop_plugin);
735 change_static_actor_with_corner(Actor * actor, AWallpaperPlugin *desktop_plugin)
739 if (desktop_plugin->priv->right_corner)
740 gtk_widget_destroy(desktop_plugin->priv->right_corner);
741 snprintf(buffer, sizeof(buffer) - 1, "%s/%s/town%i_right_corner.png", \
742 THEME_PATH, desktop_plugin->priv->theme, scene.daytime);
743 desktop_plugin->priv->right_corner = gtk_image_new_from_file (buffer);
744 if (desktop_plugin->priv->right_corner){
745 gtk_fixed_put(GTK_FIXED(desktop_plugin->priv->main_widget), desktop_plugin->priv->right_corner, 0, 0);
746 gtk_widget_show (desktop_plugin->priv->right_corner);
748 change_static_actor(actor, desktop_plugin);
753 change_layer(Actor * actor, AWallpaperPlugin *desktop_plugin)
758 a = g_ptr_array_index(actor->child, 0);
760 if (y > 480) y = -480;
761 //fprintf(stderr, "!! %s - %d\n", actor->name, y);
762 actor_set_position_full(a->widget, a->x, y, a->z);
765 a = g_ptr_array_index(actor->child, 1);
767 if (y > 480) y = -480;
768 //fprintf(stderr, "!! %s - %d\n", actor->name, y);
769 actor_set_position_full(a->widget, a->x, y, a->z);
772 a = g_ptr_array_index(actor->child, 2);
774 if (y > 480) y = -480;
775 //fprintf(stderr, "!! %s - %d\n", actor->name, y);
776 actor_set_position_full(a->widget, a->x, y, a->z);
779 a = g_ptr_array_index(actor->child, 3);
781 if (y > 480) y = -480;
782 //fprintf(stderr, "!! %s - %d\n", actor->name, y);
783 actor_set_position_full(a->widget, a->x, y, a->z);
789 change_layer1(Actor * actor, AWallpaperPlugin *desktop_plugin)
793 if (y > 480) y = -480;
794 //fprintf(stderr, "!! %s - %d\n", actor->name, y);
795 actor_set_position_full(actor->widget, actor->x, y, actor->z);
800 change_layer2(Actor * actor, AWallpaperPlugin *desktop_plugin)
804 if (y >= 480) y = -480;
805 //fprintf(stderr, "!! %s - %d\n", actor->name, y);
806 actor_set_position_full(actor->widget, actor->x, y, actor->z);
813 // уравнение изменения времени
819 GSList * tmp = scene.actors;
825 g_ptr_array_free(actor->child, TRUE);
828 g_free(actor->filename);
831 gtk_widget_destroy(actor->widget);
832 //actor->widget = NULL;
835 tmp = g_slist_next(tmp);
842 reload_scene(AWallpaperPlugin *desktop_plugin)
844 fprintf(stderr,"Reload scene %s\n", desktop_plugin->priv->theme);
846 if (!strcmp(desktop_plugin->priv->theme,"Modern"))
847 init_scene(desktop_plugin);
848 else if (!strcmp(desktop_plugin->priv->theme,"Berlin"))
849 init_scene1(desktop_plugin);
850 else if (!strcmp(desktop_plugin->priv->theme,"Matrix"))
851 init_scene2(desktop_plugin);
856 init_scene2(AWallpaperPlugin *desktop_plugin)
860 gint now = time(NULL);
862 fprintf(stderr, "init scene2 \n");
863 //scene.daytime = get_daytime();
867 actor = init_object(desktop_plugin, "background", "bg.png",
869 TRUE, TRUE, 100, 255,
871 scene.actors = g_slist_append(scene.actors, actor);
873 actor = init_object(desktop_plugin, "symbols", "symbols.png",
875 TRUE, TRUE, 100, 255,
877 scene.actors = g_slist_append(scene.actors, actor);
879 child = g_ptr_array_sized_new(4);
880 actor = init_object(desktop_plugin, "layer1", "layer1_2.png",
881 0, -480, 6, 800, 960,
882 TRUE, TRUE, 100, 255,
884 //actor->time_start_animation = now;
885 //actor->duration_animation = G_MAXINT;
886 scene.actors = g_slist_append(scene.actors, actor);
887 g_ptr_array_add(child, actor);
889 actor = init_object(desktop_plugin, "layer1", "layer1_1.png",
890 0, (-480 - 480), 7, 800, 960,
891 TRUE, TRUE, 100, 255,
893 //actor->time_start_animation = now;
894 //actor->duration_animation = G_MAXINT;
895 scene.actors = g_slist_append(scene.actors, actor);
896 g_ptr_array_add(child, actor);
898 actor = init_object(desktop_plugin, "layer2", "layer2_2.png",
899 0, -480, 8, 800, 960,
900 TRUE, TRUE, 100, 255,
902 //actor->time_start_animation = now;
903 //actor->duration_animation = G_MAXINT;
904 scene.actors = g_slist_append(scene.actors, actor);
905 g_ptr_array_add(child, actor);
907 actor = init_object(desktop_plugin, "layer2", "layer2_1.png",
908 0, (-480 - 480), 9, 800, 960,
909 TRUE, TRUE, 100, 255,
911 //actor->time_start_animation = now;
912 //actor->duration_animation = G_MAXINT;
913 scene.actors = g_slist_append(scene.actors, actor);
914 g_ptr_array_add(child, actor);
916 actor = init_object(desktop_plugin, "layers", "",
917 0, (-480 - 480), 9, 800, 960,
918 FALSE, FALSE, 100, 255,
919 (gpointer)&change_layer, NULL, child);
920 actor->time_start_animation = now;
921 actor->duration_animation = G_MAXINT;
922 scene.actors = g_slist_append(scene.actors, actor);
924 run_long_timeout(desktop_plugin);
927 /* Init Modern Scene */
929 init_scene(AWallpaperPlugin *desktop_plugin)
932 gint now = time(NULL);
936 /* fprintf(stderr, "init scene \n");*/
937 scene.daytime = get_daytime();
939 scene.wind_orientation = -1;
940 scene.wind_angle = 0.3;
941 /* init value for random */
942 scene.seed = time(NULL);
944 actor = init_object(desktop_plugin, "sky", "sky0.png",
946 TRUE , TRUE, 100, 255,
947 (gpointer)&change_static_actor, NULL, NULL);
948 change_static_actor(actor, desktop_plugin);
949 scene.actors = g_slist_append(scene.actors, actor);
951 actor = init_object(desktop_plugin, "sun", "sun.png",
953 FALSE, FALSE, 100, 255,
954 (gpointer)&change_sun, (gpointer)&probability_sun, NULL);
955 actor->time_start_animation = now;
956 actor->duration_animation = G_MAXINT;
957 change_sun(actor, desktop_plugin);
958 scene.actors = g_slist_append(scene.actors, actor);
960 //actor = init_object(desktop_plugin, "dot", "dot1.png", 0, 0, 11, 50, 50,
961 // TRUE, 100, 255, NULL, NULL);
962 //scene.actors = g_slist_append(scene.actors, actor);
964 actor = init_object(desktop_plugin, "cloud1", "cloud1.png",
965 0, fast_rnd(300)-97, 7, 150, 97,
966 FALSE, FALSE, 100, 255,
967 (gpointer)&change_cloud, NULL, NULL);
968 actor->time_start_animation = now + fast_rnd(20);
969 actor->duration_animation = 3*60;
970 scene.actors = g_slist_append(scene.actors, actor);
972 actor = init_object(desktop_plugin, "cloud2", "cloud2.png",
973 0, fast_rnd(300)-75, 7, 188, 75,
974 FALSE, FALSE, 100, 255,
975 (gpointer)&change_cloud, NULL, NULL);
976 actor->time_start_animation = now + fast_rnd(40)+10;
977 actor->duration_animation = 3*60;
978 scene.actors = g_slist_append(scene.actors, actor);
980 actor = init_object(desktop_plugin, "cloud4", "cloud4.png",
981 0, fast_rnd(300)-75, 7, 150, 75,
982 FALSE, FALSE, 100, 255,
983 (gpointer)&change_cloud, NULL, NULL);
984 actor->time_start_animation = now + fast_rnd(60) + 20;
985 actor->duration_animation = 5*60;
986 scene.actors = g_slist_append(scene.actors, actor);
989 actor = init_object(desktop_plugin, "town", "town0.png",
991 TRUE, TRUE, 100, 255,
992 (gpointer)&change_static_actor, NULL, NULL);
993 change_static_actor(actor, desktop_plugin);
994 scene.actors = g_slist_append(scene.actors, actor);
996 actor = init_object(desktop_plugin, "tram", "tram.png",
997 -300, 225, 9, 350, 210,
998 FALSE, FALSE, 100, 255,
999 (gpointer)&change_tram, NULL, NULL);
1000 actor->time_start_animation = time(NULL) + fast_rnd(10);
1001 actor->duration_animation = 60;
1002 scene.actors = g_slist_append(scene.actors, actor);
1004 actor = init_object(desktop_plugin, "border", "border0.png",
1005 0, 480-79, 10, 800, 79,
1006 TRUE, TRUE, 100, 255,
1007 (gpointer)&change_static_actor_with_corner, NULL, NULL);
1008 change_static_actor_with_corner(actor, desktop_plugin);
1009 scene.actors = g_slist_append(scene.actors, actor);
1011 actor = init_object(desktop_plugin, "moon", "moon1.png",
1013 FALSE, FALSE, 100, 255,
1014 (gpointer)&change_moon, NULL, NULL);
1015 change_moon(actor, desktop_plugin);
1016 scene.actors = g_slist_append(scene.actors, actor);
1018 actor = init_object(desktop_plugin, "wind", "",
1020 FALSE, FALSE, 100, 255,
1021 (gpointer)&change_wind, NULL, NULL);
1022 change_wind(actor, desktop_plugin);
1023 scene.actors = g_slist_append(scene.actors, actor);
1025 /* windows in 4-th house */
1065 for (i=0; i<13; i++){
1066 actor = init_object(desktop_plugin, "window1", "window1.png",
1067 winds[i][0], winds[i][1], 8, 8, 10,
1068 FALSE, FALSE, 100, 255,
1069 (gpointer)&change_window1, NULL, NULL);
1070 //change_window1(actor, desktop_plugin);
1071 actor->time_start_animation = now + fast_rnd(30);
1072 scene.actors = g_slist_append(scene.actors, actor);
1076 /* windows in 1-th house */
1101 for (i=0; i<8; i++){
1102 actor = init_object(desktop_plugin, "window2", "window2.png",
1103 winds[i][0], winds[i][1], 8, 8, 10,
1104 FALSE, FALSE, 100, 255,
1105 (gpointer)&change_window1, NULL, NULL);
1106 //change_window1(actor, desktop_plugin);
1107 actor->time_start_animation = now + fast_rnd(30);
1108 scene.actors = g_slist_append(scene.actors, actor);
1112 /* windows in 3-th house */
1144 for (i=0; i<10; i++){
1145 actor = init_object(desktop_plugin, "window3", "window3.png",
1146 winds[i][0], winds[i][1], 8, 8, 10,
1147 FALSE, FALSE, 100, 255,
1148 (gpointer)&change_window1, NULL, NULL);
1149 //change_window1(actor, desktop_plugin);
1150 actor->time_start_animation = now + fast_rnd(30);
1151 scene.actors = g_slist_append(scene.actors, actor);
1155 /* windows in 5-th house */
1178 for (i=0; i<7; i++){
1179 actor = init_object(desktop_plugin, "window4", "window4.png",
1180 winds[i][0], winds[i][1], 8, 8, 10,
1181 FALSE, FALSE, 100, 255,
1182 (gpointer)&change_window1, NULL, NULL);
1183 //change_window1(actor, desktop_plugin);
1184 actor->time_start_animation = now + fast_rnd(30);
1185 scene.actors = g_slist_append(scene.actors, actor);
1189 /* windows in 6-th house */
1209 for (i=0; i<6; i++){
1210 actor = init_object(desktop_plugin, "window5", "window5.png",
1211 winds[i][0], winds[i][1], 8, 8, 10,
1212 FALSE, FALSE, 100, 255,
1213 (gpointer)&change_window1, NULL, NULL);
1214 //change_window1(actor, desktop_plugin);
1215 actor->time_start_animation = now + fast_rnd(30);
1216 scene.actors = g_slist_append(scene.actors, actor);
1220 run_long_timeout(desktop_plugin);
1223 anim = g_new0(Animation, 1);
1225 anim->actor = actor;
1226 anim->func_change = &change_tram;
1227 anim->func_time = NULL;
1228 anim->timestart = time(NULL);
1231 scene.dynamic_actors = g_slist_append(scene.dynamic_actors, anim);
1235 /* Init Berlin Scene */
1237 init_scene1(AWallpaperPlugin *desktop_plugin)
1239 Actor *actor, *actor1, *actor2;
1240 gint now = time(NULL);
1243 GPtrArray *child = NULL;
1245 scene.daytime = get_daytime();
1246 scene.actors = NULL;
1247 scene.wind_orientation = -1;
1248 scene.wind_angle = 0.3;
1249 /* init value for random */
1250 scene.seed = time(NULL);
1253 actor = init_object(desktop_plugin, "sky", "sky.png", 0, 0, 5, 800, 480,
1254 TRUE, TRUE, 100, 255,
1255 (gpointer)&change_static_actor, NULL, NULL);
1256 change_static_actor(actor, desktop_plugin);
1257 scene.actors = g_slist_append(scene.actors, actor);
1260 actor = init_object(desktop_plugin, "sun", "sun.png", 0, 0, 6, 88, 88,
1261 FALSE, FALSE, 100, 255,
1262 (gpointer)&change_sun, (gpointer)&probability_sun, NULL);
1263 actor->time_start_animation = time(NULL);
1264 actor->duration_animation = G_MAXINT;
1265 change_sun(actor, desktop_plugin);
1266 scene.actors = g_slist_append(scene.actors, actor);
1269 actor = init_object(desktop_plugin, "dot", "dot1.png", 0, 0, 11, 50, 50,
1270 TRUE, 100, 255, NULL, NULL);
1271 scene.actors = g_slist_append(scene.actors, actor);
1274 actor = init_object(desktop_plugin, "moon", "moon1.png", 400, 15, 6, 60, 60,
1275 FALSE, FALSE, 100, 255,
1276 (gpointer)&change_moon, NULL, NULL);
1277 change_moon(actor, desktop_plugin);
1278 scene.actors = g_slist_append(scene.actors, actor);
1280 actor = init_object(desktop_plugin, "cloud1", "cloud1.png", 0, fast_rnd(300)-97, 7, 150, 97,
1281 FALSE, FALSE, 100, 255,
1282 (gpointer)&change_cloud, NULL, NULL);
1283 actor->time_start_animation = now + fast_rnd(180);
1284 actor->duration_animation = 3*60;
1285 scene.actors = g_slist_append(scene.actors, actor);
1287 actor = init_object(desktop_plugin, "cloud2", "cloud2.png", 0, fast_rnd(300)-75, 7, 188, 75,
1288 FALSE, FALSE, 100, 255,
1289 (gpointer)&change_cloud, NULL, NULL);
1290 actor->time_start_animation = now + fast_rnd(180);
1291 actor->duration_animation = 3*60;
1292 scene.actors = g_slist_append(scene.actors, actor);
1294 actor = init_object(desktop_plugin, "cloud4", "cloud4.png", 0, fast_rnd(300)-75, 7, 150, 75,
1295 FALSE, FALSE, 100, 255,
1296 (gpointer)&change_cloud, NULL, NULL);
1297 actor->time_start_animation = now + fast_rnd(180);
1298 actor->duration_animation = 5*60;
1299 scene.actors = g_slist_append(scene.actors, actor);
1302 actor = init_object(desktop_plugin, "plane2", "plane3.png", 0, 45, 8, 160, 50,
1303 FALSE, FALSE, 100, 255,
1304 (gpointer)&change_plane2, NULL, NULL);
1305 actor->time_start_animation = now + probability_plane();
1306 actor->duration_animation = 60;
1307 scene.actors = g_slist_append(scene.actors, actor);
1309 actor = init_object(desktop_plugin, "plane1", "tu154.png", 620, 233, 9, 300, 116,
1310 FALSE, FALSE, 100, 255,
1311 (gpointer)&change_plane1, NULL, NULL);
1312 actor->time_start_animation = now + probability_plane();
1313 actor->duration_animation = 30;
1314 scene.actors = g_slist_append(scene.actors, actor);
1316 actor = init_object(desktop_plugin, "town", "town.png", 0, 0, 10, 800, 480,
1317 TRUE, TRUE, 100, 255,
1318 (gpointer)&change_static_actor_with_corner, NULL, NULL);
1319 change_static_actor_with_corner(actor, desktop_plugin);
1320 scene.actors = g_slist_append(scene.actors, actor);
1322 actor = init_object(desktop_plugin, "wind", "", 0, 0, 5, 0, 0,
1323 FALSE, FALSE, 100, 255,
1324 (gpointer)&change_wind, NULL, NULL);
1325 change_wind(actor, desktop_plugin);
1326 scene.actors = g_slist_append(scene.actors, actor);
1328 actor1 = init_object(desktop_plugin, "signal_red", "red.png",
1329 486, 425, 10, 18, 38,
1330 FALSE, TRUE, 100, 255, NULL, NULL, NULL);
1331 //actor->time_start_animation = now + fast_rnd(30) + 10;
1332 scene.actors = g_slist_append(scene.actors, actor1);
1334 actor2 = init_object(desktop_plugin, "signal_green", "green.png",
1335 486, 425, 10, 18, 38,
1336 TRUE, TRUE, 100, 255, NULL, NULL, NULL);
1337 //actor->time_start_animation = now + fast_rnd(30) + 10;
1338 scene.actors = g_slist_append(scene.actors, actor2);
1339 child = g_ptr_array_sized_new(2);
1340 g_ptr_array_add(child, actor1);
1341 g_ptr_array_add(child, actor2);
1342 actor = init_object(desktop_plugin, "signal", "",
1343 486, 425, 10, 18, 38,
1344 FALSE, FALSE, 100, 255,
1345 (gpointer)&change_signal, NULL, child);
1346 actor->time_start_animation = now + fast_rnd(30) + 10;
1347 scene.actors = g_slist_append(scene.actors, actor);
1388 for (i=0; i<13; i++){
1389 actor = init_object(desktop_plugin, "window", "window.png",
1390 winds[i][0], winds[i][1], 10, 8, 9,
1391 FALSE, TRUE, 100, 255,
1392 (gpointer)&change_window1, NULL, NULL);
1393 //change_window1(actor, desktop_plugin);
1394 actor->time_start_animation = now + fast_rnd(30);
1395 scene.actors = g_slist_append(scene.actors, actor);
1399 run_long_timeout(desktop_plugin);
1405 get_sun_screen_pos(double alt, double azm, gint * x, gint * y)
1407 gint y0 = 365;// - уровень горизонта
1408 *x = (int)(azm * 800) - 64;
1409 *y = (int)((1 - alt) * y0) - 64;
1410 //fprintf(stderr, "sun pos alt=%f azm=%f x=%d y=%d\n", alt, azm, *x, *y);
1414 change_actor(GtkWidget * actor)
1417 gint x, y, daytime, scale;
1424 void (*pfunc)(gpointer, gpointer);
1426 name = g_object_get_data(G_OBJECT(actor), "name");
1427 fprintf(stderr, "change actor %s\n", name);
1429 pfunc = g_object_get_data(G_OBJECT(actor), "func");
1431 (*pfunc)(actor, g_strdup(name));
1432 daytime = get_daytime();
1433 if (daytime != TIME_NIGHT){
1434 hildon_animation_actor_set_show(actor, 1);
1435 get_sun_pos(&alt, &azm);
1436 get_sun_screen_pos(alt, azm, &x, &y);
1437 actor_set_position_full(actor, x, y, g_object_get_data(G_OBJECT(actor), "z"));
1441 if (name == "cloud1"){
1442 x = g_object_get_data(G_OBJECT(actor), "x");
1443 y = g_object_get_data(G_OBJECT(actor), "y");
1444 scale = g_object_get_data(G_OBJECT(actor), "scale");
1447 image = g_object_get_data(G_OBJECT(actor), "image");
1449 gtk_container_remove(actor, image);
1450 pixbuf = gdk_pixbuf_new_from_file_at_size ("/usr/share/livewp/theme/Modern/sun.png",
1455 image = gtk_image_new_from_pixbuf (pixbuf);
1456 g_object_unref(G_OBJECT(pixbuf));
1458 g_signal_connect(G_OBJECT(image), "expose_event",
1459 G_CALLBACK(expose_event), pixbuf);
1460 gtk_container_add (GTK_CONTAINER (actor), image);
1462 gtk_widget_show_all(actor);
1474 sc = (double)scale / 100;
1475 hildon_animation_actor_set_scale(actor, sc, sc);
1476 fprintf(stderr, "cloud x=%d y=%d scale=%f", x, y, sc);
1477 actor_set_position_full(actor, x, y, g_object_get_data(G_OBJECT(actor), "z"));
1478 g_object_set_data(G_OBJECT(actor), "x", x);
1479 g_object_set_data(G_OBJECT(actor), "y", y);
1480 g_object_set_data(G_OBJECT(actor), "scale", scale);
1486 short_timeout (AWallpaperPlugin *desktop_plugin)
1488 //gint daytime = get_daytime();
1490 void (*pfunc)(gpointer, gpointer);
1493 gboolean stop_flag = TRUE;
1495 if (!desktop_plugin->priv->visible || !desktop_plugin->priv->rich_animation){
1496 desktop_plugin->priv->short_timer = 0;
1501 //scene.daytime = daytime;
1502 /* fprintf(stderr, "Short timer %d\n", now); */
1504 while (tmp != NULL){
1506 if (now >= actor->time_start_animation
1507 && actor->time_start_animation > 0
1508 /* && now - actor->time_start_animation <= actor->duration_animation*/){
1509 pfunc = actor->func_change;
1511 (*pfunc)(actor, desktop_plugin);
1515 tmp = g_slist_next(tmp);
1518 desktop_plugin->priv->short_timer = 0;
1521 return TRUE; /* keep running this event */
1525 run_long_timeout(AWallpaperPlugin *desktop_plugin)
1528 gint daytime = get_daytime();
1530 void (*pfunc)(gpointer, gpointer);
1535 //fprintf(stderr, "!!!run long timeout short_timer=%d\n", desktop_plugin->priv->short_timer);
1536 if (scene.daytime != daytime){
1537 scene.daytime = daytime;
1539 while (tmp != NULL){
1540 //change_actor(tmp->data);
1541 pfunc =((Actor*)tmp->data)->func_change;
1543 (*pfunc)(tmp->data, desktop_plugin);
1545 tmp = g_slist_next(tmp);
1550 //fprintf(stderr, "Now %d\n", now);
1552 while (tmp != NULL){
1554 if (now >= actor->time_start_animation
1555 && actor->time_start_animation > 0
1556 && desktop_plugin->priv->short_timer == 0){
1557 /* fprintf(stderr, "start short timer act = %s %d\n", actor->name, now); */
1558 if (desktop_plugin->priv->rich_animation){
1559 actor->time_start_animation = now;
1560 desktop_plugin->priv->short_timer = g_timeout_add(SHORT_TIMER, (GtkFunction)short_timeout, desktop_plugin);
1563 (*actor->func_change)(actor, desktop_plugin);
1566 tmp = g_slist_next(tmp);
1572 long_timeout (AWallpaperPlugin *desktop_plugin)
1574 /* fprintf(stderr, "long_timeout %i\n", desktop_plugin->priv->long_timer); */
1575 if (desktop_plugin->priv->long_timer == 0 )
1577 if (!desktop_plugin->priv->visible){
1578 if(desktop_plugin->priv->short_timer != 0){
1579 g_source_remove(desktop_plugin->priv->short_timer);
1580 desktop_plugin->priv->short_timer = 0;
1582 desktop_plugin->priv->long_timer = 0;
1587 run_long_timeout(desktop_plugin);
1588 return TRUE; /* keep running this event */
1592 desktop_plugin_visible_notify (GObject *object,
1594 AWallpaperPlugin *desktop_plugin)
1597 g_object_get (object, "is-on-current-desktop", &visible, NULL);
1598 /* fprintf (stderr, "is-on-current-desktop changed. visible: %u", visible); */
1600 desktop_plugin->priv->visible = TRUE;
1601 if (desktop_plugin->priv->long_timer == 0 ){
1602 desktop_plugin->priv->long_timer = g_timeout_add(LONG_TIMER, (GtkFunction)long_timeout, desktop_plugin);
1603 run_long_timeout(desktop_plugin);
1606 desktop_plugin->priv->visible = FALSE;
1607 if (desktop_plugin->priv->long_timer != 0 ){
1608 g_source_remove(desktop_plugin->priv->long_timer);
1609 desktop_plugin->priv->long_timer = 0;
1615 rich_animation_press(GtkWidget *widget, GdkEvent *event,
1616 gpointer user_data){
1617 fprintf(stderr,"gggggggggggggggggggg2222\n");
1621 animation_wallpaper_plugin_init (AWallpaperPlugin *desktop_plugin)
1623 GtkWidget *rich_animation;
1627 fprintf(stderr, "!!!!!!!plugin init \n");
1628 Animation_WallpaperPrivate *priv = Animation_Wallpaper_HOME_PLUGIN_GET_PRIVATE (desktop_plugin);
1629 desktop_plugin->priv = Animation_Wallpaper_HOME_PLUGIN_GET_PRIVATE (desktop_plugin);
1630 priv->osso = osso_initialize(PACKAGE, VERSION, TRUE, NULL);
1634 /* Initialize DBUS */
1635 livewp_initialize_dbus(priv);
1637 priv->desktop_plugin = desktop_plugin;
1638 priv->visible = TRUE;
1639 priv->short_timer = 0;
1640 priv->theme = g_strdup("Modern");
1641 desktop_plugin->priv->main_widget = gtk_fixed_new();
1643 gtk_widget_set_size_request(desktop_plugin->priv->main_widget, 100, 32);
1644 desktop_plugin->priv->right_corner = NULL;
1645 snprintf(buffer, sizeof(buffer) - 1, "%s/%s/%s", THEME_PATH, desktop_plugin->priv->theme, "town0_right_corner.png");
1646 desktop_plugin->priv->right_corner = gtk_image_new_from_file (buffer);
1647 if (desktop_plugin->priv->right_corner){
1648 gtk_fixed_put(GTK_FIXED(desktop_plugin->priv->main_widget), desktop_plugin->priv->right_corner, 0, 0);
1649 gtk_widget_show (desktop_plugin->priv->right_corner);
1651 /* Create rich animation event */
1652 rich_animation = gtk_event_box_new();
1654 gtk_widget_set_events(rich_animation, GDK_BUTTON_PRESS_MASK);
1655 gtk_event_box_set_visible_window(GTK_EVENT_BOX(rich_animation), FALSE);
1656 gtk_widget_set_size_request(rich_animation, 100, 32);
1657 gtk_widget_show (rich_animation);
1658 g_signal_connect(rich_animation, "button-press-event", G_CALLBACK(rich_animation_press), desktop_plugin);
1659 gtk_fixed_put(GTK_FIXED(desktop_plugin->priv->main_widget), rich_animation, 0, 0);
1662 GtkWidget *label = gtk_label_new ("ddddddddddddd");
1663 gtk_widget_set_size_request(label, 95, 30);
1664 gtk_widget_show (label);
1665 // gtk_container_add (GTK_CONTAINER (desktop_plugin), label);
1666 gtk_fixed_put(GTK_FIXED(widget), label, 0, 0);
1668 hd_home_plugin_item_set_settings (HD_HOME_PLUGIN_ITEM (desktop_plugin), TRUE);
1669 g_signal_connect (desktop_plugin, "show-settings",
1670 G_CALLBACK (show_settings), priv);
1671 gtk_widget_show (desktop_plugin->priv->main_widget);
1672 gtk_container_add (GTK_CONTAINER (desktop_plugin), desktop_plugin->priv->main_widget);
1673 init_applet_position();
1676 fprintf(stderr, "!!!theme = %s\n", priv->theme);
1677 if (!strcmp(priv->theme,"Modern"))
1678 init_scene(desktop_plugin);
1679 else if (!strcmp(priv->theme,"Berlin"))
1680 init_scene1(desktop_plugin);
1681 else if (!strcmp(priv->theme, "Matrix"))
1682 init_scene2(desktop_plugin);
1683 priv->long_timer = g_timeout_add(LONG_TIMER, (GtkFunction)long_timeout, desktop_plugin);
1684 /* TODO Move scene to priv */
1685 scene.timer_type = LONG_TIMER_TYPE;
1686 g_signal_connect (desktop_plugin, "notify::is-on-current-desktop",
1687 G_CALLBACK (desktop_plugin_visible_notify), desktop_plugin);
1694 lw_applet_finalize (GObject *object)
1696 AWallpaperPlugin *desktop_plugin = Animation_Wallpaper_HOME_PLUGIN (object);
1697 Animation_WallpaperPrivate *priv = desktop_plugin->priv;
1699 fprintf(stderr,"finalaze %i\n", priv->long_timer);
1700 if (priv->long_timer){
1701 g_source_remove(priv->long_timer);
1702 priv->long_timer = 0;
1704 if (priv->short_timer){
1705 g_source_remove(priv->short_timer);
1706 priv->short_timer = 0;
1713 animation_wallpaper_plugin_class_init (AWallpaperPluginClass *klass) {
1715 GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
1716 GtkObjectClass *gobject_class = GTK_OBJECT_CLASS (klass);
1719 gobject_class->destroy = (gpointer)lw_applet_finalize;
1720 widget_class->realize = lw_applet_realize;
1721 widget_class->expose_event = lw_applet_expose_event;
1723 g_type_class_add_private (klass, sizeof (Animation_WallpaperPrivate));
1728 animation_wallpaper_plugin_class_finalize (AWallpaperPluginClass *class) {