/* vim: set sw=4 ts=4 et: */
/*
* This file is part of Live Wallpaper (livewp)
- *
+ *
* Copyright (C) 2010 Vlad Vasiliev
* Copyright (C) 2010 Tanya Makova
* for the code
- *
+ *
* This software is free software; you can redistribute it and/or
* 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
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
#include "livewp-settings.h"
/*******************************************************************************/
void lw_about(void){
-
+
gchar *about_string;
GtkWidget *window = NULL,
*vbox = NULL,
hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), "LiveWallpaper" );
result_table = g_hash_table_new(g_str_hash, g_str_equal);
- while (store){
+ while (store){
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);
+ 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")){
g_hash_table_insert(result_table, "Xscreensaver", (gint *)1);
/********************************************************************************/
void
set_button_image(GtkWidget * button, Animation_WallpaperPrivate *priv, gboolean enable){
- GtkWidget * image = NULL;
+ GtkWidget * image = NULL;
GdkPixbuf * pixbuf = NULL;
gchar *str = NULL;
gchar *icon_on = NULL;
if (enable){
if (icon_on)
str = g_strdup_printf("%s", icon_on);
- else
- str = g_strdup_printf( "%s/%s/%s", THEME_PATH,
+ else
+ str = g_strdup_printf( "%s/%s/%s", THEME_PATH,
priv->theme, "icon.png");
if (access(str, F_OK) != 0){
g_free(str);
- str = g_strdup_printf( "%s/%s/%s", THEME_PATH,
+ str = g_strdup_printf( "%s/%s/%s", THEME_PATH,
"Video", "icon.png");
}
}else {
if (icon_off)
str = g_strdup_printf("%s", icon_off);
- else
- str = g_strdup_printf( "%s/%s/%s", THEME_PATH,
+ else
+ str = g_strdup_printf( "%s/%s/%s", THEME_PATH,
priv->theme, "icond.png");
if (access(str, F_OK) != 0){
g_free(str);
- str = g_strdup_printf( "%s/%s/%s", THEME_PATH,
+ str = g_strdup_printf( "%s/%s/%s", THEME_PATH,
"Video", "icond.png");
}
}
- pixbuf = gdk_pixbuf_new_from_file_at_size (str,
- 124,
- 79,
+ pixbuf = gdk_pixbuf_new_from_file_at_size (str,
+ 124,
+ 79,
NULL);
if (str)
g_free(str);
const gchar *choice = hildon_button_get_value(HILDON_BUTTON (picker));
GtkWidget *vbox = NULL;
GtkWidget *area_vbox = NULL;
-
+
area_vbox = g_object_get_data(G_OBJECT(priv->window), "area_vbox");
if (!area_vbox)
return;
const gchar *choice = hildon_button_get_value(HILDON_BUTTON (picker));
theme_button = g_object_get_data(G_OBJECT(priv->window), "theme_button");
- if (!theme_button)
+ if (!theme_button)
return;
HildonTouchSelector * selector = hildon_picker_button_get_selector((HildonPickerButton *) theme_button);
- hildon_touch_selector_remove_column(selector, 0);
+ hildon_touch_selector_remove_column(selector, 0);
hildon_touch_selector_append_text_column(selector, (GtkTreeModel*)gtk_list_store_new (1, G_TYPE_STRING), TRUE);
fill_theme_button(priv, theme_button, (gchar *)hildon_button_get_value(HILDON_BUTTON (picker)));
/* check xscreensaver category */
HildonTouchSelector * selector = hildon_picker_button_get_selector((HildonPickerButton *) button);
if (!selector)
selector = (HildonTouchSelector *)hildon_touch_selector_new_text ();
-
+
hildon_button_set_value(HILDON_BUTTON(button), NULL);
if (!strcmp(category, "LiveWallpaper")){
hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), _("Berlin"));
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;
- if (theme){
+ num = 5;
+ if (theme){
if (!strcmp(theme, "Berlin")){
hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (selector), 0, 0);
hildon_button_set_value(HILDON_BUTTON(button), _("Berlin"));
}
}
}
- while (store){
+ while (store){
if (!g_hash_table_lookup(store->data, "category"))
continue;
if (!strcmp(g_hash_table_lookup(store->data, "category"), category)){
/* Added Shreman's Aquarium for message */
if (!strcmp(category, "Unknown")){
store = priv->extheme_list;
- while (store){
+ while (store){
if (!strcmp("Shermans Aquarium" , g_hash_table_lookup(store->data, "name"))){
flag = TRUE;
break;
button = hildon_picker_button_new (HILDON_SIZE_FINGER_HEIGHT, HILDON_BUTTON_ARRANGEMENT_VERTICAL);
hildon_button_set_title (HILDON_BUTTON (button), _("Theme"));
-
+
return button;
}
/********************************************************************************/
HILDON_TOUCH_SELECTOR (selector));
if (theme) {
if (!strcmp(theme, "Berlin")){
- hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (selector), 0, 0);
+ hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (selector), 0, 0);
hildon_button_set_value(HILDON_BUTTON(button), "LiveWallpaper");
}
if (!strcmp(theme, "Modern")){
- hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (selector), 0, 0);
+ hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (selector), 0, 0);
hildon_button_set_value(HILDON_BUTTON(button), "LiveWallpaper");
}
if (!strcmp(theme, "Matrix")){
- hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (selector), 0, 0);
+ hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (selector), 0, 0);
hildon_button_set_value(HILDON_BUTTON(button), "LiveWallpaper");
}
if (!strcmp(theme, "Accel")){
- hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (selector), 0, 0);
+ hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (selector), 0, 0);
hildon_button_set_value(HILDON_BUTTON(button), "LiveWallpaper");
}
if (!strcmp(theme, "Video")){
- hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (selector), 0, 0);
+ 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){
if (g_hash_table_lookup(result_table, g_hash_table_lookup(store->data, "category")) == NULL){
- g_hash_table_insert(result_table, g_hash_table_lookup(store->data, "category"), (gint *)num);
+ g_hash_table_insert(result_table, g_hash_table_lookup(store->data, "category"), (gint *)num);
num++;
}
if (!strcmp(theme, g_hash_table_lookup(store->data, "name"))){
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_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;
GtkWidget *theme_button1;
GtkWidget *theme_button2;
GtkWidget *theme_button3;
- GtkWidget *theme_button4;
+ GtkWidget *theme_button4;
+
-
area_hbox = g_object_get_data(G_OBJECT(priv->window), "area_hbox");
if (!area_hbox)
return;
gtk_box_pack_start(GTK_BOX(hbox),
theme_button4, TRUE, TRUE, 0);
gtk_widget_show (theme_button4);
-
+
}
/*******************************************************************************/
-void
+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;
+ GtkWidget *one_in_all_view_button;
gboolean one_in_all_view;
window = gtk_dialog_new();
rich_animation_additional_parametr(GtkWidget *vbox, Animation_WallpaperPrivate *priv){
GtkWidget *rich_animation_button;
- /* Create rich animation button */
+ /* Create rich animation button */
rich_animation_button = create_bool_button(priv->rich_animation, _("Rich Animation"));
gtk_box_pack_start(GTK_BOX(vbox),
rich_animation_button, TRUE, TRUE, 5);
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 */
+ g_object_set_data(G_OBJECT(priv->window), "filename_button", file_button);
+ /* Create rich animation button */
rich_animation_button = create_bool_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);
- /* Create Smoothing button */
+ /* Create Smoothing button */
smoothing_button = create_bool_button(priv->theme_bool_parametr1, _("Smoothing (Need more memory)"));
gtk_box_pack_start(GTK_BOX(vbox),
}
/*******************************************************************************/
-void
+void
lw_theme_settings(GtkWidget *button, Animation_WallpaperPrivate *priv) {
gint result;
GtkWidget *window = NULL;
GtkWidget *enable_button;
GtkWidget *vbox;
GtkWidget *area_vbox;
- GtkWidget *temp_button;
+ GtkWidget *temp_button;
GtkWidget *button1 = NULL;
GtkWidget *rich_animation_button = NULL;
gint view = priv->view;
gtk_widget_set_size_request(scrolled_window, -1, 370);
/* Create Enable button */
- enable_button = create_enable_button(check_applet_state(view));
+ enable_button = create_enable_button(check_applet_state(view));
gtk_box_pack_start(GTK_BOX(area_vbox),
enable_button, FALSE, FALSE, 5);
/* Create Category button */
/* 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 */
+ /* if not scuccess exit from wthout saving */
break;
}
}
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 */
+ /* if not scuccess exit from wthout saving */
break;
}
}
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 */
+ /* if not scuccess exit from wthout saving */
break;
}
}
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 */
+ /* if not scuccess exit from wthout saving */
break;
}
}
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 */
+ /* if not scuccess exit from wthout saving */
break;
}
}
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 */
+ /* if not scuccess exit from wthout saving */
break;
}
}
-
+#endif
if (priv->theme)
g_free(priv->theme);
if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Berlin")))
GSList *store = priv->extheme_list;
while (store){
if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _(g_hash_table_lookup(store->data, "name")))){
- gchar *copies = g_hash_table_lookup(store->data, "copies");
+ //check if theme installed
+ gchar *check_path = g_hash_table_lookup(store->data, "check_path");
+ if (check_path){
+ if (access(check_path, F_OK) != 0){
+ show_problem_package(button, g_hash_table_lookup(store->data, "name"));
+ gchar * install_file = g_hash_table_lookup(store->data, "install_file");
+ if (install_file){
+ 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:file://%s",
+ install_file);
+ fprintf(stderr, "system %s\n", cmd);
+ system(cmd);
+ g_free(cmd);
+ }
+ /* if not success exit from without saving */
+ break;
+ }
+ }
+
+
+ //check if theme already selected
+ gchar *copies = g_hash_table_lookup(store->data, "copies");
//fprintf(stderr, "copies = %s\n", copies);
if (copies){
count = atoi(copies);
}else count = 10;
if (count > get_count_themes_from_config(g_hash_table_lookup(store->data, "name")))
priv->theme = g_strdup(g_hash_table_lookup(store->data, "name"));
- else
+ else
show_duplicate_theme(button, g_hash_table_lookup(store->data, "name"));
//priv->hash_theme = store->data;
break;
str = g_strdup_printf("livewp-home-widget.desktop-%i", (number - 1));
config_file = hd_config_file_new(NULL, "/home/user/.config/hildon-desktop/", "home.plugins");
-
+
gkey_file = hd_config_file_load_file(config_file, FALSE);
if (gkey_file && str){
result = g_key_file_has_group(gkey_file, str);
return;
str = g_strdup_printf("livewp-home-widget.desktop-%i",(number - 1));
config_file = hd_config_file_new(NULL, "/home/user/.config/hildon-desktop/", "home.plugins");
-
+
gkey_file = hd_config_file_load_file(config_file, FALSE);
if (gkey_file){
g_key_file_set_string (gkey_file, str, "X-Desktop-File", "/usr/share/applications/hildon-home/livewp-home-widget.desktop");
return;
str = g_strdup_printf("livewp-home-widget.desktop-%i", (number - 1));
config_file = hd_config_file_new(NULL, "/home/user/.config/hildon-desktop/", "home.plugins");
-
+
gkey_file = hd_config_file_load_file(config_file, FALSE);
if (gkey_file){
- g_key_file_remove_group(gkey_file, str, NULL);
+ g_key_file_remove_group(gkey_file, str, NULL);
hd_config_file_save_file( config_file, gkey_file);
g_key_file_free(gkey_file);
}else