tryed fix xsnow
[livewp] / applet / src / livewp-settings.c
index 3d5b343..ef23997 100644 (file)
@@ -34,9 +34,9 @@ void lw_about(void){
     gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
     gtk_window_set_modal(GTK_WINDOW(window), TRUE);
     vbox = gtk_vbox_new (FALSE, 5);
-    label_about = gtk_label_new (_("Live Wallpaper Version 0.7 \n Copyright(c) 2010\n \
+    label_about = gtk_label_new (_("Live Wallpaper Version 0.7.1 \n Copyright(c) 2010\n \
 Tanya Makova\n Vlad Vasiliev\n \
-Copyright(c) 2010 for design themes Berlin and Modern Vasya Bobrikov\n \
+Copyright(c) 2010 for design themes Berlin, Modern and Accel Vasya Bobrikov\n \
 Copyright(c) 2010 for design theme Matrix Andrew Zhilin\n \
 Translators:\n \
 Finnish - Marko Vertainen\n \
@@ -62,7 +62,9 @@ create_theme_selector (void){
       hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), _("Berlin"));
       hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), _("Modern"));
       hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), _("Matrix"));
+      hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), _("Accel"));
       hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), _("Video"));
+      hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), _("Xsnow"));
       return selector;
 }
 /*******************************************************************************/
@@ -131,19 +133,25 @@ changed_value_theme_cb (HildonPickerButton *picker, Animation_WallpaperPrivate *
     gtk_box_pack_start(GTK_BOX(GTK_DIALOG(priv->window)->vbox),
                                    vbox, TRUE, TRUE, 5);
     if (choice) {
-        if (!strcmp(choice, "Berlin")){
+        if (!strcmp(choice, _("Berlin"))){
             rich_animation_additional_parametr(vbox,priv);
         }
-        if (!strcmp(choice, "Modern")){
+        if (!strcmp(choice, _("Modern"))){
             rich_animation_additional_parametr(vbox,priv);
         }
-        if (!strcmp(choice, "Matrix")){
+        if (!strcmp(choice, _("Matrix"))){
             rich_animation_additional_parametr(vbox,priv);
         }
-        if (!strcmp(choice, "Video")){
-            additional_parametr_for_theme_video(vbox, priv);
+        if (!strcmp(choice, _("Xsnow"))){
+            rich_animation_additional_parametr(vbox,priv);
         }
 
+        if (!strcmp(choice, _("Accel"))){
+            rich_animation_additional_parametr(vbox,priv);
+        }
+        if (!strcmp(choice, _("Video"))){
+            additional_parametr_for_theme_video(vbox, priv);
+        }
     }
     gtk_widget_show(vbox);
 }
@@ -173,11 +181,18 @@ create_themes_button (gchar *theme){
             hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (selector), 0, 2);
             hildon_button_set_value(HILDON_BUTTON(button), _("Matrix"));
         }
-        if (!strcmp(theme, "Video")){
+        if (!strcmp(theme, "Accel")){
             hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (selector), 0, 3);
+            hildon_button_set_value(HILDON_BUTTON(button), _("Accel"));
+        }
+        if (!strcmp(theme, "Video")){
+            hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (selector), 0, 4);
             hildon_button_set_value(HILDON_BUTTON(button), _("Video"));
         }
-
+        if (!strcmp(theme, "Xsnow")){
+            hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (selector), 0, 5);
+            hildon_button_set_value(HILDON_BUTTON(button), _("Xsnow"));
+        }
     }
     
     return button;
