removed source files to directory src
authorVlad Vasiliev <vlad@toshiba2.oblgaz>
Sat, 27 Mar 2010 15:34:01 +0000 (17:34 +0200)
committerVlad Vasiliev <vlad@toshiba2.oblgaz>
Sat, 27 Mar 2010 15:34:01 +0000 (17:34 +0200)
17 files changed:
applet/Makefile.am
applet/configure.ac
applet/data/Makefile
applet/livewp-astro.c [deleted file]
applet/livewp-astro.h [deleted file]
applet/livewp-home-widget.c [deleted file]
applet/livewp-home-widget.h [deleted file]
applet/livewp-rules.c [deleted file]
applet/livewp-rules.h [deleted file]
applet/src/Makefile [new file with mode: 0644]
applet/src/Makefile.am [new file with mode: 0644]
applet/src/livewp-astro.c [new file with mode: 0644]
applet/src/livewp-astro.h [new file with mode: 0644]
applet/src/livewp-home-widget.c [new file with mode: 0644]
applet/src/livewp-home-widget.h [new file with mode: 0644]
applet/src/livewp-rules.c [new file with mode: 0644]
applet/src/livewp-rules.h [new file with mode: 0644]

index caf52fb..82a312d 100644 (file)
@@ -1,13 +1,4 @@
-SUBDIRS = data
-# We invent desktoplib_LTLIBRARIES instead of the normal lib_LTLIBRARIES,
-# so we can specify the non-standard installation directory.
-desktoplib_LTLIBRARIES =  liblivewp-home-widget.la
-desktoplibdir = $(HILDON_DESKTOP_LIB_DIR)
-
-liblivewp_home_widget_la_SOURCES = livewp-home-widget.c livewp-home-widget.h livewp-astro.c livewp-astro.h livewp-rules.c livewp-rules.h
-liblivewp_home_widget_la_LIBADD = $(EXAMPLE_LIBS) 
-
-AM_CFLAGS = -Wall $(EXAMPLE_CFLAGS) 
+SUBDIRS = data src
 
 # .desktop file
 desktopdir = $(HILDON_HOME_DESKTOP_DIR)
index a2ebbbc..2bc9a92 100644 (file)
@@ -1,6 +1,6 @@
 AC_PREREQ(2.61)
 AC_INIT([livewp], [0.1])
-AC_CONFIG_SRCDIR([livewp-home-widget.c])
+AC_CONFIG_SRCDIR([src/livewp-home-widget.c])
 AM_INIT_AUTOMAKE
 AC_CONFIG_HEADER([config.h])
 
@@ -24,7 +24,8 @@ AC_SUBST(HILDON_DESKTOP_LIB_DIR)
 dnl Config files
 AC_CONFIG_FILES([Makefile
                livewp-home-widget.desktop
-               data/Makefile])
+               data/Makefile
+               src/Makefile])
 dnl Produce output files
 AC_OUTPUT
 
index a7b3474..c2e6b3b 100644 (file)
@@ -71,14 +71,14 @@ am__installdirs = "$(DESTDIR)$(awallpaperdir)"
 awallpaperDATA_INSTALL = $(INSTALL_DATA)
 DATA = $(awallpaper_DATA)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = ${SHELL} /home/tanya/work/livewp/applet/missing --run aclocal-1.8
+ACLOCAL = ${SHELL} /home/vlad/livewp/applet/missing --run aclocal-1.8
 AMDEP_FALSE = #
 AMDEP_TRUE = 
-AMTAR = ${SHELL} /home/tanya/work/livewp/applet/missing --run tar
+AMTAR = ${SHELL} /home/vlad/livewp/applet/missing --run tar
 AR = i486-linux-gnu-ar
-AUTOCONF = ${SHELL} /home/tanya/work/livewp/applet/missing --run autoconf
-AUTOHEADER = ${SHELL} /home/tanya/work/livewp/applet/missing --run autoheader
-AUTOMAKE = ${SHELL} /home/tanya/work/livewp/applet/missing --run automake-1.8
+AUTOCONF = ${SHELL} /home/vlad/livewp/applet/missing --run autoconf
+AUTOHEADER = ${SHELL} /home/vlad/livewp/applet/missing --run autoheader
+AUTOMAKE = ${SHELL} /home/vlad/livewp/applet/missing --run automake-1.8
 AWK = gawk
 CC = i486-linux-gnu-gcc
 CCDEPMODE = depmode=gcc3
@@ -116,7 +116,7 @@ LIBS =
 LIBTOOL = $(SHELL) $(top_builddir)/libtool
 LN_S = ln -s
 LTLIBOBJS = 
-MAKEINFO = ${SHELL} /home/tanya/work/livewp/applet/missing --run makeinfo
+MAKEINFO = ${SHELL} /home/vlad/livewp/applet/missing --run makeinfo
 NMEDIT = 
 OBJEXT = o
 PACKAGE = livewp
@@ -162,7 +162,7 @@ host_vendor = pc
 htmldir = ${docdir}
 includedir = ${prefix}/include
 infodir = ${prefix}/share/info
-install_sh = /home/tanya/work/livewp/applet/install-sh
+install_sh = /home/vlad/livewp/applet/install-sh
 libdir = ${exec_prefix}/lib
 libexecdir = ${exec_prefix}/libexec
 localedir = ${datarootdir}/locale
