Merge lp:~charlesk/indicator-datetime/lp-465689 into lp:indicator-datetime/14.04

Proposed by Charles Kerr on 2013-10-30
Status: Merged
Approved by: Ted Gould on 2013-10-30
Approved revision: 300
Merged at revision: 282
Proposed branch: lp:~charlesk/indicator-datetime/lp-465689
Merge into: lp:indicator-datetime/14.04
Prerequisite: lp:~charlesk/indicator-datetime/cmakeify
Diff against target: 228 lines (+82/-15)
7 files modified
data/com.canonical.indicator.datetime.gschema.xml (+9/-0)
data/datetime-dialog.ui (+42/-3)
panel/datetime-prefs.c (+4/-1)
src/service.c (+3/-1)
src/settings-shared.h (+1/-0)
src/utils.c (+22/-10)
src/utils.h (+1/-0)
To merge this branch: bzr merge lp:~charlesk/indicator-datetime/lp-465689
Reviewer Review Type Date Requested Status
Ted Gould (community) 2013-10-30 Approve on 2013-10-30
PS Jenkins bot (community) continuous-integration Approve on 2013-10-30
Review via email: mp+193345@code.launchpad.net

Description of the change

As per the spec, let users show the year in indicator-datetime.

To post a comment you must log in.
300. By Charles Kerr on 2013-10-30

remove a debug tracer that accidentally got committed

Ted Gould (ted) wrote :

Land this quickly before someone converts this indicator to CMake!!!

