1 /* vim: set sw=4 ts=4 et: */
3 * This file is part of Live Wallpaper (livewp)
5 * Copyright (C) 2010 Vlad Vasiliev
6 * Copyright (C) 2010 Tanya Makova
9 * This software is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1 of
12 * the License, or (at your option) any later version.
14 * This software is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this software; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
24 /*******************************************************************************/
25 #include "livewp-settings.h"
26 /*******************************************************************************/
29 GtkWidget *window = NULL,
32 window = gtk_dialog_new();
33 gtk_window_set_title(GTK_WINDOW(window), _("About"));
34 gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
35 gtk_window_set_modal(GTK_WINDOW(window), TRUE);
36 vbox = gtk_vbox_new (FALSE, 5);
37 label_about = gtk_label_new (_("Live Wallpaper\n Version 0.4 \n Copyright(c) 2010\n \
38 Tanya Makova\n Vlad Vasiliev\n \
39 Copyright(c) 2010 for design themes Berlin and Modern Vasya Bobrikov\n \
40 Copyright(c) 2010 for design theme Matrix Andrew Zhilin"));
41 gtk_box_pack_start (GTK_BOX (vbox), label_about, FALSE, FALSE, 0);
42 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox),
44 gtk_widget_show (label_about);
45 gtk_widget_show (vbox);
46 gtk_widget_show (window);
47 gtk_dialog_run(GTK_DIALOG(window));
50 /*******************************************************************************/
52 create_theme_selector (void)
56 selector = hildon_touch_selector_new_text ();
58 hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), _("Berlin"));
59 hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), _("Modern"));
60 hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), _("Matrix"));
63 /*******************************************************************************/
65 create_themes_button (gchar *theme){
70 selector = create_theme_selector();
71 button = hildon_picker_button_new (HILDON_SIZE_AUTO, HILDON_BUTTON_ARRANGEMENT_VERTICAL);
72 hildon_button_set_title (HILDON_BUTTON (button), _("Theme"));
73 hildon_picker_button_set_selector (HILDON_PICKER_BUTTON (button),
74 HILDON_TOUCH_SELECTOR (selector));
76 if (!strcmp(theme, "Berlin")){
77 hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (selector), 0, 0);
78 hildon_button_set_value(HILDON_BUTTON(button), _("Berlin"));
80 if (!strcmp(theme, "Modern")){
81 hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (selector), 0, 1);
82 hildon_button_set_value(HILDON_BUTTON(button), _("Modern"));
84 if (!strcmp(theme, "Matrix")){
85 hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (selector), 0, 2);
86 hildon_button_set_value(HILDON_BUTTON(button), _("Matrix"));
93 /*******************************************************************************/
95 create_rich_animation_button (gboolean active)
98 button = hildon_check_button_new (HILDON_SIZE_AUTO);
99 gtk_button_set_label (GTK_BUTTON (button), _("Rich Animation"));
100 hildon_check_button_set_active(button, active);
104 /*******************************************************************************/
106 lw_settings(GtkWidget *widget, Animation_WallpaperPrivate *priv){
108 GtkWidget *window = NULL;
109 GtkWidget *save_button;
110 GtkWidget *theme_button;
111 GtkWidget *rich_animation_button;
113 window = gtk_dialog_new();
114 gtk_window_set_title(GTK_WINDOW(window), _("Live Wallpaper Settings"));
115 gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
116 gtk_window_set_modal(GTK_WINDOW(window), TRUE);
117 /* Create Theme button */
118 theme_button = create_themes_button(priv->theme);
119 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox),
120 theme_button, TRUE, TRUE, 5);
121 /* Create rich animation button */
122 rich_animation_button = create_rich_animation_button(priv->rich_animation);
123 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox),
124 rich_animation_button, TRUE, TRUE, 5);
125 gtk_widget_show (theme_button);
126 gtk_widget_show (rich_animation_button);
127 gtk_widget_show (window);
128 gtk_dialog_add_button(GTK_DIALOG(window), _("About"), GTK_RESPONSE_NO);
129 save_button = gtk_dialog_add_button(GTK_DIALOG(window), _("Save"), GTK_RESPONSE_YES);
130 result = gtk_dialog_run(GTK_DIALOG(window));
133 case GTK_RESPONSE_YES:
134 if (hildon_button_get_value(HILDON_BUTTON (theme_button))){
137 if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Berlin")))
138 priv->theme = g_strdup("Berlin");
139 if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Modern")))
140 priv->theme = g_strdup("Modern");
141 if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Matrix")))
142 priv->theme = g_strdup("Matrix");
143 if (hildon_check_button_get_active (rich_animation_button))
144 priv->rich_animation = TRUE;
146 priv->rich_animation = FALSE;
149 reload_scene(priv->desktop_plugin);
152 case GTK_RESPONSE_OK:
154 case GTK_RESPONSE_NO:
155 gtk_widget_destroy(window);
161 gtk_widget_destroy(window);
165 create_settings(void){
167 GtkWidget *window = NULL;
168 GtkWidget *save_button;
169 GtkWidget *theme_button;
170 GtkWidget *rich_animation_button;
172 window = gtk_dialog_new();
173 gtk_window_set_title(GTK_WINDOW(window), _("Live Wallpaper Settings"));
174 gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
175 gtk_window_set_modal(GTK_WINDOW(window), TRUE);
176 /* Create Theme button */
177 theme_button = create_themes_button("Modern");
178 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox),
179 theme_button, TRUE, TRUE, 5);
180 /* Create rich animation button */
181 rich_animation_button = create_rich_animation_button(TRUE);
182 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox),
183 rich_animation_button, TRUE, TRUE, 5);
184 gtk_widget_show (theme_button);
185 gtk_widget_show (rich_animation_button);
186 gtk_widget_show (window);
187 gtk_dialog_add_button(GTK_DIALOG(window), _("About"), GTK_RESPONSE_NO);
188 save_button = gtk_dialog_add_button(GTK_DIALOG(window), _("Save"), GTK_RESPONSE_YES);
190 result = gtk_dialog_run(GTK_DIALOG(window));
193 case GTK_RESPONSE_YES:
194 if (hildon_button_get_value(HILDON_BUTTON (theme_button))){
197 if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Berlin")))
198 priv->theme = g_strdup("Berlin");
199 if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Modern")))
200 priv->theme = g_strdup("Modern");
201 if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Matrix")))
202 priv->theme = g_strdup("Matrix");
203 if (hildon_check_button_get_active (rich_animation_button))
204 priv->rich_animation = TRUE;
206 priv->rich_animation = FALSE;
209 reload_scene(priv->desktop_plugin);
212 case GTK_RESPONSE_OK:
214 case GTK_RESPONSE_NO:
215 gtk_widget_destroy(window);
221 gtk_widget_destroy(window);