~ubuntu-branches/ubuntu/vivid/gnome-clocks/vivid

« back to all changes in this revision

Viewing changes to src/geocoding.c

  • Committer: Package Import Robot
  • Author(s): Martin Pitt
  • Date: 2014-01-16 17:34:02 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20140116173402-6n9l3axnfdo1hjtt
Tags: 3.10.1-0ubuntu1
* New upstream release that works with current libgweather.
* debian/control.in: Bump gtk and libgweather build deps, add
  libgeocode-glib-dev and geoclue-2.0 build deps as per upstream
  configure.ac.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* geocoding.c generated by valac 0.22.0.21-8a007, the Vala compiler
 
2
 * generated from geocoding.vala, do not modify */
 
3
 
 
4
/*
 
5
 * Copyright (C) 2013  Evgeny Bobkin <evgen.ibqn@gmail.com>
 
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 2
 
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
 *
 
17
 * You should have received a copy of the GNU General Public License
 
18
 * along with this program; if not, write to the Free Software
 
19
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
20
 */
 
21
 
 
22
#include <glib.h>
 
23
#include <glib-object.h>
 
24
#include <gio/gio.h>
 
25
#include <stdlib.h>
 
26
#include <string.h>
 
27
#include <float.h>
 
28
#include <math.h>
 
29
#include <libgweather/gweather.h>
 
30
#include <geocode-glib/geocode-glib.h>
 
31
 
 
32
 
 
33
#define CLOCKS_GEO_TYPE_MANAGER (clocks_geo_manager_get_type ())
 
34
#define CLOCKS_GEO_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLOCKS_GEO_TYPE_MANAGER, ClocksGeoManager))
 
35
#define CLOCKS_GEO_IS_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLOCKS_GEO_TYPE_MANAGER))
 
36
#define CLOCKS_GEO_MANAGER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CLOCKS_GEO_TYPE_MANAGER, ClocksGeoManagerIface))
 
37
 
 
38
typedef struct _ClocksGeoManager ClocksGeoManager;
 
39
typedef struct _ClocksGeoManagerIface ClocksGeoManagerIface;
 
40
 
 
41
#define CLOCKS_GEO_TYPE_MANAGER_PROXY (clocks_geo_manager_proxy_get_type ())
 
42
typedef GDBusProxy ClocksGeoManagerProxy;
 
43
typedef GDBusProxyClass ClocksGeoManagerProxyClass;
 
44
#define _g_free0(var) (var = (g_free (var), NULL))
 
45
 
 
46
#define CLOCKS_GEO_TYPE_CLIENT (clocks_geo_client_get_type ())
 
47
#define CLOCKS_GEO_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLOCKS_GEO_TYPE_CLIENT, ClocksGeoClient))
 
48
#define CLOCKS_GEO_IS_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLOCKS_GEO_TYPE_CLIENT))
 
49
#define CLOCKS_GEO_CLIENT_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CLOCKS_GEO_TYPE_CLIENT, ClocksGeoClientIface))
 
50
 
 
51
typedef struct _ClocksGeoClient ClocksGeoClient;
 
52
typedef struct _ClocksGeoClientIface ClocksGeoClientIface;
 
53
 
 
54
#define CLOCKS_GEO_TYPE_CLIENT_PROXY (clocks_geo_client_proxy_get_type ())
 
55
typedef GDBusProxy ClocksGeoClientProxy;
 
56
typedef GDBusProxyClass ClocksGeoClientProxyClass;
 
57
 
 
58
#define CLOCKS_GEO_TYPE_LOCATION (clocks_geo_location_get_type ())
 
59
#define CLOCKS_GEO_LOCATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLOCKS_GEO_TYPE_LOCATION, ClocksGeoLocation))
 
60
#define CLOCKS_GEO_IS_LOCATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLOCKS_GEO_TYPE_LOCATION))
 
61
#define CLOCKS_GEO_LOCATION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CLOCKS_GEO_TYPE_LOCATION, ClocksGeoLocationIface))
 
62
 
 
63
typedef struct _ClocksGeoLocation ClocksGeoLocation;
 
64
typedef struct _ClocksGeoLocationIface ClocksGeoLocationIface;
 
65
 
 
66
#define CLOCKS_GEO_TYPE_LOCATION_PROXY (clocks_geo_location_proxy_get_type ())
 
67
typedef GDBusProxy ClocksGeoLocationProxy;
 
68
typedef GDBusProxyClass ClocksGeoLocationProxyClass;
 
69
 
 
70
#define CLOCKS_GEO_TYPE_INFO (clocks_geo_info_get_type ())
 
71
#define CLOCKS_GEO_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLOCKS_GEO_TYPE_INFO, ClocksGeoInfo))
 
72
#define CLOCKS_GEO_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLOCKS_GEO_TYPE_INFO, ClocksGeoInfoClass))
 
73
#define CLOCKS_GEO_IS_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLOCKS_GEO_TYPE_INFO))
 
74
#define CLOCKS_GEO_IS_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLOCKS_GEO_TYPE_INFO))
 
75
#define CLOCKS_GEO_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLOCKS_GEO_TYPE_INFO, ClocksGeoInfoClass))
 
76
 
 
77
typedef struct _ClocksGeoInfo ClocksGeoInfo;
 
78
typedef struct _ClocksGeoInfoClass ClocksGeoInfoClass;
 
79
typedef struct _ClocksGeoInfoPrivate ClocksGeoInfoPrivate;
 
80
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
 
81
#define _gweather_location_unref0(var) ((var == NULL) ? NULL : (var = (gweather_location_unref (var), NULL)))
 
82
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
 
83
typedef struct _ClocksGeoInfoSeekData ClocksGeoInfoSeekData;
 
84
typedef struct _ClocksGeoInfoOnLocationUpdatedData ClocksGeoInfoOnLocationUpdatedData;
 
85
typedef struct _ClocksGeoInfoSeekCountryCodeData ClocksGeoInfoSeekCountryCodeData;
 
86
typedef struct _ClocksGeoInfoSearchLocationsData ClocksGeoInfoSearchLocationsData;
 
87
#define _gweather_timezone_unref0(var) ((var == NULL) ? NULL : (var = (gweather_timezone_unref (var), NULL)))
 
88
 
 
89
struct _ClocksGeoManagerIface {
 
90
        GTypeInterface parent_iface;
 
91
        void (*get_client) (ClocksGeoManager* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
 
92
        void (*get_client_finish) (ClocksGeoManager* self, GAsyncResult* _res_, gchar** client_path, GError** error);
 
93
};
 
94
 
 
95
struct _ClocksGeoClientIface {
 
96
        GTypeInterface parent_iface;
 
97
        void (*start) (ClocksGeoClient* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
 
98
        void (*start_finish) (ClocksGeoClient* self, GAsyncResult* _res_, GError** error);
 
99
        gchar* (*get_location) (ClocksGeoClient* self);
 
100
        guint (*get_distance_threshold) (ClocksGeoClient* self);
 
101
        void (*set_distance_threshold) (ClocksGeoClient* self, guint value);
 
102
};
 
103
 
 
104
struct _ClocksGeoLocationIface {
 
105
        GTypeInterface parent_iface;
 
106
        gdouble (*get_latitude) (ClocksGeoLocation* self);
 
107
        gdouble (*get_longitude) (ClocksGeoLocation* self);
 
108
        gdouble (*get_accuracy) (ClocksGeoLocation* self);
 
109
        gchar* (*get_description) (ClocksGeoLocation* self);
 
110
};
 
111
 
 
112
struct _ClocksGeoInfo {
 
113
        GObject parent_instance;
 
114
        ClocksGeoInfoPrivate * priv;
 
115
};
 
116
 
 
117
struct _ClocksGeoInfoClass {
 
118
        GObjectClass parent_class;
 
119
};
 
120
 
 
121
struct _ClocksGeoInfoPrivate {
 
122
        ClocksGeoLocation* _geo_location;
 
123
        GWeatherLocation* found_location;
 
124
        gchar* country_code;
 
125
        ClocksGeoManager* manager;
 
126
        ClocksGeoClient* client;
 
127
        gdouble minimal_distance;
 
128
};
 
129
 
 
130
struct _ClocksGeoInfoSeekData {
 
131
        int _state_;
 
132
        GObject* _source_object_;
 
133
        GAsyncResult* _res_;
 
134
        GSimpleAsyncResult* _async_result;
 
135
        ClocksGeoInfo* self;
 
136
        gchar* client_path;
 
137
        ClocksGeoManager* _tmp0_;
 
138
        ClocksGeoManager* _tmp1_;
 
139
        GError* e;
 
140
        GError* _tmp2_;
 
141
        const gchar* _tmp3_;
 
142
        ClocksGeoManager* _tmp4_;
 
143
        gchar* _tmp5_;
 
144
        GError* _vala1_e;
 
145
        GError* _tmp6_;
 
146
        const gchar* _tmp7_;
 
147
        const gchar* _tmp8_;
 
148
        ClocksGeoClient* _tmp9_;
 
149
        const gchar* _tmp10_;
 
150
        ClocksGeoClient* _tmp11_;
 
151
        GError* _vala2_e;
 
152
        GError* _tmp12_;
 
153
        const gchar* _tmp13_;
 
154
        ClocksGeoClient* _tmp14_;
 
155
        ClocksGeoClient* _tmp15_;
 
156
        GError* _vala3_e;
 
157
        GError* _tmp16_;
 
158
        const gchar* _tmp17_;
 
159
        GError * _inner_error_;
 
160
};
 
161
 
 
162
struct _ClocksGeoInfoOnLocationUpdatedData {
 
163
        int _state_;
 
164
        GObject* _source_object_;
 
165
        GAsyncResult* _res_;
 
166
        GSimpleAsyncResult* _async_result;
 
167
        ClocksGeoInfo* self;
 
168
        gchar* old_path;
 
169
        gchar* new_path;
 
170
        ClocksGeoLocation* _tmp0_;
 
171
        const gchar* _tmp1_;
 
172
        ClocksGeoLocation* _tmp2_;
 
173
        ClocksGeoLocation* _tmp3_;
 
174
        GError* e;
 
175
        GError* _tmp4_;
 
176
        const gchar* _tmp5_;
 
177
        GWeatherLocation* _tmp6_;
 
178
        GWeatherLocation* _tmp7_;
 
179
        GWeatherLocation* _tmp8_;
 
180
        GError * _inner_error_;
 
181
};
 
182
 
 
183
struct _ClocksGeoInfoSeekCountryCodeData {
 
184
        int _state_;
 
185
        GObject* _source_object_;
 
186
        GAsyncResult* _res_;
 
187
        GSimpleAsyncResult* _async_result;
 
188
        ClocksGeoInfo* self;
 
189
        GeocodeLocation* location;
 
190
        ClocksGeoLocation* _tmp0_;
 
191
        gdouble _tmp1_;
 
192
        gdouble _tmp2_;
 
193
        ClocksGeoLocation* _tmp3_;
 
194
        gdouble _tmp4_;
 
195
        gdouble _tmp5_;
 
196
        GeocodeLocation* _tmp6_;
 
197
        GeocodeReverse* reverse;
 
198
        GeocodeReverse* _tmp7_;
 
199
        GeocodePlace* place;
 
200
        GeocodePlace* _tmp8_;
 
201
        const gchar* _tmp9_;
 
202
        gchar* _tmp10_;
 
203
        GError* e;
 
204
        GError* _tmp11_;
 
205
        const gchar* _tmp12_;
 
206
        GError * _inner_error_;
 
207
};
 
208
 
 
209
struct _ClocksGeoInfoSearchLocationsData {
 
210
        int _state_;
 
211
        GObject* _source_object_;
 
212
        GAsyncResult* _res_;
 
213
        GSimpleAsyncResult* _async_result;
 
214
        ClocksGeoInfo* self;
 
215
        GWeatherLocation* location;
 
216
        const gchar* _tmp0_;
 
217
        gchar* loc_country_code;
 
218
        GWeatherLocation* _tmp1_;
 
219
        const gchar* _tmp2_;
 
220
        gchar* _tmp3_;
 
221
        const gchar* _tmp4_;
 
222
        const gchar* _tmp5_;
 
223
        const gchar* _tmp6_;
 
224
        GWeatherLocation** locations;
 
225
        GWeatherLocation* _tmp7_;
 
226
        GWeatherLocation** _tmp8_;
 
227
        GWeatherLocation** _tmp9_;
 
228
        GWeatherLocation** _tmp10_;
 
229
        gint _tmp10__length1;
 
230
        gint locations_length1;
 
231
        gint _locations_size_;
 
232
        GWeatherLocation** _tmp11_;
 
233
        gint _tmp11__length1;
 
234
        gint i;
 
235
        gboolean _tmp12_;
 
236
        gboolean _tmp13_;
 
237
        gint _tmp14_;
 
238
        gint _tmp15_;
 
239
        GWeatherLocation** _tmp16_;
 
240
        gint _tmp16__length1;
 
241
        GWeatherLocation** _tmp17_;
 
242
        gint _tmp17__length1;
 
243
        gint _tmp18_;
 
244
        GWeatherLocation* _tmp19_;
 
245
        GWeatherLocationLevel _tmp20_;
 
246
        GWeatherLocation** _tmp21_;
 
247
        gint _tmp21__length1;
 
248
        gint _tmp22_;
 
249
        GWeatherLocation* _tmp23_;
 
250
        gboolean _tmp24_;
 
251
        gdouble latitude;
 
252
        gdouble longitude;
 
253
        gdouble distance;
 
254
        GWeatherLocation** _tmp25_;
 
255
        gint _tmp25__length1;
 
256
        gint _tmp26_;
 
257
        GWeatherLocation* _tmp27_;
 
258
        gdouble _tmp28_;
 
259
        gdouble _tmp29_;
 
260
        ClocksGeoLocation* _tmp30_;
 
261
        gdouble _tmp31_;
 
262
        gdouble _tmp32_;
 
263
        ClocksGeoLocation* _tmp33_;
 
264
        gdouble _tmp34_;
 
265
        gdouble _tmp35_;
 
266
        gdouble _tmp36_;
 
267
        gdouble _tmp37_;
 
268
        gdouble _tmp38_;
 
269
        gdouble _tmp39_;
 
270
        gdouble _tmp40_;
 
271
        GWeatherLocation** _tmp41_;
 
272
        gint _tmp41__length1;
 
273
        gint _tmp42_;
 
274
        GWeatherLocation* _tmp43_;
 
275
        GWeatherLocation* _tmp44_;
 
276
        gdouble _tmp45_;
 
277
        GWeatherLocation** _tmp46_;
 
278
        gint _tmp46__length1;
 
279
        gint _tmp47_;
 
280
        GWeatherLocation* _tmp48_;
 
281
};
 
282
 
 
283
 
 
284
static gpointer clocks_geo_info_parent_class = NULL;
 
285
 
 
286
GType clocks_geo_manager_proxy_get_type (void) G_GNUC_CONST;
 
287
guint clocks_geo_manager_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
 
288
GType clocks_geo_manager_get_type (void) G_GNUC_CONST;
 
289
void clocks_geo_manager_get_client (ClocksGeoManager* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
 
290
void clocks_geo_manager_get_client_finish (ClocksGeoManager* self, GAsyncResult* _res_, gchar** client_path, GError** error);
 
291
static void clocks_geo_manager_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters);
 
292
static void _vala_g_async_ready_callback (GObject *source_object, GAsyncResult *res, void *user_data);
 
293
static void clocks_geo_manager_proxy_get_client_async (ClocksGeoManager* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
 
294
static void clocks_geo_manager_proxy_get_client_finish (ClocksGeoManager* self, GAsyncResult* _res_, gchar** client_path, GError** error);
 
295
static void clocks_geo_manager_proxy_clocks_geo_manager_interface_init (ClocksGeoManagerIface* iface);
 
296
static void _dbus_clocks_geo_manager_get_client (ClocksGeoManager* self, GVariant* parameters, GDBusMethodInvocation* invocation);
 
297
static void _dbus_clocks_geo_manager_get_client_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_);
 
298
static void clocks_geo_manager_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data);
 
299
static GVariant* clocks_geo_manager_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data);
 
300
static gboolean clocks_geo_manager_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data);
 
301
static void _clocks_geo_manager_unregister_object (gpointer user_data);
 
302
GType clocks_geo_client_proxy_get_type (void) G_GNUC_CONST;
 
303
guint clocks_geo_client_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
 
304
GType clocks_geo_client_get_type (void) G_GNUC_CONST;
 
