fixed start only one copy of some themes
[livewp] / applet / src / livewp-settings.c
index f105b4d..b1be895 100644 (file)
@@ -644,6 +644,15 @@ show_problem_package (GtkWidget *widget, gchar *package_name){
     g_free(text);
 }
 /*******************************************************************************/
+void
+show_duplicate_theme (GtkWidget *widget, gchar *theme_name){
+    gchar *text;
+    text = g_strdup_printf(_("Theme %s has already been selected"), theme_name);
+    hildon_banner_show_information(GTK_WIDGET(widget), NULL, text);
+    g_free(text);
+}
+
+/*******************************************************************************/
 void 
 lw_theme_settings(GtkWidget *button, Animation_WallpaperPrivate *priv) {
     gint result;
@@ -659,6 +668,7 @@ lw_theme_settings(GtkWidget *button, Animation_WallpaperPrivate *priv) {
     GtkWidget *button1 = NULL;
     GtkWidget *rich_animation_button = NULL;
     gint view = priv->view;
+    gint count;
 
     window = gtk_dialog_new();
     priv->window = window;
@@ -800,7 +810,15 @@ lw_theme_settings(GtkWidget *button, Animation_WallpaperPrivate *priv) {
                 GSList *store = priv->extheme_list;
                 while (store){
                     if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _(g_hash_table_lookup(store->data, "name")))){
-                        priv->theme = g_strdup(g_hash_table_lookup(store->data, "name"));
+                        gchar *copies = g_hash_table_lookup(store->data, "copies");
+                        //fprintf(stderr, "copies = %s\n", copies);
+                        if (copies){
+                            count = atoi(copies);
+                        }else count = 10;
+                        if (count > get_count_themes_from_config(g_hash_table_lookup(store->data, "name")))
+                            priv->theme = g_strdup(g_hash_table_lookup(store->data, "name"));
+                        else 
+                            show_duplicate_theme(button, g_hash_table_lookup(store->data, "name"));
                         //priv->hash_theme = store->data;
                         break;
                     }