3a55a9cb4cc8fea787be3b373c5b1a0dfc38390c
[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 General Public License
11  * as published by the Free Software Foundation; either version 2 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 _livewp_common_h
26 #define _livewp_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 #include <gconf/gconf-client.h>
37 #include <time.h> 
38 #include <X11/extensions/Xrender.h>
39 #include <gdk/gdkx.h>
40
41 #include <X11/Xatom.h>
42 /* Gstreamer */
43 #include <gst/gst.h>
44 #include <gst/interfaces/xoverlay.h>
45
46 #define GETTEXT_PACKAGE "livewp"
47 #include <glib/gi18n-lib.h>
48
49 /* Position of plugin on desktop */
50 #define Xstartposition 800
51 #define Ystartposition 480 
52
53 #define THEME_PATH "/usr/share/livewp/theme"
54 #define EXTHEME_PATH "/usr/share/livewp/external_themes/"
55 #define SHORT_TIMER 75 /* 100 milisecond */
56 //#define LONG_TIMER 5*60*1000 /* 10 minutes */
57 #define LONG_TIMER  20*1000 /* 20 seconds */
58 enum { SHORT_TIMER_TYPE, LONG_TIMER_TYPE };
59 #define SKY_LEVEL 0 
60 #define SUN_LEVEL 0 
61 #define TOWN_LEVEL 0 
62 #define TRAM_LEVEL 20 
63
64 typedef struct _Scene Scene;
65 struct _Scene 
66 {
67     GSList * actors;
68     gint daytime;
69     gint timer_type;
70     gint wind_orientation; // +/- 1
71     double wind_angle; // [-1 .. 1]
72     guint seed; /* init value for random  */
73     guint notification;
74 };
75
76 typedef struct _AWallpaperPlugin AWallpaperPlugin;
77 typedef struct _AWallpaperPluginClass AWallpaperPluginClass;
78 typedef struct _Animation_WallpaperPrivate Animation_WallpaperPrivate;
79
80
81
82 struct _Animation_WallpaperPrivate
83 {
84     gint long_timer;
85     gint short_timer;
86     gchar *theme;
87     gboolean visible;
88     gboolean rich_animation;
89     gboolean one_in_all_view;
90     GtkWidget *main_widget;
91     GtkWidget *window;
92     GtkWidget *right_corner;
93     AWallpaperPlugin *desktop_plugin;
94     DBusConnection      *dbus_conn;
95     DBusConnection      *dbus_conn_session;
96     osso_context_t      *osso;
97     gint xapplet;
98     gint yapplet;
99     Scene *scene;
100     //GHashTable * hash_scene_func;
101     void (*scene_func)(gpointer);
102     GKeyFile *config_file;
103     gint view;
104     pid_t  pid;
105     pid_t  podpid;
106     guint view_notify;
107     guint alive_timer;
108     time_t last_alive_event;
109     gchar *theme_string_parametr1;
110     guint theme_int_parametr1;
111     gboolean theme_bool_parametr1;
112     GstElement *pipeline;
113     gboolean running;
114     GSList *extheme_list;
115     GHashTable *hash_theme;
116 };
117
118 struct _AWallpaperPlugin
119 {
120     HDHomePluginItem parent;
121     Animation_WallpaperPrivate *priv;
122 };
123
124 struct _AWallpaperPluginClass
125 {
126   HDHomePluginItemClass parent_class;
127 };
128
129
130 #define LIVEWP_SIGNAL_INTERFACE "org.maemo.livewp"
131 #define LIVEWP_SIGNAL_PATH "/org/maemo/livewp"
132 #define LIVEWP_SIGNAL_RELOAD_CONFIG_INTERFACE "org.maemo.livewp.reload_config"
133 #define LIVEWP_SIGNAL_RELOAD_CONFIG_PATH "/org/maemo/livewp/reload_config"
134 #define LIVEWP_RELOAD_CONFIG "reload_config"
135 #define LIVEWP_RELOAD_PLUGIN "reload_plugin"
136 #define LIVEWP_STOP_LIVEBG_ON_VIEW1 "stop_livebg_on_view1"
137 #define LIVEWP_STOP_LIVEBG_ON_VIEW2 "stop_livebg_on_view2"
138 #define LIVEWP_STOP_LIVEBG_ON_VIEW3 "stop_livebg_on_view3"
139 #define LIVEWP_STOP_LIVEBG_ON_VIEW4 "stop_livebg_on_view4"
140 #define LIVEWP_PAUSE_LIVEBG_ON_VIEW1 "pause_livebg_on_view1"
141 #define LIVEWP_PAUSE_LIVEBG_ON_VIEW2 "pause_livebg_on_view2"
142 #define LIVEWP_PAUSE_LIVEBG_ON_VIEW3 "pause_livebg_on_view3"
143 #define LIVEWP_PAUSE_LIVEBG_ON_VIEW4 "pause_livebg_on_view4"
144 #define LIVEWP_PAUSE_LIVEBG_ON_VIEW "pause_livebg_on_view"
145 #define LIVEWP_PLAY_LIVEBG_ON_VIEW1 "play_livebg_on_view1"
146 #define LIVEWP_PLAY_LIVEBG_ON_VIEW2 "play_livebg_on_view2"
147 #define LIVEWP_PLAY_LIVEBG_ON_VIEW3 "play_livebg_on_view3"
148 #define LIVEWP_PLAY_LIVEBG_ON_VIEW4 "play_livebg_on_view4"
149 #define LIVEWP_PLAY_LIVEBG_ON_VIEW "play_livebg_on_view"
150 #define LIVEWP_ALIVE_LIVEBG_ON_VIEW1 "alive_livebg_on_view1"
151 #define LIVEWP_ALIVE_LIVEBG_ON_VIEW2 "alive_livebg_on_view2"
152 #define LIVEWP_ALIVE_LIVEBG_ON_VIEW3 "alive_livebg_on_view3"
153 #define LIVEWP_ALIVE_LIVEBG_ON_VIEW4 "alive_livebg_on_view4"
154
155
156
157
158 /* For DBUS notification */
159 #define NOTIFY_SIGNAL_INTERFACE "org.freedesktop.Notifications"
160 #define NOTIFY_SIGNAL_PATH "/org/freedesktop/Notifications"
161 #define NOTIFY_MEMBER "Notify"
162 #define CLOSENOTIFY_MEMBER "NotificationClosed"
163
164 #endif