Merge lp:~charlesk/indicator-datetime/timedate1 into lp:~indicator-applet-developers/indicator-datetime/trunk.13.10

Proposed by Charles Kerr
Status: Merged
Approved by: Mathieu Trudel-Lapierre
Approved revision: 216
Merged at revision: 216
Proposed branch: lp:~charlesk/indicator-datetime/timedate1
Merge into: lp:~indicator-applet-developers/indicator-datetime/trunk.13.10
Diff against target: 260 lines (+51/-89)
3 files modified
data/datetime-dialog.ui (+1/-1)
src/datetime-prefs.c (+44/-82)
src/datetime-service.c (+6/-6)
To merge this branch: bzr merge lp:~charlesk/indicator-datetime/timedate1
Reviewer Review Type Date Requested Status
Mathieu Trudel-Lapierre Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+162489@code.launchpad.net

Commit message

merge ryan's timedate1 fixes from the 13.04 branch

Description of the change

merge ryan's timedate1 fixes from the 13.04 branch

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
Mathieu Trudel-Lapierre (cyphermox) wrote :

Approve!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/datetime-dialog.ui'
2--- data/datetime-dialog.ui 2012-05-17 20:53:17 +0000
3+++ data/datetime-dialog.ui 2013-05-03 23:00:49 +0000
4@@ -294,7 +294,7 @@
5 <object class="GtkRadioButton" id="automaticTimeRadio">
6 <property name="label" translatable="yes">_Automatically from the Internet</property>
7 <property name="visible">True</property>
8- <property name="sensitive">False</property>
9+ <property name="sensitive">True</property>
10 <property name="can_focus">True</property>
11 <property name="receives_default">False</property>
12 <property name="use_action_appearance">False</property>
13
14=== modified file 'src/datetime-prefs.c'
15--- src/datetime-prefs.c 2013-03-07 15:35:04 +0000
16+++ src/datetime-prefs.c 2013-05-03 23:00:49 +0000
17@@ -70,8 +70,6 @@
18 gboolean changing_time;
19 GtkWidget * loc_dlg;
20 CcTimezoneCompletion * completion;
21- GCancellable * tz_query_cancel;
22- GCancellable * ntp_query_cancel;
23 };
24
25 struct _IndicatorDatetimePanelClass
26@@ -193,7 +191,7 @@
27 GVariant * answers = g_dbus_proxy_call_finish (G_DBUS_PROXY (object), res, &error);
28
29 if (error != NULL) {
30- g_warning("Could not set '%s' for SettingsDaemon: %s", (gchar *)command, error->message);
31+ g_warning("Could not set '%s' using timedated: %s", (gchar *)command, error->message);
32 g_error_free(error);
33 return;
34 }
35@@ -206,33 +204,8 @@
36 {
37 gboolean active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio));
38
39- g_dbus_proxy_call (self->priv->proxy, "SetUsingNtp", g_variant_new ("(b)", active),
40- G_DBUS_CALL_FLAGS_NONE, -1, NULL, dbus_set_answered, "using_ntp");
41-}
42-
43-static void
44-ntp_query_answered (GObject *object, GAsyncResult *res, IndicatorDatetimePanel * self)
45-{
46- GError * error = NULL;
47- GVariant * answers = g_dbus_proxy_call_finish (G_DBUS_PROXY (object), res, &error);
48-
49- g_clear_object (&self->priv->ntp_query_cancel);
50-
51- if (error != NULL) {
52- g_warning("Could not query DBus proxy for SettingsDaemon: %s", error->message);
53- g_error_free(error);
54- return;
55- }
56-
57- gboolean can_use_ntp, is_using_ntp;
58- g_variant_get (answers, "(bb)", &can_use_ntp, &is_using_ntp);
59-
60- gtk_widget_set_sensitive (GTK_WIDGET (self->priv->auto_radio), can_use_ntp);
61- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->priv->auto_radio), is_using_ntp);
62-
63- g_signal_connect (self->priv->auto_radio, "notify::active", G_CALLBACK (toggle_ntp), self);
64-
65- g_variant_unref (answers);
66+ g_dbus_proxy_call (self->priv->proxy, "SetNTP", g_variant_new ("(bb)", active, TRUE),
67+ G_DBUS_CALL_FLAGS_NONE, -1, NULL, dbus_set_answered, "NTP");
68 }
69
70 static void
71@@ -255,7 +228,7 @@
72 gchar * zone;
73 g_object_get (location, "zone", &zone, NULL);
74
75- g_dbus_proxy_call (self->priv->proxy, "SetTimezone", g_variant_new ("(s)", zone),
76+ g_dbus_proxy_call (self->priv->proxy, "SetTimezone", g_variant_new ("(sb)", zone, TRUE),
77 G_DBUS_CALL_FLAGS_NONE, -1, NULL, dbus_set_answered, "timezone");
78
79 sync_entry (self, zone);
80@@ -264,55 +237,53 @@
81 }
82
83 static void
84-tz_query_answered (GObject *object, GAsyncResult *res, IndicatorDatetimePanel * self)
85-{
86- GError * error = NULL;
87- GVariant * answers = g_dbus_proxy_call_finish (G_DBUS_PROXY (object), res, &error);
88-
89- g_clear_object (&self->priv->tz_query_cancel);
90-
91- if (error != NULL) {
92- g_warning("Could not query DBus proxy for SettingsDaemon: %s", error->message);
93- g_error_free(error);
94- return;
95- }
96-
97- const gchar * timezone;
98- g_variant_get (answers, "(&s)", &timezone);
99-
100- cc_timezone_map_set_timezone (self->priv->tzmap, timezone);
101-
102- sync_entry (self, timezone);
103- g_signal_connect (self->priv->tzmap, "location-changed", G_CALLBACK (tz_changed), self);
104-
105- g_variant_unref (answers);
106-}
107-
108-static void
109 proxy_ready (GObject *object, GAsyncResult *res, IndicatorDatetimePanel * self)
110 {
111 GError * error = NULL;
112 IndicatorDatetimePanelPrivate * priv = self->priv;
113+ GVariant *value;
114
115 self->priv->proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
116
117 if (error != NULL) {
118- g_critical("Could not grab DBus proxy for SettingsDaemon: %s", error->message);
119+ g_critical("Could not grab DBus proxy for timedated: %s", error->message);
120 g_error_free(error);
121 return;
122 }
123
124 /* And now, do initial proxy configuration */
125- if (priv->ntp_query_cancel == NULL) {
126- priv->ntp_query_cancel = g_cancellable_new();
127- g_dbus_proxy_call (priv->proxy, "GetUsingNtp", NULL, G_DBUS_CALL_FLAGS_NONE, -1,
128- priv->ntp_query_cancel, (GAsyncReadyCallback)ntp_query_answered, self);
129- }
130- if (priv->tz_query_cancel == NULL) {
131- priv->tz_query_cancel = g_cancellable_new();
132- g_dbus_proxy_call (priv->proxy, "GetTimezone", NULL, G_DBUS_CALL_FLAGS_NONE, -1,
133- priv->tz_query_cancel, (GAsyncReadyCallback)tz_query_answered, self);
134- }
135+ value = g_dbus_proxy_get_cached_property (priv->proxy, "CanNTP");
136+ if (value != NULL)
137+ {
138+ if (g_variant_is_of_type (value, G_VARIANT_TYPE_BOOLEAN))
139+ gtk_widget_set_sensitive (priv->auto_radio, g_variant_get_boolean (value));
140+ g_variant_unref (value);
141+ }
142+
143+ value = g_dbus_proxy_get_cached_property (priv->proxy, "NTP");
144+ if (value != NULL)
145+ {
146+ if (g_variant_is_of_type (value, G_VARIANT_TYPE_BOOLEAN))
147+ {
148+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->auto_radio), g_variant_get_boolean (value));
149+ g_signal_connect (priv->auto_radio, "notify::active", G_CALLBACK (toggle_ntp), self);
150+ }
151+ g_variant_unref (value);
152+ }
153+
154+ value = g_dbus_proxy_get_cached_property (priv->proxy, "Timezone");
155+ if (value != NULL)
156+ {
157+ if (g_variant_is_of_type (value, G_VARIANT_TYPE_STRING))
158+ {
159+ const gchar *timezone = g_variant_get_string (value, NULL);
160+
161+ cc_timezone_map_set_timezone (priv->tzmap, timezone);
162+ sync_entry (self, timezone);
163+ g_signal_connect (priv->tzmap, "location-changed", G_CALLBACK (tz_changed), self);
164+ }
165+ g_variant_unref (value);
166+ }
167 }
168
169 static void
170@@ -359,7 +330,8 @@
171 {
172 if (self->priv->user_edited_time) {
173 gdouble current_value = gtk_spin_button_get_value (GTK_SPIN_BUTTON (self->priv->date_spin));
174- g_dbus_proxy_call (self->priv->proxy, "SetTime", g_variant_new ("(x)", (guint64)current_value),
175+ g_dbus_proxy_call (self->priv->proxy, "SetTime",
176+ g_variant_new ("(xbb)", (gint64) (current_value * G_TIME_SPAN_SECOND), FALSE, TRUE),
177 G_DBUS_CALL_FLAGS_NONE, -1, NULL, dbus_set_answered, "time");
178 }
179 self->priv->user_edited_time = FALSE;
180@@ -696,7 +668,7 @@
181 gtk_container_add (GTK_CONTAINER (alignment), polkit_button);
182 gtk_box_pack_start (GTK_BOX (WIG ("timeDateBox")), alignment, FALSE, TRUE, 0);
183
184- const gchar * polkit_name = "org.gnome.settingsdaemon.datetimemechanism.configure";
185+ const gchar * polkit_name = "org.gnome.controlcenter.datetime.configure";
186 polkit_permission_new (polkit_name, NULL, NULL, polkit_perm_ready, polkit_button);
187
188 /* Add map */
189@@ -763,9 +735,9 @@
190
191 /* Grab proxy for settings daemon */
192 g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, NULL,
193- "org.gnome.SettingsDaemon.DateTimeMechanism",
194- "/",
195- "org.gnome.SettingsDaemon.DateTimeMechanism",
196+ "org.freedesktop.timedate1",
197+ "/org/freedesktop/timedate1",
198+ "org.freedesktop.timedate1",
199 NULL, (GAsyncReadyCallback)proxy_ready, self);
200
201 /* Grab proxy for datetime service, to see if it's running. It would
202@@ -795,16 +767,6 @@
203 g_clear_object (&priv->builder);
204 g_clear_object (&priv->proxy);
205
206- if (priv->tz_query_cancel != NULL) {
207- g_cancellable_cancel (priv->tz_query_cancel);
208- g_clear_object (&priv->tz_query_cancel);
209- }
210-
211- if (priv->ntp_query_cancel != NULL) {
212- g_cancellable_cancel (priv->ntp_query_cancel);
213- g_clear_object (&priv->ntp_query_cancel);
214- }
215-
216 if (priv->loc_dlg) {
217 gtk_widget_destroy (priv->loc_dlg);
218 priv->loc_dlg = NULL;
219
220=== modified file 'src/datetime-service.c'
221--- src/datetime-service.c 2013-03-19 12:01:43 +0000
222+++ src/datetime-service.c 2013-05-03 23:00:49 +0000
223@@ -277,7 +277,7 @@
224 GVariant * answers = g_dbus_proxy_call_finish (G_DBUS_PROXY (object), res, &error);
225
226 if (error != NULL) {
227- g_warning("Could not set timezone for SettingsDaemon: %s", error->message);
228+ g_warning("Could not set timezone using timedated: %s", error->message);
229 g_clear_error (&error);
230 return;
231 }
232@@ -293,13 +293,13 @@
233 GDBusProxy * proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
234
235 if (error != NULL) {
236- g_warning("Could not grab DBus proxy for SettingsDaemon: %s", error->message);
237+ g_warning("Could not grab DBus proxy for timedated: %s", error->message);
238 g_clear_error (&error);
239 g_free (zone);
240 return;
241 }
242
243- g_dbus_proxy_call (proxy, "SetTimezone", g_variant_new ("(s)", zone),
244+ g_dbus_proxy_call (proxy, "SetTimezone", g_variant_new ("(sb)", zone, TRUE),
245 G_DBUS_CALL_FLAGS_NONE, -1, NULL, quick_set_tz_cb, NULL);
246 g_free (zone);
247 g_object_unref (proxy);
248@@ -323,9 +323,9 @@
249 g_object_unref (conf);
250
251 g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, NULL,
252- "org.gnome.SettingsDaemon.DateTimeMechanism",
253- "/",
254- "org.gnome.SettingsDaemon.DateTimeMechanism",
255+ "org.freedesktop.timedate1",
256+ "/org/freedesktop/timedate1",
257+ "org.freedesktop.timedate1",
258 NULL, quick_set_tz_proxy_cb, g_strdup (tz));
259
260 return;

Subscribers

People subscribed via source and target branches