not working
authorTanya <tanya@bookdmitri.oblgaz>
Sun, 28 Mar 2010 00:00:26 +0000 (03:00 +0300)
committerTanya <tanya@bookdmitri.oblgaz>
Sun, 28 Mar 2010 00:00:26 +0000 (03:00 +0300)
applet/src/Makefile
applet/src/Makefile.am
applet/src/livewp-home-widget.c
applet/src/livewp-multiactor.c [new file with mode: 0644]
applet/src/livewp-multiactor.h [new file with mode: 0644]

index af822f5..487225d 100644 (file)
@@ -52,7 +52,8 @@ 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 livewp-settings.lo
+       livewp-astro.lo livewp-rules.lo livewp-settings.lo \
+       livewp-multiactor.lo
 liblivewp_home_widget_la_OBJECTS =  \
        $(am_liblivewp_home_widget_la_OBJECTS)
 DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
@@ -60,6 +61,7 @@ depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
 DEP_FILES = ./$(DEPDIR)/livewp-astro.Plo \
        ./$(DEPDIR)/livewp-home-widget.Plo \
+       ./$(DEPDIR)/livewp-multiactor.Plo \
        ./$(DEPDIR)/livewp-rules.Plo \
        ./$(DEPDIR)/livewp-settings.Plo
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
@@ -190,7 +192,8 @@ 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 \
-                                  livewp-settings.c livewp-settings.h livewp-common.h 
+                                  livewp-settings.c livewp-settings.h livewp-common.h \
+                                  livewp-multiactor.c livewp-multiactor.h
 
 liblivewp_home_widget_la_LIBADD = $(EXAMPLE_LIBS) 
 AM_CFLAGS = -Wall $(EXAMPLE_CFLAGS) 
@@ -265,6 +268,7 @@ distclean-compile:
 
 include ./$(DEPDIR)/livewp-astro.Plo
 include ./$(DEPDIR)/livewp-home-widget.Plo
+include ./$(DEPDIR)/livewp-multiactor.Plo
 include ./$(DEPDIR)/livewp-rules.Plo
 include ./$(DEPDIR)/livewp-settings.Plo
 
index 9393939..23c9dec 100644 (file)
@@ -6,7 +6,8 @@ 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 \
-                                  livewp-settings.c livewp-settings.h livewp-common.h 
+                                  livewp-settings.c livewp-settings.h livewp-common.h \
+                                  livewp-multiactor.c livewp-multiactor.h
 
 liblivewp_home_widget_la_LIBADD = $(EXAMPLE_LIBS) 
 
index 27c6e48..c7eb65b 100644 (file)
@@ -26,6 +26,7 @@
 #include "livewp-home-widget.h"
 #include <gconf/gconf-client.h>
 #include "livewp-rules.h"
+#include "livewp-multiactor.h"
 
 #define PLUGIN_NAME "livewp-home-widget.desktop-0"
 #define GCONF_KEY_POSITION "/apps/osso/hildon-desktop/applets/%s/position"
