X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=applet%2Fsrc%2Flivewp-settings.c;fp=applet%2Fsrc%2Flivewp-settings.c;h=db6006ca950d578640e22cc5c60a0692468efe57;hb=85db82694e2bbdad49a86df98e5e2eca88a36d75;hp=30857e17e65100845d1daf61bd33f81c6c40ef0e;hpb=d3ba649a30941eab5eb3740afdc15e295f9d3fbc;p=livewp diff --git a/applet/src/livewp-settings.c b/applet/src/livewp-settings.c index 30857e1..db6006c 100644 --- a/applet/src/livewp-settings.c +++ b/applet/src/livewp-settings.c @@ -239,6 +239,9 @@ changed_value_theme_cb (HildonPickerButton *picker, Animation_WallpaperPrivate * if (!strcmp(choice, _("Flash"))){ additional_parametr_for_theme_flash(vbox, priv); } + if (!strcmp(choice, _("Slideshow"))){ + additional_parametr_for_theme_slideshow(vbox, priv); + } } gtk_widget_show(vbox); @@ -302,7 +305,8 @@ fill_theme_button (Animation_WallpaperPrivate *priv, GtkWidget *button, gchar *c 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")); - num = 5; + hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), _("Slideshow")); + num = 6; if (theme){ if (!strcmp(theme, "Berlin")){ hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (selector), 0, 0); @@ -324,6 +328,10 @@ fill_theme_button (Animation_WallpaperPrivate *priv, GtkWidget *button, gchar *c hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (selector), 0, 4); hildon_button_set_value(HILDON_BUTTON(button), _("Video")); } + if (!strcmp(theme, "Slideshow")){ + hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (selector), 0, 5); + hildon_button_set_value(HILDON_BUTTON(button), _("Slideshow")); + } } } while (store){ @@ -406,6 +414,10 @@ create_categories_button (Animation_WallpaperPrivate *priv){ hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (selector), 0, 0); hildon_button_set_value(HILDON_BUTTON(button), "LiveWallpaper"); } + if (!strcmp(theme, "Slideshow")){ + hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (selector), 0, 0); + hildon_button_set_value(HILDON_BUTTON(button), "LiveWallpaper"); + } GSList *store = priv->extheme_list; num = 1; while (store){ @@ -427,7 +439,35 @@ create_categories_button (Animation_WallpaperPrivate *priv){ } return button; } - +/*******************************************************************************/ +GtkWidget * +create_time_button (guint *active, gchar *name) +{ + GtkWidget *button; + GtkWidget *selector; + guint values[5] = {20, 40, 60, 120, 300}; + int i, num = 0; + gchar *str; + + button = hildon_picker_button_new (HILDON_SIZE_FINGER_HEIGHT, HILDON_BUTTON_ARRANGEMENT_VERTICAL); + hildon_button_set_title (HILDON_BUTTON (button), name); + + selector = hildon_touch_selector_new_text(); + for (i=0; i<5; i++){ + str = g_strdup_printf("%d", values[i]); + hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), str); + if (values[i] == active) num = i; + } + hildon_picker_button_set_selector (HILDON_PICKER_BUTTON (button), + HILDON_TOUCH_SELECTOR (selector)); + hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (selector), 0, num); + if (active){ + str = g_strdup_printf("%d", active); + hildon_button_set_value(HILDON_BUTTON(button), str); + }else + hildon_button_set_value(HILDON_BUTTON(button), ""); + return button; +} /*******************************************************************************/ GtkWidget * create_bool_button (gboolean active, gchar *name) @@ -463,7 +503,7 @@ create_themes_buttons_hbox(Animation_WallpaperPrivate *priv){ GSList *stlist = NULL; GConfClient *gconf_client = NULL; GConfValue *value = NULL; - guint count_of_view = 1; + guint count_of_view = 1; guint i; @@ -474,7 +514,7 @@ create_themes_buttons_hbox(Animation_WallpaperPrivate *priv){ if (hbox){ gtk_widget_destroy(hbox); } - + hbox = gtk_hbox_new(FALSE, 0); g_object_set_data(G_OBJECT(priv->window), "custom_hbox", hbox); gtk_box_pack_start(GTK_BOX(area_hbox), @@ -506,7 +546,7 @@ create_themes_buttons_hbox(Animation_WallpaperPrivate *priv){ gtk_box_pack_start(GTK_BOX(hbox), theme_button, TRUE, TRUE, 10); gtk_widget_show (theme_button); - } + } } /*******************************************************************************/ void @@ -606,6 +646,24 @@ file_button_clicked(GtkButton *button, Animation_WallpaperPrivate *priv){ } /*******************************************************************************/ void +folder_button_clicked(GtkButton *button, Animation_WallpaperPrivate *priv){ + + GtkWidget *dialog = hildon_file_chooser_dialog_new(GTK_WINDOW (priv->window), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER); + + if (priv->theme_string_parametr1) + gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), priv->theme_string_parametr1); + + gtk_widget_show_all (GTK_WIDGET (dialog)); + + if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) + { + hildon_button_set_value (HILDON_BUTTON(button), gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog))); + } + gtk_widget_destroy (dialog); + +} +/*******************************************************************************/ +void rich_animation_additional_parametr(GtkWidget *vbox, Animation_WallpaperPrivate *priv){ GtkWidget *rich_animation_button; @@ -696,6 +754,35 @@ additional_parametr_for_theme_flash(GtkWidget *vbox, Animation_WallpaperPrivate gtk_widget_show (file_button); } /*******************************************************************************/ +void +additional_parametr_for_theme_slideshow(GtkWidget *vbox, Animation_WallpaperPrivate *priv){ + + GtkWidget *file_button; + GtkWidget *time_button; + + if (priv->theme_string_parametr1) + file_button = hildon_button_new_with_text (HILDON_SIZE_FINGER_HEIGHT, HILDON_BUTTON_ARRANGEMENT_VERTICAL, + _("Folder with images"), priv->theme_string_parametr1); + else + file_button = hildon_button_new_with_text (HILDON_SIZE_FINGER_HEIGHT,HILDON_BUTTON_ARRANGEMENT_VERTICAL, + _("Folder with images")," "); + + g_signal_connect (file_button, "clicked", G_CALLBACK (folder_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); + + if (priv->theme_int_parametr1) + time_button = create_time_button(priv->theme_int_parametr1, _("Time to change image")); + else + time_button = create_time_button(0, _("Time to change image")); + gtk_box_pack_start(GTK_BOX(vbox), time_button, TRUE, TRUE, 5); + g_object_set_data(G_OBJECT(priv->window), "time_button", time_button); + + gtk_widget_show (time_button); + gtk_widget_show (file_button); +} +/*******************************************************************************/ void show_problem_package (GtkWidget *widget, gchar *package_name){ @@ -726,11 +813,11 @@ lw_theme_settings(GtkWidget *button, Animation_WallpaperPrivate *priv) { GtkWidget *vbox; GtkWidget *area_vbox; GtkWidget *temp_button; - GtkWidget *button1 = NULL; + GtkWidget *button1 = NULL, *button2 = NULL; GtkWidget *rich_animation_button = NULL; GtkWidget *confirm; gint view = priv->view; - gint count; + gint count, int_param; gchar *text; window = gtk_dialog_new(); @@ -793,57 +880,7 @@ lw_theme_settings(GtkWidget *button, Animation_WallpaperPrivate *priv) { /* Check theme */ if (hildon_button_get_value(HILDON_BUTTON (theme_button)) && strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), "")){ -#if 0 - /* Check Xsnow program */ - if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Xsnow"))){ - if (access("/usr/bin/xsnow", F_OK) != 0){ - show_problem_package(button, "Xsnow"); - /* if not scuccess exit from wthout saving */ - break; - } - } - /* Check Shermans program */ - if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), "Shermans Aquarium")){ - if (access("/usr/bin/shermans", F_OK) != 0){ - show_problem_package(button,"'Sherman's Aquarium'"); - /* if not scuccess exit from wthout saving */ - break; - } - } - /* Check Conky program */ - if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), "Conky")){ - if (access("/usr/bin/conky", F_OK) != 0){ - show_problem_package(button,"'Conky'"); - /* if not scuccess exit from wthout saving */ - break; - } - } - /* Check Orrery program */ - if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), "Orrery")){ - if (access("/opt/maemo/usr/bin/orrery", F_OK) != 0){ - show_problem_package(button,"'Orrery'"); - /* if not scuccess exit from wthout saving */ - 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){ - show_problem_package(button,"'Colorflood'"); - /* if not scuccess exit from wthout saving */ - break; - } - } -#endif if (priv->theme_string_parametr1){ g_free(priv->theme_string_parametr1); priv->theme_string_parametr1 = NULL; @@ -881,6 +918,22 @@ lw_theme_settings(GtkWidget *button, Animation_WallpaperPrivate *priv) { priv->theme_string_parametr1 = g_strdup((gchar*)hildon_button_get_value (HILDON_BUTTON(button1))); } } + if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Slideshow"))){ + priv->theme = g_strdup("Slideshow"); + 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))); + } + button2 = g_object_get_data(G_OBJECT(priv->window), "time_button"); + if (button2){ + //if (priv->theme_int_parametr1) + // g_free(priv->theme_int_parametr1); + int_param = atoi(hildon_button_get_value (HILDON_BUTTON(button2))); + priv->theme_int_parametr1 = int_param; + } + } /* Check external themes */ GSList *store = priv->extheme_list; while (store){ @@ -932,7 +985,7 @@ lw_theme_settings(GtkWidget *button, Animation_WallpaperPrivate *priv) { } store = g_slist_next(store); } - + fprintf(stderr, "theme = %s\n", priv->theme); } rich_animation_button = g_object_get_data(G_OBJECT(priv->window), "rich_animation_button");