nonprism.patch 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. diff --git a/configure.ac b/configure.ac
  2. index f5810bd5d..d3d20a540 100644
  3. --- a/configure.ac
  4. +++ b/configure.ac
  5. @@ -33,7 +33,6 @@ PKG_CHECK_MODULES([DEPS], [gdk-3.0
  6. glib-2.0
  7. gobject-2.0
  8. gtk+-3.0 >= 3.11.4
  9. - libgeoclue-2.0 >= 2.3.1
  10. gjs-1.0 >= $GJS_MIN_VERSION
  11. gweather-3.0 >= 3.17.2])
  12. diff --git a/data/org.gnome.Weather.Application.desktop.in b/data/org.gnome.Weather.Application.desktop.in
  13. index 3cd54ba2e..9d59b4699 100644
  14. --- a/data/org.gnome.Weather.Application.desktop.in
  15. +++ b/data/org.gnome.Weather.Application.desktop.in
  16. @@ -8,4 +8,3 @@ DBusActivatable=true
  17. StartupNotify=true
  18. Categories=GNOME;GTK;Utility;Core;
  19. _Keywords=Weather;Forecast;
  20. -_X-Geoclue-Reason=Allows weather information to be displayed for your location.
  21. diff --git a/src/app/currentLocationController.js b/src/app/currentLocationController.js
  22. index c070598b3..10b436d54 100644
  23. --- a/src/app/currentLocationController.js
  24. +++ b/src/app/currentLocationController.js
  25. @@ -20,104 +20,14 @@ const GLib = imports.gi.GLib;
  26. const Gio = imports.gi.Gio;
  27. const Lang = imports.lang;
  28. const GWeather = imports.gi.GWeather;
  29. -const Geoclue = imports.gi.Geoclue;
  30. const Util = imports.misc.util;
  31. -var AutoLocation = {
  32. - DISABLED: 0,
  33. - ENABLED: 1,
  34. - NOT_AVAILABLE: 2
  35. -};
  36. -
  37. var CurrentLocationController = class CurrentLocationController {
  38. constructor(world) {
  39. this._world = world;
  40. this._processStarted = false;
  41. this._settings = Util.getSettings('org.gnome.Weather.Application');
  42. - let autoLocation = this._settings.get_value('automatic-location').deep_unpack();
  43. - this._syncAutoLocation(autoLocation);
  44. - if (this.autoLocation == AutoLocation.ENABLED)
  45. - this._startGeolocationService();
  46. this.currentLocation = null;
  47. }
  48. -
  49. - _startGeolocationService() {
  50. - this._processStarted = true;
  51. - Geoclue.Simple.new(pkg.name,
  52. - Geoclue.AccuracyLevel.CITY,
  53. - null,
  54. - this._onSimpleReady.bind(this));
  55. - }
  56. -
  57. - _geoLocationFailed(e) {
  58. - log ("Failed to connect to GeoClue2 service: " + e.message);
  59. - this.autoLocation = AutoLocation.NOT_AVAILABLE;
  60. - GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
  61. - this._world.currentLocationChanged(null);
  62. - });
  63. - }
  64. -
  65. - _onSimpleReady(object, result) {
  66. - try {
  67. - this._simple = Geoclue.Simple.new_finish(result);
  68. - }
  69. - catch (e) {
  70. - this._geoLocationFailed(e);
  71. - return;
  72. - }
  73. -
  74. - let client = this._simple.get_client();
  75. - client.distance_threshold = 100;
  76. -
  77. - this._findLocation();
  78. - }
  79. -
  80. - _findLocation() {
  81. - this._locationUpdatedId =
  82. - this._simple.connect("notify::location",
  83. - this._onLocationUpdated.bind(this));
  84. -
  85. - this._onLocationUpdated(this._simple);
  86. - }
  87. -
  88. - _onLocationUpdated(simple) {
  89. - let geoclueLocation = simple.get_location();
  90. -
  91. - this.currentLocation = GWeather.Location.new_detached(geoclueLocation.description,
  92. - null,
  93. - geoclueLocation.latitude,
  94. - geoclueLocation.longitude);
  95. - this._world.currentLocationChanged(this.currentLocation);
  96. - }
  97. -
  98. - setAutoLocation(active) {
  99. - this._settings.set_value('automatic-location', new GLib.Variant('b', active));
  100. -
  101. - if (this.autoLocation == AutoLocation.NOT_AVAILABLE)
  102. - return;
  103. - this._autoLocationChanged(active);
  104. - this._syncAutoLocation(active);
  105. - }
  106. -
  107. - _syncAutoLocation(autoLocation) {
  108. - if (autoLocation)
  109. - this.autoLocation = AutoLocation.ENABLED;
  110. - else
  111. - this.autoLocation = AutoLocation.DISABLED;
  112. - }
  113. -
  114. - _autoLocationChanged(active) {
  115. - if (active) {
  116. - if (!this._processStarted) {
  117. - this._startGeolocationService();
  118. - } else {
  119. - this._locationUpdatedId =
  120. - this._simple.connect("notify::location",
  121. - this._onLocationUpdated.bind(this));
  122. - }
  123. - } else {
  124. - this._simple.disconnect(this._locationUpdatedId);
  125. - }
  126. - }
  127. }