Debian Codegraph @

weather/src/applet-struct.h

raw
1 /**
2 * This file is a part of the Cairo-Dock project
3 *
4 * Copyright : (C) see the 'copyright' file.
5 * E-mail : see the 'copyright' file.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 3
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20
21 #ifndef __CD_APPLET_STRUCT__
22 #define __CD_APPLET_STRUCT__
23
24 #include <cairo-dock.h>
25
26 #define WEATHER_NB_DAYS_MAX 8
27
28 #define WEATHER_RATIO_ICON_DESKLET .5
29
30 #define WEATHER_DEFAULT_NAME "weather"
31
32 // yahoo weather has no code location API
33 // it's possible to get a code (woeid) in the 'link' of the response, but that means that you already got a valid location
34 // so it's pretty useless
35 #undef CD_WEATHER_HAS_CODE_LOCATION
36
37 #define _display(cValue) ((cValue) == NULL || *((gchar*)cValue) == 'N' ? "?" : (const gchar*)(cValue))
38
39 struct _AppletConfig {
40 gchar *cLocationCode;
41 gboolean bISUnits;
42 gboolean bCurrentConditions;
43 gboolean bDisplayTemperature;
44 gint iNbDays;
45 gchar *cRenderer;
46 gint cDialogDuration;
47 gchar *cThemePath;
48 gboolean bDesklet3D;
49 gboolean bSetName;
50 } ;
51
52 typedef struct {
53 xmlChar *cTemp;
54 xmlChar *cSpeed;
55 xmlChar *cPressure;
56 } Unit;
57
58 typedef struct {
59 xmlChar *cIconNumber;
60 xmlChar *cDate;
61 xmlChar *cName;
62 xmlChar *cTempMax;
63 xmlChar *cTempMin;
64 xmlChar *cWeatherDescription;
65 } Day;
66
67 typedef struct {
68 xmlChar *cWindSpeed;
69 xmlChar *cWindDirection;
70 xmlChar *cPressure;
71 xmlChar *cHumidity;
72 xmlChar *cSunRise;
73 xmlChar *cSunSet;
74 int ttl; // in mn;
75 xmlChar *cDataAcquisitionDate;
76 Day now;
77 } CurrentContitions;
78
79 typedef struct {
80 Unit units;
81 CurrentContitions currentConditions;
82 Day days[WEATHER_NB_DAYS_MAX];
83 xmlChar *cCountry;
84 xmlChar *cCity;
85 xmlChar *cLink;
86 } CDWeatherData;
87
88 typedef struct {
89 gchar *cLocationCode;
90 gboolean bISUnits;
91 gboolean bCurrentConditions;
92 CDWeatherData wdata;
93 gboolean bErrorInThread;
94 GldiModuleInstance *pApplet;
95 } CDSharedMemory;
96
97 struct _AppletData {
98 CDWeatherData wdata;
99 GldiTask *pTask;
100 gboolean bErrorRetrievingData;
101 GList *pLocationsList;
102 gboolean bSetName;
103 gint iClickedDay;
104 GldiTask *pGetLocationTask;
105 gboolean bBusy;
106 GtkWidget *pCodeEntry;
107 } ;
108
109
110 #endif