From 1a9725f2e3c8a71f000e1fc9166d9909e7a9ea71 Mon Sep 17 00:00:00 2001 From: Vlad Date: Thu, 19 Aug 2010 14:29:09 +0300 Subject: [PATCH] added sound option for video --- applet/debian/changelog | 3 +- applet/src/livewp-common.h | 1 + applet/src/livewp-config.c | 29 ++++++++++++++-- applet/src/livewp-config.h | 3 +- applet/src/livewp-dbus.c | 1 - applet/src/livewp-home-widget.c | 8 ----- applet/src/livewp-scene.c | 3 ++ applet/src/livewp-settings.c | 73 +++++++++++++++++++++++++++++---------- 8 files changed, 89 insertions(+), 32 deletions(-) diff --git a/applet/debian/changelog b/applet/debian/changelog index 4773bf5..ae6831b 100644 --- a/applet/debian/changelog +++ b/applet/debian/changelog @@ -1,10 +1,11 @@ live-wallpaper (0.8.1) unstable; urgency=low * Fixed problem in parsing of xml files - * Updated Finish translation + * Updated Finish and Russian translation * Fixed bug with theme settings (when use theme Abstractile in category Xscreensaver) * Done native background in theme Accel + * Added option 'Sound' for theme Video -- Vlad Vasiliev Mon, 16 Aug 2010 12:39:10 +0200 diff --git a/applet/src/livewp-common.h b/applet/src/livewp-common.h index e0a783c..70be691 100644 --- a/applet/src/livewp-common.h +++ b/applet/src/livewp-common.h @@ -107,6 +107,7 @@ struct _Animation_WallpaperPrivate time_t last_alive_event; gchar *theme_string_parametr1; guint theme_int_parametr1; + gboolean theme_bool_parametr1; GstElement *pipeline; gboolean running; GSList *extheme_list; diff --git a/applet/src/livewp-config.c b/applet/src/livewp-config.c index 4f499ce..e8ccf93 100644 --- a/applet/src/livewp-config.c +++ b/applet/src/livewp-config.c @@ -110,8 +110,21 @@ read_config(Animation_WallpaperPrivate *priv) { gconf_value_free(value); } else priv->rich_animation = TRUE; + /* get theme additional bool aparametr 1 default TRUE */ + str = g_strdup_printf("%s%i", GCONF_KEY_ADDITIONAL_BOOL_1, id); + value = gconf_client_get(gconf_client, str, NULL); + if (str){ + g_free(str); + str = NULL; + } + if (value) { + priv->theme_bool_parametr1 = gconf_value_get_bool(value); + gconf_value_free(value); + } else + priv->theme_bool_parametr1= TRUE; + /* get theme additional parameter 1 */ - str = g_strdup_printf("%s%i", GCONF_KEY_ADDIONAL_STRING_1 , id); + str = g_strdup_printf("%s%i", GCONF_KEY_ADDITIONAL_STRING_1 , id); value = gconf_client_get(gconf_client, str, NULL); if (str){ g_free(str); @@ -161,8 +174,20 @@ save_config(Animation_WallpaperPrivate *priv) { g_free(str); str = NULL; } + str = g_strdup_printf("%s%i", GCONF_KEY_ADDITIONAL_BOOL_1, id); + if (priv->theme_bool_parametr1) + gconf_client_set_bool(gconf_client, + str, TRUE, NULL); + else + gconf_client_set_bool(gconf_client, + str, FALSE, NULL); + if (str){ + g_free(str); + str = NULL; + } + if (priv->theme_string_parametr1){ - str = g_strdup_printf("%s%i",GCONF_KEY_ADDIONAL_STRING_1, id); + str = g_strdup_printf("%s%i",GCONF_KEY_ADDITIONAL_STRING_1, id); gconf_client_set_string(gconf_client, str, priv->theme_string_parametr1, NULL); diff --git a/applet/src/livewp-config.h b/applet/src/livewp-config.h index 058fff5..ff9b892 100644 --- a/applet/src/livewp-config.h +++ b/applet/src/livewp-config.h @@ -30,7 +30,8 @@ #define GCONF_KEY_PREFIX "/apps/maemo/livewp" #define GCONF_KEY_THEME GCONF_KEY_PREFIX"/theme" #define GCONF_KEY_RANIMATION GCONF_KEY_PREFIX"/rich_animation" -#define GCONF_KEY_ADDIONAL_STRING_1 GCONF_KEY_PREFIX"/additional_string_1" +#define GCONF_KEY_ADDITIONAL_STRING_1 GCONF_KEY_PREFIX"/additional_string_1" +#define GCONF_KEY_ADDITIONAL_BOOL_1 GCONF_KEY_PREFIX"/additional_bool_1" void init_scene_Modern(AWallpaperPlugin *desktop_plugin); void init_scene_Berlin(AWallpaperPlugin *desktop_plugin); void init_scene_Matrix(AWallpaperPlugin *desktop_plugin); diff --git a/applet/src/livewp-dbus.c b/applet/src/livewp-dbus.c index bc854c6..378ab3e 100644 --- a/applet/src/livewp-dbus.c +++ b/applet/src/livewp-dbus.c @@ -73,7 +73,6 @@ livewp_deinitialize_dbus(Animation_WallpaperPrivate *priv){ gchar *filter_string; DBusError error; -fprintf(stderr,"dddddddddddddddddddd\n"); if (priv->dbus_conn_session){ filter_string = g_strdup_printf("type='signal', interface='%s'", LIVEWP_SIGNAL_INTERFACE); diff --git a/applet/src/livewp-home-widget.c b/applet/src/livewp-home-widget.c index 153fca9..e7de045 100644 --- a/applet/src/livewp-home-widget.c +++ b/applet/src/livewp-home-widget.c @@ -76,14 +76,6 @@ lw_applet_realize (GtkWidget *widget) desktop_plugin_visible_notify((GObject *)widget, NULL, desktop_plugin); -#if 0 - /* Load config */ - read_config(desktop_plugin->priv); - - init_scene_theme(desktop_plugin); - - desktop_plugin->priv->long_timer = g_timeout_add(LONG_TIMER, (GtkFunction)long_timeout, desktop_plugin); -#endif screen = gtk_widget_get_screen (widget); gtk_widget_set_colormap (widget, gdk_screen_get_rgba_colormap (screen)); diff --git a/applet/src/livewp-scene.c b/applet/src/livewp-scene.c index 64e9cc8..c62d0fd 100644 --- a/applet/src/livewp-scene.c +++ b/applet/src/livewp-scene.c @@ -270,6 +270,9 @@ init_scene_Video(AWallpaperPlugin *desktop_plugin) } file_plus_uri = g_strdup_printf("file://%s",desktop_plugin->priv->theme_string_parametr1); g_object_set (G_OBJECT (bin), "uri", file_plus_uri, NULL ); + /* Set Mute */ + if (!desktop_plugin->priv->theme_bool_parametr1) + g_object_set (G_OBJECT (bin), "mute", TRUE, NULL ); g_object_set (G_OBJECT (videosink), "force-aspect-ratio", TRUE, NULL ); if (GST_IS_X_OVERLAY (videosink)) diff --git a/applet/src/livewp-settings.c b/applet/src/livewp-settings.c index 769a32a..af7aa68 100644 --- a/applet/src/livewp-settings.c +++ b/applet/src/livewp-settings.c @@ -34,7 +34,7 @@ void lw_about(void){ 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 \n Copyright(c) 2010\n \ + label_about = gtk_label_new (_("Live Wallpaper Version 0.8.1 \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 Andrew Zhilin\n \ @@ -161,15 +161,19 @@ 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; vbox = g_object_get_data(G_OBJECT(priv->window), "custom_vbox"); if (vbox){ gtk_widget_destroy(vbox); } - vbox = gtk_vbox_new (FALSE, 5); + vbox = gtk_vbox_new (TRUE, 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); + gtk_box_pack_start(GTK_BOX(area_vbox), + vbox, FALSE, FALSE, 5); if (choice) { if (!strcmp(choice, _("Berlin"))){ rich_animation_additional_parametr(vbox,priv); @@ -275,7 +279,7 @@ GtkWidget * create_themes_button (Animation_WallpaperPrivate *priv, gchar *category){ GtkWidget *button; - button = hildon_picker_button_new (HILDON_SIZE_AUTO, HILDON_BUTTON_ARRANGEMENT_VERTICAL); + button = hildon_picker_button_new (HILDON_SIZE_FINGER_HEIGHT, HILDON_BUTTON_ARRANGEMENT_VERTICAL); hildon_button_set_title (HILDON_BUTTON (button), _("Theme")); @@ -293,7 +297,7 @@ create_categories_button (Animation_WallpaperPrivate *priv){ result_table = g_hash_table_new(g_str_hash, g_str_equal); selector = create_category_selector(priv); - button = hildon_picker_button_new (HILDON_SIZE_AUTO, HILDON_BUTTON_ARRANGEMENT_VERTICAL); + button = hildon_picker_button_new (HILDON_SIZE_FINGER_HEIGHT, HILDON_BUTTON_ARRANGEMENT_VERTICAL); hildon_button_set_title (HILDON_BUTTON (button), _("Category")); hildon_picker_button_set_selector (HILDON_PICKER_BUTTON (button), HILDON_TOUCH_SELECTOR (selector)); @@ -341,7 +345,7 @@ create_categories_button (Animation_WallpaperPrivate *priv){ /*******************************************************************************/ GtkWidget * -create_rich_animation_button (gboolean active, gchar *name) +create_bool_button (gboolean active, gchar *name) { GtkWidget *button; button = hildon_check_button_new (HILDON_SIZE_AUTO); @@ -354,7 +358,7 @@ GtkWidget * create_enable_button (gboolean active) { 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), _("Enable")); hildon_check_button_set_active(HILDON_CHECK_BUTTON(button), active); return button; @@ -467,7 +471,7 @@ rich_animation_additional_parametr(GtkWidget *vbox, Animation_WallpaperPrivate * GtkWidget *rich_animation_button; /* Create rich animation button */ - rich_animation_button = create_rich_animation_button(priv->rich_animation, _("Rich Animation")); + rich_animation_button = create_bool_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); @@ -478,6 +482,7 @@ void additional_parametr_for_theme_video(GtkWidget *vbox, Animation_WallpaperPrivate *priv){ GtkWidget *file_button; + GtkWidget *sound_button; GtkWidget *rich_animation_button; if (priv->theme_string_parametr1) @@ -491,13 +496,20 @@ 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 */ - rich_animation_button = create_rich_animation_button(priv->rich_animation, _("Loop")); + 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 sound button */ + sound_button = create_bool_button(priv->theme_bool_parametr1, _("Sound")); + gtk_box_pack_start(GTK_BOX(vbox), + sound_button, TRUE, TRUE, 5); + g_object_set_data(G_OBJECT(priv->window), "sound_button", sound_button); gtk_widget_show (file_button); + gtk_widget_show (sound_button); gtk_widget_show (rich_animation_button); } @@ -506,11 +518,14 @@ void lw_theme_settings(GtkWidget *button, Animation_WallpaperPrivate *priv) { gint result; GtkWidget *window = NULL; + GtkWidget *scrolled_window = NULL; GtkWidget *save_button; GtkWidget *theme_button; GtkWidget *category_button; GtkWidget *enable_button; GtkWidget *vbox; + GtkWidget *temp_button; + GtkWidget *area_vbox; GtkWidget *button1 = NULL; GtkWidget *rich_animation_button = NULL; gint view = priv->view; @@ -522,16 +537,26 @@ lw_theme_settings(GtkWidget *button, Animation_WallpaperPrivate *priv) { gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); gtk_window_set_modal(GTK_WINDOW(window), TRUE); + /* Create panarea */ + area_vbox = gtk_vbox_new(FALSE, 2); + g_object_set_data(G_OBJECT(window), "area_vbox", area_vbox); + scrolled_window = hildon_pannable_area_new (); + hildon_pannable_area_add_with_viewport(HILDON_PANNABLE_AREA (scrolled_window), GTK_WIDGET (area_vbox)); + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox), + scrolled_window, FALSE, FALSE, 0); + + gtk_widget_set_size_request(scrolled_window, -1, 370); + /* Create Enable button */ enable_button = create_enable_button(check_applet_state(view)); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox), - enable_button, TRUE, TRUE, 5); + gtk_box_pack_start(GTK_BOX(area_vbox), + enable_button, FALSE, FALSE, 5); /* Create Category button */ category_button = create_categories_button(priv); g_object_set_data(G_OBJECT(window), "category_button", category_button); g_signal_connect (G_OBJECT (category_button), "value-changed", G_CALLBACK (changed_value_category_cb), priv); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox), - category_button, TRUE, TRUE, 5); + gtk_box_pack_start(GTK_BOX(area_vbox), + category_button, FALSE, FALSE, 5); /* Create Custom vbox */ vbox = gtk_vbox_new (FALSE, 5); g_object_set_data(G_OBJECT(window), "custom_vbox", vbox); @@ -540,18 +565,20 @@ lw_theme_settings(GtkWidget *button, Animation_WallpaperPrivate *priv) { theme_button = create_themes_button(priv, (gchar *)hildon_button_get_value(HILDON_BUTTON (category_button))); g_object_set_data(G_OBJECT(window), "theme_button", theme_button); 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); + gtk_box_pack_start(GTK_BOX(area_vbox), + theme_button, FALSE, FALSE, 5); fill_theme_button(priv, theme_button, (gchar *)hildon_button_get_value(HILDON_BUTTON (category_button))); /* Pack custom vbox. It must be last widget */ - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox), - vbox, TRUE, TRUE, 5); + gtk_box_pack_start(GTK_BOX(area_vbox), + vbox, FALSE, FALSE, 5); gtk_widget_show (enable_button); gtk_widget_show (category_button); gtk_widget_show (theme_button); gtk_widget_show (vbox); + gtk_widget_show (area_vbox); + gtk_widget_show (scrolled_window); gtk_widget_show (window); save_button = gtk_dialog_add_button(GTK_DIALOG(window), _("Save"), GTK_RESPONSE_YES); @@ -591,6 +618,14 @@ lw_theme_settings(GtkWidget *button, Animation_WallpaperPrivate *priv) { g_free(priv->theme_string_parametr1); priv->theme_string_parametr1 = g_strdup((gchar*)hildon_button_get_value (HILDON_BUTTON(button1))); } + temp_button = g_object_get_data(G_OBJECT(priv->window), "sound_button"); + if (temp_button){ + /* Check rich animation */ + if (hildon_check_button_get_active (HILDON_CHECK_BUTTON(temp_button))) + priv->theme_bool_parametr1 = TRUE; + else + priv->theme_bool_parametr1 = FALSE; + } } /* Check external themes */ GSList *store = priv->extheme_list; -- 1.7.9.5