fixed start only one copy of some themes
[livewp] / applet / src / livewp-config.c
index 2275a10..b84c644 100644 (file)
@@ -243,3 +243,33 @@ save_config(Animation_WallpaperPrivate *priv) {
         }
     }
 }
+/*******************************************************************************/
+gint
+get_count_themes_from_config(gchar *theme_name){
+    GConfClient *gconf_client;
+    gint i, count;
+    gchar *str, *value;
+
+    gconf_client = gconf_client_get_default();
+    if (!gconf_client) {
+        fprintf(stderr, _("Failed to initialize GConf. Quitting.\n"));
+        return FALSE;
+    }
+    /* get count such themes */
+    count = 0;
+    for (i=1; i<=9; i++){
+        str = g_strdup_printf("%s%i", GCONF_KEY_THEME, i);
+        value = gconf_client_get_string(gconf_client, str, NULL);
+        if (str){ 
+            g_free(str);
+            str = NULL;
+        }    
+        if (value && !strcmp(value, theme_name)){
+            count++;
+        }
+
+    }
+    //fprintf(stderr, "get count_theme from config = %d\n", count);
+    return count;
+}
+