actor->widget = NULL;
}
-void
-create_hildon_actor(AWallpaperPlugin *desktop_plugin, Actor *actor)
-{
- GtkWidget *ha = NULL;
- GdkPixbuf *pixbuf = NULL;
- GtkWidget *image = NULL;
-
- ha = hildon_animation_actor_new();
- gchar str[256];
- snprintf(str, 255, "%s/%s/%s", THEME_PATH, desktop_plugin->priv->theme, actor->filename);
- fprintf(stderr, "!!!init object !!!!file = %s\n", str);
- pixbuf = gdk_pixbuf_new_from_file_at_size (str,
- actor->width,
- actor->height,
- NULL);
- if (pixbuf){
- image = gtk_image_new_from_pixbuf (pixbuf);
- g_object_unref(G_OBJECT(pixbuf));
- }
- if (image){
- g_signal_connect(G_OBJECT(image), "expose_event",
- G_CALLBACK(expose_event), pixbuf);
- gtk_container_add (GTK_CONTAINER (ha), image);
- }
-
- actor_set_position_full(ha, actor->x, actor->y, actor->z);
- hildon_animation_actor_set_show (ha, actor->visible);
- hildon_animation_actor_set_scale(ha, (double)actor->scale/100, (double)actor->scale/100);
- realize(ha);
- gtk_widget_show_all(ha);
-
- //g_object_set_data(G_OBJECT(ha), "name", name);
- //g_object_set_data(G_OBJECT(ha), "filename", filename);
- g_object_set_data(G_OBJECT(ha), "image", image);
- /*
- g_object_set_data(G_OBJECT(ha), "x", x);
- g_object_set_data(G_OBJECT(ha), "y", y);
- g_object_set_data(G_OBJECT(ha), "z", z);
- g_object_set_data(G_OBJECT(ha), "width", width);
- g_object_set_data(G_OBJECT(ha), "height", height);
- g_object_set_data(G_OBJECT(ha), "scale", scale);
- g_object_set_data(G_OBJECT(ha), "visible", visible);
- g_object_set_data(G_OBJECT(ha), "opacity", opacity);
- g_object_set_data(G_OBJECT(ha), "func", pfunc);
- */
- hildon_animation_actor_set_parent (HILDON_ANIMATION_ACTOR (ha), desktop_plugin);
-
- actor->widget = ha;
-}
-
static Actor*
init_object(AWallpaperPlugin *desktop_plugin,
gchar * name,
actor->func_change = pfunc_change;
actor->func_probability = pfunc_probability;
if (visible)
- create_hildon_actor(desktop_plugin, actor);
+ create_hildon_actor(actor, desktop_plugin);
+ else
+ actor->widget = NULL;
actor->time_start_animation = 0;
actor->duration_animation = 0;
/*
return actor;
}
+void
+change_moon(Actor * actor, AWallpaperPlugin *desktop_plugin)
+{
+ gint x, y, z, daytime, phase;
+ char *newfile;
+
+ if (actor){
+ daytime = get_daytime();
+ if (daytime == TIME_NIGHT){
+ if (!actor->visible){
+ actor->visible = TRUE;
+#if 0
+ phase = get_moon_phase();
+ fprintf(stderr, "change moon %d\n", phase);
+ fprintf(stderr, "actor name %s\n", actor->name);
+ fprintf(stderr, "actor ytghg %s\n", desktop_plugin->priv->theme);
+ newfile = g_strdup_printf( "%s/%s/%s%d.png", THEME_PATH, desktop_plugin->priv->theme, actor->name, phase);
+#endif
+
+ create_hildon_actor(actor, desktop_plugin);
+ //actor->filename = newfile;
+ //change_hildon_actor(actor, desktop_plugin);
+
+ }
+ //actor->x = 400;
+ //actor->y = 10;
+ // actor_set_position_full(actor->widget, x, y, actor->z);
+ //probability_sun(actor);
+ //fprintf(stderr, "after change sun %d\n", actor->time_start_animation);
+ }else if (actor->visible){
+ actor->visible = FALSE;
+ fprintf(stderr, "destroy moon \n");
+ destroy_hildon_actor(actor);
+ /* TO DO make moonrise*/
+ actor->time_start_animation = get_next_sunset();
+ }
+ }
+
+}
void
change_sun(Actor * actor, AWallpaperPlugin *desktop_plugin)
}
void
+create_hildon_actor(Actor *actor, AWallpaperPlugin *desktop_plugin)
+{
+ GtkWidget *ha = NULL;
+ GdkPixbuf *pixbuf = NULL;
+ GtkWidget *image = NULL;
+
+ ha = hildon_animation_actor_new();
+ gchar str[256];
+ snprintf(str, 255, "%s/%s/%s", THEME_PATH, desktop_plugin->priv->theme, actor->filename);
+ fprintf(stderr, "!!!create ha !!!!file = %s\n", str);
+ pixbuf = gdk_pixbuf_new_from_file_at_size (str,
+ actor->width,
+ actor->height,
+ NULL);
+ if (pixbuf){
+ image = gtk_image_new_from_pixbuf (pixbuf);
+ g_object_unref(G_OBJECT(pixbuf));
+ }
+ if (image){
+ g_signal_connect(G_OBJECT(image), "expose_event",
+ G_CALLBACK(expose_event), pixbuf);
+ gtk_container_add (GTK_CONTAINER (ha), image);
+ }
+fprintf(stderr, "creage ha x=%d y=%d z=%d visible=%d w=%i h=>%i ", actor->x, actor->y, actor->z, actor->visible, actor->width, actor->height);
+ actor_set_position_full(ha, actor->x, actor->y, actor->z);
+ hildon_animation_actor_set_show (ha, actor->visible);
+ hildon_animation_actor_set_scale(ha, (double)actor->scale/100, (double)actor->scale/100);
+ realize(ha);
+ gtk_widget_show_all(ha);
+
+ //g_object_set_data(G_OBJECT(ha), "name", name);
+ //g_object_set_data(G_OBJECT(ha), "filename", filename);
+ g_object_set_data(G_OBJECT(ha), "image", image);
+ /*
+ g_object_set_data(G_OBJECT(ha), "x", x);
+ g_object_set_data(G_OBJECT(ha), "y", y);
+ g_object_set_data(G_OBJECT(ha), "z", z);
+ g_object_set_data(G_OBJECT(ha), "width", width);
+ g_object_set_data(G_OBJECT(ha), "height", height);
+ g_object_set_data(G_OBJECT(ha), "scale", scale);
+ g_object_set_data(G_OBJECT(ha), "visible", visible);
+ g_object_set_data(G_OBJECT(ha), "opacity", opacity);
+ g_object_set_data(G_OBJECT(ha), "func", pfunc);
+ */
+ hildon_animation_actor_set_parent (HILDON_ANIMATION_ACTOR (ha), desktop_plugin);
+ fprintf(stderr, "image %p\n", desktop_plugin);
+ actor->widget = ha;
+}
+
+
+void
change_hildon_actor(Actor *actor, AWallpaperPlugin *desktop_plugin)
{
GtkWidget *image = NULL;
}
}
-void change_static_actor(Actor * actor, AWallpaperPlugin *desktop_plugin)
+
+
+void
+change_static_actor(Actor * actor, AWallpaperPlugin *desktop_plugin)
{
gint daytime;
gchar newfile[2048];
scene.actors = NULL;
//get_sun_pos(&alt, &azm);
//get_sun_screen_pos(alt, azm, &x, &y);
-
+
actor = init_object(desktop_plugin, "sun", "sun.png", 0, 0, 11, 88, 88, TRUE, 100, 255, &change_sun, &probability_sun);
actor->time_start_animation = time(NULL);
actor->duration_animation = G_MAXINT;
change_static_actor(actor, desktop_plugin);
scene.actors = g_slist_append(scene.actors, actor);
-#if 0
+
actor = init_object(desktop_plugin, "town", "town0.png", 0, 480-374, 10, 800, 374, 1, 100, 255, &change_static_actor, NULL);
change_static_actor(actor, desktop_plugin);
scene.actors = g_slist_append(scene.actors, actor);
actor = init_object(desktop_plugin, "border", "border0.png", 0, 480-79, 30, 800, 79, 1, 100, 255, &change_static_actor, NULL);
change_static_actor(actor, desktop_plugin);
scene.actors = g_slist_append(scene.actors, actor);
-#endif
+
+ actor = init_object(desktop_plugin, "moon", "moon1.png", 400, 50, 7, 150, 150,
+ FALSE, 100, 255, &change_moon, NULL);
+ //change_static_actor(actor, desktop_plugin);
+ scene.actors = g_slist_append(scene.actors, actor);
#if 0
//if (scene.daytime == TIME_DAY) snprintf(str, 255, "tram.png");