summaryrefslogtreecommitdiff
path: root/nonprism/gnome-settings-daemon/nonprism.patch
blob: eab945907b16706172469bd9b5b9faee6896d55b (plain)
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
diff --git a/configure.ac b/configure.ac
index 84c8ce234..856eaeb49 100644
--- a/configure.ac
+++ b/configure.ac
@@ -57,7 +57,6 @@ POLKIT_REQUIRED_VERSION=0.103
 UPOWER_REQUIRED_VERSION=0.99.0
 GSETTINGS_DESKTOP_SCHEMAS_REQUIRED_VERSION=3.23.3
 GEOCODE_GLIB_REQUIRED_VERSION=3.10.0
-GEOCLUE_REQUIRED_VERSION=2.3.1
 NM_REQUIRED_VERSION=1.0
 LCMS_REQUIRED_VERSION=2.2
 
@@ -163,13 +162,11 @@ PKG_CHECK_MODULES(COLOR,
 		  colord >= 1.0.2
 		  gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION
 		  libcanberra-gtk3
-		  libgeoclue-2.0 >= $GEOCLUE_REQUIRED_VERSION
 		  lcms2 >= $LCMS_REQUIRED_VERSION
 		  libnotify)
 
 PKG_CHECK_MODULES(DATETIME,
 		  libnotify >= $LIBNOTIFY_REQUIRED_VERSION
-		  libgeoclue-2.0 >= $GEOCLUE_REQUIRED_VERSION
 		  geocode-glib-1.0 >= $GEOCODE_GLIB_REQUIRED_VERSION
 		  gweather-3.0 >= $LIBGWEATHER_REQUIRED_VERSION
 		  polkit-gobject-1 >= $POLKIT_REQUIRED_VERSION)
diff --git a/plugins/color/gcm-self-test.c b/plugins/color/gcm-self-test.c
index 83c06c525..c22191e86 100644
--- a/plugins/color/gcm-self-test.c
+++ b/plugins/color/gcm-self-test.c
@@ -70,9 +70,6 @@ gcm_test_night_light (void)
         datetime_override = g_date_time_new_utc (2017, 2, 8, 20, 0, 0);
         gsd_night_light_set_date_time_now (nlight, datetime_override);
 
-        /* do not start geoclue */
-        gsd_night_light_set_geoclue_enabled (nlight, FALSE);
-
         /* do not smooth the transition */
         gsd_night_light_set_smooth_enabled (nlight, FALSE);
 
diff --git a/plugins/color/gsd-night-light.c b/plugins/color/gsd-night-light.c
index 67415f1d8..7f5118468 100644
--- a/plugins/color/gsd-night-light.c
+++ b/plugins/color/gsd-night-light.c
@@ -20,7 +20,6 @@
 
 #include "config.h"
 
-#include <geoclue.h>
 
 #define GNOME_DESKTOP_USE_UNSTABLE_API
 #include "gnome-datetime-source.h"
@@ -34,12 +33,9 @@ struct _GsdNightLight {
         GObject            parent;
         GSettings         *settings;
         gboolean           disabled_until_tmw;
-        gboolean           geoclue_enabled;
         GSource           *source;
         guint              validate_id;
         gint               disabled_day_of_month;
-        GClueClient       *geoclue_client;
-        GClueSimple       *geoclue_simple;
         GSettings         *location_settings;
         gdouble            cached_sunrise;
         gdouble            cached_sunset;
@@ -407,91 +403,6 @@ settings_changed_cb (GSettings *settings, gchar *key, gpointer user_data)
         g_debug ("settings changed");
         night_light_recheck (self);
 }
