one theme in all views almost done
[livewp] / applet / src / livewp-config.c
index 4f499ce..97ee239 100644 (file)
@@ -62,7 +62,11 @@ fill_priv(Animation_WallpaperPrivate *priv)
     GSList *store = priv->extheme_list;
     while (store){
         if (!strcmp(priv->theme, g_hash_table_lookup(store->data, "name"))){
-            priv->scene_func = (gpointer)&init_scene_External;
+            /* Default function for external themes init_scene_External */
+            if (priv->scene_func)
+                priv->scene_func = (gpointer)&init_scene_External;
+            if (!strcmp(priv->theme, "Conky"))
+                priv->scene_func = (gpointer)&init_scene_Conky;
             priv->hash_theme = store->data;
             break;
         }
@@ -110,8 +114,21 @@ read_config(Animation_WallpaperPrivate *priv) {
         gconf_value_free(value);
     } else
         priv->rich_animation = TRUE;
+    /* get theme additional bool aparametr 1 default  TRUE */
+    str = g_strdup_printf("%s%i", GCONF_KEY_ADDITIONAL_BOOL_1, id);
+    value = gconf_client_get(gconf_client, str, NULL);
+    if (str){ 
+        g_free(str);
+        str = NULL;
+    } 
+    if (value) {
+        priv->theme_bool_parametr1 = gconf_value_get_bool(value);
+        gconf_value_free(value);
+    } else
+       priv->theme_bool_parametr1= TRUE;
+
     /* get theme additional parameter 1  */
-    str = g_strdup_printf("%s%i", GCONF_KEY_ADDIONAL_STRING_1 , id);
+    str = g_strdup_printf("%s%i", GCONF_KEY_ADDITIONAL_STRING_1 , id);
     value = gconf_client_get(gconf_client, str, NULL);
     if (str){ 
         g_free(str);
@@ -121,10 +138,50 @@ read_config(Animation_WallpaperPrivate *priv) {
         priv->theme_string_parametr1 = g_strdup(gconf_value_get_string(value));
         gconf_value_free(value);
     } 
-
+    /* get parameter one theme in all view */
+    priv->one_in_all_view = get_one_in_all_views_from_config();
     return 0;
 }
+/*******************************************************************************/
+gboolean
+get_one_in_all_views_from_config(void){
+    GConfClient *gconf_client;
+    GConfValue *value = NULL;
+    gboolean result;
 
+    gconf_client = gconf_client_get_default();
+    if (!gconf_client) {
+        fprintf(stderr, _("Failed to initialize GConf. Quitting.\n"));
+        return FALSE;
+    }
+    /* get parameter one theme in all view */
+    value = gconf_client_get(gconf_client, GCONF_KEY_ONE_IN_ALL_VIEW, NULL);
+    if (value) {
+        result = gconf_value_get_bool(value);
+        gconf_value_free(value);
+    } else
+        result = FALSE;
+    return result;
+}
+/*******************************************************************************/
+void
+save_one_in_all_views_to_config(gboolean one_in_all_views){
+    GConfClient *gconf_client;
+
+    gconf_client = gconf_client_get_default();
+    if (!gconf_client) {
+        fprintf(stderr, _("Failed to initialize GConf. Quitting.\n"));
+        return;
+    }
+
+    if (one_in_all_views)
+        gconf_client_set_bool(gconf_client,
+                              GCONF_KEY_ONE_IN_ALL_VIEW, TRUE, NULL);
+    else
+        gconf_client_set_bool(gconf_client,
+                              GCONF_KEY_ONE_IN_ALL_VIEW, FALSE, NULL);
+
+}
 /*******************************************************************************/
 void
 save_config(Animation_WallpaperPrivate *priv) {
@@ -161,8 +218,20 @@ save_config(Animation_WallpaperPrivate *priv) {
         g_free(str);
         str = NULL;
     }
+    str = g_strdup_printf("%s%i", GCONF_KEY_ADDITIONAL_BOOL_1, id);
+    if (priv->theme_bool_parametr1)
+        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;
+    }
+
     if (priv->theme_string_parametr1){
-        str = g_strdup_printf("%s%i",GCONF_KEY_ADDIONAL_STRING_1, id);
+        str = g_strdup_printf("%s%i",GCONF_KEY_ADDITIONAL_STRING_1, id);
         gconf_client_set_string(gconf_client,
                   str,
                   priv->theme_string_parametr1, NULL);
@@ -171,6 +240,4 @@ save_config(Animation_WallpaperPrivate *priv) {
             str = NULL;
         }
     }
-
-    
 }