finished fifteen
authortanya <tanyshk@gmail.com>
Thu, 2 Sep 2010 13:52:37 +0000 (16:52 +0300)
committertanya <tanyshk@gmail.com>
Thu, 2 Sep 2010 13:52:37 +0000 (16:52 +0300)
applet/src/fifteen.c

index 4e9047a..32fc434 100644 (file)
@@ -1,5 +1,6 @@
 #include <hildon/hildon.h>
 #include <time.h>
+#include <unistd.h>
 #include "livewp-common.h"
 #include "livewp-actor.h"
 #include "livewp-dbus.h"
@@ -57,6 +58,7 @@ void reinit(AWallpaperPlugin *desktop_plugin)
         set_actor_position(actor, actor->x, actor->y, actor->z, desktop_plugin);
         //set_actor_position(actor, (i%4)*width, (i/4)*height, 2, desktop_plugin);
     }
+    fprintf(stderr,"end reinit\n");
 }
 
 void moving_actor(gint num, gint max, AWallpaperPlugin *desktop_plugin)
@@ -82,7 +84,7 @@ void moving_all(gint num, gint max, AWallpaperPlugin *desktop_plugin)
 {
     gint i, axis;
     double angle;
-    angle = 180*(max - num)*(max-num)/(max*max);
+    angle = 360*(max - num)*(max-num)/(max*max);
     for (i=0; i<15; i++){
         if (i%2 == 0) axis = HILDON_AA_X_AXIS;
         else axis = HILDON_AA_Y_AXIS;
@@ -103,8 +105,8 @@ gboolean main_timer(AWallpaperPlugin *desktop_plugin)
             moving_all(scene->timer_num, 20, desktop_plugin);
         return;
     } 
-    //char * accel_filename = "/sys/class/i2c-adapter/i2c-3/3-001d/coord";
-    char * accel_filename = "/home/tanya/coord";
+    char * accel_filename = "/sys/class/i2c-adapter/i2c-3/3-001d/coord";
+    //char * accel_filename = "/home/tanya/coord";
 
     gint direction = -1, bone;
     FILE *fd = NULL;
@@ -181,7 +183,7 @@ void
 view_state_changed (Animation_WallpaperPrivate *priv)
 {
     if (priv->visible){
-        priv->long_timer = g_timeout_add(100, main_timer, priv->desktop_plugin);
+        priv->long_timer = g_timeout_add(50, main_timer, priv->desktop_plugin);
     }else {
         g_source_remove(priv->long_timer);
     }
@@ -199,14 +201,26 @@ int main( int   argc, char *argv[] )
     Animation_WallpaperPrivate *priv = g_new0 (Animation_WallpaperPrivate, 1);
     scene = g_new0(Scene1, 1);
     Actor *actor;
-    gint i;
+    gint i, c, window_id=0, view=0;
     gint pg[16];
 
-    
+    while ((c = getopt(argc, argv, ":v:w:")) != -1){
+        switch (c){
+            case 'v':
+                view = atoi(optarg);
+                break;
+            case 'w':
+                window_id = atoi(optarg);
+        }
+    }
+
+    fprintf(stderr, "view=%d window_id=%d\n", view, window_id);
 
     hildon_gtk_init (&argc, &argv);
     g_set_application_name ("Simplest example");
     window = hildon_window_new ();
+    fprintf(stderr,"lllllllllllllllll\n");
+    //window->window = window_id;
     g_signal_connect (G_OBJECT (window), "delete_event",
                         G_CALLBACK (gtk_main_quit), NULL);
     priv->window = window;
@@ -214,6 +228,7 @@ int main( int   argc, char *argv[] )
     priv->xapplet = 0;
     priv->yapplet = 0;
     priv->desktop_plugin = desktop_plugin;
+    priv->view = view;
     desktop_plugin->priv = priv;
 
     priv->osso = osso_initialize("org.maemo.livewp", VERSION, TRUE, NULL);
@@ -227,7 +242,7 @@ int main( int   argc, char *argv[] )
     scene->timer_num = 0;
     reinit(desktop_plugin);
     gtk_widget_show  (window);
-    priv->long_timer = g_timeout_add(100, main_timer, desktop_plugin);
+    priv->long_timer = g_timeout_add(50, main_timer, desktop_plugin);
     gtk_main ();
     return 0;
 }