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"
30 #define PLUGIN_NAME "livewp-home-widget.desktop-0"
31 #define GCONF_KEY_POSITION "/apps/osso/hildon-desktop/applets/%s/position"
32 #define GCONF_KEY_MODIFIED "/apps/osso/hildon-desktop/applets/%s/modified"
33 #define GCONF_KEY_VIEW "/apps/osso/hildon-desktop/applets/%s/view"
35 HD_DEFINE_PLUGIN_MODULE (AWallpaperPlugin, animation_wallpaper_plugin, HD_TYPE_HOME_PLUGIN_ITEM)
36 #define Animation_Wallpaper_HOME_PLUGIN_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE (obj,\
37 Animation_Wallpaper_TYPE_HOME_PLUGIN,\
38 Animation_WallpaperPrivate))
40 /* Position of plugin on desktop */
41 #define Xstartposition 700
42 #define Ystartposition 425
44 gint xapplet = 0, yapplet = 0;
45 GSList * objects_list = NULL;
49 lw_applet_realize (GtkWidget *widget)
53 screen = gtk_widget_get_screen (widget);
54 gtk_widget_set_colormap (widget,
55 gdk_screen_get_rgba_colormap (screen));
56 gtk_widget_set_app_paintable (widget,
58 GTK_WIDGET_CLASS (animation_wallpaper_plugin_parent_class)->realize (widget);
63 lw_applet_expose_event(GtkWidget *widget,
64 GdkEventExpose *event)
68 /* Create cairo context */
69 cr = gdk_cairo_create (GDK_DRAWABLE (widget->window));
70 gdk_cairo_region (cr, event->region);
73 /* Draw alpha background */
74 cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
75 cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 0.0);
81 return GTK_WIDGET_CLASS (animation_wallpaper_plugin_parent_class)->expose_event (widget,
86 expose_event (GtkWidget *widget,GdkEventExpose *event,
90 GdkPixbuf *pixbuf = (GdkPixbuf *) data;
92 cr = gdk_cairo_create(widget->window);
94 gdk_cairo_region(cr, event->region);
95 cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
96 gdk_cairo_set_source_pixbuf(cr, pixbuf, 0.0, 0.0);
104 realize (GtkWidget *widget)
107 screen = gtk_widget_get_screen (widget);
108 gtk_widget_set_colormap (widget, gdk_screen_get_rgba_colormap (screen));
111 /* Set position of widget on desktop */
113 init_applet_position(void)
115 GSList *position = NULL;
119 GError *error = NULL;
120 GConfClient *gconf_client = gconf_client_get_default ();
121 position_key = g_strdup_printf (GCONF_KEY_POSITION, PLUGIN_NAME);
122 position = gconf_client_get_list (gconf_client,
126 if (position && position->data && position->next->data){
127 xapplet = GPOINTER_TO_INT (position->data);
128 yapplet = GPOINTER_TO_INT (position->next->data);
130 position = g_slist_prepend (g_slist_prepend (NULL,
131 GINT_TO_POINTER (Ystartposition)),
132 GINT_TO_POINTER (Xstartposition));
133 gconf_client_set_list (gconf_client,
138 xapplet = Xstartposition;
139 yapplet = Ystartposition;
141 g_free (position_key);
142 modified = g_strdup_printf ("%ld", 0);
143 modified_key = g_strdup_printf (GCONF_KEY_MODIFIED, PLUGIN_NAME);
144 gconf_client_set_string (gconf_client,
149 g_free(modified_key);
150 gconf_client_clear_cache(gconf_client);
151 g_object_unref(gconf_client);
155 actor_set_position_full(GtkWidget *actor, gint x, gint y, gint z)
157 // fprintf(stderr, "actor_set_position_full\n");
158 hildon_animation_actor_set_position_full (HILDON_ANIMATION_ACTOR (actor),x-xapplet, y-yapplet, z);
162 path_line(gint x0, gint x1, double t)
165 return ((x1 - x0) * t + x0);
170 destroy_hildon_actor(Actor *actor)
172 fprintf(stderr, "estroy_hildon_actor %p\n",actor->widget);
173 gtk_widget_destroy(actor->widget);
174 actor->widget = NULL;
178 init_object(AWallpaperPlugin *desktop_plugin,
189 void (*pfunc_change)(Actor*),
190 void (*pfunc_probability)(Actor*)
194 actor = g_new0(Actor, 1);
198 actor->width = width;
199 actor->height = height;
200 actor->visible = visible;
201 actor->scale = scale;
202 actor->opacity = opacity;
203 actor->filename = g_strdup(filename);
204 actor->name = g_strdup(name);
205 actor->func_change = pfunc_change;
206 actor->func_probability = pfunc_probability;
208 create_hildon_actor(actor, desktop_plugin);
210 actor->widget = NULL;
211 actor->time_start_animation = 0;
212 actor->duration_animation = 0;
220 //objects_list = g_slist_append(objects_list, G_OBJECT(actor));
221 //objects_list = g_slist_append(objects_list, G_OBJECT(a));
226 change_moon(Actor * actor, AWallpaperPlugin *desktop_plugin)
228 gint x, y, z, daytime, phase;
232 daytime = get_daytime();
233 if (daytime == TIME_NIGHT){
234 if (!actor->visible){
235 actor->visible = TRUE;
236 phase = get_moon_phase();
237 newfile = g_strdup_printf( "%s%d.png", actor->name, phase);
239 actor->filename = newfile;
240 create_hildon_actor(actor, desktop_plugin);
245 // actor_set_position_full(actor->widget, x, y, actor->z);
246 //probability_sun(actor);
247 //fprintf(stderr, "after change sun %d\n", actor->time_start_animation);
248 }else if (actor->visible){
249 actor->visible = FALSE;
250 fprintf(stderr, "destroy moon \n");
251 destroy_hildon_actor(actor);
252 /* TO DO make moonrise*/
253 actor->time_start_animation = get_next_sunset();
260 change_sun(Actor * actor, AWallpaperPlugin *desktop_plugin)
263 gint x, y, z, daytime;
266 daytime = get_daytime();
267 if (daytime != TIME_NIGHT){
268 if (!actor->visible){
269 actor->visible = TRUE;
271 create_hildon_actor(actor, desktop_plugin);
273 get_sun_pos(&alt, &azm);
274 get_sun_screen_pos(alt, azm, &x, &y);
277 actor_set_position_full(actor->widget, x, y, actor->z);
278 probability_sun(actor);
279 }else if (actor->visible){
280 actor->visible = FALSE;
281 destroy_hildon_actor(actor);
282 actor->time_start_animation = get_next_sunrise();
288 change_tram(Actor * actor, AWallpaperPlugin *desktop_plugin)
290 gint x0 = -300, y0 = 225, scale0 = 100,
291 x1 = 800, y1 = 162, scale1 = 130,
293 gint daytime = get_daytime();
294 time_t now = time(NULL);
297 if (!actor->visible){
298 actor->visible = TRUE;
299 if (daytime == TIME_NIGHT)
300 actor->filename = g_strdup("tram_dark.png");
302 actor->filename = g_strdup("tram.png");
303 create_hildon_actor(actor, desktop_plugin);
305 t = (double)(now - actor->time_start_animation) / actor->duration_animation;
306 x = path_line(x0, x1, t);
307 y = path_line(y0, y1, t);
308 scale = path_line(scale0, scale1, t);
309 fprintf(stderr, "change tram t=%f x=%d y=%d scale=%d\n", t, x, y, scale);
310 actor_set_position_full(actor->widget, x, y, actor->z);
311 hildon_animation_actor_set_scale(actor->widget, (double)scale/100, (double)scale/100);
314 actor->visible = FALSE;
315 destroy_hildon_actor(actor);
316 actor->time_start_animation = now + 20;
320 create_hildon_actor(Actor *actor, AWallpaperPlugin *desktop_plugin)
322 GtkWidget *ha = NULL;
323 GdkPixbuf *pixbuf = NULL;
324 GtkWidget *image = NULL;
327 fprintf(stderr, "create_hildon_actor %s\n", actor->name);
328 ha = hildon_animation_actor_new();
329 str = g_strdup_printf( "%s/%s/%s", THEME_PATH,
330 desktop_plugin->priv->theme, actor->filename);
331 pixbuf = gdk_pixbuf_new_from_file_at_size (str,
336 image = gtk_image_new_from_pixbuf (pixbuf);
337 g_object_unref(G_OBJECT(pixbuf));
340 g_signal_connect(G_OBJECT(image), "expose_event",
341 G_CALLBACK(expose_event), pixbuf);
342 gtk_container_add (GTK_CONTAINER (ha), image);
344 actor_set_position_full(ha, actor->x, actor->y, actor->z);
345 hildon_animation_actor_set_show (ha, actor->visible);
346 hildon_animation_actor_set_scale(ha, (double)actor->scale/100, (double)actor->scale/100);
348 gtk_widget_show_all(ha);
350 //g_object_set_data(G_OBJECT(ha), "name", name);
351 //g_object_set_data(G_OBJECT(ha), "filename", filename);
352 g_object_set_data(G_OBJECT(ha), "image", image);
354 g_object_set_data(G_OBJECT(ha), "x", x);
355 g_object_set_data(G_OBJECT(ha), "y", y);
356 g_object_set_data(G_OBJECT(ha), "z", z);
357 g_object_set_data(G_OBJECT(ha), "width", width);
358 g_object_set_data(G_OBJECT(ha), "height", height);
359 g_object_set_data(G_OBJECT(ha), "scale", scale);
360 g_object_set_data(G_OBJECT(ha), "visible", visible);
361 g_object_set_data(G_OBJECT(ha), "opacity", opacity);
362 g_object_set_data(G_OBJECT(ha), "func", pfunc);
364 hildon_animation_actor_set_parent (HILDON_ANIMATION_ACTOR (ha), desktop_plugin);
365 fprintf(stderr, "ha %p\n", ha);
371 change_hildon_actor(Actor *actor, AWallpaperPlugin *desktop_plugin)
373 GtkWidget *image = NULL;
374 GdkPixbuf *pixbuf = NULL;
377 str = g_strdup_printf( "%s/%s/%s", THEME_PATH,
378 desktop_plugin->priv->theme, actor->filename);
380 pixbuf = gdk_pixbuf_new_from_file_at_size (str,
385 image = gtk_image_new_from_pixbuf (pixbuf);
386 g_object_unref(G_OBJECT(pixbuf));
389 g_signal_connect(G_OBJECT(image), "expose_event",
390 G_CALLBACK(expose_event), pixbuf);
391 if (g_object_get_data(G_OBJECT(actor->widget), "image")){
392 gtk_container_remove(actor->widget, g_object_get_data(G_OBJECT(actor->widget), "image"));
394 g_object_set_data(G_OBJECT(actor->widget), "image", image);
395 gtk_container_add (GTK_CONTAINER (actor->widget), image);
396 realize(actor->widget);
397 gtk_widget_show_all(actor->widget);
404 change_static_actor(Actor * actor, AWallpaperPlugin *desktop_plugin)
409 daytime = get_daytime();
410 newfile = g_strdup_printf("%s%d.png", actor->name, daytime);
411 actor->filename = newfile;
412 change_hildon_actor(actor, desktop_plugin);
417 void change_sky(GtkWidget * actor, gpointer data)
419 gint daytime, opacity;
420 //fprintf(stderr, "change sky \n");
422 daytime = get_daytime();
423 opacity = g_object_get_data(G_OBJECT(actor), "opacity") - 10;
424 if (opacity < 0) opacity = 255;
425 hildon_animation_actor_set_show_full(actor, 1, opacity);
426 g_object_set_data(G_OBJECT(actor), "opacity", opacity);
429 //fprintf(stderr, "change sky night\n");
432 //fprintf(stderr, "change sky day\n");
439 change_background(GtkWidget * actor, gpointer data)
443 opacity = g_object_get_data(G_OBJECT(actor), "opacity") - 1;
444 if (opacity < 0) opacity = 255;
445 hildon_animation_actor_set_show_full(actor, 1, opacity);
446 g_object_set_data(G_OBJECT(actor), "opacity", opacity);
453 // уравнение изменения времени
459 GSList * tmp = scene.actors;
462 gtk_widget_destroy(tmp->data);
465 tmp = g_slist_next(tmp);
472 reload_scene(AWallpaperPlugin *desktop_plugin)
474 fprintf(stderr,"Reload scene %s\n", desktop_plugin->priv->theme);
476 if (!strcmp(desktop_plugin->priv->theme,"Modern"))
477 init_scene(desktop_plugin);
478 else if (!strcmp(desktop_plugin->priv->theme,"Berlin"))
479 init_scene(desktop_plugin);
483 probability_sun(Actor *actor)
485 actor->time_start_animation += 20 * 1;
486 actor->duration_animation = G_MAXINT;
490 init_scene(AWallpaperPlugin *desktop_plugin)
493 GSList * list = NULL;
496 fprintf(stderr, "init scene \n");
497 scene.daytime = get_daytime();
499 //get_sun_pos(&alt, &azm);
500 //get_sun_screen_pos(alt, azm, &x, &y);
502 actor = init_object(desktop_plugin, "sun", "sun.png", 0, 0, 11, 88, 88,
503 TRUE, 100, 255, &change_sun, &probability_sun);
504 actor->time_start_animation = time(NULL);
505 actor->duration_animation = G_MAXINT;
506 change_sun(actor, desktop_plugin);
507 scene.actors = g_slist_append(scene.actors, actor);
508 //scene.dynamic_actors = g_slist_append(scene.dynamic_actors, G_OBJECT(actor));
510 actor = init_object(desktop_plugin, "sky", "sky0.png", 0, 0, 5, 800, 480,
511 TRUE, 100, 255, &change_static_actor, NULL);
512 change_static_actor(actor, desktop_plugin);
513 scene.actors = g_slist_append(scene.actors, actor);
516 actor = init_object(desktop_plugin, "town", "town0.png", 0, 480-374, 10, 800, 374,
517 TRUE, 100, 255, &change_static_actor, NULL);
518 change_static_actor(actor, desktop_plugin);
519 scene.actors = g_slist_append(scene.actors, actor);
521 actor = init_object(desktop_plugin, "border", "border0.png", 0, 480-79, 30, 800, 79,
522 TRUE, 100, 255, &change_static_actor, NULL);
523 change_static_actor(actor, desktop_plugin);
524 scene.actors = g_slist_append(scene.actors, actor);
526 actor = init_object(desktop_plugin, "moon", "moon1.png", 400, 20, 7, 70, 70,
527 FALSE, 100, 255, &change_moon, NULL);
528 change_moon(actor, desktop_plugin);
529 scene.actors = g_slist_append(scene.actors, actor);
532 //if (scene.daytime == TIME_DAY) snprintf(str, 255, "tram.png");
533 //else snprintf(str, 255, "tram_dark.png");
534 //actor = init_object("tram", "tram.png", -300, 191, 25, 350, 210, 1, 100, 255, NULL);
536 actor = init_object(desktop_plugin, "tram", "tram_dark.png", -300, 225, 25, 350, 210,
537 FALSE, 100, 255, &change_tram, NULL);
538 actor->time_start_animation = time(NULL) + 10;
539 actor->duration_animation = 20;
540 scene.actors = g_slist_append(scene.actors, actor);
542 anim = g_new0(Animation, 1);
545 anim->func_change = &change_tram;
546 anim->func_time = NULL;
547 anim->timestart = time(NULL);
550 scene.dynamic_actors = g_slist_append(scene.dynamic_actors, anim);
555 init_scene1(AWallpaperPlugin *desktop_plugin)
562 GSList * list = NULL;
564 scene.daytime = get_daytime();
565 scene.dynamic_actors = NULL;
566 scene.static_actors = NULL;
568 actor = init_object(desktop_plugin, "sun", "sun.png", 0, 0, 20, 88, 88, 1, 100, 255, &change_sun);
569 change_sun(actor, NULL);
570 //scene.static_actors = g_slist_append(scene.static_actors, G_OBJECT(actor));
571 scene.dynamic_actors = g_slist_append(scene.dynamic_actors, G_OBJECT(actor));
573 actor = init_object(desktop_plugin, "background", "sky_dark.png", 0, 0, 4, 800, 480, 1, 100, 255, NULL);
574 scene.dynamic_actors = g_slist_append(scene.dynamic_actors, G_OBJECT(actor));
576 actor = init_object(desktop_plugin, "sky", "sky.png", 0, 0, 5, 800, 480, 1, 100, 255, &change_static_actor);
577 change_static_actor(actor, NULL);
578 scene.static_actors = g_slist_append(scene.static_actors, G_OBJECT(actor));
580 actor = init_object(desktop_plugin, "town", "town.png", 0, 0, 10, 800, 480, 1, 100, 255, &change_static_actor);
581 change_static_actor(actor, NULL);
582 scene.static_actors = g_slist_append(scene.static_actors, G_OBJECT(actor));
585 actor = init_object("cloud1", 400, 150, 2, 200, 150, NULL);
586 scene.dynamic_actors = g_slist_append(scene.dynamic_actors, G_OBJECT(actor));
588 actor = init_object("sun", 10, 10, 50, 88, 88, NULL);
589 list = g_slist_append(list, G_OBJECT(actor));
590 actor = init_object("cloud1", 50, 50, 49, 150, 100, NULL);
591 list = g_slist_append(list, G_OBJECT(actor));
593 ma1 = multiactor_init("multi", list, 0, 0, 50, 1.0, TRUE);
594 //objects_list = g_slist_append(objects_list, G_OBJECT(ma));
601 get_sun_screen_pos(double alt, double azm, gint * x, gint * y)
603 gint y0 = 365;// - уровень горизонта
606 *x = (int)(azm * 800) - 64;
607 *y = (int)((1 - alt) * y0) - 64;
608 //fprintf(stderr, "sun pos x=%d y=%d\n", *x, *y);
612 change_actor(GtkWidget * actor)
615 gint x, y, daytime, scale;
622 void (*pfunc)(gpointer, gpointer);
624 name = g_object_get_data(G_OBJECT(actor), "name");
625 fprintf(stderr, "change actor %s\n", name);
627 pfunc = g_object_get_data(G_OBJECT(actor), "func");
629 (*pfunc)(actor, g_strdup(name));
630 daytime = get_daytime();
631 if (daytime != TIME_NIGHT){
632 hildon_animation_actor_set_show(actor, 1);
633 get_sun_pos(&alt, &azm);
634 get_sun_screen_pos(alt, azm, &x, &y);
635 actor_set_position_full(actor, x, y, g_object_get_data(G_OBJECT(actor), "z"));
639 if (name == "cloud1"){
640 x = g_object_get_data(G_OBJECT(actor), "x");
641 y = g_object_get_data(G_OBJECT(actor), "y");
642 scale = g_object_get_data(G_OBJECT(actor), "scale");
645 image = g_object_get_data(G_OBJECT(actor), "image");
647 gtk_container_remove(actor, image);
648 pixbuf = gdk_pixbuf_new_from_file_at_size ("/usr/share/livewp/theme/Modern/sun.png",
653 image = gtk_image_new_from_pixbuf (pixbuf);
654 g_object_unref(G_OBJECT(pixbuf));
656 g_signal_connect(G_OBJECT(image), "expose_event",
657 G_CALLBACK(expose_event), pixbuf);
658 gtk_container_add (GTK_CONTAINER (actor), image);
660 gtk_widget_show_all(actor);
672 sc = (double)scale / 100;
673 hildon_animation_actor_set_scale(actor, sc, sc);
674 fprintf(stderr, "cloud x=%d y=%d scale=%f", x, y, sc);
675 actor_set_position_full(actor, x, y, g_object_get_data(G_OBJECT(actor), "z"));
676 g_object_set_data(G_OBJECT(actor), "x", x);
677 g_object_set_data(G_OBJECT(actor), "y", y);
678 g_object_set_data(G_OBJECT(actor), "scale", scale);
684 short_timeout (AWallpaperPlugin *desktop_plugin)
686 gint daytime = get_daytime();
689 void (*pfunc)(gpointer, gpointer);
693 gboolean stop_flag = TRUE;
696 fprintf(stderr, "Short timer %d\n", now);
700 if (now >= actor->time_start_animation
701 && actor->time_start_animation > 0
702 /* && now - actor->time_start_animation <= actor->duration_animation*/){
703 pfunc = actor->func_change;
705 (*pfunc)(actor, desktop_plugin);
709 tmp = g_slist_next(tmp);
712 scene.daytime = daytime;
714 desktop_plugin->priv->short_timer = 0;
717 return TRUE; /* keep running this event */
722 long_timeout (AWallpaperPlugin *desktop_plugin)
724 gint daytime = get_daytime();
727 void (*pfunc)(gpointer, gpointer);
732 /* TODO remove timeout */
733 if (!desktop_plugin->priv->visible)
735 fprintf(stderr, "timer daytime=%d\n", daytime);
736 if (scene.daytime != daytime){
739 //change_actor(tmp->data);
740 pfunc =((Actor*)tmp->data)->func_change;
742 (*pfunc)(tmp->data, desktop_plugin);
744 tmp = g_slist_next(tmp);
749 //fprintf(stderr, "Now %d\n", now);
753 if (now >= actor->time_start_animation
754 && actor->time_start_animation > 0
755 && desktop_plugin->priv->short_timer == 0){
756 fprintf(stderr, "start shor timer act = %s\n", actor->name);
757 actor->time_start_animation = now;
758 desktop_plugin->priv->short_timer = g_timeout_add(SHORT_TIMER, short_timeout, desktop_plugin);
760 tmp = g_slist_next(tmp);
763 scene.daytime = daytime;
765 return TRUE; /* keep running this event */
769 desktop_plugin_visible_notify (GObject *object,
771 AWallpaperPlugin *desktop_plugin)
774 g_object_get (object, "is-on-current-desktop", &visible, NULL);
776 desktop_plugin->priv->visible = TRUE;
778 desktop_plugin->priv->visible = FALSE;
779 /* fprintf (stderr, "is-on-current-desktop changed. visible: %u", visible); */
783 animation_wallpaper_plugin_init (AWallpaperPlugin *desktop_plugin)
787 fprintf(stderr, "!!!!!!!plugin init \n");
788 Animation_WallpaperPrivate *priv = Animation_Wallpaper_HOME_PLUGIN_GET_PRIVATE (desktop_plugin);
789 desktop_plugin->priv = Animation_Wallpaper_HOME_PLUGIN_GET_PRIVATE (desktop_plugin);
792 priv->desktop_plugin = desktop_plugin;
793 label = gtk_label_new ("");
794 gtk_widget_set_size_request(label, 95, 30);
795 gtk_widget_show (label);
796 hd_home_plugin_item_set_settings (HD_HOME_PLUGIN_ITEM (desktop_plugin), TRUE);
797 g_signal_connect (desktop_plugin, "show-settings",
798 G_CALLBACK (lw_settings), priv);
799 g_signal_connect (desktop_plugin, "notify::is-on-current-desktop",
800 G_CALLBACK (desktop_plugin_visible_notify), desktop_plugin);
802 gtk_container_add (GTK_CONTAINER (desktop_plugin), label);
803 init_applet_position();
804 fprintf(stderr, "!!!theme = %s\n", priv->theme);
805 if (!strcmp(priv->theme,"Modern"))
806 init_scene(desktop_plugin);
807 else if (!strcmp(priv->theme,"Berlin"))
808 init_scene(desktop_plugin);
809 priv->long_timer = g_timeout_add(LONG_TIMER, long_timeout, desktop_plugin);
810 priv->short_timer = 0;
811 /* TODO Move scene to priv */
812 scene.timer_type = LONG_TIMER_TYPE;
816 lw_applet_finalize (GObject *object)
818 AWallpaperPlugin *desktop_plugin = Animation_Wallpaper_HOME_PLUGIN (object);
819 Animation_WallpaperPrivate *priv = desktop_plugin->priv;
821 if (priv->long_timer){
822 g_source_remove(priv->long_timer);
823 priv->long_timer = 0;
825 if (priv->short_timer){
826 g_source_remove(priv->short_timer);
827 priv->short_timer = 0;
834 animation_wallpaper_plugin_class_init (AWallpaperPluginClass *klass) {
836 GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
837 GtkObjectClass *gobject_class = GTK_OBJECT_CLASS (klass);
840 gobject_class->destroy = lw_applet_finalize;
841 widget_class->realize = lw_applet_realize;
842 widget_class->expose_event = lw_applet_expose_event;
844 g_type_class_add_private (klass, sizeof (Animation_WallpaperPrivate));
849 animation_wallpaper_plugin_class_finalize (AWallpaperPluginClass *class) {}