-
-static void
-on_location_notify (GClueSimple *simple,
-                    GParamSpec  *pspec,
-                    gpointer     user_data)
-{
-        GsdNightLight *self = GSD_NIGHT_LIGHT (user_data);
-        GClueLocation *location;
-        gdouble latitude, longitude;
-
-        location = gclue_simple_get_location (simple);
-        latitude = gclue_location_get_latitude (location);
-        longitude = gclue_location_get_longitude (location);
-
-        g_settings_set_value (self->settings,
-                              "night-light-last-coordinates",
-                              g_variant_new ("(dd)", latitude, longitude));
-
-        g_debug ("got geoclue latitude %f, longitude %f", latitude, longitude);
-
-        /* recheck the levels if the location changed significantly */
-        if (update_cached_sunrise_sunset (self))
-                night_light_recheck_schedule (self);
-}
-
-static void
-on_geoclue_simple_ready (GObject      *source_object,
-                         GAsyncResult *res,
-                         gpointer      user_data)
-{
-        GsdNightLight *self = GSD_NIGHT_LIGHT (user_data);
-        GClueSimple *geoclue_simple;
-        g_autoptr(GError) error = NULL;
-
-        geoclue_simple = gclue_simple_new_finish (res, &error);
-        if (geoclue_simple == NULL) {
-                if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
-                        g_warning ("Failed to connect to GeoClue2 service: %s", error->message);
-                return;
-        }
-
-        self->geoclue_simple = geoclue_simple;
-        self->geoclue_client = gclue_simple_get_client (self->geoclue_simple);
-        g_object_set (G_OBJECT (self->geoclue_client),
-                      "time-threshold", 60*60, NULL); /* 1 hour */
-
-        g_signal_connect (self->geoclue_simple, "notify::location",
-                          G_CALLBACK (on_location_notify), user_data);
-
-        on_location_notify (self->geoclue_simple, NULL, user_data);
-}
-
-static void
-start_geoclue (GsdNightLight *self)
-{
-        self->cancellable = g_cancellable_new ();
-        gclue_simple_new (DESKTOP_ID,
-                          GCLUE_ACCURACY_LEVEL_CITY,
-                          self->cancellable,
-                          on_geoclue_simple_ready,
-                          self);
-
-}
-
-static void
-stop_geoclue (GsdNightLight *self)
-{
-        g_cancellable_cancel (self->cancellable);
-        g_clear_object (&self->cancellable);
-
-        if (self->geoclue_client != NULL) {
-                gclue_client_call_stop (self->geoclue_client, NULL, NULL, NULL);
-                self->geoclue_client = NULL;
-        }
-        g_clear_object (&self->geoclue_simple);
-}
-
-static void
-check_location_settings (GsdNightLight *self)
-{
-        if (g_settings_get_boolean (self->location_settings, "enabled") && self->geoclue_enabled)
-                start_geoclue (self);
-        else
-                stop_geoclue (self);
-}
 
 void
 gsd_night_light_set_disabled_until_tmw (GsdNightLight *self, gboolean value)
@@ -537,12 +448,6 @@ gsd_night_light_get_temperature (GsdNightLight *self)
         return self->cached_temperature;
 }
 
-void
-gsd_night_light_set_geoclue_enabled (GsdNightLight *self, gboolean enabled)
-{
-        self->geoclue_enabled = enabled;
-}
-
 gboolean
 gsd_night_light_start (GsdNightLight *self, GError **error)
 {
@@ -553,9 +458,6 @@
         g_signal_connect (self->settings, "changed",
                           G_CALLBACK (settings_changed_cb), self);
 
-        g_signal_connect_swapped (self->location_settings, "changed::enabled",
-                                  G_CALLBACK (check_location_settings), self);
-        check_location_settings (self);
 
         return TRUE;
 }
