122ca68c64471042aa7bcb8bdf27711db46dd6be
[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 SHORT_TIMER 75 /* 100 milisecond */
55 //#define LONG_TIMER 5*60*1000 /* 10 minutes */
56 #define LONG_TIMER  20*1000 /* 10 minutes */
57 enum { SHORT_TIMER_TYPE, LONG_TIMER_TYPE };
58 #define SKY_LEVEL 0 
59 #define SUN_LEVEL 0 
60 #define TOWN_LEVEL 0 
61 #define TRAM_LEVEL 20 
62
63 typedef struct _Scene Scene;
64 struct _Scene 
65 {
66     GSList * actors;
67     gint daytime;
68     gint timer_type;
69     gint wind_orientation; // +/- 1
70     double wind_angle; // [-1 .. 1]
71     guint seed; /* init value for random  */
72     guint notification;
73 };
74
75 typedef struct _AWallpaperPlugin AWallpaperPlugin;
76 typedef struct _AWallpaperPluginClass AWallpaperPluginClass;
77 typedef struct _Animation_WallpaperPrivate Animation_WallpaperPrivate;
78
79
80
81 struct _Animation_WallpaperPrivate
82 {
83     gint long_timer;
84     gint short_timer;
85     gchar *theme;
86     gboolean visible;
87     gboolean rich_animation;
88     GtkWidget *main_widget;
89     GtkWidget *window;
90     GtkWidget *right_corner;
91     AWallpaperPlugin *desktop_plugin;
92     DBusConnection      *dbus_conn;
93     DBusConnection      *dbus_conn_session;
94     osso_context_t      *osso;
95     gint xapplet;
96     gint yapplet;
97     Scene *scene;
98     GHashTable * hash_scene_func;
99     GKeyFile *config_file;
100     gint view;
101     pid_t  pid;
102     pid_t  podpid;
103     guint view_notify;
104     guint alive_timer;
105     time_t last_alive_event;
106     gchar *theme_string_parametr1;
107     GstElement *pipeline;
108 };
109
110 struct _AWallpaperPlugin
111 {
112     HDHomePluginItem parent;
113     Animation_WallpaperPrivate *priv;
114 };
115
116 struct _AWallpaperPluginClass
117 {
118   HDHomePluginItemClass parent_class;
119 };
120
121
122 #define LIVEWP_SIGNAL_INTERFACE "org.maemo.livewp"
123 #define LIVEWP_SIGNAL_PATH "/org/maemo/livewp"
124 #define LIVEWP_SIGNAL_RELOAD_CONFIG_INTERFACE "org.maemo.livewp.reload_config"
125 #define LIVEWP_SIGNAL_RELOAD_CONFIG_PATH "/org/maemo/livewp/reload_config"
126 #define LIVEWP_RELOAD_CONFIG "reload_config"
127 #define LIVEWP_RELOAD_PLUGIN "reload_plugin"
128 #define LIVEWP_STOP_LIVEBG_ON_VIEW1 "stop_livebg_on_view1"
129 #define LIVEWP_STOP_LIVEBG_ON_VIEW2 "stop_livebg_on_view2"
130 #define LIVEWP_STOP_LIVEBG_ON_VIEW3 "stop_livebg_on_view3"
131 #define LIVEWP_STOP_LIVEBG_ON_VIEW4 "stop_livebg_on_view4"
132 #define LIVEWP_PAUSE_LIVEBG_ON_VIEW1 "pause_livebg_on_view1"
133 #define LIVEWP_PAUSE_LIVEBG_ON_VIEW2 "pause_livebg_on_view2"
134 #define LIVEWP_PAUSE_LIVEBG_ON_VIEW3 "pause_livebg_on_view3"
135 #define LIVEWP_PAUSE_LIVEBG_ON_VIEW4 "pause_livebg_on_view4"
136 #define LIVEWP_PLAY_LIVEBG_ON_VIEW1 "play_livebg_on_view1"
137 #define LIVEWP_PLAY_LIVEBG_ON_VIEW2 "play_livebg_on_view2"
138 #define LIVEWP_PLAY_LIVEBG_ON_VIEW3 "play_livebg_on_view3"
139 #define LIVEWP_PLAY_LIVEBG_ON_VIEW4 "play_livebg_on_view4"
140 #define LIVEWP_ALIVE_LIVEBG_ON_VIEW1 "alive_livebg_on_view1"
141 #define LIVEWP_ALIVE_LIVEBG_ON_VIEW2 "alive_livebg_on_view2"
142 #define LIVEWP_ALIVE_LIVEBG_ON_VIEW3 "alive_livebg_on_view3"
143 #define LIVEWP_ALIVE_LIVEBG_ON_VIEW4 "alive_livebg_on_view4"
144
145
146
147
148 /* For DBUS notification */
149 #define NOTIFY_SIGNAL_INTERFACE "org.freedesktop.Notifications"
150 #define NOTIFY_SIGNAL_PATH "/org/freedesktop/Notifications"
151 #define NOTIFY_MEMBER "Notify"
152 #define CLOSENOTIFY_MEMBER "NotificationClosed"
153
154 #endif