added theme buttons
authortanya <tanyshk@gmail.com>
Fri, 16 Jul 2010 13:30:49 +0000 (16:30 +0300)
committertanya <tanyshk@gmail.com>
Fri, 16 Jul 2010 13:30:49 +0000 (16:30 +0300)
applet/data/theme/Matrix/icon.png [new file with mode: 0644]
applet/src/livewp-config.c
applet/src/livewp-control-widget.c
applet/src/livewp-home-widget.c
applet/src/livewp-settings.c
applet/src/livewp-settings.h

diff --git a/applet/data/theme/Matrix/icon.png b/applet/data/theme/Matrix/icon.png
new file mode 100644 (file)
index 0000000..02dc478
Binary files /dev/null and b/applet/data/theme/Matrix/icon.png differ
index a6e1a84..b9ab3d8 100644 (file)
@@ -30,6 +30,8 @@ read_config(Animation_WallpaperPrivate *priv) {
     GConfClient *gconf_client = NULL;
     gchar *tmp = NULL;
     GConfValue *value = NULL;
+    gint id = priv->view;
+    gchar * str = NULL;
     
     gconf_client = gconf_client_get_default();
     if (!gconf_client) {
@@ -37,14 +39,24 @@ read_config(Animation_WallpaperPrivate *priv) {
         return -1;
     }
     /* get Theme default Modern */
+    str = g_strdup_printf("%s%i", GCONF_KEY_THEME, id);
     tmp = gconf_client_get_string(gconf_client,
-                                  GCONF_KEY_THEME, NULL);
+                                  str, NULL);
+    if (str){ 
+        g_free(str);
+        str = NULL;
+    }    
     if (tmp){
         priv->theme = tmp;
     }else
         priv->theme = g_strdup("Modern");
     /* get Rich animation default TRUE */
-    value = gconf_client_get(gconf_client, GCONF_KEY_RANIMATION, NULL);
+    str = g_strdup_printf("%s%i", GCONF_KEY_RANIMATION, id);
+    value = gconf_client_get(gconf_client, str, NULL);
+    if (str){ 
+        g_free(str);
+        str = NULL;
+    } 
     if (value) {
         priv->rich_animation = gconf_value_get_bool(value);
         gconf_value_free(value);
index dfe3be8..e67fca4 100644 (file)
@@ -36,7 +36,7 @@ execute(osso_context_t *osso, gpointer data, gboolean user_activated){
     livewp_initialize_dbus(priv);
 
 
-    lw_settings(priv, data);
+    lw_main_settings(priv, data);
     return OSSO_OK;
 
 }
index c3258aa..08412f3 100644 (file)
@@ -51,6 +51,10 @@ lw_applet_realize (GtkWidget *widget)
     id = strid[strlen(strid)-1] - '0';
     desktop_plugin->priv->view = id + 1;
     g_free(strid); 
+    
+    /* 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);
@@ -447,9 +451,7 @@ animation_wallpaper_plugin_init (AWallpaperPlugin *desktop_plugin)
     desktop_plugin->priv =  Animation_Wallpaper_HOME_PLUGIN_GET_PRIVATE (desktop_plugin);
     priv->osso = osso_initialize(PACKAGE, VERSION, TRUE, NULL);
 
-    /* Load config */
-    read_config(priv);
-    /* Initialize DBUS */
+        /* Initialize DBUS */
     livewp_initialize_dbus(priv);
 
     priv->desktop_plugin = desktop_plugin;
index 12a7abf..3f0c7b2 100644 (file)
@@ -67,6 +67,34 @@ create_theme_selector (void)
 }
 /*******************************************************************************/
 GtkWidget *
+create_image_button (gchar *theme)
+{
+    GtkWidget *button;
+    GtkWidget *image;
+    gchar * str;
+    GdkPixbuf * pixbuf;
+    
+    button = hildon_button_new(HILDON_SIZE_AUTO_WIDTH | HILDON_SIZE_FINGER_HEIGHT,
+                                    HILDON_BUTTON_ARRANGEMENT_VERTICAL);
+    str = g_strdup_printf( "%s/%s/%s", THEME_PATH, 
+                        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);
+    //hildon_button_set_image_position (HILDON_BUTTON (button), GTK_POS_RIGHT);
+    return button;
+
+}
+/********************************************************************************/
+GtkWidget *
 create_themes_button (gchar *theme){
 
     GtkWidget *button;
@@ -123,7 +151,61 @@ show_settings(GtkWidget *widget, Animation_WallpaperPrivate *priv){
 }
 /*******************************************************************************/
 void 
-lw_settings(Animation_WallpaperPrivate *priv, gpointer data){
+lw_main_settings(Animation_WallpaperPrivate *priv, gpointer data){
+    gint result;
+    GtkWidget *window = NULL;
+    GtkWidget *theme_button1;
+    GtkWidget *theme_button2;
+    GtkWidget *theme_button3;
+    GtkWidget *theme_button4;
+    GtkWidget *hbox;
+
+    window = gtk_dialog_new();
+
+    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 */
+    hbox = gtk_hbox_new(FALSE, 5);
+    theme_button1 = create_image_button("Matrix");
+    gtk_box_pack_start(GTK_BOX(hbox),
+                                   theme_button1, TRUE, TRUE, 5);
+    theme_button2 = create_image_button("Matrix");
+    gtk_box_pack_start(GTK_BOX(hbox),
+                                   theme_button2, TRUE, TRUE, 5);
+    theme_button3 = create_image_button("Matrix");
+    gtk_box_pack_start(GTK_BOX(hbox),
+                                   theme_button3, TRUE, TRUE, 5);
+    theme_button4 = create_image_button("Matrix");
+    gtk_box_pack_start(GTK_BOX(hbox),
+                                   theme_button4, TRUE, TRUE, 5);
+    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox),
+                                   hbox, TRUE, TRUE, 5);
+
+    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 (window);
+    gtk_dialog_add_button(GTK_DIALOG(window), _("About"), GTK_RESPONSE_NO);
+
+    result = gtk_dialog_run(GTK_DIALOG(window));
+
+    switch(result){
+        case GTK_RESPONSE_NO:
+            gtk_widget_destroy(window);
+            window = NULL;
+            lw_about();
+        break;
+    }
+    if (window)
+        gtk_widget_destroy(window);
+}
+
+/*******************************************************************************/
+void 
+lw_theme_settings(Animation_WallpaperPrivate *priv, gpointer data){
     gint result;
     GtkWidget *window = NULL;
     GtkWidget *save_button;
index 4e1d628..5033096 100644 (file)
@@ -24,7 +24,7 @@
 /*******************************************************************************/
 #include "livewp-common.h"
 #include <unistd.h>
-void lw_settings(Animation_WallpaperPrivate *priv, gpointer data);
+void lw_main_settings(Animation_WallpaperPrivate *priv, gpointer data);
 void save_config(Animation_WallpaperPrivate *priv);
 gboolean check_applet_state(void);
 void reload_scene(AWallpaperPlugin *desktop_plugin);