Merge lp:~xnox/indicator-datetime/clickanywhere into lp:indicator-datetime/13.04

Proposed by Dimitri John Ledkov on 2013-03-28
Status: Rejected
Rejected by: Mathieu Trudel-Lapierre on 2013-04-02
Proposed branch: lp:~xnox/indicator-datetime/clickanywhere
Merge into: lp:indicator-datetime/13.04
Diff against target: 146 lines (+56/-6) (has conflicts)
4 files modified
data/com.canonical.indicator.datetime.gschema.xml (+14/-0)
debian/changelog (+4/-0)
src/datetime-prefs.c (+36/-6)
src/settings-shared.h (+2/-0)
Text conflict in debian/changelog
To merge this branch: bzr merge lp:~xnox/indicator-datetime/clickanywhere
Reviewer Review Type Date Requested Status
Mathieu Trudel-Lapierre 2013-03-28 Disapprove on 2013-04-01
PS Jenkins bot (community) continuous-integration Approve on 2013-03-28
Review via email: mp+155994@code.launchpad.net

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)

To post a comment you must log in.
Mathieu Trudel-Lapierre (cyphermox) wrote :

rejected as requested.

review: Disapprove

Unmerged revisions

214. By Dimitri John Ledkov on 2013-03-28

Set a pin point based on the selected town instead of closest timezone

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
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:30:34 +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 'debian/changelog'
26--- debian/changelog 2013-03-28 12:44:47 +0000
27+++ debian/changelog 2013-03-28 15:30:34 +0000
28@@ -1,4 +1,8 @@
29+<<<<<<< TREE
30 indicator-datetime (12.10.3daily13.03.26-0ubuntu1) raring; urgency=low
31+=======
32+indicator-datetime (12.10.3daily13.03.27-0ubuntu1) UNRELEASED; urgency=low
33+>>>>>>> MERGE-SOURCE
34
35 * Use systemd's service backend, ffe lp: #1153567
36 * debian/control: depends on systemd-services and systemd-shim
37
38=== modified file 'src/datetime-prefs.c'
39--- src/datetime-prefs.c 2013-03-26 20:42:11 +0000
40+++ src/datetime-prefs.c 2013-03-28 15:30:34 +0000
41@@ -220,18 +220,30 @@
42 }
43
44 static void
45+sync_location (IndicatorDatetimePanel * self, const gchar * en_name)
46+{
47+ gtk_entry_set_text (GTK_ENTRY (self->priv->tz_entry), en_name);
48+ gtk_entry_set_icon_from_stock (GTK_ENTRY (self->priv->tz_entry),
49+ GTK_ENTRY_ICON_SECONDARY, NULL);
50+
51+ GSettings * conf = g_settings_new (SETTINGS_INTERFACE);
52+ g_settings_set_string (conf, SETTINGS_TIMEZONE_NAME_S, en_name);
53+}
54+
55+static void
56 tz_changed (CcTimezoneMap * map, CcTimezoneLocation * location, IndicatorDatetimePanel * self)
57 {
58 if (location == NULL)
59 return;
60
61- gchar * zone;
62+ gchar * zone, * name;
63 g_object_get (location, "zone", &zone, NULL);
64+ g_object_get (location, "en_name", &name, NULL);
65
66 g_dbus_proxy_call (self->priv->proxy, "SetTimezone", g_variant_new ("(sb)", zone, TRUE),
67 G_DBUS_CALL_FLAGS_NONE, -1, NULL, dbus_set_answered, "timezone");
68
69- sync_entry (self, zone);
70+ sync_location (self, name);
71
72 g_free (zone);
73 }
74@@ -278,7 +290,25 @@
75 {
76 const gchar *timezone = g_variant_get_string (value, NULL);
77
78- cc_timezone_map_set_timezone (priv->tzmap, timezone);
79+ GSettings * conf = g_settings_new (SETTINGS_INTERFACE);
80+ gdouble lon = g_settings_get_double(conf, SETTINGS_LOCATION_LONGITUDE);
81+ gdouble lat = g_settings_get_double(conf, SETTINGS_LOCATION_LATITUDE);
82+ gchar * saved_tz = g_settings_get_string (conf, SETTINGS_TIMEZONE_NAME_S);
83+ gchar * saved_zone, * saved_name;
84+
85+ split_settings_location (saved_tz, &saved_zone, &saved_name);
86+
87+ if (g_strcmp0 (saved_zone, timezone) == 0) {
88+ cc_timezone_map_set_location (self->priv->tzmap, lon, lat);
89+ } else {
90+ cc_timezone_map_set_timezone (self->priv->tzmap, timezone);
91+ }
92+
93+ g_free (saved_tz);
94+ g_free (saved_zone);
95+ g_free (saved_name);
96+ g_object_unref (conf);
97+
98 sync_entry (self, timezone);
99 g_signal_connect (priv->tzmap, "location-changed", G_CALLBACK (tz_changed), self);
100 }
101@@ -572,6 +602,7 @@
102 GtkTreeIter * iter, IndicatorDatetimePanel * self)
103 {
104 const gchar * name, * zone;
105+ gdouble lon = 0.0, lat = 0.0;
106
107 gtk_tree_model_get (model, iter,
108 CC_TIMEZONE_COMPLETION_NAME, &name,
109@@ -580,7 +611,6 @@
110
111 if (zone == NULL || zone[0] == 0) {
112 const gchar * strlon, * strlat;
113- gdouble lon = 0.0, lat = 0.0;
114
115 gtk_tree_model_get (model, iter,
116 CC_TIMEZONE_COMPLETION_LONGITUDE, &strlon,
117@@ -598,14 +628,14 @@
118 zone = cc_timezone_map_get_timezone_at_coords (self->priv->tzmap, lon, lat);
119 }
120
121+ cc_timezone_map_set_location (self->priv->tzmap, lon, lat);
122+
123 GSettings * conf = g_settings_new (SETTINGS_INTERFACE);
124 gchar * tz_name = g_strdup_printf ("%s %s", zone, name);
125 g_settings_set_string (conf, SETTINGS_TIMEZONE_NAME_S, tz_name);
126 g_free (tz_name);
127 g_object_unref (conf);
128
129- cc_timezone_map_set_timezone (self->priv->tzmap, zone);
130-
131 return FALSE; // Do normal action too
132 }
133
134
135=== modified file 'src/settings-shared.h'
136--- src/settings-shared.h 2012-05-17 20:46:42 +0000
137+++ src/settings-shared.h 2013-03-28 15:30:34 +0000
138@@ -36,6 +36,8 @@
139 #define SETTINGS_SHOW_DETECTED_S "show-auto-detected-location"
140 #define SETTINGS_LOCATIONS_S "locations"
141 #define SETTINGS_TIMEZONE_NAME_S "timezone-name"
142+#define SETTINGS_LOCATION_LONGITUDE "location-longitude"
143+#define SETTINGS_LOCATION_LATITUDE "location-latitude"
144
145 enum {
146 SETTINGS_TIME_LOCALE = 0,

Subscribers

People subscribed via source and target branches