done changed theme
authortanya <tanyshk@gmail.com>
Mon, 19 Jul 2010 14:00:33 +0000 (17:00 +0300)
committertanya <tanyshk@gmail.com>
Mon, 19 Jul 2010 14:00:33 +0000 (17:00 +0300)
applet/src/livewp-dbus.c
applet/src/livewp-settings.c

index bc470b0..6b7b049 100644 (file)
@@ -141,7 +141,7 @@ get_livewp_signal_cb(DBusConnection *conn, DBusMessage *msg, Animation_Wallpaper
     START_FUNCTION;
 #endif
 
-    //fprintf (stderr, "PATH11111111111111111111 %s %s %s\n",   dbus_message_get_path(msg),   dbus_message_get_interface (msg), dbus_message_get_member (msg));
+    fprintf (stderr, "PATH11111111111111111111 %s %s %s\n",   dbus_message_get_path(msg),   dbus_message_get_interface (msg), dbus_message_get_member (msg));
     if (dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_RELOAD_CONFIG)){
         if(read_config(priv)){
                 fprintf(stderr, "\nCan not read config file.\n");
index b959d5f..5993da7 100644 (file)
@@ -73,7 +73,7 @@ theme_button_clicked(GtkButton *button, Animation_WallpaperPrivate *priv){
 /********************************************************************************/
 
 GtkWidget *
-create_image_button (gint view){
+create_image_button (gint view, DBusConnection *conn_sess){
     GtkWidget *button;
     GtkWidget *image;
     gchar * str;
@@ -82,6 +82,7 @@ create_image_button (gint view){
     fprintf(stderr,"create_image_button\n");
     Animation_WallpaperPrivate *priv = g_new0(Animation_WallpaperPrivate, 1);
     priv->view = view;
+    priv->dbus_conn_session = conn_sess;
     read_config(priv);
     button = hildon_button_new(HILDON_SIZE_AUTO_WIDTH | HILDON_SIZE_FINGER_HEIGHT,
                                     HILDON_BUTTON_ARRANGEMENT_VERTICAL);
@@ -180,16 +181,16 @@ lw_main_settings(Animation_WallpaperPrivate *priv, gpointer data){
     gtk_window_set_modal(GTK_WINDOW(window), TRUE);
     /* Create Theme button */
     hbox = gtk_hbox_new(FALSE, 5);
-    theme_button1 = create_image_button(0);
+    theme_button1 = create_image_button(0, priv->dbus_conn_session);
     gtk_box_pack_start(GTK_BOX(hbox),
                                    theme_button1, TRUE, TRUE, 5);
-    theme_button2 = create_image_button(1);
+    theme_button2 = create_image_button(1, priv->dbus_conn_session);
     gtk_box_pack_start(GTK_BOX(hbox),
                                    theme_button2, TRUE, TRUE, 5);
-    theme_button3 = create_image_button(2);
+    theme_button3 = create_image_button(2, priv->dbus_conn_session);
     gtk_box_pack_start(GTK_BOX(hbox),
                                    theme_button3, TRUE, TRUE, 5);
-    theme_button4 = create_image_button(3);
+    theme_button4 = create_image_button(3, priv->dbus_conn_session);
     gtk_box_pack_start(GTK_BOX(hbox),
                                    theme_button4, TRUE, TRUE, 5);
     gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox),
@@ -276,13 +277,14 @@ lw_theme_settings(Animation_WallpaperPrivate *priv, gpointer  data){
             save_config(priv);
             /* action with applet */
             if (hildon_check_button_get_active (HILDON_CHECK_BUTTON(enable_button))){
-                    if (!check_applet_state(view))
+                    if (!check_applet_state(view)){
                         start_applet(view);
-                    else
+                    }else {
                         send_dbus_signal (priv,
                               LIVEWP_SIGNAL_INTERFACE,
                               LIVEWP_SIGNAL_PATH,
                               LIVEWP_RELOAD_CONFIG);
+                    }
             }else
                     if (check_applet_state(view))
                         stop_applet(view);
@@ -369,6 +371,27 @@ start_applet(gint number){
 /*******************************************************************************/
 void
 stop_applet(gint number){
+    HDConfigFile *config_file = NULL;
+    GKeyFile *gkey_file = NULL;
+    gchar *str = NULL;
+
+    if (number > 3 || number < 0)
+        return;
+    str = g_strdup_printf("livewp-home-widget.desktop-%i",number);
+    config_file = hd_config_file_new(NULL, "/home/user/.config/hildon-desktop/", "home.plugins");
+    
+    gkey_file = hd_config_file_load_file(config_file, FALSE);
+    if (gkey_file){
+         g_key_file_remove_group(gkey_file, str, NULL);  
+        hd_config_file_save_file( config_file, gkey_file);
+        g_key_file_free(gkey_file);
+    }else
+        fprintf(stderr, "Problem with config file");
+    if (str)
+        g_free(str);
+    g_object_unref(config_file);
+
+#if 0    
     FILE    *file_in;
     FILE    *file_out;
     gchar buffer[2048];
@@ -403,4 +426,5 @@ stop_applet(gint number){
             unlink ("/tmp/livewallpaper.plugins");
         }
     }
+#endif
 }