review: Approve

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-10-30 23:11:14 +0000
4@@ -64,6 +64,15 @@
5 time-format value is set to custom.
6 </description>
7 </key>
8+ <key name="show-year" type="b">
9+ <default>false</default>
10+ <summary>Show the year in the indicator</summary>
11+ <description>
12+ Puts the year in the panel along with the month and the date.
13+ This setting will be ignored if either the time-format value is set to custom
14+ or if show-date is set to false.
15+ </description>
16+ </key>
17 <key name="show-calendar" type="b">
18 <default>true</default>
19 <summary>Show the monthly calendar in the indicator</summary>
20
21=== modified file 'data/datetime-dialog.ui'
22--- data/datetime-dialog.ui 2013-03-01 22:44:38 +0000
23+++ data/datetime-dialog.ui 2013-10-30 23:11:14 +0000
24@@ -529,7 +529,7 @@
25 </packing>
26 </child>
27 <child>
28- <object class="GtkCheckButton" id="showDateTimeCheck">
29+ <object class="GtkCheckButton" id="showDateAndMonthCheck">
30 <property name="label" translatable="yes">_Date and month</property>
31 <property name="visible">True</property>
32 <property name="can_focus">True</property>
33@@ -546,6 +546,45 @@
34 </packing>
35 </child>
36 <child>
37+ <object class="GtkAlignment" id="showYearAlignment">
38+ <property name="visible">True</property>
39+ <property name="can_focus">False</property>
40+ <property name="xalign">0</property>
41+ <property name="yalign">0</property>
42+ <property name="yscale">0</property>
43+ <property name="left_padding">24</property>
44+ <child>
45+ <object class="GtkVBox" id="showYearVbox">
46+ <property name="visible">True</property>
47+ <property name="can_focus">False</property>
48+ <property name="spacing">6</property>
49+ <child>
50+ <object class="GtkCheckButton" id="showYearCheck">
51+ <property name="label" translatable="yes">_Year</property>
52+ <property name="visible">True</property>
53+ <property name="can_focus">True</property>
54+ <property name="receives_default">False</property>
55+ <property name="use_action_appearance">False</property>
56+ <property name="use_underline">True</property>
57+ <property name="xalign">0</property>
58+ <property name="draw_indicator">True</property>
59+ </object>
60+ <packing>
61+ <property name="expand">True</property>
62+ <property name="fill">True</property>
63+ <property name="position">0</property>
64+ </packing>
65+ </child>
66+ </object>
67+ </child>
68+ </object>
69+ <packing>
70+ <property name="expand">False</property>
71+ <property name="fill">True</property>
72+ <property name="position">3</property>
73+ </packing>
74+ </child>
75+ <child>
76 <object class="GtkVBox" id="vbox5">
77 <property name="visible">True</property>
78 <property name="can_focus">False</property>
79@@ -589,7 +628,7 @@
80 <packing>
81 <property name="expand">False</property>
82 <property name="fill">True</property>
83- <property name="position">3</property>
84+ <property name="position">4</property>
85 </packing>
86 </child>
87 <child>
88@@ -606,7 +645,7 @@
89 <packing>
90 <property name="expand">False</property>
91 <property name="fill">True</property>
92- <property name="position">4</property>
93+ <property name="position">5</property>
94 </packing>
95 </child>
96 </object>
97
98=== modified file 'panel/datetime-prefs.c'
99--- panel/datetime-prefs.c 2013-10-30 23:11:14 +0000
100+++ panel/datetime-prefs.c 2013-10-30 23:11:14 +0000
101@@ -699,7 +699,9 @@
102 "active", G_SETTINGS_BIND_DEFAULT);
103 g_settings_bind (conf, SETTINGS_SHOW_DAY_S, WIG ("showWeekdayCheck"),
104 "active", G_SETTINGS_BIND_DEFAULT);
105- g_settings_bind (conf, SETTINGS_SHOW_DATE_S, WIG ("showDateTimeCheck"),
106+ g_settings_bind (conf, SETTINGS_SHOW_DATE_S, WIG ("showDateAndMonthCheck"),
107+ "active", G_SETTINGS_BIND_DEFAULT);
108+ g_settings_bind (conf, SETTINGS_SHOW_YEAR_S, WIG ("showYearCheck"),
109 "active", G_SETTINGS_BIND_DEFAULT);
110 g_settings_bind (conf, SETTINGS_SHOW_SECONDS_S, WIG ("showSecondsCheck"),
111 "active", G_SETTINGS_BIND_DEFAULT);
112@@ -725,6 +727,7 @@
113 "active", G_SETTINGS_BIND_DEFAULT);
114
115 /* Set up sensitivities */
116+ add_widget_dependency (WIG ("showDateAndMonthCheck"), WIG ("showYearCheck"));
117 add_widget_dependency (WIG ("showCalendarCheck"), WIG ("calendarOptions"));
118 add_widget_dependency (WIG ("showClockCheck"), WIG ("clockOptions"));
119 add_widget_dependency (WIG ("showLocationsCheck"), WIG ("locationsButton"));
120
121=== modified file 'src/service.c'
122--- src/service.c 2013-10-30 23:11:14 +0000
123+++ src/service.c 2013-10-30 23:11:14 +0000
124@@ -666,7 +666,8 @@
125 {
126 gboolean show_day = g_settings_get_boolean (s, SETTINGS_SHOW_DAY_S);
127 gboolean show_date = g_settings_get_boolean (s, SETTINGS_SHOW_DATE_S);
128- fmt = generate_full_format_string (show_day, show_date, s);
129+ gboolean show_year = show_date && g_settings_get_boolean (s, SETTINGS_SHOW_YEAR_S);
130+ fmt = generate_full_format_string (show_day, show_date, show_year, s);
131 }
132
133 p->header_label_format_string = fmt;
134@@ -2182,6 +2183,7 @@
135 SETTINGS_SHOW_SECONDS_S,
136 SETTINGS_SHOW_DAY_S,
137 SETTINGS_SHOW_DATE_S,
138+ SETTINGS_SHOW_YEAR_S,
139 SETTINGS_CUSTOM_TIME_FORMAT_S
140 };
141 const char * const calendar_settings[] = {
142
143=== modified file 'src/settings-shared.h'
144--- src/settings-shared.h 2013-09-07 12:07:51 +0000
145+++ src/settings-shared.h 2013-10-30 23:11:14 +0000
146@@ -37,6 +37,7 @@
147 #define SETTINGS_SHOW_SECONDS_S "show-seconds"
148 #define SETTINGS_SHOW_DAY_S "show-day"
149 #define SETTINGS_SHOW_DATE_S "show-date"
150+#define SETTINGS_SHOW_YEAR_S "show-year"
151 #define SETTINGS_CUSTOM_TIME_FORMAT_S "custom-time-format"
152 #define SETTINGS_SHOW_CALENDAR_S "show-calendar"
153 #define SETTINGS_SHOW_WEEK_NUMBERS_S "show-week-numbers"
154
155=== modified file 'src/utils.c'
156--- src/utils.c 2013-10-30 23:11:14 +0000
157+++ src/utils.c 2013-10-30 23:11:14 +0000
158@@ -329,19 +329,31 @@
159 ***/
160
161 static const gchar *
162-get_full_date_format_string (gboolean show_day, gboolean show_date)
163+get_full_date_format_string (gboolean show_day, gboolean show_date, gboolean show_year)
164 {
165- const gchar * fmt;
166+ const char * fmt;
167
168- if (show_date && show_day)
169- /* TRANSLATORS: a strftime(3) format showing the date and weekday */
170+ if (show_day && show_date && show_year)
171+ /* TRANSLATORS: a strftime(3) format showing the weekday, date, and year */
172+ fmt = T_("%a %b %e %Y");
173+ else if (show_day && show_date)
174+ /* TRANSLATORS: a strftime(3) format showing the weekday and date */
175 fmt = T_("%a %b %e");
176+ else if (show_day && show_year)
177+ /* TRANSLATORS: a strftime(3) format showing the weekday and year. */
178+ fmt = T_("%a %Y");
179+ else if (show_day)
180+ /* TRANSLATORS: a strftime(3) format showing the weekday. */
181+ fmt = T_("%a");
182+ else if (show_date && show_year)
183+ /* TRANSLATORS: a strftime(3) format showing the date and year */
184+ fmt = T_("%b %e %Y");
185 else if (show_date)
186 /* TRANSLATORS: a strftime(3) format showing the date */
187 fmt = T_("%b %e");
188- else if (show_day)
189- /* TRANSLATORS: a strftime(3) format showing the weekday */
190- fmt = T_("%a");
191+ else if (show_year)
192+ /* TRANSLATORS: a strftime(3) format showing the year */
193+ fmt = T_("%Y");
194 else
195 fmt = NULL;
196
197@@ -400,9 +412,9 @@
198 }
199
200 gchar *
201-generate_full_format_string (gboolean show_day, gboolean show_date, GSettings * settings)
202+generate_full_format_string (gboolean show_day, gboolean show_date, gboolean show_year, GSettings * settings)
203 {
204- const gchar * date_fmt = get_full_date_format_string (show_day, show_date);
205+ const gchar * date_fmt = get_full_date_format_string (show_day, show_date, show_year);
206 const gchar * time_fmt = get_full_time_format_string (settings);
207 return join_date_and_time_format_strings (date_fmt, time_fmt);
208 }
209@@ -436,6 +448,6 @@
210 break;
211 }
212
213- return generate_full_format_string (show_day, show_date, settings);
214+ return generate_full_format_string (show_day, show_date, FALSE, settings);
215 }
216
217
218=== modified file 'src/utils.h'
219--- src/utils.h 2013-10-03 21:16:24 +0000
220+++ src/utils.h 2013-10-30 23:11:14 +0000
221@@ -54,6 +54,7 @@
222
223 gchar * generate_full_format_string (gboolean show_day,
224 gboolean show_date,
225+ gboolean show_year,
226 GSettings * settings);
227
228 gchar * generate_full_format_string_at_time (GDateTime * now,

Subscribers

People subscribed via source and target branches