Merging upstream version 0.7.0 (Closes: #493243, #510888, #567617, #699414, #709777...
[debian/lxpanel.git] / plugins / weather / location.h
1 /**
2 * Copyright (c) 2012-2014 Piotr Sipika; see the AUTHORS file for more.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 * See the COPYRIGHT file for more information.
19 */
20
21 /* Defines the layout of the location structure */
22
23 #ifndef LXWEATHER_LOCATION_HEADER
24 #define LXWEATHER_LOCATION_HEADER
25
26 #include <glib.h>
27 #include <string.h>
28
29 /* */
30 #define LOCATIONINFO_GROUP_NAME "Location"
31 #define LOCATIONINFO_GROUP_NAME_LENGTH strlen(LOCATIONINFO_GROUP_NAME)
32
33 /* LocationInfo struct definition */
34 typedef struct
35 {
36 gchar * pcAlias_;
37 gchar * pcCity_;
38 gchar * pcState_;
39 gchar * pcCountry_;
40 gchar * pcWOEID_;
41 gchar cUnits_;
42 guint uiInterval_;
43 gboolean bEnabled_;
44 } LocationInfo;
45
46 /* Configuration helpers */
47 typedef enum
48 {
49 ALIAS = 0,
50 CITY,
51 STATE,
52 COUNTRY,
53 WOEID,
54 UNITS,
55 INTERVAL,
56 ENABLED,
57 LOCATIONINFO_FIELD_COUNT
58 } LocationInfoField;
59
60 /* Defined in the .c file - specifies the array of field names */
61 extern const gchar * LocationInfoFieldNames[];
62
63 /**
64 * Provides the mechanism to free any data associated with
65 * the LocationInfo structure
66 *
67 * @param pData Entry to free.
68 *
69 */
70 void
71 freeLocation(gpointer pData);
72
73 /**
74 * Prints the contents of the supplied entry to stdout
75 *
76 * @param pEntry Entry contents of which to print.
77 *
78 */
79 void
80 printLocation(gpointer pEntry);
81
82 /**
83 * Sets the alias for the location
84 *
85 * @param pEntry Pointer to the location to modify
86 * @param pData Alias value to use
87 *
88 */
89 void
90 setLocationAlias(gpointer pEntry, gpointer pData);
91
92 /**
93 * Copies a location entry.
94 *
95 * @param pDestination Address of the pointer to the location to set.
96 * @param pSource Pointer to the location to use/copy.
97 *
98 * @note Destination is first freed, if non-NULL, otherwise a new allocation
99 * is made. Both source and destination locations must be released by
100 * the caller.
101 */
102 void
103 copyLocation(gpointer * pDestination, gpointer pSource);
104
105 #endif