From a493b31c52075d271326a6ed07e079f9c3994365 Mon Sep 17 00:00:00 2001 From: tanya Date: Fri, 17 Sep 2010 15:37:04 +0300 Subject: [PATCH] added in xml check_path and install_file, tried open .install file in the browser --- applet/data/external_themes/100boxes.xml | 2 +- applet/data/external_themes/colorflood.xml | 1 + applet/data/external_themes/conky.xml | 4 +- applet/data/external_themes/crazychikens.xml | 1 + applet/data/external_themes/orrery.xml.disable | 3 +- applet/data/external_themes/xsnow2.xml | 3 +- applet/data/theme/Conky/conky.install | 8 ++ applet/src/livewp-settings.c | 141 ++++++++++++++---------- 8 files changed, 99 insertions(+), 64 deletions(-) create mode 100644 applet/data/theme/Conky/conky.install diff --git a/applet/data/external_themes/100boxes.xml b/applet/data/external_themes/100boxes.xml index 41286cf..dee8143 100644 --- a/applet/data/external_themes/100boxes.xml +++ b/applet/data/external_themes/100boxes.xml @@ -1,6 +1,6 @@ 100Boxes /usr/bin/100boxes -l - 100boxes + 100boxes_exec Game diff --git a/applet/data/external_themes/colorflood.xml b/applet/data/external_themes/colorflood.xml index 84f2d98..b0b62c2 100644 --- a/applet/data/external_themes/colorflood.xml +++ b/applet/data/external_themes/colorflood.xml @@ -5,4 +5,5 @@ Game /usr/share/livewp/theme/Colorflood/icon.png /usr/share/livewp/theme/Colorflood/icond.png + /usr/bin/colorflood diff --git a/applet/data/external_themes/conky.xml b/applet/data/external_themes/conky.xml index dce4b76..507d8f6 100644 --- a/applet/data/external_themes/conky.xml +++ b/applet/data/external_themes/conky.xml @@ -4,5 +4,7 @@ Unknown /usr/share/livewp/theme/Conky/icon.png /usr/share/livewp/theme/Conky/icond.png - -w + -w + /usr/bin/conky + /usr/share/livewp/theme/Conky/conky.install diff --git a/applet/data/external_themes/crazychikens.xml b/applet/data/external_themes/crazychikens.xml index e3926cf..712d511 100644 --- a/applet/data/external_themes/crazychikens.xml +++ b/applet/data/external_themes/crazychikens.xml @@ -6,4 +6,5 @@ /usr/share/livewp/theme/CrazyChickens/icon.png /usr/share/livewp/theme/CrazyChickens/icond.png --livewallpaper + /usr/bin/crazychickens diff --git a/applet/data/external_themes/orrery.xml.disable b/applet/data/external_themes/orrery.xml.disable index 689a418..5253295 100644 --- a/applet/data/external_themes/orrery.xml.disable +++ b/applet/data/external_themes/orrery.xml.disable @@ -4,5 +4,6 @@ orrery Unknown /usr/share/livewp/theme/Orrery/icon.png - /usr/share/livewp/theme/Orrery/icond.png + /usr/share/livewp/theme/Orrery/icond.png + /opt/maemo/usr/bin/orrery diff --git a/applet/data/external_themes/xsnow2.xml b/applet/data/external_themes/xsnow2.xml index b95d95b..8b9c012 100644 --- a/applet/data/external_themes/xsnow2.xml +++ b/applet/data/external_themes/xsnow2.xml @@ -3,5 +3,6 @@ /usr/bin/xsnow Unknown /usr/share/livewp/theme/Xsnow/icon.png - /usr/share/livewp/theme/Xsnow/icond.png + /usr/share/livewp/theme/Xsnow/icond.png + /usr/bin/xsnow diff --git a/applet/data/theme/Conky/conky.install b/applet/data/theme/Conky/conky.install new file mode 100644 index 0000000..6841bc2 --- /dev/null +++ b/applet/data/theme/Conky/conky.install @@ -0,0 +1,8 @@ +[install] +catalogues = extras +package = conky + +[extras] +name = Maemo Extras +uri = http://repository.maemo.org/extras/ +components = free non-free diff --git a/applet/src/livewp-settings.c b/applet/src/livewp-settings.c index b1be895..01e3bfc 100644 --- a/applet/src/livewp-settings.c +++ b/applet/src/livewp-settings.c @@ -1,21 +1,21 @@ /* 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 @@ -25,7 +25,7 @@ #include "livewp-settings.h" /*******************************************************************************/ void lw_about(void){ - + gchar *about_string; GtkWidget *window = NULL, *vbox = NULL, @@ -69,14 +69,14 @@ create_category_selector (Animation_WallpaperPrivate *priv){ 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); @@ -93,7 +93,7 @@ theme_button_clicked(GtkWidget *button, GdkEventButton *event, Animation_Wallpap /********************************************************************************/ 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; @@ -111,30 +111,30 @@ set_button_image(GtkWidget * button, Animation_WallpaperPrivate *priv, gboolean 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); @@ -203,7 +203,7 @@ changed_value_theme_cb (HildonPickerButton *picker, Animation_WallpaperPrivate * 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; @@ -243,10 +243,10 @@ changed_value_category_cb (HildonPickerButton *picker, Animation_WallpaperPrivat 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 */ @@ -274,7 +274,7 @@ fill_theme_button (Animation_WallpaperPrivate *priv, GtkWidget *button, gchar *c 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")); @@ -282,8 +282,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; - 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")); @@ -306,7 +306,7 @@ fill_theme_button (Animation_WallpaperPrivate *priv, GtkWidget *button, gchar *c } } } - while (store){ + while (store){ if (!g_hash_table_lookup(store->data, "category")) continue; if (!strcmp(g_hash_table_lookup(store->data, "category"), category)){ @@ -322,7 +322,7 @@ fill_theme_button (Animation_WallpaperPrivate *priv, GtkWidget *button, gchar *c /* 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; @@ -346,7 +346,7 @@ create_themes_button (Animation_WallpaperPrivate *priv, gchar *category){ button = hildon_picker_button_new (HILDON_SIZE_FINGER_HEIGHT, HILDON_BUTTON_ARRANGEMENT_VERTICAL); hildon_button_set_title (HILDON_BUTTON (button), _("Theme")); - + return button; } /********************************************************************************/ @@ -367,36 +367,36 @@ create_categories_button (Animation_WallpaperPrivate *priv){ 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; @@ -442,9 +442,9 @@ create_themes_buttons_hbox(Animation_WallpaperPrivate *priv){ 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; @@ -476,16 +476,16 @@ create_themes_buttons_hbox(Animation_WallpaperPrivate *priv){ 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(); @@ -592,7 +592,7 @@ void 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); @@ -618,13 +618,13 @@ additional_parametr_for_theme_video(GtkWidget *vbox, Animation_WallpaperPrivate 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), @@ -653,7 +653,7 @@ show_duplicate_theme (GtkWidget *widget, gchar *theme_name){ } /*******************************************************************************/ -void +void lw_theme_settings(GtkWidget *button, Animation_WallpaperPrivate *priv) { gint result; GtkWidget *window = NULL; @@ -664,7 +664,7 @@ lw_theme_settings(GtkWidget *button, Animation_WallpaperPrivate *priv) { 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; @@ -688,7 +688,7 @@ lw_theme_settings(GtkWidget *button, Animation_WallpaperPrivate *priv) { 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 */ @@ -730,11 +730,12 @@ 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 */ + /* if not scuccess exit from wthout saving */ break; } } @@ -742,7 +743,7 @@ lw_theme_settings(GtkWidget *button, Animation_WallpaperPrivate *priv) { 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; } } @@ -750,7 +751,7 @@ lw_theme_settings(GtkWidget *button, Animation_WallpaperPrivate *priv) { 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; } } @@ -758,7 +759,7 @@ lw_theme_settings(GtkWidget *button, Animation_WallpaperPrivate *priv) { 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; } } @@ -766,7 +767,7 @@ lw_theme_settings(GtkWidget *button, Animation_WallpaperPrivate *priv) { 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; } } @@ -775,11 +776,11 @@ lw_theme_settings(GtkWidget *button, Animation_WallpaperPrivate *priv) { 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"))) @@ -810,14 +811,34 @@ lw_theme_settings(GtkWidget *button, Animation_WallpaperPrivate *priv) { 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; @@ -878,7 +899,7 @@ check_applet_state(gint number){ 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); @@ -898,7 +919,7 @@ start_applet(gint number){ 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"); @@ -921,10 +942,10 @@ stop_applet(gint number){ 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 -- 1.7.9.5