1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /* mateweather-location.h - Location-handling code
3  *
4  * Copyright 2008, Red Hat, Inc.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public License
8  * as published by the Free Software Foundation; either version 2.1 of
9  * the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, see
18  * <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef __MATEWEATHER_LOCATIONS_H__
22 #define __MATEWEATHER_LOCATIONS_H__
23 
24 #ifndef MATEWEATHER_I_KNOW_THIS_IS_UNSTABLE
25 #error "libmateweather should only be used if you understand that it's subject to change, and is not supported as a fixed API/ABI or as part of the platform"
26 #endif
27 
28 #include <glib.h>
29 #include <libmateweather/mateweather-timezone.h>
30 #include <libmateweather/weather.h>
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 typedef struct _MateWeatherLocation MateWeatherLocation;
37 
38 typedef enum { /*< underscore_name=mateweather_location_level >*/
39     MATEWEATHER_LOCATION_WORLD,
40     MATEWEATHER_LOCATION_REGION,
41     MATEWEATHER_LOCATION_COUNTRY,
42     /* ADM1 = first-order administrative division = state/province, etc */
43     MATEWEATHER_LOCATION_ADM1,
44     /* ADM2 = second-order division = county, etc */
45     MATEWEATHER_LOCATION_ADM2,
46     MATEWEATHER_LOCATION_CITY,
47     MATEWEATHER_LOCATION_WEATHER_STATION
48 } MateWeatherLocationLevel;
49 
50 GType mateweather_location_get_type (void);
51 #define MATEWEATHER_TYPE_LOCATION (mateweather_location_get_type ())
52 
53 MateWeatherLocation      *mateweather_location_new_world      (gboolean           use_regions);
54 MateWeatherLocation      *mateweather_location_ref            (MateWeatherLocation  *loc);
55 void                   mateweather_location_unref          (MateWeatherLocation  *loc);
56 
57 const char            *mateweather_location_get_name       (MateWeatherLocation  *loc);
58 const char            *mateweather_location_get_sort_name  (MateWeatherLocation  *loc);
59 MateWeatherLocationLevel  mateweather_location_get_level      (MateWeatherLocation  *loc);
60 MateWeatherLocation      *mateweather_location_get_parent     (MateWeatherLocation  *loc);
61 
62 MateWeatherLocation     **mateweather_location_get_children   (MateWeatherLocation  *loc);
63 void                   mateweather_location_free_children  (MateWeatherLocation  *loc,
64 							 MateWeatherLocation **children);
65 
66 gboolean               mateweather_location_has_coords     (MateWeatherLocation  *loc);
67 void                   mateweather_location_get_coords     (MateWeatherLocation  *loc,
68 							 double            *latitude,
69 							 double            *longitude);
70 double                 mateweather_location_get_distance   (MateWeatherLocation  *loc,
71 							 MateWeatherLocation  *loc2);
72 
73 const char            *mateweather_location_get_country    (MateWeatherLocation  *loc);
74 
75 MateWeatherTimezone      *mateweather_location_get_timezone   (MateWeatherLocation  *loc);
76 MateWeatherTimezone     **mateweather_location_get_timezones  (MateWeatherLocation  *loc);
77 void                   mateweather_location_free_timezones (MateWeatherLocation  *loc,
78 							 MateWeatherTimezone **zones);
79 
80 const char            *mateweather_location_get_code       (MateWeatherLocation  *loc);
81 char                  *mateweather_location_get_city_name  (MateWeatherLocation  *loc);
82 
83 WeatherInfo           *mateweather_location_get_weather    (MateWeatherLocation  *loc);
84 
85 #ifdef __cplusplus
86 }
87 #endif
88 
89 #endif /* __MATEWEATHER_LOCATIONS_H__ */
90