@@ -44,6 +45,7 @@ HD_DEFINE_PLUGIN_MODULE (AWallpaperPlugin, animation_wallpaper_plugin, HD_TYPE_H
 
 gint xapplet = 0, yapplet = 0;
 GSList * objects_list = NULL;
+MultiActor * multiactor1;
 Scene scene;
 
 static void
@@ -158,7 +160,6 @@ actor_set_position_full(GtkWidget *actor, gint x, gint y, gint z)
 static GtkWidget* 
 init_object(gchar * name, gint x, gint y, gint z, gint width, gint height)
 {
-  Actor  a;  
   GtkWidget *actor;
   GdkPixbuf *pixbuf;
   GtkWidget *image;
@@ -167,7 +168,7 @@ init_object(gchar * name, gint x, gint y, gint z, gint width, gint height)
   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); */
+  //fprintf(stderr, "!!!init object !!!!\nname = %s file = %s\n", name, str);
   pixbuf = gdk_pixbuf_new_from_file_at_size (str, 
                                              width, 
                                              height, 
@@ -191,6 +192,9 @@ init_object(gchar * name, gint x, gint y, gint z, gint width, gint height)
   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);
+  g_object_set_data(G_OBJECT(actor), "visible", 1);
+  
+  hildon_animation_actor_set_parent (HILDON_ANIMATION_ACTOR (actor), scene.window);
 /*
   a.widget = actor;
   a.name = name;
@@ -221,22 +225,29 @@ init_scene(GtkWidget *window)
   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));
 
+  GSList * list = NULL;
+  actor = init_object("sun", 10, 10, 50, 88, 88);
+  list = g_slist_append(list, G_OBJECT(actor));
+  actor = init_object("cloud1", 50, 50, 49, 150, 100);
+  list = g_slist_append(list, G_OBJECT(actor));
+
+  multiactor1 = multiactor_init("multi", list, 0, 0, 50, 1.0, TRUE);
+  fprintf(stderr, "create multiactor ma=%p name=%s\n", multiactor1, multiactor1->name);
+  //objects_list = g_slist_append(objects_list, G_OBJECT(ma)); 
+  
+
 }
 
 void 
@@ -249,6 +260,11 @@ get_sun_screen_pos(double alt, double azm, gint * x, gint * y)
     *y = (int)((1 - alt) * y0) - 64;
 }
 
+void change_multiactor()
+{
+    //fprintf(stderr, "change multiactotr p=%p name= %s x=%d\n", multiactor1, multiactor1->name, multiactor1->x);
+}
+
 static void 
 change_actor(GtkWidget * actor)
 {
@@ -323,6 +339,9 @@ plugin_on_timeout (gpointer data)
   GSList * tmp;
   fprintf(stderr, "on timeout\n");
 
+  //change_multiactor();
+  //fprintf(stderr, "create multiactor ma=%p name=%s\n", multiactor1, multiactor1->name);
+
   if (scene.daytime == daytime){
       /* Change dynamic actors */
       tmp = scene.dynamic_actors;
diff --git a/applet/src/livewp-multiactor.c b/applet/src/livewp-multiactor.c
new file mode 100644 (file)
index 0000000..de39357
--- /dev/null
@@ -0,0 +1,69 @@
+/* vim: set sw=4 ts=4 et: */
+/*
+ * 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-multiactor.h"
+
+MultiActor * multiactor_init(gchar * name, GSList * child, gint x, gint y, gint z, double scale, gboolean visible)
+{
+    MultiActor ma, *p;
+    ma.name = name;
+    ma.child = child;
+    ma.x = x;
+    ma.y = y;
+    ma.z = z;
+    ma.scale = scale;
+    ma.visible = visible;
+
+    p = &ma;
+    fprintf(stderr, "init multiactor p=%p name=%s\n", p, p->name);
+
+    return p;
+}
+
+void multiactor_set_visible(MultiActor *ma, gboolean visible)
+{
+    GSList * tmp = ma->child;
+    gboolean cur_visible;
+    while (tmp != NULL){
+        if (visible == FALSE){
+            // hide all
+            hildon_animate_actor_set_show(tmp->data, visible);
+        }else {
+            // show only needed
+            cur_visible = g_object_get_data(G_OBJECT(tmp->data), "visible");
+            if (cur_visible) hildon_animate_actor_set_show(tmp->data, visible);
+        }
+        tmp = g_slist_next(tmp);
+    }
+    ma->visible = visible;
+}
+void multiactor_set_scale(MultiActor *ma, double scale)
+{
+    GSList * tmp = ma->child;
+    while (tmp != NULL){
+        hildon_animate_actor_set_scale(tmp->data, scale, scale);
+        tmp = g_slist_next(tmp);
+    }
+    ma->scale = scale;
+}
diff --git a/applet/src/livewp-multiactor.h b/applet/src/livewp-multiactor.h
new file mode 100644 (file)
index 0000000..a08857b
--- /dev/null
@@ -0,0 +1,46 @@
+/* vim: set sw=4 ts=4 et: */
+/*
+ * 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_multiactor_h
+#define _livewp_multiactor_h 1
+/*******************************************************************************/
+#include <glib-object.h>
+
+#include <libhildondesktop/libhildondesktop.h>
+
+typedef struct {
+    gchar * name;
+    GSList * child;
+    gint x;
+    gint y;
+    gint z;
+    double scale;
+    gboolean visible;
+
+} MultiActor;
+/*******************************************************************************/
+MultiActor * multiactor_init(gchar * name, GSList * child, gint x, gint y, gint z, double scale, gboolean visible);
+void multiactor_set_visible(MultiActor *ma, gboolean visible);
+void multiactor_set_scale(MultiActor *ma, double scale);
+#endif