fixed start only one copy of some themes
[livewp] / applet / src / livewp-settings.c
index 90310ac..b1be895 100644 (file)
@@ -38,11 +38,12 @@ void lw_about(void){
     about_string = g_strdup_printf(_("Live Wallpaper Version %s \n Copyright(c) 2010\n \
 Tanya Makova\n Vlad Vasiliev\n \
 Copyright(c) 2010 for design themes Berlin, Modern and Accel Vasya Bobrikov\n \
-Copyright(c) 2010 for design themes Matrix Fifteen and for icons Andrew Zhilin\n \
+Copyright(c) 2010 for design themes Matrix, Fifteen \nand for icons Andrew Zhilin\n \
 Translators:\n \
 Finnish - Marko Vertainen\n \
 Spain  - Alejandro López\n \
 Italian  - Emanuele Cassioli\n \
+Dutch - Roland van Tilburg (aka ROLAN900D) \n \
 Russian - Tanya Makova \n \
           Vlad Vasiliev\n"), VERSION);
 
@@ -566,7 +567,7 @@ cb_timeout_settings(GtkWidget *window){
 
     if (window)
         gtk_widget_destroy(window);
-    return TRUE;
+    return FALSE;
 }
 /*******************************************************************************/
 void
@@ -603,6 +604,7 @@ void
 additional_parametr_for_theme_video(GtkWidget *vbox, Animation_WallpaperPrivate *priv){
 
     GtkWidget *file_button;
+    GtkWidget *smoothing_button;
     GtkWidget *rich_animation_button;
 
     if (priv->theme_string_parametr1)
@@ -622,16 +624,13 @@ additional_parametr_for_theme_video(GtkWidget *vbox, Animation_WallpaperPrivate
     gtk_box_pack_start(GTK_BOX(vbox),
                                    rich_animation_button, TRUE, TRUE, 5);
     g_object_set_data(G_OBJECT(priv->window), "rich_animation_button", rich_animation_button);
-    /* Create sound button */  
-#if 0
+    /* Create Smoothing button */  
 
-    /* Doesn't work in real device. Hardware volume buttons can to change volume for mutted track */
-    sound_button = create_bool_button(priv->theme_bool_parametr1, _("Sound"));
+    smoothing_button = create_bool_button(priv->theme_bool_parametr1, _("Smoothing (Need more memory)"));
     gtk_box_pack_start(GTK_BOX(vbox),
-                                   sound_button, TRUE, TRUE, 5);
-    g_object_set_data(G_OBJECT(priv->window), "sound_button", sound_button);
-    gtk_widget_show (sound_button);
-#endif
+                                   smoothing_button, TRUE, TRUE, 5);
+    g_object_set_data(G_OBJECT(priv->window), "smoothing_button", smoothing_button);
+    gtk_widget_show (smoothing_button);
     gtk_widget_show (file_button);
     gtk_widget_show (rich_animation_button);
 
@@ -645,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;
@@ -656,9 +664,11 @@ lw_theme_settings(GtkWidget *button, Animation_WallpaperPrivate *priv) {
     GtkWidget *enable_button;
     GtkWidget *vbox;
     GtkWidget *area_vbox;
+    GtkWidget *temp_button; 
     GtkWidget *button1 = NULL;
     GtkWidget *rich_animation_button = NULL;
     gint view = priv->view;
+    gint count;
 
     window = gtk_dialog_new();
     priv->window = window;
@@ -752,6 +762,15 @@ lw_theme_settings(GtkWidget *button, Animation_WallpaperPrivate *priv) {
                         break;
                     }
                 }
+                /* Check CrazyChickens program */
+                if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), "CrazyChickens")){
+                    if (access("/usr/bin/crazychickens", F_OK) != 0){
+                        show_problem_package(button,"'Crazy Chickens'");
+                        /* if not scuccess exit from wthout saving */ 
+                        break;
+                    }
+                }
+
                 /* Check Colorflood program */
                 if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), "Colorflood")){
                     if (access("/usr/bin/colorflood", F_OK) != 0){
@@ -779,21 +798,27 @@ lw_theme_settings(GtkWidget *button, Animation_WallpaperPrivate *priv) {
                             g_free(priv->theme_string_parametr1);
                         priv->theme_string_parametr1 = g_strdup((gchar*)hildon_button_get_value (HILDON_BUTTON(button1)));
                     }
-                    /* 
-                    temp_button = g_object_get_data(G_OBJECT(priv->window), "sound_button");
+                    temp_button = g_object_get_data(G_OBJECT(priv->window), "smoothing_button");
                     if (temp_button){
                         if (hildon_check_button_get_active (HILDON_CHECK_BUTTON(temp_button)))
                             priv->theme_bool_parametr1 = TRUE;
                         else
                             priv->theme_bool_parametr1 = FALSE;
                     }
-                    */
                 }
                 /* Check external themes */
                 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;
                     }