trying to fix problem with live background in all windows
[livewp] / applet / src / livewp-settings.c
index b2076e8..51ed788 100644 (file)
@@ -7,8 +7,8 @@
  *       for the code
  * 
  * This software is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2 of
  * the License, or (at your option) any later version.
  * 
  * This software is distributed in the hope that it will be useful, but
@@ -38,7 +38,7 @@ 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 \
@@ -61,30 +61,26 @@ GtkWidget *
 create_category_selector (Animation_WallpaperPrivate *priv){
     GtkWidget *selector;
     GSList *store = priv->extheme_list;
-    GList *category_list;
     GHashTable *result_table = NULL;
 
+    selector = hildon_touch_selector_new_text();
+
+    hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), "LiveWallpaper" );
+
     result_table = g_hash_table_new(g_str_hash, g_str_equal);
     while (store){  
-        if (!g_hash_table_lookup(result_table, g_hash_table_lookup(store->data, "category")))
+        if (!g_hash_table_lookup(result_table, g_hash_table_lookup(store->data, "category"))){
             g_hash_table_insert(result_table, g_hash_table_lookup(store->data, "category"), (gint *)1);     
+            hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), g_hash_table_lookup(store->data, "category"));
+        }
         store = g_slist_next(store);
     }
     
     /* Add Xscreensaver for install message */
-    if (!g_hash_table_lookup(result_table,"Xscreensaver"))
+    if (!g_hash_table_lookup(result_table,"Xscreensaver")){
             g_hash_table_insert(result_table, "Xscreensaver", (gint *)1);
-   
-
-    category_list = g_hash_table_get_keys (result_table);
-    selector = hildon_touch_selector_new_text();
-
-    hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), "LiveWallpaper" );
-    while (category_list){  
-        hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector),category_list->data );
-        category_list = g_list_next(category_list);
+            hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), "Xscreensaver");
     }
-
     return selector;
 }
 
@@ -397,10 +393,11 @@ create_categories_button (Animation_WallpaperPrivate *priv){
                 num++;
             }
             if (!strcmp(theme, g_hash_table_lookup(store->data, "name"))){
-                if (g_hash_table_lookup(store->data, "category"))
+                if (g_hash_table_lookup(store->data, "category")){
                     hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (selector), 0, 
                     (gint)g_hash_table_lookup(result_table, g_hash_table_lookup(store->data, "category"))); 
                     hildon_button_set_value(HILDON_BUTTON(button), g_hash_table_lookup(store->data, "category"));
+                }
                 break;
             }
 
@@ -485,10 +482,10 @@ void
 lw_main_settings(Animation_WallpaperPrivate *priv, gpointer data){
     gint result;
     GtkWidget *window = NULL;
+    GtkWidget *banner = NULL;
     GtkWidget *area_hbox;
     GtkWidget *one_in_all_view_button; 
     gboolean one_in_all_view;
-    Animation_WallpaperPrivate *priv_temp = NULL;
 
     window = gtk_dialog_new();
     priv->window = window;
@@ -545,20 +542,31 @@ lw_main_settings(Animation_WallpaperPrivate *priv, gpointer data){
 
     if (hildon_check_button_get_active (HILDON_CHECK_BUTTON(one_in_all_view_button)) != one_in_all_view){
         save_one_in_all_views_to_config(hildon_check_button_get_active (HILDON_CHECK_BUTTON(one_in_all_view_button)));
-        fprintf(stderr,"CHECK!!!!!!!!!!!!!!\n");
+        //fprintf(stderr,"CHECK!!!!!!!!!!!!!!\n");
+        banner = hildon_banner_show_information (window, NULL, _("Livewallpaper is reloading..."));
+        hildon_banner_set_timeout(HILDON_BANNER(banner), 3000);
         stop_applet(1);
         stop_applet(2);
         stop_applet(3);
         stop_applet(4);
-        sleep(7);
-        start_applet(1);
-        start_applet(2);
-        start_applet(3);
-        start_applet(4);
-        
+        g_timeout_add(3000, (GSourceFunc)cb_timeout_settings, window);
+    }else{
+        if (window)
+            gtk_widget_destroy(window);
     }
+}
+/*******************************************************************************/
+gboolean
+cb_timeout_settings(GtkWidget *window){
+
+    start_applet(1);
+    start_applet(2);
+    start_applet(3);
+    start_applet(4);
+
     if (window)
         gtk_widget_destroy(window);
+    return FALSE;
 }
 /*******************************************************************************/
 void
@@ -744,6 +752,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){