split parametres between themes
authorvlad <vlad@vlanout.(none)>
Wed, 28 Jul 2010 18:51:17 +0000 (21:51 +0300)
committervlad <vlad@vlanout.(none)>
Wed, 28 Jul 2010 18:51:17 +0000 (21:51 +0300)
applet/src/livewp-scene.c
applet/src/livewp-settings.c

index adcfeb7..e4c4813 100644 (file)
@@ -41,6 +41,11 @@ destroy_scene(AWallpaperPlugin *desktop_plugin)
                desktop_plugin->priv->scene = NULL;
            }
     }
+    if (desktop_plugin->priv->pipeline){
+        gst_element_set_state (desktop_plugin->priv->pipeline, GST_STATE_NULL);
+        gst_object_unref (GST_OBJECT (desktop_plugin->priv->pipeline));
+
+    }
 }
 
 void
@@ -90,7 +95,7 @@ init_scene_Video(AWallpaperPlugin *desktop_plugin)
     gchar *file_plus_uri;
 
 
-    desktop_plugin->priv->pipeline= gst_pipeline_new("gst-player");
+    desktop_plugin->priv->pipeline = gst_pipeline_new("gst-player");
     bin = gst_element_factory_make ("playbin2", "bin");
     videosink = gst_element_factory_make ("ximagesink", "videosink");
     g_object_set (G_OBJECT (bin), "video-sink", videosink, NULL);
index d88fe5f..2a2bfbe 100644 (file)
@@ -118,6 +118,35 @@ create_image_button (gint view, DBusConnection *conn_sess){
 
 }
 /********************************************************************************/
+void
+changed_value_theme_cb (HildonPickerButton *picker, Animation_WallpaperPrivate *priv)
+{
+    const gchar *choice = hildon_button_get_value(HILDON_BUTTON (picker));
+    GtkWidget *vbox = NULL;
+        
+    vbox = g_object_get_data(G_OBJECT(priv->window), "custom_vbox");
+    if (vbox)
+        gtk_widget_destroy(vbox);
+    vbox = gtk_vbox_new (FALSE, 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);
+    if (choice) {
+        if (!strcmp(choice, "Berlin")){
+        }
+        if (!strcmp(choice, "Modern")){
+        }
+        if (!strcmp(choice, "Matrix")){
+        }
+        if (!strcmp(choice, "Video")){
+            additional_parametr_for_theme_video(vbox, priv);
+        }
+
+    }
+    gtk_widget_show(vbox);
+}
+
+/********************************************************************************/
 GtkWidget *
 create_themes_button (gchar *theme){
 
@@ -148,6 +177,7 @@ create_themes_button (gchar *theme){
         }
 
     }
+    
     return button;
 }
 
@@ -190,7 +220,6 @@ lw_main_settings(Animation_WallpaperPrivate *priv, gpointer data){
 
     window = gtk_dialog_new();
 
-    priv->window = window;
     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);
@@ -244,16 +273,24 @@ file_button_clicked(GtkButton *button, Animation_WallpaperPrivate *priv){
 
     if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK)
     {
-      if (priv->theme_string_parametr1)
-            g_free(priv->theme_string_parametr1);
-       priv->theme_string_parametr1 = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
-       hildon_button_set_value (button, priv->theme_string_parametr1);
+      hildon_button_set_value (button, gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)));
     }
     gtk_widget_destroy (dialog);
 
 }
 /*******************************************************************************/
 void
+rich_animation_additional_parametr(GtkWidget *vbox, Animation_WallpaperPrivate *priv){
+    GtkWidget *rich_animation_button;
+    /* Create rich animation button */  
+    rich_animation_button = create_rich_animation_button(priv->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);
+    gtk_widget_show (rich_animation_button);
+}
+/*******************************************************************************/
+void
 additional_parametr_for_theme_video(GtkWidget *vbox, Animation_WallpaperPrivate *priv){
 
     GtkWidget *file_button;
@@ -269,6 +306,7 @@ 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);
     gtk_widget_show (file_button);
 
 }
@@ -281,10 +319,12 @@ lw_theme_settings(Animation_WallpaperPrivate *priv, GtkWidget *button){
     GtkWidget *theme_button;
     GtkWidget *enable_button;
     GtkWidget *vbox;
-    GtkWidget *rich_animation_button;
+    GtkWidget *button1 = NULL;
+    GtkWidget *rich_animation_button = NULL;
     gint view = priv->view;
 
     window = gtk_dialog_new();
+    priv->window = window;
 
     gtk_window_set_title(GTK_WINDOW(window), _("View Settings"));
     gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
@@ -295,24 +335,26 @@ lw_theme_settings(Animation_WallpaperPrivate *priv, GtkWidget *button){
                                    enable_button, TRUE, TRUE, 5);
     /* Create Theme button */
     theme_button = create_themes_button(priv->theme);
+    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);
-    /* Create rich animation button */  
-    rich_animation_button = create_rich_animation_button(priv->rich_animation);
-    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox),
-                                   rich_animation_button, TRUE, TRUE, 5);
-     
+
     /* Create custom vbox */
     vbox = gtk_vbox_new (FALSE, 5);
     g_object_set_data(G_OBJECT(window), "custom_vbox", vbox);
     gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox),
                                    vbox, TRUE, TRUE, 5);
+    if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Berlin"))||
+        !strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Matrix"))||
+        !strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Modern"))){
+        rich_animation_additional_parametr(vbox, priv);
+    }
+
     if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Video"))){
         additional_parametr_for_theme_video(vbox, priv);
     } 
     gtk_widget_show (enable_button);
     gtk_widget_show (theme_button);
-    gtk_widget_show (rich_animation_button);
     gtk_widget_show (vbox);
     gtk_widget_show (window);
     save_button = gtk_dialog_add_button(GTK_DIALOG(window), _("Save"), GTK_RESPONSE_YES);
@@ -335,15 +377,24 @@ lw_theme_settings(Animation_WallpaperPrivate *priv, GtkWidget *button){
                     priv->theme = g_strdup("Matrix");
                 if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Video"))){
                     priv->theme = g_strdup("Video");
+                    button1 = g_object_get_data(G_OBJECT(priv->window), "filename_button");
+                    if (button1){
+                        if (priv->theme_string_parametr1)
+                            g_free(priv->theme_string_parametr1);
+                        priv->theme_string_parametr1 = hildon_button_get_value (button1);
+                    }
                 }
 
             }
-            /* Check rich animation */
-            if (hildon_check_button_get_active (HILDON_CHECK_BUTTON(rich_animation_button)))
-                priv->rich_animation = TRUE;
-            else
-                priv->rich_animation = FALSE;
 
+            rich_animation_button = g_object_get_data(G_OBJECT(priv->window), "filename_button");
+            if (rich_animation_button){
+                /* Check rich animation */
+                if (hildon_check_button_get_active (HILDON_CHECK_BUTTON(rich_animation_button)))
+                    priv->rich_animation = TRUE;
+                else
+                    priv->rich_animation = FALSE;
+            }
             /* Save config */
             save_config(priv);
             /* action with applet */