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