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;
256 return fast_rnd(180);
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 if (!desktop_plugin->priv->rich_animation) return;
760 a = g_ptr_array_index(actor->child, 0);
762 if (y > 480) y = -480;
763 //fprintf(stderr, "!! %s - %d\n", actor->name, y);
764 actor_set_position_full(a->widget, a->x, y, a->z);
767 a = g_ptr_array_index(actor->child, 1);
769 if (y > 480) y = -480;
770 //fprintf(stderr, "!! %s - %d\n", actor->name, y);
771 actor_set_position_full(a->widget, a->x, y, a->z);
774 a = g_ptr_array_index(actor->child, 2);
776 if (y > 480) y = -480;
777 //fprintf(stderr, "!! %s - %d\n", actor->name, y);
778 actor_set_position_full(a->widget, a->x, y, a->z);
781 a = g_ptr_array_index(actor->child, 3);
783 if (y > 480) y = -480;
784 //fprintf(stderr, "!! %s - %d\n", actor->name, y);
785 actor_set_position_full(a->widget, a->x, y, a->z);
791 change_layer1(Actor * actor, AWallpaperPlugin *desktop_plugin)
795 if (y > 480) y = -480;
796 //fprintf(stderr, "!! %s - %d\n", actor->name, y);
797 actor_set_position_full(actor->widget, actor->x, y, actor->z);
802 change_layer2(Actor * actor, AWallpaperPlugin *desktop_plugin)
806 if (y >= 480) y = -480;
807 //fprintf(stderr, "!! %s - %d\n", actor->name, y);
808 actor_set_position_full(actor->widget, actor->x, y, actor->z);
815 // уравнение изменения времени
821 GSList * tmp = scene.actors;
827 g_ptr_array_free(actor->child, TRUE);
830 g_free(actor->filename);
833 gtk_widget_destroy(actor->widget);
834 //actor->widget = NULL;
837 tmp = g_slist_next(tmp);
844 reload_scene(AWallpaperPlugin *desktop_plugin)
846 fprintf(stderr,"Reload scene %s\n", desktop_plugin->priv->theme);
848 if (!strcmp(desktop_plugin->priv->theme,"Modern"))
849 init_scene(desktop_plugin);
850 else if (!strcmp(desktop_plugin->priv->theme,"Berlin"))
851 init_scene1(desktop_plugin);
852 else if (!strcmp(desktop_plugin->priv->theme,"Matrix"))
853 init_scene2(desktop_plugin);
858 init_scene2(AWallpaperPlugin *desktop_plugin)
862 gint now = time(NULL);
865 if (desktop_plugin->priv->rich_animation){
873 fprintf(stderr, "init scene2 \n");
874 //scene.daytime = get_daytime();
878 actor = init_object(desktop_plugin, "background", "bg.png",
880 TRUE, TRUE, 100, 255,
882 scene.actors = g_slist_append(scene.actors, actor);
884 actor = init_object(desktop_plugin, "symbols", "symbols.png",
886 TRUE, TRUE, 100, 255,
888 scene.actors = g_slist_append(scene.actors, actor);
890 child = g_ptr_array_sized_new(4);
891 actor = init_object(desktop_plugin, "layer1", "layer1_2.png",
893 TRUE, TRUE, 100, 255,
895 //actor->time_start_animation = now;
896 //actor->duration_animation = G_MAXINT;
897 scene.actors = g_slist_append(scene.actors, actor);
898 g_ptr_array_add(child, actor);
900 actor = init_object(desktop_plugin, "layer1", "layer1_1.png",
902 TRUE, TRUE, 100, 255,
904 //actor->time_start_animation = now;
905 //actor->duration_animation = G_MAXINT;
906 scene.actors = g_slist_append(scene.actors, actor);
907 g_ptr_array_add(child, actor);
909 actor = init_object(desktop_plugin, "layer2", "layer2_2.png",
911 TRUE, TRUE, 100, 255,
913 //actor->time_start_animation = now;
914 //actor->duration_animation = G_MAXINT;
915 scene.actors = g_slist_append(scene.actors, actor);
916 g_ptr_array_add(child, actor);
918 actor = init_object(desktop_plugin, "layer2", "layer2_1.png",
920 TRUE, TRUE, 100, 255,
922 //actor->time_start_animation = now;
923 //actor->duration_animation = G_MAXINT;
924 scene.actors = g_slist_append(scene.actors, actor);
925 g_ptr_array_add(child, actor);
927 actor = init_object(desktop_plugin, "layers", "",
929 FALSE, FALSE, 100, 255,
930 (gpointer)&change_layer, NULL, child);
931 actor->time_start_animation = now;
932 actor->duration_animation = G_MAXINT;
933 scene.actors = g_slist_append(scene.actors, actor);
935 run_long_timeout(desktop_plugin);
938 /* Init Modern Scene */
940 init_scene(AWallpaperPlugin *desktop_plugin)
943 gint now = time(NULL);
947 /* fprintf(stderr, "init scene \n");*/
948 scene.daytime = get_daytime();
950 scene.wind_orientation = -1;
951 scene.wind_angle = 0.3;
952 /* init value for random */
953 scene.seed = time(NULL);
955 actor = init_object(desktop_plugin, "sky", "sky0.png",
957 TRUE , TRUE, 100, 255,
958 (gpointer)&change_static_actor, NULL, NULL);
959 change_static_actor(actor, desktop_plugin);
960 scene.actors = g_slist_append(scene.actors, actor);
962 actor = init_object(desktop_plugin, "sun", "sun.png",
964 FALSE, FALSE, 100, 255,
965 (gpointer)&change_sun, (gpointer)&probability_sun, NULL);
966 actor->time_start_animation = now;
967 actor->duration_animation = G_MAXINT;
968 change_sun(actor, desktop_plugin);
969 scene.actors = g_slist_append(scene.actors, actor);
971 //actor = init_object(desktop_plugin, "dot", "dot1.png", 0, 0, 11, 50, 50,
972 // TRUE, 100, 255, NULL, NULL);
973 //scene.actors = g_slist_append(scene.actors, actor);
975 actor = init_object(desktop_plugin, "cloud1", "cloud1.png",
976 0, fast_rnd(300)-97, 7, 150, 97,
977 FALSE, FALSE, 100, 255,
978 (gpointer)&change_cloud, NULL, NULL);
979 actor->time_start_animation = now + fast_rnd(20);
980 actor->duration_animation = 3*60;
981 scene.actors = g_slist_append(scene.actors, actor);
983 actor = init_object(desktop_plugin, "cloud2", "cloud2.png",
984 0, fast_rnd(300)-75, 7, 188, 75,
985 FALSE, FALSE, 100, 255,
986 (gpointer)&change_cloud, NULL, NULL);
987 actor->time_start_animation = now + fast_rnd(40)+10;
988 actor->duration_animation = 3*60;
989 scene.actors = g_slist_append(scene.actors, actor);
991 actor = init_object(desktop_plugin, "cloud4", "cloud4.png",
992 0, fast_rnd(300)-75, 7, 150, 75,
993 FALSE, FALSE, 100, 255,
994 (gpointer)&change_cloud, NULL, NULL);
995 actor->time_start_animation = now + fast_rnd(60) + 20;
996 actor->duration_animation = 5*60;
997 scene.actors = g_slist_append(scene.actors, actor);
1000 actor = init_object(desktop_plugin, "town", "town0.png",
1002 TRUE, TRUE, 100, 255,
1003 (gpointer)&change_static_actor, NULL, NULL);
1004 change_static_actor(actor, desktop_plugin);
1005 scene.actors = g_slist_append(scene.actors, actor);
1007 actor = init_object(desktop_plugin, "tram", "tram.png",
1008 -300, 225, 9, 350, 210,
1009 FALSE, FALSE, 100, 255,
1010 (gpointer)&change_tram, NULL, NULL);
1011 actor->time_start_animation = time(NULL) + fast_rnd(10);
1012 actor->duration_animation = 60;
1013 scene.actors = g_slist_append(scene.actors, actor);
1015 actor = init_object(desktop_plugin, "border", "border0.png",
1016 0, 480-79, 10, 800, 79,
1017 TRUE, TRUE, 100, 255,
1018 (gpointer)&change_static_actor_with_corner, NULL, NULL);
1019 change_static_actor_with_corner(actor, desktop_plugin);
1020 scene.actors = g_slist_append(scene.actors, actor);
1022 actor = init_object(desktop_plugin, "moon", "moon1.png",
1024 FALSE, FALSE, 100, 255,
1025 (gpointer)&change_moon, NULL, NULL);
1026 change_moon(actor, desktop_plugin);
1027 scene.actors = g_slist_append(scene.actors, actor);
1029 actor = init_object(desktop_plugin, "wind", "",
1031 FALSE, FALSE, 100, 255,
1032 (gpointer)&change_wind, NULL, NULL);
1033 change_wind(actor, desktop_plugin);
1034 scene.actors = g_slist_append(scene.actors, actor);
1036 /* windows in 4-th house */
1076 for (i=0; i<13; i++){
1077 actor = init_object(desktop_plugin, "window1", "window1.png",
1078 winds[i][0], winds[i][1], 8, 8, 10,
1079 FALSE, FALSE, 100, 255,
1080 (gpointer)&change_window1, NULL, NULL);
1081 //change_window1(actor, desktop_plugin);
1082 actor->time_start_animation = now + fast_rnd(30);
1083 scene.actors = g_slist_append(scene.actors, actor);
1087 /* windows in 1-th house */
1112 for (i=0; i<8; i++){
1113 actor = init_object(desktop_plugin, "window2", "window2.png",
1114 winds[i][0], winds[i][1], 8, 8, 10,
1115 FALSE, FALSE, 100, 255,
1116 (gpointer)&change_window1, NULL, NULL);
1117 //change_window1(actor, desktop_plugin);
1118 actor->time_start_animation = now + fast_rnd(30);
1119 scene.actors = g_slist_append(scene.actors, actor);
1123 /* windows in 3-th house */
1155 for (i=0; i<10; i++){
1156 actor = init_object(desktop_plugin, "window3", "window3.png",
1157 winds[i][0], winds[i][1], 8, 8, 10,
1158 FALSE, FALSE, 100, 255,
1159 (gpointer)&change_window1, NULL, NULL);
1160 //change_window1(actor, desktop_plugin);
1161 actor->time_start_animation = now + fast_rnd(30);
1162 scene.actors = g_slist_append(scene.actors, actor);
1166 /* windows in 5-th house */
1189 for (i=0; i<7; i++){
1190 actor = init_object(desktop_plugin, "window4", "window4.png",
1191 winds[i][0], winds[i][1], 8, 8, 10,
1192 FALSE, FALSE, 100, 255,
1193 (gpointer)&change_window1, NULL, NULL);
1194 //change_window1(actor, desktop_plugin);
1195 actor->time_start_animation = now + fast_rnd(30);
1196 scene.actors = g_slist_append(scene.actors, actor);
1200 /* windows in 6-th house */
1220 for (i=0; i<6; i++){
1221 actor = init_object(desktop_plugin, "window5", "window5.png",
1222 winds[i][0], winds[i][1], 8, 8, 10,
1223 FALSE, FALSE, 100, 255,
1224 (gpointer)&change_window1, NULL, NULL);
1225 //change_window1(actor, desktop_plugin);
1226 actor->time_start_animation = now + fast_rnd(30);
1227 scene.actors = g_slist_append(scene.actors, actor);
1231 run_long_timeout(desktop_plugin);
1234 anim = g_new0(Animation, 1);
1236 anim->actor = actor;
1237 anim->func_change = &change_tram;
1238 anim->func_time = NULL;
1239 anim->timestart = time(NULL);
1242 scene.dynamic_actors = g_slist_append(scene.dynamic_actors, anim);
1246 /* Init Berlin Scene */
1248 init_scene1(AWallpaperPlugin *desktop_plugin)
1250 Actor *actor, *actor1, *actor2;
1251 gint now = time(NULL);
1254 GPtrArray *child = NULL;
1256 scene.daytime = get_daytime();
1257 scene.actors = NULL;
1258 scene.wind_orientation = -1;
1259 scene.wind_angle = 0.3;
1260 /* init value for random */
1261 scene.seed = time(NULL);
1264 actor = init_object(desktop_plugin, "sky", "sky.png", 0, 0, 5, 800, 480,
1265 TRUE, TRUE, 100, 255,
1266 (gpointer)&change_static_actor, NULL, NULL);
1267 change_static_actor(actor, desktop_plugin);
1268 scene.actors = g_slist_append(scene.actors, actor);
1271 actor = init_object(desktop_plugin, "sun", "sun.png", 0, 0, 6, 88, 88,
1272 FALSE, FALSE, 100, 255,
1273 (gpointer)&change_sun, (gpointer)&probability_sun, NULL);
1274 actor->time_start_animation = time(NULL);
1275 actor->duration_animation = G_MAXINT;
1276 change_sun(actor, desktop_plugin);
1277 scene.actors = g_slist_append(scene.actors, actor);
1280 actor = init_object(desktop_plugin, "dot", "dot1.png", 0, 0, 11, 50, 50,
1281 TRUE, 100, 255, NULL, NULL);
1282 scene.actors = g_slist_append(scene.actors, actor);
1285 actor = init_object(desktop_plugin, "moon", "moon1.png", 400, 15, 6, 60, 60,
1286 FALSE, FALSE, 100, 255,
1287 (gpointer)&change_moon, NULL, NULL);
1288 change_moon(actor, desktop_plugin);
1289 scene.actors = g_slist_append(scene.actors, actor);
1291 actor = init_object(desktop_plugin, "cloud1", "cloud1.png", 0, fast_rnd(300)-97, 7, 150, 97,
1292 FALSE, FALSE, 100, 255,
1293 (gpointer)&change_cloud, NULL, NULL);
1294 actor->time_start_animation = now + fast_rnd(30) + 10;
1295 actor->duration_animation = 3*60;
1296 scene.actors = g_slist_append(scene.actors, actor);
1298 actor = init_object(desktop_plugin, "cloud2", "cloud2.png", 0, fast_rnd(300)-75, 7, 188, 75,
1299 FALSE, FALSE, 100, 255,
1300 (gpointer)&change_cloud, NULL, NULL);
1301 actor->time_start_animation = now + fast_rnd(10);
1302 actor->duration_animation = 3*60;
1303 scene.actors = g_slist_append(scene.actors, actor);
1305 actor = init_object(desktop_plugin, "cloud4", "cloud4.png", 0, fast_rnd(300)-75, 7, 150, 75,
1306 FALSE, FALSE, 100, 255,
1307 (gpointer)&change_cloud, NULL, NULL);
1308 actor->time_start_animation = now + fast_rnd(60) + 20;
1309 actor->duration_animation = 5*60;
1310 scene.actors = g_slist_append(scene.actors, actor);
1313 actor = init_object(desktop_plugin, "plane2", "plane3.png", 0, 45, 8, 160, 50,
1314 FALSE, FALSE, 100, 255,
1315 (gpointer)&change_plane2, NULL, NULL);
1316 actor->time_start_animation = now + fast_rnd(40) + 20;
1317 actor->duration_animation = 60;
1318 scene.actors = g_slist_append(scene.actors, actor);
1320 actor = init_object(desktop_plugin, "plane1", "tu154.png", 620, 233, 9, 300, 116,
1321 FALSE, FALSE, 100, 255,
1322 (gpointer)&change_plane1, NULL, NULL);
1323 actor->time_start_animation = now + fast_rnd(20);
1324 actor->duration_animation = 30;
1325 scene.actors = g_slist_append(scene.actors, actor);
1327 actor = init_object(desktop_plugin, "town", "town.png", 0, 0, 10, 800, 480,
1328 TRUE, TRUE, 100, 255,
1329 (gpointer)&change_static_actor_with_corner, NULL, NULL);
1330 change_static_actor_with_corner(actor, desktop_plugin);
1331 scene.actors = g_slist_append(scene.actors, actor);
1333 actor = init_object(desktop_plugin, "wind", "", 0, 0, 5, 0, 0,
1334 FALSE, FALSE, 100, 255,
1335 (gpointer)&change_wind, NULL, NULL);
1336 change_wind(actor, desktop_plugin);
1337 scene.actors = g_slist_append(scene.actors, actor);
1339 actor1 = init_object(desktop_plugin, "signal_red", "red.png",
1340 486, 425, 10, 18, 38,
1341 FALSE, TRUE, 100, 255, NULL, NULL, NULL);
1342 //actor->time_start_animation = now + fast_rnd(30) + 10;
1343 scene.actors = g_slist_append(scene.actors, actor1);
1345 actor2 = init_object(desktop_plugin, "signal_green", "green.png",
1346 486, 425, 10, 18, 38,
1347 TRUE, TRUE, 100, 255, NULL, NULL, NULL);
1348 //actor->time_start_animation = now + fast_rnd(30) + 10;
1349 scene.actors = g_slist_append(scene.actors, actor2);
1350 child = g_ptr_array_sized_new(2);
1351 g_ptr_array_add(child, actor1);
1352 g_ptr_array_add(child, actor2);
1353 actor = init_object(desktop_plugin, "signal", "",
1354 486, 425, 10, 18, 38,
1355 FALSE, FALSE, 100, 255,
1356 (gpointer)&change_signal, NULL, child);
1357 actor->time_start_animation = now + fast_rnd(30) + 10;
1358 scene.actors = g_slist_append(scene.actors, actor);
1399 for (i=0; i<13; i++){
1400 actor = init_object(desktop_plugin, "window", "window.png",
1401 winds[i][0], winds[i][1], 10, 8, 9,
1402 FALSE, TRUE, 100, 255,
1403 (gpointer)&change_window1, NULL, NULL);
1404 //change_window1(actor, desktop_plugin);
1405 actor->time_start_animation = now + fast_rnd(30);
1406 scene.actors = g_slist_append(scene.actors, actor);
1410 run_long_timeout(desktop_plugin);
1416 get_sun_screen_pos(double alt, double azm, gint * x, gint * y)
1418 gint y0 = 365;// - уровень горизонта
1419 *x = (int)(azm * 800) - 64;
1420 *y = (int)((1 - alt) * y0) - 64;
1421 //fprintf(stderr, "sun pos alt=%f azm=%f x=%d y=%d\n", alt, azm, *x, *y);
1425 change_actor(GtkWidget * actor)
1428 gint x, y, daytime, scale;
1435 void (*pfunc)(gpointer, gpointer);
1437 name = g_object_get_data(G_OBJECT(actor), "name");
1438 fprintf(stderr, "change actor %s\n", name);
1440 pfunc = g_object_get_data(G_OBJECT(actor), "func");
1442 (*pfunc)(actor, g_strdup(name));
1443 daytime = get_daytime();
1444 if (daytime != TIME_NIGHT){
1445 hildon_animation_actor_set_show(actor, 1);
1446 get_sun_pos(&alt, &azm);
1447 get_sun_screen_pos(alt, azm, &x, &y);
1448 actor_set_position_full(actor, x, y, g_object_get_data(G_OBJECT(actor), "z"));
1452 if (name == "cloud1"){
1453 x = g_object_get_data(G_OBJECT(actor), "x");
1454 y = g_object_get_data(G_OBJECT(actor), "y");
1455 scale = g_object_get_data(G_OBJECT(actor), "scale");
1458 image = g_object_get_data(G_OBJECT(actor), "image");
1460 gtk_container_remove(actor, image);
1461 pixbuf = gdk_pixbuf_new_from_file_at_size ("/usr/share/livewp/theme/Modern/sun.png",
1466 image = gtk_image_new_from_pixbuf (pixbuf);
1467 g_object_unref(G_OBJECT(pixbuf));
1469 g_signal_connect(G_OBJECT(image), "expose_event",
1470 G_CALLBACK(expose_event), pixbuf);
1471 gtk_container_add (GTK_CONTAINER (actor), image);
1473 gtk_widget_show_all(actor);
1485 sc = (double)scale / 100;
1486 hildon_animation_actor_set_scale(actor, sc, sc);
1487 fprintf(stderr, "cloud x=%d y=%d scale=%f", x, y, sc);
1488 actor_set_position_full(actor, x, y, g_object_get_data(G_OBJECT(actor), "z"));
1489 g_object_set_data(G_OBJECT(actor), "x", x);
1490 g_object_set_data(G_OBJECT(actor), "y", y);
1491 g_object_set_data(G_OBJECT(actor), "scale", scale);
1497 short_timeout (AWallpaperPlugin *desktop_plugin)
1499 //gint daytime = get_daytime();
1501 void (*pfunc)(gpointer, gpointer);
1504 gboolean stop_flag = TRUE;
1506 if (!desktop_plugin->priv->visible || !desktop_plugin->priv->rich_animation){
1507 desktop_plugin->priv->short_timer = 0;
1512 //scene.daytime = daytime;
1513 /* fprintf(stderr, "Short timer %d\n", now); */
1515 while (tmp != NULL){
1517 if (now >= actor->time_start_animation
1518 && actor->time_start_animation > 0
1519 /* && now - actor->time_start_animation <= actor->duration_animation*/){
1520 pfunc = actor->func_change;
1522 (*pfunc)(actor, desktop_plugin);
1526 tmp = g_slist_next(tmp);
1529 desktop_plugin->priv->short_timer = 0;
1532 return TRUE; /* keep running this event */
1536 run_long_timeout(AWallpaperPlugin *desktop_plugin)
1539 gint daytime = get_daytime();
1541 void (*pfunc)(gpointer, gpointer);
1546 //fprintf(stderr, "!!!run long timeout short_timer=%d\n", desktop_plugin->priv->short_timer);
1547 if (scene.daytime != daytime){
1548 scene.daytime = daytime;
1550 while (tmp != NULL){
1551 //change_actor(tmp->data);
1552 pfunc =((Actor*)tmp->data)->func_change;
1554 (*pfunc)(tmp->data, desktop_plugin);
1556 tmp = g_slist_next(tmp);
1561 //fprintf(stderr, "Now %d\n", now);
1563 while (tmp != NULL){
1565 if (now >= actor->time_start_animation
1566 && actor->time_start_animation > 0
1567 && desktop_plugin->priv->short_timer == 0){
1568 /* fprintf(stderr, "start short timer act = %s %d\n", actor->name, now); */
1569 if (desktop_plugin->priv->rich_animation){
1570 actor->time_start_animation = now;
1571 desktop_plugin->priv->short_timer = g_timeout_add(SHORT_TIMER, (GtkFunction)short_timeout, desktop_plugin);
1574 (*actor->func_change)(actor, desktop_plugin);
1577 tmp = g_slist_next(tmp);
1583 long_timeout (AWallpaperPlugin *desktop_plugin)
1585 /* fprintf(stderr, "long_timeout %i\n", desktop_plugin->priv->long_timer); */
1586 if (desktop_plugin->priv->long_timer == 0 )
1588 if (!desktop_plugin->priv->visible){
1589 if(desktop_plugin->priv->short_timer != 0){
1590 g_source_remove(desktop_plugin->priv->short_timer);
1591 desktop_plugin->priv->short_timer = 0;
1593 desktop_plugin->priv->long_timer = 0;
1598 run_long_timeout(desktop_plugin);
1599 return TRUE; /* keep running this event */
1603 desktop_plugin_visible_notify (GObject *object,
1605 AWallpaperPlugin *desktop_plugin)
1608 g_object_get (object, "is-on-current-desktop", &visible, NULL);
1609 /* fprintf (stderr, "is-on-current-desktop changed. visible: %u", visible); */
1611 desktop_plugin->priv->visible = TRUE;
1612 if (desktop_plugin->priv->long_timer == 0 ){
1613 desktop_plugin->priv->long_timer = g_timeout_add(LONG_TIMER, (GtkFunction)long_timeout, desktop_plugin);
1614 run_long_timeout(desktop_plugin);
1617 desktop_plugin->priv->visible = FALSE;
1618 if (desktop_plugin->priv->long_timer != 0 ){
1619 g_source_remove(desktop_plugin->priv->long_timer);
1620 desktop_plugin->priv->long_timer = 0;
1626 rich_animation_press(GtkWidget *widget, GdkEvent *event,
1627 gpointer user_data){
1628 fprintf(stderr,"gggggggggggggggggggg2222\n");
1632 animation_wallpaper_plugin_init (AWallpaperPlugin *desktop_plugin)
1634 GtkWidget *rich_animation;
1638 fprintf(stderr, "!!!!!!!plugin init \n");
1639 Animation_WallpaperPrivate *priv = Animation_Wallpaper_HOME_PLUGIN_GET_PRIVATE (desktop_plugin);
1640 desktop_plugin->priv = Animation_Wallpaper_HOME_PLUGIN_GET_PRIVATE (desktop_plugin);
1641 priv->osso = osso_initialize(PACKAGE, VERSION, TRUE, NULL);
1645 /* Initialize DBUS */
1646 livewp_initialize_dbus(priv);
1648 priv->desktop_plugin = desktop_plugin;
1649 priv->visible = TRUE;
1650 priv->short_timer = 0;
1651 //priv->theme = g_strdup("Modern");
1652 desktop_plugin->priv->main_widget = gtk_fixed_new();
1654 gtk_widget_set_size_request(desktop_plugin->priv->main_widget, 100, 32);
1655 desktop_plugin->priv->right_corner = NULL;
1656 snprintf(buffer, sizeof(buffer) - 1, "%s/%s/%s", THEME_PATH, desktop_plugin->priv->theme, "town0_right_corner.png");
1657 desktop_plugin->priv->right_corner = gtk_image_new_from_file (buffer);
1658 if (desktop_plugin->priv->right_corner){
1659 gtk_fixed_put(GTK_FIXED(desktop_plugin->priv->main_widget), desktop_plugin->priv->right_corner, 0, 0);
1660 gtk_widget_show (desktop_plugin->priv->right_corner);
1662 /* Create rich animation event */
1663 rich_animation = gtk_event_box_new();
1665 gtk_widget_set_events(rich_animation, GDK_BUTTON_PRESS_MASK);
1666 gtk_event_box_set_visible_window(GTK_EVENT_BOX(rich_animation), FALSE);
1667 gtk_widget_set_size_request(rich_animation, 100, 32);
1668 gtk_widget_show (rich_animation);
1669 g_signal_connect(rich_animation, "button-press-event", G_CALLBACK(rich_animation_press), desktop_plugin);
1670 gtk_fixed_put(GTK_FIXED(desktop_plugin->priv->main_widget), rich_animation, 0, 0);
1673 GtkWidget *label = gtk_label_new ("ddddddddddddd");
1674 gtk_widget_set_size_request(label, 95, 30);
1675 gtk_widget_show (label);
1676 // gtk_container_add (GTK_CONTAINER (desktop_plugin), label);
1677 gtk_fixed_put(GTK_FIXED(widget), label, 0, 0);
1679 hd_home_plugin_item_set_settings (HD_HOME_PLUGIN_ITEM (desktop_plugin), TRUE);
1680 g_signal_connect (desktop_plugin, "show-settings",
1681 G_CALLBACK (show_settings), priv);
1682 gtk_widget_show (desktop_plugin->priv->main_widget);
1683 gtk_container_add (GTK_CONTAINER (desktop_plugin), desktop_plugin->priv->main_widget);
1684 init_applet_position();
1687 fprintf(stderr, "!!!theme = %s\n", priv->theme);
1688 if (!strcmp(priv->theme,"Modern"))
1689 init_scene(desktop_plugin);
1690 else if (!strcmp(priv->theme,"Berlin"))
1691 init_scene1(desktop_plugin);
1692 else if (!strcmp(priv->theme, "Matrix"))
1693 init_scene2(desktop_plugin);
1694 priv->long_timer = g_timeout_add(LONG_TIMER, (GtkFunction)long_timeout, desktop_plugin);
1695 /* TODO Move scene to priv */
1696 scene.timer_type = LONG_TIMER_TYPE;
1697 g_signal_connect (desktop_plugin, "notify::is-on-current-desktop",
1698 G_CALLBACK (desktop_plugin_visible_notify), desktop_plugin);
1705 lw_applet_finalize (GObject *object)
1707 AWallpaperPlugin *desktop_plugin = Animation_Wallpaper_HOME_PLUGIN (object);
1708 Animation_WallpaperPrivate *priv = desktop_plugin->priv;
1710 fprintf(stderr,"finalaze %i\n", priv->long_timer);
1711 if (priv->long_timer){
1712 g_source_remove(priv->long_timer);
1713 priv->long_timer = 0;
1715 if (priv->short_timer){
1716 g_source_remove(priv->short_timer);
1717 priv->short_timer = 0;
1724 animation_wallpaper_plugin_class_init (AWallpaperPluginClass *klass) {
1726 GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
1727 GtkObjectClass *gobject_class = GTK_OBJECT_CLASS (klass);
1730 gobject_class->destroy = (gpointer)lw_applet_finalize;
1731 widget_class->realize = lw_applet_realize;
1732 widget_class->expose_event = lw_applet_expose_event;
1734 g_type_class_add_private (klass, sizeof (Animation_WallpaperPrivate));
1739 animation_wallpaper_plugin_class_finalize (AWallpaperPluginClass *class) {