actor_set_position_full(actor, x, y, z);
hildon_animation_actor_set_show (actor, visible);
+ hildon_animation_actor_set_scale(actor, (double)scale/100, (double)scale/100);
realize(actor);
gtk_widget_show_all(actor);
g_object_set_data(G_OBJECT(actor), "name", name);
}
}
void change_tram(GtkWidget * actor, gpointer data)
-{
+{
double alt, azm;
gint x, y, z, scale, width, height, daytime;
- //fprintf(stderr, "change sun \n");
+ fprintf(stderr, "change tram %i \n", data);
if (actor){
x = g_object_get_data(G_OBJECT(actor), "x");
y = g_object_get_data(G_OBJECT(actor), "y");
}
}
+static void path_tram(GtkWidget * actor, gint* t)
+{
+ gint x0 = -300, y0 = 191, scale0 = 100, t0 = 0,
+ x1 = 800, y1 = 119, scale1 = 130, t1 = 100,
+ x, y, scale;
+ x = 12 * *t - 300;
+ y = -0.72 * *t + 191;
+ scale = 0.3 * *t + 100;
+ if (x >= x1){
+ x = x0;
+ y = y0;
+ scale = scale0;
+ *t = 0;
+ }
+ fprintf(stderr, "path tram: t=%i, x=%i, y=%i, scale=%i\n", *t, x, y, scale);
+ actor_set_position_full(actor, x, y, g_object_get_data(G_OBJECT(actor), "z"));
+ hildon_animation_actor_set_scale(actor, (double)scale/100, (double)scale/100);
+}
+static gint get_time(gint t)
+{
+ return t*1.2;
+
+}
+
static void
init_scene(GtkWidget *window)
{
actor = init_object("tram", "tram.png", -300, 191, 25, 350, 240, 1, 100, 255, NULL);
scene.dynamic_actors = g_slist_append(scene.dynamic_actors, G_OBJECT(actor));
-
-}
+ }
static void
init_scene1(GtkWidget *window)
{
}
}
-
+gint ttt = 0;
static gboolean
plugin_on_timeout (AWallpaperPlugin *desktop_plugin)
{
gint daytime = get_daytime();
GSList * tmp;
+ gchar * name;
void (*pfunc)(gpointer, gpointer);
//fprintf(stderr, "on timeout\n");
while (tmp != NULL){
//change_actor(tmp->data);
pfunc = g_object_get_data(G_OBJECT(tmp->data), "func");
+ name = g_object_get_data(G_OBJECT(tmp->data), "name");
+ if (name == "tram"){
+ path_tram(tmp->data, &ttt);
+ ttt = get_time(ttt+1);
+ }else
if (pfunc){
(*pfunc)(tmp->data, NULL);
}
static void
animation_wallpaper_plugin_init (AWallpaperPlugin *desktop_plugin)
{
- GtkWidget *label;
-
- Animation_WallpaperPrivate *priv = Animation_Wallpaper_HOME_PLUGIN_GET_PRIVATE (desktop_plugin);
- desktop_plugin->priv = Animation_Wallpaper_HOME_PLUGIN_GET_PRIVATE (desktop_plugin);
- /* Load config */
- read_config(priv);
- label = gtk_label_new ("");
- gtk_widget_set_size_request(label, 95, 30);
- gtk_widget_show (label);
- hd_home_plugin_item_set_settings (HD_HOME_PLUGIN_ITEM (desktop_plugin), TRUE);
- g_signal_connect (desktop_plugin, "show-settings",
+ GtkWidget *label;
+ Animation_WallpaperPrivate *priv = Animation_Wallpaper_HOME_PLUGIN_GET_PRIVATE (desktop_plugin);
+ desktop_plugin->priv = Animation_Wallpaper_HOME_PLUGIN_GET_PRIVATE (desktop_plugin);
+ label = gtk_label_new ("");
+ //desktop_plugin->priv->main_widget = label;
+ gtk_widget_set_size_request(label, 95, 30);
+ gtk_widget_show (label);
+ hd_home_plugin_item_set_settings (HD_HOME_PLUGIN_ITEM (desktop_plugin), TRUE);
+ g_signal_connect (desktop_plugin, "show-settings",
G_CALLBACK (lw_settings), NULL);
- g_signal_connect (desktop_plugin, "notify::is-on-current-desktop",
+ 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);
- priv->timer = g_timeout_add(50, plugin_on_timeout, desktop_plugin);
+ gtk_container_add (GTK_CONTAINER (desktop_plugin), label);
+ init_applet_position();
+ init_scene(desktop_plugin);
+ priv->timer = g_timeout_add(1000, plugin_on_timeout, desktop_plugin);
}
static void
g_source_remove(priv->timer);
priv->timer = NULL;
}
- /* Save config */
- save_config(priv);
}
static void