305
void clocks_geo_client_start (ClocksGeoClient* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
 
306
void clocks_geo_client_start_finish (ClocksGeoClient* self, GAsyncResult* _res_, GError** error);
 
307
gchar* clocks_geo_client_get_location (ClocksGeoClient* self);
 
308
guint clocks_geo_client_get_distance_threshold (ClocksGeoClient* self);
 
309
void clocks_geo_client_set_distance_threshold (ClocksGeoClient* self, guint value);
 
310
static void g_cclosure_user_marshal_VOID__STRING_STRING (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data);
 
311
static void clocks_geo_client_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters);
 
312
static void _dbus_handle_clocks_geo_client_location_updated (ClocksGeoClient* self, GVariant* parameters);
 
313
static void clocks_geo_client_proxy_start_async (ClocksGeoClient* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
 
314
static void clocks_geo_client_proxy_start_finish (ClocksGeoClient* self, GAsyncResult* _res_, GError** error);
 
315
static gchar* clocks_geo_client_dbus_proxy_get_location (ClocksGeoClient* self);
 
316
static guint clocks_geo_client_dbus_proxy_get_distance_threshold (ClocksGeoClient* self);
 
317
static void clocks_geo_client_dbus_proxy_set_distance_threshold (ClocksGeoClient* self, guint value);
 
318
static void clocks_geo_client_proxy_clocks_geo_client_interface_init (ClocksGeoClientIface* iface);
 
319
static void _dbus_clocks_geo_client_start (ClocksGeoClient* self, GVariant* parameters, GDBusMethodInvocation* invocation);
 
320
static void _dbus_clocks_geo_client_start_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_);
 
321
static void clocks_geo_client_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data);
 
322
static GVariant* clocks_geo_client_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data);
 
323
static GVariant* _dbus_clocks_geo_client_get_location (ClocksGeoClient* self);
 
324
static GVariant* _dbus_clocks_geo_client_get_distance_threshold (ClocksGeoClient* self);
 
325
static gboolean clocks_geo_client_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data);
 
326
static void _dbus_clocks_geo_client_set_distance_threshold (ClocksGeoClient* self, GVariant* _value);
 
327
static void _dbus_clocks_geo_client_location_updated (GObject* _sender, const gchar* old_path, const gchar* new_path, gpointer* _data);
 
328
static void _clocks_geo_client_unregister_object (gpointer user_data);
 
329
GType clocks_geo_location_get_type (void) G_GNUC_CONST;
 
330
GType clocks_geo_location_proxy_get_type (void) G_GNUC_CONST;
 
331
guint clocks_geo_location_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
 
332
gdouble clocks_geo_location_get_latitude (ClocksGeoLocation* self);
 
333
gdouble clocks_geo_location_get_longitude (ClocksGeoLocation* self);
 
334
gdouble clocks_geo_location_get_accuracy (ClocksGeoLocation* self);
 
335
gchar* clocks_geo_location_get_description (ClocksGeoLocation* self);
 
336
static void clocks_geo_location_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters);
 
337
static gdouble clocks_geo_location_dbus_proxy_get_latitude (ClocksGeoLocation* self);
 
338
static gdouble clocks_geo_location_dbus_proxy_get_longitude (ClocksGeoLocation* self);
 
339
static gdouble clocks_geo_location_dbus_proxy_get_accuracy (ClocksGeoLocation* self);
 
340
static gchar* clocks_geo_location_dbus_proxy_get_description (ClocksGeoLocation* self);
 
341
static void clocks_geo_location_proxy_clocks_geo_location_interface_init (ClocksGeoLocationIface* iface);
 
342
static void clocks_geo_location_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data);
 
343
static GVariant* clocks_geo_location_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data);
 
344
static GVariant* _dbus_clocks_geo_location_get_latitude (ClocksGeoLocation* self);
 
345
static GVariant* _dbus_clocks_geo_location_get_longitude (ClocksGeoLocation* self);
 
346
static GVariant* _dbus_clocks_geo_location_get_accuracy (ClocksGeoLocation* self);
 
347
static GVariant* _dbus_clocks_geo_location_get_description (ClocksGeoLocation* self);
 
348
static gboolean clocks_geo_location_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data);
 
349
static void _clocks_geo_location_unregister_object (gpointer user_data);
 
350
GType clocks_geo_info_get_type (void) G_GNUC_CONST;
 
351
#define CLOCKS_GEO_INFO_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CLOCKS_GEO_TYPE_INFO, ClocksGeoInfoPrivate))
 
352
enum  {
 
353
        CLOCKS_GEO_INFO_DUMMY_PROPERTY,
 
354
        CLOCKS_GEO_INFO_GEO_LOCATION
 
355
};
 
356
ClocksGeoInfo* clocks_geo_info_new (void);
 
357
ClocksGeoInfo* clocks_geo_info_construct (GType object_type);
 
358
static void clocks_geo_info_seek_data_free (gpointer _data);
 
359
void clocks_geo_info_seek (ClocksGeoInfo* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
 
360
void clocks_geo_info_seek_finish (ClocksGeoInfo* self, GAsyncResult* _res_);
 
361
static gboolean clocks_geo_info_seek_co (ClocksGeoInfoSeekData* _data_);
 
362
static void clocks_geo_info_seek_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
 
363
static void __lambda21_ (ClocksGeoInfo* self, const gchar* old_path, const gchar* new_path);
 
364
void clocks_geo_info_on_location_updated (ClocksGeoInfo* self, const gchar* old_path, const gchar* new_path, GAsyncReadyCallback _callback_, gpointer _user_data_);
 
365
void clocks_geo_info_on_location_updated_finish (ClocksGeoInfo* self, GAsyncResult* _res_);
 
366
static void __lambda22_ (ClocksGeoInfo* self, GObject* obj, GAsyncResult* res);
 
367
static void ___lambda22__gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self);
 
368
static void ___lambda21__clocks_geo_client_location_updated (ClocksGeoClient* _sender, const gchar* old_path, const gchar* new_path, gpointer self);
 
369
static void clocks_geo_info_on_location_updated_data_free (gpointer _data);
 
370
static gboolean clocks_geo_info_on_location_updated_co (ClocksGeoInfoOnLocationUpdatedData* _data_);
 
371
static void clocks_geo_info_on_location_updated_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
 
372
static void clocks_geo_info_set_geo_location (ClocksGeoInfo* self, ClocksGeoLocation* value);
 
373
static void clocks_geo_info_seek_country_code (ClocksGeoInfo* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
 
374
static void clocks_geo_info_seek_country_code_finish (ClocksGeoInfo* self, GAsyncResult* _res_);
 
375
static void clocks_geo_info_search_locations (ClocksGeoInfo* self, GWeatherLocation* location, GAsyncReadyCallback _callback_, gpointer _user_data_);
 
376
static void clocks_geo_info_search_locations_finish (ClocksGeoInfo* self, GAsyncResult* _res_);
 
377
static void clocks_geo_info_seek_country_code_data_free (gpointer _data);
 
378
static gboolean clocks_geo_info_seek_country_code_co (ClocksGeoInfoSeekCountryCodeData* _data_);
 
379
ClocksGeoLocation* clocks_geo_info_get_geo_location (ClocksGeoInfo* self);
 
380
static void clocks_geo_info_seek_country_code_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
 
381
static gdouble clocks_geo_info_deg_to_rad (ClocksGeoInfo* self, gdouble deg);
 
382
static gdouble clocks_geo_info_get_distance (ClocksGeoInfo* self, gdouble latitude1, gdouble longitude1, gdouble latitude2, gdouble longitude2);
 
383
static void clocks_geo_info_search_locations_data_free (gpointer _data);
 
384
static gboolean clocks_geo_info_search_locations_co (ClocksGeoInfoSearchLocationsData* _data_);
 
385
static GWeatherLocation** _vala_array_dup1 (GWeatherLocation** self, int length);
 
386
static void clocks_geo_info_search_locations_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
 
387
gboolean clocks_geo_info_is_location_similar (ClocksGeoInfo* self, GWeatherLocation* location);
 
388
static void g_cclosure_user_marshal_VOID__BOXED (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data);
 
389
static void clocks_geo_info_finalize (GObject* obj);
 
390
static void _vala_clocks_geo_info_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
 
391
static void _vala_clocks_geo_info_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
 
392
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
 
393
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
 
394
static gint _vala_array_length (gpointer array);
 
395
 
 
396
static const GDBusArgInfo _clocks_geo_manager_dbus_arg_info_get_client_client_path = {-1, "client_path", "s"};
 
397
static const GDBusArgInfo * const _clocks_geo_manager_dbus_arg_info_get_client_in[] = {NULL};
 
398
static const GDBusArgInfo * const _clocks_geo_manager_dbus_arg_info_get_client_out[] = {&_clocks_geo_manager_dbus_arg_info_get_client_client_path, NULL};
 
399
static const GDBusMethodInfo _clocks_geo_manager_dbus_method_info_get_client = {-1, "GetClient", (GDBusArgInfo **) (&_clocks_geo_manager_dbus_arg_info_get_client_in), (GDBusArgInfo **) (&_clocks_geo_manager_dbus_arg_info_get_client_out)};
 
400
static const GDBusMethodInfo * const _clocks_geo_manager_dbus_method_info[] = {&_clocks_geo_manager_dbus_method_info_get_client, NULL};
 
401
static const GDBusSignalInfo * const _clocks_geo_manager_dbus_signal_info[] = {NULL};
 
402
static const GDBusPropertyInfo * const _clocks_geo_manager_dbus_property_info[] = {NULL};
 
403
static const GDBusInterfaceInfo _clocks_geo_manager_dbus_interface_info = {-1, "org.freedesktop.GeoClue2.Manager", (GDBusMethodInfo **) (&_clocks_geo_manager_dbus_method_info), (GDBusSignalInfo **) (&_clocks_geo_manager_dbus_signal_info), (GDBusPropertyInfo **) (&_clocks_geo_manager_dbus_property_info)};
 
404
static const GDBusInterfaceVTable _clocks_geo_manager_dbus_interface_vtable = {clocks_geo_manager_dbus_interface_method_call, clocks_geo_manager_dbus_interface_get_property, clocks_geo_manager_dbus_interface_set_property};
 
405
static const GDBusArgInfo * const _clocks_geo_client_dbus_arg_info_start_in[] = {NULL};
 
406
static const GDBusArgInfo * const _clocks_geo_client_dbus_arg_info_start_out[] = {NULL};
 
407
static const GDBusMethodInfo _clocks_geo_client_dbus_method_info_start = {-1, "Start", (GDBusArgInfo **) (&_clocks_geo_client_dbus_arg_info_start_in), (GDBusArgInfo **) (&_clocks_geo_client_dbus_arg_info_start_out)};
 
408
static const GDBusMethodInfo * const _clocks_geo_client_dbus_method_info[] = {&_clocks_geo_client_dbus_method_info_start, NULL};
 
409
static const GDBusArgInfo _clocks_geo_client_dbus_arg_info_location_updated_old_path = {-1, "old_path", "s"};
 
410
static const GDBusArgInfo _clocks_geo_client_dbus_arg_info_location_updated_new_path = {-1, "new_path", "s"};
 
411
static const GDBusArgInfo * const _clocks_geo_client_dbus_arg_info_location_updated[] = {&_clocks_geo_client_dbus_arg_info_location_updated_old_path, &_clocks_geo_client_dbus_arg_info_location_updated_new_path, NULL};
 
412
static const GDBusSignalInfo _clocks_geo_client_dbus_signal_info_location_updated = {-1, "LocationUpdated", (GDBusArgInfo **) (&_clocks_geo_client_dbus_arg_info_location_updated)};
 
413
static const GDBusSignalInfo * const _clocks_geo_client_dbus_signal_info[] = {&_clocks_geo_client_dbus_signal_info_location_updated, NULL};
 
414
static const GDBusPropertyInfo _clocks_geo_client_dbus_property_info_location = {-1, "Location", "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE};
 
415
static const GDBusPropertyInfo _clocks_geo_client_dbus_property_info_distance_threshold = {-1, "DistanceThreshold", "u", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE};
 
416
static const GDBusPropertyInfo * const _clocks_geo_client_dbus_property_info[] = {&_clocks_geo_client_dbus_property_info_location, &_clocks_geo_client_dbus_property_info_distance_threshold, NULL};
 
417
static const GDBusInterfaceInfo _clocks_geo_client_dbus_interface_info = {-1, "org.freedesktop.GeoClue2.Client", (GDBusMethodInfo **) (&_clocks_geo_client_dbus_method_info), (GDBusSignalInfo **) (&_clocks_geo_client_dbus_signal_info), (GDBusPropertyInfo **) (&_clocks_geo_client_dbus_property_info)};
 
418
static const GDBusInterfaceVTable _clocks_geo_client_dbus_interface_vtable = {clocks_geo_client_dbus_interface_method_call, clocks_geo_client_dbus_interface_get_property, clocks_geo_client_dbus_interface_set_property};
 
419
static const GDBusMethodInfo * const _clocks_geo_location_dbus_method_info[] = {NULL};
 
420
static const GDBusSignalInfo * const _clocks_geo_location_dbus_signal_info[] = {NULL};
 
421
static const GDBusPropertyInfo _clocks_geo_location_dbus_property_info_latitude = {-1, "Latitude", "d", G_DBUS_PROPERTY_INFO_FLAGS_READABLE};
 
422
static const GDBusPropertyInfo _clocks_geo_location_dbus_property_info_longitude = {-1, "Longitude", "d", G_DBUS_PROPERTY_INFO_FLAGS_READABLE};
 
423
static const GDBusPropertyInfo _clocks_geo_location_dbus_property_info_accuracy = {-1, "Accuracy", "d", G_DBUS_PROPERTY_INFO_FLAGS_READABLE};
 
424
static const GDBusPropertyInfo _clocks_geo_location_dbus_property_info_description = {-1, "Description", "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE};
 
425
static const GDBusPropertyInfo * const _clocks_geo_location_dbus_property_info[] = {&_clocks_geo_location_dbus_property_info_latitude, &_clocks_geo_location_dbus_property_info_longitude, &_clocks_geo_location_dbus_property_info_accuracy, &_clocks_geo_location_dbus_property_info_description, NULL};
 
426
static const GDBusInterfaceInfo _clocks_geo_location_dbus_interface_info = {-1, "org.freedesktop.GeoClue2.Location", (GDBusMethodInfo **) (&_clocks_geo_location_dbus_method_info), (GDBusSignalInfo **) (&_clocks_geo_location_dbus_signal_info), (GDBusPropertyInfo **) (&_clocks_geo_location_dbus_property_info)};
 
427
static const GDBusInterfaceVTable _clocks_geo_location_dbus_interface_vtable = {clocks_geo_location_dbus_interface_method_call, clocks_geo_location_dbus_interface_get_property, clocks_geo_location_dbus_interface_set_property};
 
428
 
 
429
void clocks_geo_manager_get_client (ClocksGeoManager* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
 
430
        CLOCKS_GEO_MANAGER_GET_INTERFACE (self)->get_client (self, _callback_, _user_data_);
 
431
}
 
432
 
 
433
 
 
434
void clocks_geo_manager_get_client_finish (ClocksGeoManager* self, GAsyncResult* _res_, gchar** client_path, GError** error) {
 
435
        CLOCKS_GEO_MANAGER_GET_INTERFACE (self)->get_client_finish (self, _res_, client_path, error);
 
436
}
 
437
 
 
438
 
 
439
static void clocks_geo_manager_base_init (ClocksGeoManagerIface * iface) {
 
440
        static gboolean initialized = FALSE;
 
441
        if (!initialized) {
 
442
                initialized = TRUE;
 
443
        }
 
444
}
 
445
 
 
446
 
 
447
GType clocks_geo_manager_get_type (void) {
 
448
        static volatile gsize clocks_geo_manager_type_id__volatile = 0;
 
449
        if (g_once_init_enter (&clocks_geo_manager_type_id__volatile)) {
 
450
                static const GTypeInfo g_define_type_info = { sizeof (ClocksGeoManagerIface), (GBaseInitFunc) clocks_geo_manager_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
 
451
                GType clocks_geo_manager_type_id;
 
452
                clocks_geo_manager_type_id = g_type_register_static (G_TYPE_INTERFACE, "ClocksGeoManager", &g_define_type_info, 0);
 
453
                g_type_interface_add_prerequisite (clocks_geo_manager_type_id, G_TYPE_OBJECT);
 
454
                g_type_set_qdata (clocks_geo_manager_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) clocks_geo_manager_proxy_get_type);
 
455
                g_type_set_qdata (clocks_geo_manager_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), "org.freedesktop.GeoClue2.Manager");
 
456
                g_type_set_qdata (clocks_geo_manager_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) clocks_geo_manager_register_object);
 
457
                g_once_init_leave (&clocks_geo_manager_type_id__volatile, clocks_geo_manager_type_id);
 
458
        }
 
459
        return clocks_geo_manager_type_id__volatile;
 
460
}
 
461
 
 
462
 
 
463
G_DEFINE_TYPE_EXTENDED (ClocksGeoManagerProxy, clocks_geo_manager_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (CLOCKS_GEO_TYPE_MANAGER, clocks_geo_manager_proxy_clocks_geo_manager_interface_init) )
 
464
static void clocks_geo_manager_proxy_class_init (ClocksGeoManagerProxyClass* klass) {
 
465
        G_DBUS_PROXY_CLASS (klass)->g_signal = clocks_geo_manager_proxy_g_signal;
 
466
}
 
467
 
 
468
 
 
469
static void clocks_geo_manager_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters) {
 
470
}
 
