added dbus
authortanya <tanyshk@gmail.com>
Thu, 2 Sep 2010 08:09:46 +0000 (11:09 +0300)
committertanya <tanyshk@gmail.com>
Thu, 2 Sep 2010 08:09:46 +0000 (11:09 +0300)
applet/src/Makefile.am
applet/src/fifteen.c

index fb68b70..aeecf27 100644 (file)
@@ -47,6 +47,7 @@ liblivewp_panel_widget_la_CFLAGS = -Wall $(MAEMO_CFLAGS) $(OSSO_CFLAGS)  $(CONTR
 FIFTEEN_SOURCE_FILES = fifteen.c livewp-common.h \
                                        livewp-actor.c livewp-actor.h \
                                        livewp-astro.c livewp-astro.h \
+                                       livewp-dbus.c livewp-dbus.h \
                                        livewp-rules.c livewp-rules.h 
 
 
index b9b1994..4e9047a 100644 (file)
@@ -2,6 +2,7 @@
 #include <time.h>
 #include "livewp-common.h"
 #include "livewp-actor.h"
+#include "livewp-dbus.h"
 
 enum {
     UP = 0,
@@ -40,37 +41,6 @@ void init_pg(gint *pg)
         pg[j] = t;
     }
 }
-#if 0
-gint move(gint direction, AWallpaperPlugin *desktop_plugin)
-{
-    gint bone;
-    Actor *actor;
-    switch (direction) {
-        case UP:
-            bone = empty + 4;
-            if (bone > 15) return -1;
-            break;
-        case RIGHT:
-            bone = empty - 1;
-            if (empty % 4 == 0) return -1;
-            break;
-        case DOWN:
-            bone = empty - 4;
-            if (bone < 0) return -1;
-            break;
-        case LEFT:
-            bone = empty + 1;
-            if (bone % 4 == 0) return -1;
-    }
-    //actor = actors[pg[bone]];
-    cur = bone;
-    //set_actor_position(actor, (empty%4)*width, (empty/4)*height, actor->z, desktop_plugin);
-    //pg[empty] = pg[bone];
-    //pg[bone] = 15;
-    //empty = bone;
-    return pg[bone]; 
-}
-#endif
 void reinit(AWallpaperPlugin *desktop_plugin)
 {
     fprintf(stderr, "reinit\n");
@@ -112,13 +82,14 @@ void moving_all(gint num, gint max, AWallpaperPlugin *desktop_plugin)
 {
     gint i, axis;
     double angle;
-    angle = 360*(max - num)/max;
+    angle = 180*(max - num)*(max-num)/(max*max);
     for (i=0; i<15; i++){
-        if (i%2 == 0) axis = HILDON_AA_Y_AXIS;
-        else axis = HILDON_AA_X_AXIS;
-        set_actor_rotation(actors[i], axis, angle, 0, 0, 0);
+        if (i%2 == 0) axis = HILDON_AA_X_AXIS;
+        else axis = HILDON_AA_Y_AXIS;
+        set_actor_rotation(actors[i], axis, angle, width/2, height/2, 0);
     }
-    if (num == (int)max/2){
+    //if (num == (int)max/2){
+    if (num == 0){
         reinit(desktop_plugin);
     }
 }
@@ -200,6 +171,27 @@ void init_actors(AWallpaperPlugin *desktop_plugin)
     }
     //return actors;
 }
+void
+quit_from_program (Animation_WallpaperPrivate *priv)
+{
+    gtk_main_quit();
+}
+
+void
+view_state_changed (Animation_WallpaperPrivate *priv)
+{
+    if (priv->visible){
+        priv->long_timer = g_timeout_add(100, main_timer, priv->desktop_plugin);
+    }else {
+        g_source_remove(priv->long_timer);
+    }
+    
+}
+gint
+read_config (Animation_WallpaperPrivate *priv){}
+void
+reload_scene(AWallpaperPlugin *desktop_plugin){}
+
 int main( int   argc, char *argv[] )
 {
     GtkWidget *window;
@@ -210,6 +202,8 @@ int main( int   argc, char *argv[] )
     gint i;
     gint pg[16];
 
+    
+
     hildon_gtk_init (&argc, &argv);
     g_set_application_name ("Simplest example");
     window = hildon_window_new ();
@@ -219,8 +213,13 @@ int main( int   argc, char *argv[] )
     priv->theme = g_strdup("Fifteen"); 
     priv->xapplet = 0;
     priv->yapplet = 0;
+    priv->desktop_plugin = desktop_plugin;
     desktop_plugin->priv = priv;
 
+    priv->osso = osso_initialize("org.maemo.livewp", VERSION, TRUE, NULL);
+    livewp_initialize_dbus(priv);
+    
+
     //init_pg(pg);
     scene->pg = pg;
     //scene->actors = init_actors(desktop_plugin);
@@ -228,7 +227,7 @@ int main( int   argc, char *argv[] )
     scene->timer_num = 0;
     reinit(desktop_plugin);
     gtk_widget_show  (window);
-    g_timeout_add(100, main_timer, desktop_plugin);
+    priv->long_timer = g_timeout_add(100, main_timer, desktop_plugin);
     gtk_main ();
     return 0;
 }