From: tanya Date: Sun, 2 May 2010 21:28:21 +0000 (+0300) Subject: tryed summary init scene X-Git-Url: http://git.maemo.org/git/?a=commitdiff_plain;ds=sidebyside;h=0a0408710d66baee3e50be39557c64d5fd70e6f9;p=livewp tryed summary init scene --- diff --git a/applet/src/livewp-home-widget.c b/applet/src/livewp-home-widget.c index 75152d5..88e0ba5 100644 --- a/applet/src/livewp-home-widget.c +++ b/applet/src/livewp-home-widget.c @@ -388,7 +388,7 @@ animation_wallpaper_plugin_init (AWallpaperPlugin *desktop_plugin) { GtkWidget *rich_animation; gchar buffer[2048]; - + gchar str[128]; //fprintf(stderr, "!!!!!!!plugin init \n"); Animation_WallpaperPrivate *priv = Animation_Wallpaper_HOME_PLUGIN_GET_PRIVATE (desktop_plugin); @@ -442,13 +442,19 @@ animation_wallpaper_plugin_init (AWallpaperPlugin *desktop_plugin) fprintf(stderr, "!!!theme = %s\n", priv->theme); + snprintf(str, sizeof(str) - 1, "%s", "init_scene2"); + fprintf(stderr, " str = %s\n", str); priv->scene = NULL; +#if 0 if (!strcmp(priv->theme,"Modern")) init_scene(desktop_plugin); else if (!strcmp(priv->theme,"Berlin")) init_scene1(desktop_plugin); else if (!strcmp(priv->theme, "Matrix")) init_scene2(desktop_plugin); +#endif + init_scene_theme(desktop_plugin); + priv->long_timer = g_timeout_add(LONG_TIMER, (GtkFunction)long_timeout, desktop_plugin); /* TODO Move scene to priv */ //scene.timer_type = LONG_TIMER_TYPE; diff --git a/applet/src/livewp-scene.c b/applet/src/livewp-scene.c index 2871871..914df70 100644 --- a/applet/src/livewp-scene.c +++ b/applet/src/livewp-scene.c @@ -45,12 +45,15 @@ reload_scene(AWallpaperPlugin *desktop_plugin) { fprintf(stderr,"Reload scene %s\n", desktop_plugin->priv->theme); destroy_scene(desktop_plugin); +#if 0 if (!strcmp(desktop_plugin->priv->theme,"Modern")) init_scene(desktop_plugin); else if (!strcmp(desktop_plugin->priv->theme,"Berlin")) init_scene1(desktop_plugin); else if (!strcmp(desktop_plugin->priv->theme,"Matrix")) init_scene2(desktop_plugin); +#endif + init_scene_theme(desktop_plugin); } void @@ -624,3 +627,19 @@ init_scene1(AWallpaperPlugin *desktop_plugin) } +void +init_scene_theme(AWallpaperPlugin *desktop_plugin) +{ + GHashTable * hash; + void (*func)(gpointer); + hash = g_hash_table_new(g_str_hash, g_str_equal); + + g_hash_table_insert(hash, g_strdup("Berlin"), (gpointer)&init_scene1); + g_hash_table_insert(hash, g_strdup("Modern"), (gpointer)&init_scene); + g_hash_table_insert(hash, g_strdup("Matrix"), (gpointer)&init_scene2); + + func = g_hash_table_lookup(hash, desktop_plugin->priv->theme); + if (func){ + (*func)(desktop_plugin); + } +} diff --git a/applet/src/livewp-scene.h b/applet/src/livewp-scene.h index e617519..13035e7 100644 --- a/applet/src/livewp-scene.h +++ b/applet/src/livewp-scene.h @@ -41,4 +41,6 @@ void init_scene(AWallpaperPlugin *desktop_plugin); void init_scene1(AWallpaperPlugin *desktop_plugin); void run_long_timeout(AWallpaperPlugin *desktop_plugin); void reload_scene(AWallpaperPlugin *desktop_plugin); +void init_scene_theme(AWallpaperPlugin *desktop_plugin); + #endif