diff --git a/applet/livewp-astro.c b/applet/livewp-astro.c
deleted file mode 100644 (file)
index ec2a8eb..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * This file is part of Live Wallpaper (livewp)
- * 
- * Copyright (C) 2010 Vlad Vasiliev
- * Copyright (C) 2010 Tanya Makova
- *       for the code
- * 
- * This software is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- * 
- * This software is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
-*/
-/*******************************************************************************/
-#include <stdio.h>
-#include "livewp-astro.h"
-    
-double ut(int hour, int min, int zone)
-{
-    return (hour - zone + (double)min/60);
-}
-
-double jd(int year, int month, int day, double uu)
-{
-    return (367*year)-floor((floor((month+9)/12)+year)*7/4)+floor(275*month/9)+day-730531.5+(uu/24);
-}
-
-double altitude(double lon, double lat, int year, int month, int day, int hour, int min, int zone)
-{
-    double uu, jj, T, k, M, Lo, DL, L, eps, delta, RA, GMST, LMST, H, eqt, alt;
-    uu = ut(hour, min, zone);
-    jj = jd(year, month, day, uu);
-    T = jj / 36525;
-    k = M_PI / 180;
-    M = 357.5291 + 35999.0503 * T - 0.0001559 * T * T - 0.00000045 * T * T * T;
-    M = fmod(M, 360);
-    Lo = 280.46645 + 36000.76983 * T + 0.0003032 * T * T;
-    Lo = fmod(Lo, 360);
-    DL = (1.9146-0.004817*T-0.000014*T*T)*sin(k*M)+(0.019993-0.000101*T)*sin(k*2*M)+0.00029*sin(k*3*M);
-    L=Lo+DL;
-    eps=23.43999-0.013*T;
-    delta=(1/k)*asin(sin(L*k)*sin(eps*k));
-    RA=(1/k)*atan2(cos(eps*k)*sin(L*k),cos(L*k));
-    RA=fmod((RA+360), 360);
-    GMST=280.46061837+360.98564736629*jj+0.000387933*T*T-T*T*T/38710000;
-    GMST=fmod((GMST+360), 360);
-    LMST=GMST+lon;
-    H=LMST-RA;
-    eqt=(Lo-RA)*4;
-    alt=(1/k)*asin(sin(lat*k)*sin(delta*k)+cos(lat*k)*cos(delta*k)*cos(H*k));
-    return alt;
-}
-
-double azimuth(double lon, double lat, int year, int month, int day, int hour, int min, int zone)
-{
-    double uu, jj, T, k, M, Lo, DL, L, eps, delta, RA, GMST, LMST, H, eqt, azm;
-    uu = ut(hour, min, zone);
-    jj = jd(year, month, day, uu);
-    T = jj / 36525;
-    k = M_PI / 180;
-    M = 357.5291 + 35999.0503 * T - 0.0001559 * T * T - 0.00000045 * T * T * T;
-    M = fmod(M, 360);
-    Lo = 280.46645 + 36000.76983 * T + 0.0003032 * T * T;
-    Lo = fmod(Lo, 360);
-    DL = (1.9146-0.004817*T-0.000014*T*T)*sin(k*M)+(0.019993-0.000101*T)*sin(k*2*M)+0.00029*sin(k*3*M);
-    L=Lo+DL;
-    eps=23.43999-0.013*T;
-    delta=(1/k)*asin(sin(L*k)*sin(eps*k));
-    RA=(1/k)*atan2(cos(eps*k)*sin(L*k),cos(L*k));
-    RA=fmod((RA+360), 360);
-    GMST=280.46061837+360.98564736629*jj+0.000387933*T*T-T*T*T/38710000;
-    GMST=fmod((GMST+360), 360);
-    LMST=GMST+lon;
-    H=LMST-RA;
-    eqt=(Lo-RA)*4;
-    azm=(1/k)*atan2(-sin(H*k),cos(lat*k)*tan(delta*k)-sin(lat*k)*cos(H*k));
-    azm=fmod((azm+360), 360);
-    return azm;
-}
-double moon_phase(int year, int month, int day)
-{
-    int lg;
-    double agepart, ge, jd, moonday;
-    ge = 1721425.5;
-    moonday = 29.530588853;
-    if (month <= 2) lg = 0;
-    else {
-        if ((fmod(year, 4) == 0) && (!(fmod(year, 100) == 0) && (fmod(year, 400) != 0)))
-            lg = -1;
-        else lg = -2;
-    }
-    jd = (ge - 1) + 
-        (365 * (year - 1)) + 
-        floor((year - 1) / 4) + 
-        (-floor((year - 1) / 100)) +
-        floor((year - 1) / 400) + 
-        floor((((367 * month) - 362) / 12) + lg + day);
-    
-    agepart = (jd - 2451550.1) / moonday;
-    agepart = agepart - floor(agepart);
-    if (agepart < 0) agepart + 1;
-/*
-    ageday = agepart * moonday;
-
-    moonfill = 1.0 - ((moonday/2 - ageday) / (moonday/2));
-    fprintf(stderr, "agepart = %f, ageday = %f, moonfill = %f\n", agepart, ageday, moonfill);
-    */
-    return agepart;
-}
-
-/*
-int main(int argc, char * argv)
-{   
-    int year, month, day, hour, min, zone;
-    double alt, azm, lon, lat, moonpart;
-    lon = 30.133333;
-    lat = 55.166666;
-    year = 2010;
-    month = 4;
-    day = 13;
-    hour = 18;
-    min = 10;
-    zone = 2;
-    
-    //moonpart = moon_phase1(year, month, day);
-    //fprintf(stderr, "moon path = %f\n", moonpart);
-    alt = altitude(lon, lat, year, month, day, hour, min, zone);
-    azm = azimuth(lon, lat, year, month, day, hour, min, zone);
-    fprintf(stderr, "alt=%5.6f azm=%5.6f\n", alt, azm);
-
-    return 1;
-}
-*/
diff --git a/applet/livewp-astro.h b/applet/livewp-astro.h
deleted file mode 100644 (file)
index 6bb25d1..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * This file is part of Live Wallpaper (livewp)
- * 
- * Copyright (C) 2010 Vlad Vasiliev
- * Copyright (C) 2010 Tanya Makova
- *       for the code
- * 
- * This software is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- * 
- * This software is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
-*/
-/*******************************************************************************/
-#ifndef _livewp_astro_h
-#define _livewp_astro_h 1
-/*******************************************************************************/
-#include <math.h>
-/*******************************************************************************/
-double ut(int hour, int min, int zone);
-double jd(int year, int month, int day, double uu);
-double altitude(double lon, double lat, int year, int month, int day, int hour, int min, int zone);
-double azimuth(double lon, double lat, int year, int month, int day, int hour, int min, int zone);
-double moon_phase(int year, int month, int day);
-/*******************************************************************************/
-#endif
diff --git a/applet/livewp-home-widget.c b/applet/livewp-home-widget.c
deleted file mode 100644 (file)
index b09ecda..0000000
+++ /dev/null
@@ -1,335 +0,0 @@
-/*
- * This file is part of Live Wallpaper (livewp)
- * 
- * Copyright (C) 2010 Vlad Vasiliev
- * Copyright (C) 2010 Tanya Makova
- *       for the code
- * 
- * This software is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- * 
- * This software is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
-*/
-/*******************************************************************************/
-#include <gtk/gtk.h>
-#include <hildon/hildon.h>
-#include "livewp-home-widget.h"
-#include <libhildondesktop/libhildondesktop.h>
-#include <gconf/gconf-client.h>
-#include "livewp-rules.h"
-
-#define PLUGIN_NAME "livewp-home-widget.desktop-0"
-#define GCONF_KEY_POSITION "/apps/osso/hildon-desktop/applets/%s/position"
-#define GCONF_KEY_MODIFIED "/apps/osso/hildon-desktop/applets/%s/modified"
-#define GCONF_KEY_VIEW     "/apps/osso/hildon-desktop/applets/%s/view"
-
-HD_DEFINE_PLUGIN_MODULE (AWallpaperPlugin, animation_wallpaper_plugin, HD_TYPE_HOME_PLUGIN_ITEM)
-
-#define Xstartposition 795
-#define Ystartposition 430
-
-gint xapplet = 0, yapplet = 0;
-GSList * objects_list = NULL;
-Scene scene;
-
-gboolean
-expose_event (GtkWidget *widget,GdkEventExpose *event,
-     gpointer data)
-{
-    cairo_t *cr;
-    GdkPixbuf *pixbuf = (GdkPixbuf *) data;
-       
-    cr = gdk_cairo_create(widget->window);
-    gdk_cairo_region(cr, event->region);
-    cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
-    gdk_cairo_set_source_pixbuf(cr, pixbuf, 0.0, 0.0);
-    cairo_paint(cr);
-    cairo_destroy(cr);
-    return TRUE;
-}
-void
-realize (GtkWidget *widget)
-{
-    GdkScreen *screen;
-    screen = gtk_widget_get_screen (widget);
-    gtk_widget_set_colormap (widget, gdk_screen_get_rgba_colormap (screen));
-}
-
-void
-init_applet_position(void)
-{
-  /* To Do Must be Only 1 per secund */
-  GSList *position = NULL;
-  gchar *position_key;
-  gchar *modified_key;
-  gchar *modified;
-  GError *error = NULL;
-  GConfClient   *gconf_client = gconf_client_get_default ();
-  position_key = g_strdup_printf (GCONF_KEY_POSITION, PLUGIN_NAME);
-  position = gconf_client_get_list (gconf_client,
-                                    position_key,
-                                    GCONF_VALUE_INT,
-                                    NULL);
-  if (position && position->data && position->next->data){
-       xapplet = GPOINTER_TO_INT (position->data);
-       yapplet = GPOINTER_TO_INT (position->next->data);
-  }else{
-       fprintf(stderr,"Not position \n");
-       position = g_slist_prepend (g_slist_prepend (NULL,
-                                      GINT_TO_POINTER (Ystartposition)),
-                                     GINT_TO_POINTER (Xstartposition));
-       gconf_client_set_list (gconf_client,
-                               position_key,
-                               GCONF_VALUE_INT,
-                              position,
-                              &error);
-       xapplet = Xstartposition;
-       yapplet = Ystartposition;
-  }
-  g_free (position_key);
-  modified = g_strdup_printf ("%ld", 0);
-  modified_key = g_strdup_printf (GCONF_KEY_MODIFIED, PLUGIN_NAME);
-  gconf_client_set_string (gconf_client,
-                           modified_key,
-                           modified,
-                           &error);
-  fprintf(stderr,"position %i %i\n",xapplet, yapplet);
-  gconf_client_clear_cache(gconf_client);
-  g_object_unref(gconf_client);
-}
-
-actor_set_position_full(GtkWidget *actor, gint x, gint y, gint z)
-{
- fprintf(stderr, "actor_set_position_full\n");
- hildon_animation_actor_set_position_full (HILDON_ANIMATION_ACTOR (actor),x-xapplet, y-yapplet, z);
-}
-
-GtkWidget* init_object(gchar * name, gint x, gint y, gint z, gint width, gint height)
-{
-  Actor  a;  
-  GtkWidget *actor;
-  GdkPixbuf *pixbuf;
-  GtkWidget *image;
-
-  actor = hildon_animation_actor_new();
-  gchar str[256];
-  snprintf(str, 255, "/usr/share/anwall/%s.png", name);
-  //fprintf(stderr, "!!!init object !!!!\nname = %s file = %s\n", name, str);
-  pixbuf = gdk_pixbuf_new_from_file_at_size (str, 
-                                             width, 
-                                             height, 
-                                             NULL);
-  if (pixbuf){
-      image = gtk_image_new_from_pixbuf (pixbuf);
-      g_object_unref(G_OBJECT(pixbuf));
-  }
-  g_signal_connect(G_OBJECT(image), "expose_event",
-                           G_CALLBACK(expose_event), pixbuf);
-  gtk_container_add (GTK_CONTAINER (actor), image);
-
-   pixbuf = gdk_pixbuf_new_from_file_at_size ("/usr/share/anwall/cloud1.png", 
-                                             width, 
-                                             height, 
-                                             NULL);
-  if (pixbuf){
-      image = gtk_image_new_from_pixbuf (pixbuf);
-      g_object_unref(G_OBJECT(pixbuf));
-  }
-  g_signal_connect(G_OBJECT(image), "expose_event",
-                           G_CALLBACK(expose_event), pixbuf);
-
-  gtk_container_add (GTK_CONTAINER (actor), image);
-  actor_set_position_full(actor, x, y, z);
-  hildon_animation_actor_set_show (actor, 1);
-  realize(actor);
-  gtk_widget_show_all(actor);
-  g_object_set_data(G_OBJECT(actor), "name", name);
-  g_object_set_data(G_OBJECT(actor), "x", x);
-  g_object_set_data(G_OBJECT(actor), "y", y);
-  g_object_set_data(G_OBJECT(actor), "z", z);
-  g_object_set_data(G_OBJECT(actor), "scale", 10);
-
-  
-  //objects_list = g_slist_append(objects_list, G_OBJECT(actor));
-  //objects_list = g_slist_append(objects_list, G_OBJECT(a));
-  return actor;
-}
-
-void
-init_scene(GtkWidget *window)
-{
-  GtkWidget *actor;
-  GdkPixbuf *pixbuf;
-  GtkWidget *image;
-  double alt, azm;
-  gint x, y;
-
-  scene.window = window;
-  scene.daytime = get_daytime();
-  scene.dynamic_actors = NULL;
-  scene.static_actors = NULL;
-
-  get_sun_pos(&alt, &azm);
-  get_sun_screen_pos(alt, azm, &x, &y);
-  fprintf(stderr, "init scene\n");
-  actor = init_object("sun", x, y, 20, 88, 88);
-  hildon_animation_actor_set_parent (HILDON_ANIMATION_ACTOR (actor), window);
-  scene.static_actors = g_slist_append(scene.static_actors, G_OBJECT(actor));
-  scene.dynamic_actors = g_slist_append(scene.dynamic_actors, G_OBJECT(actor));
-
-  actor = init_object("sky", 0, 0, 0, 800, 480);
-  hildon_animation_actor_set_parent (HILDON_ANIMATION_ACTOR (actor), window);
-  scene.static_actors = g_slist_append(scene.static_actors, G_OBJECT(actor));
-
-  actor = init_object("town", 0, 0, 10, 800, 480);
-  hildon_animation_actor_set_parent (HILDON_ANIMATION_ACTOR (actor), window);
-  scene.static_actors = g_slist_append(scene.static_actors, G_OBJECT(actor));
-
-  actor = init_object("cloud1", 400, 150, 2, 200, 150);
-  hildon_animation_actor_set_parent (HILDON_ANIMATION_ACTOR (actor), window);
-  scene.dynamic_actors = g_slist_append(scene.dynamic_actors, G_OBJECT(actor));
-
-}
-
-static void
-example_label_home_applet_realize (GtkWidget *widget)
-{
-}
-void get_sun_screen_pos(double alt, double azm, gint * x, gint * y)
-{
-    gint y0 = 400;// - уровень горизонта
-    gint o_width = 128,
-         o_height = 
-    *x = (int)(azm * 800) - 64;
-    *y = (int)((1 - alt) * y0) - 64;
-}
-
-void change_actor(GtkWidget * actor)
-{
-    char * name;
-    gint x, y, daytime, sc;
-    double scale;
-    double alt, azm;
-    name = g_object_get_data(G_OBJECT(actor), "name");
-    fprintf(stderr, "change actor %s\n", name);
-    if (name == "sun"){
-        daytime = get_daytime();
-        if (daytime != TIME_NIGHT){
-            hildon_animation_actor_set_show(actor, 1);
-            get_sun_pos(&alt, &azm);
-            get_sun_screen_pos(alt, azm, &x, &y);
-            actor_set_position_full(actor, x, y, g_object_get_data(G_OBJECT(actor), "z"));
-        }
-    }
-    
-    if (name == "cloud1"){
-        x = g_object_get_data(G_OBJECT(actor), "x");
-        y = g_object_get_data(G_OBJECT(actor), "y");
-        sc = g_object_get_data(G_OBJECT(actor), "scale");
-        
-        x += 40;
-        y -= 20;
-        sc -= 1;
-        if (x > 600){
-            x = 400;
-            y = 150;
-            sc = 10;
-        }
-        scale = (double)sc / 10;
-        hildon_animation_actor_set_scale(actor, scale, scale);
-        fprintf(stderr, "cloud x=%d y=%d scale=%f", x, y, scale);
-        actor_set_position_full(actor, x, y, g_object_get_data(G_OBJECT(actor), "z"));
-        g_object_set_data(G_OBJECT(actor), "x", x);
-        g_object_set_data(G_OBJECT(actor), "y", y);
-        g_object_set_data(G_OBJECT(actor), "scale", sc);
-    }
-
-}
-
-static gboolean
-plugin_on_timeout (gpointer data)
-{
-  gint daytime = get_daytime();
-  GSList * tmp;
-  fprintf(stderr, "on timeout\n");
-
-  if (scene.daytime == daytime){
-      // change dynamic actors
-      tmp = scene.dynamic_actors;
-  }else {
-      // change static actors
-      tmp = scene.dynamic_actors;
-  } 
-  while (tmp != NULL){
-      change_actor(tmp->data);
-      tmp = g_slist_next(tmp);
-  }
-
-  scene.daytime = daytime;
-
-  //double azm, alt;
-  //get_sun_pos(&alt, &azm);
-/*
-  GSList * tmp = objects_list;
-  while (tmp != NULL){
-      //processing(tmp->data);
-      
-      str = g_object_get_data(G_OBJECT(tmp->data), "name");
-      fprintf(stderr, "object: %s\n", str);
-      
-      if (str == "sun"){
-        //get_sun_screen_pos(alt, azm, &x, &y);
-        //x = tmp->data
-        //actor_set_position_full(tmp->data, x, y, 20);
-        //g_object_set_data(G_OBJECT(tmp->data), "posX", x);
-        //g_object_set_data(G_OBJECT(tmp->data), "posY", y);
-        //fprintf(stderr, "x = %d y = %d\n", x, y);
-        child = gtk_container_get_children(GTK_CONTAINER (tmp->data));
-        while (child != NULL) {
-            gtk_container_remove(GTK_CONTAINER (tmp->data), child->data);
-            child = child->next;
-        }
-
-         //snprintf(str, 255, "/usr/share/anwall/%s.png", name);
-         //fprintf(stderr, "!!!init object !!!!\nname = %s file = %s\n", name, str);
-             
-      }
-      
-      if (str == "town"){
-          //hildon_animation_actor_set_show(tmp->data, 0);
-      }
-      //a = tmp->data;
-      //fprintf(stderr, "--timeout %s\n", a->name);
-      tmp = g_slist_next(tmp);
-  }
-  */
-  return TRUE; /* keep running this event */
-}
-
-static void
-animation_wallpaper_plugin_init (AWallpaperPlugin *desktop_plugin)
-{
-  GtkWidget *label;
-  label = gtk_label_new (""); 
-  gtk_widget_show (label);
-  gtk_container_add (GTK_CONTAINER (desktop_plugin), label);
-  init_applet_position();
-  init_scene(desktop_plugin);
-  desktop_plugin->timer = g_timeout_add(1000*10, plugin_on_timeout, desktop_plugin);
-}
-
-static void
-animation_wallpaper_plugin_class_init (AWallpaperPluginClass *klass) {}
-
-static void
-animation_wallpaper_plugin_class_finalize (AWallpaperPluginClass *class) {}
diff --git a/applet/livewp-home-widget.h b/applet/livewp-home-widget.h
deleted file mode 100644 (file)
index 1b56087..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * This file is part of Live Wallpaper (livewp)
- * 
- * Copyright (C) 2010 Vlad Vasiliev
- * Copyright (C) 2010 Tanya Makova
- *       for the code
- * 
- * This software is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- * 
- * This software is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
-*/
-/*******************************************************************************/
-#ifndef Animation_Wallpaper_PLUGIN_H
-#define Animation_Wallpaper_PLUGIN_H
-
-#include <glib-object.h>
-
-#include <libhildondesktop/libhildondesktop.h>
-
-G_BEGIN_DECLS
-
-typedef struct _AWallpaperPlugin AWallpaperPlugin;
-typedef struct _AWallpaperPluginClass AWallpaperPluginClass;
-
-#define Animation_Wallpaper_TYPE_HOME_PLUGIN (animation_wallpaper_home_plugin_get_type ())
-
-#define Animation_Wallpaper_HOME_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
-                        Animation_Wallpaper_TYPE_HOME_PLUGIN, AWallpaperHomePlugin))
-
-#define Animation_Wallpaper_HOME_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
-                        Animation_Wallpaper_TYPE_HOME_PLUGIN, AWallpaperHomePluginClass))
-
-#define Animation_Wallpaper_IS_HOME_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
-                        Animation_Wallpaper_TYPE_HOME_PLUGIN))
-
-#define Animation_Wallpaper_IS_HOME_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
-                        Animation_Wallpaper_TYPE_HOME_PLUGIN))
-
-#define Animation_Wallpaper_HOME_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
-                        Animation_Wallpaper_TYPE_HOME_PLUGIN, AWallpaperHomePluginClass))
-
-struct _AWallpaperPlugin
-{
-    HDHomePluginItem hitem;
-    GObject *parent;
-    gint timer;
-};
-
-struct _AWallpaperPluginClass
-{
-    HDHomePluginItemClass parent_class;
-
-};
-
-typedef struct {
-    GtkWidget * window;
-    GSList * static_actors;
-    GSList * dynamic_actors;
-    gint daytime;
-} Scene;
-
-typedef struct {
-    GtkWidget * widget;
-    gchar * name;
-    gchar * filename;
-    gint x;
-    gint y;
-    gint z;
-    gint widht;
-    gint height;
-    gboolean visible;
-
-} Actor;
-
-GType animation_wallpaper_home_plugin_get_type(void);
-
-G_END_DECLS
-
-#endif
diff --git a/applet/livewp-rules.c b/applet/livewp-rules.c
deleted file mode 100644 (file)
index 791ba94..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * This file is part of Live Wallpaper (livewp)
- * 
- * Copyright (C) 2010 Vlad Vasiliev
- * Copyright (C) 2010 Tanya Makova
- *       for the code
- * 
- * This software is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- * 
- * This software is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
-*/
-/*******************************************************************************/
-
-#include "livewp-rules.h"
-
-/*******************************************************************************/
-
-void get_localtime(int * year, int * month, int * day, int * hour, int * min, int * zone)
-{
-    time_t timet;
-    struct tm nt;
-    time(&timet);
-    localtime_r(&timet, &nt);
-    *year = nt.tm_year + 1900;
-    *month = nt.tm_mon + 1;
-    *day = nt.tm_mday;
-    *hour = nt.tm_hour;
-    *min = nt.tm_min;
-    *zone = nt.tm_gmtoff/3600;
-  /* 
- *year = 2010;
-    *month = 3;
-    *day = 24;
-    *hour = 16;
-    *min = 20;
-    *zone = 2;*/
-}
-
-void get_coord(double * lat, double * lon)
-{
-    *lat = 55.166666;
-    *lon = 30.166666;
-}
-
-void get_sun_pos(double * alt, double * azm)
-{
-    int year, month, day, hour, min, zone;
-    double lat, lon;
-    get_localtime(&year, &month, &day, &hour, &min, &zone);
-    get_coord(&lat, &lon);
-    *alt = altitude(lon, lat, year, month, day, hour, min, zone);
-    *alt = *alt / 70; // sun height in percent
-
-    *azm = azimuth(lon, lat, year, month, day, hour, min, zone);
-    //if south latitude
-    if (lat < 0){
-        *azm = 90 + (90 - *azm);
-        *azm = fmod(*azm, 360);
-    }
-    *azm = (*azm - 90) / 180; // sun azimuth in percent
-}
-int get_daytime()
-{
-    double alt, azm;
-    get_sun_pos(&alt, &azm);
-    alt = alt * 100;
-    azm = azm * 100;
-    printf("alt = %f azm=%f\n", alt, azm);
-    if (alt <= -7) return TIME_NIGHT;
-    if (alt > -7 && alt < 7 && azm < 50) return TIME_SUNRISE;
-    if (alt > 7 && alt < azm > 50) return TIME_SUNSET;
-    if (alt >= 7) return TIME_DAY;
-    
-}
-int get_moon_phase()
-{ 
-    int year, month, day, hour, min, zone;
-    double phase;
-    get_localtime(&year, &month, &day, &hour, &min, &zone);
-    phase = moon_phase(year, month, day) * 100;
-    printf("ph = %f\n", phase);
-    if (phase <= 3 || phase >=97) return MOON_NONE;
-    if (phase > 5 && phase <= 25) return MOON_GROWS;
-    if (phase > 25 && phase <= 45) return MOON_GROWSHALF;
-    if (phase > 45 && phase <= 55) return MOON_FULL;
-    if (phase > 55 && phase <= 75) return MOON_DECREASHALF;
-    if (phase > 75 && phase < 97) return MOON_DECREAS;
-}
diff --git a/applet/livewp-rules.h b/applet/livewp-rules.h
deleted file mode 100644 (file)
index 3cba194..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * This file is part of Live Wallpaper (livewp)
- * 
- * Copyright (C) 2010 Vlad Vasiliev
- * Copyright (C) 2010 Tanya Makova
- *       for the code
- * 
- * This software is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- * 
- * This software is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
-*/
-/*******************************************************************************/
-#ifndef _livewp_rules_h
-#define _livewp_rules_h 1
-/*******************************************************************************/
-#include <time.h>
-#include "livewp-astro.h"
-/*******************************************************************************/
-#define TIME_DAY        0
-#define TIME_NIGHT      1
-#define TIME_SUNRISE    2
-#define TIME_SUNSET     3
-
-#define MOON_NONE               0
-#define MOON_GROWS              1
-#define MOON_GROWSHALF          2
-#define MOON_FULL               3 
-#define MOON_DECREASHALF        4
-#define MOON_DECREAS            5
-
-/*******************************************************************************/
-void get_localtime(int * year, int * month, int * day, int * hour, int * min, int * zone);
-void get_coord(double * lat, double * lon);
-void get_sun_pos(double * alt, double * azm);
-int get_daytime();
-int get_moon_phase();
-/*******************************************************************************/
-#endif
diff --git a/applet/src/Makefile b/applet/src/Makefile
new file mode 100644 (file)
index 0000000..c290f29
--- /dev/null
@@ -0,0 +1,471 @@
+# Makefile.in generated by automake 1.8.5 from Makefile.am.
+# src/Makefile.  Generated from Makefile.in by configure.
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+
+SOURCES = $(liblivewp_home_widget_la_SOURCES)
+
+srcdir = .
+top_srcdir = ..
+
+pkgdatadir = $(datadir)/livewp
+pkglibdir = $(libdir)/livewp
+pkgincludedir = $(includedir)/livewp
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = /scratchbox/tools/bin/install -c
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_triplet = i486-pc-linux-gnu
+subdir = src
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+mkinstalldirs = $(mkdir_p)
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(desktoplibdir)"
+desktoplibLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(desktoplib_LTLIBRARIES)
+am__DEPENDENCIES_1 =
+liblivewp_home_widget_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
+am_liblivewp_home_widget_la_OBJECTS = livewp-home-widget.lo \
+       livewp-astro.lo livewp-rules.lo
+liblivewp_home_widget_la_OBJECTS =  \
+       $(am_liblivewp_home_widget_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+DEP_FILES = ./$(DEPDIR)/livewp-astro.Plo \
+       ./$(DEPDIR)/livewp-home-widget.Plo \
+       ./$(DEPDIR)/livewp-rules.Plo
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+       $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+       $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+       $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+       $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(liblivewp_home_widget_la_SOURCES)
+DIST_SOURCES = $(liblivewp_home_widget_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = ${SHELL} /home/vlad/livewp/applet/missing --run aclocal-1.8
+AMDEP_FALSE = #
+AMDEP_TRUE = 
+AMTAR = ${SHELL} /home/vlad/livewp/applet/missing --run tar
+AR = i486-linux-gnu-ar
+AUTOCONF = ${SHELL} /home/vlad/livewp/applet/missing --run autoconf
+AUTOHEADER = ${SHELL} /home/vlad/livewp/applet/missing --run autoheader
+AUTOMAKE = ${SHELL} /home/vlad/livewp/applet/missing --run automake-1.8
+AWK = gawk
+CC = i486-linux-gnu-gcc
+CCDEPMODE = depmode=gcc3
+CFLAGS = -Wall -g -O2
+CPP = i486-linux-gnu-gcc -E
+CPPFLAGS = 
+CXX = i486-linux-gnu-g++
+CXXCPP = i486-linux-gnu-g++ -E
+CXXDEPMODE = depmode=gcc3
+CXXFLAGS = -g -O2
+CYGPATH_W = echo
+DEFS = -DHAVE_CONFIG_H
+DEPDIR = .deps
+DSYMUTIL = 
+ECHO = echo
+ECHO_C = 
+ECHO_N = -n
+ECHO_T = 
+EGREP = /scratchbox/tools/bin/grep -E
+EXAMPLE_CFLAGS = -DMAEMO_CHANGES -DMAEMO_GTK -pthread -I/usr/include/hildon-1 -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/libhildondesktop-1 -I/usr/include/gnome-vfs-2.0 -I/usr/lib/gnome-vfs-2.0/include -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/gconf/2  
+EXAMPLE_LIBS = -pthread -lhildondesktop-1 -lhildon-1 -lgnomevfs-2 -lgconf-2 -lgthread-2.0 -lrt -ldbus-glib-1 -ldbus-1 -lpthread -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lglib-2.0  
+EXEEXT = 
+F77 = 
+FFLAGS = 
+GREP = /scratchbox/tools/bin/grep
+HILDON_DESKTOP_LIB_DIR = /usr/lib/hildon-desktop
+HILDON_HOME_DESKTOP_DIR = /usr/share/applications/hildon-home
+INSTALL_DATA = ${INSTALL} -m 644
+INSTALL_PROGRAM = ${INSTALL}
+INSTALL_SCRIPT = ${INSTALL}
+INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s
+LDFLAGS = 
+LIBOBJS = 
+LIBS = 
+LIBTOOL = $(SHELL) $(top_builddir)/libtool
+LN_S = ln -s
+LTLIBOBJS = 
+MAKEINFO = ${SHELL} /home/vlad/livewp/applet/missing --run makeinfo
+NMEDIT = 
+OBJEXT = o
+PACKAGE = livewp
+PACKAGE_BUGREPORT = 
+PACKAGE_NAME = livewp
+PACKAGE_STRING = livewp 0.1
+PACKAGE_TARNAME = livewp
+PACKAGE_VERSION = 0.1
+PATH_SEPARATOR = :
+PKG_CONFIG = /scratchbox/tools/bin/pkg-config
+RANLIB = i486-linux-gnu-ranlib
+SED = /scratchbox/tools/bin/sed
+SET_MAKE = 
+SHELL = /bin/sh
+STRIP = i486-linux-gnu-strip
+VERSION = 0.1
+ac_ct_CC = 
+ac_ct_CXX = 
+ac_ct_F77 = 
+am__fastdepCC_FALSE = #
+am__fastdepCC_TRUE = 
+am__fastdepCXX_FALSE = #
+am__fastdepCXX_TRUE = 
+am__include = include
+am__leading_dot = .
+am__quote = 
+bindir = ${exec_prefix}/bin
+build = i486-pc-linux-gnu
+build_alias = i486-linux-gnu
+build_cpu = i486
+build_os = linux-gnu
+build_vendor = pc
+datadir = ${datarootdir}
+datarootdir = ${prefix}/share
+docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
+dvidir = ${docdir}
+exec_prefix = ${prefix}
+host = i486-pc-linux-gnu
+host_alias = i486-linux-gnu
+host_cpu = i486
+host_os = linux-gnu
+host_vendor = pc
+htmldir = ${docdir}
+includedir = ${prefix}/include
+infodir = ${prefix}/share/info
+install_sh = /home/vlad/livewp/applet/install-sh
+libdir = ${exec_prefix}/lib
+libexecdir = ${exec_prefix}/libexec
+localedir = ${datarootdir}/locale
+localstatedir = ${prefix}/var
+mandir = ${prefix}/share/man
+mkdir_p = mkdir -p -- .
+oldincludedir = /usr/include
+pdfdir = ${docdir}
+prefix = /usr
+program_transform_name = s,x,x,
+psdir = ${docdir}
+sbindir = ${exec_prefix}/sbin
+sharedstatedir = ${prefix}/com
+sysconfdir = ${prefix}/etc
+target_alias = 
+
+# We invent desktoplib_LTLIBRARIES instead of the normal lib_LTLIBRARIES,
+# so we can specify the non-standard installation directory.
+desktoplib_LTLIBRARIES = liblivewp-home-widget.la
+desktoplibdir = $(HILDON_DESKTOP_LIB_DIR)
+liblivewp_home_widget_la_SOURCES = livewp-home-widget.c livewp-home-widget.h livewp-astro.c livewp-astro.h livewp-rules.c livewp-rules.h
+liblivewp_home_widget_la_LIBADD = $(EXAMPLE_LIBS) 
+AM_CFLAGS = -Wall $(EXAMPLE_CFLAGS) 
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+               && exit 0; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --gnu  src/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-desktoplibLTLIBRARIES: $(desktoplib_LTLIBRARIES)
+       @$(NORMAL_INSTALL)
+       test -z "$(desktoplibdir)" || $(mkdir_p) "$(DESTDIR)$(desktoplibdir)"
+       @list='$(desktoplib_LTLIBRARIES)'; for p in $$list; do \
+         if test -f $$p; then \
+           f="`echo $$p | sed -e 's|^.*/||'`"; \
+           echo " $(LIBTOOL) --mode=install $(desktoplibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(desktoplibdir)/$$f'"; \
+           $(LIBTOOL) --mode=install $(desktoplibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(desktoplibdir)/$$f"; \
+         else :; fi; \
+       done
+
+uninstall-desktoplibLTLIBRARIES:
+       @$(NORMAL_UNINSTALL)
+       @list='$(desktoplib_LTLIBRARIES)'; for p in $$list; do \
+           p="`echo $$p | sed -e 's|^.*/||'`"; \
+         echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(desktoplibdir)/$$p'"; \
+         $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(desktoplibdir)/$$p"; \
+       done
+
+clean-desktoplibLTLIBRARIES:
+       -test -z "$(desktoplib_LTLIBRARIES)" || rm -f $(desktoplib_LTLIBRARIES)
+       @list='$(desktoplib_LTLIBRARIES)'; for p in $$list; do \
+         dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+         test "$$dir" != "$$p" || dir=.; \
+         echo "rm -f \"$${dir}/so_locations\""; \
+         rm -f "$${dir}/so_locations"; \
+       done
+liblivewp-home-widget.la: $(liblivewp_home_widget_la_OBJECTS) $(liblivewp_home_widget_la_DEPENDENCIES) 
+       $(LINK) -rpath $(desktoplibdir) $(liblivewp_home_widget_la_LDFLAGS) $(liblivewp_home_widget_la_OBJECTS) $(liblivewp_home_widget_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+       -rm -f *.$(OBJEXT)
+
+distclean-compile:
+       -rm -f *.tab.c
+
+include ./$(DEPDIR)/livewp-astro.Plo
+include ./$(DEPDIR)/livewp-home-widget.Plo
+include ./$(DEPDIR)/livewp-rules.Plo
+
+.c.o:
+       if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+       then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+#      source='$<' object='$@' libtool=no \
+#      depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' \
+#      $(CCDEPMODE) $(depcomp) \
+#      $(COMPILE) -c $<
+
+.c.obj:
+       if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+       then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+#      source='$<' object='$@' libtool=no \
+#      depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' \
+#      $(CCDEPMODE) $(depcomp) \
+#      $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+       if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+       then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+#      source='$<' object='$@' libtool=yes \
+#      depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' \
+#      $(CCDEPMODE) $(depcomp) \
+#      $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+       -rm -f *.lo
+
+clean-libtool:
+       -rm -rf .libs _libs
+
+distclean-libtool:
+       -rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+       list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+         test -n "$$unique" || unique=$$empty_fix; \
+         $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+           $$tags $$unique; \
+       fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       test -z "$(CTAGS_ARGS)$$tags$$unique" \
+         || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+            $$tags $$unique
+
+GTAGS:
+       here=`$(am__cd) $(top_builddir) && pwd` \
+         && cd $(top_srcdir) \
+         && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+       @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+       list='$(DISTFILES)'; for file in $$list; do \
+         case $$file in \
+           $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+           $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+         esac; \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+         if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+           dir="/$$dir"; \
+           $(mkdir_p) "$(distdir)$$dir"; \
+         else \
+           dir=''; \
+         fi; \
+         if test -d $$d/$$file; then \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+           fi; \
+           cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+         else \
+           test -f $(distdir)/$$file \
+           || cp -p $$d/$$file $(distdir)/$$file \
+           || exit 1; \
+         fi; \
+       done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+       for dir in "$(DESTDIR)$(desktoplibdir)"; do \
+         test -z "$$dir" || $(mkdir_p) "$$dir"; \
+       done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+         install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+         `test -z '$(STRIP)' || \
+           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+       -rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-desktoplibLTLIBRARIES clean-generic clean-libtool \
+       mostlyclean-am
+
+distclean: distclean-am
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+       distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-desktoplibLTLIBRARIES
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+       mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-desktoplibLTLIBRARIES uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean \
+       clean-desktoplibLTLIBRARIES clean-generic clean-libtool ctags \
+       distclean distclean-compile distclean-generic \
+       distclean-libtool distclean-tags distdir dvi dvi-am html \
+       html-am info info-am install install-am install-data \
+       install-data-am install-desktoplibLTLIBRARIES install-exec \
+       install-exec-am install-info install-info-am install-man \
+       install-strip installcheck installcheck-am installdirs \
+       maintainer-clean maintainer-clean-generic mostlyclean \
+       mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+       pdf pdf-am ps ps-am tags uninstall uninstall-am \
+       uninstall-desktoplibLTLIBRARIES uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/applet/src/Makefile.am b/applet/src/Makefile.am
new file mode 100644 (file)
index 0000000..c532e86
--- /dev/null
@@ -0,0 +1,10 @@
+# We invent desktoplib_LTLIBRARIES instead of the normal lib_LTLIBRARIES,
+# so we can specify the non-standard installation directory.
+desktoplib_LTLIBRARIES =  liblivewp-home-widget.la
+desktoplibdir = $(HILDON_DESKTOP_LIB_DIR)
+
+liblivewp_home_widget_la_SOURCES = livewp-home-widget.c livewp-home-widget.h livewp-astro.c livewp-astro.h livewp-rules.c livewp-rules.h
+liblivewp_home_widget_la_LIBADD = $(EXAMPLE_LIBS) 
+
+AM_CFLAGS = -Wall $(EXAMPLE_CFLAGS) 
+
diff --git a/applet/src/livewp-astro.c b/applet/src/livewp-astro.c
new file mode 100644 (file)
index 0000000..ec2a8eb
--- /dev/null
@@ -0,0 +1,142 @@
+/*
+ * This file is part of Live Wallpaper (livewp)
+ * 
+ * Copyright (C) 2010 Vlad Vasiliev
+ * Copyright (C) 2010 Tanya Makova
+ *       for the code
+ * 
+ * This software is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+*/
+/*******************************************************************************/
+#include <stdio.h>
+#include "livewp-astro.h"
+    
+double ut(int hour, int min, int zone)
+{
+    return (hour - zone + (double)min/60);
+}
+
+double jd(int year, int month, int day, double uu)
+{
+    return (367*year)-floor((floor((month+9)/12)+year)*7/4)+floor(275*month/9)+day-730531.5+(uu/24);
+}
+
+double altitude(double lon, double lat, int year, int month, int day, int hour, int min, int zone)
+{
+    double uu, jj, T, k, M, Lo, DL, L, eps, delta, RA, GMST, LMST, H, eqt, alt;
+    uu = ut(hour, min, zone);
+    jj = jd(year, month, day, uu);
+    T = jj / 36525;
+    k = M_PI / 180;
+    M = 357.5291 + 35999.0503 * T - 0.0001559 * T * T - 0.00000045 * T * T * T;
+    M = fmod(M, 360);
+    Lo = 280.46645 + 36000.76983 * T + 0.0003032 * T * T;
+    Lo = fmod(Lo, 360);
+    DL = (1.9146-0.004817*T-0.000014*T*T)*sin(k*M)+(0.019993-0.000101*T)*sin(k*2*M)+0.00029*sin(k*3*M);
+    L=Lo+DL;
+    eps=23.43999-0.013*T;
+    delta=(1/k)*asin(sin(L*k)*sin(eps*k));
+    RA=(1/k)*atan2(cos(eps*k)*sin(L*k),cos(L*k));
+    RA=fmod((RA+360), 360);
+    GMST=280.46061837+360.98564736629*jj+0.000387933*T*T-T*T*T/38710000;
+    GMST=fmod((GMST+360), 360);
+    LMST=GMST+lon;
+    H=LMST-RA;
+    eqt=(Lo-RA)*4;
+    alt=(1/k)*asin(sin(lat*k)*sin(delta*k)+cos(lat*k)*cos(delta*k)*cos(H*k));
+    return alt;
+}
+
+double azimuth(double lon, double lat, int year, int month, int day, int hour, int min, int zone)
+{
+    double uu, jj, T, k, M, Lo, DL, L, eps, delta, RA, GMST, LMST, H, eqt, azm;
+    uu = ut(hour, min, zone);
+    jj = jd(year, month, day, uu);
+    T = jj / 36525;
+    k = M_PI / 180;
+    M = 357.5291 + 35999.0503 * T - 0.0001559 * T * T - 0.00000045 * T * T * T;
+    M = fmod(M, 360);
+    Lo = 280.46645 + 36000.76983 * T + 0.0003032 * T * T;
+    Lo = fmod(Lo, 360);
+    DL = (1.9146-0.004817*T-0.000014*T*T)*sin(k*M)+(0.019993-0.000101*T)*sin(k*2*M)+0.00029*sin(k*3*M);
+    L=Lo+DL;
+    eps=23.43999-0.013*T;
+    delta=(1/k)*asin(sin(L*k)*sin(eps*k));
+    RA=(1/k)*atan2(cos(eps*k)*sin(L*k),cos(L*k));
+    RA=fmod((RA+360), 360);
+    GMST=280.46061837+360.98564736629*jj+0.000387933*T*T-T*T*T/38710000;
+    GMST=fmod((GMST+360), 360);
+    LMST=GMST+lon;
+    H=LMST-RA;
+    eqt=(Lo-RA)*4;
+    azm=(1/k)*atan2(-sin(H*k),cos(lat*k)*tan(delta*k)-sin(lat*k)*cos(H*k));
+    azm=fmod((azm+360), 360);
+    return azm;
+}
+double moon_phase(int year, int month, int day)
+{
+    int lg;
+    double agepart, ge, jd, moonday;
+    ge = 1721425.5;
+    moonday = 29.530588853;
+    if (month <= 2) lg = 0;
+    else {
+        if ((fmod(year, 4) == 0) && (!(fmod(year, 100) == 0) && (fmod(year, 400) != 0)))
+            lg = -1;
+        else lg = -2;
+    }
+    jd = (ge - 1) + 
+        (365 * (year - 1)) + 
+        floor((year - 1) / 4) + 
+        (-floor((year - 1) / 100)) +
+        floor((year - 1) / 400) + 
+        floor((((367 * month) - 362) / 12) + lg + day);
+    
+    agepart = (jd - 2451550.1) / moonday;
+    agepart = agepart - floor(agepart);
+    if (agepart < 0) agepart + 1;
+/*
+    ageday = agepart * moonday;
+
+    moonfill = 1.0 - ((moonday/2 - ageday) / (moonday/2));
+    fprintf(stderr, "agepart = %f, ageday = %f, moonfill = %f\n", agepart, ageday, moonfill);
+    */
+    return agepart;
+}
+
+/*
+int main(int argc, char * argv)
+{   
+    int year, month, day, hour, min, zone;
+    double alt, azm, lon, lat, moonpart;
+    lon = 30.133333;
+    lat = 55.166666;
+    year = 2010;
+    month = 4;
+    day = 13;
+    hour = 18;
+    min = 10;
+    zone = 2;
+    
+    //moonpart = moon_phase1(year, month, day);
+    //fprintf(stderr, "moon path = %f\n", moonpart);
+    alt = altitude(lon, lat, year, month, day, hour, min, zone);
+    azm = azimuth(lon, lat, year, month, day, hour, min, zone);
+    fprintf(stderr, "alt=%5.6f azm=%5.6f\n", alt, azm);
+
+    return 1;
+}
+*/
diff --git a/applet/src/livewp-astro.h b/applet/src/livewp-astro.h
new file mode 100644 (file)
index 0000000..6bb25d1
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * This file is part of Live Wallpaper (livewp)
+ * 
+ * Copyright (C) 2010 Vlad Vasiliev
+ * Copyright (C) 2010 Tanya Makova
+ *       for the code
+ * 
+ * This software is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+*/
+/*******************************************************************************/
+#ifndef _livewp_astro_h
+#define _livewp_astro_h 1
+/*******************************************************************************/
+#include <math.h>
+/*******************************************************************************/
+double ut(int hour, int min, int zone);
+double jd(int year, int month, int day, double uu);
+double altitude(double lon, double lat, int year, int month, int day, int hour, int min, int zone);
+double azimuth(double lon, double lat, int year, int month, int day, int hour, int min, int zone);
+double moon_phase(int year, int month, int day);
+/*******************************************************************************/
+#endif
diff --git a/applet/src/livewp-home-widget.c b/applet/src/livewp-home-widget.c
new file mode 100644 (file)
index 0000000..b09ecda
--- /dev/null
@@ -0,0 +1,335 @@
+/*
+ * This file is part of Live Wallpaper (livewp)
+ * 
+ * Copyright (C) 2010 Vlad Vasiliev
+ * Copyright (C) 2010 Tanya Makova
+ *       for the code
+ * 
+ * This software is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+*/
+/*******************************************************************************/
+#include <gtk/gtk.h>
+#include <hildon/hildon.h>
+#include "livewp-home-widget.h"
+#include <libhildondesktop/libhildondesktop.h>
+#include <gconf/gconf-client.h>
+#include "livewp-rules.h"
+
+#define PLUGIN_NAME "livewp-home-widget.desktop-0"
+#define GCONF_KEY_POSITION "/apps/osso/hildon-desktop/applets/%s/position"
+#define GCONF_KEY_MODIFIED "/apps/osso/hildon-desktop/applets/%s/modified"
+#define GCONF_KEY_VIEW     "/apps/osso/hildon-desktop/applets/%s/view"
+
+HD_DEFINE_PLUGIN_MODULE (AWallpaperPlugin, animation_wallpaper_plugin, HD_TYPE_HOME_PLUGIN_ITEM)
+
+#define Xstartposition 795
+#define Ystartposition 430
+
+gint xapplet = 0, yapplet = 0;
+GSList * objects_list = NULL;
+Scene scene;
+
+gboolean
+expose_event (GtkWidget *widget,GdkEventExpose *event,
+     gpointer data)
+{
+    cairo_t *cr;
+    GdkPixbuf *pixbuf = (GdkPixbuf *) data;
+       
+    cr = gdk_cairo_create(widget->window);
+    gdk_cairo_region(cr, event->region);
+    cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
+    gdk_cairo_set_source_pixbuf(cr, pixbuf, 0.0, 0.0);
+    cairo_paint(cr);
+    cairo_destroy(cr);
+    return TRUE;
+}
+void
+realize (GtkWidget *widget)
+{
+    GdkScreen *screen;
+    screen = gtk_widget_get_screen (widget);
+    gtk_widget_set_colormap (widget, gdk_screen_get_rgba_colormap (screen));
+}
+
+void
+init_applet_position(void)
+{
+  /* To Do Must be Only 1 per secund */
+  GSList *position = NULL;
+  gchar *position_key;
+  gchar *modified_key;
+  gchar *modified;
+  GError *error = NULL;
+  GConfClient   *gconf_client = gconf_client_get_default ();
+  position_key = g_strdup_printf (GCONF_KEY_POSITION, PLUGIN_NAME);
+  position = gconf_client_get_list (gconf_client,
+                                    position_key,
+                                    GCONF_VALUE_INT,
+                                    NULL);
+  if (position && position->data && position->next->data){
+       xapplet = GPOINTER_TO_INT (position->data);
+       yapplet = GPOINTER_TO_INT (position->next->data);
+  }else{
+       fprintf(stderr,"Not position \n");
+       position = g_slist_prepend (g_slist_prepend (NULL,
+                                      GINT_TO_POINTER (Ystartposition)),
+                                     GINT_TO_POINTER (Xstartposition));
+       gconf_client_set_list (gconf_client,
+                               position_key,
+                               GCONF_VALUE_INT,
+                              position,
+                              &error);
+       xapplet = Xstartposition;
+       yapplet = Ystartposition;
+  }
+  g_free (position_key);
+  modified = g_strdup_printf ("%ld", 0);
+  modified_key = g_strdup_printf (GCONF_KEY_MODIFIED, PLUGIN_NAME);
+  gconf_client_set_string (gconf_client,
+                           modified_key,
+                           modified,
+                           &error);
+  fprintf(stderr,"position %i %i\n",xapplet, yapplet);
+  gconf_client_clear_cache(gconf_client);
+  g_object_unref(gconf_client);
+}
+
+actor_set_position_full(GtkWidget *actor, gint x, gint y, gint z)
+{
+ fprintf(stderr, "actor_set_position_full\n");
+ hildon_animation_actor_set_position_full (HILDON_ANIMATION_ACTOR (actor),x-xapplet, y-yapplet, z);
+}
+
+GtkWidget* init_object(gchar * name, gint x, gint y, gint z, gint width, gint height)
+{
+  Actor  a;  
+  GtkWidget *actor;
+  GdkPixbuf *pixbuf;
+  GtkWidget *image;
+
+  actor = hildon_animation_actor_new();
+  gchar str[256];
+  snprintf(str, 255, "/usr/share/anwall/%s.png", name);
+  //fprintf(stderr, "!!!init object !!!!\nname = %s file = %s\n", name, str);
+  pixbuf = gdk_pixbuf_new_from_file_at_size (str, 
+                                             width, 
+                                             height, 
+                                             NULL);
+  if (pixbuf){
+      image = gtk_image_new_from_pixbuf (pixbuf);
+      g_object_unref(G_OBJECT(pixbuf));
+  }
+  g_signal_connect(G_OBJECT(image), "expose_event",
+                           G_CALLBACK(expose_event), pixbuf);
+  gtk_container_add (GTK_CONTAINER (actor), image);
+
+   pixbuf = gdk_pixbuf_new_from_file_at_size ("/usr/share/anwall/cloud1.png", 
+                                             width, 
+                                             height, 
+                                             NULL);
+  if (pixbuf){
+      image = gtk_image_new_from_pixbuf (pixbuf);
+      g_object_unref(G_OBJECT(pixbuf));
+  }
+  g_signal_connect(G_OBJECT(image), "expose_event",
+                           G_CALLBACK(expose_event), pixbuf);
+
+  gtk_container_add (GTK_CONTAINER (actor), image);
+  actor_set_position_full(actor, x, y, z);
+  hildon_animation_actor_set_show (actor, 1);
+  realize(actor);
+  gtk_widget_show_all(actor);
+  g_object_set_data(G_OBJECT(actor), "name", name);
+  g_object_set_data(G_OBJECT(actor), "x", x);
+  g_object_set_data(G_OBJECT(actor), "y", y);
+  g_object_set_data(G_OBJECT(actor), "z", z);
+  g_object_set_data(G_OBJECT(actor), "scale", 10);
+
+  
+  //objects_list = g_slist_append(objects_list, G_OBJECT(actor));
+  //objects_list = g_slist_append(objects_list, G_OBJECT(a));
+  return actor;
+}
+
+void
+init_scene(GtkWidget *window)
+{
+  GtkWidget *actor;
+  GdkPixbuf *pixbuf;
+  GtkWidget *image;
+  double alt, azm;
+  gint x, y;
+
+  scene.window = window;
+  scene.daytime = get_daytime();
+  scene.dynamic_actors = NULL;
+  scene.static_actors = NULL;
+
+  get_sun_pos(&alt, &azm);
+  get_sun_screen_pos(alt, azm, &x, &y);
+  fprintf(stderr, "init scene\n");
+  actor = init_object("sun", x, y, 20, 88, 88);
+  hildon_animation_actor_set_parent (HILDON_ANIMATION_ACTOR (actor), window);
+  scene.static_actors = g_slist_append(scene.static_actors, G_OBJECT(actor));
+  scene.dynamic_actors = g_slist_append(scene.dynamic_actors, G_OBJECT(actor));
+
+  actor = init_object("sky", 0, 0, 0, 800, 480);
+  hildon_animation_actor_set_parent (HILDON_ANIMATION_ACTOR (actor), window);
+  scene.static_actors = g_slist_append(scene.static_actors, G_OBJECT(actor));
+
+  actor = init_object("town", 0, 0, 10, 800, 480);
+  hildon_animation_actor_set_parent (HILDON_ANIMATION_ACTOR (actor), window);
+  scene.static_actors = g_slist_append(scene.static_actors, G_OBJECT(actor));
+
+  actor = init_object("cloud1", 400, 150, 2, 200, 150);
+  hildon_animation_actor_set_parent (HILDON_ANIMATION_ACTOR (actor), window);
+  scene.dynamic_actors = g_slist_append(scene.dynamic_actors, G_OBJECT(actor));
+
+}
+
+static void
+example_label_home_applet_realize (GtkWidget *widget)
+{
+}
+void get_sun_screen_pos(double alt, double azm, gint * x, gint * y)
+{
+    gint y0 = 400;// - уровень горизонта
+    gint o_width = 128,
+         o_height = 
+    *x = (int)(azm * 800) - 64;
+    *y = (int)((1 - alt) * y0) - 64;
+}
+
+void change_actor(GtkWidget * actor)
+{
+    char * name;
+    gint x, y, daytime, sc;
+    double scale;
+    double alt, azm;
+    name = g_object_get_data(G_OBJECT(actor), "name");
+    fprintf(stderr, "change actor %s\n", name);
+    if (name == "sun"){
+        daytime = get_daytime();
+        if (daytime != TIME_NIGHT){
+            hildon_animation_actor_set_show(actor, 1);
+            get_sun_pos(&alt, &azm);
+            get_sun_screen_pos(alt, azm, &x, &y);
+            actor_set_position_full(actor, x, y, g_object_get_data(G_OBJECT(actor), "z"));
+        }
+    }
+    
+    if (name == "cloud1"){
+        x = g_object_get_data(G_OBJECT(actor), "x");
+        y = g_object_get_data(G_OBJECT(actor), "y");
+        sc = g_object_get_data(G_OBJECT(actor), "scale");
+        
+        x += 40;
+        y -= 20;
+        sc -= 1;
+        if (x > 600){
+            x = 400;
+            y = 150;
+            sc = 10;
+        }
+        scale = (double)sc / 10;
+        hildon_animation_actor_set_scale(actor, scale, scale);
+        fprintf(stderr, "cloud x=%d y=%d scale=%f", x, y, scale);
+        actor_set_position_full(actor, x, y, g_object_get_data(G_OBJECT(actor), "z"));
+        g_object_set_data(G_OBJECT(actor), "x", x);
+        g_object_set_data(G_OBJECT(actor), "y", y);
+        g_object_set_data(G_OBJECT(actor), "scale", sc);
+    }
+
+}
+
+static gboolean
+plugin_on_timeout (gpointer data)
+{
+  gint daytime = get_daytime();
+  GSList * tmp;
+  fprintf(stderr, "on timeout\n");
+
+  if (scene.daytime == daytime){
+      // change dynamic actors
+      tmp = scene.dynamic_actors;
+  }else {
+      // change static actors
+      tmp = scene.dynamic_actors;
+  } 
+  while (tmp != NULL){
+      change_actor(tmp->data);
+      tmp = g_slist_next(tmp);
+  }
+
+  scene.daytime = daytime;
+
+  //double azm, alt;
+  //get_sun_pos(&alt, &azm);
+/*
+  GSList * tmp = objects_list;
+  while (tmp != NULL){
+      //processing(tmp->data);
+      
+      str = g_object_get_data(G_OBJECT(tmp->data), "name");
+      fprintf(stderr, "object: %s\n", str);
+      
+      if (str == "sun"){
+        //get_sun_screen_pos(alt, azm, &x, &y);
+        //x = tmp->data
+        //actor_set_position_full(tmp->data, x, y, 20);
+        //g_object_set_data(G_OBJECT(tmp->data), "posX", x);
+        //g_object_set_data(G_OBJECT(tmp->data), "posY", y);
+        //fprintf(stderr, "x = %d y = %d\n", x, y);
+        child = gtk_container_get_children(GTK_CONTAINER (tmp->data));
+        while (child != NULL) {
+            gtk_container_remove(GTK_CONTAINER (tmp->data), child->data);
+            child = child->next;
+        }
+
+         //snprintf(str, 255, "/usr/share/anwall/%s.png", name);
+         //fprintf(stderr, "!!!init object !!!!\nname = %s file = %s\n", name, str);
+             
+      }
+      
+      if (str == "town"){
+          //hildon_animation_actor_set_show(tmp->data, 0);
+      }
+      //a = tmp->data;
+      //fprintf(stderr, "--timeout %s\n", a->name);
+      tmp = g_slist_next(tmp);
+  }
+  */
+  return TRUE; /* keep running this event */
+}
+
+static void
+animation_wallpaper_plugin_init (AWallpaperPlugin *desktop_plugin)
+{
+  GtkWidget *label;
+  label = gtk_label_new (""); 
+  gtk_widget_show (label);
+  gtk_container_add (GTK_CONTAINER (desktop_plugin), label);
+  init_applet_position();
+  init_scene(desktop_plugin);
+  desktop_plugin->timer = g_timeout_add(1000*10, plugin_on_timeout, desktop_plugin);
+}
+
+static void
+animation_wallpaper_plugin_class_init (AWallpaperPluginClass *klass) {}
+
+static void
+animation_wallpaper_plugin_class_finalize (AWallpaperPluginClass *class) {}
diff --git a/applet/src/livewp-home-widget.h b/applet/src/livewp-home-widget.h
new file mode 100644 (file)
index 0000000..1b56087
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+ * This file is part of Live Wallpaper (livewp)
+ * 
+ * Copyright (C) 2010 Vlad Vasiliev
+ * Copyright (C) 2010 Tanya Makova
+ *       for the code
+ * 
+ * This software is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+*/
+/*******************************************************************************/
+#ifndef Animation_Wallpaper_PLUGIN_H
+#define Animation_Wallpaper_PLUGIN_H
+
+#include <glib-object.h>
+
+#include <libhildondesktop/libhildondesktop.h>
+
+G_BEGIN_DECLS
+
+typedef struct _AWallpaperPlugin AWallpaperPlugin;
+typedef struct _AWallpaperPluginClass AWallpaperPluginClass;
+
+#define Animation_Wallpaper_TYPE_HOME_PLUGIN (animation_wallpaper_home_plugin_get_type ())
+
+#define Animation_Wallpaper_HOME_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+                        Animation_Wallpaper_TYPE_HOME_PLUGIN, AWallpaperHomePlugin))
+
+#define Animation_Wallpaper_HOME_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
+                        Animation_Wallpaper_TYPE_HOME_PLUGIN, AWallpaperHomePluginClass))
+
+#define Animation_Wallpaper_IS_HOME_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+                        Animation_Wallpaper_TYPE_HOME_PLUGIN))
+
+#define Animation_Wallpaper_IS_HOME_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+                        Animation_Wallpaper_TYPE_HOME_PLUGIN))
+
+#define Animation_Wallpaper_HOME_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+                        Animation_Wallpaper_TYPE_HOME_PLUGIN, AWallpaperHomePluginClass))
+
+struct _AWallpaperPlugin
+{
+    HDHomePluginItem hitem;
+    GObject *parent;
+    gint timer;
+};
+
+struct _AWallpaperPluginClass
+{
+    HDHomePluginItemClass parent_class;
+
+};
+
+typedef struct {
+    GtkWidget * window;
+    GSList * static_actors;
+    GSList * dynamic_actors;
+    gint daytime;
+} Scene;
+
+typedef struct {
+    GtkWidget * widget;
+    gchar * name;
+    gchar * filename;
+    gint x;
+    gint y;
+    gint z;
+    gint widht;
+    gint height;
+    gboolean visible;
+
+} Actor;
+
+GType animation_wallpaper_home_plugin_get_type(void);
+
+G_END_DECLS
+
+#endif
diff --git a/applet/src/livewp-rules.c b/applet/src/livewp-rules.c
new file mode 100644 (file)
index 0000000..791ba94
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ * This file is part of Live Wallpaper (livewp)
+ * 
+ * Copyright (C) 2010 Vlad Vasiliev
+ * Copyright (C) 2010 Tanya Makova
+ *       for the code
+ * 
+ * This software is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+*/
+/*******************************************************************************/
+
+#include "livewp-rules.h"
+
+/*******************************************************************************/
+
+void get_localtime(int * year, int * month, int * day, int * hour, int * min, int * zone)
+{
+    time_t timet;
+    struct tm nt;
+    time(&timet);
+    localtime_r(&timet, &nt);
+    *year = nt.tm_year + 1900;
+    *month = nt.tm_mon + 1;
+    *day = nt.tm_mday;
+    *hour = nt.tm_hour;
+    *min = nt.tm_min;
+    *zone = nt.tm_gmtoff/3600;
+  /* 
+ *year = 2010;
+    *month = 3;
+    *day = 24;
+    *hour = 16;
+    *min = 20;
+    *zone = 2;*/
+}
+
+void get_coord(double * lat, double * lon)
+{
+    *lat = 55.166666;
+    *lon = 30.166666;
+}
+
+void get_sun_pos(double * alt, double * azm)
+{
+    int year, month, day, hour, min, zone;
+    double lat, lon;
+    get_localtime(&year, &month, &day, &hour, &min, &zone);
+    get_coord(&lat, &lon);
+    *alt = altitude(lon, lat, year, month, day, hour, min, zone);
+    *alt = *alt / 70; // sun height in percent
+
+    *azm = azimuth(lon, lat, year, month, day, hour, min, zone);
+    //if south latitude
+    if (lat < 0){
+        *azm = 90 + (90 - *azm);
+        *azm = fmod(*azm, 360);
+    }
+    *azm = (*azm - 90) / 180; // sun azimuth in percent
+}
+int get_daytime()
+{
+    double alt, azm;
+    get_sun_pos(&alt, &azm);
+    alt = alt * 100;
+    azm = azm * 100;
+    printf("alt = %f azm=%f\n", alt, azm);
+    if (alt <= -7) return TIME_NIGHT;
+    if (alt > -7 && alt < 7 && azm < 50) return TIME_SUNRISE;
+    if (alt > 7 && alt < azm > 50) return TIME_SUNSET;
+    if (alt >= 7) return TIME_DAY;
+    
+}
+int get_moon_phase()
+{ 
+    int year, month, day, hour, min, zone;
+    double phase;
+    get_localtime(&year, &month, &day, &hour, &min, &zone);
+    phase = moon_phase(year, month, day) * 100;
+    printf("ph = %f\n", phase);
+    if (phase <= 3 || phase >=97) return MOON_NONE;
+    if (phase > 5 && phase <= 25) return MOON_GROWS;
+    if (phase > 25 && phase <= 45) return MOON_GROWSHALF;
+    if (phase > 45 && phase <= 55) return MOON_FULL;
+    if (phase > 55 && phase <= 75) return MOON_DECREASHALF;
+    if (phase > 75 && phase < 97) return MOON_DECREAS;
+}
diff --git a/applet/src/livewp-rules.h b/applet/src/livewp-rules.h
new file mode 100644 (file)
index 0000000..3cba194
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * This file is part of Live Wallpaper (livewp)
+ * 
+ * Copyright (C) 2010 Vlad Vasiliev
+ * Copyright (C) 2010 Tanya Makova
+ *       for the code
+ * 
+ * This software is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+*/
+/*******************************************************************************/
+#ifndef _livewp_rules_h
+#define _livewp_rules_h 1
+/*******************************************************************************/
+#include <time.h>
+#include "livewp-astro.h"
+/*******************************************************************************/
+#define TIME_DAY        0
+#define TIME_NIGHT      1
+#define TIME_SUNRISE    2
+#define TIME_SUNSET     3
+
+#define MOON_NONE               0
+#define MOON_GROWS              1
+#define MOON_GROWSHALF          2
+#define MOON_FULL               3 
+#define MOON_DECREASHALF        4
+#define MOON_DECREAS            5
+
+/*******************************************************************************/
+void get_localtime(int * year, int * month, int * day, int * hour, int * min, int * zone);
+void get_coord(double * lat, double * lon);
+void get_sun_pos(double * alt, double * azm);
+int get_daytime();
+int get_moon_phase();
+/*******************************************************************************/
+#endif