tryed summary init scene
authortanya <tanya@moshkanov.oblgaz>
Sun, 2 May 2010 21:28:21 +0000 (00:28 +0300)
committertanya <tanya@moshkanov.oblgaz>
Sun, 2 May 2010 21:28:21 +0000 (00:28 +0300)
applet/src/livewp-home-widget.c
applet/src/livewp-scene.c
applet/src/livewp-scene.h

index 75152d5..88e0ba5 100644 (file)
@@ -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;
index 2871871..914df70 100644 (file)
@@ -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);
+    }
+}
index e617519..13035e7 100644 (file)
@@ -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