471
 
 
472
 
 
473
static void clocks_geo_manager_proxy_init (ClocksGeoManagerProxy* self) {
 
474
}
 
475
 
 
476
 
 
477
static void _vala_g_async_ready_callback (GObject *source_object, GAsyncResult *res, void *user_data) {
 
478
        g_simple_async_result_set_op_res_gpointer (user_data, g_object_ref (res), g_object_unref);
 
479
        g_simple_async_result_complete (user_data);
 
480
        g_object_unref (user_data);
 
481
}
 
482
 
 
483
 
 
484
static void clocks_geo_manager_proxy_get_client_async (ClocksGeoManager* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
 
485
        GDBusMessage *_message;
 
486
        GVariant *_arguments;
 
487
        GVariantBuilder _arguments_builder;
 
488
        G_IO_ERROR;
 
489
        _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.freedesktop.GeoClue2.Manager", "GetClient");
 
490
        g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
 
491
        _arguments = g_variant_builder_end (&_arguments_builder);
 
492
        g_dbus_message_set_body (_message, _arguments);
 
493
        g_dbus_connection_send_message_with_reply (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, _vala_g_async_ready_callback, g_simple_async_result_new ((GObject *) self, _callback_, _user_data_, NULL));
 
494
        g_object_unref (_message);
 
495
}
 
496
 
 
497
 
 
498
static void clocks_geo_manager_proxy_get_client_finish (ClocksGeoManager* self, GAsyncResult* _res_, gchar** client_path, GError** error) {
 
499
        GDBusMessage *_reply_message;
 
500
        GVariant *_reply;
 
501
        GVariantIter _reply_iter;
 
502
        gchar* _vala_client_path;
 
503
        GVariant* _tmp0_;
 
504
        _reply_message = g_dbus_connection_send_message_with_reply_finish (g_dbus_proxy_get_connection ((GDBusProxy *) self), g_simple_async_result_get_op_res_gpointer ((GSimpleAsyncResult *) _res_), error);
 
505
        if (!_reply_message) {
 
506
                return;
 
507
        }
 
508
        if (g_dbus_message_to_gerror (_reply_message, error)) {
 
509
                g_object_unref (_reply_message);
 
510
                return;
 
511
        }
 
512
        _reply = g_dbus_message_get_body (_reply_message);
 
513
        g_variant_iter_init (&_reply_iter, _reply);
 
514
        _tmp0_ = g_variant_iter_next_value (&_reply_iter);
 
515
        _vala_client_path = g_variant_dup_string (_tmp0_, NULL);
 
516
        g_variant_unref (_tmp0_);
 
517
        *client_path = _vala_client_path;
 
518
        g_object_unref (_reply_message);
 
519
}
 
520
 
 
521
 
 
522
static void clocks_geo_manager_proxy_clocks_geo_manager_interface_init (ClocksGeoManagerIface* iface) {
 
523
        iface->get_client = clocks_geo_manager_proxy_get_client_async;
 
524
        iface->get_client_finish = clocks_geo_manager_proxy_get_client_finish;
 
525
}
 
526
 
 
527
 
 
528
static void _dbus_clocks_geo_manager_get_client (ClocksGeoManager* self, GVariant* parameters, GDBusMethodInvocation* invocation) {
 
529
        GVariantIter _arguments_iter;
 
530
        g_variant_iter_init (&_arguments_iter, parameters);
 
531
        clocks_geo_manager_get_client (self, (GAsyncReadyCallback) _dbus_clocks_geo_manager_get_client_ready, invocation);
 
532
}
 
533
 
 
534
 
 
535
static void _dbus_clocks_geo_manager_get_client_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_) {
 
536
        GDBusMethodInvocation * invocation;
 
537
        GError* error = NULL;
 
538
        GDBusMessage* _reply_message;
 
539
        GVariant* _reply;
 
540
        GVariantBuilder _reply_builder;
 
541
        gchar* client_path = NULL;
 
542
        invocation = _user_data_;
 
543
        clocks_geo_manager_get_client_finish ((ClocksGeoManager*) source_object, _res_, &client_path, &error);
 
544
        if (error) {
 
545
                g_dbus_method_invocation_return_gerror (invocation, error);
 
546
                return;
 
547
        }
 
548
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
 
549
        g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
 
550
        g_variant_builder_add_value (&_reply_builder, g_variant_new_string (client_path));
 
551
        _reply = g_variant_builder_end (&_reply_builder);
 
552
        g_dbus_message_set_body (_reply_message, _reply);
 
553
        _g_free0 (client_path);
 
554
        g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
 
555
        g_object_unref (invocation);
 
556
        g_object_unref (_reply_message);
 
557
}
 
558
 
 
559
 
 
560
static void clocks_geo_manager_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data) {
 
561
        gpointer* data;
 
562
        gpointer object;
 
563
        data = user_data;
 
564
        object = data[0];
 
565
        if (strcmp (method_name, "GetClient") == 0) {
 
566
                _dbus_clocks_geo_manager_get_client (object, parameters, invocation);
 
567
        } else {
 
568
                g_object_unref (invocation);
 
569
        }
 
570
}
 
571
 
 
572
 
 
573
static GVariant* clocks_geo_manager_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data) {
 
574
        gpointer* data;
 
575
        gpointer object;
 
576
        data = user_data;
 
577
        object = data[0];
 
578
        return NULL;
 
579
}
 
580
 
 
581
 
 
582
static gboolean clocks_geo_manager_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data) {
 
583
        gpointer* data;
 
584
        gpointer object;
 
585
        data = user_data;
 
586
        object = data[0];
 
587
        return FALSE;
 
588
}
 
589
 
 
590
 
 
591
guint clocks_geo_manager_register_object (gpointer object, GDBusConnection* connection, const gchar* path, GError** error) {
 
592
        guint result;
 
593
        gpointer *data;
 
594
        data = g_new (gpointer, 3);
 
595
        data[0] = g_object_ref (object);
 
596
        data[1] = g_object_ref (connection);
 
597
        data[2] = g_strdup (path);
 
598
        result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) (&_clocks_geo_manager_dbus_interface_info), &_clocks_geo_manager_dbus_interface_vtable, data, _clocks_geo_manager_unregister_object, error);
 
599
        if (!result) {
 
600
                return 0;
 
601
        }
 
602
        return result;
 
603
}
 
604
 
 
605
 
 
606
static void _clocks_geo_manager_unregister_object (gpointer user_data) {
 
607
        gpointer* data;
 
608
        data = user_data;
 
609
        g_object_unref (data[0]);
 
610
        g_object_unref (data[1]);
 
611
        g_free (data[2]);
 
612
        g_free (data);
 
613
}
 
614
 
 
615
 
 
616
void clocks_geo_client_start (ClocksGeoClient* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
 
617
        CLOCKS_GEO_CLIENT_GET_INTERFACE (self)->start (self, _callback_, _user_data_);
 
618
}
 
619
 
 
620
 
 
621
void clocks_geo_client_start_finish (ClocksGeoClient* self, GAsyncResult* _res_, GError** error) {
 
622
        CLOCKS_GEO_CLIENT_GET_INTERFACE (self)->start_finish (self, _res_, error);
 
623
}
 
624
 
 
625
 
 
626
gchar* clocks_geo_client_get_location (ClocksGeoClient* self) {
 
627
        g_return_val_if_fail (self != NULL, NULL);
 
628
        return CLOCKS_GEO_CLIENT_GET_INTERFACE (self)->get_location (self);
 
629
}
 
630
 
 
631
 
 
632
guint clocks_geo_client_get_distance_threshold (ClocksGeoClient* self) {
 
633
        g_return_val_if_fail (self != NULL, 0U);
 
634
        return CLOCKS_GEO_CLIENT_GET_INTERFACE (self)->get_distance_threshold (self);
 
635
}
 
636
 
 
637
 
 
638
void clocks_geo_client_set_distance_threshold (ClocksGeoClient* self, guint value) {
 
639
        g_return_if_fail (self != NULL);
 
640
        CLOCKS_GEO_CLIENT_GET_INTERFACE (self)->set_distance_threshold (self, value);
 
641
}
 
642
 
 
643
 
 
644
static void g_cclosure_user_marshal_VOID__STRING_STRING (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data) {
 
645
        typedef void (*GMarshalFunc_VOID__STRING_STRING) (gpointer data1, const char* arg_1, const char* arg_2, gpointer data2);
 
646
        register GMarshalFunc_VOID__STRING_STRING callback;
 
647
        register GCClosure * cc;
 
648
        register gpointer data1;
 
649
        register gpointer data2;
 
650
        cc = (GCClosure *) closure;
 
651
        g_return_if_fail (n_param_values == 3);
 
652
        if (G_CCLOSURE_SWAP_DATA (closure)) {
 
653
                data1 = closure->data;
 
654
                data2 = param_values->data[0].v_pointer;
 
655
        } else {
 
656
                data1 = param_values->data[0].v_pointer;
 
657
                data2 = closure->data;
 
658
        }
 
659
        callback = (GMarshalFunc_VOID__STRING_STRING) (marshal_data ? marshal_data : cc->callback);
 
660
        callback (data1, g_value_get_string (param_values + 1), g_value_get_string (param_values + 2), data2);
 
661
}
 
662
 
 
663
 
 
664
static void clocks_geo_client_base_init (ClocksGeoClientIface * iface) {
 
665
        static gboolean initialized = FALSE;
 
666
        if (!initialized) {
 
667
                initialized = TRUE;
 
668
                g_signal_new ("location_updated", CLOCKS_GEO_TYPE_CLIENT, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__STRING_STRING, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING);
 
669
        }
 
670
}
 
671
 
 
672
 
 
673
GType clocks_geo_client_get_type (void) {
 
674
        static volatile gsize clocks_geo_client_type_id__volatile = 0;
 
675
        if (g_once_init_enter (&clocks_geo_client_type_id__volatile)) {
 
676
                static const GTypeInfo g_define_type_info = { sizeof (ClocksGeoClientIface), (GBaseInitFunc) clocks_geo_client_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
 
677
                GType clocks_geo_client_type_id;
 
678
                clocks_geo_client_type_id = g_type_register_static (G_TYPE_INTERFACE, "ClocksGeoClient", &g_define_type_info, 0);
 
679
                g_type_interface_add_prerequisite (clocks_geo_client_type_id, G_TYPE_OBJECT);
 
680
                g_type_set_qdata (clocks_geo_client_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) clocks_geo_client_proxy_get_type);
 
681
                g_type_set_qdata (clocks_geo_client_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), "org.freedesktop.GeoClue2.Client");
 
682
                g_type_set_qdata (clocks_geo_client_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) clocks_geo_client_register_object);
 
683
                g_once_init_leave (&clocks_geo_client_type_id__volatile, clocks_geo_client_type_id);
 
684
        }
 
685
        return clocks_geo_client_type_id__volatile;
 
686
}
 
687
 
 
688
 
 
689
G_DEFINE_TYPE_EXTENDED (ClocksGeoClientProxy, clocks_geo_client_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (CLOCKS_GEO_TYPE_CLIENT, clocks_geo_client_proxy_clocks_geo_client_interface_init) )
 
690
static void clocks_geo_client_proxy_class_init (ClocksGeoClientProxyClass* klass) {
 
691
        G_DBUS_PROXY_CLASS (klass)->g_signal = clocks_geo_client_proxy_g_signal;
 
692
}
 
693
 
 
694
 
 
695
static void _dbus_handle_clocks_geo_client_location_updated (ClocksGeoClient* self, GVariant* parameters) {
 
696
        GVariantIter _arguments_iter;
 
697
        gchar* old_path = NULL;
 
698
        GVariant* _tmp1_;
 
699
        gchar* new_path = NULL;
 
700
        GVariant* _tmp2_;
 
701
        g_variant_iter_init (&_arguments_iter, parameters);
 
702
        _tmp1_ = g_variant_iter_next_value (&_arguments_iter);
 
703
        old_path = g_variant_dup_string (_tmp1_, NULL);
 
704
        g_variant_unref (_tmp1_);
 
705
        _tmp2_ = g_variant_iter_next_value (&_arguments_iter);
 
706
        new_path = g_variant_dup_string (_tmp2_, NULL);
 
707
        g_variant_unref (_tmp2_);
 
708
        g_signal_emit_by_name (self, "location-updated", old_path, new_path);
 
709
        _g_free0 (old_path);
 
710
        _g_free0 (new_path);
 
711
}
 
712
 
 
713
 
 
714
static void clocks_geo_client_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters) {
 
715
        if (strcmp (signal_name, "LocationUpdated") == 0) {
 
716
                _dbus_handle_clocks_geo_client_location_updated ((ClocksGeoClient*) proxy, parameters);
 
717
        }
 
718
}
 
719
 
 
720
 
 
721
static void clocks_geo_client_proxy_init (ClocksGeoClientProxy* self) {
 
722
}
 
723
 
 
724
 
 
725
static void clocks_geo_client_proxy_start_async (ClocksGeoClient* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
 
726
        GDBusMessage *_message;
 
727
        GVariant *_arguments;
 
728
        GVariantBuilder _arguments_builder;
 
729
        G_IO_ERROR;
 
730
        _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.freedesktop.GeoClue2.Client", "Start");
 
731
        g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
 
732
        _arguments = g_variant_builder_end (&_arguments_builder);
 
733
        g_dbus_message_set_body (_message, _arguments);
 
734
        g_dbus_connection_send_message_with_reply (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, _vala_g_async_ready_callback, g_simple_async_result_new ((GObject *) self, _callback_, _user_data_, NULL));
 
735
        g_object_unref (_message);
 
736
}
 
737
 
 
738
 
 
739
static void clocks_geo_client_proxy_start_finish (ClocksGeoClient* self, GAsyncResult* _res_, GError** error) {
 
740
        GDBusMessage *_reply_message;
 
741
        _reply_message = g_dbus_connection_send_message_with_reply_finish (g_dbus_proxy_get_connection ((GDBusProxy *) self), g_simple_async_result_get_op_res_gpointer ((GSimpleAsyncResult *) _res_), error);
 
742
        if (!_reply_message) {
 
743
                return;
 
744
        }
 
745
        if (g_dbus_message_to_gerror (_reply_message, error)) {
 
746
                g_object_unref (_reply_message);
 
747
                return;
 
748
        }
 
749
        g_object_unref (_reply_message);
 
750
}
 
751
 
 
752
 
 
753
static gchar* clocks_geo_client_dbus_proxy_get_location (ClocksGeoClient* self) {
 
754
        GVariant *_inner_reply;
 
755
        gchar* _result;
 
756
        _inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "Location");
 
757
        if (!_inner_reply) {
 
758
                GVariant *_arguments;
 
759
                GVariant *_reply;
 
760
                GVariantBuilder _arguments_builder;
 
761
                g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
 
762
                g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.freedesktop.GeoClue2.Client"));
 
763
                g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("Location"));
 
764
                _arguments = g_variant_builder_end (&_arguments_builder);
 
765
                _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
 
766
                if (!_reply) {
 
767
                        return NULL;
 
768
                }
 
769
                g_variant_get (_reply, "(v)", &_inner_reply);
 
770
                g_variant_unref (_reply);
 
771
        }
 
772
        _result = g_variant_dup_string (_inner_reply, NULL);
 
773
        g_variant_unref (_inner_reply);
 
774
        return _result;
 
775
}
 
776
 
 
777
 
 
778
static guint clocks_geo_client_dbus_proxy_get_distance_threshold (ClocksGeoClient* self) {
 
779
        GVariant *_inner_reply;
 
780
        guint _result;
 
781
        _inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "DistanceThreshold");
 
782
        if (!_inner_reply) {
 
783
                GVariant *_arguments;
 
784
                GVariant *_reply;
 
785
                GVariantBuilder _arguments_builder;
 
786
                g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
 
787
                g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.freedesktop.GeoClue2.Client"));
 
788
                g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("DistanceThreshold"));
 
789
                _arguments = g_variant_builder_end (&_arguments_builder);
 
790
                _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
 
791
                if (!_reply) {
 
792
                        return 0U;
 
793
                }
 
794
                g_variant_get (_reply, "(v)", &_inner_reply);
 
795
                g_variant_unref (_reply);
 
796
        }
 
