added fork
authorvlad <vlad@vlanout.(none)>
Sat, 24 Jul 2010 18:59:12 +0000 (21:59 +0300)
committervlad <vlad@vlanout.(none)>
Sat, 24 Jul 2010 18:59:12 +0000 (21:59 +0300)
applet/src/livewp-dbus.c
applet/src/livewp-home-widget.c

index 5b0c519..233f12a 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 b4d010b..9557f7e 100644 (file)
@@ -45,19 +45,43 @@ lw_applet_realize (GtkWidget *widget)
     gchar * strid; 
     gint id; 
     AWallpaperPlugin *desktop_plugin = widget;
+    pid_t  pid;
+    char* child_argv[] =  {"/usr/bin/livewp", "0", (char *) 0 };
+
 
     strid = g_strdup(hd_plugin_item_get_plugin_id (HD_PLUGIN_ITEM (widget)));
     id = strid[strlen(strid)-1] - '0';
     desktop_plugin->priv->view = id;
     g_free(strid); 
     
+    fprintf(stderr,"ID !!!!!!!!!! %i\n",id);
+
+    switch (id){
+           case 0: child_argv[1] = "0";
+               break;
+           case 1: child_argv[1] = "1";
+               break;
+           case 2: child_argv[1] = "2";
+               break;
+           case 3: child_argv[1] = "3";
+               break;
+    }
+    fprintf(stderr,"New proceess !!!!!!!!!! %s\n",child_argv[0]);
+    fprintf(stderr,"New proceess !!!!!!!!!! %s\n",child_argv[1]);
+    pid = fork();
+    if (pid == 0){
+       fprintf(stderr,"New proceess !!!!!!!!!! %s\n",child_argv[1]);
+       execvp("/usr/bin/livewp", child_argv);
+       fprintf(stderr,"Problem with new process");
+    }
+#if 0
     /* 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);
-
+#endif
     screen = gtk_widget_get_screen (widget);
     gtk_widget_set_colormap (widget,
                                 gdk_screen_get_rgba_colormap (screen));
@@ -505,9 +529,9 @@ static void
 lw_applet_finalize (GObject *object)
 {
 fprintf(stderr,"lw_applet_finalize\n");
-/*
      AWallpaperPlugin *desktop_plugin = Animation_Wallpaper_HOME_PLUGIN (object);
      Animation_WallpaperPrivate *priv = desktop_plugin->priv;
+/*
      
      if (priv){
             livewp_deinitialize_dbus(priv);
@@ -523,7 +547,26 @@ fprintf(stderr,"lw_applet_finalize\n");
 
             destroy_scene(desktop_plugin);
      }
-*/
+*/    
+     
+     if (priv){
+            livewp_deinitialize_dbus(priv);
+            switch (priv->view){
+               case 0: send_dbus_signal (priv, LIVEWP_SIGNAL_INTERFACE, 
+                                         LIVEWP_SIGNAL_PATH, LIVEWP_STOP_LIVEBG_ON_VIEW0);
+                       break;
+               case 1: send_dbus_signal (priv, LIVEWP_SIGNAL_INTERFACE, 
+                                         LIVEWP_SIGNAL_PATH, LIVEWP_STOP_LIVEBG_ON_VIEW1);
+                       break;
+               case 2: send_dbus_signal (priv, LIVEWP_SIGNAL_INTERFACE, 
+                                         LIVEWP_SIGNAL_PATH, LIVEWP_STOP_LIVEBG_ON_VIEW2);
+                       break;
+               case 3: send_dbus_signal (priv, LIVEWP_SIGNAL_INTERFACE, 
+                                         LIVEWP_SIGNAL_PATH, LIVEWP_STOP_LIVEBG_ON_VIEW3);
+                       break;
+            }
+     }
+
 }
 
 static void
@@ -532,21 +575,7 @@ desktop_widget_finalize (GObject *object)
      AWallpaperPlugin *desktop_plugin = Animation_Wallpaper_HOME_PLUGIN (object);
      Animation_WallpaperPrivate *priv = desktop_plugin->priv;
      
-     if (priv){
-            livewp_deinitialize_dbus(priv);
-            fprintf(stderr,"finalaze %i\n", priv->long_timer);
-            if (priv->long_timer){
-               g_source_remove(priv->long_timer);
-               priv->long_timer = 0;
-            }
-            if (priv->short_timer){
-               g_source_remove(priv->short_timer);
-               priv->short_timer = 0;
-            }
-
-            destroy_scene(desktop_plugin);
-     }
-      /* Call the base class's implementation: */
+       /* Call the base class's implementation: */
       G_OBJECT_CLASS (animation_wallpaper_plugin_parent_class)->finalize (object);
 }