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 \
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), _("Mplayer"));
+ 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;
}
/*******************************************************************************/
void
theme_button_clicked(GtkButton *button, Animation_WallpaperPrivate *priv){
- lw_theme_settings(priv, button);
+ lw_theme_settings(GTK_WIDGET(button), priv);
}
/********************************************************************************/
void
GtkWidget *
create_image_button (gint view, DBusConnection *conn_sess){
GtkWidget *button;
- GtkWidget *image;
- gchar * str;
- GdkPixbuf * pixbuf;
Animation_WallpaperPrivate *priv = g_new0(Animation_WallpaperPrivate, 1);
priv->view = view;
+ priv->theme_string_parametr1 = NULL;
priv->dbus_conn_session = conn_sess;
read_config(priv);
button = hildon_button_new(HILDON_SIZE_AUTO_WIDTH | HILDON_SIZE_FINGER_HEIGHT,
HILDON_BUTTON_ARRANGEMENT_VERTICAL);
g_object_set_data(G_OBJECT(button), "view", GINT_TO_POINTER(view));
+ g_object_set_data(G_OBJECT(button), "priv", priv);
set_button_image(button, priv->theme, check_applet_state(view));
g_signal_connect(button, "clicked", G_CALLBACK(theme_button_clicked), priv);
hildon_button_set_image_position (HILDON_BUTTON (button), GTK_POS_RIGHT);
}
/********************************************************************************/
+void
+changed_value_theme_cb (HildonPickerButton *picker, Animation_WallpaperPrivate *priv)
+{
+ const gchar *choice = hildon_button_get_value(HILDON_BUTTON (picker));
+ GtkWidget *vbox = NULL;
+
+ vbox = g_object_get_data(G_OBJECT(priv->window), "custom_vbox");
+ if (vbox)
+ gtk_widget_destroy(vbox);
+ vbox = gtk_vbox_new (FALSE, 5);
+ g_object_set_data(G_OBJECT(priv->window), "custom_vbox", vbox);
+ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(priv->window)->vbox),
+ vbox, TRUE, TRUE, 5);
+ if (choice) {
+ if (!strcmp(choice, _("Berlin"))){
+ rich_animation_additional_parametr(vbox,priv);
+ }
+ if (!strcmp(choice, _("Modern"))){
+ rich_animation_additional_parametr(vbox,priv);
+ }
+ if (!strcmp(choice, _("Matrix"))){
+ rich_animation_additional_parametr(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);
+}
+
+/********************************************************************************/
GtkWidget *
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, "Mplayer")){
+ if (!strcmp(theme, "Accel")){
hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (selector), 0, 3);
- hildon_button_set_value(HILDON_BUTTON(button), _("Mplayer"));
+ 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;
}
/*******************************************************************************/
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;
}
GtkWidget *theme_button3;
GtkWidget *theme_button4;
GtkWidget *hbox;
+ Animation_WallpaperPrivate *priv_temp = NULL;
window = gtk_dialog_new();
result = gtk_dialog_run(GTK_DIALOG(window));
+ priv_temp = g_object_get_data(G_OBJECT(theme_button1), "priv");
+ if (priv_temp){
+ g_free(priv_temp);
+ priv_temp =NULL;
+ }
+ priv_temp = g_object_get_data(G_OBJECT(theme_button2), "priv");
+ if (priv_temp){
+ g_free(priv_temp);
+ priv_temp =NULL;
+ }
+ priv_temp = g_object_get_data(G_OBJECT(theme_button3), "priv");
+ if (priv_temp){
+ g_free(priv_temp);
+ priv_temp =NULL;
+ }
+ priv_temp = g_object_get_data(G_OBJECT(theme_button4), "priv");
+ if (priv_temp){
+ g_free(priv_temp);
+ priv_temp =NULL;
+ }
+
+
switch(result){
case GTK_RESPONSE_NO:
gtk_widget_destroy(window);
lw_about();
break;
}
+
+
if (window)
gtk_widget_destroy(window);
}
+/*******************************************************************************/
+void
+file_button_clicked(GtkButton *button, Animation_WallpaperPrivate *priv){
+
+ GtkWidget *dialog = hildon_file_chooser_dialog_new(GTK_WINDOW (priv->window), GTK_FILE_CHOOSER_ACTION_OPEN);
+
+ 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;
+ /* Create rich animation button */
+ 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);
+ gtk_widget_show (rich_animation_button);
+}
+/*******************************************************************************/
+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,
+ _("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); /* 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);
+
+}
/*******************************************************************************/
void
-lw_theme_settings(Animation_WallpaperPrivate *priv, GtkWidget *button){
+lw_theme_settings(GtkWidget *button, Animation_WallpaperPrivate *priv) {
gint result;
GtkWidget *window = NULL;
GtkWidget *save_button;
GtkWidget *theme_button;
GtkWidget *enable_button;
- GtkWidget *rich_animation_button;
+ GtkWidget *vbox;
+ GtkWidget *button1 = NULL;
+ GtkWidget *rich_animation_button = NULL;
gint view = priv->view;
+ gboolean success_choice = TRUE;
window = gtk_dialog_new();
+ priv->window = window;
gtk_window_set_title(GTK_WINDOW(window), _("View Settings"));
gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
enable_button, TRUE, TRUE, 5);
/* Create Theme button */
theme_button = create_themes_button(priv->theme);
+ g_signal_connect (G_OBJECT (theme_button), "value-changed", G_CALLBACK (changed_value_theme_cb), priv);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox),
theme_button, TRUE, TRUE, 5);
- /* Create rich animation button */
- rich_animation_button = create_rich_animation_button(priv->rich_animation);
+
+ /* Create custom vbox */
+ vbox = gtk_vbox_new (FALSE, 5);
+ g_object_set_data(G_OBJECT(window), "custom_vbox", vbox);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox),
- rich_animation_button, TRUE, TRUE, 5);
+ 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);
+ }
+
+ if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Video"))){
+ additional_parametr_for_theme_video(vbox, priv);
+ }
+
gtk_widget_show (enable_button);
gtk_widget_show (theme_button);
- gtk_widget_show (rich_animation_button);
+ gtk_widget_show (vbox);
gtk_widget_show (window);
save_button = gtk_dialog_add_button(GTK_DIALOG(window), _("Save"), GTK_RESPONSE_YES);
if (priv->theme)
g_free(priv->theme);
- if (priv->theme_string_parametr1)
- g_free(priv->theme_string_parametr1);
- priv->theme_string_parametr1 = NULL;
if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Berlin")))
priv->theme = g_strdup("Berlin");
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)), _("Mplayer"))){
- priv->theme = g_strdup("Mplayer");
- priv->theme_string_parametr1 = g_strdup("/home/user/MyDocs/.videos/9.mp4");
+ 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");
+ 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 rich animation */
- if (hildon_check_button_get_active (HILDON_CHECK_BUTTON(rich_animation_button)))
- priv->rich_animation = TRUE;
- else
- priv->rich_animation = FALSE;
+ 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)))
+ priv->rich_animation = TRUE;
+ else
+ priv->rich_animation = FALSE;
+ }
+ /* if not scuccess exit from wthout saving */
+ if (!success_choice)
+ break;
/* Save config */
save_config(priv);
/* action with applet */