@@ -565,7 +467,6 @@ gsd_night_light_finalize (GObject *object)
 {
         GsdNightLight *self = GSD_NIGHT_LIGHT (object);
 
-        stop_geoclue (self);
 
         poll_timeout_destroy (self);
         poll_smooth_destroy (self);
@@ -697,7 +598,6 @@ gsd_night_light_class_init (GsdNightLightClass *klass)
 static void
 gsd_night_light_init (GsdNightLight *self)
 {
-        self->geoclue_enabled = TRUE;
         self->smooth_enabled = TRUE;
         self->cached_sunrise = -1.f;
         self->cached_sunset = -1.f;
diff --git a/plugins/color/gsd-night-light.h b/plugins/color/gsd-night-light.h
index 4f086dc67..4a63ecfab 100644
--- a/plugins/color/gsd-night-light.h
+++ b/plugins/color/gsd-night-light.h
@@ -42,8 +42,6 @@ void             gsd_night_light_set_disabled_until_tmw (GsdNightLight *self,
                                                          gboolean       value);
 
 /* only for the self test program */
-void             gsd_night_light_set_geoclue_enabled    (GsdNightLight *self,
-                                                         gboolean       enabled);
 void             gsd_night_light_set_date_time_now      (GsdNightLight *self,
                                                          GDateTime     *datetime);
 void             gsd_night_light_set_smooth_enabled     (GsdNightLight *self,
diff --git a/plugins/datetime/gsd-timezone-monitor.c b/plugins/datetime/gsd-timezone-monitor.c
index 2ac864875..5bc4b2932 100644
--- a/plugins/datetime/gsd-timezone-monitor.c
+++ b/plugins/datetime/gsd-timezone-monitor.c
@@ -25,7 +25,6 @@
 #include "tz.h"
 #include "weather-tz.h"
 
-#include <geoclue.h>
 #include <geocode-glib/geocode-glib.h>
 #include <polkit/polkit.h>
 
@@ -45,9 +44,6 @@ typedef struct
         GPermission *permission;
         Timedate1 *dtm;
 
-        GClueClient *geoclue_client;
-        GClueSimple *geoclue_simple;
-        GCancellable *geoclue_cancellable;
 
         TzDB *tzdb;
         WeatherTzDB *weather_tzdb;
@@ -246,105 +242,6 @@ start_reverse_geocoding (GsdTimezoneMonitor *self,
         g_object_unref (place);
 }
 
-static void
-start_reverse_geocoding (GsdTimezoneMonitor *self,
-                         gdouble             latitude,
-                         gdouble             longitude)
-{
-        GeocodeLocation *location;
-        GeocodeReverse *reverse;
-        GsdTimezoneMonitorPrivate *priv = gsd_timezone_monitor_get_instance_private (self);
-
-        location = geocode_location_new (latitude,
-                                         longitude,
-                                         GEOCODE_LOCATION_ACCURACY_CITY);
-
-        reverse = geocode_reverse_new_for_location (location);
-        geocode_reverse_resolve_async (reverse,
-                                       priv->geoclue_cancellable,
-                                       on_reverse_geocoding_ready,
-                                       self);
-
-        g_object_unref (location);
-        g_object_unref (reverse);
-}
-
-static void
-on_location_notify (GClueSimple *simple,
-                    GParamSpec  *pspec,
-                    gpointer     user_data)
-{
-        GsdTimezoneMonitor *self = user_data;
-        GClueLocation *location;
-        gdouble latitude, longitude;
-
-        location = gclue_simple_get_location (simple);
-
-        latitude = gclue_location_get_latitude (location);
-        longitude = gclue_location_get_longitude (location);
-
-        start_reverse_geocoding (self, latitude, longitude);
-}
-
-static void
-on_geoclue_simple_ready (GObject      *source_object,
-                         GAsyncResult *res,
-                         gpointer      user_data)
-{
-        GError *error = NULL;
-        GsdTimezoneMonitorPrivate *priv;
-        GClueSimple *geoclue_simple;
-
-        geoclue_simple = gclue_simple_new_finish (res, &error);
-        if (geoclue_simple == NULL) {
-                if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
-                        g_warning ("Failed to connect to GeoClue2 service: %s", error->message);
-                g_error_free (error);
-                return;
-        }
-
-        priv = gsd_timezone_monitor_get_instance_private (user_data);
-        priv->geoclue_simple = geoclue_simple;
-        priv->geoclue_client = gclue_simple_get_client (priv->geoclue_simple);
-        gclue_client_set_distance_threshold (priv->geoclue_client,
-                                             GEOCODE_LOCATION_ACCURACY_CITY);
-
-        g_signal_connect (priv->geoclue_simple, "notify::location",
-                          G_CALLBACK (on_location_notify), user_data);
-
-        on_location_notify (priv->geoclue_simple, NULL, user_data);
-}
-
-static void
-start_geoclue (GsdTimezoneMonitor *self)
-{
-        GsdTimezoneMonitorPrivate *priv = gsd_timezone_monitor_get_instance_private (self);
-
-        priv->geoclue_cancellable = g_cancellable_new ();
-        gclue_simple_new (DESKTOP_ID,
-                          GCLUE_ACCURACY_LEVEL_CITY,
-                          priv->geoclue_cancellable,
-                          on_geoclue_simple_ready,
-                          self);
-
-}
-
-static void
-stop_geoclue (GsdTimezoneMonitor *self)
-{
-        GsdTimezoneMonitorPrivate *priv = gsd_timezone_monitor_get_instance_private (self);
-
-        g_cancellable_cancel (priv->geoclue_cancellable);
-        g_clear_object (&priv->geoclue_cancellable);
-
-        if (priv->geoclue_client) {
-                gclue_client_call_stop (priv->geoclue_client, NULL, NULL, NULL);
-                priv->geoclue_client = NULL;
-        }
-
-        g_clear_object (&priv->geoclue_simple);
-}
-
 GsdTimezoneMonitor *
 gsd_timezone_monitor_new (void)
 {
@@ -359,7 +296,6 @@ gsd_timezone_monitor_finalize (GObject *obj)
 
         g_debug ("Stopping timezone monitor");
 
-        stop_geoclue (monitor);
 
         if (priv->cancellable) {
                 g_cancellable_cancel (priv->cancellable);
@@ -394,16 +290,6 @@
                               G_TYPE_NONE, 1, G_TYPE_POINTER);
 }
 
-static void
-check_location_settings (GsdTimezoneMonitor *self)
-{
-        GsdTimezoneMonitorPrivate *priv = gsd_timezone_monitor_get_instance_private (self);
-        if (g_settings_get_boolean (priv->location_settings, "enabled"))
-                start_geoclue (self);
-        else
-                stop_geoclue (self);
-}
-
 static void
 gsd_timezone_monitor_init (GsdTimezoneMonitor *self)
 {
@@ -446,7 +382,4 @@ gsd_timezone_monitor_init (GsdTimezoneMonitor *self)
         priv->weather_tzdb = weather_tz_db_new ();
 
         priv->location_settings = g_settings_new ("org.gnome.system.location");
-        g_signal_connect_swapped (priv->location_settings, "changed::enabled",
-                                  G_CALLBACK (check_location_settings), self);
-        check_location_settings (self);
 }