added select file into dialog
[livewp] / applet / src / livewp-settings.c
index f96ec7c..3da182e 100644 (file)
@@ -66,7 +66,6 @@ create_category_selector (Animation_WallpaperPrivate *priv){
 
     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){
@@ -82,6 +81,11 @@ create_category_selector (Animation_WallpaperPrivate *priv){
             g_hash_table_insert(result_table, "Xscreensaver", (gint *)1);
             hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), "Xscreensaver");
     }
+    /* Add LiveWallpaper to selector */
+    if (!g_hash_table_lookup(result_table,"LiveWallpaper")){
+        hildon_touch_selector_prepend_text (HILDON_TOUCH_SELECTOR (selector), "LiveWallpaper" );
+    }
+
     return selector;
 }
 
@@ -232,6 +236,10 @@ changed_value_theme_cb (HildonPickerButton *picker, Animation_WallpaperPrivate *
         if (!strcmp(choice, _("Video"))){
             additional_parametr_for_theme_video(vbox, priv);
         }
+        if (!strcmp(choice, _("Flash"))){
+            additional_parametr_for_theme_flash(vbox, priv);
+        }
+
     }
     gtk_widget_show(vbox);
 }
@@ -240,6 +248,10 @@ void
 changed_value_category_cb (HildonPickerButton *picker, Animation_WallpaperPrivate *priv)
 {
     GtkWidget *theme_button = NULL;
+    GtkWidget *confirm;
+    gchar *text;
+
+
     const gchar *choice = hildon_button_get_value(HILDON_BUTTON (picker));
 
     theme_button = g_object_get_data(G_OBJECT(priv->window), "theme_button");
@@ -253,9 +265,17 @@ changed_value_category_cb (HildonPickerButton *picker, Animation_WallpaperPrivat
     if (choice){
         if (!strcmp(choice,"Xscreensaver"))
             if (access("/usr/bin/xscreensaver", F_OK) != 0){
-                show_problem_package((GtkWidget *)picker, "Xscreensaver");
+                text = g_strdup_printf(_("You haven't got the installed package %s. Do you want to install it via using Application Manager?"),  "Xscreensaver");
+                confirm = hildon_note_new_confirmation(GTK_WINDOW(priv->window), text);
+                if(GTK_RESPONSE_OK == gtk_dialog_run(GTK_DIALOG(confirm))){
+                     gchar * cmd = g_strdup_printf("dbus-send --print-reply --dest=com.nokia.osso_browser /com/nokia/osso_browser/service com.nokia.osso_browser.open_new_window string:%s", "http://maemo.org/downloads/product/raw/Maemo5/xscreensaver/?get_installfile");
+                     fprintf(stderr, "system %s\n", cmd);
+                     system(cmd);
+                     g_free(cmd);
+                 }
+                 g_free(text);
+                 gtk_widget_destroy(confirm);
             }
-
     }
 }
 /********************************************************************************/
@@ -601,9 +621,20 @@ rich_animation_additional_parametr(GtkWidget *vbox, Animation_WallpaperPrivate *
 }
 /*******************************************************************************/
 void
+link_button_clicked(GtkButton *button, gchar *url){
+
+  gchar * cmd = g_strdup_printf("dbus-send --print-reply --dest=com.nokia.osso_browser \
+         /com/nokia/osso_browser/service com.nokia.osso_browser.open_new_window string:%s", url);
+  fprintf(stderr, "system %s\n", cmd);
+  system(cmd);
+  g_free(cmd);
+}
+/*******************************************************************************/
+void
 additional_parametr_for_theme_video(GtkWidget *vbox, Animation_WallpaperPrivate *priv){
 
     GtkWidget *file_button;
+    GtkWidget *link_button;
     GtkWidget *smoothing_button;
     GtkWidget *rich_animation_button;
 
@@ -630,12 +661,45 @@ additional_parametr_for_theme_video(GtkWidget *vbox, Animation_WallpaperPrivate
     gtk_box_pack_start(GTK_BOX(vbox),
                                    smoothing_button, TRUE, TRUE, 5);
     g_object_set_data(G_OBJECT(priv->window), "smoothing_button", smoothing_button);
+
+    link_button = hildon_button_new_with_text (HILDON_SIZE_FINGER_HEIGHT,HILDON_BUTTON_ARRANGEMENT_VERTICAL,
+                                                   _("Press me for"), _("download more videos"));
+
+    g_signal_connect (link_button, "clicked", G_CALLBACK (link_button_clicked), "http://talk.maemo.org/showthread.php?t=60185");
+    gtk_box_pack_start(GTK_BOX(vbox),
+                                   link_button, TRUE, TRUE, 5);
+
     gtk_widget_show (smoothing_button);
     gtk_widget_show (file_button);
     gtk_widget_show (rich_animation_button);
+    gtk_widget_show (link_button);
+
+}
+/*******************************************************************************/
+void
+additional_parametr_for_theme_flash(GtkWidget *vbox, Animation_WallpaperPrivate *priv){
+
+    GtkWidget *file_button;
+    GtkWidget *link_button;
+    GtkWidget *smoothing_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,
+                                                   _("Play file"), priv->theme_string_parametr1);
+    else
+        file_button = hildon_button_new_with_text (HILDON_SIZE_FINGER_HEIGHT,HILDON_BUTTON_ARRANGEMENT_VERTICAL,
+                                                   _("Play file")," ");
 
+    g_signal_connect (file_button, "clicked", G_CALLBACK (file_button_clicked), priv);
+
+    gtk_box_pack_start(GTK_BOX(vbox),
+                                   file_button, TRUE, TRUE, 5);
+    g_object_set_data(G_OBJECT(priv->window), "filename_button", file_button);
+    gtk_widget_show (file_button);
 }
 /*******************************************************************************/
+
 void
 show_problem_package (GtkWidget *widget, gchar *package_name){
     gchar *text;
@@ -809,6 +873,14 @@ lw_theme_settings(GtkWidget *button, Animation_WallpaperPrivate *priv) {
                             priv->theme_bool_parametr1 = FALSE;
                     }
                 }
+                if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Flash"))){
+                    button1 = g_object_get_data(G_OBJECT(priv->window), "filename_button");
+                    if (button1){
+                        if (priv->theme_string_parametr1)
+                            g_free(priv->theme_string_parametr1);
+                        priv->theme_string_parametr1 = g_strdup((gchar*)hildon_button_get_value (HILDON_BUTTON(button1)));
+                    }
+                }
                 /* Check external themes */
                 GSList *store = priv->extheme_list;
                 while (store){
@@ -821,10 +893,10 @@ lw_theme_settings(GtkWidget *button, Animation_WallpaperPrivate *priv) {
                                        if (install_file){
                                     if (g_hash_table_lookup(store->data, "associated_package"))
                                         text = g_strdup_printf(_("You haven't got the installed package %s. Do you want to install it via using Application Manager?"),
-                                                                                                              (gchar *) g_hash_table_lookup(store->data, "associated_package"));
+                                                (gchar *) g_hash_table_lookup(store->data, "associated_package"));
                                     else
                                         text = g_strdup_printf(_("You haven't got the installed package %s. Do you want to install it via using Application Manager?"),
-                                                                                                               (gchar *)g_hash_table_lookup(store->data, "name"));
+                                                (gchar *)g_hash_table_lookup(store->data, "name"));
                                     confirm = hildon_note_new_confirmation(GTK_WINDOW(window), text);
                                     if(GTK_RESPONSE_OK == gtk_dialog_run(GTK_DIALOG(confirm))){
                                         gchar * cmd = g_strdup_printf("dbus-send --print-reply --dest=com.nokia.osso_browser /com/nokia/osso_browser/service com.nokia.osso_browser.open_new_window string:%s", install_file);