@@ -185,11 +200,11 @@ create_themes_button (gchar *theme){
 
 /*******************************************************************************/
 GtkWidget *
-create_rich_animation_button (gboolean active)
+create_rich_animation_button (gboolean active, gchar *name)
 {
     GtkWidget *button;
     button = hildon_check_button_new (HILDON_SIZE_AUTO);
-    gtk_button_set_label (GTK_BUTTON (button), _("Rich Animation"));
+    gtk_button_set_label (GTK_BUTTON (button), name);
     hildon_check_button_set_active(HILDON_CHECK_BUTTON(button), active);
     return button;
 }
@@ -253,14 +268,6 @@ lw_main_settings(Animation_WallpaperPrivate *priv, gpointer data){
 
     result = gtk_dialog_run(GTK_DIALOG(window));
 
-    switch(result){
-        case GTK_RESPONSE_NO:
-//            gtk_widget_destroy(window);
-            window = NULL;
-            lw_about();
-        break;
-    }
-
     priv_temp = g_object_get_data(G_OBJECT(theme_button1), "priv");
     if (priv_temp){
         g_free(priv_temp);
@@ -283,6 +290,15 @@ lw_main_settings(Animation_WallpaperPrivate *priv, gpointer data){
     }
 
 
+    switch(result){
+        case GTK_RESPONSE_NO:
+            gtk_widget_destroy(window);
+            window = NULL;
+            lw_about();
+        break;
+    }
+
+
     if (window)
         gtk_widget_destroy(window);
 }
@@ -309,7 +325,7 @@ void
 rich_animation_additional_parametr(GtkWidget *vbox, Animation_WallpaperPrivate *priv){
     GtkWidget *rich_animation_button;
     /* Create rich animation button */  
-    rich_animation_button = create_rich_animation_button(priv->rich_animation);
+    rich_animation_button = create_rich_animation_button(priv->rich_animation, _("Rich Animation"));
     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);
@@ -320,6 +336,7 @@ void
 additional_parametr_for_theme_video(GtkWidget *vbox, Animation_WallpaperPrivate *priv){
 
     GtkWidget *file_button;
+    GtkWidget *rich_animation_button;
 
     if (priv->theme_string_parametr1)
         file_button = hildon_button_new_with_text (HILDON_SIZE_FINGER_HEIGHT, HILDON_BUTTON_ARRANGEMENT_VERTICAL,
@@ -332,8 +349,14 @@ additional_parametr_for_theme_video(GtkWidget *vbox, Animation_WallpaperPrivate
 
     gtk_box_pack_start(GTK_BOX(vbox),
                                    file_button, TRUE, TRUE, 5);
-    g_object_set_data(G_OBJECT(priv->window), "filename_button", file_button);
+    g_object_set_data(G_OBJECT(priv->window), "filename_button", file_button);    /* Create rich animation button */  
+    rich_animation_button = create_rich_animation_button(priv->rich_animation, _("Loop"));
+    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);
+
     gtk_widget_show (file_button);
+    gtk_widget_show (rich_animation_button);
 
 }
 /*******************************************************************************/
@@ -348,6 +371,7 @@ lw_theme_settings(GtkWidget *button, Animation_WallpaperPrivate *priv) {
     GtkWidget *button1 = NULL;
     GtkWidget *rich_animation_button = NULL;
     gint view = priv->view;
+    gboolean success_choice = TRUE;
 
     window = gtk_dialog_new();
     priv->window = window;
@@ -372,6 +396,8 @@ lw_theme_settings(GtkWidget *button, Animation_WallpaperPrivate *priv) {
                                    vbox, TRUE, TRUE, 5);
     if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Berlin"))||
         !strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Matrix"))||
+        !strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Accel"))||
+        !strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Xsnow"))||
         !strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Modern"))){
         rich_animation_additional_parametr(vbox, priv);
     }
@@ -402,6 +428,17 @@ lw_theme_settings(GtkWidget *button, Animation_WallpaperPrivate *priv) {
                     priv->theme = g_strdup("Modern");
                 if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Matrix")))
                     priv->theme = g_strdup("Matrix");
+                if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Accel")))
+                    priv->theme = g_strdup("Accel");
+                if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Xsnow"))){
+                    priv->theme = g_strdup("Xsnow");
+                    if (access("/usr/bin/xsnow", F_OK) != 0){
+                        fprintf(stderr,"sddddddddddddddddddddddddddddd\n");
+                        success_choice = FALSE;
+                        hildon_banner_show_information(GTK_WIDGET(window), NULL, 
+                        _("You haven't got the installed package Xsnow. Please install it via using Application Manager"));
+                    }
+                }
                 if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Video"))){
                     priv->theme = g_strdup("Video");
                     button1 = g_object_get_data(G_OBJECT(priv->window), "filename_button");
@@ -414,7 +451,7 @@ lw_theme_settings(GtkWidget *button, Animation_WallpaperPrivate *priv) {
 
             }
 
-            rich_animation_button = g_object_get_data(G_OBJECT(priv->window), "filename_button");
+            rich_animation_button = g_object_get_data(G_OBJECT(priv->window), "rich_animation_button");
             if (rich_animation_button){
                 /* Check rich animation */
                 if (hildon_check_button_get_active (HILDON_CHECK_BUTTON(rich_animation_button)))
@@ -422,6 +459,9 @@ lw_theme_settings(GtkWidget *button, Animation_WallpaperPrivate *priv) {
                 else
                     priv->rich_animation = FALSE;
             }
+            /* if not scuccess exit from wthout saving */ 
+            if (!success_choice)
+                break;
             /* Save config */
             save_config(priv);
             /* action with applet */