70be6913bc0c47ee9759a3a6cf8f0385eb2fad9e
[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 _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     GtkWidget *main_widget;
90     GtkWidget *window;
91     GtkWidget *right_corner;
92     AWallpaperPlugin *desktop_plugin;
93     DBusConnection      *dbus_conn;
94     DBusConnection      *dbus_conn_session;
95     osso_context_t      *osso;
96     gint xapplet;
97     gint yapplet;
98     Scene *scene;
99     //GHashTable * hash_scene_func;
100     void (*scene_func)(gpointer);
101     GKeyFile *config_file;
102     gint view;
103     pid_t  pid;
104     pid_t  podpid;
105     guint view_notify;
106     guint alive_timer;
107     time_t last_alive_event;
108     gchar *theme_string_parametr1;
109     guint theme_int_parametr1;
110     gboolean theme_bool_parametr1;
111     GstElement *pipeline;
112     gboolean running;
113     GSList *extheme_list;
114     GHashTable *hash_theme;
115 };
116
117 struct _AWallpaperPlugin
118 {
119     HDHomePluginItem parent;
120     Animation_WallpaperPrivate *priv;
121 };
122
123 struct _AWallpaperPluginClass
124 {
125   HDHomePluginItemClass parent_class;
126 };
127
128
129 #define LIVEWP_SIGNAL_INTERFACE "org.maemo.livewp"
130 #define LIVEWP_SIGNAL_PATH "/org/maemo/livewp"
131 #define LIVEWP_SIGNAL_RELOAD_CONFIG_INTERFACE "org.maemo.livewp.reload_config"
132 #define LIVEWP_SIGNAL_RELOAD_CONFIG_PATH "/org/maemo/livewp/reload_config"
133 #define LIVEWP_RELOAD_CONFIG "reload_config"
134 #define LIVEWP_RELOAD_PLUGIN "reload_plugin"
135 #define LIVEWP_STOP_LIVEBG_ON_VIEW1 "stop_livebg_on_view1"
136 #define LIVEWP_STOP_LIVEBG_ON_VIEW2 "stop_livebg_on_view2"
137 #define LIVEWP_STOP_LIVEBG_ON_VIEW3 "stop_livebg_on_view3"
138 #define LIVEWP_STOP_LIVEBG_ON_VIEW4 "stop_livebg_on_view4"
139 #define LIVEWP_PAUSE_LIVEBG_ON_VIEW1 "pause_livebg_on_view1"
140 #define LIVEWP_PAUSE_LIVEBG_ON_VIEW2 "pause_livebg_on_view2"
141 #define LIVEWP_PAUSE_LIVEBG_ON_VIEW3 "pause_livebg_on_view3"
142 #define LIVEWP_PAUSE_LIVEBG_ON_VIEW4 "pause_livebg_on_view4"
143 #define LIVEWP_PAUSE_LIVEBG_ON_VIEW "pause_livebg_on_view"
144 #define LIVEWP_PLAY_LIVEBG_ON_VIEW1 "play_livebg_on_view1"
145 #define LIVEWP_PLAY_LIVEBG_ON_VIEW2 "play_livebg_on_view2"
146 #define LIVEWP_PLAY_LIVEBG_ON_VIEW3 "play_livebg_on_view3"
147 #define LIVEWP_PLAY_LIVEBG_ON_VIEW4 "play_livebg_on_view4"
148 #define LIVEWP_PLAY_LIVEBG_ON_VIEW "play_livebg_on_view"
149 #define LIVEWP_ALIVE_LIVEBG_ON_VIEW1 "alive_livebg_on_view1"
150 #define LIVEWP_ALIVE_LIVEBG_ON_VIEW2 "alive_livebg_on_view2"
151 #define LIVEWP_ALIVE_LIVEBG_ON_VIEW3 "alive_livebg_on_view3"
152 #define LIVEWP_ALIVE_LIVEBG_ON_VIEW4 "alive_livebg_on_view4"
153
154
155
156
157 /* For DBUS notification */
158 #define NOTIFY_SIGNAL_INTERFACE "org.freedesktop.Notifications"
159 #define NOTIFY_SIGNAL_PATH "/org/freedesktop/Notifications"
160 #define NOTIFY_MEMBER "Notify"
161 #define CLOSENOTIFY_MEMBER "NotificationClosed"
162
163 #endif