Merge lp:~xnox/indicator-datetime/clickanywhere into lp:~indicator-applet-developers/indicator-datetime/trunk.13.10
- clickanywhere
- Merge into trunk.13.10
Status: | Work in progress |
---|---|
Proposed branch: | lp:~xnox/indicator-datetime/clickanywhere |
Merge into: | lp:~indicator-applet-developers/indicator-datetime/trunk.13.10 |
Diff against target: |
399 lines (+111/-94) 7 files modified
data/com.canonical.indicator.datetime.gschema.xml (+14/-0) data/datetime-dialog.ui (+1/-1) debian/changelog (+7/-0) debian/control (+2/-0) src/datetime-prefs.c (+79/-87) src/datetime-service.c (+6/-6) src/settings-shared.h (+2/-0) |
To merge this branch: | bzr merge lp:~xnox/indicator-datetime/clickanywhere |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mathieu Trudel-Lapierre | Needs Fixing | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Review via email:
|
Commit message
Set a pin point based on the selected town instead of closest timezone (LP: #892370)
Description of the change
Set a pin point based on the selected town instead of closest timezone (LP: #892370)
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mathieu Trudel-Lapierre (cyphermox) wrote : | # |
I could notice two issues related to memory management:
in sync_location(), a GSettings object is created but not g_object_unref'd.
in tz_changed(), char* name is added and it seems to me like it should be freed.
Otherwise, thanks for including the commits from Seb/Ryan I hadn't had time to merge into the branch yet :)
Note, this is the incorrect branch if you intend for this to land in raring; you'll want to merge into lp:indicator-datetime/13.04 instead. (I think this is due to the default landing branch automatically selected by Launchpad)
Assuming you indeed want to land in the other branch, please don't delete this merge, it should land in both trunks :)
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Dimitri John Ledkov (xnox) wrote : | # |
I did propose to get this merged into /13.04 branch[1]. But I had a quick chat with seb128 and we agreed it's a bit intrusive for 13.04 & it probably also requires UIFe
[1] https:/
Can you please reject the /13.04 merge proposal? linked above.
I will check & try to address the memory issues.
Unmerged revisions
- 214. By Dimitri John Ledkov
-
Set a pin point based on the selected town instead of closest timezone
Preview Diff
1 | === modified file 'data/com.canonical.indicator.datetime.gschema.xml' |
2 | --- data/com.canonical.indicator.datetime.gschema.xml 2012-07-13 15:52:55 +0000 |
3 | +++ data/com.canonical.indicator.datetime.gschema.xml 2013-03-28 15:29:23 +0000 |
4 | @@ -114,5 +114,19 @@ |
5 | Some timezones can be known by many different cities or names. This setting describes how the current zone prefers to be named. Format is "TIMEZONE NAME" (e.g. "America/New_York Boston" to name the New_York zone Boston). |
6 | </description> |
7 | </key> |
8 | + <key name="location-longitude" type="d"> |
9 | + <default>0.0</default> |
10 | + <summary>The longitude of the current location</summary> |
11 | + <description> |
12 | + Some timezones can be known by many different cities or names. This setting describes the longitudinal component of the coordinate for the location in timezone-name above. |
13 | + </description> |
14 | + </key> |
15 | + <key name="location-latitude" type="d"> |
16 | + <default>0.0</default> |
17 | + <summary>The latitude of the current location</summary> |
18 | + <description> |
19 | + Some timezones can be known by many different cities or names. This setting describes the latitudinal component of the coordinate for the location in timezone-name above. |
20 | + </description> |
21 | + </key> |
22 | </schema> |
23 | </schemalist> |
24 | |
25 | === modified file 'data/datetime-dialog.ui' |
26 | --- data/datetime-dialog.ui 2012-05-17 20:53:17 +0000 |
27 | +++ data/datetime-dialog.ui 2013-03-28 15:29:23 +0000 |
28 | @@ -294,7 +294,7 @@ |
29 | <object class="GtkRadioButton" id="automaticTimeRadio"> |
30 | <property name="label" translatable="yes">_Automatically from the Internet</property> |
31 | <property name="visible">True</property> |
32 | - <property name="sensitive">False</property> |
33 | + <property name="sensitive">True</property> |
34 | <property name="can_focus">True</property> |
35 | <property name="receives_default">False</property> |
36 | <property name="use_action_appearance">False</property> |
37 | |
38 | === modified file 'debian/changelog' |
39 | --- debian/changelog 2013-03-07 02:01:22 +0000 |
40 | +++ debian/changelog 2013-03-28 15:29:23 +0000 |
41 | @@ -1,3 +1,10 @@ |
42 | +indicator-datetime (12.10.3daily13.03.27-0ubuntu1) UNRELEASED; urgency=low |
43 | + |
44 | + * Use systemd's service backend, ffe lp: #1153567 |
45 | + * debian/control: depends on systemd-services and systemd-shim |
46 | + |
47 | + -- Sebastien Bacher <seb128@ubuntu.com> Tue, 26 Mar 2013 19:53:55 +0100 |
48 | + |
49 | indicator-datetime (12.10.3daily13.03.07-0ubuntu1) raring; urgency=low |
50 | |
51 | [ Michael Terry ] |
52 | |
53 | === modified file 'debian/control' |
54 | --- debian/control 2013-01-17 21:17:40 +0000 |
55 | +++ debian/control 2013-03-28 15:29:23 +0000 |
56 | @@ -40,6 +40,8 @@ |
57 | ${misc:Depends}, |
58 | gnome-control-center, |
59 | geoclue-ubuntu-geoip | geoclue-provider, |
60 | + systemd-services, |
61 | + systemd-shim |
62 | Recommends: indicator-applet | indicator-renderer, |
63 | evolution-data-server, |
64 | Description: Simple clock |
65 | |
66 | === modified file 'src/datetime-prefs.c' |
67 | --- src/datetime-prefs.c 2013-03-07 15:35:04 +0000 |
68 | +++ src/datetime-prefs.c 2013-03-28 15:29:23 +0000 |
69 | @@ -70,8 +70,6 @@ |
70 | gboolean changing_time; |
71 | GtkWidget * loc_dlg; |
72 | CcTimezoneCompletion * completion; |
73 | - GCancellable * tz_query_cancel; |
74 | - GCancellable * ntp_query_cancel; |
75 | }; |
76 | |
77 | struct _IndicatorDatetimePanelClass |
78 | @@ -193,7 +191,7 @@ |
79 | GVariant * answers = g_dbus_proxy_call_finish (G_DBUS_PROXY (object), res, &error); |
80 | |
81 | if (error != NULL) { |
82 | - g_warning("Could not set '%s' for SettingsDaemon: %s", (gchar *)command, error->message); |
83 | + g_warning("Could not set '%s' using timedated: %s", (gchar *)command, error->message); |
84 | g_error_free(error); |
85 | return; |
86 | } |
87 | @@ -206,33 +204,8 @@ |
88 | { |
89 | gboolean active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio)); |
90 | |
91 | - g_dbus_proxy_call (self->priv->proxy, "SetUsingNtp", g_variant_new ("(b)", active), |
92 | - G_DBUS_CALL_FLAGS_NONE, -1, NULL, dbus_set_answered, "using_ntp"); |
93 | -} |
94 | - |
95 | -static void |
96 | -ntp_query_answered (GObject *object, GAsyncResult *res, IndicatorDatetimePanel * self) |
97 | -{ |
98 | - GError * error = NULL; |
99 | - GVariant * answers = g_dbus_proxy_call_finish (G_DBUS_PROXY (object), res, &error); |
100 | - |
101 | - g_clear_object (&self->priv->ntp_query_cancel); |
102 | - |
103 | - if (error != NULL) { |
104 | - g_warning("Could not query DBus proxy for SettingsDaemon: %s", error->message); |
105 | - g_error_free(error); |
106 | - return; |
107 | - } |
108 | - |
109 | - gboolean can_use_ntp, is_using_ntp; |
110 | - g_variant_get (answers, "(bb)", &can_use_ntp, &is_using_ntp); |
111 | - |
112 | - gtk_widget_set_sensitive (GTK_WIDGET (self->priv->auto_radio), can_use_ntp); |
113 | - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->priv->auto_radio), is_using_ntp); |
114 | - |
115 | - g_signal_connect (self->priv->auto_radio, "notify::active", G_CALLBACK (toggle_ntp), self); |
116 | - |
117 | - g_variant_unref (answers); |
118 | + g_dbus_proxy_call (self->priv->proxy, "SetNTP", g_variant_new ("(bb)", active, TRUE), |
119 | + G_DBUS_CALL_FLAGS_NONE, -1, NULL, dbus_set_answered, "NTP"); |
120 | } |
121 | |
122 | static void |
123 | @@ -247,72 +220,100 @@ |
124 | } |
125 | |
126 | static void |
127 | +sync_location (IndicatorDatetimePanel * self, const gchar * en_name) |
128 | +{ |
129 | + gtk_entry_set_text (GTK_ENTRY (self->priv->tz_entry), en_name); |
130 | + gtk_entry_set_icon_from_stock (GTK_ENTRY (self->priv->tz_entry), |
131 | + GTK_ENTRY_ICON_SECONDARY, NULL); |
132 | + |
133 | + GSettings * conf = g_settings_new (SETTINGS_INTERFACE); |
134 | + g_settings_set_string (conf, SETTINGS_TIMEZONE_NAME_S, en_name); |
135 | +} |
136 | + |
137 | +static void |
138 | tz_changed (CcTimezoneMap * map, CcTimezoneLocation * location, IndicatorDatetimePanel * self) |
139 | { |
140 | if (location == NULL) |
141 | return; |
142 | |
143 | - gchar * zone; |
144 | + gchar * zone, * name; |
145 | g_object_get (location, "zone", &zone, NULL); |
146 | + g_object_get (location, "en_name", &name, NULL); |
147 | |
148 | - g_dbus_proxy_call (self->priv->proxy, "SetTimezone", g_variant_new ("(s)", zone), |
149 | + g_dbus_proxy_call (self->priv->proxy, "SetTimezone", g_variant_new ("(sb)", zone, TRUE), |
150 | G_DBUS_CALL_FLAGS_NONE, -1, NULL, dbus_set_answered, "timezone"); |
151 | |
152 | - sync_entry (self, zone); |
153 | + sync_location (self, name); |
154 | |
155 | g_free (zone); |
156 | } |
157 | |
158 | static void |
159 | -tz_query_answered (GObject *object, GAsyncResult *res, IndicatorDatetimePanel * self) |
160 | -{ |
161 | - GError * error = NULL; |
162 | - GVariant * answers = g_dbus_proxy_call_finish (G_DBUS_PROXY (object), res, &error); |
163 | - |
164 | - g_clear_object (&self->priv->tz_query_cancel); |
165 | - |
166 | - if (error != NULL) { |
167 | - g_warning("Could not query DBus proxy for SettingsDaemon: %s", error->message); |
168 | - g_error_free(error); |
169 | - return; |
170 | - } |
171 | - |
172 | - const gchar * timezone; |
173 | - g_variant_get (answers, "(&s)", &timezone); |
174 | - |
175 | - cc_timezone_map_set_timezone (self->priv->tzmap, timezone); |
176 | - |
177 | - sync_entry (self, timezone); |
178 | - g_signal_connect (self->priv->tzmap, "location-changed", G_CALLBACK (tz_changed), self); |
179 | - |
180 | - g_variant_unref (answers); |
181 | -} |
182 | - |
183 | -static void |
184 | proxy_ready (GObject *object, GAsyncResult *res, IndicatorDatetimePanel * self) |
185 | { |
186 | GError * error = NULL; |
187 | IndicatorDatetimePanelPrivate * priv = self->priv; |
188 | + GVariant *value; |
189 | |
190 | self->priv->proxy = g_dbus_proxy_new_for_bus_finish (res, &error); |
191 | |
192 | if (error != NULL) { |
193 | - g_critical("Could not grab DBus proxy for SettingsDaemon: %s", error->message); |
194 | + g_critical("Could not grab DBus proxy for timedated: %s", error->message); |
195 | g_error_free(error); |
196 | return; |
197 | } |
198 | |
199 | /* And now, do initial proxy configuration */ |
200 | - if (priv->ntp_query_cancel == NULL) { |
201 | - priv->ntp_query_cancel = g_cancellable_new(); |
202 | - g_dbus_proxy_call (priv->proxy, "GetUsingNtp", NULL, G_DBUS_CALL_FLAGS_NONE, -1, |
203 | - priv->ntp_query_cancel, (GAsyncReadyCallback)ntp_query_answered, self); |
204 | - } |
205 | - if (priv->tz_query_cancel == NULL) { |
206 | - priv->tz_query_cancel = g_cancellable_new(); |
207 | - g_dbus_proxy_call (priv->proxy, "GetTimezone", NULL, G_DBUS_CALL_FLAGS_NONE, -1, |
208 | - priv->tz_query_cancel, (GAsyncReadyCallback)tz_query_answered, self); |
209 | - } |
210 | + value = g_dbus_proxy_get_cached_property (priv->proxy, "CanNTP"); |
211 | + if (value != NULL) |
212 | + { |
213 | + if (g_variant_is_of_type (value, G_VARIANT_TYPE_BOOLEAN)) |
214 | + gtk_widget_set_sensitive (priv->auto_radio, g_variant_get_boolean (value)); |
215 | + g_variant_unref (value); |
216 | + } |
217 | + |
218 | + value = g_dbus_proxy_get_cached_property (priv->proxy, "NTP"); |
219 | + if (value != NULL) |
220 | + { |
221 | + if (g_variant_is_of_type (value, G_VARIANT_TYPE_BOOLEAN)) |
222 | + { |
223 | + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->auto_radio), g_variant_get_boolean (value)); |
224 | + g_signal_connect (priv->auto_radio, "notify::active", G_CALLBACK (toggle_ntp), self); |
225 | + } |
226 | + g_variant_unref (value); |
227 | + } |
228 | + |
229 | + value = g_dbus_proxy_get_cached_property (priv->proxy, "Timezone"); |
230 | + if (value != NULL) |
231 | + { |
232 | + if (g_variant_is_of_type (value, G_VARIANT_TYPE_STRING)) |
233 | + { |
234 | + const gchar *timezone = g_variant_get_string (value, NULL); |
235 | + |
236 | + GSettings * conf = g_settings_new (SETTINGS_INTERFACE); |
237 | + gdouble lon = g_settings_get_double(conf, SETTINGS_LOCATION_LONGITUDE); |
238 | + gdouble lat = g_settings_get_double(conf, SETTINGS_LOCATION_LATITUDE); |
239 | + gchar * saved_tz = g_settings_get_string (conf, SETTINGS_TIMEZONE_NAME_S); |
240 | + gchar * saved_zone, * saved_name; |
241 | + |
242 | + split_settings_location (saved_tz, &saved_zone, &saved_name); |
243 | + |
244 | + if (g_strcmp0 (saved_zone, timezone) == 0) { |
245 | + cc_timezone_map_set_location (self->priv->tzmap, lon, lat); |
246 | + } else { |
247 | + cc_timezone_map_set_timezone (self->priv->tzmap, timezone); |
248 | + } |
249 | + |
250 | + g_free (saved_tz); |
251 | + g_free (saved_zone); |
252 | + g_free (saved_name); |
253 | + g_object_unref (conf); |
254 | + |
255 | + sync_entry (self, timezone); |
256 | + g_signal_connect (priv->tzmap, "location-changed", G_CALLBACK (tz_changed), self); |
257 | + } |
258 | + g_variant_unref (value); |
259 | + } |
260 | } |
261 | |
262 | static void |
263 | @@ -359,7 +360,8 @@ |
264 | { |
265 | if (self->priv->user_edited_time) { |
266 | gdouble current_value = gtk_spin_button_get_value (GTK_SPIN_BUTTON (self->priv->date_spin)); |
267 | - g_dbus_proxy_call (self->priv->proxy, "SetTime", g_variant_new ("(x)", (guint64)current_value), |
268 | + g_dbus_proxy_call (self->priv->proxy, "SetTime", |
269 | + g_variant_new ("(xbb)", (gint64) (current_value * G_TIME_SPAN_SECOND), FALSE, TRUE), |
270 | G_DBUS_CALL_FLAGS_NONE, -1, NULL, dbus_set_answered, "time"); |
271 | } |
272 | self->priv->user_edited_time = FALSE; |
273 | @@ -600,6 +602,7 @@ |
274 | GtkTreeIter * iter, IndicatorDatetimePanel * self) |
275 | { |
276 | const gchar * name, * zone; |
277 | + gdouble lon = 0.0, lat = 0.0; |
278 | |
279 | gtk_tree_model_get (model, iter, |
280 | CC_TIMEZONE_COMPLETION_NAME, &name, |
281 | @@ -608,7 +611,6 @@ |
282 | |
283 | if (zone == NULL || zone[0] == 0) { |
284 | const gchar * strlon, * strlat; |
285 | - gdouble lon = 0.0, lat = 0.0; |
286 | |
287 | gtk_tree_model_get (model, iter, |
288 | CC_TIMEZONE_COMPLETION_LONGITUDE, &strlon, |
289 | @@ -626,14 +628,14 @@ |
290 | zone = cc_timezone_map_get_timezone_at_coords (self->priv->tzmap, lon, lat); |
291 | } |
292 | |
293 | + cc_timezone_map_set_location (self->priv->tzmap, lon, lat); |
294 | + |
295 | GSettings * conf = g_settings_new (SETTINGS_INTERFACE); |
296 | gchar * tz_name = g_strdup_printf ("%s %s", zone, name); |
297 | g_settings_set_string (conf, SETTINGS_TIMEZONE_NAME_S, tz_name); |
298 | g_free (tz_name); |
299 | g_object_unref (conf); |
300 | |
301 | - cc_timezone_map_set_timezone (self->priv->tzmap, zone); |
302 | - |
303 | return FALSE; // Do normal action too |
304 | } |
305 | |
306 | @@ -696,7 +698,7 @@ |
307 | gtk_container_add (GTK_CONTAINER (alignment), polkit_button); |
308 | gtk_box_pack_start (GTK_BOX (WIG ("timeDateBox")), alignment, FALSE, TRUE, 0); |
309 | |
310 | - const gchar * polkit_name = "org.gnome.settingsdaemon.datetimemechanism.configure"; |
311 | + const gchar * polkit_name = "org.gnome.controlcenter.datetime.configure"; |
312 | polkit_permission_new (polkit_name, NULL, NULL, polkit_perm_ready, polkit_button); |
313 | |
314 | /* Add map */ |
315 | @@ -763,9 +765,9 @@ |
316 | |
317 | /* Grab proxy for settings daemon */ |
318 | g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, NULL, |
319 | - "org.gnome.SettingsDaemon.DateTimeMechanism", |
320 | - "/", |
321 | - "org.gnome.SettingsDaemon.DateTimeMechanism", |
322 | + "org.freedesktop.timedate1", |
323 | + "/org/freedesktop/timedate1", |
324 | + "org.freedesktop.timedate1", |
325 | NULL, (GAsyncReadyCallback)proxy_ready, self); |
326 | |
327 | /* Grab proxy for datetime service, to see if it's running. It would |
328 | @@ -795,16 +797,6 @@ |
329 | g_clear_object (&priv->builder); |
330 | g_clear_object (&priv->proxy); |
331 | |
332 | - if (priv->tz_query_cancel != NULL) { |
333 | - g_cancellable_cancel (priv->tz_query_cancel); |
334 | - g_clear_object (&priv->tz_query_cancel); |
335 | - } |
336 | - |
337 | - if (priv->ntp_query_cancel != NULL) { |
338 | - g_cancellable_cancel (priv->ntp_query_cancel); |
339 | - g_clear_object (&priv->ntp_query_cancel); |
340 | - } |
341 | - |
342 | if (priv->loc_dlg) { |
343 | gtk_widget_destroy (priv->loc_dlg); |
344 | priv->loc_dlg = NULL; |
345 | |
346 | === modified file 'src/datetime-service.c' |
347 | --- src/datetime-service.c 2013-02-04 15:13:42 +0000 |
348 | +++ src/datetime-service.c 2013-03-28 15:29:23 +0000 |
349 | @@ -277,7 +277,7 @@ |
350 | GVariant * answers = g_dbus_proxy_call_finish (G_DBUS_PROXY (object), res, &error); |
351 | |
352 | if (error != NULL) { |
353 | - g_warning("Could not set timezone for SettingsDaemon: %s", error->message); |
354 | + g_warning("Could not set timezone using timedated: %s", error->message); |
355 | g_clear_error (&error); |
356 | return; |
357 | } |
358 | @@ -293,13 +293,13 @@ |
359 | GDBusProxy * proxy = g_dbus_proxy_new_for_bus_finish (res, &error); |
360 | |
361 | if (error != NULL) { |
362 | - g_warning("Could not grab DBus proxy for SettingsDaemon: %s", error->message); |
363 | + g_warning("Could not grab DBus proxy for timedated: %s", error->message); |
364 | g_clear_error (&error); |
365 | g_free (zone); |
366 | return; |
367 | } |
368 | |
369 | - g_dbus_proxy_call (proxy, "SetTimezone", g_variant_new ("(s)", zone), |
370 | + g_dbus_proxy_call (proxy, "SetTimezone", g_variant_new ("(sb)", zone, TRUE), |
371 | G_DBUS_CALL_FLAGS_NONE, -1, NULL, quick_set_tz_cb, NULL); |
372 | g_free (zone); |
373 | g_object_unref (proxy); |
374 | @@ -323,9 +323,9 @@ |
375 | g_object_unref (conf); |
376 | |
377 | g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, NULL, |
378 | - "org.gnome.SettingsDaemon.DateTimeMechanism", |
379 | - "/", |
380 | - "org.gnome.SettingsDaemon.DateTimeMechanism", |
381 | + "org.freedesktop.timedate1", |
382 | + "/org/freedesktop/timedate1", |
383 | + "org.freedesktop.timedate1", |
384 | NULL, quick_set_tz_proxy_cb, g_strdup (tz)); |
385 | |
386 | return; |
387 | |
388 | === modified file 'src/settings-shared.h' |
389 | --- src/settings-shared.h 2012-05-17 20:46:42 +0000 |
390 | +++ src/settings-shared.h 2013-03-28 15:29:23 +0000 |
391 | @@ -36,6 +36,8 @@ |
392 | #define SETTINGS_SHOW_DETECTED_S "show-auto-detected-location" |
393 | #define SETTINGS_LOCATIONS_S "locations" |
394 | #define SETTINGS_TIMEZONE_NAME_S "timezone-name" |
395 | +#define SETTINGS_LOCATION_LONGITUDE "location-longitude" |
396 | +#define SETTINGS_LOCATION_LATITUDE "location-latitude" |
397 | |
398 | enum { |
399 | SETTINGS_TIME_LOCALE = 0, |
PASSED: Continuous integration, rev:214 jenkins. qa.ubuntu. com/job/ indicator- datetime- ci/1/ jenkins. qa.ubuntu. com/job/ indicator- datetime- raring- amd64-ci/ 1 jenkins. qa.ubuntu. com/job/ indicator- datetime- raring- armhf-ci/ 1
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins: 8080/job/ indicator- datetime- ci/1/rebuild
http://