797
        _result = g_variant_get_uint32 (_inner_reply);
 
798
        g_variant_unref (_inner_reply);
 
799
        return _result;
 
800
}
 
801
 
 
802
 
 
803
static void clocks_geo_client_dbus_proxy_set_distance_threshold (ClocksGeoClient* self, guint value) {
 
804
        GVariant *_arguments;
 
805
        GVariant *_reply;
 
806
        GVariantBuilder _arguments_builder;
 
807
        g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
 
808
        g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.freedesktop.GeoClue2.Client"));
 
809
        g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("DistanceThreshold"));
 
810
        g_variant_builder_open (&_arguments_builder, G_VARIANT_TYPE_VARIANT);
 
811
        g_variant_builder_add_value (&_arguments_builder, g_variant_new_uint32 (value));
 
812
        g_variant_builder_close (&_arguments_builder);
 
813
        _arguments = g_variant_builder_end (&_arguments_builder);
 
814
        _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Set", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
 
815
        if (!_reply) {
 
816
                return;
 
817
        }
 
818
        g_variant_unref (_reply);
 
819
}
 
820
 
 
821
 
 
822
static void clocks_geo_client_proxy_clocks_geo_client_interface_init (ClocksGeoClientIface* iface) {
 
823
        iface->start = clocks_geo_client_proxy_start_async;
 
824
        iface->start_finish = clocks_geo_client_proxy_start_finish;
 
825
        iface->get_location = clocks_geo_client_dbus_proxy_get_location;
 
826
        iface->get_distance_threshold = clocks_geo_client_dbus_proxy_get_distance_threshold;
 
827
        iface->set_distance_threshold = clocks_geo_client_dbus_proxy_set_distance_threshold;
 
828
}
 
829
 
 
830
 
 
831
static void _dbus_clocks_geo_client_start (ClocksGeoClient* self, GVariant* parameters, GDBusMethodInvocation* invocation) {
 
832
        GVariantIter _arguments_iter;
 
833
        g_variant_iter_init (&_arguments_iter, parameters);
 
834
        clocks_geo_client_start (self, (GAsyncReadyCallback) _dbus_clocks_geo_client_start_ready, invocation);
 
835
}
 
836
 
 
837
 
 
838
static void _dbus_clocks_geo_client_start_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_) {
 
839
        GDBusMethodInvocation * invocation;
 
840
        GError* error = NULL;
 
841
        GDBusMessage* _reply_message;
 
842
        GVariant* _reply;
 
843
        GVariantBuilder _reply_builder;
 
844
        invocation = _user_data_;
 
845
        clocks_geo_client_start_finish ((ClocksGeoClient*) source_object, _res_, &error);
 
846
        if (error) {
 
847
                g_dbus_method_invocation_return_gerror (invocation, error);
 
848
                return;
 
849
        }
 
850
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
 
851
        g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
 
852
        _reply = g_variant_builder_end (&_reply_builder);
 
853
        g_dbus_message_set_body (_reply_message, _reply);
 
854
        g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
 
855
        g_object_unref (invocation);
 
856
        g_object_unref (_reply_message);
 
857
}
 
858
 
 
859
 
 
860
static void clocks_geo_client_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data) {
 
861
        gpointer* data;
 
862
        gpointer object;
 
863
        data = user_data;
 
864
        object = data[0];
 
865
        if (strcmp (method_name, "Start") == 0) {
 
866
                _dbus_clocks_geo_client_start (object, parameters, invocation);
 
867
        } else {
 
868
                g_object_unref (invocation);
 
869
        }
 
870
}
 
871
 
 
872
 
 
873
static GVariant* _dbus_clocks_geo_client_get_location (ClocksGeoClient* self) {
 
874
        gchar* result;
 
875
        GVariant* _reply;
 
876
        result = clocks_geo_client_get_location (self);
 
877
        _reply = g_variant_new_string (result);
 
878
        _g_free0 (result);
 
879
        return _reply;
 
880
}
 
881
 
 
882
 
 
883
static GVariant* _dbus_clocks_geo_client_get_distance_threshold (ClocksGeoClient* self) {
 
884
        guint result;
 
885
        GVariant* _reply;
 
886
        result = clocks_geo_client_get_distance_threshold (self);
 
887
        _reply = g_variant_new_uint32 (result);
 
888
        return _reply;
 
889
}
 
890
 
 
891
 
 
892
static GVariant* clocks_geo_client_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data) {
 
893
        gpointer* data;
 
894
        gpointer object;
 
895
        data = user_data;
 
896
        object = data[0];
 
897
        if (strcmp (property_name, "Location") == 0) {
 
898
                return _dbus_clocks_geo_client_get_location (object);
 
899
        } else if (strcmp (property_name, "DistanceThreshold") == 0) {
 
900
                return _dbus_clocks_geo_client_get_distance_threshold (object);
 
901
        }
 
902
        return NULL;
 
903
}
 
904
 
 
905
 
 
906
static void _dbus_clocks_geo_client_set_distance_threshold (ClocksGeoClient* self, GVariant* _value) {
 
907
        guint value = 0U;
 
908
        value = g_variant_get_uint32 (_value);
 
909
        clocks_geo_client_set_distance_threshold (self, value);
 
910
}
 
911
 
 
912
 
 
913
static gboolean clocks_geo_client_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data) {
 
914
        gpointer* data;
 
915
        gpointer object;
 
916
        data = user_data;
 
917
        object = data[0];
 
918
        if (strcmp (property_name, "DistanceThreshold") == 0) {
 
919
                _dbus_clocks_geo_client_set_distance_threshold (object, value);
 
920
                return TRUE;
 
921
        }
 
922
        return FALSE;
 
923
}
 
924
 
 
925
 
 
926
static void _dbus_clocks_geo_client_location_updated (GObject* _sender, const gchar* old_path, const gchar* new_path, gpointer* _data) {
 
927
        GDBusConnection * _connection;
 
928
        const gchar * _path;
 
929
        GVariant *_arguments;
 
930
        GVariantBuilder _arguments_builder;
 
931
        _connection = _data[1];
 
932
        _path = _data[2];
 
933
        g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
 
934
        g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (old_path));
 
935
        g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (new_path));
 
936
        _arguments = g_variant_builder_end (&_arguments_builder);
 
937
        g_dbus_connection_emit_signal (_connection, NULL, _path, "org.freedesktop.GeoClue2.Client", "LocationUpdated", _arguments, NULL);
 
938
}
 
939
 
 
940
 
 
941
guint clocks_geo_client_register_object (gpointer object, GDBusConnection* connection, const gchar* path, GError** error) {
 
942
        guint result;
 
943
        gpointer *data;
 
944
        data = g_new (gpointer, 3);
 
945
        data[0] = g_object_ref (object);
 
946
        data[1] = g_object_ref (connection);
 
947
        data[2] = g_strdup (path);
 
948
        result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) (&_clocks_geo_client_dbus_interface_info), &_clocks_geo_client_dbus_interface_vtable, data, _clocks_geo_client_unregister_object, error);
 
949
        if (!result) {
 
950
                return 0;
 
951
        }
 
952
        g_signal_connect (object, "location-updated", (GCallback) _dbus_clocks_geo_client_location_updated, data);
 
953
        return result;
 
954
}
 
955
 
 
956
 
 
957
static void _clocks_geo_client_unregister_object (gpointer user_data) {
 
958
        gpointer* data;
 
959
        data = user_data;
 
960
        g_signal_handlers_disconnect_by_func (data[0], _dbus_clocks_geo_client_location_updated, data);
 
961
        g_object_unref (data[0]);
 
962
        g_object_unref (data[1]);
 
963
        g_free (data[2]);
 
964
        g_free (data);
 
965
}
 
966
 
 
967
 
 
968
gdouble clocks_geo_location_get_latitude (ClocksGeoLocation* self) {
 
969
        g_return_val_if_fail (self != NULL, 0.0);
 
970
        return CLOCKS_GEO_LOCATION_GET_INTERFACE (self)->get_latitude (self);
 
971
}
 
972
 
 
973
 
 
974
gdouble clocks_geo_location_get_longitude (ClocksGeoLocation* self) {
 
975
        g_return_val_if_fail (self != NULL, 0.0);
 
976
        return CLOCKS_GEO_LOCATION_GET_INTERFACE (self)->get_longitude (self);
 
977
}
 
978
 
 
979
 
 
980
gdouble clocks_geo_location_get_accuracy (ClocksGeoLocation* self) {
 
981
        g_return_val_if_fail (self != NULL, 0.0);
 
982
        return CLOCKS_GEO_LOCATION_GET_INTERFACE (self)->get_accuracy (self);
 
983
}
 
984
 
 
985
 
 
986
gchar* clocks_geo_location_get_description (ClocksGeoLocation* self) {
 
987
        g_return_val_if_fail (self != NULL, NULL);
 
988
        return CLOCKS_GEO_LOCATION_GET_INTERFACE (self)->get_description (self);
 
989
}
 
990
 
 
991
 
 
992
static void clocks_geo_location_base_init (ClocksGeoLocationIface * iface) {
 
993
        static gboolean initialized = FALSE;
 
994
        if (!initialized) {
 
995
                initialized = TRUE;
 
996
        }
 
997
}
 
998
 
 
999
 
 
1000
GType clocks_geo_location_get_type (void) {
 
1001
        static volatile gsize clocks_geo_location_type_id__volatile = 0;
 
1002
        if (g_once_init_enter (&clocks_geo_location_type_id__volatile)) {
 
1003
                static const GTypeInfo g_define_type_info = { sizeof (ClocksGeoLocationIface), (GBaseInitFunc) clocks_geo_location_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
 
1004
                GType clocks_geo_location_type_id;
 
1005
                clocks_geo_location_type_id = g_type_register_static (G_TYPE_INTERFACE, "ClocksGeoLocation", &g_define_type_info, 0);
 
1006
                g_type_interface_add_prerequisite (clocks_geo_location_type_id, G_TYPE_OBJECT);
 
1007
                g_type_set_qdata (clocks_geo_location_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) clocks_geo_location_proxy_get_type);
 
1008
                g_type_set_qdata (clocks_geo_location_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), "org.freedesktop.GeoClue2.Location");
 
1009
                g_type_set_qdata (clocks_geo_location_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) clocks_geo_location_register_object);
 
1010
                g_once_init_leave (&clocks_geo_location_type_id__volatile, clocks_geo_location_type_id);
 
1011
        }
 
1012
        return clocks_geo_location_type_id__volatile;
 
1013
}
 
1014
 
 
1015
 
 
1016
G_DEFINE_TYPE_EXTENDED (ClocksGeoLocationProxy, clocks_geo_location_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (CLOCKS_GEO_TYPE_LOCATION, clocks_geo_location_proxy_clocks_geo_location_interface_init) )
 
1017
static void clocks_geo_location_proxy_class_init (ClocksGeoLocationProxyClass* klass) {
 
1018
        G_DBUS_PROXY_CLASS (klass)->g_signal = clocks_geo_location_proxy_g_signal;
 
1019
}
 
1020
 
 
1021
 
 
1022
static void clocks_geo_location_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters) {
 
1023
}
 
1024
 
 
1025
 
 
1026
static void clocks_geo_location_proxy_init (ClocksGeoLocationProxy* self) {
 
1027
}
 
1028
 
 
1029
 
 
1030
static gdouble clocks_geo_location_dbus_proxy_get_latitude (ClocksGeoLocation* self) {
 
1031
        GVariant *_inner_reply;
 
1032
        gdouble _result;
 
1033
        _inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "Latitude");
 
1034
        if (!_inner_reply) {
 
1035
                GVariant *_arguments;
 
1036
                GVariant *_reply;
 
1037
                GVariantBuilder _arguments_builder;
 
1038
                g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
 
1039
                g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.freedesktop.GeoClue2.Location"));
 
1040
                g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("Latitude"));
 
1041
                _arguments = g_variant_builder_end (&_arguments_builder);
 
1042
                _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
 
1043
                if (!_reply) {
 
1044
                        return 0.0;
 
1045
                }
 
1046
                g_variant_get (_reply, "(v)", &_inner_reply);
 
1047
                g_variant_unref (_reply);
 
1048
        }
 
1049
        _result = g_variant_get_double (_inner_reply);
 
1050
        g_variant_unref (_inner_reply);
 
1051
        return _result;
 
1052
}
 
1053
 
 
1054
 
 
1055
static gdouble clocks_geo_location_dbus_proxy_get_longitude (ClocksGeoLocation* self) {
 
1056
        GVariant *_inner_reply;
 
1057
        gdouble _result;
 
1058
        _inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "Longitude");
 
1059
        if (!_inner_reply) {
 
1060
                GVariant *_arguments;
 
1061
                GVariant *_reply;
 
1062
                GVariantBuilder _arguments_builder;
 
1063
                g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
 
1064
                g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.freedesktop.GeoClue2.Location"));
 
1065
                g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("Longitude"));
 
1066
                _arguments = g_variant_builder_end (&_arguments_builder);
 
1067
                _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
 
1068
                if (!_reply) {
 
1069
                        return 0.0;
 
1070
                }
 
1071
                g_variant_get (_reply, "(v)", &_inner_reply);
 
1072
                g_variant_unref (_reply);
 
1073
        }
 
1074
        _result = g_variant_get_double (_inner_reply);
 
1075
        g_variant_unref (_inner_reply);
 
1076
        return _result;
 
1077
}
 
1078
 
 
1079
 
 
1080
static gdouble clocks_geo_location_dbus_proxy_get_accuracy (ClocksGeoLocation* self) {
 
1081
        GVariant *_inner_reply;
 
1082
        gdouble _result;
 
1083
        _inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "Accuracy");
 
1084
        if (!_inner_reply) {
 
1085
                GVariant *_arguments;
 
1086
                GVariant *_reply;
 
1087
                GVariantBuilder _arguments_builder;
 
1088
                g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
 
1089
                g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.freedesktop.GeoClue2.Location"));
 
1090
                g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("Accuracy"));
 
1091
                _arguments = g_variant_builder_end (&_arguments_builder);
 
1092
                _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
 
1093
                if (!_reply) {
 
1094
                        return 0.0;
 
1095
                }
 
1096
                g_variant_get (_reply, "(v)", &_inner_reply);
 
1097
                g_variant_unref (_reply);
 
1098
        }
 
1099
        _result = g_variant_get_double (_inner_reply);
 
1100
        g_variant_unref (_inner_reply);
 
1101
        return _result;
 
1102
}
 
1103
 
 
1104
 
 
1105
static gchar* clocks_geo_location_dbus_proxy_get_description (ClocksGeoLocation* self) {
 
1106
        GVariant *_inner_reply;
 
1107
        gchar* _result;
 
1108
        _inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "Description");
 
1109
        if (!_inner_reply) {
 
1110
                GVariant *_arguments;
 
1111
                GVariant *_reply;
 
1112
                GVariantBuilder _arguments_builder;
 
1113
                g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
 
1114
                g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.freedesktop.GeoClue2.Location"));
 
1115
                g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("Description"));
 
1116
                _arguments = g_variant_builder_end (&_arguments_builder);
 
1117
                _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
 
1118
                if (!_reply) {
 
1119
                        return NULL;
 
1120
                }
 
1121
                g_variant_get (_reply, "(v)", &_inner_reply);
 
1122
                g_variant_unref (_reply);
 
1123
        }
 
1124
        _result = g_variant_dup_string (_inner_reply, NULL);
 
1125
        g_variant_unref (_inner_reply);
 
1126
        return _result;
 
1127
}
 
1128
 
 
1129
 
 
1130
static void clocks_geo_location_proxy_clocks_geo_location_interface_init (ClocksGeoLocationIface* iface) {
 
1131
        iface->get_latitude = clocks_geo_location_dbus_proxy_get_latitude;
 
1132
        iface->get_longitude = clocks_geo_location_dbus_proxy_get_longitude;
 
1133
        iface->get_accuracy = clocks_geo_location_dbus_proxy_get_accuracy;
 
1134
        iface->get_description = clocks_geo_location_dbus_proxy_get_description;
 
1135
}
 
1136
 
 
1137
 
 
1138
static void clocks_geo_location_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data) {
 
1139
        gpointer* data;
 
1140
        gpointer object;
 
1141
        data = user_data;
 
1142
        object = data[0];
 
1143
        g_object_unref (invocation);
 
1144
}
 
1145
 
 
1146
 
 
1147
static GVariant* _dbus_clocks_geo_location_get_latitude (ClocksGeoLocation* self) {
 
1148
        gdouble result;
 
1149
        GVariant* _reply;
 
1150
        result = clocks_geo_location_get_latitude (self);
 
1151
        _reply = g_variant_new_double (result);
 
1152
        return _reply;
 
1153
}
 
