1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
=== modified file 'src/location-geoclue.c'
--- src/location-geoclue.c 2011-03-27 22:14:58 +0000
+++ src/location-geoclue.c 2011-07-12 20:30:30 +0000
@@ -50,14 +50,20 @@
int
location_geoclue_start(location_geoclue_state_t *state)
{
- GeoclueMaster *master = NULL;
- GeoclueMasterClient *client = NULL;
- GError *error = NULL;
- gchar *name = NULL;
+ if (state->provider && state->provider_path) {
+ state->position = geoclue_position_new(state->provider,
+ state->provider_path);
+ } else {
+ GeoclueMaster *master = geoclue_master_get_default();
+ GeoclueMasterClient *client = geoclue_master_create_client(master,
+ NULL, NULL);
+ GError *error = NULL;
- if (!(state->provider && state->provider_path)) {
- master = geoclue_master_get_default();
- client = geoclue_master_create_client(master, NULL, NULL);
+ if (client == NULL) {
+ g_printerr(_("Unable to obtain master client.\n"));
+ g_object_unref(master);
+ return -1;
+ }
if (!geoclue_master_client_set_requirements(client,
GEOCLUE_ACCURACY_LEVEL_REGION,
@@ -68,15 +74,18 @@
error->message);
g_error_free(error);
g_object_unref(client);
+ g_object_unref(master);
return -1;
}
state->position = geoclue_master_client_create_position(client, NULL);
- } else {
- state->position = geoclue_position_new(state->provider,
- state->provider_path);
- }
+
+ g_object_unref(client);
+ g_object_unref(master);
+ }
+
+ gchar *name = NULL;
if (geoclue_provider_get_provider_info(GEOCLUE_PROVIDER(state->position),
&name, NULL, NULL)) {
|