step for category is done
authorvlad <vlad@vlanout.(none)>
Thu, 12 Aug 2010 16:18:28 +0000 (19:18 +0300)
committervlad <vlad@vlanout.(none)>
Thu, 12 Aug 2010 16:18:28 +0000 (19:18 +0300)
applet/src/livewp-settings.c
applet/src/livewp-settings.h

index dcbfe37..bb14a81 100644 (file)
@@ -77,26 +77,14 @@ create_category_selector (Animation_WallpaperPrivate *priv){
         category_list = g_list_next(category_list);
     }
 
+    hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), "LiveWallpaper" );
     return selector;
 }
 
 /*******************************************************************************/
 GtkWidget *
 create_theme_selector (Animation_WallpaperPrivate *priv){
-    GtkWidget *selector;
-    GSList *store = priv->extheme_list;
-    selector = hildon_touch_selector_new_text ();
-
-    hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), _("Berlin"));
-    hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), _("Modern"));
-    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"));
-    while (store){  
-        hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), g_hash_table_lookup(store->data, "name"));
-        store = g_slist_next(store);
-    }
-    return selector;
+    return NULL;
 }
 /*******************************************************************************/
 void
@@ -214,27 +202,38 @@ void
 changed_value_category_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);
+    GtkWidget *theme_button = NULL;
+
+    theme_button = g_object_get_data(G_OBJECT(priv->window), "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_append_text_column(selector, gtk_list_store_new (1, G_TYPE_STRING), TRUE);
+    fill_theme_button(priv, theme_button);
 }
 /********************************************************************************/
-GtkWidget *
-create_themes_button (Animation_WallpaperPrivate *priv){
+void
+fill_theme_button (Animation_WallpaperPrivate *priv, GtkWidget *button){
 
-    GtkWidget *button;
-    GtkWidget *selector;
     gchar *theme = priv->theme;
     gint num=0;
+    GSList *store = priv->extheme_list;
+    HildonTouchSelector * selector =  hildon_picker_button_get_selector((HildonPickerButton *) button);
+    if (!selector)
+        selector = hildon_touch_selector_new_text ();
+
+    hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), _("Berlin"));
+    hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), _("Modern"));
+    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"));
+    fprintf(stderr, "append texx in selector\n");
+    while (store){  
+        hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), g_hash_table_lookup(store->data, "name"));
+        store = g_slist_next(store);
+    }
 
-    selector = create_theme_selector(priv);
-    button = hildon_picker_button_new (HILDON_SIZE_AUTO, HILDON_BUTTON_ARRANGEMENT_VERTICAL);
-    hildon_button_set_title (HILDON_BUTTON (button), _("Theme"));
-    hildon_picker_button_set_selector (HILDON_PICKER_BUTTON (button),
-                                                       HILDON_TOUCH_SELECTOR (selector));
     if (theme) {
         if (!strcmp(theme, "Berlin")){
             hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (selector), 0, 0);
@@ -268,7 +267,20 @@ create_themes_button (Animation_WallpaperPrivate *priv){
             store = g_slist_next(store);
         }
     }
-    
+    hildon_picker_button_set_selector (HILDON_PICKER_BUTTON (button),
+                                                       HILDON_TOUCH_SELECTOR (selector));
+
+}
+/********************************************************************************/
+GtkWidget *
+create_themes_button (Animation_WallpaperPrivate *priv){
+
+    GtkWidget *button;
+    button = hildon_picker_button_new (HILDON_SIZE_AUTO, HILDON_BUTTON_ARRANGEMENT_VERTICAL);
+    hildon_button_set_title (HILDON_BUTTON (button), _("Theme"));
+        fill_theme_button(priv, button);
+
+   
     return button;
 }
 /********************************************************************************/
@@ -516,6 +528,7 @@ lw_theme_settings(GtkWidget *button, Animation_WallpaperPrivate *priv) {
 
     /* Create Theme button */
     theme_button = create_themes_button(priv);
+    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);
index 115c7e2..239ac80 100644 (file)
@@ -26,6 +26,7 @@
 
 #include <hildon-fm-2/hildon/hildon-file-chooser-dialog.h>
 #include <unistd.h>
+void fill_theme_button (Animation_WallpaperPrivate *priv, GtkWidget *button);
 void lw_main_settings(Animation_WallpaperPrivate *priv, gpointer data);
 void save_config(Animation_WallpaperPrivate *priv);
 gboolean check_applet_state(gint number);