*/
/*******************************************************************************/
#include "livewp-actor.h"
-#include <sys/time.h>
-#include "livewp-rules.h"
Actor*
init_object(AWallpaperPlugin *desktop_plugin,
#define _livewp_actor_h 1
#include "livewp-common.h"
+#include <sys/time.h>
+#include "livewp-rules.h"
+typedef struct _Actor Actor;
+struct _Actor
+{
+ GtkWidget * widget;
+ GtkWidget * image;
+ gchar *name;
+ gchar *filename;
+ gint x;
+ gint y;
+ gint z;
+ gint width;
+ gint height;
+ gint scale;
+ gint opacity;
+ gboolean visible;
+ void (*func_change)(gpointer, gpointer);
+ time_t time_start_animation;
+ gint duration_animation;
+ void (*func_probability)(gpointer);
+ GPtrArray *child;
+};
+
+/*******************************************************************************/
Actor* init_object(AWallpaperPlugin *desktop_plugin,
gchar * name,
gchar * filename,
#define GETTEXT_PACKAGE "livewp"
#include <glib/gi18n-lib.h>
+/* Position of plugin on desktop */
+#define Xstartposition 700
+#define Ystartposition 448
+
#define THEME_PATH "/usr/share/livewp/theme"
#define SHORT_TIMER 75 /* 100 milisecond */
//#define LONG_TIMER 5*60*1000 /* 10 minutes */
#define TRAM_LEVEL 20
typedef struct _Scene Scene;
-typedef struct _Actor Actor;
typedef struct _AWallpaperPlugin AWallpaperPlugin;
typedef struct _AWallpaperPluginClass AWallpaperPluginClass;
typedef struct _Animation_WallpaperPrivate Animation_WallpaperPrivate;
};
-struct _Actor
-{
- GtkWidget * widget;
- gchar *name;
- gchar *filename;
- gint x;
- gint y;
- gint z;
- gint width;
- gint height;
- gint scale;
- gint opacity;
- gboolean visible;
- void (*func_change)(gpointer, gpointer);
- time_t time_start_animation;
- gint duration_animation;
- void (*func_probability)(gpointer);
- GPtrArray *child;
-
-};
struct _Scene
{
/*******************************************************************************/
#include "livewp-common.h"
#include "livewp-home-widget.h"
-#include "livewp-actor.h"
#include <gconf/gconf-client.h>
#include "livewp-rules.h"
#include <sys/time.h>
Animation_Wallpaper_TYPE_HOME_PLUGIN,\
Animation_WallpaperPrivate))
-/* Position of plugin on desktop */
-#define Xstartposition 700
-#define Ystartposition 448
-
-//gint xapplet = 0, yapplet = 0;
-
static void
lw_applet_realize (GtkWidget *widget)
{
gconf_client_clear_cache(gconf_client);
g_object_unref(gconf_client);
}
-
+#if 0
void
actor_set_position_full(GtkWidget *actor, gint x, gint y, gint z)
{
/* fprintf(stderr, "actor_set_position_full z=%d\n", z); */
hildon_animation_actor_set_position_full (HILDON_ANIMATION_ACTOR (actor),x-0, y-0, z);
}
-
+#endif
void
destroy_hildon_actor(Actor *actor)
}
-gint
-rnd(gint max)
-{
- srand(time(NULL));
- return rand() % max;
-}
-gint fast_rnd(gint max)
-{
- guint offset = 12923;
- guint multiplier = 4079;
-
- //*seed = *seed * multiplier + offset;
- //return (gint)(*seed % max);
- guint seed = time(NULL);
- return (gint)(seed % max);
-}
-
void
create_hildon_actor(Actor *actor, AWallpaperPlugin *desktop_plugin)
{
G_CALLBACK(expose_event), pixbuf);
gtk_container_add (GTK_CONTAINER (ha), image);
}
- //actor_set_position_full(ha, actor->x, actor->y, actor->z);
- //hildon_animation_actor_set_scale(HILDON_ANIMATION_ACTOR(ha), (double)actor->scale/100, (double)actor->scale/100);
realize(ha);
gtk_widget_show_all(ha);
- //hildon_animation_actor_set_show (HILDON_ANIMATION_ACTOR(ha), actor->visible);
/* TO DO check it */
/* gdk_flush (); */
- g_object_set_data(G_OBJECT(ha), "image", image);
+ //g_object_set_data(G_OBJECT(ha), "image", image);
+ actor->image = image;
hildon_animation_actor_set_parent (HILDON_ANIMATION_ACTOR (ha), GTK_WINDOW(desktop_plugin));
actor->widget = ha;
set_actor_position(actor, actor->x, actor->y, actor->z, desktop_plugin);
if (image){
g_signal_connect(G_OBJECT(image), "expose_event",
G_CALLBACK(expose_event), pixbuf);
- if (g_object_get_data(G_OBJECT(actor->widget), "image")){
- gtk_container_remove(GTK_CONTAINER(actor->widget), g_object_get_data(G_OBJECT(actor->widget), "image"));
+ //if (g_object_get_data(G_OBJECT(actor->widget), "image")){
+ if (actor->image){
+ gtk_container_remove(GTK_CONTAINER(actor->widget), actor->image);
}
- g_object_set_data(G_OBJECT(actor->widget), "image", image);
+ //g_object_set_data(G_OBJECT(actor->widget), "image", image);
+ actor->image = image;
gtk_container_add (GTK_CONTAINER (actor->widget), image);
realize(actor->widget);
gtk_widget_show_all(actor->widget);
}
-
-
-/*
-static gint
-get_time(gint t){
- // уравнение изменения времени
- return t*1.1;
-}
-*/
static void
destroy_scene(AWallpaperPlugin *desktop_plugin)
{
#define Animation_Wallpaper_PLUGIN_H
#include <glib-object.h>
+#include "livewp-actor.h"
G_BEGIN_DECLS
G_END_DECLS
void lw_settings(gpointer user_data, gpointer data);
-void actor_set_position_full(GtkWidget *actor, gint x, gint y, gint z);
+//void actor_set_position_full(GtkWidget *actor, gint x, gint y, gint z);
gint read_config(Animation_WallpaperPrivate *priv);
void save_config(Animation_WallpaperPrivate *priv);
void run_long_timeout(AWallpaperPlugin *desktop_plugin);
static void init_scene(AWallpaperPlugin *desktop_plugin);
static void init_scene1(AWallpaperPlugin *desktop_plugin);
static void init_scene2(AWallpaperPlugin *desktop_plugin);
-void set_actor_visible(Actor *actor, gboolean visible);
-void set_actor_scale(Actor *actor, double scalex, double scaley);
+//void set_actor_visible(Actor *actor, gboolean visible);
+//void set_actor_scale(Actor *actor, double scalex, double scaley);
void create_hildon_actor(Actor *actor, AWallpaperPlugin *desktop_plugin);
void get_sun_screen_pos(double alt, double azm, gint * x, gint * y);
void show_settings(GtkWidget *widget, Animation_WallpaperPrivate *priv);
return MOON_NONE;
}
+
+gint
+fast_rnd(gint max)
+{
+ guint offset = 12923;
+ guint multiplier = 4079;
+
+ //*seed = *seed * multiplier + offset;
+ //return (gint)(*seed % max);
+ guint seed = time(NULL);
+ return (gint)(seed % max);
+}
+
/*******************************************************************************/
#include <time.h>
#include "livewp-astro.h"
+#include "livewp-common.h"
/*******************************************************************************/
#define TIME_DAY 0
#define TIME_NIGHT 3
int get_moon_phase();
time_t get_next_sunrise();
time_t get_next_sunset();
+gint fast_rnd(gint max);
+
/*******************************************************************************/
#endif