return actor;
}
+void
+destroy_actor(Actor *actor)
+{
+ if (actor){
+ if (actor->child){
+ g_ptr_array_free(actor->child, TRUE);
+ }
+ if (actor->filename)
+ g_free(actor->filename);
+ if (actor->name)
+ g_free(actor->name);
+ gtk_widget_destroy(actor->widget);
+ //actor->widget = NULL;
+ g_free(actor);
+ }
+}
static gint
path_line(gint x0, gint x1, double t)
{
// уравниение прямой
return ((x1 - x0) * t + x0);
}
+static void
+set_actor_scale(Actor *actor, double scalex, double scaley)
+{
+ hildon_animation_actor_set_scale(
+ HILDON_ANIMATION_ACTOR(actor->widget),
+ scalex,
+ scaley
+ );
+
+}
+
+static void
+set_actor_visible(Actor *actor, gboolean visible)
+{
+ hildon_animation_actor_set_show(HILDON_ANIMATION_ACTOR(actor->widget), visible);
+}
+
+void
+set_actor_position(Actor *actor, gint x, gint y, gint z, AWallpaperPlugin *desktop_plugin)
+{
+ hildon_animation_actor_set_position_full(HILDON_ANIMATION_ACTOR (actor->widget),
+ x-desktop_plugin->priv->xapplet,
+ y-desktop_plugin->priv->yapplet,
+ z);
+}
void
change_moon(Actor * actor, AWallpaperPlugin *desktop_plugin)
y = 0.001920*x*x - 1.536*x + 337.2;
//y = a*x*x + b*x + c;
- actor_set_position_full(actor->widget, x, y, actor->z);
+ set_actor_position(actor, x, y, actor->z, desktop_plugin);
if (t>=2){
actor->time_start_animation = sec;
get_sun_screen_pos(alt, azm, &x, &y);
actor->x = x;
actor->y = y;
- actor_set_position_full(actor->widget, x, y, actor->z);
+ set_actor_position(actor, x, y, actor->z, desktop_plugin);
actor->time_start_animation = time(NULL) + 60;
}else if (actor->visible){
actor->visible = FALSE;
x = path_line(x0, x1, t);
y = path_line(y0, y1, t);
scale = path_line(scale0, scale1, t);
- actor_set_position_full(actor->widget, x, y, actor->z);
+ set_actor_position(actor, x, y, actor->z, desktop_plugin);
set_actor_scale(actor, (double)scale/100, (double)scale/100);
if (t >= 1){
/* stop animation */
x = path_line(x0, x1, t);
y = path_line(y0, y1, t);
//scale = path_line(scale0, scale1, t);
- actor_set_position_full(actor->widget, x, y, actor->z);
+ set_actor_position(actor, x, y, actor->z, desktop_plugin);
if (t >= 1){
/* stop animation */
actor->visible = FALSE;
x = path_line(x0, x1, t);
y = path_line(y0, y1, t);
//scale = path_line(scale0, scale1, t);
- actor_set_position_full(actor->widget, x, y, actor->z);
+ set_actor_position(actor, x, y, actor->z, desktop_plugin);
if (t >= 1){
/* stop animation */
actor->visible = FALSE;
y = -desktop_plugin->priv->scene->wind_angle * (x - x0) + actor->y;
scale = path_line(scale0, scale1, (double)(y - y0)/(y1 - y0));
- actor_set_position_full(actor->widget, x, y, actor->z);
+ set_actor_position(actor, x, y, actor->z, desktop_plugin);
set_actor_scale(actor, (double)scale/100, (double)scale/100);
if ((y < y1 || y > y0) || t >= 1){
/* stop animation */
}
void
-set_actor_scale(Actor *actor, double scalex, double scaley)
+change_layer(Actor * actor, AWallpaperPlugin *desktop_plugin)
{
- hildon_animation_actor_set_scale(
- HILDON_ANIMATION_ACTOR(actor->widget),
- scalex,
- scaley
- );
+ gint y;
+ Actor *a;
-}
+ if (!desktop_plugin->priv->rich_animation) return;
-void
-set_actor_visible(Actor *actor, gboolean visible)
-{
- hildon_animation_actor_set_show(HILDON_ANIMATION_ACTOR(actor->widget), visible);
+ a = g_ptr_array_index(actor->child, 0);
+ y = a->y + 10;
+ if (y > 480) y = -480;
+ set_actor_position(a, a->x, y, a->z, desktop_plugin);
+ a->y = y;
+
+ a = g_ptr_array_index(actor->child, 1);
+ y = a->y + 10;
+ if (y > 480) y = -480;
+ set_actor_position(a, a->x, y, a->z, desktop_plugin);
+ a->y = y;
+
+ a = g_ptr_array_index(actor->child, 2);
+ y = a->y + 20;
+ if (y > 480) y = -480;
+ set_actor_position(a, a->x, y, a->z, desktop_plugin);
+ a->y = y;
+
+ a = g_ptr_array_index(actor->child, 3);
+ y = a->y + 20;
+ if (y > 480) y = -480;
+ set_actor_position(a, a->x, y, a->z, desktop_plugin);
+ a->y = y;
}
+
+
void (*pfunc_probability)(Actor*),
GPtrArray *child
);
-
+void destroy_actor(Actor *actor);
+void set_actor_position(Actor *actor, gint x, gint y, gint z, AWallpaperPlugin *desktop_plugin);
void change_moon(Actor * actor, AWallpaperPlugin *desktop_plugin);
void change_sun(Actor * actor, AWallpaperPlugin *desktop_plugin);
void change_tram(Actor * actor, AWallpaperPlugin *desktop_plugin);
void change_wind(Actor *actor, AWallpaperPlugin *desktop_plugin);
void change_window1(Actor * actor, AWallpaperPlugin *desktop_plugin);
void change_signal(Actor * actor, AWallpaperPlugin *desktop_plugin);
-void set_actor_scale(Actor *actor, double scalex, double scaley);
-void set_actor_visible(Actor *actor, gboolean visible);
void change_layer(Actor * actor, AWallpaperPlugin *desktop_plugin);
#endif
DBusConnection *dbus_conn_session;
osso_context_t *osso;
Scene *scene;
+ gint xapplet;
+ gint yapplet;
};
struct _AWallpaperPlugin
#define Xstartposition 700
#define Ystartposition 448
-gint xapplet = 0, yapplet = 0;
-//Scene scene;
+//gint xapplet = 0, yapplet = 0;
static void
lw_applet_realize (GtkWidget *widget)
/* Set position of widget on desktop */
static void
-init_applet_position(void)
+init_applet_position(gint *xapplet, gint *yapplet)
{
GSList *position = NULL;
gchar *position_key;
GCONF_VALUE_INT,
NULL);
if (position && position->data && position->next->data){
- xapplet = GPOINTER_TO_INT (position->data);
- yapplet = GPOINTER_TO_INT (position->next->data);
+ *xapplet = GPOINTER_TO_INT (position->data);
+ *yapplet = GPOINTER_TO_INT (position->next->data);
}else{
position = g_slist_prepend (g_slist_prepend (NULL,
GINT_TO_POINTER (Ystartposition)),
GCONF_VALUE_INT,
position,
&error);
- xapplet = Xstartposition;
- yapplet = Ystartposition;
+ *xapplet = Xstartposition;
+ *yapplet = Ystartposition;
}
g_free (position_key);
modified = g_strdup_printf ("%i", 0);
actor_set_position_full(GtkWidget *actor, gint x, gint y, gint z)
{
/* fprintf(stderr, "actor_set_position_full z=%d\n", z); */
- hildon_animation_actor_set_position_full (HILDON_ANIMATION_ACTOR (actor),x-xapplet, y-yapplet, z);
+ hildon_animation_actor_set_position_full (HILDON_ANIMATION_ACTOR (actor),x-0, y-0, z);
}
G_CALLBACK(expose_event), pixbuf);
gtk_container_add (GTK_CONTAINER (ha), image);
}
- actor_set_position_full(ha, actor->x, actor->y, actor->z);
+ //actor_set_position_full(ha, actor->x, actor->y, actor->z);
hildon_animation_actor_set_scale(HILDON_ANIMATION_ACTOR(ha), (double)actor->scale/100, (double)actor->scale/100);
realize(ha);
gtk_widget_show_all(ha);
g_object_set_data(G_OBJECT(ha), "image", image);
hildon_animation_actor_set_parent (HILDON_ANIMATION_ACTOR (ha), GTK_WINDOW(desktop_plugin));
actor->widget = ha;
+ set_actor_position(actor, actor->x, actor->y, actor->z, desktop_plugin);
}
}
-void
-change_layer(Actor * actor, AWallpaperPlugin *desktop_plugin)
-{
- gint y;
- Actor *a;
-
- if (!desktop_plugin->priv->rich_animation) return;
-
- a = g_ptr_array_index(actor->child, 0);
- y = a->y + 10;
- if (y > 480) y = -480;
- actor_set_position_full(a->widget, a->x, y, a->z);
- a->y = y;
-
- a = g_ptr_array_index(actor->child, 1);
- y = a->y + 10;
- if (y > 480) y = -480;
- actor_set_position_full(a->widget, a->x, y, a->z);
- a->y = y;
-
- a = g_ptr_array_index(actor->child, 2);
- y = a->y + 20;
- if (y > 480) y = -480;
- actor_set_position_full(a->widget, a->x, y, a->z);
- a->y = y;
-
- a = g_ptr_array_index(actor->child, 3);
- y = a->y + 20;
- if (y > 480) y = -480;
- actor_set_position_full(a->widget, a->x, y, a->z);
- a->y = y;
-
-}
-#if 0
-void
-change_layer1(Actor * actor, AWallpaperPlugin *desktop_plugin)
-{
- gint y;
- y = actor->y + 10;
- if (y > 480) y = -480;
- actor_set_position_full(actor->widget, actor->x, y, actor->z);
- actor->y = y;
-}
-
-void
-change_layer2(Actor * actor, AWallpaperPlugin *desktop_plugin)
-{
- gint y;
- y = actor->y + 15;
- if (y >= 480) y = -480;
- actor_set_position_full(actor->widget, actor->x, y, actor->z);
- actor->y = y;
-}
-#endif
/*
static gint
get_time(gint t){
destroy_scene(AWallpaperPlugin *desktop_plugin)
{
GSList * tmp = desktop_plugin->priv->scene->actors;
- Actor *actor;
while (tmp != NULL){
- actor = tmp->data;
- if (actor){
- if (actor->child){
- g_ptr_array_free(actor->child, TRUE);
- }
- if (actor->filename)
- g_free(actor->filename);
- if (actor->name)
- g_free(actor->name);
- gtk_widget_destroy(actor->widget);
- //actor->widget = NULL;
- g_free(actor);
- }
+ destroy_actor(tmp->data);
tmp = g_slist_next(tmp);
}
g_slist_free(tmp);
priv->desktop_plugin = desktop_plugin;
priv->visible = TRUE;
priv->short_timer = 0;
+ priv->xapplet = 0;
+ priv->yapplet = 0;
//priv->theme = g_strdup("Modern");
desktop_plugin->priv->main_widget = gtk_fixed_new();
GtkWidget *label = gtk_label_new ("ddddddddddddd");
gtk_widget_set_size_request(label, 95, 30);
gtk_widget_show (label);
-// gtk_container_add (GTK_CONTAINER (desktop_plugin), label);
+ gtk_container_add (GTK_CONTAINER (desktop_plugin), label);
gtk_fixed_put(GTK_FIXED(widget), label, 0, 0);
*/
hd_home_plugin_item_set_settings (HD_HOME_PLUGIN_ITEM (desktop_plugin), TRUE);
G_CALLBACK (show_settings), priv);
gtk_widget_show (desktop_plugin->priv->main_widget);
gtk_container_add (GTK_CONTAINER (desktop_plugin), desktop_plugin->priv->main_widget);
- init_applet_position();
+ init_applet_position(&(priv->xapplet), &(priv->yapplet));
fprintf(stderr, "!!!theme = %s\n", priv->theme);