2c38d96ada353bb744b4d792dbbb4322edf99710
[livewp] / applet / src / livewp-common.h
1 /* vim: set sw=4 ts=4 et: */
2 /*
3  * This file is part of Live Wallpaper (livewp)
4  * 
5  * Copyright (C) 2010 Vlad Vasiliev
6  * Copyright (C) 2010 Tanya Makova
7  *       for the code
8  * 
9  * This software is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public License
11  * as published by the Free Software Foundation; either version 2.1 of
12  * the License, or (at your option) any later version.
13  * 
14  * This software is distributed in the hope that it will be useful, but
15  * WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  * 
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this software; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
22  * 02110-1301 USA
23 */
24 /*******************************************************************************/
25 #ifndef _weather_common_h
26 #define _weather_common_h 1
27 #ifdef HAVE_CONFIG_H
28 #include <config.h>
29 #endif
30
31 #include <gtk/gtk.h>
32 #include <hildon/hildon.h>
33 #include <locale.h>
34 #include <libhildondesktop/libhildondesktop.h>
35 #include <libosso.h>
36
37 #define GETTEXT_PACKAGE "livewp"
38 #include <glib/gi18n-lib.h>
39
40 #define THEME_PATH "/usr/share/livewp/theme"
41 #define SHORT_TIMER 75 /* 100 milisecond */
42 //#define LONG_TIMER 5*60*1000 /* 10 minutes */
43 #define LONG_TIMER  20*1000 /* 10 minutes */
44 enum { SHORT_TIMER_TYPE, LONG_TIMER_TYPE };
45 #define SKY_LEVEL 0 
46 #define SUN_LEVEL 0 
47 #define TOWN_LEVEL 0 
48 #define TRAM_LEVEL 20 
49
50 typedef struct _Scene Scene;
51 typedef struct _Actor Actor;
52 typedef struct _AWallpaperPlugin AWallpaperPlugin;
53 typedef struct _AWallpaperPluginClass AWallpaperPluginClass;
54 typedef struct _Animation_WallpaperPrivate Animation_WallpaperPrivate;
55
56 struct _Animation_WallpaperPrivate
57 {
58     gint long_timer;
59     gint short_timer;
60     gchar *theme;
61     gboolean visible;
62     gboolean rich_animation;
63     GtkWidget *main_widget;
64     GtkWidget *right_corner;
65     AWallpaperPlugin *desktop_plugin;
66     DBusConnection      *dbus_conn;
67     DBusConnection      *dbus_conn_session;
68     osso_context_t      *osso;
69     Scene *scene;
70 };
71
72 struct _AWallpaperPlugin
73 {
74     HDHomePluginItem parent;
75     Animation_WallpaperPrivate *priv;
76 };
77
78 struct _AWallpaperPluginClass
79 {
80     HDHomePluginItemClass parent_class;
81
82 };
83
84 struct _Actor
85 {
86     GtkWidget * widget;
87     gchar  *name;
88     gchar *filename;
89     gint x;
90     gint y;
91     gint z;
92     gint width;
93     gint height;
94     gint scale;
95     gint opacity; 
96     gboolean visible;
97     void (*func_change)(gpointer, gpointer);
98     time_t time_start_animation;
99     gint duration_animation;
100     void (*func_probability)(gpointer);
101     GPtrArray *child;
102
103 };
104
105 struct _Scene 
106 {
107     GSList * actors;
108     gint daytime;
109     gint timer_type;
110     gint wind_orientation; // +/- 1
111     double wind_angle; // [-1 .. 1]
112     guint seed; /* init value for random  */
113 };
114 #define LIVEWP_SIGNAL_INTERFACE "org.maemo.livewp"
115 #define LIVEWP_SIGNAL_PATH "/org/maemo/livewp"
116 #define LIVEWP_SIGNAL_RELOAD_CONFIG_INTERFACE "org.maemo.livewp.reload_config"
117 #define LIVEWP_SIGNAL_RELOAD_CONFIG_PATH "/org/maemo/livewp/reload_config"
118 #define LIVEWP_RELOAD_CONFIG "reload_config"
119 #define LIVEWP_RELOAD_PLUGIN "reload_plugin"
120 #endif