done config for one theme for all views
authorVlad <vlad@gas.by>
Wed, 1 Sep 2010 13:33:35 +0000 (16:33 +0300)
committerVlad <vlad@gas.by>
Wed, 1 Sep 2010 13:33:35 +0000 (16:33 +0300)
applet/src/livewp-common.h
applet/src/livewp-config.c
applet/src/livewp-config.h
applet/src/livewp-settings.c
applet/src/livewp-settings.h

index 70be691..be92608 100644 (file)
@@ -86,6 +86,7 @@ struct _Animation_WallpaperPrivate
     gchar *theme;
     gboolean visible;
     gboolean rich_animation;
+    gboolean one_in_all_view;
     GtkWidget *main_widget;
     GtkWidget *window;
     GtkWidget *right_corner;
index e3aa165..4c7a06c 100644 (file)
@@ -138,6 +138,13 @@ read_config(Animation_WallpaperPrivate *priv) {
         priv->theme_string_parametr1 = g_strdup(gconf_value_get_string(value));
         gconf_value_free(value);
     } 
+    /* get parameter one theme in all view */
+    value = gconf_client_get(gconf_client, GCONF_KEY_ONE_IN_ALL_VIEW, NULL);
+    if (value) {
+        priv->one_in_all_view = gconf_value_get_bool(value);
+        gconf_value_free(value);
+    } else
+       priv->one_in_all_view = FALSE;
 
     return 0;
 }
@@ -200,6 +207,12 @@ save_config(Animation_WallpaperPrivate *priv) {
             str = NULL;
         }
     }
+    if (priv->one_in_all_view)
+        gconf_client_set_bool(gconf_client,
+                              GCONF_KEY_ONE_IN_ALL_VIEW, TRUE, NULL);
+    else
+        gconf_client_set_bool(gconf_client,
+                              GCONF_KEY_ONE_IN_ALL_VIEW, FALSE, NULL);
 
     
 }
index 4fd4d20..65e15c9 100644 (file)
 
 #define GCONF_KEY_PREFIX                            "/apps/maemo/livewp"
 #define GCONF_KEY_THEME                             GCONF_KEY_PREFIX"/theme"
+#define GCONF_KEY_ONE_IN_ALL_VIEW                   GCONF_KEY_PREFIX"/one_in_all_view"
 #define GCONF_KEY_RANIMATION                        GCONF_KEY_PREFIX"/rich_animation"
-#define GCONF_KEY_ADDITIONAL_STRING_1                  GCONF_KEY_PREFIX"/additional_string_1"
-#define GCONF_KEY_ADDITIONAL_BOOL_1                  GCONF_KEY_PREFIX"/additional_bool_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);
index 8184a24..471e904 100644 (file)
@@ -193,6 +193,14 @@ create_image_button (gint view, DBusConnection *conn_sess){
 }
 /********************************************************************************/
 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));
@@ -407,7 +415,7 @@ GtkWidget *
 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;
@@ -429,49 +437,79 @@ show_settings(GtkWidget *widget, Animation_WallpaperPrivate *priv){
     lw_main_settings(priv, NULL);
 }
 /*******************************************************************************/
-void 
-lw_main_settings(Animation_WallpaperPrivate *priv, gpointer data){
-    gint result;
-    GtkWidget *window = NULL;
+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;
-
-    window = gtk_dialog_new();
+    GtkWidget *theme_button4;    
 
-    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 *area_hbox;
+    GtkWidget *one_in_all_view_button; 
+    Animation_WallpaperPrivate *priv_temp = NULL;
+
+    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);
+    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);
@@ -492,7 +530,7 @@ lw_main_settings(Animation_WallpaperPrivate *priv, gpointer data){
         g_free(priv_temp);
         priv_temp =NULL;
     }
-
+*/
 
     switch(result){
         case GTK_RESPONSE_NO:
index 587a701..c5464c7 100644 (file)
@@ -44,3 +44,4 @@ void rich_animation_additional_parametr(GtkWidget *vbox, Animation_WallpaperPriv
 void additional_parametr_for_theme_video(GtkWidget *vbox, Animation_WallpaperPrivate *priv);
 GSList * get_list_exthemes(void);
 void show_problem_package (GtkWidget *widget, gchar *package_name);
+void changed_value_one_in_all_cb (GtkWidget *toggle, Animation_WallpaperPrivate *priv);