From e90c69cd1ad0dce5a733c09a81a54b8b5de97414 Mon Sep 17 00:00:00 2001 From: tanya Date: Fri, 9 Apr 2010 15:46:48 +0300 Subject: [PATCH] added type of timeout --- applet/src/Makefile.am | 1 - applet/src/livewp-common.h | 14 ++--- applet/src/livewp-home-widget.c | 107 +++++---------------------------------- applet/src/livewp-home-widget.h | 5 +- 4 files changed, 18 insertions(+), 109 deletions(-) diff --git a/applet/src/Makefile.am b/applet/src/Makefile.am index a4b7464..3df4273 100644 --- a/applet/src/Makefile.am +++ b/applet/src/Makefile.am @@ -7,7 +7,6 @@ liblivewp_home_widget_la_SOURCES = livewp-home-widget.c livewp-home-widget.h \ livewp-astro.c livewp-astro.h \ livewp-rules.c livewp-rules.h \ livewp-settings.c livewp-settings.h livewp-common.h \ - livewp-multiactor.c livewp-multiactor.h \ livewp-config.c livewp-config.h liblivewp_home_widget_la_LIBADD = $(EXAMPLE_LIBS) diff --git a/applet/src/livewp-common.h b/applet/src/livewp-common.h index 521f6e8..972c146 100644 --- a/applet/src/livewp-common.h +++ b/applet/src/livewp-common.h @@ -31,18 +31,10 @@ #include #define THEME_PATH "/usr/share/livewp/theme" -#define NAME_SIZE 256: +#define SHORT_TIMER 100 /* 100 milisecond */ +#define LONG_TIMER 10*60*1000 /* 10 minutes */ +enum { SHORT_TIMER_TYPE, LONG_TIMER_TYPE }; -typedef struct { - gchar * name; - GSList * child; - gint x; - gint y; - gint z; - double scale; - gboolean visible; - -} MultiActor; typedef struct _AWallpaperPlugin AWallpaperPlugin; typedef struct _AWallpaperPluginClass AWallpaperPluginClass; diff --git a/applet/src/livewp-home-widget.c b/applet/src/livewp-home-widget.c index 4f083cb..7815088 100644 --- a/applet/src/livewp-home-widget.c +++ b/applet/src/livewp-home-widget.c @@ -43,7 +43,6 @@ HD_DEFINE_PLUGIN_MODULE (AWallpaperPlugin, animation_wallpaper_plugin, HD_TYPE_H gint xapplet = 0, yapplet = 0; GSList * objects_list = NULL; -MultiActor * ma1; Scene scene; static void @@ -610,27 +609,7 @@ get_sun_screen_pos(double alt, double azm, gint * x, gint * y) *y = (int)((1 - alt) * y0) - 64; //fprintf(stderr, "sun pos x=%d y=%d\n", *x, *y); } - -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); - -} - +#if 0 static void change_actor(GtkWidget * actor) { @@ -702,6 +681,7 @@ change_actor(GtkWidget * actor) } } +#endif static gboolean plugin_on_timeout (AWallpaperPlugin *desktop_plugin) { @@ -744,70 +724,9 @@ fprintf(stderr, "timer daytime=%d\n", daytime); tmp = g_slist_next(tmp); } -#if 0 - while (tmp != NULL) - { - anim = tmp->data; - if (anim == NULL) fprintf(stderr, "get anim\n"); - t = now - anim->timestart; - if (t > anim->timeall){ - anim->timestart = now; - if (anim->count != -1) anim->count--; - - } - if (anim->count == 0){ - g_free(anim); - scene.dynamic_actors = g_slist_remove(scene.dynamic_actors, anim); - //tmp->data = NULL; - tmp = scene.dynamic_actors; - fprintf(stderr, "delete anim %d\n", g_slist_length(tmp)); - - }else { - if (anim->func_time ) t = (*anim->func_time)(t); - if (anim->func_change) (*anim->func_change)(anim->actor, (double)t/anim->timeall); - tmp = g_slist_next(tmp); - } - } - #endif - scene.daytime = daytime; + scene.daytime = daytime; - //double azm, alt; - //get_sun_pos(&alt, &azm); -/* - GSList * tmp = objects_list; - while (tmp != NULL){ - //processing(tmp->data); - - str = g_object_get_data(G_OBJECT(tmp->data), "name"); - fprintf(stderr, "object: %s\n", str); - - if (str == "sun"){ - //get_sun_screen_pos(alt, azm, &x, &y); - //x = tmp->data - //actor_set_position_full(tmp->data, x, y, 20); - //g_object_set_data(G_OBJECT(tmp->data), "posX", x); - //g_object_set_data(G_OBJECT(tmp->data), "posY", y); - //fprintf(stderr, "x = %d y = %d\n", x, y); - child = gtk_container_get_children(GTK_CONTAINER (tmp->data)); - while (child != NULL) { - gtk_container_remove(GTK_CONTAINER (tmp->data), child->data); - child = child->next; - } - - //snprintf(str, 255, "/usr/share/anwall/%s.png", name); - //fprintf(stderr, "!!!init object !!!!\nname = %s file = %s\n", name, str); - - } - - if (str == "town"){ - //hildon_animation_actor_set_show(tmp->data, 0); - } - //a = tmp->data; - //fprintf(stderr, "--timeout %s\n", a->name); - tmp = g_slist_next(tmp); - } - */ - return TRUE; /* keep running this event */ + return TRUE; /* keep running this event */ } static void @@ -844,14 +763,16 @@ animation_wallpaper_plugin_init (AWallpaperPlugin *desktop_plugin) 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(); - fprintf(stderr, "!!!theme = %s\n", priv->theme); - if (!strcmp(priv->theme,"Modern")) - init_scene(desktop_plugin); - else if (!strcmp(priv->theme,"Berlin")) - init_scene(desktop_plugin); - priv->timer = g_timeout_add(1000*3, plugin_on_timeout, desktop_plugin); + gtk_container_add (GTK_CONTAINER (desktop_plugin), label); + init_applet_position(); + fprintf(stderr, "!!!theme = %s\n", priv->theme); + if (!strcmp(priv->theme,"Modern")) + init_scene(desktop_plugin); + else if (!strcmp(priv->theme,"Berlin")) + init_scene(desktop_plugin); + priv->timer = g_timeout_add(LONG_TIMER, plugin_on_timeout, desktop_plugin); + /* TODO Move scene to priv */ + scene.timer_type = LONG_TIMER_TYPE; } static void diff --git a/applet/src/livewp-home-widget.h b/applet/src/livewp-home-widget.h index 55cf195..bcb8db2 100644 --- a/applet/src/livewp-home-widget.h +++ b/applet/src/livewp-home-widget.h @@ -50,6 +50,7 @@ G_BEGIN_DECLS typedef struct { GSList * actors; gint daytime; + gint timer_type; } Scene; /* typedef struct { @@ -67,10 +68,6 @@ GType animation_wallpaper_plugin_get_type(void); G_END_DECLS void lw_settings(GtkWidget *widget, gpointer user_data); -MultiActor *multiactor_init(gchar * name, GSList * child, gint x, gint y, gint z, double scale, gboolean visible); -void multiactor_set_visible(MultiActor *ma, gboolean visible); -void multiactor_set_scale(MultiActor *ma, double scale); -void multiactor_set_position(MultiActor *ma, gint dx, gint dy, gint dz); void actor_set_position_full(GtkWidget *actor, gint x, gint y, gint z); gint read_config(Animation_WallpaperPrivate *priv); void save_config(Animation_WallpaperPrivate *priv); -- 1.7.9.5