From 28e8668a8f6d0ab21a6f3f88cc62a2387740a637 Mon Sep 17 00:00:00 2001 From: Vlad Vasiliev Date: Mon, 12 Apr 2010 19:46:38 +0300 Subject: [PATCH] rich_animation option is done --- applet/src/livewp-home-widget.c | 27 ++++++++++++++++----------- applet/src/livewp-settings.c | 7 ++++--- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/applet/src/livewp-home-widget.c b/applet/src/livewp-home-widget.c index 1874793..6c049e3 100644 --- a/applet/src/livewp-home-widget.c +++ b/applet/src/livewp-home-widget.c @@ -332,8 +332,7 @@ change_tram(Actor * actor, AWallpaperPlugin *desktop_plugin) ms = tvb.tv_usec; sec = tvb.tv_sec; -// fprintf(stderr, "1 %f - %d\n", sec+(double)ms/100000, now); - + if (!actor->visible){ actor->visible = TRUE; if (scene.daytime == TIME_NIGHT){ @@ -875,8 +874,10 @@ short_timeout (AWallpaperPlugin *desktop_plugin) Actor *actor; gboolean stop_flag = TRUE; - if (!desktop_plugin->priv->visible) - return TRUE; + if (!desktop_plugin->priv->visible || !desktop_plugin->priv->rich_animation){ + desktop_plugin->priv->short_timer = 0; + return FALSE; + } now = time(NULL); //scene.daytime = daytime; @@ -913,8 +914,10 @@ long_timeout (AWallpaperPlugin *desktop_plugin) Actor *actor; /* TODO remove timeout */ - if (!desktop_plugin->priv->visible) - return TRUE; + if (!desktop_plugin->priv->visible){ + desktop_plugin->priv->short_timer = 0; + return FALSE; + } //fprintf(stderr, "timer daytime=%d\n", daytime); if (scene.daytime != daytime){ tmp = scene.actors; @@ -938,7 +941,8 @@ long_timeout (AWallpaperPlugin *desktop_plugin) && desktop_plugin->priv->short_timer == 0){ actor->time_start_animation = now; /* fprintf(stderr, "start short timer act = %s %d\n", actor->name, now); */ - desktop_plugin->priv->short_timer = g_timeout_add(SHORT_TIMER, (GtkFunction)short_timeout, desktop_plugin); + if (desktop_plugin->priv->rich_animation) + desktop_plugin->priv->short_timer = g_timeout_add(SHORT_TIMER, (GtkFunction)short_timeout, desktop_plugin); } tmp = g_slist_next(tmp); } @@ -953,11 +957,12 @@ desktop_plugin_visible_notify (GObject *object, GParamSpec *spec, AWallpaperPlugin *desktop_plugin) { - gboolean visible; - g_object_get (object, "is-on-current-desktop", &visible, NULL); - if (visible) + gboolean visible; + g_object_get (object, "is-on-current-desktop", &visible, NULL); + if (visible){ desktop_plugin->priv->visible = TRUE; - else + desktop_plugin->priv->long_timer = g_timeout_add(LONG_TIMER, (GtkFunction)long_timeout, desktop_plugin); + }else desktop_plugin->priv->visible = FALSE; /* fprintf (stderr, "is-on-current-desktop changed. visible: %u", visible); */ } diff --git a/applet/src/livewp-settings.c b/applet/src/livewp-settings.c index 6b1ec12..6d3712b 100644 --- a/applet/src/livewp-settings.c +++ b/applet/src/livewp-settings.c @@ -86,12 +86,12 @@ create_themes_button (gchar *theme){ /*******************************************************************************/ GtkWidget * -create_rich_animation_button (void) +create_rich_animation_button (gboolean active) { GtkWidget *button; button = hildon_check_button_new (HILDON_SIZE_AUTO); gtk_button_set_label (GTK_BUTTON (button), _("Rich Animation")); -// g_signal_connect (button, "toggled", G_CALLBACK (button_toggled), NULL); + hildon_check_button_set_active(button, active); return button; } @@ -113,10 +113,11 @@ lw_settings(GtkWidget *widget, Animation_WallpaperPrivate *priv){ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox), theme_button, TRUE, TRUE, 5); /* Create rich animation button */ - rich_animation_button = create_rich_animation_button(); + rich_animation_button = create_rich_animation_button(priv->rich_animation); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox), rich_animation_button, TRUE, TRUE, 5); gtk_widget_show (theme_button); + gtk_widget_show (rich_animation_button); gtk_widget_show (window); gtk_dialog_add_button(GTK_DIALOG(window), _("About"), GTK_RESPONSE_NO); save_button = gtk_dialog_add_button(GTK_DIALOG(window), _("Save"), GTK_RESPONSE_YES); -- 1.7.9.5