1
/* geocoding.c generated by valac 0.22.0.21-8a007, the Vala compiler
2
* generated from geocoding.vala, do not modify */
5
* Copyright (C) 2013 Evgeny Bobkin <evgen.ibqn@gmail.com>
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.
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.
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.
23
#include <glib-object.h>
29
#include <libgweather/gweather.h>
30
#include <geocode-glib/geocode-glib.h>
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))
38
typedef struct _ClocksGeoManager ClocksGeoManager;
39
typedef struct _ClocksGeoManagerIface ClocksGeoManagerIface;
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))
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))
51
typedef struct _ClocksGeoClient ClocksGeoClient;
52
typedef struct _ClocksGeoClientIface ClocksGeoClientIface;
54
#define CLOCKS_GEO_TYPE_CLIENT_PROXY (clocks_geo_client_proxy_get_type ())
55
typedef GDBusProxy ClocksGeoClientProxy;
56
typedef GDBusProxyClass ClocksGeoClientProxyClass;
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))
63
typedef struct _ClocksGeoLocation ClocksGeoLocation;
64
typedef struct _ClocksGeoLocationIface ClocksGeoLocationIface;
66
#define CLOCKS_GEO_TYPE_LOCATION_PROXY (clocks_geo_location_proxy_get_type ())
67
typedef GDBusProxy ClocksGeoLocationProxy;
68
typedef GDBusProxyClass ClocksGeoLocationProxyClass;
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))
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)))
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);
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);
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);
112
struct _ClocksGeoInfo {
113
GObject parent_instance;
114
ClocksGeoInfoPrivate * priv;
117
struct _ClocksGeoInfoClass {
118
GObjectClass parent_class;
121
struct _ClocksGeoInfoPrivate {
122
ClocksGeoLocation* _geo_location;
123
GWeatherLocation* found_location;
125
ClocksGeoManager* manager;
126
ClocksGeoClient* client;
127
gdouble minimal_distance;
130
struct _ClocksGeoInfoSeekData {
132
GObject* _source_object_;
134
GSimpleAsyncResult* _async_result;
137
ClocksGeoManager* _tmp0_;
138
ClocksGeoManager* _tmp1_;
142
ClocksGeoManager* _tmp4_;
148
ClocksGeoClient* _tmp9_;
149
const gchar* _tmp10_;
150
ClocksGeoClient* _tmp11_;
153
const gchar* _tmp13_;
154
ClocksGeoClient* _tmp14_;
155
ClocksGeoClient* _tmp15_;
158
const gchar* _tmp17_;
159
GError * _inner_error_;
162
struct _ClocksGeoInfoOnLocationUpdatedData {
164
GObject* _source_object_;
166
GSimpleAsyncResult* _async_result;
170
ClocksGeoLocation* _tmp0_;
172
ClocksGeoLocation* _tmp2_;
173
ClocksGeoLocation* _tmp3_;
177
GWeatherLocation* _tmp6_;
178
GWeatherLocation* _tmp7_;
179
GWeatherLocation* _tmp8_;
180
GError * _inner_error_;
183
struct _ClocksGeoInfoSeekCountryCodeData {
185
GObject* _source_object_;
187
GSimpleAsyncResult* _async_result;
189
GeocodeLocation* location;
190
ClocksGeoLocation* _tmp0_;
193
ClocksGeoLocation* _tmp3_;
196
GeocodeLocation* _tmp6_;
197
GeocodeReverse* reverse;
198
GeocodeReverse* _tmp7_;
200
GeocodePlace* _tmp8_;
205
const gchar* _tmp12_;
206
GError * _inner_error_;
209
struct _ClocksGeoInfoSearchLocationsData {
211
GObject* _source_object_;
213
GSimpleAsyncResult* _async_result;
215
GWeatherLocation* location;
217
gchar* loc_country_code;
218
GWeatherLocation* _tmp1_;
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;
239
GWeatherLocation** _tmp16_;
240
gint _tmp16__length1;
241
GWeatherLocation** _tmp17_;
242
gint _tmp17__length1;
244
GWeatherLocation* _tmp19_;
245
GWeatherLocationLevel _tmp20_;
246
GWeatherLocation** _tmp21_;
247
gint _tmp21__length1;
249
GWeatherLocation* _tmp23_;
254
GWeatherLocation** _tmp25_;
255
gint _tmp25__length1;
257
GWeatherLocation* _tmp27_;
260
ClocksGeoLocation* _tmp30_;
263
ClocksGeoLocation* _tmp33_;
271
GWeatherLocation** _tmp41_;
272
gint _tmp41__length1;
274
GWeatherLocation* _tmp43_;
275
GWeatherLocation* _tmp44_;
277
GWeatherLocation** _tmp46_;
278
gint _tmp46__length1;
280
GWeatherLocation* _tmp48_;
284
static gpointer clocks_geo_info_parent_class = NULL;
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))
353
CLOCKS_GEO_INFO_DUMMY_PROPERTY,
354
CLOCKS_GEO_INFO_GEO_LOCATION
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);
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};
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_);
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);
439
static void clocks_geo_manager_base_init (ClocksGeoManagerIface * iface) {
440
static gboolean initialized = FALSE;
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);
459
return clocks_geo_manager_type_id__volatile;
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;
469
static void clocks_geo_manager_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters) {
473
static void clocks_geo_manager_proxy_init (ClocksGeoManagerProxy* self) {
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);
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;
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);
498
static void clocks_geo_manager_proxy_get_client_finish (ClocksGeoManager* self, GAsyncResult* _res_, gchar** client_path, GError** error) {
499
GDBusMessage *_reply_message;
501
GVariantIter _reply_iter;
502
gchar* _vala_client_path;
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) {
508
if (g_dbus_message_to_gerror (_reply_message, error)) {
509
g_object_unref (_reply_message);
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);
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;
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);
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;
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);
545
g_dbus_method_invocation_return_gerror (invocation, error);
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);
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) {
565
if (strcmp (method_name, "GetClient") == 0) {
566
_dbus_clocks_geo_manager_get_client (object, parameters, invocation);
568
g_object_unref (invocation);
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) {
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) {
591
guint clocks_geo_manager_register_object (gpointer object, GDBusConnection* connection, const gchar* path, GError** error) {
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);
606
static void _clocks_geo_manager_unregister_object (gpointer user_data) {
609
g_object_unref (data[0]);
610
g_object_unref (data[1]);
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_);
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);
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);
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);
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);
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;
656
data1 = param_values->data[0].v_pointer;
657
data2 = closure->data;
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);
664
static void clocks_geo_client_base_init (ClocksGeoClientIface * iface) {
665
static gboolean initialized = FALSE;
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);
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);
685
return clocks_geo_client_type_id__volatile;
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;
695
static void _dbus_handle_clocks_geo_client_location_updated (ClocksGeoClient* self, GVariant* parameters) {
696
GVariantIter _arguments_iter;
697
gchar* old_path = NULL;
699
gchar* new_path = NULL;
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);
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);
721
static void clocks_geo_client_proxy_init (ClocksGeoClientProxy* self) {
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;
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);
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) {
745
if (g_dbus_message_to_gerror (_reply_message, error)) {
746
g_object_unref (_reply_message);
749
g_object_unref (_reply_message);
753
static gchar* clocks_geo_client_dbus_proxy_get_location (ClocksGeoClient* self) {
754
GVariant *_inner_reply;
756
_inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "Location");
758
GVariant *_arguments;
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);
769
g_variant_get (_reply, "(v)", &_inner_reply);
770
g_variant_unref (_reply);
772
_result = g_variant_dup_string (_inner_reply, NULL);
773
g_variant_unref (_inner_reply);
778
static guint clocks_geo_client_dbus_proxy_get_distance_threshold (ClocksGeoClient* self) {
779
GVariant *_inner_reply;
781
_inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "DistanceThreshold");
783
GVariant *_arguments;
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);
794
g_variant_get (_reply, "(v)", &_inner_reply);
795
g_variant_unref (_reply);
797
_result = g_variant_get_uint32 (_inner_reply);
798
g_variant_unref (_inner_reply);
803
static void clocks_geo_client_dbus_proxy_set_distance_threshold (ClocksGeoClient* self, guint value) {
804
GVariant *_arguments;
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);
818
g_variant_unref (_reply);
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;
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);
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;
843
GVariantBuilder _reply_builder;
844
invocation = _user_data_;
845
clocks_geo_client_start_finish ((ClocksGeoClient*) source_object, _res_, &error);
847
g_dbus_method_invocation_return_gerror (invocation, error);
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);
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) {
865
if (strcmp (method_name, "Start") == 0) {
866
_dbus_clocks_geo_client_start (object, parameters, invocation);
868
g_object_unref (invocation);
873
static GVariant* _dbus_clocks_geo_client_get_location (ClocksGeoClient* self) {
876
result = clocks_geo_client_get_location (self);
877
_reply = g_variant_new_string (result);
883
static GVariant* _dbus_clocks_geo_client_get_distance_threshold (ClocksGeoClient* self) {
886
result = clocks_geo_client_get_distance_threshold (self);
887
_reply = g_variant_new_uint32 (result);
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) {
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);
906
static void _dbus_clocks_geo_client_set_distance_threshold (ClocksGeoClient* self, GVariant* _value) {
908
value = g_variant_get_uint32 (_value);
909
clocks_geo_client_set_distance_threshold (self, value);
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) {
918
if (strcmp (property_name, "DistanceThreshold") == 0) {
919
_dbus_clocks_geo_client_set_distance_threshold (object, value);
926
static void _dbus_clocks_geo_client_location_updated (GObject* _sender, const gchar* old_path, const gchar* new_path, gpointer* _data) {
927
GDBusConnection * _connection;
929
GVariant *_arguments;
930
GVariantBuilder _arguments_builder;
931
_connection = _data[1];
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);
941
guint clocks_geo_client_register_object (gpointer object, GDBusConnection* connection, const gchar* path, GError** error) {
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);
952
g_signal_connect (object, "location-updated", (GCallback) _dbus_clocks_geo_client_location_updated, data);
957
static void _clocks_geo_client_unregister_object (gpointer 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]);
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);
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);
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);
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);
992
static void clocks_geo_location_base_init (ClocksGeoLocationIface * iface) {
993
static gboolean initialized = FALSE;
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);
1012
return clocks_geo_location_type_id__volatile;
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;
1022
static void clocks_geo_location_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters) {
1026
static void clocks_geo_location_proxy_init (ClocksGeoLocationProxy* self) {
1030
static gdouble clocks_geo_location_dbus_proxy_get_latitude (ClocksGeoLocation* self) {
1031
GVariant *_inner_reply;
1033
_inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "Latitude");
1034
if (!_inner_reply) {
1035
GVariant *_arguments;
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);
1046
g_variant_get (_reply, "(v)", &_inner_reply);
1047
g_variant_unref (_reply);
1049
_result = g_variant_get_double (_inner_reply);
1050
g_variant_unref (_inner_reply);
1055
static gdouble clocks_geo_location_dbus_proxy_get_longitude (ClocksGeoLocation* self) {
1056
GVariant *_inner_reply;
1058
_inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "Longitude");
1059
if (!_inner_reply) {
1060
GVariant *_arguments;
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);
1071
g_variant_get (_reply, "(v)", &_inner_reply);
1072
g_variant_unref (_reply);
1074
_result = g_variant_get_double (_inner_reply);
1075
g_variant_unref (_inner_reply);
1080
static gdouble clocks_geo_location_dbus_proxy_get_accuracy (ClocksGeoLocation* self) {
1081
GVariant *_inner_reply;
1083
_inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "Accuracy");
1084
if (!_inner_reply) {
1085
GVariant *_arguments;
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);
1096
g_variant_get (_reply, "(v)", &_inner_reply);
1097
g_variant_unref (_reply);
1099
_result = g_variant_get_double (_inner_reply);
1100
g_variant_unref (_inner_reply);
1105
static gchar* clocks_geo_location_dbus_proxy_get_description (ClocksGeoLocation* self) {
1106
GVariant *_inner_reply;
1108
_inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "Description");
1109
if (!_inner_reply) {
1110
GVariant *_arguments;
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);
1121
g_variant_get (_reply, "(v)", &_inner_reply);
1122
g_variant_unref (_reply);
1124
_result = g_variant_dup_string (_inner_reply, NULL);
1125
g_variant_unref (_inner_reply);
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;
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) {
1143
g_object_unref (invocation);
1147
static GVariant* _dbus_clocks_geo_location_get_latitude (ClocksGeoLocation* self) {
1150
result = clocks_geo_location_get_latitude (self);
1151
_reply = g_variant_new_double (result);
1156
static GVariant* _dbus_clocks_geo_location_get_longitude (ClocksGeoLocation* self) {
1159
result = clocks_geo_location_get_longitude (self);
1160
_reply = g_variant_new_double (result);
1165
static GVariant* _dbus_clocks_geo_location_get_accuracy (ClocksGeoLocation* self) {
1168
result = clocks_geo_location_get_accuracy (self);
1169
_reply = g_variant_new_double (result);
1174
static GVariant* _dbus_clocks_geo_location_get_description (ClocksGeoLocation* self) {
1177
result = clocks_geo_location_get_description (self);
1178
_reply = g_variant_new_string (result);
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) {
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);
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) {
1211
guint clocks_geo_location_register_object (gpointer object, GDBusConnection* connection, const gchar* path, GError** error) {
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);
1226
static void _clocks_geo_location_unregister_object (gpointer user_data) {
1229
g_object_unref (data[0]);
1230
g_object_unref (data[1]);
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;
1248
ClocksGeoInfo* clocks_geo_info_new (void) {
1249
return clocks_geo_info_construct (CLOCKS_GEO_TYPE_INFO);
1253
static void clocks_geo_info_seek_data_free (gpointer _data) {
1254
ClocksGeoInfoSeekData* _data_;
1256
_g_object_unref0 (_data_->self);
1257
g_slice_free (ClocksGeoInfoSeekData, _data_);
1261
static gpointer _g_object_ref0 (gpointer self) {
1262
return self ? g_object_ref (self) : NULL;
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_);
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_));
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_);
1293
static void __lambda22_ (ClocksGeoInfo* self, GObject* obj, GAsyncResult* res) {
1294
GAsyncResult* _tmp0_ = NULL;
1295
g_return_if_fail (res != NULL);
1297
clocks_geo_info_on_location_updated_finish (self, _tmp0_);
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);
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);
1314
clocks_geo_info_on_location_updated (self, _tmp0_, _tmp1_, ___lambda22__gasync_ready_callback, g_object_ref (self));
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);
1323
static gboolean clocks_geo_info_seek_co (ClocksGeoInfoSeekData* _data_) {
1324
switch (_data_->_state_) {
1336
g_assert_not_reached ();
1339
_data_->client_path = NULL;
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);
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;
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_);
1357
_g_object_unref0 (_data_->self->priv->manager);
1358
_data_->self->priv->manager = _data_->_tmp0_;
1361
__catch8_g_io_error:
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);
1375
g_simple_async_result_complete (_data_->_async_result);
1377
g_object_unref (_data_->_async_result);
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_);
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_);
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;
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_);
1409
__catch9_g_io_error:
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);
1423
g_simple_async_result_complete (_data_->_async_result);
1425
g_object_unref (_data_->_async_result);
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_);
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);
1443
g_simple_async_result_complete (_data_->_async_result);
1445
g_object_unref (_data_->_async_result);
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);
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;
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_);
1467
_g_object_unref0 (_data_->self->priv->client);
1468
_data_->self->priv->client = _data_->_tmp9_;
1471
__catch10_g_io_error:
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);
1485
g_simple_async_result_complete (_data_->_async_result);
1487
g_object_unref (_data_->_async_result);
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_);
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);
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_);
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;
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_);
1519
__catch11_g_io_error:
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);
1533
g_simple_async_result_complete (_data_->_async_result);
1535
g_object_unref (_data_->_async_result);
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_);
1545
_g_free0 (_data_->client_path);
1546
if (_data_->_state_ == 0) {
1547
g_simple_async_result_complete_in_idle (_data_->_async_result);
1549
g_simple_async_result_complete (_data_->_async_result);
1551
g_object_unref (_data_->_async_result);
1556
static void clocks_geo_info_on_location_updated_data_free (gpointer _data) {
1557
ClocksGeoInfoOnLocationUpdatedData* _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_);
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_;
1579
_tmp2_ = g_strdup (_tmp1_);
1580
_g_free0 (_data_->old_path);
1581
_data_->old_path = _tmp2_;
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_);
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_));
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_);
1605
static gboolean clocks_geo_info_on_location_updated_co (ClocksGeoInfoOnLocationUpdatedData* _data_) {
1606
switch (_data_->_state_) {
1616
g_assert_not_reached ();
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);
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;
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_);
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_);
1643
__catch12_g_io_error:
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);
1656
g_simple_async_result_complete (_data_->_async_result);
1658
g_object_unref (_data_->_async_result);
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_);
1667
_data_->_state_ = 2;
1668
clocks_geo_info_seek_country_code (_data_->self, clocks_geo_info_on_location_updated_ready, _data_);
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_);
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_);
1686
if (_data_->_state_ == 0) {
1687
g_simple_async_result_complete_in_idle (_data_->_async_result);
1689
g_simple_async_result_complete (_data_->_async_result);
1691
g_object_unref (_data_->_async_result);
1696
static void clocks_geo_info_seek_country_code_data_free (gpointer _data) {
1697
ClocksGeoInfoSeekCountryCodeData* _data_;
1699
_g_object_unref0 (_data_->self);
1700
g_slice_free (ClocksGeoInfoSeekCountryCodeData, _data_);
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_);
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_));
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_);
1731
static gboolean clocks_geo_info_seek_country_code_co (ClocksGeoInfoSeekCountryCodeData* _data_) {
1732
switch (_data_->_state_) {
1738
g_assert_not_reached ();
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_;
1760
_data_->_state_ = 1;
1761
geocode_reverse_resolve_async (_data_->reverse, NULL, clocks_geo_info_seek_country_code_ready, _data_);
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;
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);
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);
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_);
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);
1803
g_simple_async_result_complete (_data_->_async_result);
1805
g_object_unref (_data_->_async_result);
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);
1815
result = (G_PI / 180.0) * _tmp0_;
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;
1824
gdouble _tmp0_ = 0.0;
1825
gdouble _tmp1_ = 0.0;
1827
gdouble _tmp2_ = 0.0;
1828
gdouble _tmp3_ = 0.0;
1830
gdouble _tmp4_ = 0.0;
1831
gdouble _tmp5_ = 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);
1843
_tmp1_ = clocks_geo_info_deg_to_rad (self, _tmp0_);
1846
_tmp3_ = clocks_geo_info_deg_to_rad (self, _tmp2_);
1848
_tmp4_ = longitude1;
1849
_tmp5_ = clocks_geo_info_deg_to_rad (self, _tmp4_);
1851
_tmp6_ = longitude2;
1852
_tmp7_ = clocks_geo_info_deg_to_rad (self, _tmp6_);
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;
1865
static void clocks_geo_info_search_locations_data_free (gpointer _data) {
1866
ClocksGeoInfoSearchLocationsData* _data_;
1868
_gweather_location_unref0 (_data_->location);
1869
_g_object_unref0 (_data_->self);
1870
g_slice_free (ClocksGeoInfoSearchLocationsData, _data_);
1874
static gpointer _gweather_location_ref0 (gpointer self) {
1875
return self ? gweather_location_ref (self) : NULL;
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_;
1890
_tmp2_ = _gweather_location_ref0 (_tmp1_);
1891
_gweather_location_unref0 (_data_->location);
1892
_data_->location = _tmp2_;
1893
clocks_geo_info_search_locations_co (_data_);
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_));
1903
static GWeatherLocation** _vala_array_dup1 (GWeatherLocation** self, int length) {
1904
GWeatherLocation** result;
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]);
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_);
1925
static gboolean clocks_geo_info_search_locations_co (ClocksGeoInfoSearchLocationsData* _data_) {
1926
switch (_data_->_state_) {
1932
g_assert_not_reached ();
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);
1957
g_simple_async_result_complete (_data_->_async_result);
1959
g_object_unref (_data_->_async_result);
1963
_g_free0 (_data_->loc_country_code);
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) {
1987
_data_->_tmp12_ = 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;
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)) {
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_;
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_);
2095
clocks_geo_info_search_locations_finish (_data_->self, _data_->_res_);
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);
2104
g_simple_async_result_complete (_data_->_async_result);
2106
g_object_unref (_data_->_async_result);
2111
static gpointer _gweather_timezone_ref0 (gpointer self) {
2112
return self ? gweather_timezone_ref (self) : NULL;
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;
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;
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;
2166
_tmp13_ = gweather_location_get_timezone (_tmp12_);
2167
_tmp14_ = _gweather_timezone_ref0 (_tmp13_);
2169
_tmp15_ = self->priv->found_location;
2170
_tmp16_ = gweather_location_get_timezone (_tmp15_);
2171
_tmp17_ = _gweather_timezone_ref0 (_tmp16_);
2172
found_timezone = _tmp17_;
2174
if (_tmp19_ != NULL) {
2175
GWeatherTimezone* _tmp20_ = NULL;
2176
_tmp20_ = found_timezone;
2177
_tmp18_ = _tmp20_ != 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;
2194
_tmp23_ = gweather_timezone_get_tzid (_tmp22_);
2195
_tmp24_ = g_strdup (_tmp23_);
2197
_tmp25_ = found_timezone;
2198
_tmp26_ = gweather_timezone_get_tzid (_tmp25_);
2199
_tmp27_ = g_strdup (_tmp26_);
2200
found_tzid = _tmp27_;
2202
_tmp29_ = found_tzid;
2203
if (g_strcmp0 (_tmp28_, _tmp29_) == 0) {
2205
_g_free0 (found_tzid);
2207
_gweather_timezone_unref0 (found_timezone);
2208
_gweather_timezone_unref0 (timezone);
2209
_g_free0 (found_country_code);
2210
_g_free0 (country_code);
2213
_g_free0 (found_tzid);
2216
_gweather_timezone_unref0 (found_timezone);
2217
_gweather_timezone_unref0 (timezone);
2219
_g_free0 (found_country_code);
2220
_g_free0 (country_code);
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;
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);
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");
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;
2261
data1 = param_values->data[0].v_pointer;
2262
data2 = closure->data;
2264
callback = (GMarshalFunc_VOID__BOXED) (marshal_data ? marshal_data : cc->callback);
2265
callback (data1, g_value_get_boxed (param_values + 1), data2);
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 ());
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;
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);
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);
2306
return clocks_geo_info_type_id__volatile;
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));
2318
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
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));
2332
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
2338
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
2339
if ((array != NULL) && (destroy_func != NULL)) {
2341
for (i = 0; i < array_length; i = i + 1) {
2342
if (((gpointer*) array)[i] != NULL) {
2343
destroy_func (((gpointer*) array)[i]);
2350
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
2351
_vala_array_destroy (array, array_length, destroy_func);
2356
static gint _vala_array_length (gpointer array) {
2360
while (((gpointer*) array)[length]) {