1154
 
 
1155
 
 
1156
static GVariant* _dbus_clocks_geo_location_get_longitude (ClocksGeoLocation* self) {
 
1157
        gdouble result;
 
1158
        GVariant* _reply;
 
1159
        result = clocks_geo_location_get_longitude (self);
 
1160
        _reply = g_variant_new_double (result);
 
1161
        return _reply;
 
1162
}
 
1163
 
 
1164
 
 
1165
static GVariant* _dbus_clocks_geo_location_get_accuracy (ClocksGeoLocation* self) {
 
1166
        gdouble result;
 
1167
        GVariant* _reply;
 
1168
        result = clocks_geo_location_get_accuracy (self);
 
1169
        _reply = g_variant_new_double (result);
 
1170
        return _reply;
 
1171
}
 
1172
 
 
1173
 
 
1174
static GVariant* _dbus_clocks_geo_location_get_description (ClocksGeoLocation* self) {
 
1175
        gchar* result;
 
1176
        GVariant* _reply;
 
1177
        result = clocks_geo_location_get_description (self);
 
1178
        _reply = g_variant_new_string (result);
 
1179
        _g_free0 (result);
 
1180
        return _reply;
 
1181
}
 
1182
 
 
1183
 
 
1184
static GVariant* clocks_geo_location_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data) {
 
1185
        gpointer* data;
 
1186
        gpointer object;
 
1187
        data = user_data;
 
1188
        object = data[0];
 
1189
        if (strcmp (property_name, "Latitude") == 0) {
 
1190
                return _dbus_clocks_geo_location_get_latitude (object);
 
1191
        } else if (strcmp (property_name, "Longitude") == 0) {
 
1192
                return _dbus_clocks_geo_location_get_longitude (object);
 
1193
        } else if (strcmp (property_name, "Accuracy") == 0) {
 
1194
                return _dbus_clocks_geo_location_get_accuracy (object);
 
1195
        } else if (strcmp (property_name, "Description") == 0) {
 
1196
                return _dbus_clocks_geo_location_get_description (object);
 
1197
        }
 
1198
        return NULL;
 
1199
}
 
1200
 
 
1201
 
 
1202
static gboolean clocks_geo_location_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data) {
 
1203
        gpointer* data;
 
1204
        gpointer object;
 
1205
        data = user_data;
 
1206
        object = data[0];
 
1207
        return FALSE;
 
1208
}
 
1209
 
 
1210
 
 
1211
guint clocks_geo_location_register_object (gpointer object, GDBusConnection* connection, const gchar* path, GError** error) {
 
1212
        guint result;
 
1213
        gpointer *data;
 
1214
        data = g_new (gpointer, 3);
 
1215
        data[0] = g_object_ref (object);
 
1216
        data[1] = g_object_ref (connection);
 
1217
        data[2] = g_strdup (path);
 
1218
        result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) (&_clocks_geo_location_dbus_interface_info), &_clocks_geo_location_dbus_interface_vtable, data, _clocks_geo_location_unregister_object, error);
 
1219
        if (!result) {
 
1220
                return 0;
 
1221
        }
 
1222
        return result;
 
1223
}
 
1224
 
 
1225
 
 
1226
static void _clocks_geo_location_unregister_object (gpointer user_data) {
 
1227
        gpointer* data;
 
1228
        data = user_data;
 
1229
        g_object_unref (data[0]);
 
1230
        g_object_unref (data[1]);
 
1231
        g_free (data[2]);
 
1232
        g_free (data);
 
1233
}
 
1234
 
 
1235
 
 
1236
ClocksGeoInfo* clocks_geo_info_construct (GType object_type) {
 
1237
        ClocksGeoInfo * self = NULL;
 
1238
        self = (ClocksGeoInfo*) g_object_new (object_type, NULL);
 
1239
        _g_free0 (self->priv->country_code);
 
1240
        self->priv->country_code = NULL;
 
1241
        _gweather_location_unref0 (self->priv->found_location);
 
1242
        self->priv->found_location = NULL;
 
1243
        self->priv->minimal_distance = 1000.0;
 
1244
        return self;
 
1245
}
 
1246
 
 
1247
 
 
1248
ClocksGeoInfo* clocks_geo_info_new (void) {
 
1249
        return clocks_geo_info_construct (CLOCKS_GEO_TYPE_INFO);
 
1250
}
 
1251
 
 
1252
 
 
1253
static void clocks_geo_info_seek_data_free (gpointer _data) {
 
1254
        ClocksGeoInfoSeekData* _data_;
 
1255
        _data_ = _data;
 
1256
        _g_object_unref0 (_data_->self);
 
1257
        g_slice_free (ClocksGeoInfoSeekData, _data_);
 
1258
}
 
1259
 
 
1260
 
 
1261
static gpointer _g_object_ref0 (gpointer self) {
 
1262
        return self ? g_object_ref (self) : NULL;
 
1263
}
 
1264
 
 
1265
 
 
1266
void clocks_geo_info_seek (ClocksGeoInfo* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
 
1267
        ClocksGeoInfoSeekData* _data_;
 
1268
        ClocksGeoInfo* _tmp0_ = NULL;
 
1269
        _data_ = g_slice_new0 (ClocksGeoInfoSeekData);
 
1270
        _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, clocks_geo_info_seek);
 
1271
        g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, clocks_geo_info_seek_data_free);
 
1272
        _tmp0_ = _g_object_ref0 (self);
 
1273
        _data_->self = _tmp0_;
 
1274
        clocks_geo_info_seek_co (_data_);
 
1275
}
 
1276
 
 
1277
 
 
1278
void clocks_geo_info_seek_finish (ClocksGeoInfo* self, GAsyncResult* _res_) {
 
1279
        ClocksGeoInfoSeekData* _data_;
 
1280
        _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
 
1281
}
 
1282
 
 
1283
 
 
1284
static void clocks_geo_info_seek_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
 
1285
        ClocksGeoInfoSeekData* _data_;
 
1286
        _data_ = _user_data_;
 
1287
        _data_->_source_object_ = source_object;
 
1288
        _data_->_res_ = _res_;
 
1289
        clocks_geo_info_seek_co (_data_);
 
1290
}
 
1291
 
 
1292
 
 
1293
static void __lambda22_ (ClocksGeoInfo* self, GObject* obj, GAsyncResult* res) {
 
1294
        GAsyncResult* _tmp0_ = NULL;
 
1295
        g_return_if_fail (res != NULL);
 
1296
        _tmp0_ = res;
 
1297
        clocks_geo_info_on_location_updated_finish (self, _tmp0_);
 
1298
}
 
1299
 
 
1300
 
 
1301
static void ___lambda22__gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self) {
 
1302
        __lambda22_ (self, source_object, res);
 
1303
        g_object_unref (self);
 
1304
}
 
1305
 
 
1306
 
 
1307
static void __lambda21_ (ClocksGeoInfo* self, const gchar* old_path, const gchar* new_path) {
 
1308
        const gchar* _tmp0_ = NULL;
 
1309
        const gchar* _tmp1_ = NULL;
 
1310
        g_return_if_fail (old_path != NULL);
 
1311
        g_return_if_fail (new_path != NULL);
 
1312
        _tmp0_ = old_path;
 
1313
        _tmp1_ = new_path;
 
1314
        clocks_geo_info_on_location_updated (self, _tmp0_, _tmp1_, ___lambda22__gasync_ready_callback, g_object_ref (self));
 
1315
}
 
1316
 
 
1317
 
 
1318
static void ___lambda21__clocks_geo_client_location_updated (ClocksGeoClient* _sender, const gchar* old_path, const gchar* new_path, gpointer self) {
 
1319
        __lambda21_ (self, old_path, new_path);
 
1320
}
 
1321
 
 
1322
 
 
1323
static gboolean clocks_geo_info_seek_co (ClocksGeoInfoSeekData* _data_) {
 
1324
        switch (_data_->_state_) {
 
1325
                case 0:
 
1326
                goto _state_0;
 
1327
                case 1:
 
1328
                goto _state_1;
 
1329
                case 2:
 
1330
                goto _state_2;
 
1331
                case 3:
 
1332
                goto _state_3;
 
1333
                case 4:
 
1334
                goto _state_4;
 
1335
                default:
 
1336
                g_assert_not_reached ();
 
1337
        }
 
1338
        _state_0:
 
1339
        _data_->client_path = NULL;
 
1340
        {
 
1341
                _data_->_state_ = 1;
 
1342
                g_async_initable_new_async (CLOCKS_GEO_TYPE_MANAGER_PROXY, 0, NULL, clocks_geo_info_seek_ready, _data_, "g-flags", 0, "g-name", "org.freedesktop.GeoClue2", "g-bus-type", G_BUS_TYPE_SYSTEM, "g-object-path", "/org/freedesktop/GeoClue2/Manager", "g-interface-name", "org.freedesktop.GeoClue2.Manager", NULL);
 
1343
                return FALSE;
 
1344
                _state_1:
 
1345
                _data_->_tmp1_ = NULL;
 
1346
                _data_->_tmp1_ = g_async_initable_new_finish (_data_->_source_object_, _data_->_res_, &_data_->_inner_error_);
 
1347
                _data_->_tmp0_ = (ClocksGeoManager*) _data_->_tmp1_;
 
1348
                if (_data_->_inner_error_ != NULL) {
 
1349
                        if (_data_->_inner_error_->domain == G_IO_ERROR) {
 
1350
                                goto __catch8_g_io_error;
 
1351
                        }
 
1352
                        _g_free0 (_data_->client_path);
 
1353
                        g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
 
1354
                        g_clear_error (&_data_->_inner_error_);
 
1355
                        return FALSE;
 
1356
                }
 
1357
                _g_object_unref0 (_data_->self->priv->manager);
 
1358
                _data_->self->priv->manager = _data_->_tmp0_;
 
1359
        }
 
1360
        goto __finally8;
 
1361
        __catch8_g_io_error:
 
1362
        {
 
1363
                _data_->e = _data_->_inner_error_;
 
1364
                _data_->_inner_error_ = NULL;
 
1365
                _data_->_tmp2_ = NULL;
 
1366
                _data_->_tmp2_ = _data_->e;
 
1367
                _data_->_tmp3_ = NULL;
 
1368
                _data_->_tmp3_ = _data_->_tmp2_->message;
 
1369
                g_warning ("geocoding.vala:73: Failed to connect to GeoClue2 Manager service: %s", _data_->_tmp3_);
 
1370
                _g_error_free0 (_data_->e);
 
1371
                _g_free0 (_data_->client_path);
 
1372
                if (_data_->_state_ == 0) {
 
1373
                        g_simple_async_result_complete_in_idle (_data_->_async_result);
 
1374
                } else {
 
1375
                        g_simple_async_result_complete (_data_->_async_result);
 
1376
                }
 
1377
                g_object_unref (_data_->_async_result);
 
1378
                return FALSE;
 
1379
        }
 
1380
        __finally8:
 
1381
        if (_data_->_inner_error_ != NULL) {
 
1382
                _g_free0 (_data_->client_path);
 
1383
                g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
 
1384
                g_clear_error (&_data_->_inner_error_);
 
1385
                return FALSE;
 
1386
        }
 
1387
        {
 
1388
                _data_->_tmp4_ = NULL;
 
1389
                _data_->_tmp4_ = _data_->self->priv->manager;
 
1390
                _data_->_tmp5_ = NULL;
 
1391
                _data_->_state_ = 2;
 
1392
                clocks_geo_manager_get_client (_data_->_tmp4_, clocks_geo_info_seek_ready, _data_);
 
1393
                return FALSE;
 
1394
                _state_2:
 
1395
                clocks_geo_manager_get_client_finish (_data_->_tmp4_, _data_->_res_, &_data_->_tmp5_, &_data_->_inner_error_);
 
1396
                _g_free0 (_data_->client_path);
 
1397
                _data_->client_path = _data_->_tmp5_;
 
1398
                if (_data_->_inner_error_ != NULL) {
 
1399
                        if (_data_->_inner_error_->domain == G_IO_ERROR) {
 
1400
                                goto __catch9_g_io_error;
 
1401
                        }
 
1402
                        _g_free0 (_data_->client_path);
 
1403
                        g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
 
1404
                        g_clear_error (&_data_->_inner_error_);
 
1405
                        return FALSE;
 
1406
                }
 
1407
        }
 
1408
        goto __finally9;
 
1409
        __catch9_g_io_error:
 
1410
        {
 
1411
                _data_->_vala1_e = _data_->_inner_error_;
 
1412
                _data_->_inner_error_ = NULL;
 
1413
                _data_->_tmp6_ = NULL;
 
1414
                _data_->_tmp6_ = _data_->_vala1_e;
 
1415
                _data_->_tmp7_ = NULL;
 
1416
                _data_->_tmp7_ = _data_->_tmp6_->message;
 
1417
                g_warning ("geocoding.vala:80: Failed to connect to GeoClue2 Manager service: %s", _data_->_tmp7_);
 
1418
                _g_error_free0 (_data_->_vala1_e);
 
1419
                _g_free0 (_data_->client_path);
 
1420
                if (_data_->_state_ == 0) {
 
1421
                        g_simple_async_result_complete_in_idle (_data_->_async_result);
 
1422
                } else {
 
1423
                        g_simple_async_result_complete (_data_->_async_result);
 
1424
                }
 
1425
                g_object_unref (_data_->_async_result);
 
1426
                return FALSE;
 
1427
        }
 
1428
        __finally9:
 
1429
        if (_data_->_inner_error_ != NULL) {
 
1430
                _g_free0 (_data_->client_path);
 
1431
                g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
 
1432
                g_clear_error (&_data_->_inner_error_);
 
1433
                return FALSE;
 
1434
        }
 
1435
        _data_->_tmp8_ = NULL;
 
1436
        _data_->_tmp8_ = _data_->client_path;
 
1437
        if (_data_->_tmp8_ == NULL) {
 
1438
                g_warning ("geocoding.vala:85: The client path is not set");
 
1439
                _g_free0 (_data_->client_path);
 
1440
                if (_data_->_state_ == 0) {
 
1441
                        g_simple_async_result_complete_in_idle (_data_->_async_result);
 
1442
                } else {
 
1443
                        g_simple_async_result_complete (_data_->_async_result);
 
1444
                }
 
1445
                g_object_unref (_data_->_async_result);
 
1446
                return FALSE;
 
1447
        }
 
1448
        {
 
1449
                _data_->_tmp10_ = NULL;
 
1450
                _data_->_tmp10_ = _data_->client_path;
 
1451
                _data_->_state_ = 3;
 
1452
                g_async_initable_new_async (CLOCKS_GEO_TYPE_CLIENT_PROXY, 0, NULL, clocks_geo_info_seek_ready, _data_, "g-flags", 0, "g-name", "org.freedesktop.GeoClue2", "g-bus-type", G_BUS_TYPE_SYSTEM, "g-object-path", _data_->_tmp10_, "g-interface-name", "org.freedesktop.GeoClue2.Client", NULL);
 
1453
                return FALSE;
 
1454
                _state_3:
 
1455
                _data_->_tmp11_ = NULL;
 
1456
                _data_->_tmp11_ = g_async_initable_new_finish (_data_->_source_object_, _data_->_res_, &_data_->_inner_error_);
 
1457
                _data_->_tmp9_ = (ClocksGeoClient*) _data_->_tmp11_;
 
1458
                if (_data_->_inner_error_ != NULL) {
 
1459
                        if (_data_->_inner_error_->domain == G_IO_ERROR) {
 
1460
                                goto __catch10_g_io_error;
 
1461
                        }
 
1462
                        _g_free0 (_data_->client_path);
 
1463
                        g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
 
1464
                        g_clear_error (&_data_->_inner_error_);
 
1465
                        return FALSE;
 
1466
                }
 
1467
                _g_object_unref0 (_data_->self->priv->client);
 
1468
                _data_->self->priv->client = _data_->_tmp9_;
 
1469
        }
 
1470
        goto __finally10;
 
1471
        __catch10_g_io_error:
 
1472
        {
 
1473
                _data_->_vala2_e = _data_->_inner_error_;
 
1474
                _data_->_inner_error_ = NULL;
 
1475
                _data_->_tmp12_ = NULL;
 
1476
                _data_->_tmp12_ = _data_->_vala2_e;
 
1477
                _data_->_tmp13_ = NULL;
 
1478
                _data_->_tmp13_ = _data_->_tmp12_->message;
 
1479
                g_warning ("geocoding.vala:94: Failed to connect to GeoClue2 Client service: %s", _data_->_tmp13_);
 
1480
                _g_error_free0 (_data_->_vala2_e);
 
1481
                _g_free0 (_data_->client_path);
 
1482
                if (_data_->_state_ == 0) {
 
1483
                        g_simple_async_result_complete_in_idle (_data_->_async_result);
 
1484
                } else {
 
1485
                        g_simple_async_result_complete (_data_->_async_result);
 
1486
                }
 
1487
                g_object_unref (_data_->_async_result);
 
1488
                return FALSE;
 
1489
        }
 
1490
        __finally10:
 
1491
        if (_data_->_inner_error_ != NULL) {
 
1492
                _g_free0 (_data_->client_path);
 
1493
                g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
 
1494
                g_clear_error (&_data_->_inner_error_);
 
1495
                return FALSE;
 
1496
        }
 
1497
        _data_->_tmp14_ = NULL;
 
1498
        _data_->_tmp14_ = _data_->self->priv->client;
 
1499
        g_signal_connect_object (_data_->_tmp14_, "location-updated", (GCallback) ___lambda21__clocks_geo_client_location_updated, _data_->self, 0);
 
1500
        {
 
1501
                _data_->_tmp15_ = NULL;
 
1502
                _data_->_tmp15_ = _data_->self->priv->client;
 
1503
                _data_->_state_ = 4;
 
1504
                clocks_geo_client_start (_data_->_tmp15_, clocks_geo_info_seek_ready, _data_);
 
1505
                return FALSE;
 
1506
                _state_4:
 
1507
                clocks_geo_client_start_finish (_data_->_tmp15_, _data_->_res_, &_data_->_inner_error_);
 
1508
                if (_data_->_inner_error_ != NULL) {
 
1509
                        if (_data_->_inner_error_->domain == G_IO_ERROR) {
 
1510
                                goto __catch11_g_io_error;
 
1511
                        }
 
1512
                        _g_free0 (_data_->client_path);
 
1513
                        g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
 
1514
                        g_clear_error (&_data_->_inner_error_);
 
1515
                        return FALSE;
 
1516
                }
 
1517
        }
 
1518
        goto __finally11;
 
1519
        __catch11_g_io_error:
 
1520
        {
 
1521
                _data_->_vala3_e = _data_->_inner_error_;
 
1522
                _data_->_inner_error_ = NULL;
 
1523
                _data_->_tmp16_ = NULL;
 
1524
                _data_->_tmp16_ = _data_->_vala3_e;
 
1525
                _data_->_tmp17_ = NULL;
 
1526
                _data_->_tmp17_ = _data_->_tmp16_->message;
 
1527
                g_warning ("geocoding.vala:107: Failed to start client: %s", _data_->_tmp17_);
 
1528
                _g_error_free0 (_data_->_vala3_e);
 
1529
                _g_free0 (_data_->client_path);
 
1530
                if (_data_->_state_ == 0) {
 
1531
                        g_simple_async_result_complete_in_idle (_data_->_async_result);
 
1532
                } else {
 
1533
                        g_simple_async_result_complete (_data_->_async_result);
 
1534
                }
 
1535
                g_object_unref (_data_->_async_result);
 
1536
                return FALSE;
 
1537
        }
 
1538
        __finally11:
 
1539
        if (_data_->_inner_error_ != NULL) {
 
1540
                _g_free0 (_data_->client_path);
 
1541
                g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
 
1542
                g_clear_error (&_data_->_inner_error_);
 
1543
                return FALSE;
 
1544
        }
 
1545
        _g_free0 (_data_->client_path);
 
1546
        if (_data_->_state_ == 0) {
 
1547
                g_simple_async_result_complete_in_idle (_data_->_async_result);
 
1548
        } else {
 
1549
                g_simple_async_result_complete (_data_->_async_result);
 
1550
        }
 
1551
        g_object_unref (_data_->_async_result);
 
1552
        return FALSE;
 
1553
}
 
