From 3cc5415844e2b3ef76b6d145e0a4080e294f496a Mon Sep 17 00:00:00 2001 From: vlad Date: Sun, 25 Jul 2010 15:01:44 +0300 Subject: [PATCH] desktop swipe is done --- applet/src/livewp-common.h | 2 ++ applet/src/livewp-config.h | 1 - applet/src/livewp-main.c | 45 +++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 44 insertions(+), 4 deletions(-) diff --git a/applet/src/livewp-common.h b/applet/src/livewp-common.h index 5c00b29..4a0bea8 100644 --- a/applet/src/livewp-common.h +++ b/applet/src/livewp-common.h @@ -33,6 +33,7 @@ #include #include #include +#include #define GETTEXT_PACKAGE "livewp" #include @@ -90,6 +91,7 @@ struct _Animation_WallpaperPrivate GKeyFile *config_file; gint view; pid_t pid; + guint view_notify; }; struct _AWallpaperPlugin diff --git a/applet/src/livewp-config.h b/applet/src/livewp-config.h index 9b9151f..7431eaf 100644 --- a/applet/src/livewp-config.h +++ b/applet/src/livewp-config.h @@ -26,7 +26,6 @@ #define _livewp_config_h 1 #include "livewp-common.h" -#include #define GCONF_KEY_PREFIX "/apps/maemo/livewp" #define GCONF_KEY_THEME GCONF_KEY_PREFIX"/theme" diff --git a/applet/src/livewp-main.c b/applet/src/livewp-main.c index 56a4f2d..606de53 100644 --- a/applet/src/livewp-main.c +++ b/applet/src/livewp-main.c @@ -41,6 +41,7 @@ btn_setting_clicked(HildonButton *btn, gpointer data) lw_main_settings(priv, NULL); fprintf(stderr, "btn setting clicked, %s\n", priv->theme); } +/*******************************************************************************/ void btn_power_clicked(HildonButton *btn, gpointer data) { @@ -52,7 +53,10 @@ btn_power_clicked(HildonButton *btn, gpointer data) else hildon_button_set_text(HILDON_BUTTON(btn), _("Stop"), "stop"); } -static void set_live_bg (Display *display, Window xwindow, int mode) +/*******************************************************************************/ +static void set_live_bg (Display *display, Window xwindow, int mode); +static +void set_live_bg (Display *display, Window xwindow, int mode) { Atom atom; @@ -65,6 +69,33 @@ static void set_live_bg (Display *display, Window xwindow, int mode) XA_INTEGER, 32, PropModeReplace, (unsigned char *) &mode, 1); } +/*******************************************************************************/ +void +view_changed (GConfClient *client, guint cnxn_id, + GConfEntry *entry, Animation_WallpaperPrivate *priv) +{ + GConfValue *value; + value = gconf_entry_get_value (entry); + if (value) { + if (priv->view == gconf_value_get_int (value)) + priv->visible = TRUE; + else + priv->visible = FALSE; + if (priv->visible){ + if (priv->long_timer == 0 ){ + priv->long_timer = g_timeout_add(LONG_TIMER, (GtkFunction)long_timeout, priv->desktop_plugin); + run_long_timeout(priv->desktop_plugin); + } + }else{ + if (priv->long_timer != 0 ){ + g_source_remove(priv->long_timer); + priv->long_timer = 0; + } + } + gconf_value_free(value); + } +} +/*******************************************************************************/ void quit_from_program (Animation_WallpaperPrivate *priv) { @@ -79,10 +110,12 @@ quit_from_program (Animation_WallpaperPrivate *priv) priv->short_timer = 0; } destroy_scene(priv->desktop_plugin); + if (priv->view_notify != 0) + gconf_client_notify_remove (gconf_client_get_default (), priv->view_notify); } gtk_main_quit();; } - +/*******************************************************************************/ int main(int argc, char *argv[]) { @@ -134,6 +167,7 @@ main(int argc, char *argv[]) priv->scene = NULL; priv->window = main_widget; + priv->desktop_plugin = desktop_plugin; priv->view = view; /* Load config */ @@ -145,8 +179,13 @@ main(int argc, char *argv[]) priv->visible = TRUE; else priv->visible = FALSE; - + + priv->view_notify = 0; fprintf(stderr,"VISIBLE %i %i\n",priv->visible, current_active_view()); + gconf_client_add_dir(gconf_client_get_default (), "/apps/osso/hildon-desktop/views", GCONF_CLIENT_PRELOAD_NONE, NULL); + priv->view_notify = gconf_client_notify_add(gconf_client_get_default (),"/apps/osso/hildon-desktop/views/current", + view_changed, priv, NULL, NULL); + init_scene_theme(desktop_plugin); priv->long_timer = g_timeout_add(LONG_TIMER, (GtkFunction)long_timeout, desktop_plugin); -- 1.7.9.5