From: tanya Date: Fri, 30 Apr 2010 13:02:36 +0000 (+0300) Subject: continued restructuring X-Git-Url: https://vcs.maemo.org/git/?a=commitdiff_plain;h=86221a1557e200e9a6897364d4872ef05371ce38;p=livewp continued restructuring --- diff --git a/applet/src/livewp-home-widget.c b/applet/src/livewp-home-widget.c index d7412bb..fbe86c7 100644 --- a/applet/src/livewp-home-widget.c +++ b/applet/src/livewp-home-widget.c @@ -247,87 +247,6 @@ change_hildon_actor(Actor *actor, AWallpaperPlugin *desktop_plugin) } -void -get_sun_screen_pos(double alt, double azm, gint * x, gint * y) -{ - gint y0 = 365;// - уровень горизонта - *x = (int)(azm * 800) - 64; - *y = (int)((1 - alt) * y0) - 64; - //fprintf(stderr, "sun pos alt=%f azm=%f x=%d y=%d\n", alt, azm, *x, *y); -} -#if 0 -static void -change_actor(GtkWidget * actor) -{ - char * name; - gint x, y, daytime, scale; - gdouble sc; - double alt, azm; - - GtkWidget *image; - GdkPixbuf *pixbuf; - - void (*pfunc)(gpointer, gpointer); - - name = g_object_get_data(G_OBJECT(actor), "name"); - fprintf(stderr, "change actor %s\n", name); - if (name == "sun"){ - pfunc = g_object_get_data(G_OBJECT(actor), "func"); - if (pfunc) - (*pfunc)(actor, g_strdup(name)); - daytime = get_daytime(); - if (daytime != TIME_NIGHT){ - hildon_animation_actor_set_show(actor, 1); - get_sun_pos(&alt, &azm); - get_sun_screen_pos(alt, azm, &x, &y); - actor_set_position_full(actor, x, y, g_object_get_data(G_OBJECT(actor), "z")); - } - } - - if (name == "cloud1"){ - x = g_object_get_data(G_OBJECT(actor), "x"); - y = g_object_get_data(G_OBJECT(actor), "y"); - scale = g_object_get_data(G_OBJECT(actor), "scale"); - - /* Start */ - image = g_object_get_data(G_OBJECT(actor), "image"); - - gtk_container_remove(actor, image); - pixbuf = gdk_pixbuf_new_from_file_at_size ("/usr/share/livewp/theme/Modern/sun.png", - 200, - 200, - NULL); - if (pixbuf){ - image = gtk_image_new_from_pixbuf (pixbuf); - g_object_unref(G_OBJECT(pixbuf)); - } - g_signal_connect(G_OBJECT(image), "expose_event", - G_CALLBACK(expose_event), pixbuf); - gtk_container_add (GTK_CONTAINER (actor), image); - realize(actor); - gtk_widget_show_all(actor); - /* End*/ - - - x += 40; - y -= 20; - scale -= 10; - if (x > 500){ - x = 400; - y = 150; - sc = 1; - } - sc = (double)scale / 100; - hildon_animation_actor_set_scale(actor, sc, sc); - fprintf(stderr, "cloud x=%d y=%d scale=%f", x, y, sc); - actor_set_position_full(actor, x, y, g_object_get_data(G_OBJECT(actor), "z")); - g_object_set_data(G_OBJECT(actor), "x", x); - g_object_set_data(G_OBJECT(actor), "y", y); - g_object_set_data(G_OBJECT(actor), "scale", scale); - } - -} -#endif static gboolean short_timeout (AWallpaperPlugin *desktop_plugin) { @@ -463,6 +382,7 @@ rich_animation_press(GtkWidget *widget, GdkEvent *event, fprintf(stderr,"gggggggggggggggggggg2222\n"); return FALSE; } + static void animation_wallpaper_plugin_init (AWallpaperPlugin *desktop_plugin) { diff --git a/applet/src/livewp-rules.c b/applet/src/livewp-rules.c index cb1ddd3..3501a65 100644 --- a/applet/src/livewp-rules.c +++ b/applet/src/livewp-rules.c @@ -158,4 +158,12 @@ fast_rnd(gint max) guint seed = time(NULL); return (gint)(seed % max); } +void +get_sun_screen_pos(double alt, double azm, gint * x, gint * y) +{ + gint y0 = 365;// - уровень горизонта + *x = (int)(azm * 800) - 64; + *y = (int)((1 - alt) * y0) - 64; + //fprintf(stderr, "sun pos alt=%f azm=%f x=%d y=%d\n", alt, azm, *x, *y); +} diff --git a/applet/src/livewp-rules.h b/applet/src/livewp-rules.h index c18dc25..ccefbf6 100644 --- a/applet/src/livewp-rules.h +++ b/applet/src/livewp-rules.h @@ -49,6 +49,7 @@ int get_moon_phase(); time_t get_next_sunrise(); time_t get_next_sunset(); gint fast_rnd(gint max); +void get_sun_screen_pos(double alt, double azm, gint * x, gint * y); /*******************************************************************************/ #endif