* 02110-1301 USA
*/
/*******************************************************************************/
-#include <gtk/gtk.h>
-#include <hildon/hildon.h>
+#include "livewp-common.h"
#include "livewp-home-widget.h"
#include <gconf/gconf-client.h>
#include "livewp-rules.h"
gint xapplet = 0, yapplet = 0;
GSList * objects_list = NULL;
+MultiActor * ma1;
Scene scene;
static void
g_object_unref(gconf_client);
}
-static void
+void
actor_set_position_full(GtkWidget *actor, gint x, gint y, gint z)
{
fprintf(stderr, "actor_set_position_full\n");
static GtkWidget*
init_object(gchar * name, gint x, gint y, gint z, gint width, gint height)
{
- Actor a;
GtkWidget *actor;
GdkPixbuf *pixbuf;
GtkWidget *image;
+ gdouble scale = 1.0;
actor = hildon_animation_actor_new();
gchar str[256];
snprintf(str, 255, "/usr/share/anwall/%s.png", name);
- /* fprintf(stderr, "!!!init object !!!!\nname = %s file = %s\n", name, str); */
+ //fprintf(stderr, "!!!init object !!!!\nname = %s file = %s\n", name, str);
pixbuf = gdk_pixbuf_new_from_file_at_size (str,
width,
height,
hildon_animation_actor_set_show (actor, 1);
realize(actor);
gtk_widget_show_all(actor);
+
g_object_set_data(G_OBJECT(actor), "name", name);
+ g_object_set_data(G_OBJECT(actor), "image", image);
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), "z", z);
g_object_set_data(G_OBJECT(actor), "scale", 10);
-
+ g_object_set_data(G_OBJECT(actor), "visible", 1);
+ hildon_animation_actor_set_parent (HILDON_ANIMATION_ACTOR (actor), scene.window);
+/*
+ a.widget = actor;
+ a.name = name;
+ a.x = x;
+ a.y = y;
+ a.z = z;
+ */
//objects_list = g_slist_append(objects_list, G_OBJECT(actor));
//objects_list = g_slist_append(objects_list, G_OBJECT(a));
return actor;
get_sun_screen_pos(alt, azm, &x, &y);
fprintf(stderr, "init scene\n");
actor = init_object("sun", x, y, 20, 88, 88);
- hildon_animation_actor_set_parent (HILDON_ANIMATION_ACTOR (actor), window);
scene.static_actors = g_slist_append(scene.static_actors, G_OBJECT(actor));
scene.dynamic_actors = g_slist_append(scene.dynamic_actors, G_OBJECT(actor));
actor = init_object("sky", 0, 0, 0, 800, 480);
- hildon_animation_actor_set_parent (HILDON_ANIMATION_ACTOR (actor), window);
scene.static_actors = g_slist_append(scene.static_actors, G_OBJECT(actor));
actor = init_object("town", 0, 0, 10, 800, 480);
- hildon_animation_actor_set_parent (HILDON_ANIMATION_ACTOR (actor), window);
scene.static_actors = g_slist_append(scene.static_actors, G_OBJECT(actor));
actor = init_object("cloud1", 400, 150, 2, 200, 150);
- hildon_animation_actor_set_parent (HILDON_ANIMATION_ACTOR (actor), window);
scene.dynamic_actors = g_slist_append(scene.dynamic_actors, G_OBJECT(actor));
+ GSList * list = NULL;
+ actor = init_object("sun", 10, 10, 50, 88, 88);
+ list = g_slist_append(list, G_OBJECT(actor));
+ actor = init_object("cloud1", 50, 50, 49, 150, 100);
+ list = g_slist_append(list, G_OBJECT(actor));
+
+ ma1 = multiactor_init("multi", list, 0, 0, 50, 1.0, TRUE);
+ //objects_list = g_slist_append(objects_list, G_OBJECT(ma));
+
+
}
void
*y = (int)((1 - alt) * y0) - 64;
}
+void change_multiactor()
+{
+ gboolean fl;
+ double scale;
+ gint x, y, z;
+ if (ma1->visible) fl = FALSE;
+ else fl = TRUE;
+ //multiactor_set_visible(ma1, fl);
+
+ scale = ma1->scale;
+ scale -= 0.1;
+ if (scale == 0) scale = 1;
+ //multiactor_set_scale(ma1, scale);
+
+ x = ma1->x + 10;
+ y = ma1->y + 10;
+ multiactor_set_position(ma1, x, y, 0);
+
+}
+
static void
change_actor(GtkWidget * actor)
{
char * name;
- gint x, y, daytime, sc;
- double scale;
+ gint x, y, daytime, scale;
+ gdouble sc;
double alt, azm;
+
+ GtkWidget *image;
+ GdkPixbuf *pixbuf;
+
name = g_object_get_data(G_OBJECT(actor), "name");
fprintf(stderr, "change actor %s\n", name);
if (name == "sun"){
if (name == "cloud1"){
x = g_object_get_data(G_OBJECT(actor), "x");
y = g_object_get_data(G_OBJECT(actor), "y");
- sc = g_object_get_data(G_OBJECT(actor), "scale");
+ 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/anwall/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;
- sc -= 1;
- if (x > 600){
+ scale -= 1;
+ if (x > 500){
x = 400;
y = 150;
- sc = 10;
+ sc = 1;
}
- scale = (double)sc / 10;
- hildon_animation_actor_set_scale(actor, scale, scale);
- fprintf(stderr, "cloud x=%d y=%d scale=%f", x, y, scale);
+ sc = (double)scale / 10;
+ 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", sc);
+ g_object_set_data(G_OBJECT(actor), "scale", scale);
}
}
GSList * tmp;
fprintf(stderr, "on timeout\n");
+ change_multiactor();
+
if (scene.daytime == daytime){
/* Change dynamic actors */
tmp = scene.dynamic_actors;
*/
return TRUE; /* keep running this event */
}
-void
-live_wallpaper_settings(GtkWidget *widget, gpointer user_data){
- fprintf(stderr,"test\n");
+
+static void
+desktop_plugin_visible_notify (GObject *object,
+ GParamSpec *spec,
+ AWallpaperPlugin *desktop_plugin)
+{
+ gboolean visible;
+ g_object_get (object, "is-on-current-desktop", &visible, NULL);
+ fprintf (stderr, "is-on-current-desktop changed. visible: %u", visible);
}
+
static void
animation_wallpaper_plugin_init (AWallpaperPlugin *desktop_plugin)
{
hd_home_plugin_item_set_settings (HD_HOME_PLUGIN_ITEM (desktop_plugin), TRUE);
g_signal_connect (desktop_plugin, "show-settings",
G_CALLBACK (live_wallpaper_settings), NULL);
+ g_signal_connect (desktop_plugin, "notify::is-on-current-desktop",
+ G_CALLBACK (desktop_plugin_visible_notify), desktop_plugin);
+
gtk_container_add (GTK_CONTAINER (desktop_plugin), label);
init_applet_position();
init_scene(desktop_plugin);