one theme in all views almost done
[livewp] / applet / src / livewp-home-widget.c
index e7de045..4181cbb 100644 (file)
@@ -67,11 +67,16 @@ lw_applet_realize (GtkWidget *widget)
            case 3: child_argv[1] = "4";
                break;
     }
-
-    desktop_plugin->priv->pid = fork();
-    if (desktop_plugin->priv->pid == 0){
-       execvp("/usr/bin/livewp", child_argv);
-       fprintf(stderr,"Problem with new process");
+    desktop_plugin->priv->one_in_all_view = get_one_in_all_views_from_config();
+    /* Check one theme in all view mode */
+    if (!desktop_plugin->priv->one_in_all_view || 
+        (desktop_plugin->priv->one_in_all_view && id == 0)){
+           /* Start a new process */
+           desktop_plugin->priv->pid = fork();
+           if (desktop_plugin->priv->pid == 0){
+               execvp("/usr/bin/livewp", child_argv);
+               fprintf(stderr,"Problem with new process");
+           }
     }
 
     desktop_plugin_visible_notify((GObject *)widget, NULL, desktop_plugin);
@@ -147,16 +152,18 @@ desktop_plugin_visible_notify (GObject    *object,
     g_object_get (object, "is-on-current-desktop", &visible, NULL);
     /* fprintf (stderr, "is-on-current-desktop changed. visible: %u", visible); */
     if (priv){
-       /*    
-        if (visible){
-                       send_dbus_signal (priv, LIVEWP_SIGNAL_INTERFACE, 
-                                 LIVEWP_SIGNAL_PATH, LIVEWP_PLAY_LIVEBG_ON_VIEW);
-        }else{ 
+             if (priv->one_in_all_view){
+                    if (visible)
                        send_dbus_signal (priv, LIVEWP_SIGNAL_INTERFACE, 
-                                 LIVEWP_SIGNAL_PATH, LIVEWP_PAUSE_LIVEBG_ON_VIEW);
-        }
-        */    
-        
+                                         LIVEWP_SIGNAL_PATH, LIVEWP_PLAY_LIVEBG_ON_VIEW1);
+                    else{
+                       /* start any application on current view */
+                       if ((priv->view + 1) == current_active_view())
+                               send_dbus_signal (priv, LIVEWP_SIGNAL_INTERFACE, 
+                                         LIVEWP_SIGNAL_PATH, LIVEWP_PAUSE_LIVEBG_ON_VIEW1);
+                    }
+                    return;
+             }
             switch (priv->view + 1){
                case 1: if (visible)
                                send_dbus_signal (priv, LIVEWP_SIGNAL_INTERFACE, 
@@ -187,6 +194,7 @@ desktop_plugin_visible_notify (GObject    *object,
                                          LIVEWP_SIGNAL_PATH, LIVEWP_PAUSE_LIVEBG_ON_VIEW4);
                        break;
             }
+
      }
     
 }