1554
 
 
1555
 
 
1556
static void clocks_geo_info_on_location_updated_data_free (gpointer _data) {
 
1557
        ClocksGeoInfoOnLocationUpdatedData* _data_;
 
1558
        _data_ = _data;
 
1559
        _g_free0 (_data_->old_path);
 
1560
        _g_free0 (_data_->new_path);
 
1561
        _g_object_unref0 (_data_->self);
 
1562
        g_slice_free (ClocksGeoInfoOnLocationUpdatedData, _data_);
 
1563
}
 
1564
 
 
1565
 
 
1566
void clocks_geo_info_on_location_updated (ClocksGeoInfo* self, const gchar* old_path, const gchar* new_path, GAsyncReadyCallback _callback_, gpointer _user_data_) {
 
1567
        ClocksGeoInfoOnLocationUpdatedData* _data_;
 
1568
        ClocksGeoInfo* _tmp0_ = NULL;
 
1569
        const gchar* _tmp1_ = NULL;
 
1570
        gchar* _tmp2_ = NULL;
 
1571
        const gchar* _tmp3_ = NULL;
 
1572
        gchar* _tmp4_ = NULL;
 
1573
        _data_ = g_slice_new0 (ClocksGeoInfoOnLocationUpdatedData);
 
1574
        _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, clocks_geo_info_on_location_updated);
 
1575
        g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, clocks_geo_info_on_location_updated_data_free);
 
1576
        _tmp0_ = _g_object_ref0 (self);
 
1577
        _data_->self = _tmp0_;
 
1578
        _tmp1_ = old_path;
 
1579
        _tmp2_ = g_strdup (_tmp1_);
 
1580
        _g_free0 (_data_->old_path);
 
1581
        _data_->old_path = _tmp2_;
 
1582
        _tmp3_ = new_path;
 
1583
        _tmp4_ = g_strdup (_tmp3_);
 
1584
        _g_free0 (_data_->new_path);
 
1585
        _data_->new_path = _tmp4_;
 
1586
        clocks_geo_info_on_location_updated_co (_data_);
 
1587
}
 
1588
 
 
1589
 
 
1590
void clocks_geo_info_on_location_updated_finish (ClocksGeoInfo* self, GAsyncResult* _res_) {
 
1591
        ClocksGeoInfoOnLocationUpdatedData* _data_;
 
1592
        _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
 
1593
}
 
1594
 
 
1595
 
 
1596
static void clocks_geo_info_on_location_updated_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
 
1597
        ClocksGeoInfoOnLocationUpdatedData* _data_;
 
1598
        _data_ = _user_data_;
 
1599
        _data_->_source_object_ = source_object;
 
1600
        _data_->_res_ = _res_;
 
1601
        clocks_geo_info_on_location_updated_co (_data_);
 
1602
}
 
1603
 
 
1604
 
 
1605
static gboolean clocks_geo_info_on_location_updated_co (ClocksGeoInfoOnLocationUpdatedData* _data_) {
 
1606
        switch (_data_->_state_) {
 
1607
                case 0:
 
1608
                goto _state_0;
 
1609
                case 1:
 
1610
                goto _state_1;
 
1611
                case 2:
 
1612
                goto _state_2;
 
1613
                case 3:
 
1614
                goto _state_3;
 
1615
                default:
 
1616
                g_assert_not_reached ();
 
1617
        }
 
1618
        _state_0:
 
1619
        {
 
1620
                _data_->_tmp1_ = NULL;
 
1621
                _data_->_tmp1_ = _data_->new_path;
 
1622
                _data_->_state_ = 1;
 
1623
                g_async_initable_new_async (CLOCKS_GEO_TYPE_LOCATION_PROXY, 0, NULL, clocks_geo_info_on_location_updated_ready, _data_, "g-flags", 0, "g-name", "org.freedesktop.GeoClue2", "g-bus-type", G_BUS_TYPE_SYSTEM, "g-object-path", _data_->_tmp1_, "g-interface-name", "org.freedesktop.GeoClue2.Location", NULL);
 
1624
                return FALSE;
 
1625
                _state_1:
 
1626
                _data_->_tmp2_ = NULL;
 
1627
                _data_->_tmp2_ = g_async_initable_new_finish (_data_->_source_object_, _data_->_res_, &_data_->_inner_error_);
 
1628
                _data_->_tmp0_ = (ClocksGeoLocation*) _data_->_tmp2_;
 
1629
                if (_data_->_inner_error_ != NULL) {
 
1630
                        if (_data_->_inner_error_->domain == G_IO_ERROR) {
 
1631
                                goto __catch12_g_io_error;
 
1632
                        }
 
1633
                        g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
 
1634
                        g_clear_error (&_data_->_inner_error_);
 
1635
                        return FALSE;
 
1636
                }
 
1637
                _data_->_tmp3_ = NULL;
 
1638
                _data_->_tmp3_ = _data_->_tmp0_;
 
1639
                clocks_geo_info_set_geo_location (_data_->self, _data_->_tmp3_);
 
1640
                _g_object_unref0 (_data_->_tmp3_);
 
1641
        }
 
1642
        goto __finally12;
 
1643
        __catch12_g_io_error:
 
1644
        {
 
1645
                _data_->e = _data_->_inner_error_;
 
1646
                _data_->_inner_error_ = NULL;
 
1647
                _data_->_tmp4_ = NULL;
 
1648
                _data_->_tmp4_ = _data_->e;
 
1649
                _data_->_tmp5_ = NULL;
 
1650
                _data_->_tmp5_ = _data_->_tmp4_->message;
 
1651
                g_warning ("geocoding.vala:118: Failed to connect to GeoClue2 Location service: %s", _data_->_tmp5_);
 
1652
                _g_error_free0 (_data_->e);
 
1653
                if (_data_->_state_ == 0) {
 
1654
                        g_simple_async_result_complete_in_idle (_data_->_async_result);
 
1655
                } else {
 
1656
                        g_simple_async_result_complete (_data_->_async_result);
 
1657
                }
 
1658
                g_object_unref (_data_->_async_result);
 
1659
                return FALSE;
 
1660
        }
 
1661
        __finally12:
 
1662
        if (_data_->_inner_error_ != NULL) {
 
1663
                g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
 
1664
                g_clear_error (&_data_->_inner_error_);
 
1665
                return FALSE;
 
1666
        }
 
1667
        _data_->_state_ = 2;
 
1668
        clocks_geo_info_seek_country_code (_data_->self, clocks_geo_info_on_location_updated_ready, _data_);
 
1669
        return FALSE;
 
1670
        _state_2:
 
1671
        clocks_geo_info_seek_country_code_finish (_data_->self, _data_->_res_);
 
1672
        _data_->_tmp6_ = NULL;
 
1673
        _data_->_tmp6_ = gweather_location_get_world ();
 
1674
        _data_->_state_ = 3;
 
1675
        clocks_geo_info_search_locations (_data_->self, _data_->_tmp6_, clocks_geo_info_on_location_updated_ready, _data_);
 
1676
        return FALSE;
 
1677
        _state_3:
 
1678
        clocks_geo_info_search_locations_finish (_data_->self, _data_->_res_);
 
1679
        _data_->_tmp7_ = NULL;
 
1680
        _data_->_tmp7_ = _data_->self->priv->found_location;
 
1681
        if (_data_->_tmp7_ != NULL) {
 
1682
                _data_->_tmp8_ = NULL;
 
1683
                _data_->_tmp8_ = _data_->self->priv->found_location;
 
1684
                g_signal_emit_by_name (_data_->self, "location-changed", _data_->_tmp8_);
 
1685
        }
 
1686
        if (_data_->_state_ == 0) {
 
1687
                g_simple_async_result_complete_in_idle (_data_->_async_result);
 
1688
        } else {
 
1689
                g_simple_async_result_complete (_data_->_async_result);
 
1690
        }
 
1691
        g_object_unref (_data_->_async_result);
 
1692
        return FALSE;
 
1693
}
 
1694
 
 
1695
 
 
1696
static void clocks_geo_info_seek_country_code_data_free (gpointer _data) {
 
1697
        ClocksGeoInfoSeekCountryCodeData* _data_;
 
1698
        _data_ = _data;
 
1699
        _g_object_unref0 (_data_->self);
 
1700
        g_slice_free (ClocksGeoInfoSeekCountryCodeData, _data_);
 
1701
}
 
1702
 
 
1703
 
 
1704
static void clocks_geo_info_seek_country_code (ClocksGeoInfo* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
 
1705
        ClocksGeoInfoSeekCountryCodeData* _data_;
 
1706
        ClocksGeoInfo* _tmp0_ = NULL;
 
1707
        _data_ = g_slice_new0 (ClocksGeoInfoSeekCountryCodeData);
 
1708
        _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, clocks_geo_info_seek_country_code);
 
1709
        g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, clocks_geo_info_seek_country_code_data_free);
 
1710
        _tmp0_ = _g_object_ref0 (self);
 
1711
        _data_->self = _tmp0_;
 
1712
        clocks_geo_info_seek_country_code_co (_data_);
 
1713
}
 
1714
 
 
1715
 
 
1716
static void clocks_geo_info_seek_country_code_finish (ClocksGeoInfo* self, GAsyncResult* _res_) {
 
1717
        ClocksGeoInfoSeekCountryCodeData* _data_;
 
1718
        _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
 
1719
}
 
1720
 
 
1721
 
 
1722
static void clocks_geo_info_seek_country_code_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
 
1723
        ClocksGeoInfoSeekCountryCodeData* _data_;
 
1724
        _data_ = _user_data_;
 
1725
        _data_->_source_object_ = source_object;
 
1726
        _data_->_res_ = _res_;
 
1727
        clocks_geo_info_seek_country_code_co (_data_);
 
1728
}
 
1729
 
 
1730
 
 
1731
static gboolean clocks_geo_info_seek_country_code_co (ClocksGeoInfoSeekCountryCodeData* _data_) {
 
1732
        switch (_data_->_state_) {
 
1733
                case 0:
 
1734
                goto _state_0;
 
1735
                case 1:
 
1736
                goto _state_1;
 
1737
                default:
 
1738
                g_assert_not_reached ();
 
1739
        }
 
1740
        _state_0:
 
1741
        _data_->_tmp0_ = NULL;
 
1742
        _data_->_tmp0_ = _data_->self->priv->_geo_location;
 
1743
        _data_->_tmp1_ = 0.0;
 
1744
        _data_->_tmp1_ = clocks_geo_location_get_latitude (_data_->_tmp0_);
 
1745
        _data_->_tmp2_ = 0.0;
 
1746
        _data_->_tmp2_ = _data_->_tmp1_;
 
1747
        _data_->_tmp3_ = NULL;
 
1748
        _data_->_tmp3_ = _data_->self->priv->_geo_location;
 
1749
        _data_->_tmp4_ = 0.0;
 
1750
        _data_->_tmp4_ = clocks_geo_location_get_longitude (_data_->_tmp3_);
 
1751
        _data_->_tmp5_ = 0.0;
 
1752
        _data_->_tmp5_ = _data_->_tmp4_;
 
1753
        _data_->_tmp6_ = NULL;
 
1754
        _data_->_tmp6_ = geocode_location_new (_data_->_tmp2_, _data_->_tmp5_, (gdouble) GEOCODE_LOCATION_ACCURACY_UNKNOWN);
 
1755
        _data_->location = _data_->_tmp6_;
 
1756
        _data_->_tmp7_ = NULL;
 
1757
        _data_->_tmp7_ = geocode_reverse_new_for_location (_data_->location);
 
1758
        _data_->reverse = _data_->_tmp7_;
 
1759
        {
 
1760
                _data_->_state_ = 1;
 
1761
                geocode_reverse_resolve_async (_data_->reverse, NULL, clocks_geo_info_seek_country_code_ready, _data_);
 
1762
                return FALSE;
 
1763
                _state_1:
 
1764
                _data_->_tmp8_ = NULL;
 
1765
                _data_->_tmp8_ = geocode_reverse_resolve_finish (_data_->reverse, _data_->_res_, &_data_->_inner_error_);
 
1766
                _data_->place = _data_->_tmp8_;
 
1767
                if (_data_->_inner_error_ != NULL) {
 
1768
                        goto __catch13_g_error;
 
1769
                }
 
1770
                _data_->_tmp9_ = NULL;
 
1771
                _data_->_tmp9_ = geocode_place_get_country_code (_data_->place);
 
1772
                _data_->_tmp10_ = NULL;
 
1773
                _data_->_tmp10_ = g_strdup (_data_->_tmp9_);
 
1774
                _g_free0 (_data_->self->priv->country_code);
 
1775
                _data_->self->priv->country_code = _data_->_tmp10_;
 
1776
                _g_object_unref0 (_data_->place);
 
1777
        }
 
1778
        goto __finally13;
 
1779
        __catch13_g_error:
 
1780
        {
 
1781
                _data_->e = _data_->_inner_error_;
 
1782
                _data_->_inner_error_ = NULL;
 
1783
                _data_->_tmp11_ = NULL;
 
1784
                _data_->_tmp11_ = _data_->e;
 
1785
                _data_->_tmp12_ = NULL;
 
1786
                _data_->_tmp12_ = _data_->_tmp11_->message;
 
1787
                g_warning ("geocoding.vala:140: Failed to obtain country code: %s", _data_->_tmp12_);
 
1788
                _g_error_free0 (_data_->e);
 
1789
        }
 
1790
        __finally13:
 
1791
        if (_data_->_inner_error_ != NULL) {
 
1792
                _g_object_unref0 (_data_->reverse);
 
1793
                _g_object_unref0 (_data_->location);
 
1794
                g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
 
1795
                g_clear_error (&_data_->_inner_error_);
 
1796
                return FALSE;
 
1797
        }
 
1798
        _g_object_unref0 (_data_->reverse);
 
1799
        _g_object_unref0 (_data_->location);
 
1800
        if (_data_->_state_ == 0) {
 
1801
                g_simple_async_result_complete_in_idle (_data_->_async_result);
 
1802
        } else {
 
1803
                g_simple_async_result_complete (_data_->_async_result);
 
1804
        }
 
1805
        g_object_unref (_data_->_async_result);
 
1806
        return FALSE;
 
1807
}
 
