fork is done
[livewp] / applet / src / livewp-main.c
index 8b57753..56a4f2d 100644 (file)
@@ -68,10 +68,8 @@ static void set_live_bg (Display *display, Window xwindow, int mode)
 void
 quit_from_program (Animation_WallpaperPrivate *priv)
 {
-     
      if (priv){
             livewp_deinitialize_dbus(priv);
-            fprintf(stderr,"Quit from LiveWallpaper \n");
             if (priv->long_timer){
                    g_source_remove(priv->long_timer);
                priv->long_timer = 0;
@@ -82,7 +80,7 @@ quit_from_program (Animation_WallpaperPrivate *priv)
             }
             destroy_scene(priv->desktop_plugin);
      }
-     gtk_main_quit();
+     gtk_main_quit();;
 }
 
 int
@@ -93,14 +91,13 @@ main(int argc, char *argv[])
     GtkWidget *btn_setting, *vbox, *btn_power;
     gint result;
     HildonProgram       *app;
-    int view = 0;
+    int view = 1;
 
      
     if (argc == 2) 
         view = atoi(argv[1]);
-    fprintf(stderr,"VIEW %i\n", view);
-    if (view < 0 || view > 3)
-        view = 0;
+    if (view < 1 || view > 4)
+        view = 1;
 
     AWallpaperPlugin *desktop_plugin = g_new0 (AWallpaperPlugin, 1);
     Animation_WallpaperPrivate *priv = g_new0 (Animation_WallpaperPrivate, 1);
@@ -139,16 +136,20 @@ main(int argc, char *argv[])
     priv->window = main_widget;
 
     priv->view = view;
-    priv->visible = TRUE;
     /* Load config */
     read_config(priv);
     /* Initialize DBUS */
     livewp_initialize_dbus(priv);
-    set_live_bg(GDK_WINDOW_XDISPLAY (main_widget->window), GDK_WINDOW_XID (main_widget->window), view + 1);
+    set_live_bg(GDK_WINDOW_XDISPLAY (main_widget->window), GDK_WINDOW_XID (main_widget->window), view);
+    if (current_active_view() == view) 
+        priv->visible = TRUE;
+    else 
+        priv->visible = FALSE;
+
+    fprintf(stderr,"VISIBLE %i %i\n",priv->visible, current_active_view());
     init_scene_theme(desktop_plugin);
         
     priv->long_timer = g_timeout_add(LONG_TIMER, (GtkFunction)long_timeout, desktop_plugin);
 
     gtk_main();
-    return 0;
 }