fixed changed image on settings buttons
authortanya <tanyshk@gmail.com>
Mon, 19 Jul 2010 14:20:04 +0000 (17:20 +0300)
committertanya <tanyshk@gmail.com>
Mon, 19 Jul 2010 14:20:04 +0000 (17:20 +0300)
applet/src/livewp-settings.c

index 5993da7..cf20a6f 100644 (file)
@@ -68,9 +68,29 @@ create_theme_selector (void){
 void
 theme_button_clicked(GtkButton *button, Animation_WallpaperPrivate *priv){
 
-    lw_theme_settings(priv, NULL);
+    lw_theme_settings(priv, button);
 }
 /********************************************************************************/
+void
+set_button_image(GtkWidget * button, gchar *theme){
+    GtkWidget * image = NULL; 
+    GdkPixbuf * pixbuf = NULL; 
+    gchar * str = g_strdup_printf( "%s/%s/%s", THEME_PATH, 
+                        theme, "icon.png");
+    fprintf(stderr, "set image %s\n", str);
+    pixbuf = gdk_pixbuf_new_from_file_at_size (str, 
+                                             100, 
+                                             60, 
+                                             NULL);
+    if (str)
+        g_free(str);
+    if (pixbuf){
+        image = gtk_image_new_from_pixbuf (pixbuf);
+        g_object_unref(G_OBJECT(pixbuf));
+    }
+
+    hildon_button_set_image (HILDON_BUTTON (button), image);
+}
 
 GtkWidget *
 create_image_button (gint view, DBusConnection *conn_sess){
@@ -87,20 +107,7 @@ create_image_button (gint view, DBusConnection *conn_sess){
     button = hildon_button_new(HILDON_SIZE_AUTO_WIDTH | HILDON_SIZE_FINGER_HEIGHT,
                                     HILDON_BUTTON_ARRANGEMENT_VERTICAL);
     g_object_set_data(G_OBJECT(button), "view", GINT_TO_POINTER(view));
-    str = g_strdup_printf( "%s/%s/%s", THEME_PATH, 
-                        priv->theme, "icon.png");
-    pixbuf = gdk_pixbuf_new_from_file_at_size (str, 
-                                             100, 
-                                             60, 
-                                             NULL);
-    if (str)
-        g_free(str);
-    if (pixbuf){
-        image = gtk_image_new_from_pixbuf (pixbuf);
-        g_object_unref(G_OBJECT(pixbuf));
-    }
-
-    hildon_button_set_image (HILDON_BUTTON (button), image);
+    set_button_image(button, priv->theme);
     g_signal_connect(button, "clicked", G_CALLBACK(theme_button_clicked), priv);
     //hildon_button_set_image_position (HILDON_BUTTON (button), GTK_POS_RIGHT);
     return button;
@@ -219,7 +226,7 @@ lw_main_settings(Animation_WallpaperPrivate *priv, gpointer data){
 
 /*******************************************************************************/
 void 
-lw_theme_settings(Animation_WallpaperPrivate *priv, gpointer  data){
+lw_theme_settings(Animation_WallpaperPrivate *priv, GtkWidget *button){
     gint result;
     GtkWidget *window = NULL;
     GtkWidget *save_button;
@@ -275,6 +282,7 @@ lw_theme_settings(Animation_WallpaperPrivate *priv, gpointer  data){
                 priv->rich_animation = FALSE;
             /* Save config */
             save_config(priv);
+            set_button_image(button, priv->theme);
             /* action with applet */
             if (hildon_check_button_get_active (HILDON_CHECK_BUTTON(enable_button))){
                     if (!check_applet_state(view)){