1808
 
 
1809
 
 
1810
static gdouble clocks_geo_info_deg_to_rad (ClocksGeoInfo* self, gdouble deg) {
 
1811
        gdouble result = 0.0;
 
1812
        gdouble _tmp0_ = 0.0;
 
1813
        g_return_val_if_fail (self != NULL, 0.0);
 
1814
        _tmp0_ = deg;
 
1815
        result = (G_PI / 180.0) * _tmp0_;
 
1816
        return result;
 
1817
}
 
1818
 
 
1819
 
 
1820
static gdouble clocks_geo_info_get_distance (ClocksGeoInfo* self, gdouble latitude1, gdouble longitude1, gdouble latitude2, gdouble longitude2) {
 
1821
        gdouble result = 0.0;
 
1822
        static const gdouble earth_radius = 6372.795;
 
1823
        gdouble lat1 = 0.0;
 
1824
        gdouble _tmp0_ = 0.0;
 
1825
        gdouble _tmp1_ = 0.0;
 
1826
        gdouble lat2 = 0.0;
 
1827
        gdouble _tmp2_ = 0.0;
 
1828
        gdouble _tmp3_ = 0.0;
 
1829
        gdouble lon1 = 0.0;
 
1830
        gdouble _tmp4_ = 0.0;
 
1831
        gdouble _tmp5_ = 0.0;
 
1832
        gdouble lon2 = 0.0;
 
1833
        gdouble _tmp6_ = 0.0;
 
1834
        gdouble _tmp7_ = 0.0;
 
1835
        gdouble _tmp8_ = 0.0;
 
1836
        gdouble _tmp9_ = 0.0;
 
1837
        gdouble _tmp10_ = 0.0;
 
1838
        gdouble _tmp11_ = 0.0;
 
1839
        gdouble _tmp12_ = 0.0;
 
1840
        gdouble _tmp13_ = 0.0;
 
1841
        g_return_val_if_fail (self != NULL, 0.0);
 
1842
        _tmp0_ = latitude1;
 
1843
        _tmp1_ = clocks_geo_info_deg_to_rad (self, _tmp0_);
 
1844
        lat1 = _tmp1_;
 
1845
        _tmp2_ = latitude2;
 
1846
        _tmp3_ = clocks_geo_info_deg_to_rad (self, _tmp2_);
 
1847
        lat2 = _tmp3_;
 
1848
        _tmp4_ = longitude1;
 
1849
        _tmp5_ = clocks_geo_info_deg_to_rad (self, _tmp4_);
 
1850
        lon1 = _tmp5_;
 
1851
        _tmp6_ = longitude2;
 
1852
        _tmp7_ = clocks_geo_info_deg_to_rad (self, _tmp6_);
 
1853
        lon2 = _tmp7_;
 
1854
        _tmp8_ = cos (lat1);
 
1855
        _tmp9_ = cos (lat2);
 
1856
        _tmp10_ = cos (lon1 - lon2);
 
1857
        _tmp11_ = sin (lat1);
 
1858
        _tmp12_ = sin (lat2);
 
1859
        _tmp13_ = acos (((_tmp8_ * _tmp9_) * _tmp10_) + (_tmp11_ * _tmp12_));
 
1860
        result = _tmp13_ * earth_radius;
 
1861
        return result;
 
1862
}
 
1863
 
 
1864
 
 
1865
static void clocks_geo_info_search_locations_data_free (gpointer _data) {
 
1866
        ClocksGeoInfoSearchLocationsData* _data_;
 
1867
        _data_ = _data;
 
1868
        _gweather_location_unref0 (_data_->location);
 
1869
        _g_object_unref0 (_data_->self);
 
1870
        g_slice_free (ClocksGeoInfoSearchLocationsData, _data_);
 
1871
}
 
1872
 
 
1873
 
 
1874
static gpointer _gweather_location_ref0 (gpointer self) {
 
1875
        return self ? gweather_location_ref (self) : NULL;
 
1876
}
 
1877
 
 
1878
 
 
1879
static void clocks_geo_info_search_locations (ClocksGeoInfo* self, GWeatherLocation* location, GAsyncReadyCallback _callback_, gpointer _user_data_) {
 
1880
        ClocksGeoInfoSearchLocationsData* _data_;
 
1881
        ClocksGeoInfo* _tmp0_ = NULL;
 
1882
        GWeatherLocation* _tmp1_ = NULL;
 
1883
        GWeatherLocation* _tmp2_ = NULL;
 
1884
        _data_ = g_slice_new0 (ClocksGeoInfoSearchLocationsData);
 
1885
        _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, clocks_geo_info_search_locations);
 
1886
        g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, clocks_geo_info_search_locations_data_free);
 
1887
        _tmp0_ = _g_object_ref0 (self);
 
1888
        _data_->self = _tmp0_;
 
1889
        _tmp1_ = location;
 
1890
        _tmp2_ = _gweather_location_ref0 (_tmp1_);
 
1891
        _gweather_location_unref0 (_data_->location);
 
1892
        _data_->location = _tmp2_;
 
1893
        clocks_geo_info_search_locations_co (_data_);
 
1894
}
 
1895
 
 
1896
 
 
1897
static void clocks_geo_info_search_locations_finish (ClocksGeoInfo* self, GAsyncResult* _res_) {
 
1898
        ClocksGeoInfoSearchLocationsData* _data_;
 
1899
        _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
 
1900
}
 
1901
 
 
1902
 
 
1903
static GWeatherLocation** _vala_array_dup1 (GWeatherLocation** self, int length) {
 
1904
        GWeatherLocation** result;
 
1905
        int i;
 
1906
        result = g_new0 (GWeatherLocation*, length + 1);
 
1907
        for (i = 0; i < length; i++) {
 
1908
                GWeatherLocation* _tmp0_ = NULL;
 
1909
                _tmp0_ = _gweather_location_ref0 (self[i]);
 
1910
                result[i] = _tmp0_;
 
1911
        }
 
1912
        return result;
 
1913
}
 
1914
 
 
1915
 
 
1916
static void clocks_geo_info_search_locations_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
 
1917
        ClocksGeoInfoSearchLocationsData* _data_;
 
1918
        _data_ = _user_data_;
 
1919
        _data_->_source_object_ = source_object;
 
1920
        _data_->_res_ = _res_;
 
1921
        clocks_geo_info_search_locations_co (_data_);
 
1922
}
 
1923
 
 
1924
 
 
1925
static gboolean clocks_geo_info_search_locations_co (ClocksGeoInfoSearchLocationsData* _data_) {
 
1926
        switch (_data_->_state_) {
 
1927
                case 0:
 
1928
                goto _state_0;
 
1929
                case 1:
 
1930
                goto _state_1;
 
1931
                default:
 
1932
                g_assert_not_reached ();
 
1933
        }
 
1934
        _state_0:
 
1935
        _data_->_tmp0_ = NULL;
 
1936
        _data_->_tmp0_ = _data_->self->priv->country_code;
 
1937
        if (_data_->_tmp0_ != NULL) {
 
1938
                _data_->_tmp1_ = NULL;
 
1939
                _data_->_tmp1_ = _data_->location;
 
1940
                _data_->_tmp2_ = NULL;
 
1941
                _data_->_tmp2_ = gweather_location_get_country (_data_->_tmp1_);
 
1942
                _data_->_tmp3_ = NULL;
 
1943
                _data_->_tmp3_ = g_strdup (_data_->_tmp2_);
 
1944
                _data_->loc_country_code = _data_->_tmp3_;
 
1945
                _data_->_tmp4_ = NULL;
 
1946
                _data_->_tmp4_ = _data_->loc_country_code;
 
1947
                if (_data_->_tmp4_ != NULL) {
 
1948
                        _data_->_tmp5_ = NULL;
 
1949
                        _data_->_tmp5_ = _data_->loc_country_code;
 
1950
                        _data_->_tmp6_ = NULL;
 
1951
                        _data_->_tmp6_ = _data_->self->priv->country_code;
 
1952
                        if (g_strcmp0 (_data_->_tmp5_, _data_->_tmp6_) != 0) {
 
1953
                                _g_free0 (_data_->loc_country_code);
 
1954
                                if (_data_->_state_ == 0) {
 
1955
                                        g_simple_async_result_complete_in_idle (_data_->_async_result);
 
1956
                                } else {
 
1957
                                        g_simple_async_result_complete (_data_->_async_result);
 
1958
                                }
 
1959
                                g_object_unref (_data_->_async_result);
 
1960
                                return FALSE;
 
1961
                        }
 
1962
                }
 
1963
                _g_free0 (_data_->loc_country_code);
 
1964
        }
 
1965
        _data_->_tmp7_ = NULL;
 
1966
        _data_->_tmp7_ = _data_->location;
 
1967
        _data_->_tmp8_ = NULL;
 
1968
        _data_->_tmp9_ = NULL;
 
1969
        _data_->_tmp9_ = _data_->_tmp8_ = gweather_location_get_children (_data_->_tmp7_);
 
1970
        _data_->_tmp10_ = NULL;
 
1971
        _data_->_tmp10__length1 = 0;
 
1972
        _data_->_tmp10_ = (_data_->_tmp9_ != NULL) ? _vala_array_dup1 (_data_->_tmp9_, _vala_array_length (_data_->_tmp8_)) : ((gpointer) _data_->_tmp9_);
 
1973
        _data_->_tmp10__length1 = _vala_array_length (_data_->_tmp8_);
 
1974
        _data_->locations_length1 = 0;
 
1975
        _data_->_locations_size_ = 0;
 
1976
        _data_->locations = _data_->_tmp10_;
 
1977
        _data_->locations_length1 = _data_->_tmp10__length1;
 
1978
        _data_->_locations_size_ = _data_->locations_length1;
 
1979
        _data_->_tmp11_ = NULL;
 
1980
        _data_->_tmp11__length1 = 0;
 
1981
        _data_->_tmp11_ = _data_->locations;
 
1982
        _data_->_tmp11__length1 = _data_->locations_length1;
 
1983
        if (_data_->_tmp11_ != NULL) {
 
1984
                {
 
1985
                        _data_->i = 0;
 
1986
                        {
 
1987
                                _data_->_tmp12_ = TRUE;
 
1988
                                while (TRUE) {
 
1989
                                        _data_->_tmp13_ = FALSE;
 
1990
                                        _data_->_tmp13_ = _data_->_tmp12_;
 
1991
                                        if (!_data_->_tmp13_) {
 
1992
                                                _data_->_tmp14_ = 0;
 
1993
                                                _data_->_tmp14_ = _data_->i;
 
1994
                                                _data_->i = _data_->_tmp14_ + 1;
 
1995
                                        }
 
1996
                                        _data_->_tmp12_ = FALSE;
 
1997
                                        _data_->_tmp15_ = 0;
 
1998
                                        _data_->_tmp15_ = _data_->i;
 
1999
                                        _data_->_tmp16_ = NULL;
 
2000
                                        _data_->_tmp16__length1 = 0;
 
2001
                                        _data_->_tmp16_ = _data_->locations;
 
2002
                                        _data_->_tmp16__length1 = _data_->locations_length1;
 
2003
                                        if (!(_data_->_tmp15_ < _data_->_tmp16__length1)) {
 
2004
                                                break;
 
2005
                                        }
 
2006
                                        _data_->_tmp17_ = NULL;
 
2007
                                        _data_->_tmp17__length1 = 0;
 
2008
                                        _data_->_tmp17_ = _data_->locations;
 
2009
                                        _data_->_tmp17__length1 = _data_->locations_length1;
 
2010
                                        _data_->_tmp18_ = 0;
 
2011
                                        _data_->_tmp18_ = _data_->i;
 
2012
                                        _data_->_tmp19_ = NULL;
 
2013
                                        _data_->_tmp19_ = _data_->_tmp17_[_data_->_tmp18_];
 
2014
                                        _data_->_tmp20_ = 0;
 
2015
                                        _data_->_tmp20_ = gweather_location_get_level (_data_->_tmp19_);
 
2016
                                        if (_data_->_tmp20_ == GWEATHER_LOCATION_CITY) {
 
2017
                                                _data_->_tmp21_ = NULL;
 
2018
                                                _data_->_tmp21__length1 = 0;
 
2019
                                                _data_->_tmp21_ = _data_->locations;
 
2020
                                                _data_->_tmp21__length1 = _data_->locations_length1;
 
2021
                                                _data_->_tmp22_ = 0;
 
2022
                                                _data_->_tmp22_ = _data_->i;
 
2023
                                                _data_->_tmp23_ = NULL;
 
2024
                                                _data_->_tmp23_ = _data_->_tmp21_[_data_->_tmp22_];
 
2025
                                                _data_->_tmp24_ = FALSE;
 
2026
                                                _data_->_tmp24_ = gweather_location_has_coords (_data_->_tmp23_);
 
2027
                                                if (_data_->_tmp24_) {
 
2028
                                                        _data_->_tmp25_ = NULL;
 
2029
                                                        _data_->_tmp25__length1 = 0;
 
2030
                                                        _data_->_tmp25_ = _data_->locations;
 
2031
                                                        _data_->_tmp25__length1 = _data_->locations_length1;
 
2032
                                                        _data_->_tmp26_ = 0;
 
2033
                                                        _data_->_tmp26_ = _data_->i;
 
2034
                                                        _data_->_tmp27_ = NULL;
 
2035
                                                        _data_->_tmp27_ = _data_->_tmp25_[_data_->_tmp26_];
 
2036
                                                        _data_->_tmp28_ = 0.0;
 
2037
                                                        _data_->_tmp29_ = 0.0;
 
2038
                                                        gweather_location_get_coords (_data_->_tmp27_, &_data_->_tmp28_, &_data_->_tmp29_);
 
2039
                                                        _data_->latitude = _data_->_tmp28_;
 
2040
                                                        _data_->longitude = _data_->_tmp29_;
 
2041
                                                        _data_->_tmp30_ = NULL;
 
2042
                                                        _data_->_tmp30_ = _data_->self->priv->_geo_location;
 
2043
                                                        _data_->_tmp31_ = 0.0;
 
2044
                                                        _data_->_tmp31_ = clocks_geo_location_get_latitude (_data_->_tmp30_);
 
2045
                                                        _data_->_tmp32_ = 0.0;
 
2046
                                                        _data_->_tmp32_ = _data_->_tmp31_;
 
2047
                                                        _data_->_tmp33_ = NULL;
 
2048
                                                        _data_->_tmp33_ = _data_->self->priv->_geo_location;
 
2049
                                                        _data_->_tmp34_ = 0.0;
 
2050
                                                        _data_->_tmp34_ = clocks_geo_location_get_longitude (_data_->_tmp33_);
 
2051
                                                        _data_->_tmp35_ = 0.0;
 
2052
                                                        _data_->_tmp35_ = _data_->_tmp34_;
 
2053
                                                        _data_->_tmp36_ = 0.0;
 
2054
                                                        _data_->_tmp36_ = _data_->latitude;
 
2055
                                                        _data_->_tmp37_ = 0.0;
 
2056
                                                        _data_->_tmp37_ = _data_->longitude;
 
2057
                                                        _data_->_tmp38_ = 0.0;
 
2058
                                                        _data_->_tmp38_ = clocks_geo_info_get_distance (_data_->self, _data_->_tmp32_, _data_->_tmp35_, _data_->_tmp36_, _data_->_tmp37_);
 
2059
                                                        _data_->distance = _data_->_tmp38_;
 
2060
                                                        _data_->_tmp39_ = 0.0;
 
2061
                                                        _data_->_tmp39_ = _data_->distance;
 
2062
                                                        _data_->_tmp40_ = 0.0;
 
2063
                                                        _data_->_tmp40_ = _data_->self->priv->minimal_distance;
 
2064
                                                        if (_data_->_tmp39_ < _data_->_tmp40_) {
 
2065
                                                                _data_->_tmp41_ = NULL;
 
2066
                                                                _data_->_tmp41__length1 = 0;
 
2067
                                                                _data_->_tmp41_ = _data_->locations;
 
2068
                                                                _data_->_tmp41__length1 = _data_->locations_length1;
 
2069
                                                                _data_->_tmp42_ = 0;
 
2070
                                                                _data_->_tmp42_ = _data_->i;
 
2071
                                                                _data_->_tmp43_ = NULL;
 
2072
                                                                _data_->_tmp43_ = _data_->_tmp41_[_data_->_tmp42_];
 
2073
                                                                _data_->_tmp44_ = NULL;
 
2074
                                                                _data_->_tmp44_ = _gweather_location_ref0 (_data_->_tmp43_);
 
2075
                                                                _gweather_location_unref0 (_data_->self->priv->found_location);
 
2076
                                                                _data_->self->priv->found_location = _data_->_tmp44_;
 
2077
                                                                _data_->_tmp45_ = 0.0;
 
2078
                                                                _data_->_tmp45_ = _data_->distance;
 
2079
                                                                _data_->self->priv->minimal_distance = _data_->_tmp45_;
 
2080
                                                        }
 
2081
                                                }
 
2082
                                        }
 
2083
                                        _data_->_tmp46_ = NULL;
 
2084
                                        _data_->_tmp46__length1 = 0;
 
2085
                                        _data_->_tmp46_ = _data_->locations;
 
2086
                                        _data_->_tmp46__length1 = _data_->locations_length1;
 
2087
                                        _data_->_tmp47_ = 0;
 
2088
                                        _data_->_tmp47_ = _data_->i;
 
2089
                                        _data_->_tmp48_ = NULL;
 
2090
                                        _data_->_tmp48_ = _data_->_tmp46_[_data_->_tmp47_];
 
2091
                                        _data_->_state_ = 1;
 
2092
                                        clocks_geo_info_search_locations (_data_->self, _data_->_tmp48_, clocks_geo_info_search_locations_ready, _data_);
 
2093
                                        return FALSE;
 
2094
                                        _state_1:
 
2095
                                        clocks_geo_info_search_locations_finish (_data_->self, _data_->_res_);
 
2096
                                }
 
2097
                        }
 
2098
                }
 
2099
        }
 
2100
        _data_->locations = (_vala_array_free (_data_->locations, _data_->locations_length1, (GDestroyNotify) gweather_location_unref), NULL);
 
2101
        if (_data_->_state_ == 0) {
 
2102
                g_simple_async_result_complete_in_idle (_data_->_async_result);
 
2103
        } else {
 
2104
                g_simple_async_result_complete (_data_->_async_result);
 
2105
        }
 
2106
        g_object_unref (_data_->_async_result);
 
2107
        return FALSE;
 
2108
}
 
