* for the code
*
* This software is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but
#include "livewp-settings.h"
/*******************************************************************************/
void lw_about(void){
-
+
+ gchar *about_string;
GtkWidget *window = NULL,
*vbox = NULL,
*label_about = NULL;
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.8.6 \n Copyright(c) 2010\n \
+ about_string = g_strdup_printf(_("Live Wallpaper Version %s \n Copyright(c) 2010\n \
Tanya Makova\n Vlad Vasiliev\n \
Copyright(c) 2010 for design themes Berlin, Modern and Accel Vasya Bobrikov\n \
-Copyright(c) 2010 for design theme Matrix and icons Andrew Zhilin\n \
+Copyright(c) 2010 for design themes Matrix, Fifteen \nand for icons Andrew Zhilin\n \
Translators:\n \
Finnish - Marko Vertainen\n \
Spain - Alejandro López\n \
+Italian - Emanuele Cassioli\n \
Russian - Tanya Makova \n \
- Vlad Vasiliev\n"));
+ Vlad Vasiliev\n"), VERSION);
+
+ label_about = gtk_label_new (about_string);
gtk_box_pack_start (GTK_BOX (vbox), label_about, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox),
vbox, TRUE, TRUE, 0);
create_category_selector (Animation_WallpaperPrivate *priv){
GtkWidget *selector;
GSList *store = priv->extheme_list;
- GList *category_list;
GHashTable *result_table = NULL;
+ 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){
- if (!g_hash_table_lookup(result_table, g_hash_table_lookup(store->data, "category")))
+ if (!g_hash_table_lookup(result_table, g_hash_table_lookup(store->data, "category"))){
g_hash_table_insert(result_table, g_hash_table_lookup(store->data, "category"), (gint *)1);
+ hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), g_hash_table_lookup(store->data, "category"));
+ }
store = g_slist_next(store);
}
/* Add Xscreensaver for install message */
- if (!g_hash_table_lookup(result_table,"Xscreensaver"))
+ if (!g_hash_table_lookup(result_table,"Xscreensaver")){
g_hash_table_insert(result_table, "Xscreensaver", (gint *)1);
-
-
- category_list = g_hash_table_get_keys (result_table);
- selector = hildon_touch_selector_new_text();
-
- hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), "LiveWallpaper" );
- while (category_list){
- hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector),category_list->data );
- category_list = g_list_next(category_list);
+ hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), "Xscreensaver");
}
-
return selector;
}
}
/********************************************************************************/
void
+changed_value_one_in_all_cb (GtkWidget *toggle, Animation_WallpaperPrivate *priv)
+{
+ priv->one_in_all_view = hildon_check_button_get_active((HildonCheckButton *)toggle);
+ create_themes_buttons_hbox(priv);
+ fprintf(stderr, "changed_value_one_in_all_cb\n");
+}
+/********************************************************************************/
+void
changed_value_theme_cb (HildonPickerButton *picker, Animation_WallpaperPrivate *priv)
{
const gchar *choice = hildon_button_get_value(HILDON_BUTTON (picker));
num++;
}
if (!strcmp(theme, g_hash_table_lookup(store->data, "name"))){
- if (g_hash_table_lookup(store->data, "category"))
+ if (g_hash_table_lookup(store->data, "category")){
hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (selector), 0,
(gint)g_hash_table_lookup(result_table, g_hash_table_lookup(store->data, "category")));
hildon_button_set_value(HILDON_BUTTON(button), g_hash_table_lookup(store->data, "category"));
+ }
break;
}
create_bool_button (gboolean active, gchar *name)
{
GtkWidget *button;
- button = hildon_check_button_new (HILDON_SIZE_AUTO);
+ button = hildon_check_button_new (HILDON_SIZE_FINGER_HEIGHT);
gtk_button_set_label (GTK_BUTTON (button), name);
hildon_check_button_set_active(HILDON_CHECK_BUTTON(button), active);
return button;
lw_main_settings(priv, NULL);
}
/*******************************************************************************/
-void
-lw_main_settings(Animation_WallpaperPrivate *priv, gpointer data){
- gint result;
- GtkWidget *window = NULL;
+void
+create_themes_buttons_hbox(Animation_WallpaperPrivate *priv){
+ GtkWidget *hbox = NULL;
+ GtkWidget *area_hbox = NULL;
GtkWidget *theme_button1;
GtkWidget *theme_button2;
GtkWidget *theme_button3;
- GtkWidget *theme_button4;
- GtkWidget *hbox;
- Animation_WallpaperPrivate *priv_temp = NULL;
+ GtkWidget *theme_button4;
- window = gtk_dialog_new();
-
- gtk_window_set_title(GTK_WINDOW(window), _("Live Wallpaper Settings"));
- gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
- gtk_window_set_modal(GTK_WINDOW(window), TRUE);
- /* Create Theme button */
+
+ area_hbox = g_object_get_data(G_OBJECT(priv->window), "area_hbox");
+ if (!area_hbox)
+ return;
+ hbox = g_object_get_data(G_OBJECT(priv->window), "custom_hbox");
+ 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),
+ hbox, FALSE, FALSE, 5);
+ /* Create Theme buttons */
theme_button1 = create_image_button(1, priv->dbus_conn_session);
gtk_box_pack_start(GTK_BOX(hbox),
theme_button1, TRUE, TRUE, 0);
+ gtk_widget_show (theme_button1);
+ gtk_widget_show (hbox);
+ if (priv->one_in_all_view)
+ return;
theme_button2 = create_image_button(2, priv->dbus_conn_session);
gtk_box_pack_start(GTK_BOX(hbox),
theme_button2, TRUE, TRUE, 0);
+ gtk_widget_show (theme_button2);
theme_button3 = create_image_button(3, priv->dbus_conn_session);
gtk_box_pack_start(GTK_BOX(hbox),
theme_button3, TRUE, TRUE, 0);
+ gtk_widget_show (theme_button3);
theme_button4 = create_image_button(4, priv->dbus_conn_session);
gtk_box_pack_start(GTK_BOX(hbox),
theme_button4, TRUE, TRUE, 0);
+ gtk_widget_show (theme_button4);
+
+}
+/*******************************************************************************/
+void
+lw_main_settings(Animation_WallpaperPrivate *priv, gpointer data){
+ gint result;
+ GtkWidget *window = NULL;
+ GtkWidget *banner = NULL;
+ GtkWidget *area_hbox;
+ GtkWidget *one_in_all_view_button;
+ gboolean one_in_all_view;
+
+ window = gtk_dialog_new();
+ priv->window = window;
+
+ one_in_all_view = priv->one_in_all_view;
+ gtk_window_set_title(GTK_WINDOW(window), _("Live Wallpaper Settings"));
+ gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
+ gtk_window_set_modal(GTK_WINDOW(window), TRUE);
+ one_in_all_view_button = create_bool_button(priv->one_in_all_view, _("One theme in all views"));
+ g_signal_connect (G_OBJECT (one_in_all_view_button), "toggled", G_CALLBACK (changed_value_one_in_all_cb), priv);
+ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox), one_in_all_view_button, TRUE, TRUE, 5);
+ area_hbox = gtk_vbox_new(FALSE, 2);
+ g_object_set_data(G_OBJECT(window), "area_hbox", area_hbox);
+ create_themes_buttons_hbox(priv);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox),
- hbox, TRUE, TRUE, 5);
+ area_hbox, TRUE, TRUE, 0);
- gtk_widget_show (theme_button1);
- gtk_widget_show (theme_button2);
- gtk_widget_show (theme_button3);
- gtk_widget_show (theme_button4);
- gtk_widget_show_all (hbox);
+ gtk_widget_show (one_in_all_view_button);
+ gtk_widget_show_all (area_hbox);
gtk_widget_show (window);
gtk_dialog_add_button(GTK_DIALOG(window), _("About"), GTK_RESPONSE_NO);
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);
g_free(priv_temp);
priv_temp =NULL;
}
-
+*/
switch(result){
case GTK_RESPONSE_NO:
break;
}
+ if (hildon_check_button_get_active (HILDON_CHECK_BUTTON(one_in_all_view_button)) != one_in_all_view){
+ save_one_in_all_views_to_config(hildon_check_button_get_active (HILDON_CHECK_BUTTON(one_in_all_view_button)));
+ //fprintf(stderr,"CHECK!!!!!!!!!!!!!!\n");
+ banner = hildon_banner_show_information (window, NULL, _("Livewallpaper is reloading..."));
+ hildon_banner_set_timeout(HILDON_BANNER(banner), 3000);
+ stop_applet(1);
+ stop_applet(2);
+ stop_applet(3);
+ stop_applet(4);
+ g_timeout_add(3000, (GSourceFunc)cb_timeout_settings, window);
+ }else{
+ if (window)
+ gtk_widget_destroy(window);
+ }
+}
+/*******************************************************************************/
+gboolean
+cb_timeout_settings(GtkWidget *window){
+
+ start_applet(1);
+ start_applet(2);
+ start_applet(3);
+ start_applet(4);
if (window)
gtk_widget_destroy(window);
+ return FALSE;
}
/*******************************************************************************/
void
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;
+ }
+ }
if (priv->theme)
g_free(priv->theme);