Merge lp:~charlesk/indicator-location/use-properties-cpp into lp:indicator-location/16.04
- use-properties-cpp
- Merge into trunk.16.04
Proposed by
Charles Kerr
Status: | Merged |
---|---|
Approved by: | Charles Kerr |
Approved revision: | 161 |
Merged at revision: | 152 |
Proposed branch: | lp:~charlesk/indicator-location/use-properties-cpp |
Merge into: | lp:indicator-location/16.04 |
Prerequisite: | lp:~charlesk/indicator-location/lp-1535353-remove-here-tos |
Diff against target: |
764 lines (+141/-190) 13 files modified
CMakeLists.txt (+2/-1) src/controller.cc (+0/-46) src/controller.h (+8/-34) src/location-service-controller.cc (+26/-33) src/location-service-controller.h (+6/-6) src/phone.cc (+44/-27) src/phone.h (+7/-4) src/service.cc (+12/-12) src/service.h (+1/-1) tests/controller-mock.h (+8/-12) tests/gtest-dbus-fixture.h (+3/-3) tests/gtest-dbus-indicator-fixture.h (+5/-5) tests/phone-test.cc (+19/-6) |
To merge this branch: | bzr merge lp:~charlesk/indicator-location/use-properties-cpp |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Xavi Garcia | Approve | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Review via email: mp+283676@code.launchpad.net |
Commit message
Use core::Property<X> fields to notify the indicator when location settings change
Description of the change
A minor cleanup branch of something that's irritated me for awhile in indicator-location, the use of Java-style Listener interface classes for observer/observable to know when CUALC's location settings change.
This MP replaces the Listener interfaces with use of core::Property<X> objects to signal when a value changes.
To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : | # |
review:
Approve
(continuous-integration)
Revision history for this message
Xavi Garcia (xavi-garcia-mena) wrote : | # |
LGTM, thanks
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'CMakeLists.txt' | |||
2 | --- CMakeLists.txt 2015-04-16 00:44:22 +0000 | |||
3 | +++ CMakeLists.txt 2016-01-22 18:23:42 +0000 | |||
4 | @@ -35,7 +35,8 @@ | |||
5 | 35 | ubuntu-app-launch-2 | 35 | ubuntu-app-launch-2 |
6 | 36 | url-dispatcher-1 | 36 | url-dispatcher-1 |
7 | 37 | gio-unix-2.0>=2.36 | 37 | gio-unix-2.0>=2.36 |
9 | 38 | glib-2.0>=2.36) | 38 | glib-2.0>=2.36 |
10 | 39 | properties-cpp>=0.0.1) | ||
11 | 39 | include_directories (SYSTEM ${SERVICE_DEPS_INCLUDE_DIRS}) | 40 | include_directories (SYSTEM ${SERVICE_DEPS_INCLUDE_DIRS}) |
12 | 40 | 41 | ||
13 | 41 | ## | 42 | ## |
14 | 42 | 43 | ||
15 | === removed file 'src/controller.cc' | |||
16 | --- src/controller.cc 2013-08-25 20:31:26 +0000 | |||
17 | +++ src/controller.cc 1970-01-01 00:00:00 +0000 | |||
18 | @@ -1,46 +0,0 @@ | |||
19 | 1 | /* | ||
20 | 2 | * Copyright 2013 Canonical Ltd. | ||
21 | 3 | * | ||
22 | 4 | * This program is free software; you can redistribute it and/or modify | ||
23 | 5 | * it under the terms of the GNU General Public License as published by | ||
24 | 6 | * the Free Software Foundation; version 3. | ||
25 | 7 | * | ||
26 | 8 | * This program is distributed in the hope that it will be useful, | ||
27 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
28 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
29 | 11 | * GNU Lesser General Public License for more details. | ||
30 | 12 | * | ||
31 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
32 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
33 | 15 | * | ||
34 | 16 | * Authors: | ||
35 | 17 | * Charles Kerr <charles.kerr@canonical.com> | ||
36 | 18 | */ | ||
37 | 19 | |||
38 | 20 | #include "controller.h" | ||
39 | 21 | |||
40 | 22 | void | ||
41 | 23 | Controller :: add_listener (ControllerListener * l) | ||
42 | 24 | { | ||
43 | 25 | listeners.insert (l); | ||
44 | 26 | } | ||
45 | 27 | |||
46 | 28 | void | ||
47 | 29 | Controller :: remove_listener (ControllerListener * l) | ||
48 | 30 | { | ||
49 | 31 | listeners.erase (l); | ||
50 | 32 | } | ||
51 | 33 | |||
52 | 34 | void | ||
53 | 35 | Controller :: notify_gps_enabled (bool enabled) | ||
54 | 36 | { | ||
55 | 37 | for (auto it : listeners) | ||
56 | 38 | it->on_gps_enabled_changed (enabled); | ||
57 | 39 | } | ||
58 | 40 | |||
59 | 41 | void | ||
60 | 42 | Controller :: notify_location_service_enabled (bool enabled) | ||
61 | 43 | { | ||
62 | 44 | for (auto it : listeners) | ||
63 | 45 | it->on_location_service_enabled_changed (enabled); | ||
64 | 46 | } | ||
65 | 47 | 0 | ||
66 | === modified file 'src/controller.h' | |||
67 | --- src/controller.h 2015-04-15 13:42:24 +0000 | |||
68 | +++ src/controller.h 2016-01-22 18:23:42 +0000 | |||
69 | @@ -20,48 +20,22 @@ | |||
70 | 20 | #ifndef __INDICATOR_LOCATION_CONTROLLER_H__ | 20 | #ifndef __INDICATOR_LOCATION_CONTROLLER_H__ |
71 | 21 | #define __INDICATOR_LOCATION_CONTROLLER_H__ | 21 | #define __INDICATOR_LOCATION_CONTROLLER_H__ |
72 | 22 | 22 | ||
73 | 23 | #include <set> | ||
74 | 24 | |||
75 | 25 | #include <core/property.h> | 23 | #include <core/property.h> |
76 | 26 | 24 | ||
77 | 27 | class ControllerListener | ||
78 | 28 | { | ||
79 | 29 | public: | ||
80 | 30 | ControllerListener() {} | ||
81 | 31 | virtual ~ControllerListener() {} | ||
82 | 32 | |||
83 | 33 | public: | ||
84 | 34 | virtual void on_gps_enabled_changed (bool is_enabled) = 0; | ||
85 | 35 | virtual void on_location_service_enabled_changed (bool is_enabled) = 0; | ||
86 | 36 | }; | ||
87 | 37 | |||
88 | 38 | class Controller | 25 | class Controller |
89 | 39 | { | 26 | { |
97 | 40 | public: | 27 | public: |
98 | 41 | 28 | Controller(); | |
99 | 42 | Controller () {} | 29 | virtual ~Controller(); |
93 | 43 | virtual ~Controller() {} | ||
94 | 44 | |||
95 | 45 | void add_listener (ControllerListener *); | ||
96 | 46 | void remove_listener (ControllerListener *); | ||
100 | 47 | 30 | ||
101 | 48 | /// True iff we've gotten status info from the location service | 31 | /// True iff we've gotten status info from the location service |
102 | 49 | virtual const core::Property<bool>& is_valid() const =0; | 32 | virtual const core::Property<bool>& is_valid() const =0; |
103 | 50 | 33 | ||
118 | 51 | virtual bool is_gps_enabled () const = 0; | 34 | virtual const core::Property<bool>& gps_enabled() const =0; |
119 | 52 | virtual bool is_location_service_enabled () const = 0; | 35 | virtual const core::Property<bool>& location_service_enabled() const =0; |
120 | 53 | 36 | ||
121 | 54 | virtual void set_gps_enabled (bool enabled) = 0; | 37 | virtual void set_gps_enabled (bool enabled) =0; |
122 | 55 | virtual void set_location_service_enabled (bool enabled) = 0; | 38 | virtual void set_location_service_enabled (bool enabled) =0; |
109 | 56 | |||
110 | 57 | private: | ||
111 | 58 | |||
112 | 59 | std::set<ControllerListener*> listeners; | ||
113 | 60 | |||
114 | 61 | protected: | ||
115 | 62 | |||
116 | 63 | void notify_gps_enabled (bool); | ||
117 | 64 | void notify_location_service_enabled (bool); | ||
123 | 65 | }; | 39 | }; |
124 | 66 | 40 | ||
125 | 67 | #endif // __INDICATOR_LOCATION_CONTROLLER_H__ | 41 | #endif // __INDICATOR_LOCATION_CONTROLLER_H__ |
126 | 68 | 42 | ||
127 | === modified file 'src/location-service-controller.cc' | |||
128 | --- src/location-service-controller.cc 2015-04-17 16:44:53 +0000 | |||
129 | +++ src/location-service-controller.cc 2016-01-22 18:23:42 +0000 | |||
130 | @@ -31,21 +31,13 @@ | |||
131 | 31 | { | 31 | { |
132 | 32 | public: | 32 | public: |
133 | 33 | 33 | ||
135 | 34 | Impl(LocationServiceController& owner) | 34 | Impl() |
136 | 35 | { | 35 | { |
137 | 36 | m_cancellable.reset(g_cancellable_new(), [](GCancellable* c) { | 36 | m_cancellable.reset(g_cancellable_new(), [](GCancellable* c) { |
138 | 37 | g_cancellable_cancel(c); | 37 | g_cancellable_cancel(c); |
139 | 38 | g_object_unref(c); | 38 | g_object_unref(c); |
140 | 39 | }); | 39 | }); |
141 | 40 | 40 | ||
142 | 41 | m_gps_enabled.changed().connect([&owner](bool b){ | ||
143 | 42 | owner.notify_gps_enabled(b); | ||
144 | 43 | }); | ||
145 | 44 | |||
146 | 45 | m_loc_enabled.changed().connect([&owner](bool b){ | ||
147 | 46 | owner.notify_location_service_enabled(b); | ||
148 | 47 | }); | ||
149 | 48 | |||
150 | 49 | g_bus_get(G_BUS_TYPE_SYSTEM, | 41 | g_bus_get(G_BUS_TYPE_SYSTEM, |
151 | 50 | m_cancellable.get(), | 42 | m_cancellable.get(), |
152 | 51 | on_system_bus_ready, | 43 | on_system_bus_ready, |
153 | @@ -59,14 +51,14 @@ | |||
154 | 59 | return m_is_valid; | 51 | return m_is_valid; |
155 | 60 | } | 52 | } |
156 | 61 | 53 | ||
158 | 62 | bool is_gps_enabled() const | 54 | const core::Property<bool>& gps_enabled() const |
159 | 63 | { | 55 | { |
161 | 64 | return m_gps_enabled.get(); | 56 | return m_gps_enabled; |
162 | 65 | } | 57 | } |
163 | 66 | 58 | ||
165 | 67 | bool is_location_service_enabled() const | 59 | const core::Property<bool>& location_service_enabled() const |
166 | 68 | { | 60 | { |
168 | 69 | return m_loc_enabled.get(); | 61 | return m_loc_enabled; |
169 | 70 | } | 62 | } |
170 | 71 | 63 | ||
171 | 72 | void set_gps_enabled(bool enabled) | 64 | void set_gps_enabled(bool enabled) |
172 | @@ -108,9 +100,9 @@ | |||
173 | 108 | nullptr); | 100 | nullptr); |
174 | 109 | 101 | ||
175 | 110 | // manage the name_tag's lifespan | 102 | // manage the name_tag's lifespan |
179 | 111 | self->m_name_tag.reset(new guint{name_tag}, [](guint* name_tag){ | 103 | self->m_name_tag.reset(new guint{name_tag}, [](guint* tag){ |
180 | 112 | g_bus_unwatch_name(*name_tag); | 104 | g_bus_unwatch_name(*tag); |
181 | 113 | delete name_tag; | 105 | delete tag; |
182 | 114 | }); | 106 | }); |
183 | 115 | } | 107 | } |
184 | 116 | else if (error != nullptr) | 108 | else if (error != nullptr) |
185 | @@ -122,9 +114,9 @@ | |||
186 | 122 | } | 114 | } |
187 | 123 | 115 | ||
188 | 124 | static void on_name_appeared(GDBusConnection * system_bus, | 116 | static void on_name_appeared(GDBusConnection * system_bus, |
190 | 125 | const gchar * bus_name, | 117 | const gchar * /*bus_name*/, |
191 | 126 | const gchar * name_owner, | 118 | const gchar * name_owner, |
193 | 127 | gpointer gself) | 119 | gpointer gself) |
194 | 128 | { | 120 | { |
195 | 129 | auto self = static_cast<Impl*>(gself); | 121 | auto self = static_cast<Impl*>(gself); |
196 | 130 | 122 | ||
197 | @@ -275,7 +267,7 @@ | |||
198 | 275 | { | 267 | { |
199 | 276 | bool success, value; | 268 | bool success, value; |
200 | 277 | std::tie(success, value) = get_bool_reply_from_call(source_object, res); | 269 | std::tie(success, value) = get_bool_reply_from_call(source_object, res); |
202 | 278 | g_debug("service loc reply: success %d value %d", (int)success, (int)value); | 270 | g_debug("service loc reply: success %d value %d", int(success), int(value)); |
203 | 279 | if (success) | 271 | if (success) |
204 | 280 | static_cast<Impl*>(gself)->m_loc_enabled.set(value); | 272 | static_cast<Impl*>(gself)->m_loc_enabled.set(value); |
205 | 281 | } | 273 | } |
206 | @@ -286,7 +278,7 @@ | |||
207 | 286 | { | 278 | { |
208 | 287 | bool success, value; | 279 | bool success, value; |
209 | 288 | std::tie(success, value) = get_bool_reply_from_call(source_object, res); | 280 | std::tie(success, value) = get_bool_reply_from_call(source_object, res); |
211 | 289 | g_debug("service gps reply: success %d value %d", (int)success, (int)value); | 281 | g_debug("service gps reply: success %d value %d", int(success), int(value)); |
212 | 290 | if (success) | 282 | if (success) |
213 | 291 | static_cast<Impl*>(gself)->m_gps_enabled.set(value); | 283 | static_cast<Impl*>(gself)->m_gps_enabled.set(value); |
214 | 292 | } | 284 | } |
215 | @@ -319,7 +311,7 @@ | |||
216 | 319 | 311 | ||
217 | 320 | static void check_method_call_reply(GObject *connection, | 312 | static void check_method_call_reply(GObject *connection, |
218 | 321 | GAsyncResult *res, | 313 | GAsyncResult *res, |
220 | 322 | gpointer gself) | 314 | gpointer /*gself*/) |
221 | 323 | { | 315 | { |
222 | 324 | GError * error; | 316 | GError * error; |
223 | 325 | GVariant * v; | 317 | GVariant * v; |
224 | @@ -368,7 +360,7 @@ | |||
225 | 368 | ***/ | 360 | ***/ |
226 | 369 | 361 | ||
227 | 370 | LocationServiceController::LocationServiceController(): | 362 | LocationServiceController::LocationServiceController(): |
229 | 371 | impl{new Impl{*this}} | 363 | impl{new Impl{}} |
230 | 372 | { | 364 | { |
231 | 373 | } | 365 | } |
232 | 374 | 366 | ||
233 | @@ -382,17 +374,18 @@ | |||
234 | 382 | return impl->is_valid(); | 374 | return impl->is_valid(); |
235 | 383 | } | 375 | } |
236 | 384 | 376 | ||
248 | 385 | bool | 377 | const core::Property<bool>& |
249 | 386 | LocationServiceController::is_gps_enabled() const | 378 | LocationServiceController::gps_enabled() const |
250 | 387 | { | 379 | { |
251 | 388 | return impl->is_gps_enabled(); | 380 | return impl->gps_enabled(); |
252 | 389 | } | 381 | } |
253 | 390 | 382 | ||
254 | 391 | bool | 383 | const core::Property<bool>& |
255 | 392 | LocationServiceController::is_location_service_enabled() const | 384 | LocationServiceController::location_service_enabled() const |
256 | 393 | { | 385 | { |
257 | 394 | return impl->is_location_service_enabled(); | 386 | return impl->location_service_enabled(); |
258 | 395 | } | 387 | } |
259 | 388 | |||
260 | 396 | void | 389 | void |
261 | 397 | LocationServiceController::set_gps_enabled(bool enabled) | 390 | LocationServiceController::set_gps_enabled(bool enabled) |
262 | 398 | { | 391 | { |
263 | 399 | 392 | ||
264 | === modified file 'src/location-service-controller.h' | |||
265 | --- src/location-service-controller.h 2015-04-17 16:51:19 +0000 | |||
266 | +++ src/location-service-controller.h 2016-01-22 18:23:42 +0000 | |||
267 | @@ -20,26 +20,26 @@ | |||
268 | 20 | #ifndef INDICATOR_LOCATION_CONTROLLER_LOCATION_SERVICE | 20 | #ifndef INDICATOR_LOCATION_CONTROLLER_LOCATION_SERVICE |
269 | 21 | #define INDICATOR_LOCATION_CONTROLLER_LOCATION_SERVICE | 21 | #define INDICATOR_LOCATION_CONTROLLER_LOCATION_SERVICE |
270 | 22 | 22 | ||
272 | 23 | #include "controller.h" | 23 | #include "controller.h" // parent class |
273 | 24 | 24 | ||
274 | 25 | #include <memory> // std::unique_ptr | 25 | #include <memory> // std::unique_ptr |
275 | 26 | 26 | ||
276 | 27 | class LocationServiceController: public Controller | 27 | class LocationServiceController: public Controller |
277 | 28 | { | 28 | { |
279 | 29 | public: | 29 | public: |
280 | 30 | LocationServiceController(); | 30 | LocationServiceController(); |
281 | 31 | virtual ~LocationServiceController(); | 31 | virtual ~LocationServiceController(); |
282 | 32 | 32 | ||
286 | 33 | virtual const core::Property<bool>& is_valid() const override; | 33 | const core::Property<bool>& is_valid() const override; |
287 | 34 | bool is_gps_enabled () const override; | 34 | const core::Property<bool>& gps_enabled() const override; |
288 | 35 | bool is_location_service_enabled () const override; | 35 | const core::Property<bool>& location_service_enabled() const override; |
289 | 36 | void set_gps_enabled (bool enabled) override; | 36 | void set_gps_enabled (bool enabled) override; |
290 | 37 | void set_location_service_enabled (bool enabled) override; | 37 | void set_location_service_enabled (bool enabled) override; |
291 | 38 | 38 | ||
292 | 39 | LocationServiceController(const LocationServiceController&) =delete; | 39 | LocationServiceController(const LocationServiceController&) =delete; |
293 | 40 | LocationServiceController& operator=(const LocationServiceController&) =delete; | 40 | LocationServiceController& operator=(const LocationServiceController&) =delete; |
294 | 41 | 41 | ||
296 | 42 | private: | 42 | private: |
297 | 43 | friend class Impl; | 43 | friend class Impl; |
298 | 44 | class Impl; | 44 | class Impl; |
299 | 45 | std::unique_ptr<Impl> impl; | 45 | std::unique_ptr<Impl> impl; |
300 | 46 | 46 | ||
301 | === modified file 'src/phone.cc' | |||
302 | --- src/phone.cc 2016-01-22 18:23:42 +0000 | |||
303 | +++ src/phone.cc 2016-01-22 18:23:42 +0000 | |||
304 | @@ -38,7 +38,29 @@ | |||
305 | 38 | action_group (action_group_) | 38 | action_group (action_group_) |
306 | 39 | { | 39 | { |
307 | 40 | create_menu (); | 40 | create_menu (); |
309 | 41 | controller->add_listener (this); | 41 | |
310 | 42 | auto on_gps = [this](bool enabled){ | ||
311 | 43 | update_gps_enabled_action(); | ||
312 | 44 | update_header(); | ||
313 | 45 | }; | ||
314 | 46 | controller_connections.push_back( | ||
315 | 47 | controller->gps_enabled().changed().connect(on_gps) | ||
316 | 48 | ); | ||
317 | 49 | |||
318 | 50 | auto on_loc = [this](bool enabled){ | ||
319 | 51 | update_detection_enabled_action(); | ||
320 | 52 | update_header(); | ||
321 | 53 | }; | ||
322 | 54 | controller_connections.push_back( | ||
323 | 55 | controller->location_service_enabled().changed().connect(on_loc) | ||
324 | 56 | ); | ||
325 | 57 | |||
326 | 58 | auto on_valid = [this](bool valid){ | ||
327 | 59 | update_actions_enabled(); | ||
328 | 60 | }; | ||
329 | 61 | controller_connections.push_back( | ||
330 | 62 | controller->is_valid().changed().connect(on_valid) | ||
331 | 63 | ); | ||
332 | 42 | 64 | ||
333 | 43 | /* create the actions & add them to the group */ | 65 | /* create the actions & add them to the group */ |
334 | 44 | std::array<GSimpleAction*, 4> actions = { create_root_action(), | 66 | std::array<GSimpleAction*, 4> actions = { create_root_action(), |
335 | @@ -51,14 +73,11 @@ | |||
336 | 51 | g_object_unref (a); | 73 | g_object_unref (a); |
337 | 52 | } | 74 | } |
338 | 53 | 75 | ||
342 | 54 | // the profile should track whether the controller is valid or not | 76 | update_actions_enabled(); |
340 | 55 | controller->is_valid().changed().connect([this](bool){on_is_valid_changed();}); | ||
341 | 56 | on_is_valid_changed(); | ||
343 | 57 | } | 77 | } |
344 | 58 | 78 | ||
345 | 59 | Phone :: ~Phone () | 79 | Phone :: ~Phone () |
346 | 60 | { | 80 | { |
347 | 61 | controller->remove_listener (this); | ||
348 | 62 | } | 81 | } |
349 | 63 | 82 | ||
350 | 64 | /*** | 83 | /*** |
351 | @@ -73,7 +92,7 @@ | |||
352 | 73 | 92 | ||
353 | 74 | // as per "Indicators - RTM Usability Fix" document: | 93 | // as per "Indicators - RTM Usability Fix" document: |
354 | 75 | // visible iff location is enabled | 94 | // visible iff location is enabled |
356 | 76 | return controller->is_location_service_enabled(); | 95 | return controller->location_service_enabled().get(); |
357 | 77 | } | 96 | } |
358 | 78 | 97 | ||
359 | 79 | GVariant * | 98 | GVariant * |
360 | @@ -123,7 +142,7 @@ | |||
361 | 123 | } | 142 | } |
362 | 124 | 143 | ||
363 | 125 | void | 144 | void |
365 | 126 | Phone :: on_is_valid_changed() | 145 | Phone :: update_actions_enabled() |
366 | 127 | { | 146 | { |
367 | 128 | const auto map = G_ACTION_MAP(action_group.get()); | 147 | const auto map = G_ACTION_MAP(action_group.get()); |
368 | 129 | const bool is_valid = controller->is_valid().get(); | 148 | const bool is_valid = controller->is_valid().get(); |
369 | @@ -141,15 +160,7 @@ | |||
370 | 141 | GVariant * | 160 | GVariant * |
371 | 142 | Phone :: action_state_for_location_detection () | 161 | Phone :: action_state_for_location_detection () |
372 | 143 | { | 162 | { |
382 | 144 | return g_variant_new_boolean (controller->is_location_service_enabled()); | 163 | return g_variant_new_boolean (controller->location_service_enabled().get()); |
374 | 145 | } | ||
375 | 146 | |||
376 | 147 | void | ||
377 | 148 | Phone :: on_location_service_enabled_changed (bool is_enabled G_GNUC_UNUSED) | ||
378 | 149 | { | ||
379 | 150 | GAction * action = g_action_map_lookup_action (G_ACTION_MAP(action_group.get()), LOCATION_ACTION_KEY); | ||
380 | 151 | g_simple_action_set_state (G_SIMPLE_ACTION(action), action_state_for_location_detection()); | ||
381 | 152 | update_header(); | ||
383 | 153 | } | 164 | } |
384 | 154 | 165 | ||
385 | 155 | void | 166 | void |
386 | @@ -177,6 +188,13 @@ | |||
387 | 177 | return action; | 188 | return action; |
388 | 178 | } | 189 | } |
389 | 179 | 190 | ||
390 | 191 | void | ||
391 | 192 | Phone::update_detection_enabled_action() | ||
392 | 193 | { | ||
393 | 194 | GAction * action = g_action_map_lookup_action (G_ACTION_MAP(action_group.get()), LOCATION_ACTION_KEY); | ||
394 | 195 | g_simple_action_set_state (G_SIMPLE_ACTION(action), action_state_for_location_detection()); | ||
395 | 196 | } | ||
396 | 197 | |||
397 | 180 | /*** | 198 | /*** |
398 | 181 | **** | 199 | **** |
399 | 182 | ***/ | 200 | ***/ |
400 | @@ -184,15 +202,7 @@ | |||
401 | 184 | GVariant * | 202 | GVariant * |
402 | 185 | Phone :: action_state_for_gps_detection () | 203 | Phone :: action_state_for_gps_detection () |
403 | 186 | { | 204 | { |
413 | 187 | return g_variant_new_boolean (controller->is_gps_enabled()); | 205 | return g_variant_new_boolean (controller->gps_enabled().get()); |
405 | 188 | } | ||
406 | 189 | |||
407 | 190 | void | ||
408 | 191 | Phone :: on_gps_enabled_changed (bool is_enabled G_GNUC_UNUSED) | ||
409 | 192 | { | ||
410 | 193 | GAction * action = g_action_map_lookup_action (G_ACTION_MAP(action_group.get()), GPS_ACTION_KEY); | ||
411 | 194 | g_simple_action_set_state (G_SIMPLE_ACTION(action), action_state_for_gps_detection()); | ||
412 | 195 | update_header(); | ||
414 | 196 | } | 206 | } |
415 | 197 | 207 | ||
416 | 198 | void | 208 | void |
417 | @@ -206,7 +216,7 @@ | |||
418 | 206 | } | 216 | } |
419 | 207 | 217 | ||
420 | 208 | GSimpleAction * | 218 | GSimpleAction * |
422 | 209 | Phone :: create_gps_enabled_action () | 219 | Phone :: create_gps_enabled_action() |
423 | 210 | { | 220 | { |
424 | 211 | GSimpleAction * action; | 221 | GSimpleAction * action; |
425 | 212 | 222 | ||
426 | @@ -220,6 +230,13 @@ | |||
427 | 220 | return action; | 230 | return action; |
428 | 221 | } | 231 | } |
429 | 222 | 232 | ||
430 | 233 | void | ||
431 | 234 | Phone::update_gps_enabled_action() | ||
432 | 235 | { | ||
433 | 236 | GAction * action = g_action_map_lookup_action (G_ACTION_MAP(action_group.get()), GPS_ACTION_KEY); | ||
434 | 237 | g_simple_action_set_state (G_SIMPLE_ACTION(action), action_state_for_gps_detection()); | ||
435 | 238 | } | ||
436 | 239 | |||
437 | 223 | /*** | 240 | /*** |
438 | 224 | **** | 241 | **** |
439 | 225 | ***/ | 242 | ***/ |
440 | @@ -230,7 +247,7 @@ | |||
441 | 230 | { | 247 | { |
442 | 231 | void | 248 | void |
443 | 232 | on_uri_dispatched (const gchar * uri, | 249 | on_uri_dispatched (const gchar * uri, |
445 | 233 | gboolean success G_GNUC_UNUSED, | 250 | gboolean success, |
446 | 234 | gpointer user_data G_GNUC_UNUSED) | 251 | gpointer user_data G_GNUC_UNUSED) |
447 | 235 | { | 252 | { |
448 | 236 | if (!success) | 253 | if (!success) |
449 | 237 | 254 | ||
450 | === modified file 'src/phone.h' | |||
451 | --- src/phone.h 2016-01-22 18:23:42 +0000 | |||
452 | +++ src/phone.h 2016-01-22 18:23:42 +0000 | |||
453 | @@ -21,13 +21,14 @@ | |||
454 | 21 | #define __INDICATOR_LOCATION_PHONE_H__ | 21 | #define __INDICATOR_LOCATION_PHONE_H__ |
455 | 22 | 22 | ||
456 | 23 | #include <memory> | 23 | #include <memory> |
457 | 24 | #include <vector> | ||
458 | 24 | 25 | ||
459 | 25 | #include <glib.h> | 26 | #include <glib.h> |
460 | 26 | #include <gio/gio.h> | 27 | #include <gio/gio.h> |
461 | 27 | 28 | ||
462 | 28 | #include "controller.h" | 29 | #include "controller.h" |
463 | 29 | 30 | ||
465 | 30 | class Phone: public ControllerListener | 31 | class Phone |
466 | 31 | { | 32 | { |
467 | 32 | public: | 33 | public: |
468 | 33 | Phone (const std::shared_ptr<Controller>& controller, | 34 | Phone (const std::shared_ptr<Controller>& controller, |
469 | @@ -37,9 +38,7 @@ | |||
470 | 37 | 38 | ||
471 | 38 | protected: | 39 | protected: |
472 | 39 | std::shared_ptr<Controller> controller; | 40 | std::shared_ptr<Controller> controller; |
476 | 40 | virtual void on_is_valid_changed(); | 41 | std::vector<core::ScopedConnection> controller_connections; |
474 | 41 | virtual void on_gps_enabled_changed (bool is_enabled); | ||
475 | 42 | virtual void on_location_service_enabled_changed (bool is_enabled); | ||
477 | 43 | 42 | ||
478 | 44 | private: | 43 | private: |
479 | 45 | std::shared_ptr<GMenu> menu; | 44 | std::shared_ptr<GMenu> menu; |
480 | @@ -55,15 +54,19 @@ | |||
481 | 55 | GVariant * action_state_for_root () const; | 54 | GVariant * action_state_for_root () const; |
482 | 56 | GSimpleAction * create_root_action (); | 55 | GSimpleAction * create_root_action (); |
483 | 57 | void update_header(); | 56 | void update_header(); |
484 | 57 | void update_actions_enabled(); | ||
485 | 58 | 58 | ||
486 | 59 | private: | 59 | private: |
487 | 60 | GVariant * action_state_for_location_detection (); | 60 | GVariant * action_state_for_location_detection (); |
488 | 61 | GSimpleAction * create_detection_enabled_action (); | 61 | GSimpleAction * create_detection_enabled_action (); |
489 | 62 | void update_detection_enabled_action(); | ||
490 | 62 | static void on_detection_location_activated (GSimpleAction*, GVariant*, gpointer); | 63 | static void on_detection_location_activated (GSimpleAction*, GVariant*, gpointer); |
491 | 63 | 64 | ||
492 | 65 | |||
493 | 64 | private: | 66 | private: |
494 | 65 | GVariant * action_state_for_gps_detection (); | 67 | GVariant * action_state_for_gps_detection (); |
495 | 66 | GSimpleAction * create_gps_enabled_action (); | 68 | GSimpleAction * create_gps_enabled_action (); |
496 | 69 | void update_gps_enabled_action(); | ||
497 | 67 | static void on_detection_gps_activated (GSimpleAction*, GVariant*, gpointer); | 70 | static void on_detection_gps_activated (GSimpleAction*, GVariant*, gpointer); |
498 | 68 | 71 | ||
499 | 69 | private: | 72 | private: |
500 | 70 | 73 | ||
501 | === modified file 'src/service.cc' | |||
502 | --- src/service.cc 2016-01-22 18:23:42 +0000 | |||
503 | +++ src/service.cc 2016-01-22 18:23:42 +0000 | |||
504 | @@ -84,44 +84,44 @@ | |||
505 | 84 | ***/ | 84 | ***/ |
506 | 85 | 85 | ||
507 | 86 | void | 86 | void |
509 | 87 | Service :: on_name_lost (GDBusConnection * connection, | 87 | Service :: on_name_lost (GDBusConnection * conn, |
510 | 88 | const char * name, | 88 | const char * name, |
511 | 89 | gpointer gself) | 89 | gpointer gself) |
512 | 90 | { | 90 | { |
514 | 91 | g_debug ("%s::%s: %s %p", G_STRLOC, G_STRFUNC, name, connection); | 91 | g_debug ("%s::%s: %s %p", G_STRLOC, G_STRFUNC, name, conn); |
515 | 92 | 92 | ||
517 | 93 | static_cast<Service*>(gself)->on_name_lost (connection, name); | 93 | static_cast<Service*>(gself)->on_name_lost (conn, name); |
518 | 94 | } | 94 | } |
519 | 95 | void | 95 | void |
521 | 96 | Service :: on_name_lost (GDBusConnection * connection, | 96 | Service :: on_name_lost (GDBusConnection * conn, |
522 | 97 | const char * name) | 97 | const char * name) |
523 | 98 | { | 98 | { |
525 | 99 | g_debug ("%s::%s: %s %p", G_STRLOC, G_STRFUNC, name, connection); | 99 | g_debug ("%s::%s: %s %p", G_STRLOC, G_STRFUNC, name, conn); |
526 | 100 | 100 | ||
527 | 101 | if (name_lost_callback != nullptr) | 101 | if (name_lost_callback != nullptr) |
528 | 102 | (name_lost_callback)(this, name_lost_user_data); | 102 | (name_lost_callback)(this, name_lost_user_data); |
529 | 103 | } | 103 | } |
530 | 104 | 104 | ||
531 | 105 | void | 105 | void |
533 | 106 | Service :: on_bus_acquired (GDBusConnection * connection, | 106 | Service :: on_bus_acquired (GDBusConnection * conn, |
534 | 107 | const char * name, | 107 | const char * name, |
535 | 108 | gpointer gself) | 108 | gpointer gself) |
536 | 109 | { | 109 | { |
538 | 110 | static_cast<Service*>(gself)->on_bus_acquired (connection, name); | 110 | static_cast<Service*>(gself)->on_bus_acquired (conn, name); |
539 | 111 | } | 111 | } |
540 | 112 | void | 112 | void |
542 | 113 | Service :: on_bus_acquired (GDBusConnection * connection, | 113 | Service :: on_bus_acquired (GDBusConnection * conn, |
543 | 114 | const char * name) | 114 | const char * name) |
544 | 115 | { | 115 | { |
546 | 116 | g_debug ("%s::%s: %s %p", G_STRLOC, G_STRFUNC, name, connection); | 116 | g_debug ("%s::%s: %s %p", G_STRLOC, G_STRFUNC, name, conn); |
547 | 117 | 117 | ||
549 | 118 | this->connection.reset (G_DBUS_CONNECTION (g_object_ref(connection))); | 118 | this->connection.reset (G_DBUS_CONNECTION (g_object_ref(conn))); |
550 | 119 | 119 | ||
551 | 120 | GError * error = nullptr; | 120 | GError * error = nullptr; |
552 | 121 | 121 | ||
553 | 122 | /* export the action group */ | 122 | /* export the action group */ |
554 | 123 | 123 | ||
556 | 124 | unsigned int export_id = g_dbus_connection_export_action_group (connection, | 124 | unsigned int export_id = g_dbus_connection_export_action_group (conn, |
557 | 125 | INDICATOR_OBJECT_PATH, | 125 | INDICATOR_OBJECT_PATH, |
558 | 126 | G_ACTION_GROUP (action_group.get()), | 126 | G_ACTION_GROUP (action_group.get()), |
559 | 127 | &error); | 127 | &error); |
560 | @@ -146,7 +146,7 @@ | |||
561 | 146 | 146 | ||
562 | 147 | for (unsigned int i=0, n=G_N_ELEMENTS(menus); i<n; i++) | 147 | for (unsigned int i=0, n=G_N_ELEMENTS(menus); i<n; i++) |
563 | 148 | { | 148 | { |
565 | 149 | export_id = g_dbus_connection_export_menu_model (connection, | 149 | export_id = g_dbus_connection_export_menu_model (conn, |
566 | 150 | menus[i].path, | 150 | menus[i].path, |
567 | 151 | G_MENU_MODEL (menus[i].menu.get()), | 151 | G_MENU_MODEL (menus[i].menu.get()), |
568 | 152 | &error); | 152 | &error); |
569 | 153 | 153 | ||
570 | === modified file 'src/service.h' | |||
571 | --- src/service.h 2016-01-22 18:23:42 +0000 | |||
572 | +++ src/service.h 2016-01-22 18:23:42 +0000 | |||
573 | @@ -30,7 +30,7 @@ | |||
574 | 30 | class Service | 30 | class Service |
575 | 31 | { | 31 | { |
576 | 32 | public: | 32 | public: |
578 | 33 | Service (const std::shared_ptr<Controller>& controller); | 33 | explicit Service (const std::shared_ptr<Controller>& controller); |
579 | 34 | virtual ~Service (); | 34 | virtual ~Service (); |
580 | 35 | 35 | ||
581 | 36 | private: | 36 | private: |
582 | 37 | 37 | ||
583 | === renamed file 'src/controller-mock.h' => 'tests/controller-mock.h' | |||
584 | --- src/controller-mock.h 2015-04-15 14:24:14 +0000 | |||
585 | +++ tests/controller-mock.h 2016-01-22 18:23:42 +0000 | |||
586 | @@ -17,10 +17,9 @@ | |||
587 | 17 | * Charles Kerr <charles.kerr@canonical.com> | 17 | * Charles Kerr <charles.kerr@canonical.com> |
588 | 18 | */ | 18 | */ |
589 | 19 | 19 | ||
592 | 20 | #ifndef __INDICATOR_LOCATION_CONTROLLER_MOCK__H__ | 20 | #pragma once |
591 | 21 | #define __INDICATOR_LOCATION_CONTROLLER_MOCK__H__ | ||
593 | 22 | 21 | ||
595 | 23 | #include "controller.h" | 22 | #include <src/controller.h> |
596 | 24 | 23 | ||
597 | 25 | class MockController: public Controller | 24 | class MockController: public Controller |
598 | 26 | { | 25 | { |
599 | @@ -31,19 +30,16 @@ | |||
600 | 31 | 30 | ||
601 | 32 | core::Property<bool>& is_valid() { return m_is_valid; } | 31 | core::Property<bool>& is_valid() { return m_is_valid; } |
602 | 33 | const core::Property<bool>& is_valid() const override { return m_is_valid; } | 32 | const core::Property<bool>& is_valid() const override { return m_is_valid; } |
605 | 34 | bool is_gps_enabled () const { return gps; } | 33 | const core::Property<bool>& gps_enabled() const override { return m_gps_enabled; } |
606 | 35 | bool is_location_service_enabled () const { return loc; } | 34 | const core::Property<bool>& location_service_enabled() const override { return m_location_service_enabled; } |
607 | 36 | 35 | ||
610 | 37 | void set_gps_enabled (bool enabled) { notify_gps_enabled (gps=enabled); } | 36 | void set_gps_enabled (bool enabled) override { m_gps_enabled=enabled; } |
611 | 38 | void set_location_service_enabled (bool enabled) { notify_location_service_enabled (loc=enabled); } | 37 | void set_location_service_enabled (bool enabled) override { m_location_service_enabled=enabled; } |
612 | 39 | 38 | ||
613 | 40 | private: | 39 | private: |
614 | 41 | 40 | ||
615 | 42 | core::Property<bool> m_is_valid {true}; | 41 | core::Property<bool> m_is_valid {true}; |
618 | 43 | bool gps { false }; | 42 | core::Property<bool> m_gps_enabled {false}; |
619 | 44 | bool loc { false }; | 43 | core::Property<bool> m_location_service_enabled {false}; |
620 | 45 | }; | 44 | }; |
621 | 46 | 45 | ||
622 | 47 | #endif // __INDICATOR_LOCATION_CONTROLLER_MOCK__H__ | ||
623 | 48 | |||
624 | 49 | |||
625 | 50 | 46 | ||
626 | === modified file 'tests/gtest-dbus-fixture.h' | |||
627 | --- tests/gtest-dbus-fixture.h 2014-01-27 00:02:51 +0000 | |||
628 | +++ tests/gtest-dbus-fixture.h 2016-01-22 18:23:42 +0000 | |||
629 | @@ -57,7 +57,7 @@ | |||
630 | 57 | static gboolean | 57 | static gboolean |
631 | 58 | wait_for_signal__timeout (gpointer name) | 58 | wait_for_signal__timeout (gpointer name) |
632 | 59 | { | 59 | { |
634 | 60 | g_error ("%s: timed out waiting for signal '%s'", G_STRLOC, (char*)name); | 60 | g_error ("%s: timed out waiting for signal '%s'", G_STRLOC, name); |
635 | 61 | return G_SOURCE_REMOVE; | 61 | return G_SOURCE_REMOVE; |
636 | 62 | } | 62 | } |
637 | 63 | 63 | ||
638 | @@ -113,7 +113,7 @@ | |||
639 | 113 | protected: | 113 | protected: |
640 | 114 | 114 | ||
641 | 115 | /* convenience func to loop while waiting for a GObject's signal */ | 115 | /* convenience func to loop while waiting for a GObject's signal */ |
643 | 116 | void wait_for_signal(gpointer o, const gchar * signal, const int timeout_seconds=5) | 116 | void wait_for_signal(gpointer o, const gchar * signal, const guint timeout_seconds=5) |
644 | 117 | { | 117 | { |
645 | 118 | // wait for the signal or for timeout, whichever comes first | 118 | // wait for the signal or for timeout, whichever comes first |
646 | 119 | const auto handler_id = g_signal_connect_swapped(o, signal, | 119 | const auto handler_id = g_signal_connect_swapped(o, signal, |
647 | @@ -128,7 +128,7 @@ | |||
648 | 128 | } | 128 | } |
649 | 129 | 129 | ||
650 | 130 | /* convenience func to loop for N msec */ | 130 | /* convenience func to loop for N msec */ |
652 | 131 | void wait_msec(int msec=50) | 131 | void wait_msec(guint msec=50) |
653 | 132 | { | 132 | { |
654 | 133 | const auto id = g_timeout_add(msec, wait_msec__timeout, loop); | 133 | const auto id = g_timeout_add(msec, wait_msec__timeout, loop); |
655 | 134 | g_main_loop_run(loop); | 134 | g_main_loop_run(loop); |
656 | 135 | 135 | ||
657 | === modified file 'tests/gtest-dbus-indicator-fixture.h' | |||
658 | --- tests/gtest-dbus-indicator-fixture.h 2015-04-15 14:24:14 +0000 | |||
659 | +++ tests/gtest-dbus-indicator-fixture.h 2016-01-22 18:23:42 +0000 | |||
660 | @@ -44,9 +44,9 @@ | |||
661 | 44 | gint position G_GNUC_UNUSED, | 44 | gint position G_GNUC_UNUSED, |
662 | 45 | gint removed G_GNUC_UNUSED, | 45 | gint removed G_GNUC_UNUSED, |
663 | 46 | gint added G_GNUC_UNUSED, | 46 | gint added G_GNUC_UNUSED, |
665 | 47 | gpointer any_item_changed) | 47 | gpointer gany_item_changed) |
666 | 48 | { | 48 | { |
668 | 49 | *((gboolean*)any_item_changed) = true; | 49 | *static_cast<gboolean*>(gany_item_changed) = true; |
669 | 50 | } | 50 | } |
670 | 51 | 51 | ||
671 | 52 | protected: | 52 | protected: |
672 | @@ -83,7 +83,7 @@ | |||
673 | 83 | 83 | ||
674 | 84 | void sync_menu (void) | 84 | void sync_menu (void) |
675 | 85 | { | 85 | { |
677 | 86 | g_slist_free_full (menu_references, (GDestroyNotify)g_object_unref); | 86 | g_slist_free_full (menu_references, GDestroyNotify(g_object_unref)); |
678 | 87 | menu_references = nullptr; | 87 | menu_references = nullptr; |
679 | 88 | activate_subtree (G_MENU_MODEL (menu_model)); | 88 | activate_subtree (G_MENU_MODEL (menu_model)); |
680 | 89 | } | 89 | } |
681 | @@ -111,7 +111,7 @@ | |||
682 | 111 | G_BUS_NAME_WATCHER_FLAGS_NONE, | 111 | G_BUS_NAME_WATCHER_FLAGS_NONE, |
683 | 112 | on_name_appeared, // quits the loop | 112 | on_name_appeared, // quits the loop |
684 | 113 | nullptr, this, nullptr); | 113 | nullptr, this, nullptr); |
686 | 114 | const guint timer_id = g_timeout_add_seconds (TIME_LIMIT_SEC, (GSourceFunc)g_main_loop_quit, loop); | 114 | const guint timer_id = g_timeout_add_seconds (TIME_LIMIT_SEC, GSourceFunc(g_main_loop_quit), loop); |
687 | 115 | g_main_loop_run (loop); | 115 | g_main_loop_run (loop); |
688 | 116 | g_source_remove (timer_id); | 116 | g_source_remove (timer_id); |
689 | 117 | g_bus_unwatch_name (watch_id); | 117 | g_bus_unwatch_name (watch_id); |
690 | @@ -136,7 +136,7 @@ | |||
691 | 136 | { | 136 | { |
692 | 137 | g_clear_pointer (&timer, g_timer_destroy); | 137 | g_clear_pointer (&timer, g_timer_destroy); |
693 | 138 | 138 | ||
695 | 139 | g_slist_free_full (menu_references, (GDestroyNotify)g_object_unref); | 139 | g_slist_free_full (menu_references, GDestroyNotify(g_object_unref)); |
696 | 140 | menu_references = nullptr; | 140 | menu_references = nullptr; |
697 | 141 | g_clear_object (&menu_model); | 141 | g_clear_object (&menu_model); |
698 | 142 | 142 | ||
699 | 143 | 143 | ||
700 | === modified file 'tests/phone-test.cc' | |||
701 | --- tests/phone-test.cc 2016-01-22 18:23:42 +0000 | |||
702 | +++ tests/phone-test.cc 2016-01-22 18:23:42 +0000 | |||
703 | @@ -21,12 +21,11 @@ | |||
704 | 21 | #define INDICATOR_PROFILE "phone" | 21 | #define INDICATOR_PROFILE "phone" |
705 | 22 | #include "gtest-dbus-indicator-fixture.h" | 22 | #include "gtest-dbus-indicator-fixture.h" |
706 | 23 | 23 | ||
707 | 24 | #include "controller-mock.h" | ||
708 | 24 | #include "src/dbus-shared.h" | 25 | #include "src/dbus-shared.h" |
709 | 25 | #include "src/controller-mock.h" | ||
710 | 26 | #include "src/service.h" | 26 | #include "src/service.h" |
711 | 27 | 27 | ||
714 | 28 | class PhoneTest: public GTestDBusIndicatorFixture, | 28 | class PhoneTest: public GTestDBusIndicatorFixture |
713 | 29 | public ControllerListener | ||
715 | 30 | { | 29 | { |
716 | 31 | protected: | 30 | protected: |
717 | 32 | 31 | ||
718 | @@ -37,6 +36,7 @@ | |||
719 | 37 | 36 | ||
720 | 38 | std::shared_ptr<MockController> myController; | 37 | std::shared_ptr<MockController> myController; |
721 | 39 | std::shared_ptr<Service> myService; | 38 | std::shared_ptr<Service> myService; |
722 | 39 | std::vector<core::ScopedConnection> myConnections; | ||
723 | 40 | 40 | ||
724 | 41 | public: | 41 | public: |
725 | 42 | 42 | ||
726 | @@ -72,14 +72,27 @@ | |||
727 | 72 | virtual void setup_service () | 72 | virtual void setup_service () |
728 | 73 | { | 73 | { |
729 | 74 | myController.reset (new MockController ()); | 74 | myController.reset (new MockController ()); |
730 | 75 | myController->add_listener (this); | ||
731 | 76 | myService.reset (new Service (myController)); | 75 | myService.reset (new Service (myController)); |
732 | 76 | |||
733 | 77 | myConnections.push_back( | ||
734 | 78 | myController->gps_enabled().changed().connect([this](bool enabled){ | ||
735 | 79 | gps_enabled_changed = true; | ||
736 | 80 | gps_enabled = enabled; | ||
737 | 81 | }) | ||
738 | 82 | ); | ||
739 | 83 | |||
740 | 84 | myConnections.push_back( | ||
741 | 85 | myController->location_service_enabled().changed().connect([this](bool enabled){ | ||
742 | 86 | loc_enabled_changed = true; | ||
743 | 87 | loc_enabled = enabled; | ||
744 | 88 | }) | ||
745 | 89 | ); | ||
746 | 77 | } | 90 | } |
747 | 78 | 91 | ||
748 | 79 | virtual void teardown_service () | 92 | virtual void teardown_service () |
749 | 80 | { | 93 | { |
750 | 81 | myService.reset (); | 94 | myService.reset (); |
752 | 82 | myController->remove_listener (this); | 95 | myConnections.clear (); |
753 | 83 | myController.reset (); | 96 | myController.reset (); |
754 | 84 | } | 97 | } |
755 | 85 | }; | 98 | }; |
756 | @@ -123,7 +136,7 @@ | |||
757 | 123 | TEST_F (PhoneTest, IsValidVisible) | 136 | TEST_F (PhoneTest, IsValidVisible) |
758 | 124 | { | 137 | { |
759 | 125 | // make sure something's enabled so that the indicator should be visible | 138 | // make sure something's enabled so that the indicator should be visible |
761 | 126 | if (!myController->is_location_service_enabled()) { | 139 | if (!myController->location_service_enabled().get()) { |
762 | 127 | myController->set_location_service_enabled(true); | 140 | myController->set_location_service_enabled(true); |
763 | 128 | wait_for_action_state_change("location-detection-enabled"); | 141 | wait_for_action_state_change("location-detection-enabled"); |
764 | 129 | } | 142 | } |
PASSED: Continuous integration, rev:161 jenkins. qa.ubuntu. com/job/ indicator- location- ci/70/ jenkins. qa.ubuntu. com/job/ indicator- location- wily-amd64- ci/5 jenkins. qa.ubuntu. com/job/ indicator- location- wily-armhf- ci/5 jenkins. qa.ubuntu. com/job/ indicator- location- wily-armhf- ci/5/artifact/ work/output/ *zip*/output. zip
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/indicator- location- ci/70/rebuild
http://