2109
 
 
2110
 
 
2111
static gpointer _gweather_timezone_ref0 (gpointer self) {
 
2112
        return self ? gweather_timezone_ref (self) : NULL;
 
2113
}
 
2114
 
 
2115
 
 
2116
gboolean clocks_geo_info_is_location_similar (ClocksGeoInfo* self, GWeatherLocation* location) {
 
2117
        gboolean result = FALSE;
 
2118
        GWeatherLocation* _tmp0_ = NULL;
 
2119
        g_return_val_if_fail (self != NULL, FALSE);
 
2120
        g_return_val_if_fail (location != NULL, FALSE);
 
2121
        _tmp0_ = self->priv->found_location;
 
2122
        if (_tmp0_ != NULL) {
 
2123
                gchar* country_code = NULL;
 
2124
                GWeatherLocation* _tmp1_ = NULL;
 
2125
                const gchar* _tmp2_ = NULL;
 
2126
                gchar* _tmp3_ = NULL;
 
2127
                gchar* found_country_code = NULL;
 
2128
                GWeatherLocation* _tmp4_ = NULL;
 
2129
                const gchar* _tmp5_ = NULL;
 
2130
                gchar* _tmp6_ = NULL;
 
2131
                gboolean _tmp7_ = FALSE;
 
2132
                const gchar* _tmp8_ = NULL;
 
2133
                gboolean _tmp11_ = FALSE;
 
2134
                _tmp1_ = location;
 
2135
                _tmp2_ = gweather_location_get_country (_tmp1_);
 
2136
                _tmp3_ = g_strdup (_tmp2_);
 
2137
                country_code = _tmp3_;
 
2138
                _tmp4_ = self->priv->found_location;
 
2139
                _tmp5_ = gweather_location_get_country (_tmp4_);
 
2140
                _tmp6_ = g_strdup (_tmp5_);
 
2141
                found_country_code = _tmp6_;
 
2142
                _tmp8_ = country_code;
 
2143
                if (_tmp8_ != NULL) {
 
2144
                        const gchar* _tmp9_ = NULL;
 
2145
                        const gchar* _tmp10_ = NULL;
 
2146
                        _tmp9_ = country_code;
 
2147
                        _tmp10_ = found_country_code;
 
2148
                        _tmp7_ = g_strcmp0 (_tmp9_, _tmp10_) == 0;
 
2149
                } else {
 
2150
                        _tmp7_ = FALSE;
 
2151
                }
 
2152
                _tmp11_ = _tmp7_;
 
2153
                if (_tmp11_) {
 
2154
                        GWeatherTimezone* timezone = NULL;
 
2155
                        GWeatherLocation* _tmp12_ = NULL;
 
2156
                        GWeatherTimezone* _tmp13_ = NULL;
 
2157
                        GWeatherTimezone* _tmp14_ = NULL;
 
2158
                        GWeatherTimezone* found_timezone = NULL;
 
2159
                        GWeatherLocation* _tmp15_ = NULL;
 
2160
                        GWeatherTimezone* _tmp16_ = NULL;
 
2161
                        GWeatherTimezone* _tmp17_ = NULL;
 
2162
                        gboolean _tmp18_ = FALSE;
 
2163
                        GWeatherTimezone* _tmp19_ = NULL;
 
2164
                        gboolean _tmp21_ = FALSE;
 
2165
                        _tmp12_ = location;
 
2166
                        _tmp13_ = gweather_location_get_timezone (_tmp12_);
 
2167
                        _tmp14_ = _gweather_timezone_ref0 (_tmp13_);
 
2168
                        timezone = _tmp14_;
 
2169
                        _tmp15_ = self->priv->found_location;
 
2170
                        _tmp16_ = gweather_location_get_timezone (_tmp15_);
 
2171
                        _tmp17_ = _gweather_timezone_ref0 (_tmp16_);
 
2172
                        found_timezone = _tmp17_;
 
2173
                        _tmp19_ = timezone;
 
2174
                        if (_tmp19_ != NULL) {
 
2175
                                GWeatherTimezone* _tmp20_ = NULL;
 
2176
                                _tmp20_ = found_timezone;
 
2177
                                _tmp18_ = _tmp20_ != NULL;
 
2178
                        } else {
 
2179
                                _tmp18_ = FALSE;
 
2180
                        }
 
2181
                        _tmp21_ = _tmp18_;
 
2182
                        if (_tmp21_) {
 
2183
                                gchar* tzid = NULL;
 
2184
                                GWeatherTimezone* _tmp22_ = NULL;
 
2185
                                const gchar* _tmp23_ = NULL;
 
2186
                                gchar* _tmp24_ = NULL;
 
2187
                                gchar* found_tzid = NULL;
 
2188
                                GWeatherTimezone* _tmp25_ = NULL;
 
2189
                                const gchar* _tmp26_ = NULL;
 
2190
                                gchar* _tmp27_ = NULL;
 
2191
                                const gchar* _tmp28_ = NULL;
 
2192
                                const gchar* _tmp29_ = NULL;
 
2193
                                _tmp22_ = timezone;
 
2194
                                _tmp23_ = gweather_timezone_get_tzid (_tmp22_);
 
2195
                                _tmp24_ = g_strdup (_tmp23_);
 
2196
                                tzid = _tmp24_;
 
2197
                                _tmp25_ = found_timezone;
 
2198
                                _tmp26_ = gweather_timezone_get_tzid (_tmp25_);
 
2199
                                _tmp27_ = g_strdup (_tmp26_);
 
2200
                                found_tzid = _tmp27_;
 
2201
                                _tmp28_ = tzid;
 
2202
                                _tmp29_ = found_tzid;
 
2203
                                if (g_strcmp0 (_tmp28_, _tmp29_) == 0) {
 
2204
                                        result = TRUE;
 
2205
                                        _g_free0 (found_tzid);
 
2206
                                        _g_free0 (tzid);
 
2207
                                        _gweather_timezone_unref0 (found_timezone);
 
2208
                                        _gweather_timezone_unref0 (timezone);
 
2209
                                        _g_free0 (found_country_code);
 
2210
                                        _g_free0 (country_code);
 
2211
                                        return result;
 
2212
                                }
 
2213
                                _g_free0 (found_tzid);
 
2214
                                _g_free0 (tzid);
 
2215
                        }
 
2216
                        _gweather_timezone_unref0 (found_timezone);
 
2217
                        _gweather_timezone_unref0 (timezone);
 
2218
                }
 
2219
                _g_free0 (found_country_code);
 
2220
                _g_free0 (country_code);
 
2221
        }
 
2222
        result = FALSE;
 
2223
        return result;
 
2224
}
 
2225
 
 
2226
 
 
2227
ClocksGeoLocation* clocks_geo_info_get_geo_location (ClocksGeoInfo* self) {
 
2228
        ClocksGeoLocation* result;
 
2229
        ClocksGeoLocation* _tmp0_ = NULL;
 
2230
        g_return_val_if_fail (self != NULL, NULL);
 
2231
        _tmp0_ = self->priv->_geo_location;
 
2232
        result = _tmp0_;
 
2233
        return result;
 
2234
}
 
2235
 
 
2236
 
 
2237
static void clocks_geo_info_set_geo_location (ClocksGeoInfo* self, ClocksGeoLocation* value) {
 
2238
        ClocksGeoLocation* _tmp0_ = NULL;
 
2239
        ClocksGeoLocation* _tmp1_ = NULL;
 
2240
        g_return_if_fail (self != NULL);
 
2241
        _tmp0_ = value;
 
2242
        _tmp1_ = _g_object_ref0 (_tmp0_);
 
2243
        _g_object_unref0 (self->priv->_geo_location);
 
2244
        self->priv->_geo_location = _tmp1_;
 
2245
        g_object_notify ((GObject *) self, "geo-location");
 
2246
}
 
2247
 
 
2248
 
 
2249
static void g_cclosure_user_marshal_VOID__BOXED (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data) {
 
2250
        typedef void (*GMarshalFunc_VOID__BOXED) (gpointer data1, gpointer arg_1, gpointer data2);
 
2251
        register GMarshalFunc_VOID__BOXED callback;
 
2252
        register GCClosure * cc;
 
2253
        register gpointer data1;
 
2254
        register gpointer data2;
 
2255
        cc = (GCClosure *) closure;
 
2256
        g_return_if_fail (n_param_values == 2);
 
2257
        if (G_CCLOSURE_SWAP_DATA (closure)) {
 
2258
                data1 = closure->data;
 
2259
                data2 = param_values->data[0].v_pointer;
 
2260
        } else {
 
2261
                data1 = param_values->data[0].v_pointer;
 
2262
                data2 = closure->data;
 
2263
        }
 
2264
        callback = (GMarshalFunc_VOID__BOXED) (marshal_data ? marshal_data : cc->callback);
 
2265
        callback (data1, g_value_get_boxed (param_values + 1), data2);
 
2266
}
 
2267
 
 
2268
 
 
2269
static void clocks_geo_info_class_init (ClocksGeoInfoClass * klass) {
 
2270
        clocks_geo_info_parent_class = g_type_class_peek_parent (klass);
 
2271
        g_type_class_add_private (klass, sizeof (ClocksGeoInfoPrivate));
 
2272
        G_OBJECT_CLASS (klass)->get_property = _vala_clocks_geo_info_get_property;
 
2273
        G_OBJECT_CLASS (klass)->set_property = _vala_clocks_geo_info_set_property;
 
2274
        G_OBJECT_CLASS (klass)->finalize = clocks_geo_info_finalize;
 
2275
        g_object_class_install_property (G_OBJECT_CLASS (klass), CLOCKS_GEO_INFO_GEO_LOCATION, g_param_spec_object ("geo-location", "geo-location", "geo-location", CLOCKS_GEO_TYPE_LOCATION, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
 
2276
        g_signal_new ("location_changed", CLOCKS_GEO_TYPE_INFO, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__BOXED, G_TYPE_NONE, 1, gweather_location_get_type ());
 
2277
}
 
2278
 
 
2279
 
 
2280
static void clocks_geo_info_instance_init (ClocksGeoInfo * self) {
 
2281
        self->priv = CLOCKS_GEO_INFO_GET_PRIVATE (self);
 
2282
        self->priv->_geo_location = NULL;
 
2283
}
 
2284
 
 
2285
 
 
2286
static void clocks_geo_info_finalize (GObject* obj) {
 
2287
        ClocksGeoInfo * self;
 
2288
        self = G_TYPE_CHECK_INSTANCE_CAST (obj, CLOCKS_GEO_TYPE_INFO, ClocksGeoInfo);
 
2289
        _g_object_unref0 (self->priv->_geo_location);
 
2290
        _gweather_location_unref0 (self->priv->found_location);
 
2291
        _g_free0 (self->priv->country_code);
 
2292
        _g_object_unref0 (self->priv->manager);
 
2293
        _g_object_unref0 (self->priv->client);
 
2294
        G_OBJECT_CLASS (clocks_geo_info_parent_class)->finalize (obj);
 
2295
}
 
2296
 
 
2297
 
 
2298
GType clocks_geo_info_get_type (void) {
 
2299
        static volatile gsize clocks_geo_info_type_id__volatile = 0;
 
2300
        if (g_once_init_enter (&clocks_geo_info_type_id__volatile)) {
 
2301
                static const GTypeInfo g_define_type_info = { sizeof (ClocksGeoInfoClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) clocks_geo_info_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ClocksGeoInfo), 0, (GInstanceInitFunc) clocks_geo_info_instance_init, NULL };
 
2302
                GType clocks_geo_info_type_id;
 
2303
                clocks_geo_info_type_id = g_type_register_static (G_TYPE_OBJECT, "ClocksGeoInfo", &g_define_type_info, 0);
 
2304
                g_once_init_leave (&clocks_geo_info_type_id__volatile, clocks_geo_info_type_id);
 
2305
        }
 
2306
        return clocks_geo_info_type_id__volatile;
 
2307
}
 
2308
 
 
2309
 
 
2310
static void _vala_clocks_geo_info_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
 
2311
        ClocksGeoInfo * self;
 
2312
        self = G_TYPE_CHECK_INSTANCE_CAST (object, CLOCKS_GEO_TYPE_INFO, ClocksGeoInfo);
 
2313
        switch (property_id) {
 
2314
                case CLOCKS_GEO_INFO_GEO_LOCATION:
 
2315
                g_value_set_object (value, clocks_geo_info_get_geo_location (self));
 
2316
                break;
 
2317
                default:
 
2318
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 
2319
                break;
 
2320
        }
 
2321
}
 
2322
 
 
2323
 
 
2324
static void _vala_clocks_geo_info_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
 
2325
        ClocksGeoInfo * self;
 
2326
        self = G_TYPE_CHECK_INSTANCE_CAST (object, CLOCKS_GEO_TYPE_INFO, ClocksGeoInfo);
 
2327
        switch (property_id) {
 
2328
                case CLOCKS_GEO_INFO_GEO_LOCATION:
 
2329
                clocks_geo_info_set_geo_location (self, g_value_get_object (value));
 
2330
                break;
 
2331
                default:
 
2332
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 
2333
                break;
 
2334
        }
 
2335
}
 
2336
 
 
2337
 
 
2338
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
 
2339
        if ((array != NULL) && (destroy_func != NULL)) {
 
2340
                int i;
 
2341
                for (i = 0; i < array_length; i = i + 1) {
 
2342
                        if (((gpointer*) array)[i] != NULL) {
 
2343
                                destroy_func (((gpointer*) array)[i]);
 
2344
                        }
 
2345
                }
 
2346
        }
 
2347
}
 
2348
 
 
2349
 
 
2350
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
 
2351
        _vala_array_destroy (array, array_length, destroy_func);
 
2352
        g_free (array);
 
2353
}
 
2354
 
 
2355
 
 
2356
static gint _vala_array_length (gpointer array) {
 
2357
        int length;
 
2358
        length = 0;
 
2359
        if (array) {
 
2360
                while (((gpointer*) array)[length]) {
 
2361
                        length++;
 
2362
                }
 
2363
        }
 
2364
        return length;
 
2365
}
 
2366
 
 
2367
 
 
2368