fork is done
[livewp] / applet / src / livewp-config.c
index a529834..4a93f8c 100644 (file)
 #include "livewp-config.h"
 /*******************************************************************************/
 gint 
+current_active_view(void){
+    GConfClient *gconf_client = NULL;
+    GConfValue *value = NULL;
+    gint result = -1;
+
+    gconf_client = gconf_client_get_default();
+    if (!gconf_client) {
+        fprintf(stderr, _("Failed to initialize GConf. Quitting.\n"));
+        return result;
+    }
+
+    result = gconf_client_get_int(gconf_client, "/apps/osso/hildon-desktop/views/current", NULL);
+
+    fprintf(stderr,"uuuu@@@@@@@@@@@@!!!!!!!!!!!1 %i\n", result);
+    return result;
+
+}
+/*******************************************************************************/
+gint 
 read_config(Animation_WallpaperPrivate *priv) {
 
     GConfClient *gconf_client = NULL;
     gchar *tmp = NULL;
+    GConfValue *value = NULL;
+    gint id = priv->view;
+    gchar * str = NULL;
 
     gconf_client = gconf_client_get_default();
     if (!gconf_client) {
@@ -36,12 +58,30 @@ read_config(Animation_WallpaperPrivate *priv) {
         return -1;
     }
     /* get Theme default Modern */
+    str = g_strdup_printf("%s%i", GCONF_KEY_THEME, id);
     tmp = gconf_client_get_string(gconf_client,
-                                  GCONF_KEY_THEME, NULL);
+                                  str, NULL);
+    if (str){ 
+        g_free(str);
+        str = NULL;
+    }    
     if (tmp){
         priv->theme = tmp;
     }else
         priv->theme = g_strdup("Modern");
+    /* get Rich animation default TRUE */
+    str = g_strdup_printf("%s%i", GCONF_KEY_RANIMATION, id);
+    value = gconf_client_get(gconf_client, str, NULL);
+    if (str){ 
+        g_free(str);
+        str = NULL;
+    } 
+    if (value) {
+        priv->rich_animation = gconf_value_get_bool(value);
+        gconf_value_free(value);
+    } else
+        priv->rich_animation = TRUE;
+    
 
     return 0;
 }
@@ -51,14 +91,36 @@ void
 save_config(Animation_WallpaperPrivate *priv) {
 
     GConfClient *gconf_client;
+    gchar * str = NULL;
+    gint id = priv->view;
+
     gconf_client = gconf_client_get_default();
     if (!gconf_client) {
         fprintf(stderr, _("Failed to initialize GConf. Quitting.\n"));
         return;
     }
-    /* Save Weather source name. */
-    if (priv->theme)
+    
+    if (priv->theme){
+        str = g_strdup_printf("%s%i", GCONF_KEY_THEME, id);
         gconf_client_set_string(gconf_client,
-                  GCONF_KEY_THEME,
+                  str,
                   priv->theme, NULL);
+        if (str){
+            g_free(str);
+            str = NULL;
+        }
+    }
+
+    str = g_strdup_printf("%s%i", GCONF_KEY_RANIMATION, id);
+    if (priv->rich_animation)
+        gconf_client_set_bool(gconf_client,
+                              str, TRUE, NULL);
+    else
+        gconf_client_set_bool(gconf_client,
+                              str, FALSE, NULL);
+    if (str){
+        g_free(str);
+        str = NULL;
+    }
+    
 }