Merge lp:~robert-ancell/indicator-datetime/no-panel into lp:indicator-datetime/14.04

Proposed by Robert Ancell
Status: Merged
Approved by: Charles Kerr
Approved revision: 306
Merged at revision: 303
Proposed branch: lp:~robert-ancell/indicator-datetime/no-panel
Merge into: lp:indicator-datetime/14.04
Diff against target: 2820 lines (+2/-2677)
18 files modified
CMakeLists.txt (+0/-28)
data/CMakeLists.txt (+0/-43)
data/datetime-dialog.ui (+0/-864)
data/gnome-indicator-datetime-panel.desktop.in (+0/-13)
data/unity-datetime-panel.desktop.in (+0/-13)
debian/control (+1/-29)
debian/gnome-control-center-datetime.install (+0/-3)
debian/indicator-datetime.install (+0/-6)
debian/unity-control-center-datetime.install (+0/-3)
panel-gnome/CMakeLists.txt (+0/-30)
panel-unity/CMakeLists.txt (+0/-29)
panel/datetime-prefs-locations.c (+0/-687)
panel/datetime-prefs-locations.h (+0/-35)
panel/datetime-prefs.c (+0/-879)
po/CMakeLists.txt (+1/-1)
po/POTFILES.in (+0/-5)
src/CMakeLists.txt (+0/-5)
src/actions-live.cpp (+0/-4)
To merge this branch: bzr merge lp:~robert-ancell/indicator-datetime/no-panel
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Charles Kerr (community) Approve
Sebastien Bacher Approve
Review via email: mp+205664@code.launchpad.net

Commit message

Move date/time panel into unity-control-center

To post a comment you must log in.
Revision history for this message
Robert Ancell (robert-ancell) wrote :
304. By Robert Ancell

Drop dependency on libtimezonemap1-dev

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks for the work Robert. Do we need the dummy package? The unity one might makes sense for upgrades (though having u-c-c provides the old name should be good enough), the gnome-control-center-datetime doesn't really imho (especially since it has an empty depends list)

review: Needs Information
Revision history for this message
Charles Kerr (charlesk) wrote :

As discussed in irc, I agree with the premise of moving the datetime panel out of this repo and appreciate Robert working on this diff. :)

305. By Robert Ancell

Remove gnome-control-center-datetime and unity-control-center-datetime - we don't need them

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Sebastien Bacher (seb128) wrote :

Looks fine to me, I'm letting an indicator maintainer change the merge status though

review: Approve
306. By Robert Ancell

Remove .install file - we have one binary package now

Revision history for this message
Charles Kerr (charlesk) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

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 2014-01-27 17:02:40 +0000
3+++ CMakeLists.txt 2014-02-11 21:51:37 +0000
4@@ -44,28 +44,6 @@
5 json-glib-1.0>=0.16.2)
6 include_directories (SYSTEM ${SERVICE_DEPS_INCLUDE_DIRS})
7
8-pkg_check_modules (PANEL_DEPS
9- glib-2.0>=2.36
10- gio-unix-2.0>=2.36
11- gtk+-3.0>=3.1.4
12- timezonemap
13- libgnome-control-center
14- polkit-gobject-1)
15-if (PANEL_DEPS_FOUND)
16- set (BUILD_PANEL 1)
17-endif ()
18-
19-pkg_check_modules (UNITY_PANEL_DEPS
20- glib-2.0>=2.36
21- gio-unix-2.0>=2.36
22- gtk+-3.0>=3.1.4
23- timezonemap
24- libunity-control-center
25- polkit-gobject-1)
26-if (UNITY_PANEL_DEPS_FOUND)
27- set (BUILD_UNITY_PANEL 1)
28-endif ()
29-
30 ##
31 ## custom targets
32 ##
33@@ -107,12 +85,6 @@
34 # actually build things
35 add_subdirectory(include)
36 add_subdirectory(src)
37-if (BUILD_PANEL)
38- add_subdirectory (panel-gnome)
39-endif ()
40-if (BUILD_UNITY_PANEL)
41- add_subdirectory (panel-unity)
42-endif ()
43 add_subdirectory(data)
44 add_subdirectory(po)
45 if (${enable_tests})
46
47=== modified file 'data/CMakeLists.txt'
48--- data/CMakeLists.txt 2014-01-10 01:45:41 +0000
49+++ data/CMakeLists.txt 2014-02-11 21:51:37 +0000
50@@ -62,46 +62,3 @@
51
52 install (FILES "${UNITY_INDICATOR_FILE}"
53 DESTINATION "${UNITY_INDICATOR_DIR}")
54-
55-
56-##
57-## gnome-control-center panel: .ui and .desktop files
58-##
59-
60-if (BUILD_PANEL)
61-
62- # the .ui file
63- install (FILES "datetime-dialog.ui"
64- DESTINATION "${CMAKE_INSTALL_DATADIR}/${CMAKE_PROJECT_NAME}/gnome-control-center")
65-
66- # the .desktop file
67- set (DESKTOP_NAME "gnome-indicator-datetime-panel.desktop")
68- set (DESKTOP_FILE "${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_NAME}")
69- set (DESKTOP_FILE_IN "${CMAKE_CURRENT_SOURCE_DIR}/${DESKTOP_NAME}.in")
70- set (ENV{LC_ALL} "C")
71- execute_process (COMMAND intltool-merge -quiet --desktop-style --utf8 "${CMAKE_SOURCE_DIR}/po" "${DESKTOP_FILE_IN}" "${DESKTOP_FILE}")
72- install (FILES ${DESKTOP_FILE}
73- DESTINATION "${CMAKE_INSTALL_DATADIR}/applications")
74-
75-endif ()
76-
77-##
78-## unity-control-center panel: .ui and .desktop files
79-##
80-
81-if (BUILD_UNITY_PANEL)
82-
83- # the .ui file
84- install (FILES "datetime-dialog.ui"
85- DESTINATION "${CMAKE_INSTALL_DATADIR}/${CMAKE_PROJECT_NAME}/unity-control-center")
86-
87- # the .desktop file
88- set (DESKTOP_NAME "unity-datetime-panel.desktop")
89- set (DESKTOP_FILE "${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_NAME}")
90- set (DESKTOP_FILE_IN "${CMAKE_CURRENT_SOURCE_DIR}/${DESKTOP_NAME}.in")
91- set (ENV{LC_ALL} "C")
92- execute_process (COMMAND intltool-merge -quiet --desktop-style --utf8 "${CMAKE_SOURCE_DIR}/po" "${DESKTOP_FILE_IN}" "${DESKTOP_FILE}")
93- install (FILES ${DESKTOP_FILE}
94- DESTINATION "${CMAKE_INSTALL_DATADIR}/applications")
95-
96-endif ()
97
98=== removed file 'data/datetime-dialog.ui'
99--- data/datetime-dialog.ui 2013-10-30 22:29:43 +0000
100+++ data/datetime-dialog.ui 1970-01-01 00:00:00 +0000
101@@ -1,864 +0,0 @@
102-<?xml version="1.0" encoding="UTF-8"?>
103-<interface>
104- <requires lib="gtk+" version="2.24"/>
105- <!-- interface-naming-policy project-wide -->
106- <object class="GtkAdjustment" id="dateAdjustment">
107- <property name="upper">1.8446744073709552e+19</property>
108- <property name="step_increment">86400</property>
109- <property name="page_increment">864000</property>
110- </object>
111- <object class="GtkWindow" id="locationsDialog">
112- <property name="can_focus">False</property>
113- <property name="title" translatable="yes">Locations</property>
114- <property name="default_width">300</property>
115- <property name="default_height">200</property>
116- <property name="destroy_with_parent">True</property>
117- <child>
118- <object class="GtkVBox" id="vbox1">
119- <property name="visible">True</property>
120- <property name="can_focus">False</property>
121- <child>
122- <object class="GtkScrolledWindow" id="scrolledwindow1">
123- <property name="visible">True</property>
124- <property name="can_focus">True</property>
125- <property name="hscrollbar_policy">automatic</property>
126- <property name="vscrollbar_policy">automatic</property>
127- <child>
128- <object class="GtkTreeView" id="locationsView">
129- <property name="visible">True</property>
130- <property name="can_focus">True</property>
131- <property name="model">locationsStore</property>
132- <property name="headers_visible">False</property>
133- <property name="headers_clickable">False</property>
134- <property name="reorderable">True</property>
135- <property name="search_column">0</property>
136- </object>
137- </child>
138- </object>
139- <packing>
140- <property name="expand">True</property>
141- <property name="fill">True</property>
142- <property name="position">0</property>
143- </packing>
144- </child>
145- <child>
146- <object class="GtkHSeparator" id="hseparator1">
147- <property name="visible">True</property>
148- <property name="can_focus">False</property>
149- </object>
150- <packing>
151- <property name="expand">False</property>
152- <property name="fill">True</property>
153- <property name="position">1</property>
154- </packing>
155- </child>
156- <child>
157- <object class="GtkHBox" id="hbox10">
158- <property name="visible">True</property>
159- <property name="can_focus">False</property>
160- <property name="spacing">4</property>
161- <child>
162- <object class="GtkButton" id="addButton">
163- <property name="visible">True</property>
164- <property name="can_focus">True</property>
165- <property name="receives_default">True</property>
166- <property name="use_action_appearance">False</property>
167- <child internal-child="accessible">
168- <object class="AtkObject" id="addButton-atkobject">
169- <property name="AtkObject::accessible-description" translatable="yes">Add a Location…</property>
170- </object>
171- </child>
172- <child>
173- <object class="GtkImage" id="addImage">
174- <property name="visible">True</property>
175- <property name="can_focus">False</property>
176- <property name="stock">gtk-add</property>
177- </object>
178- </child>
179- </object>
180- <packing>
181- <property name="expand">False</property>
182- <property name="fill">True</property>
183- <property name="position">0</property>
184- </packing>
185- </child>
186- <child>
187- <object class="GtkButton" id="removeButton">
188- <property name="visible">True</property>
189- <property name="can_focus">True</property>
190- <property name="receives_default">True</property>
191- <property name="use_action_appearance">False</property>
192- <child internal-child="accessible">
193- <object class="AtkObject" id="removeButton-atkobject">
194- <property name="AtkObject::accessible-description" translatable="yes">Remove This Location</property>
195- </object>
196- </child>
197- <child>
198- <object class="GtkImage" id="removeImage">
199- <property name="visible">True</property>
200- <property name="can_focus">False</property>
201- <property name="stock">gtk-remove</property>
202- </object>
203- </child>
204- </object>
205- <packing>
206- <property name="expand">False</property>
207- <property name="fill">True</property>
208- <property name="position">1</property>
209- </packing>
210- </child>
211- <child>
212- <object class="GtkButton" id="sortByNameButton">
213- <property name="label" translatable="yes">Sort by _Name</property>
214- <property name="use_action_appearance">False</property>
215- <property name="visible">True</property>
216- <property name="can_focus">True</property>
217- <property name="receives_default">True</property>
218- <property name="use_action_appearance">False</property>
219- <property name="use_underline">True</property>
220- <accelerator key="n" signal="clicked" modifiers="GDK_MOD1_MASK"/>
221- </object>
222- <packing>
223- <property name="expand">False</property>
224- <property name="fill">False</property>
225- <property name="padding">6</property>
226- <property name="position">2</property>
227- </packing>
228- </child>
229- <child>
230- <object class="GtkButton" id="sortByTimeButton">
231- <property name="label" translatable="yes">Sort by _Time</property>
232- <property name="use_action_appearance">False</property>
233- <property name="visible">True</property>
234- <property name="can_focus">True</property>
235- <property name="receives_default">True</property>
236- <property name="use_action_appearance">False</property>
237- <property name="use_underline">True</property>
238- <accelerator key="t" signal="clicked" modifiers="GDK_MOD1_MASK"/>
239- </object>
240- <packing>
241- <property name="expand">False</property>
242- <property name="fill">False</property>
243- <property name="position">3</property>
244- </packing>
245- </child>
246- </object>
247- <packing>
248- <property name="expand">False</property>
249- <property name="fill">True</property>
250- <property name="padding">4</property>
251- <property name="position">2</property>
252- </packing>
253- </child>
254- </object>
255- </child>
256- </object>
257- <object class="GtkListStore" id="locationsStore">
258- <columns>
259- <!-- column-name Location -->
260- <column type="gchararray"/>
261- <!-- column-name Time -->
262- <column type="gchararray"/>
263- <!-- column-name Zone -->
264- <column type="gchararray"/>
265- <!-- column-name Visible Name -->
266- <column type="gchararray"/>
267- <!-- column-name Icon -->
268- <column type="gchararray"/>
269- </columns>
270- </object>
271- <object class="GtkAdjustment" id="timeAdjustment">
272- <property name="upper">1.8446744073709552e+19</property>
273- <property name="step_increment">60</property>
274- <property name="page_increment">3600</property>
275- </object>
276- <object class="GtkEventBox" id="timeDatePanel">
277- <property name="can_focus">False</property>
278- <property name="border_width">5</property>
279- <child>
280- <object class="GtkNotebook" id="notebook1">
281- <property name="visible">True</property>
282- <property name="can_focus">True</property>
283- <child>
284- <object class="GtkVBox" id="timeDateBox">
285- <property name="visible">True</property>
286- <property name="can_focus">False</property>
287- <property name="border_width">12</property>
288- <property name="spacing">6</property>
289- <child>
290- <object class="GtkVBox" id="timeDateOptions">
291- <property name="visible">True</property>
292- <property name="can_focus">False</property>
293- <property name="spacing">12</property>
294- <child>
295- <object class="GtkVBox" id="vbox6">
296- <property name="visible">True</property>
297- <property name="can_focus">False</property>
298- <property name="spacing">6</property>
299- <child>
300- <object class="GtkAspectFrame" id="mapBox">
301- <property name="height_request">265</property>
302- <property name="visible">True</property>
303- <property name="can_focus">False</property>
304- <property name="label_xalign">0</property>
305- <property name="shadow_type">none</property>
306- <child>
307- <placeholder/>
308- </child>
309- </object>
310- <packing>
311- <property name="expand">True</property>
312- <property name="fill">True</property>
313- <property name="position">0</property>
314- </packing>
315- </child>
316- <child>
317- <object class="GtkHBox" id="hbox1">
318- <property name="visible">True</property>
319- <property name="can_focus">False</property>
320- <property name="spacing">6</property>
321- <child>
322- <object class="GtkLabel" id="label5">
323- <property name="visible">True</property>
324- <property name="can_focus">False</property>
325- <property name="xalign">1</property>
326- <property name="label" translatable="yes">_Location:</property>
327- <property name="use_underline">True</property>
328- <property name="mnemonic_widget">timezoneEntry</property>
329- </object>
330- <packing>
331- <property name="expand">False</property>
332- <property name="fill">True</property>
333- <property name="position">0</property>
334- </packing>
335- </child>
336- <child>
337- <object class="GtkEntry" id="timezoneEntry">
338- <property name="visible">True</property>
339- <property name="can_focus">True</property>
340- <property name="invisible_char">•</property>
341- <property name="invisible_char_set">True</property>
342- </object>
343- <packing>
344- <property name="expand">True</property>
345- <property name="fill">True</property>
346- <property name="position">1</property>
347- </packing>
348- </child>
349- </object>
350- <packing>
351- <property name="expand">False</property>
352- <property name="fill">True</property>
353- <property name="position">1</property>
354- </packing>
355- </child>
356- </object>
357- <packing>
358- <property name="expand">True</property>
359- <property name="fill">True</property>
360- <property name="position">0</property>
361- </packing>
362- </child>
363- <child>
364- <object class="GtkTable" id="table1">
365- <property name="visible">True</property>
366- <property name="can_focus">False</property>
367- <property name="n_rows">2</property>
368- <property name="n_columns">2</property>
369- <property name="column_spacing">6</property>
370- <property name="row_spacing">6</property>
371- <child>
372- <object class="GtkHBox" id="hbox2">
373- <property name="visible">True</property>
374- <property name="can_focus">False</property>
375- <property name="spacing">6</property>
376- <child>
377- <object class="GtkRadioButton" id="manualTimeRadio">
378- <property name="label" translatable="yes">_Manually</property>
379- <property name="visible">True</property>
380- <property name="can_focus">True</property>
381- <property name="receives_default">False</property>
382- <property name="use_action_appearance">False</property>
383- <property name="use_underline">True</property>
384- <property name="xalign">0</property>
385- <property name="active">True</property>
386- <property name="draw_indicator">True</property>
387- </object>
388- <packing>
389- <property name="expand">False</property>
390- <property name="fill">True</property>
391- <property name="position">0</property>
392- </packing>
393- </child>
394- <child>
395- <object class="GtkRadioButton" id="automaticTimeRadio">
396- <property name="label" translatable="yes">_Automatically from the Internet</property>
397- <property name="visible">True</property>
398- <property name="sensitive">True</property>
399- <property name="can_focus">True</property>
400- <property name="receives_default">False</property>
401- <property name="use_action_appearance">False</property>
402- <property name="use_underline">True</property>
403- <property name="xalign">0</property>
404- <property name="draw_indicator">True</property>
405- <property name="group">manualTimeRadio</property>
406- </object>
407- <packing>
408- <property name="expand">False</property>
409- <property name="fill">True</property>
410- <property name="position">1</property>
411- </packing>
412- </child>
413- </object>
414- <packing>
415- <property name="left_attach">1</property>
416- <property name="right_attach">2</property>
417- </packing>
418- </child>
419- <child>
420- <object class="GtkLabel" id="label9">
421- <property name="visible">True</property>
422- <property name="can_focus">False</property>
423- <property name="xalign">1</property>
424- <property name="label" translatable="yes">Set the time:</property>
425- </object>
426- <packing>
427- <property name="x_options">GTK_FILL</property>
428- <property name="y_options">GTK_FILL</property>
429- </packing>
430- </child>
431- <child>
432- <object class="GtkHBox" id="manualOptions">
433- <property name="visible">True</property>
434- <property name="can_focus">False</property>
435- <property name="spacing">12</property>
436- <child>
437- <object class="GtkHBox" id="hbox8">
438- <property name="visible">True</property>
439- <property name="can_focus">False</property>
440- <property name="spacing">6</property>
441- <child>
442- <object class="GtkSpinButton" id="timeSpinner">
443- <property name="visible">True</property>
444- <property name="can_focus">True</property>
445- <property name="invisible_char">•</property>
446- <property name="width_chars">11</property>
447- <property name="xalign">1</property>
448- <property name="invisible_char_set">True</property>
449- <property name="adjustment">timeAdjustment</property>
450- </object>
451- <packing>
452- <property name="expand">False</property>
453- <property name="fill">True</property>
454- <property name="position">0</property>
455- </packing>
456- </child>
457- </object>
458- <packing>
459- <property name="expand">False</property>
460- <property name="fill">True</property>
461- <property name="position">0</property>
462- </packing>
463- </child>
464- <child>
465- <object class="GtkHBox" id="hbox9">
466- <property name="visible">True</property>
467- <property name="can_focus">False</property>
468- <property name="spacing">6</property>
469- <child>
470- <object class="GtkLabel" id="label10">
471- <property name="visible">True</property>
472- <property name="can_focus">False</property>
473- <property name="xalign">0</property>
474- <property name="label" translatable="yes">_Date:</property>
475- <property name="use_underline">True</property>
476- <property name="mnemonic_widget">dateSpinner</property>
477- </object>
478- <packing>
479- <property name="expand">False</property>
480- <property name="fill">True</property>
481- <property name="position">0</property>
482- </packing>
483- </child>
484- <child>
485- <object class="GtkSpinButton" id="dateSpinner">
486- <property name="visible">True</property>
487- <property name="can_focus">True</property>
488- <property name="invisible_char">•</property>
489- <property name="width_chars">11</property>
490- <property name="xalign">1</property>
491- <property name="invisible_char_set">True</property>
492- <property name="adjustment">dateAdjustment</property>
493- </object>
494- <packing>
495- <property name="expand">False</property>
496- <property name="fill">True</property>
497- <property name="position">1</property>
498- </packing>
499- </child>
500- </object>
501- <packing>
502- <property name="expand">False</property>
503- <property name="fill">True</property>
504- <property name="position">1</property>
505- </packing>
506- </child>
507- </object>
508- <packing>
509- <property name="left_attach">1</property>
510- <property name="right_attach">2</property>
511- <property name="top_attach">1</property>
512- <property name="bottom_attach">2</property>
513- </packing>
514- </child>
515- <child>
516- <object class="GtkLabel" id="label11">
517- <property name="visible">True</property>
518- <property name="can_focus">False</property>
519- <property name="xalign">1</property>
520- <property name="label" translatable="yes">Tim_e:</property>
521- <property name="use_underline">True</property>
522- <property name="mnemonic_widget">timeSpinner</property>
523- </object>
524- <packing>
525- <property name="top_attach">1</property>
526- <property name="bottom_attach">2</property>
527- <property name="x_options">GTK_FILL</property>
528- <property name="y_options">GTK_FILL</property>
529- </packing>
530- </child>
531- </object>
532- <packing>
533- <property name="expand">False</property>
534- <property name="fill">True</property>
535- <property name="position">1</property>
536- </packing>
537- </child>
538- </object>
539- <packing>
540- <property name="expand">True</property>
541- <property name="fill">True</property>
542- <property name="pack_type">end</property>
543- <property name="position">0</property>
544- </packing>
545- </child>
546- <child>
547- <placeholder/>
548- </child>
549- </object>
550- </child>
551- <child type="tab">
552- <object class="GtkLabel" id="label1">
553- <property name="visible">True</property>
554- <property name="can_focus">False</property>
555- <property name="xpad">1</property>
556- <property name="label" translatable="yes">_Time &amp; Date</property>
557- <property name="use_underline">True</property>
558- </object>
559- <packing>
560- <property name="tab_fill">False</property>
561- </packing>
562- </child>
563- <child>
564- <object class="GtkAlignment" id="alignment1">
565- <property name="visible">True</property>
566- <property name="can_focus">False</property>
567- <property name="yalign">0</property>
568- <property name="yscale">0</property>
569- <child>
570- <object class="GtkVBox" id="clockBox">
571- <property name="visible">True</property>
572- <property name="can_focus">False</property>
573- <property name="border_width">12</property>
574- <property name="spacing">12</property>
575- <child>
576- <object class="GtkCheckButton" id="showClockCheck">
577- <property name="label" translatable="yes">_Show a clock in the menu bar</property>
578- <property name="visible">True</property>
579- <property name="can_focus">True</property>
580- <property name="receives_default">False</property>
581- <property name="use_action_appearance">False</property>
582- <property name="use_underline">True</property>
583- <property name="xalign">0</property>
584- <property name="draw_indicator">True</property>
585- </object>
586- <packing>
587- <property name="expand">True</property>
588- <property name="fill">True</property>
589- <property name="position">0</property>
590- </packing>
591- </child>
592- <child>
593- <object class="GtkHBox" id="clockOptions">
594- <property name="visible">True</property>
595- <property name="can_focus">False</property>
596- <property name="homogeneous">True</property>
597- <child>
598- <object class="GtkVBox" id="vbox2">
599- <property name="visible">True</property>
600- <property name="can_focus">False</property>
601- <property name="spacing">6</property>
602- <child>
603- <object class="GtkLabel" id="label3">
604- <property name="visible">True</property>
605- <property name="can_focus">False</property>
606- <property name="xalign">0</property>
607- <property name="label" translatable="yes">In the clock, show:</property>
608- </object>
609- <packing>
610- <property name="expand">False</property>
611- <property name="fill">True</property>
612- <property name="position">0</property>
613- </packing>
614- </child>
615- <child>
616- <object class="GtkCheckButton" id="showWeekdayCheck">
617- <property name="label" translatable="yes">_Weekday</property>
618- <property name="visible">True</property>
619- <property name="can_focus">True</property>
620- <property name="receives_default">False</property>
621- <property name="use_action_appearance">False</property>
622- <property name="use_underline">True</property>
623- <property name="xalign">0</property>
624- <property name="draw_indicator">True</property>
625- </object>
626- <packing>
627- <property name="expand">False</property>
628- <property name="fill">True</property>
629- <property name="position">1</property>
630- </packing>
631- </child>
632- <child>
633- <object class="GtkCheckButton" id="showDateAndMonthCheck">
634- <property name="label" translatable="yes">_Date and month</property>
635- <property name="visible">True</property>
636- <property name="can_focus">True</property>
637- <property name="receives_default">False</property>
638- <property name="use_action_appearance">False</property>
639- <property name="use_underline">True</property>
640- <property name="xalign">0</property>
641- <property name="draw_indicator">True</property>
642- </object>
643- <packing>
644- <property name="expand">False</property>
645- <property name="fill">True</property>
646- <property name="position">2</property>
647- </packing>
648- </child>
649- <child>
650- <object class="GtkAlignment" id="showYearAlignment">
651- <property name="visible">True</property>
652- <property name="can_focus">False</property>
653- <property name="xalign">0</property>
654- <property name="yalign">0</property>
655- <property name="yscale">0</property>
656- <property name="left_padding">24</property>
657- <child>
658- <object class="GtkVBox" id="showYearVbox">
659- <property name="visible">True</property>
660- <property name="can_focus">False</property>
661- <property name="spacing">6</property>
662- <child>
663- <object class="GtkCheckButton" id="showYearCheck">
664- <property name="label" translatable="yes">_Year</property>
665- <property name="visible">True</property>
666- <property name="can_focus">True</property>
667- <property name="receives_default">False</property>
668- <property name="use_action_appearance">False</property>
669- <property name="use_underline">True</property>
670- <property name="xalign">0</property>
671- <property name="draw_indicator">True</property>
672- </object>
673- <packing>
674- <property name="expand">True</property>
675- <property name="fill">True</property>
676- <property name="position">0</property>
677- </packing>
678- </child>
679- </object>
680- </child>
681- </object>
682- <packing>
683- <property name="expand">False</property>
684- <property name="fill">True</property>
685- <property name="position">3</property>
686- </packing>
687- </child>
688- <child>
689- <object class="GtkVBox" id="vbox5">
690- <property name="visible">True</property>
691- <property name="can_focus">False</property>
692- <child>
693- <object class="GtkRadioButton" id="show12HourRadio">
694- <property name="label" translatable="yes">_12-hour time</property>
695- <property name="visible">True</property>
696- <property name="can_focus">True</property>
697- <property name="receives_default">False</property>
698- <property name="use_action_appearance">False</property>
699- <property name="use_underline">True</property>
700- <property name="xalign">0</property>
701- <property name="active">True</property>
702- <property name="draw_indicator">True</property>
703- </object>
704- <packing>
705- <property name="expand">False</property>
706- <property name="fill">True</property>
707- <property name="position">0</property>
708- </packing>
709- </child>
710- <child>
711- <object class="GtkRadioButton" id="show24HourRadio">
712- <property name="label" translatable="yes">_24-hour time</property>
713- <property name="visible">True</property>
714- <property name="can_focus">True</property>
715- <property name="receives_default">False</property>
716- <property name="use_action_appearance">False</property>
717- <property name="use_underline">True</property>
718- <property name="xalign">0</property>
719- <property name="draw_indicator">True</property>
720- <property name="group">show12HourRadio</property>
721- </object>
722- <packing>
723- <property name="expand">False</property>
724- <property name="fill">True</property>
725- <property name="position">1</property>
726- </packing>
727- </child>
728- </object>
729- <packing>
730- <property name="expand">False</property>
731- <property name="fill">True</property>
732- <property name="position">4</property>
733- </packing>
734- </child>
735- <child>
736- <object class="GtkCheckButton" id="showSecondsCheck">
737- <property name="label" translatable="yes">Seco_nds</property>
738- <property name="visible">True</property>
739- <property name="can_focus">True</property>
740- <property name="receives_default">False</property>
741- <property name="use_action_appearance">False</property>
742- <property name="use_underline">True</property>
743- <property name="xalign">0</property>
744- <property name="draw_indicator">True</property>
745- </object>
746- <packing>
747- <property name="expand">False</property>
748- <property name="fill">True</property>
749- <property name="position">5</property>
750- </packing>
751- </child>
752- </object>
753- <packing>
754- <property name="expand">True</property>
755- <property name="fill">True</property>
756- <property name="position">0</property>
757- </packing>
758- </child>
759- <child>
760- <object class="GtkVBox" id="vbox3">
761- <property name="visible">True</property>
762- <property name="can_focus">False</property>
763- <property name="spacing">6</property>
764- <child>
765- <object class="GtkLabel" id="label4">
766- <property name="visible">True</property>
767- <property name="can_focus">False</property>
768- <property name="xalign">0</property>
769- <property name="label" translatable="yes">In the clock’s menu, show:</property>
770- </object>
771- <packing>
772- <property name="expand">True</property>
773- <property name="fill">True</property>
774- <property name="position">0</property>
775- </packing>
776- </child>
777- <child>
778- <object class="GtkCheckButton" id="showCalendarCheck">
779- <property name="label" translatable="yes">_Monthly calendar</property>
780- <property name="visible">True</property>
781- <property name="can_focus">True</property>
782- <property name="receives_default">False</property>
783- <property name="use_action_appearance">False</property>
784- <property name="use_underline">True</property>
785- <property name="xalign">0</property>
786- <property name="draw_indicator">True</property>
787- </object>
788- <packing>
789- <property name="expand">False</property>
790- <property name="fill">True</property>
791- <property name="position">1</property>
792- </packing>
793- </child>
794- <child>
795- <object class="GtkAlignment" id="calendarOptions">
796- <property name="visible">True</property>
797- <property name="can_focus">False</property>
798- <property name="xalign">0</property>
799- <property name="yalign">0</property>
800- <property name="yscale">0</property>
801- <property name="left_padding">24</property>
802- <child>
803- <object class="GtkVBox" id="vbox4">
804- <property name="visible">True</property>
805- <property name="can_focus">False</property>
806- <property name="spacing">6</property>
807- <child>
808- <object class="GtkCheckButton" id="includeWeekNumbersCheck">
809- <property name="label" translatable="yes">Include week num_bers</property>
810- <property name="visible">True</property>
811- <property name="can_focus">True</property>
812- <property name="receives_default">False</property>
813- <property name="use_action_appearance">False</property>
814- <property name="use_underline">True</property>
815- <property name="xalign">0</property>
816- <property name="draw_indicator">True</property>
817- </object>
818- <packing>
819- <property name="expand">True</property>
820- <property name="fill">True</property>
821- <property name="position">0</property>
822- </packing>
823- </child>
824- </object>
825- </child>
826- </object>
827- <packing>
828- <property name="expand">False</property>
829- <property name="fill">True</property>
830- <property name="position">2</property>
831- </packing>
832- </child>
833- <child>
834- <object class="GtkCheckButton" id="showEventsCheck">
835- <property name="visible">True</property>
836- <property name="can_focus">True</property>
837- <property name="receives_default">False</property>
838- <property name="use_action_appearance">False</property>
839- <property name="use_underline">True</property>
840- <property name="xalign">0</property>
841- <property name="draw_indicator">True</property>
842- <child>
843- <object class="GtkLabel" id="label12">
844- <property name="visible">True</property>
845- <property name="can_focus">False</property>
846- <property name="xalign">0</property>
847- <property name="label" translatable="yes">Coming _events from Evolution Calendar</property>
848- <property name="use_underline">True</property>
849- <property name="wrap">True</property>
850- <property name="mnemonic_widget">showEventsCheck</property>
851- </object>
852- </child>
853- </object>
854- <packing>
855- <property name="expand">False</property>
856- <property name="fill">True</property>
857- <property name="position">3</property>
858- </packing>
859- </child>
860- <child>
861- <object class="GtkCheckButton" id="showDetectedCheck">
862- <property name="label" translatable="yes">Time in _auto-detected location</property>
863- <property name="visible">True</property>
864- <property name="can_focus">True</property>
865- <property name="receives_default">False</property>
866- <property name="use_action_appearance">False</property>
867- <property name="use_underline">True</property>
868- <property name="xalign">0</property>
869- <property name="draw_indicator">True</property>
870- </object>
871- <packing>
872- <property name="expand">False</property>
873- <property name="fill">True</property>
874- <property name="position">4</property>
875- </packing>
876- </child>
877- <child>
878- <object class="GtkCheckButton" id="showLocationsCheck">
879- <property name="label" translatable="yes">Time in _other locations</property>
880- <property name="visible">True</property>
881- <property name="can_focus">True</property>
882- <property name="receives_default">False</property>
883- <property name="use_action_appearance">False</property>
884- <property name="use_underline">True</property>
885- <property name="xalign">0</property>
886- <property name="draw_indicator">True</property>
887- </object>
888- <packing>
889- <property name="expand">False</property>
890- <property name="fill">True</property>
891- <property name="position">5</property>
892- </packing>
893- </child>
894- <child>
895- <object class="GtkAlignment" id="alignment2">
896- <property name="visible">True</property>
897- <property name="can_focus">False</property>
898- <property name="xalign">0</property>
899- <property name="yalign">0</property>
900- <property name="xscale">0</property>
901- <property name="yscale">0</property>
902- <property name="left_padding">24</property>
903- <child>
904- <object class="GtkButton" id="locationsButton">
905- <property name="label" translatable="yes">Choose _Locations…</property>
906- <property name="visible">True</property>
907- <property name="can_focus">True</property>
908- <property name="receives_default">True</property>
909- <property name="use_action_appearance">False</property>
910- <property name="use_underline">True</property>
911- <property name="xalign">0</property>
912- </object>
913- </child>
914- </object>
915- <packing>
916- <property name="expand">True</property>
917- <property name="fill">True</property>
918- <property name="position">6</property>
919- </packing>
920- </child>
921- </object>
922- <packing>
923- <property name="expand">True</property>
924- <property name="fill">True</property>
925- <property name="position">1</property>
926- </packing>
927- </child>
928- </object>
929- <packing>
930- <property name="expand">True</property>
931- <property name="fill">True</property>
932- <property name="position">1</property>
933- </packing>
934- </child>
935- </object>
936- </child>
937- </object>
938- <packing>
939- <property name="position">1</property>
940- <property name="tab_fill">False</property>
941- </packing>
942- </child>
943- <child type="tab">
944- <object class="GtkLabel" id="label2">
945- <property name="visible">True</property>
946- <property name="can_focus">False</property>
947- <property name="label" translatable="yes">_Clock</property>
948- <property name="use_underline">True</property>
949- </object>
950- <packing>
951- <property name="position">1</property>
952- <property name="tab_fill">False</property>
953- </packing>
954- </child>
955- </object>
956- </child>
957- </object>
958- <object class="GtkSizeGroup" id="timeSizeGroup">
959- <widgets>
960- <widget name="label5"/>
961- <widget name="label9"/>
962- <widget name="label11"/>
963- </widgets>
964- </object>
965-</interface>
966
967=== removed file 'data/gnome-indicator-datetime-panel.desktop.in'
968--- data/gnome-indicator-datetime-panel.desktop.in 2013-09-23 04:32:05 +0000
969+++ data/gnome-indicator-datetime-panel.desktop.in 1970-01-01 00:00:00 +0000
970@@ -1,13 +0,0 @@
971-[Desktop Entry]
972-Version=1.0
973-_Name=Time & Date
974-_Comment=Change your clock and date settings
975-Icon=preferences-system-time
976-TryExec=gnome-control-center
977-Exec=gnome-control-center indicator-datetime
978-StartupNotify=true
979-Type=Application
980-Categories=GNOME;GTK;Utility;DesktopSettings;Settings;X-GNOME-SystemSettings;X-GNOME-Settings-Panel;
981-X-GNOME-Settings-Panel=indicator-datetime
982-OnlyShowIn=Unity;
983-X-Ubuntu-Gettext-Domain=indicator-datetime
984
985=== removed file 'data/unity-datetime-panel.desktop.in'
986--- data/unity-datetime-panel.desktop.in 2014-01-21 21:47:02 +0000
987+++ data/unity-datetime-panel.desktop.in 1970-01-01 00:00:00 +0000
988@@ -1,13 +0,0 @@
989-[Desktop Entry]
990-Version=1.0
991-_Name=Time & Date
992-_Comment=Change your clock and date settings
993-Icon=preferences-system-time
994-TryExec=unity-control-center
995-Exec=unity-control-center datetime
996-StartupNotify=true
997-Type=Application
998-Categories=GNOME;GTK;Utility;DesktopSettings;Settings;X-GNOME-SystemSettings;X-Unity-Settings-Panel;
999-X-Unity-Settings-Panel=datetime
1000-OnlyShowIn=Unity;
1001-X-Ubuntu-Gettext-Domain=indicator-datetime
1002
1003=== modified file 'debian/control'
1004--- debian/control 2014-01-29 03:38:57 +0000
1005+++ debian/control 2014-02-11 21:51:37 +0000
1006@@ -26,9 +26,6 @@
1007 libpolkit-gobject-1-dev,
1008 libedataserver1.2-dev (>= 3.5),
1009 libgconf2-dev (>= 2.31),
1010- libgnome-control-center-dev,
1011- libunity-control-center-dev,
1012- libtimezonemap1-dev,
1013 liburl-dispatcher1-dev,
1014 libproperties-cpp-dev,
1015 libdbustest1-dev,
1016@@ -50,34 +47,9 @@
1017 systemd-shim,
1018 Recommends: indicator-applet | indicator-renderer,
1019 evolution-data-server,
1020- unity-control-center-datetime | gnome-control-center-datetime | ubuntu-system-settings,
1021+ unity-control-center (>= 14.04.3) | ubuntu-system-settings,
1022 Suggests: click,
1023 Conflicts: indicator-datetime (<< 13.10.0)
1024 Replaces: indicator-datetime (<< 13.10.0)
1025 Description: Simple clock
1026 A simple clock appearing in the indicator bar
1027-
1028-Package: gnome-control-center-datetime
1029-Architecture: any
1030-Depends: ${shlibs:Depends},
1031- ${misc:Depends},
1032- indicator-datetime (=${binary:Version}),
1033- gnome-control-center,
1034-Conflicts: indicator-datetime (<< 13.10.0)
1035-Replaces: indicator-datetime (<< 13.10.0)
1036-Description: Clock settings in the GNOME Control Center
1037- A module to get date time and clock settings in the GNOME control
1038- center.
1039-
1040-Package: unity-control-center-datetime
1041-Architecture: any
1042-Depends: ${shlibs:Depends},
1043- ${misc:Depends},
1044- indicator-datetime (=${binary:Version}),
1045- unity-control-center,
1046-Conflicts: indicator-datetime (<< 13.10.0)
1047-Replaces: indicator-datetime (<< 13.10.0)
1048-Description: Clock settings in the Unity Control Center
1049- A module to get date time and clock settings in the Unity control
1050- center.
1051-
1052
1053=== removed file 'debian/gnome-control-center-datetime.install'
1054--- debian/gnome-control-center-datetime.install 2014-01-10 01:45:41 +0000
1055+++ debian/gnome-control-center-datetime.install 1970-01-01 00:00:00 +0000
1056@@ -1,3 +0,0 @@
1057-usr/lib/*/control-center-1/panels/*
1058-usr/share/indicator-datetime/gnome-control-center/*
1059-usr/share/applications/gnome-indicator-datetime-panel.desktop
1060
1061=== removed file 'debian/indicator-datetime.install'
1062--- debian/indicator-datetime.install 2013-10-31 18:40:41 +0000
1063+++ debian/indicator-datetime.install 1970-01-01 00:00:00 +0000
1064@@ -1,6 +0,0 @@
1065-usr/share/glib-2.0/schemas/*
1066-usr/share/upstart/sessions/*
1067-usr/share/unity/indicators/*
1068-usr/lib/*/indicator-datetime/indicator-datetime-service
1069-usr/share/locale/*
1070-etc/xdg/autostart/*
1071
1072=== removed file 'debian/unity-control-center-datetime.install'
1073--- debian/unity-control-center-datetime.install 2014-01-10 01:45:41 +0000
1074+++ debian/unity-control-center-datetime.install 1970-01-01 00:00:00 +0000
1075@@ -1,3 +0,0 @@
1076-usr/lib/*/unity-control-center-1/panels/*
1077-usr/share/indicator-datetime/unity-control-center/*
1078-usr/share/applications/unity-datetime-panel.desktop
1079
1080=== removed directory 'panel'
1081=== removed directory 'panel-gnome'
1082=== removed file 'panel-gnome/CMakeLists.txt'
1083--- panel-gnome/CMakeLists.txt 2014-01-28 22:26:45 +0000
1084+++ panel-gnome/CMakeLists.txt 1970-01-01 00:00:00 +0000
1085@@ -1,30 +0,0 @@
1086-set (PANEL_LIB "gnome-indicator-datetime")
1087-
1088-add_definitions (-DPKGDATADIR="${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/${CMAKE_PROJECT_NAME}")
1089-
1090-
1091-SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -g")
1092-SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -g ${CXX_WARNING_ARGS}")
1093-
1094-add_library (${PANEL_LIB} SHARED
1095- ${CMAKE_SOURCE_DIR}/panel/datetime-prefs.c
1096- ${CMAKE_SOURCE_DIR}/panel/datetime-prefs-locations.c
1097- ${CMAKE_SOURCE_DIR}/panel/datetime-prefs-locations.h
1098- ${CMAKE_SOURCE_DIR}/src/utils.c
1099- ${CMAKE_SOURCE_DIR}/include/datetime/utils.h
1100- ${CMAKE_SOURCE_DIR}/include/datetime/settings-shared.h)
1101-set_property (TARGET ${PANEL_LIB} PROPERTY OUTPUT_NAME indicator-datetime)
1102-
1103-include_directories (SYSTEM ${PANEL_DEPS_INCLUDE_DIRS})
1104-
1105-link_directories (${PANEL_DEPS_LIBRARY_DIRS})
1106-
1107-set_property (TARGET ${PANEL_LIB}
1108- APPEND_STRING PROPERTY COMPILE_FLAGS
1109- " -g ${CC_WARNING_ARGS} ${GCOV_FLAGS}")
1110-
1111-target_link_libraries (${PANEL_LIB} ${PANEL_DEPS_LIBRARIES} ${GCOV_LIBS})
1112-
1113-install (TARGETS ${PANEL_LIB}
1114- DESTINATION ${CMAKE_INSTALL_LIBDIR}/control-center-1/panels)
1115-
1116
1117=== removed directory 'panel-unity'
1118=== removed file 'panel-unity/CMakeLists.txt'
1119--- panel-unity/CMakeLists.txt 2014-01-28 22:26:45 +0000
1120+++ panel-unity/CMakeLists.txt 1970-01-01 00:00:00 +0000
1121@@ -1,29 +0,0 @@
1122-set (PANEL_LIB "unity-indicator-datetime")
1123-
1124-add_definitions (-DPKGDATADIR="${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/${CMAKE_PROJECT_NAME}")
1125-
1126-SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -g")
1127-SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -g ${CXX_WARNING_ARGS}")
1128-
1129-add_library (${PANEL_LIB} SHARED
1130- ${CMAKE_SOURCE_DIR}/panel/datetime-prefs.c
1131- ${CMAKE_SOURCE_DIR}/panel/datetime-prefs-locations.c
1132- ${CMAKE_SOURCE_DIR}/panel/datetime-prefs-locations.h
1133- ${CMAKE_SOURCE_DIR}/src/utils.c
1134- ${CMAKE_SOURCE_DIR}/include/datetime/utils.h
1135- ${CMAKE_SOURCE_DIR}/include/datetime/settings-shared.h)
1136-set_property (TARGET ${PANEL_LIB} PROPERTY OUTPUT_NAME indicator-datetime)
1137-
1138-include_directories (SYSTEM ${UNITY_PANEL_DEPS_INCLUDE_DIRS})
1139-
1140-link_directories (${UNITY_PANEL_DEPS_LIBRARY_DIRS})
1141-
1142-set_property (TARGET ${PANEL_LIB}
1143- APPEND_STRING PROPERTY COMPILE_FLAGS
1144- " -g ${CC_WARNING_ARGS} ${GCOV_FLAGS} -DUSE_UNITY")
1145-
1146-target_link_libraries (${PANEL_LIB} ${UNITY_PANEL_DEPS_LIBRARIES} ${GCOV_LIBS})
1147-
1148-install (TARGETS ${PANEL_LIB}
1149- DESTINATION ${CMAKE_INSTALL_LIBDIR}/unity-control-center-1/panels)
1150-
1151
1152=== removed file 'panel/datetime-prefs-locations.c'
1153--- panel/datetime-prefs-locations.c 2014-01-29 22:32:17 +0000
1154+++ panel/datetime-prefs-locations.c 1970-01-01 00:00:00 +0000
1155@@ -1,687 +0,0 @@
1156-/* -*- Mode: C; coding: utf-8; indent-tabs-mode: nil; tab-width: 2 -*-
1157-
1158-A dialog for setting time and date preferences.
1159-
1160-Copyright 2011 Canonical Ltd.
1161-
1162-Authors:
1163- Michael Terry <michael.terry@canonical.com>
1164-
1165-This program is free software: you can redistribute it and/or modify it
1166-under the terms of the GNU General Public License version 3, as published
1167-by the Free Software Foundation.
1168-
1169-This program is distributed in the hope that it will be useful, but
1170-WITHOUT ANY WARRANTY; without even the implied warranties of
1171-MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1172-PURPOSE. See the GNU General Public License for more details.
1173-
1174-You should have received a copy of the GNU General Public License along
1175-with this program. If not, see <http://www.gnu.org/licenses/>.
1176-*/
1177-
1178-#ifdef HAVE_CONFIG_H
1179-#include "config.h"
1180-#endif
1181-
1182-#include "datetime-prefs-locations.h"
1183-
1184-#include <datetime/settings-shared.h>
1185-#include <datetime/utils.h>
1186-
1187-#include <timezonemap/timezone-completion.h>
1188-
1189-#include <glib/gi18n-lib.h>
1190-#include <gtk/gtk.h>
1191-
1192-#include <stdlib.h>
1193-#include <time.h> /* time_t */
1194-
1195-#if USE_UNITY
1196- #define DATETIME_DIALOG_UI_FILE PKGDATADIR "/unity-control-center/datetime-dialog.ui"
1197-#else
1198- #define DATETIME_DIALOG_UI_FILE PKGDATADIR "/gnome-control-center/datetime-dialog.ui"
1199-#endif
1200-
1201-#define COL_NAME 0
1202-#define COL_TIME 1
1203-#define COL_ZONE 2
1204-#define COL_VISIBLE_NAME 3
1205-#define COL_ICON 4
1206-
1207-static gboolean update_times (GtkWidget * dlg);
1208-static void save_when_idle (GtkWidget * dlg);
1209-
1210-/***
1211-**** Sorting
1212-***/
1213-
1214-/**
1215- * A temporary struct used for sorting
1216- */
1217-struct TimeLocation
1218-{
1219- gchar * collated_name;
1220- gint pos;
1221- gint32 offset;
1222-};
1223-
1224-static struct TimeLocation*
1225-time_location_new (const char * zone, const char * name, int pos, time_t now)
1226-{
1227- struct TimeLocation * loc = g_new (struct TimeLocation, 1);
1228- GTimeZone * tz = g_time_zone_new (zone);
1229- const gint interval = g_time_zone_find_interval (tz, G_TIME_TYPE_UNIVERSAL, now);
1230- loc->offset = g_time_zone_get_offset (tz, interval);
1231- loc->collated_name = g_utf8_collate_key (name, -1);
1232- loc->pos = pos;
1233- g_time_zone_unref (tz);
1234- return loc;
1235-}
1236-
1237-static void
1238-time_location_free (struct TimeLocation * loc)
1239-{
1240- g_free (loc->collated_name);
1241- g_free (loc);
1242-}
1243-
1244-static GSList*
1245-time_location_array_new_from_model (GtkTreeModel * model)
1246-{
1247- int pos = 0;
1248- GtkTreeIter iter;
1249- GSList * list = NULL;
1250- const time_t now = time (NULL);
1251-
1252- if (gtk_tree_model_get_iter_first (model, &iter)) do
1253- {
1254- gchar * zone = NULL;
1255- gchar * name = NULL;
1256-
1257- gtk_tree_model_get (model, &iter,
1258- COL_ZONE, &zone,
1259- COL_VISIBLE_NAME, &name,
1260- -1);
1261-
1262- if (zone && name)
1263- list = g_slist_prepend (list, time_location_new (zone, name, pos++, now));
1264-
1265- g_free (name);
1266- g_free (zone);
1267- }
1268- while (gtk_tree_model_iter_next (model, &iter));
1269-
1270- return g_slist_reverse (list);
1271-}
1272-
1273-static void
1274-handle_sort(GtkWidget * button G_GNUC_UNUSED,
1275- GtkTreeView * tree_view,
1276- GCompareFunc compare)
1277-{
1278- GtkTreeModel * model = gtk_tree_view_get_model (tree_view);
1279- GSList * l;
1280- GSList * list = g_slist_sort (time_location_array_new_from_model(model), compare);
1281-
1282- gint i;
1283- gint * reorder = g_new (gint, g_slist_length(list));
1284- for (i=0, l=list; l!=NULL; l=l->next, i++)
1285- reorder[i] = ((struct TimeLocation*)l->data)->pos;
1286- gtk_list_store_reorder (GTK_LIST_STORE(model), reorder);
1287-
1288- g_free (reorder);
1289- g_slist_free_full (list, (GDestroyNotify)time_location_free);
1290-}
1291-
1292-static gint
1293-time_location_compare_by_name (gconstpointer ga, gconstpointer gb)
1294-{
1295- const struct TimeLocation * a = ga;
1296- const struct TimeLocation * b = gb;
1297- int ret = g_strcmp0 (a->collated_name, b->collated_name); /* primary key */
1298- if (!ret)
1299- ret = a->offset - b->offset; /* secondary key */
1300- return ret;
1301-}
1302-static void
1303-handle_sort_by_name (GtkWidget * button, GtkTreeView * tree_view)
1304-{
1305- handle_sort (button, tree_view, time_location_compare_by_name);
1306-}
1307-
1308-static gint
1309-time_location_compare_by_time (gconstpointer ga, gconstpointer gb)
1310-{
1311- const struct TimeLocation * a = ga;
1312- const struct TimeLocation * b = gb;
1313- int ret = a->offset - b->offset; /* primary key */
1314- if (!ret)
1315- ret = g_strcmp0 (a->collated_name, b->collated_name); /* secondary key */
1316- return ret;
1317-}
1318-static void
1319-handle_sort_by_time (GtkWidget * button, GtkTreeView * tree_view)
1320-{
1321- handle_sort (button, tree_view, time_location_compare_by_time);
1322-}
1323-
1324-static gboolean
1325-time_location_list_test_sorted (GSList * list, GCompareFunc compare)
1326-{
1327- GSList * l;
1328- for (l=list; l!=NULL && l->next!=NULL; l=l->next)
1329- if (compare(l->data, l->next->data) > 0)
1330- return FALSE;
1331- return TRUE;
1332-}
1333-static void
1334-location_model_test_sorted (GtkTreeModel * model, gboolean * is_sorted_by_name, gboolean * is_sorted_by_time)
1335-{
1336- GSList * list = time_location_array_new_from_model(model);
1337- *is_sorted_by_name = time_location_list_test_sorted (list, time_location_compare_by_name);
1338- *is_sorted_by_time = time_location_list_test_sorted (list, time_location_compare_by_time);
1339- g_slist_free_full (list, (GDestroyNotify)time_location_free);
1340-}
1341-
1342-/***
1343-****
1344-***/
1345-
1346-static void
1347-handle_add (GtkWidget * button G_GNUC_UNUSED, GtkTreeView * tree)
1348-{
1349- GtkListStore * store = GTK_LIST_STORE (gtk_tree_view_get_model (tree));
1350-
1351- GtkTreeIter iter;
1352- gtk_list_store_append (store, &iter);
1353-
1354- GtkTreePath * path = gtk_tree_model_get_path (GTK_TREE_MODEL (store), &iter);
1355- gtk_tree_view_set_cursor (tree, path, gtk_tree_view_get_column (tree, 0), TRUE);
1356- gtk_tree_path_free (path);
1357-}
1358-
1359-static void
1360-handle_remove (GtkWidget * button G_GNUC_UNUSED, GtkTreeView * tree)
1361-{
1362- GtkListStore * store = GTK_LIST_STORE (gtk_tree_view_get_model (tree));
1363- GtkTreeSelection * selection = gtk_tree_view_get_selection (tree);
1364-
1365- GList * paths = gtk_tree_selection_get_selected_rows (selection, NULL);
1366-
1367- /* Convert all paths to iters so we can safely delete multiple paths. For a
1368- GtkListStore, iters persist past model changes. */
1369- GList * tree_iters = NULL;
1370- GList * iter;
1371- for (iter = paths; iter; iter = iter->next) {
1372- GtkTreeIter * tree_iter = g_new(GtkTreeIter, 1);
1373- if (gtk_tree_model_get_iter (GTK_TREE_MODEL (store), tree_iter, (GtkTreePath *)iter->data)) {
1374- tree_iters = g_list_prepend (tree_iters, tree_iter);
1375- }
1376- gtk_tree_path_free (iter->data);
1377- }
1378- g_list_free (paths);
1379-
1380- // Find the next item to select
1381- GtkTreeIter *last_selected = g_list_nth_data(tree_iters, 0);
1382- GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL (store), last_selected);
1383- GtkTreeIter titer;
1384- if (!gtk_tree_model_get_iter(GTK_TREE_MODEL (store), &titer, path)) {
1385- g_debug("Failed to get last selected iter from path");
1386- last_selected = NULL;
1387- } else {
1388- if (!gtk_tree_model_iter_next(GTK_TREE_MODEL (store), &titer)) {
1389- if (gtk_tree_path_prev(path)) {
1390- if (!gtk_tree_model_get_iter(GTK_TREE_MODEL (store), &titer, path)) {
1391- g_debug("Failed to get iter from path");
1392- last_selected = NULL;
1393- } else {
1394- last_selected = &titer;
1395- }
1396- } else {
1397- g_debug("handle_remove: Failed to find another location to select (assume single selected)");
1398- last_selected = NULL;
1399- }
1400- } else {
1401- g_debug("Got next item in model");
1402- last_selected = &titer;
1403- }
1404- }
1405-
1406- if (last_selected) {
1407- gboolean clear = TRUE;
1408- path = gtk_tree_model_get_path(GTK_TREE_MODEL (store), last_selected);
1409-
1410- // Step over the path to find an item which isn't in the delete list
1411- if (g_list_length(tree_iters) > 1) {
1412- for (iter = tree_iters; iter; iter = iter->next) {
1413- GtkTreePath *ipath = gtk_tree_model_get_path(GTK_TREE_MODEL (store), (GtkTreeIter *)iter->data);
1414- if (gtk_tree_path_compare(path, ipath) == 0) {
1415- clear = FALSE;
1416- break;
1417- }
1418- }
1419- while (clear == FALSE) {
1420- if (gtk_tree_path_prev(path)) {
1421- clear = TRUE;
1422- for (iter = tree_iters; iter; iter = iter->next) {
1423- GtkTreePath *ipath = gtk_tree_model_get_path(GTK_TREE_MODEL (store), (GtkTreeIter *)iter->data);
1424- if (gtk_tree_path_compare(path, ipath) == 0) {
1425- clear = FALSE;
1426- break;
1427- }
1428- }
1429- if (clear) {
1430- if (!gtk_tree_model_get_iter(GTK_TREE_MODEL (store), &titer, path)) {
1431- g_debug("Failed to get iter from path");
1432- last_selected = NULL;
1433- } else {
1434- last_selected = &titer;
1435- }
1436- }
1437- } else {
1438- last_selected = NULL;
1439- break;
1440- }
1441- }
1442- }
1443- }
1444-
1445- /* Now delete each iterator */
1446- for (iter = tree_iters; iter; iter = iter->next) {
1447- gtk_list_store_remove (store, (GtkTreeIter *)iter->data);
1448- g_free (iter->data);
1449- }
1450- g_list_free (tree_iters);
1451-
1452- if (last_selected)
1453- gtk_tree_selection_select_iter(selection, last_selected);
1454-}
1455-
1456-static void
1457-handle_edit (GtkCellRendererText * renderer G_GNUC_UNUSED,
1458- gchar * path,
1459- gchar * new_text,
1460- GtkListStore * store)
1461-{
1462- GtkTreeIter iter;
1463-
1464- // Manual user edits are always wrong (unless they are undoing a previous
1465- // edit), so we set the error icon here if needed. Common way to get to
1466- // this code path is to lose entry focus.
1467- if (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (store), &iter, path)) {
1468- gchar * name;
1469- gtk_tree_model_get (GTK_TREE_MODEL (store), &iter, COL_NAME, &name, -1);
1470- gboolean correct = g_strcmp0 (name, new_text) == 0;
1471- g_free (name);
1472-
1473- gtk_list_store_set (store, &iter,
1474- COL_VISIBLE_NAME, new_text,
1475- COL_ICON, correct ? NULL : "dialog-error",
1476- -1);
1477- }
1478-}
1479-
1480-static gboolean
1481-timezone_selected (GtkEntryCompletion * widget, GtkTreeModel * model,
1482- GtkTreeIter * iter, GtkWidget * dlg)
1483-{
1484- gchar * zone = NULL;
1485- gchar * name = NULL;
1486-
1487- gtk_tree_model_get (model, iter,
1488- CC_TIMEZONE_COMPLETION_ZONE, &zone,
1489- CC_TIMEZONE_COMPLETION_NAME, &name,
1490- -1);
1491-
1492- /* if no explicit timezone, try to determine one from latlon */
1493- if (!zone || !*zone)
1494- {
1495- gchar * strlat = NULL;
1496- gchar * strlon = NULL;
1497- gdouble lat = 0;
1498- gdouble lon = 0;
1499-
1500- gtk_tree_model_get (model, iter,
1501- CC_TIMEZONE_COMPLETION_LATITUDE, &strlat,
1502- CC_TIMEZONE_COMPLETION_LONGITUDE, &strlon,
1503- -1);
1504-
1505- if (strlat && *strlat) lat = g_ascii_strtod(strlat, NULL);
1506- if (strlon && *strlon) lon = g_ascii_strtod(strlon, NULL);
1507-
1508- CcTimezoneMap * tzmap = CC_TIMEZONE_MAP (g_object_get_data (G_OBJECT (widget), "tzmap"));
1509- g_free (zone);
1510- zone = g_strdup (cc_timezone_map_get_timezone_at_coords (tzmap, lon, lat));
1511-
1512- g_free (strlat);
1513- g_free (strlon);
1514- }
1515-
1516- GtkListStore * store = GTK_LIST_STORE (g_object_get_data (G_OBJECT (widget), "store"));
1517- GtkTreeIter * store_iter = (GtkTreeIter *)g_object_get_data (G_OBJECT (widget), "store_iter");
1518- if (store != NULL && store_iter != NULL) {
1519- gtk_list_store_set (store, store_iter,
1520- COL_VISIBLE_NAME, name,
1521- COL_ICON, NULL,
1522- COL_NAME, name,
1523- COL_ZONE, zone, -1);
1524- }
1525-
1526- update_times (dlg);
1527-
1528- /* cleanup */
1529- g_free (name);
1530- g_free (zone);
1531-
1532- return FALSE; // Do normal action too
1533-}
1534-
1535-static gboolean
1536-query_tooltip (GtkTreeView * tree, gint x, gint y, gboolean keyboard_mode,
1537- GtkTooltip * tooltip, GtkCellRenderer * cell)
1538-{
1539- GtkTreeModel * model;
1540- GtkTreeIter iter;
1541- if (!gtk_tree_view_get_tooltip_context (tree, &x, &y, keyboard_mode,
1542- &model, NULL, &iter))
1543- return FALSE;
1544-
1545- const gchar * icon;
1546- gtk_tree_model_get (model, &iter, COL_ICON, &icon, -1);
1547- if (icon == NULL)
1548- return FALSE;
1549-
1550- GtkTreeViewColumn * col = gtk_tree_view_get_column (tree, 0);
1551- gtk_tree_view_set_tooltip_cell (tree, tooltip, NULL, col, cell);
1552- gtk_tooltip_set_text (tooltip, _("You need to complete this location for it to appear in the menu."));
1553- return TRUE;
1554-}
1555-
1556-static void
1557-handle_edit_started (GtkCellRendererText * renderer G_GNUC_UNUSED,
1558- GtkCellEditable * editable,
1559- gchar * path,
1560- CcTimezoneCompletion * completion)
1561-{
1562- if (GTK_IS_ENTRY (editable)) {
1563- GtkEntry *entry = GTK_ENTRY (editable);
1564- cc_timezone_completion_watch_entry (completion, entry);
1565-
1566- GtkListStore * store = GTK_LIST_STORE (g_object_get_data (G_OBJECT (completion), "store"));
1567- GtkTreeIter * store_iter = g_new(GtkTreeIter, 1);
1568- if (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (store), store_iter, path)) {
1569- g_object_set_data_full (G_OBJECT (completion), "store_iter", store_iter, g_free);
1570- }
1571- }
1572-}
1573-
1574-static gboolean
1575-update_times (GtkWidget * dlg)
1576-{
1577- /* For each entry, check zone in column 2 and set column 1 to it's time */
1578- CcTimezoneCompletion * completion = CC_TIMEZONE_COMPLETION (g_object_get_data (G_OBJECT (dlg), "completion"));
1579- GtkListStore * store = GTK_LIST_STORE (g_object_get_data (G_OBJECT (completion), "store"));
1580- GObject * cell = G_OBJECT (g_object_get_data (G_OBJECT (completion), "name-cell"));
1581-
1582- gboolean editing;
1583- g_object_get (cell, "editing", &editing, NULL);
1584- if (editing) { /* No updates while editing, it cancels the edit */
1585- return TRUE;
1586- }
1587-
1588- g_signal_handlers_block_by_func (store, save_when_idle, dlg);
1589-
1590- GtkTreeIter iter;
1591- if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter)) {
1592- GDateTime * now = g_date_time_new_now_local ();
1593- do {
1594- gchar * strzone;
1595-
1596- gtk_tree_model_get (GTK_TREE_MODEL (store), &iter, COL_ZONE, &strzone, -1);
1597-
1598- if (strzone && *strzone) {
1599- GTimeZone * tz = g_time_zone_new (strzone);
1600- GDateTime * now_tz = g_date_time_to_timezone (now, tz);
1601- gchar * format = generate_full_format_string_at_time (now, now_tz, NULL);
1602- gchar * time_str = g_date_time_format (now_tz, format);
1603- gchar * old_time_str;
1604-
1605- gtk_tree_model_get (GTK_TREE_MODEL (store), &iter, COL_TIME, &old_time_str, -1);
1606- if (g_strcmp0 (old_time_str, time_str))
1607- gtk_list_store_set (store, &iter, COL_TIME, time_str, -1);
1608-
1609- g_free (old_time_str);
1610- g_free (time_str);
1611- g_free (format);
1612- g_date_time_unref (now_tz);
1613- g_time_zone_unref (tz);
1614- }
1615- g_free (strzone);
1616- } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter));
1617- g_date_time_unref (now);
1618- }
1619-
1620- g_signal_handlers_unblock_by_func (store, save_when_idle, dlg);
1621-
1622- return TRUE;
1623-}
1624-
1625-static void
1626-fill_from_settings (GObject * store, GSettings * conf)
1627-{
1628- gchar ** locations = g_settings_get_strv (conf, SETTINGS_LOCATIONS_S);
1629-
1630- gtk_list_store_clear (GTK_LIST_STORE (store));
1631-
1632- gchar ** striter;
1633- GtkTreeIter iter;
1634- for (striter = locations; *striter; ++striter) {
1635- gchar * zone, * name;
1636- split_settings_location (*striter, &zone, &name);
1637-
1638- gtk_list_store_append (GTK_LIST_STORE (store), &iter);
1639- gtk_list_store_set (GTK_LIST_STORE (store), &iter,
1640- COL_VISIBLE_NAME, name,
1641- COL_ICON, NULL,
1642- COL_NAME, name,
1643- COL_ZONE, zone, -1);
1644-
1645- g_free (zone);
1646- g_free (name);
1647- }
1648-
1649- g_strfreev (locations);
1650-}
1651-
1652-static void
1653-save_to_settings (GObject * store, GSettings * conf)
1654-{
1655- gboolean empty = TRUE;
1656- GVariantBuilder builder;
1657- g_variant_builder_init (&builder, G_VARIANT_TYPE_STRING_ARRAY);
1658-
1659- GtkTreeIter iter;
1660- if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter)) {
1661- GString * gstr = g_string_new (NULL);
1662- do {
1663- gchar * strname;
1664- gchar * strzone;
1665- gtk_tree_model_get (GTK_TREE_MODEL (store), &iter,
1666- COL_NAME, &strname,
1667- COL_ZONE, &strzone,
1668- -1);
1669- if (strzone && *strzone && strname && *strname) {
1670- g_string_printf (gstr, "%s %s", strzone, strname);
1671- g_variant_builder_add (&builder, "s", gstr->str);
1672- empty = FALSE;
1673- }
1674- g_free (strname);
1675- g_free (strzone);
1676- } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter));
1677- g_string_free (gstr, TRUE);
1678- }
1679-
1680- if (empty) {
1681- /* Empty list */
1682- g_variant_builder_clear (&builder);
1683- g_settings_set_strv (conf, SETTINGS_LOCATIONS_S, NULL);
1684- }
1685- else {
1686- g_settings_set_value (conf, SETTINGS_LOCATIONS_S, g_variant_builder_end (&builder));
1687- }
1688-}
1689-
1690-static gboolean
1691-save_now (GtkWidget *dlg)
1692-{
1693- GSettings * conf = G_SETTINGS (g_object_get_data (G_OBJECT (dlg), "conf"));
1694- GObject * completion = G_OBJECT (g_object_get_data (G_OBJECT (dlg), "completion"));
1695- GObject * store = G_OBJECT (g_object_get_data (completion, "store"));
1696-
1697- save_to_settings (store, conf);
1698-
1699- g_object_set_data (G_OBJECT (dlg), "save-id", GINT_TO_POINTER(0));
1700-
1701- return FALSE;
1702-}
1703-
1704-static void
1705-save_when_idle (GtkWidget *dlg)
1706-{
1707- guint save_id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (dlg), "save-id"));
1708-
1709- if (save_id == 0) {
1710- save_id = g_idle_add ((GSourceFunc)save_now, dlg);
1711- g_object_set_data (G_OBJECT (dlg), "save-id", GINT_TO_POINTER(save_id));
1712- }
1713-}
1714-
1715-static void
1716-dialog_closed (GtkWidget * dlg, GObject * store G_GNUC_UNUSED)
1717-{
1718- /* Cleanup a tad */
1719- guint time_id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (dlg), "time-id"));
1720- g_source_remove (time_id);
1721-
1722- guint save_id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (dlg), "save-id"));
1723- if (save_id > 0)
1724- g_source_remove (save_id);
1725-}
1726-
1727-static void
1728-selection_changed (GtkTreeSelection * selection, GtkWidget * remove_button)
1729-{
1730- gint count = gtk_tree_selection_count_selected_rows (selection);
1731- gtk_widget_set_sensitive (remove_button, count > 0);
1732-}
1733-
1734-static void
1735-update_button_sensitivity (GtkWidget * dlg)
1736-{
1737- GObject * odlg = G_OBJECT(dlg);
1738- GObject * completion = g_object_get_data(odlg, "completion");
1739- GtkTreeModel * model = GTK_TREE_MODEL (g_object_get_data (completion, "store"));
1740- gboolean is_sorted_by_name;
1741- gboolean is_sorted_by_time;
1742- location_model_test_sorted (model, &is_sorted_by_name, &is_sorted_by_time);
1743- gtk_widget_set_sensitive (GTK_WIDGET(g_object_get_data(odlg, "sortByNameButton")), !is_sorted_by_name);
1744- gtk_widget_set_sensitive (GTK_WIDGET(g_object_get_data(odlg, "sortByTimeButton")), !is_sorted_by_time);
1745-}
1746-
1747-static void
1748-model_changed (GtkWidget * dlg)
1749-{
1750- update_button_sensitivity (dlg);
1751- save_when_idle (dlg);
1752-}
1753-
1754-GtkWidget *
1755-datetime_setup_locations_dialog (CcTimezoneMap * map)
1756-{
1757- GError * error = NULL;
1758- GtkBuilder * builder = gtk_builder_new ();
1759- gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE);
1760- gtk_builder_add_from_file (builder, DATETIME_DIALOG_UI_FILE, &error);
1761- if (error != NULL) {
1762- /* We have to abort, we can't continue without the ui file */
1763- g_error ("Could not load ui file %s: %s", DATETIME_DIALOG_UI_FILE, error->message);
1764- g_error_free (error);
1765- return NULL;
1766- }
1767-
1768- GSettings * conf = g_settings_new (SETTINGS_INTERFACE);
1769-
1770-#define WIG(name) GTK_WIDGET (gtk_builder_get_object (builder, name))
1771-
1772- GtkWidget * dlg = WIG ("locationsDialog");
1773- GtkWidget * tree = WIG ("locationsView");
1774- GObject * store = gtk_builder_get_object (builder, "locationsStore");
1775-
1776- /* Configure tree */
1777- CcTimezoneCompletion * completion = cc_timezone_completion_new ();
1778- g_object_set_data (G_OBJECT (completion), "tzmap", map);
1779- g_object_set_data (G_OBJECT (completion), "store", store);
1780- g_signal_connect (completion, "match-selected", G_CALLBACK (timezone_selected), dlg);
1781-
1782- GtkCellRenderer * cell = gtk_cell_renderer_text_new ();
1783- g_object_set (cell, "editable", TRUE, NULL);
1784- g_signal_connect (cell, "editing-started", G_CALLBACK (handle_edit_started), completion);
1785- g_signal_connect (cell, "edited", G_CALLBACK (handle_edit), store);
1786- gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tree), -1,
1787- _("Location"), cell,
1788- "text", COL_VISIBLE_NAME, NULL);
1789- GtkTreeViewColumn * loc_col = gtk_tree_view_get_column (GTK_TREE_VIEW (tree), 0);
1790- gtk_tree_view_column_set_expand (loc_col, TRUE);
1791- g_object_set_data (G_OBJECT (completion), "name-cell", cell);
1792-
1793- cell = gtk_cell_renderer_pixbuf_new ();
1794- gtk_tree_view_column_pack_start (loc_col, cell, FALSE);
1795- gtk_tree_view_column_add_attribute (loc_col, cell, "icon-name", COL_ICON);
1796-
1797- gtk_widget_set_has_tooltip (tree, TRUE);
1798- g_signal_connect (tree, "query-tooltip", G_CALLBACK (query_tooltip), cell);
1799-
1800- cell = gtk_cell_renderer_text_new ();
1801- gtk_cell_renderer_set_alignment (cell, 1.0f, 0.5f);
1802- gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tree), -1,
1803- _("Time"), cell,
1804- "text", COL_TIME, NULL);
1805-
1806- GtkTreeSelection * selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree));
1807- gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE);
1808- g_signal_connect (selection, "changed", G_CALLBACK (selection_changed), WIG ("removeButton"));
1809- selection_changed (selection, WIG ("removeButton"));
1810-
1811- g_signal_connect (WIG ("addButton"), "clicked", G_CALLBACK (handle_add), tree);
1812- g_signal_connect (WIG ("removeButton"), "clicked", G_CALLBACK (handle_remove), tree);
1813-
1814- GtkWidget * w = WIG ("sortByNameButton");
1815- g_signal_connect (w, "clicked", G_CALLBACK (handle_sort_by_name), tree);
1816- g_object_set_data (G_OBJECT(dlg), "sortByNameButton", w);
1817-
1818- w = WIG ("sortByTimeButton");
1819- g_signal_connect (w, "clicked", G_CALLBACK (handle_sort_by_time), tree);
1820- g_object_set_data (G_OBJECT(dlg), "sortByTimeButton", w);
1821-
1822- fill_from_settings (store, conf);
1823- g_signal_connect_swapped (store, "row-deleted", G_CALLBACK (model_changed), dlg);
1824- g_signal_connect_swapped (store, "row-inserted", G_CALLBACK (model_changed), dlg);
1825- g_signal_connect_swapped (store, "row-changed", G_CALLBACK (model_changed), dlg);
1826- g_signal_connect_swapped (store, "rows-reordered", G_CALLBACK (model_changed), dlg);
1827- g_object_set_data_full (G_OBJECT (dlg), "conf", g_object_ref (conf), g_object_unref);
1828- g_object_set_data_full (G_OBJECT (dlg), "completion", completion, g_object_unref);
1829- g_signal_connect (dlg, "destroy", G_CALLBACK (dialog_closed), store);
1830-
1831- guint time_id = g_timeout_add_seconds (2, (GSourceFunc)update_times, dlg);
1832- g_object_set_data (G_OBJECT (dlg), "time-id", GINT_TO_POINTER(time_id));
1833- update_times (dlg);
1834-
1835-#undef WIG
1836-
1837- g_object_unref (conf);
1838- g_object_unref (builder);
1839-
1840- return dlg;
1841-}
1842-
1843
1844=== removed file 'panel/datetime-prefs-locations.h'
1845--- panel/datetime-prefs-locations.h 2013-10-18 19:22:54 +0000
1846+++ panel/datetime-prefs-locations.h 1970-01-01 00:00:00 +0000
1847@@ -1,35 +0,0 @@
1848-/* -*- Mode: C; coding: utf-8; indent-tabs-mode: nil; tab-width: 2 -*-
1849-
1850-A dialog for setting time and date preferences.
1851-
1852-Copyright 2011 Canonical Ltd.
1853-
1854-Authors:
1855- Michael Terry <michael.terry@canonical.com>
1856-
1857-This program is free software: you can redistribute it and/or modify it
1858-under the terms of the GNU General Public License version 3, as published
1859-by the Free Software Foundation.
1860-
1861-This program is distributed in the hope that it will be useful, but
1862-WITHOUT ANY WARRANTY; without even the implied warranties of
1863-MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1864-PURPOSE. See the GNU General Public License for more details.
1865-
1866-You should have received a copy of the GNU General Public License along
1867-with this program. If not, see <http://www.gnu.org/licenses/>.
1868-*/
1869-
1870-#ifndef __DATETIME_PREFS_LOCATIONS_H__
1871-#define __DATETIME_PREFS_LOCATIONS_H__
1872-
1873-#include <gtk/gtk.h>
1874-#include <timezonemap/cc-timezone-map.h>
1875-
1876-G_BEGIN_DECLS
1877-
1878-GtkWidget * datetime_setup_locations_dialog (CcTimezoneMap * map);
1879-
1880-G_END_DECLS
1881-
1882-#endif
1883
1884=== removed file 'panel/datetime-prefs.c'
1885--- panel/datetime-prefs.c 2014-02-05 18:22:28 +0000
1886+++ panel/datetime-prefs.c 1970-01-01 00:00:00 +0000
1887@@ -1,879 +0,0 @@
1888-/* -*- Mode: C; coding: utf-8; indent-tabs-mode: nil; tab-width: 2 -*-
1889-
1890-A dialog for setting time and date preferences.
1891-
1892-Copyright 2011 Canonical Ltd.
1893-
1894-Authors:
1895- Ted Gould <ted@canonical.com>
1896- Michael Terry <michael.terry@canonical.com>
1897-
1898-This program is free software: you can redistribute it and/or modify it
1899-under the terms of the GNU General Public License version 3, as published
1900-by the Free Software Foundation.
1901-
1902-This program is distributed in the hope that it will be useful, but
1903-WITHOUT ANY WARRANTY; without even the implied warranties of
1904-MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1905-PURPOSE. See the GNU General Public License for more details.
1906-
1907-You should have received a copy of the GNU General Public License along
1908-with this program. If not, see <http://www.gnu.org/licenses/>.
1909-*/
1910-
1911-#ifdef HAVE_CONFIG_H
1912-#include "config.h"
1913-#endif
1914-
1915-#include "datetime-prefs-locations.h"
1916-
1917-#include <datetime/dbus-shared.h>
1918-#include <datetime/settings-shared.h>
1919-#include <datetime/utils.h>
1920-
1921-#include <polkit/polkit.h>
1922-#include <timezonemap/cc-timezone-map.h>
1923-#include <timezonemap/timezone-completion.h>
1924-
1925-#include <glib/gi18n-lib.h>
1926-#include <gdk/gdkkeysyms.h>
1927-#include <gtk/gtk.h>
1928-
1929-#ifdef USE_UNITY
1930- #include <libunity-control-center/cc-panel.h>
1931-#else
1932- #include <libgnome-control-center/cc-panel.h>
1933-#endif
1934-
1935-#include <stdlib.h>
1936-#include <libintl.h>
1937-#include <locale.h>
1938-#include <langinfo.h>
1939-
1940-#if USE_UNITY
1941-#define DATETIME_DIALOG_UI_FILE PKGDATADIR "/unity-control-center/datetime-dialog.ui"
1942-#else
1943-#define DATETIME_DIALOG_UI_FILE PKGDATADIR "/gnome-control-center/datetime-dialog.ui"
1944-#endif
1945-
1946-#define INDICATOR_DATETIME_TYPE_PANEL indicator_datetime_panel_get_type()
1947-
1948-typedef struct _IndicatorDatetimePanel IndicatorDatetimePanel;
1949-typedef struct _IndicatorDatetimePanelPrivate IndicatorDatetimePanelPrivate;
1950-typedef struct _IndicatorDatetimePanelClass IndicatorDatetimePanelClass;
1951-
1952-struct _IndicatorDatetimePanel
1953-{
1954- CcPanel parent;
1955- IndicatorDatetimePanelPrivate * priv;
1956-};
1957-
1958-struct _IndicatorDatetimePanelPrivate
1959-{
1960- guint name_watch_id;
1961- GtkBuilder * builder;
1962- GDBusProxy * proxy;
1963- GtkWidget * auto_radio;
1964- GtkWidget * tz_entry;
1965- CcTimezoneMap * tzmap;
1966- GtkWidget * time_spin;
1967- GtkWidget * date_spin;
1968- guint save_time_id;
1969- gboolean user_edited_time;
1970- gboolean changing_time;
1971- GtkWidget * loc_dlg;
1972- GSettings * settings;
1973- CcTimezoneCompletion * completion;
1974-};
1975-
1976-struct _IndicatorDatetimePanelClass
1977-{
1978- CcPanelClass parent_class;
1979-};
1980-
1981-G_DEFINE_DYNAMIC_TYPE (IndicatorDatetimePanel, indicator_datetime_panel, CC_TYPE_PANEL)
1982-
1983-/* Turns the boolean property into a string gsettings */
1984-static GVariant *
1985-bind_hours_set (const GValue * value,
1986- const GVariantType * type G_GNUC_UNUSED,
1987- gpointer user_data)
1988-{
1989- const gchar * output = NULL;
1990- gboolean is_12hour_button = (gboolean)GPOINTER_TO_INT(user_data);
1991-
1992- if (g_value_get_boolean(value)) {
1993- /* Only do anything if we're setting active = true */
1994- output = is_12hour_button ? "12-hour" : "24-hour";
1995- } else {
1996- return NULL;
1997- }
1998-
1999- return g_variant_new_string (output);
2000-}
2001-
2002-/* Turns a string gsettings into a boolean property */
2003-static gboolean
2004-bind_hours_get (GValue * value, GVariant * variant, gpointer user_data)
2005-{
2006- const gchar * str = g_variant_get_string(variant, NULL);
2007- gboolean output = FALSE;
2008- gboolean is_12hour_button = (gboolean)GPOINTER_TO_INT(user_data);
2009-
2010- if (g_strcmp0(str, "locale-default") == 0) {
2011- output = (is_12hour_button == is_locale_12h ());
2012- } else if (g_strcmp0(str, "12-hour") == 0) {
2013- output = is_12hour_button;
2014- } else if (g_strcmp0(str, "24-hour") == 0) {
2015- output = !is_12hour_button;
2016- } else {
2017- return FALSE;
2018- }
2019-
2020- g_value_set_boolean (value, output);
2021- return TRUE;
2022-}
2023-
2024-static void
2025-widget_dependency_cb (GtkWidget * parent, GParamSpec *pspec G_GNUC_UNUSED, GtkWidget * dependent)
2026-{
2027- gboolean active, sensitive;
2028- g_object_get (G_OBJECT (parent),
2029- "active", &active,
2030- "sensitive", &sensitive, NULL);
2031- gtk_widget_set_sensitive (dependent, active && sensitive);
2032-}
2033-
2034-static void
2035-add_widget_dependency (GtkWidget * parent, GtkWidget * dependent)
2036-{
2037- g_signal_connect (parent, "notify::active", G_CALLBACK(widget_dependency_cb),
2038- dependent);
2039- g_signal_connect (parent, "notify::sensitive", G_CALLBACK(widget_dependency_cb),
2040- dependent);
2041- widget_dependency_cb (parent, NULL, dependent);
2042-}
2043-
2044-static void
2045-polkit_dependency_cb (GPermission * permission, GParamSpec *pspec G_GNUC_UNUSED, GtkWidget * dependent)
2046-{
2047- gboolean allowed = FALSE;
2048-
2049- g_object_get (G_OBJECT (permission),
2050- "allowed", &allowed, NULL);
2051-
2052- gtk_widget_set_sensitive (dependent, allowed);
2053-}
2054-
2055-static void
2056-add_polkit_dependency_helper (GtkWidget * parent, GParamSpec *pspec G_GNUC_UNUSED, GtkWidget * dependent)
2057-{
2058- GtkLockButton * button = GTK_LOCK_BUTTON (parent);
2059- GPermission * permission = gtk_lock_button_get_permission (button);
2060- g_signal_connect (permission, "notify::allowed",
2061- G_CALLBACK(polkit_dependency_cb), dependent);
2062- polkit_dependency_cb (permission, NULL, dependent);
2063-}
2064-
2065-static void
2066-add_polkit_dependency (GtkWidget * parent, GtkWidget * dependent)
2067-{
2068- /* polkit async hasn't finished at this point, so wait for permission to come in */
2069- g_signal_connect (parent, "notify::permission", G_CALLBACK(add_polkit_dependency_helper),
2070- dependent);
2071- gtk_widget_set_sensitive (dependent, FALSE);
2072-}
2073-
2074-static void
2075-polkit_perm_ready (GObject *source_object G_GNUC_UNUSED, GAsyncResult *res, gpointer user_data)
2076-{
2077- GError * error = NULL;
2078- GPermission * permission = polkit_permission_new_finish (res, &error);
2079-
2080- if (error != NULL) {
2081- if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
2082- g_warning ("Could not get permission object: %s", error->message);
2083- g_error_free (error);
2084- return;
2085- }
2086-
2087- GtkLockButton * button = GTK_LOCK_BUTTON (user_data);
2088- gtk_lock_button_set_permission (button, permission);
2089-}
2090-
2091-static void
2092-dbus_set_answered (GObject *object, GAsyncResult *res, gpointer command)
2093-{
2094- GError * error = NULL;
2095- GVariant * answers = g_dbus_proxy_call_finish (G_DBUS_PROXY (object), res, &error);
2096-
2097- if (error != NULL) {
2098- if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
2099- g_warning("Could not set '%s' using timedated: %s", (gchar *)command, error->message);
2100- g_error_free(error);
2101- return;
2102- }
2103-
2104- g_variant_unref (answers);
2105-}
2106-
2107-static void
2108-toggle_ntp (GtkWidget * radio, GParamSpec * pspec G_GNUC_UNUSED, IndicatorDatetimePanel * self)
2109-{
2110- gboolean active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio));
2111-
2112- g_dbus_proxy_call (self->priv->proxy, "SetNTP", g_variant_new ("(bb)", active, TRUE),
2113- G_DBUS_CALL_FLAGS_NONE, -1, NULL, dbus_set_answered, "NTP");
2114-}
2115-
2116-static void
2117-sync_entry (IndicatorDatetimePanel * self, const gchar * location)
2118-{
2119- gchar * name = get_timezone_name (location, self->priv->settings);
2120- gtk_entry_set_text (GTK_ENTRY (self->priv->tz_entry), name);
2121- g_free (name);
2122-
2123- gtk_entry_set_icon_from_icon_name (GTK_ENTRY (self->priv->tz_entry),
2124- GTK_ENTRY_ICON_SECONDARY, NULL);
2125-}
2126-
2127-static void
2128-tz_changed (CcTimezoneMap * map G_GNUC_UNUSED,
2129- CcTimezoneLocation * location,
2130- IndicatorDatetimePanel * self)
2131-{
2132- if (location == NULL)
2133- return;
2134-
2135- gchar * zone;
2136- g_object_get (location, "zone", &zone, NULL);
2137-
2138- g_dbus_proxy_call (self->priv->proxy, "SetTimezone", g_variant_new ("(sb)", zone, TRUE),
2139- G_DBUS_CALL_FLAGS_NONE, -1, NULL, dbus_set_answered, "timezone");
2140-
2141- sync_entry (self, zone);
2142-
2143- g_free (zone);
2144-}
2145-
2146-static void
2147-proxy_ready (GObject *object G_GNUC_UNUSED,
2148- GAsyncResult *res,
2149- IndicatorDatetimePanel * self)
2150-{
2151- GError * error = NULL;
2152- IndicatorDatetimePanelPrivate * priv = self->priv;
2153- GVariant *value;
2154-
2155- self->priv->proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
2156-
2157- if (error != NULL) {
2158- if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
2159- g_critical("Could not grab DBus proxy for timedated: %s", error->message);
2160- g_error_free(error);
2161- return;
2162- }
2163-
2164- /* And now, do initial proxy configuration */
2165- value = g_dbus_proxy_get_cached_property (priv->proxy, "CanNTP");
2166- if (value != NULL)
2167- {
2168- if (g_variant_is_of_type (value, G_VARIANT_TYPE_BOOLEAN))
2169- gtk_widget_set_sensitive (priv->auto_radio, g_variant_get_boolean (value));
2170- g_variant_unref (value);
2171- }
2172-
2173- value = g_dbus_proxy_get_cached_property (priv->proxy, "NTP");
2174- if (value != NULL)
2175- {
2176- if (g_variant_is_of_type (value, G_VARIANT_TYPE_BOOLEAN))
2177- {
2178- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->auto_radio), g_variant_get_boolean (value));
2179- g_signal_connect (priv->auto_radio, "notify::active", G_CALLBACK (toggle_ntp), self);
2180- }
2181- g_variant_unref (value);
2182- }
2183-
2184- value = g_dbus_proxy_get_cached_property (priv->proxy, "Timezone");
2185- if (value != NULL)
2186- {
2187- if (g_variant_is_of_type (value, G_VARIANT_TYPE_STRING))
2188- {
2189- const gchar * str = g_variant_get_string (value, NULL);
2190-
2191- cc_timezone_map_set_timezone (priv->tzmap, str);
2192- sync_entry (self, str);
2193- g_signal_connect (priv->tzmap, "location-changed", G_CALLBACK (tz_changed), self);
2194- }
2195- g_variant_unref (value);
2196- }
2197-}
2198-
2199-#define WIG(name) GTK_WIDGET (gtk_builder_get_object(self->priv->builder, name))
2200-
2201-static void
2202-set_show_clock_check_sensitive (IndicatorDatetimePanel * self,
2203- gboolean sensitive)
2204-{
2205- gtk_widget_set_sensitive (WIG("showClockCheck"), sensitive);
2206-}
2207-
2208-static void
2209-on_bus_name_appeared (GDBusConnection * connection G_GNUC_UNUSED,
2210- const char * name G_GNUC_UNUSED,
2211- const char * name_owner,
2212- gpointer self)
2213-{
2214- set_show_clock_check_sensitive (self, name_owner && *name_owner);
2215-}
2216-
2217-static void
2218-on_bus_name_vanished (GDBusConnection * connection G_GNUC_UNUSED,
2219- const char * name G_GNUC_UNUSED,
2220- gpointer self)
2221-{
2222- set_show_clock_check_sensitive (self, FALSE);
2223-}
2224-
2225-static gboolean
2226-are_spinners_focused (IndicatorDatetimePanel * self)
2227-{
2228- // save_time_id means that we were in focus and haven't finished our save
2229- // yet, so act like we are still focused.
2230- return self->priv->save_time_id ||
2231- gtk_widget_has_focus (self->priv->time_spin) ||
2232- gtk_widget_has_focus (self->priv->date_spin);
2233-}
2234-
2235-static gboolean
2236-save_time (IndicatorDatetimePanel * self)
2237-{
2238- if (self->priv->user_edited_time) {
2239- gdouble current_value = gtk_spin_button_get_value (GTK_SPIN_BUTTON (self->priv->date_spin));
2240- g_dbus_proxy_call (self->priv->proxy, "SetTime",
2241- g_variant_new ("(xbb)", (gint64) (current_value * G_TIME_SPAN_SECOND), FALSE, TRUE),
2242- G_DBUS_CALL_FLAGS_NONE, -1, NULL, dbus_set_answered, "time");
2243- }
2244- self->priv->user_edited_time = FALSE;
2245- self->priv->save_time_id = 0;
2246- return FALSE;
2247-}
2248-
2249-static gboolean
2250-spin_focus_in (IndicatorDatetimePanel * self)
2251-{
2252- if (self->priv->save_time_id > 0) {
2253- g_source_remove (self->priv->save_time_id);
2254- self->priv->save_time_id = 0;
2255- }
2256- return FALSE;
2257-}
2258-
2259-static gboolean
2260-spin_focus_out (IndicatorDatetimePanel * self)
2261-{
2262- /* We want to only save when both spinners are unfocused. But it's difficult
2263- to tell who is about to get focus during a focus-out. So we set an idle
2264- callback to save the time if we don't focus in to another spinner by that
2265- time. */
2266- if (self->priv->save_time_id == 0) {
2267- self->priv->save_time_id = g_idle_add ((GSourceFunc)save_time, self);
2268- }
2269- return FALSE;
2270-}
2271-
2272-static int
2273-input_time_text (GtkWidget * spinner, gdouble * value, IndicatorDatetimePanel * self)
2274-{
2275- gboolean is_time = (gboolean)GPOINTER_TO_INT (g_object_get_data (G_OBJECT (spinner), "is-time"));
2276- const gchar * text = gtk_entry_get_text (GTK_ENTRY (spinner));
2277-
2278- gdouble current_value = gtk_spin_button_get_value (GTK_SPIN_BUTTON (spinner));
2279- *value = current_value;
2280-
2281- GDateTime * now = g_date_time_new_from_unix_local (current_value);
2282- gint year, month, day, hour, minute, second;
2283- year = g_date_time_get_year (now);
2284- month = g_date_time_get_month (now);
2285- day = g_date_time_get_day_of_month (now);
2286- hour = g_date_time_get_hour (now);
2287- minute = g_date_time_get_minute (now);
2288- second = g_date_time_get_second (now);
2289- g_date_time_unref (now);
2290-
2291- /* Parse this string as if it were in the output format */
2292- gint scanned = 0;
2293- gboolean passed = TRUE, skip = FALSE;
2294- if (is_time) {
2295- gint hour_in, minute_in, second_in;
2296-
2297- if (is_locale_12h ()) { // TODO: make this look-at/watch gsettings?
2298- char ampm[51];
2299-
2300- /* coverity[secure_coding] */
2301- scanned = sscanf (text, "%u:%u:%u %50s", &hour_in, &minute_in, &second_in, ampm);
2302- passed = (scanned == 4);
2303-
2304- if (passed) {
2305- const char *pm_str = nl_langinfo (PM_STR);
2306- if (g_ascii_strcasecmp (pm_str, ampm) == 0) {
2307- hour_in += 12;
2308- }
2309- }
2310- } else {
2311- /* coverity[secure_coding] */
2312- scanned = sscanf (text, "%u:%u:%u", &hour_in, &minute_in, &second_in);
2313- passed = (scanned == 3);
2314- }
2315-
2316- if (passed && (hour_in > 23 || minute_in > 59 || second_in > 59)) {
2317- passed = FALSE;
2318- }
2319- if (passed && hour == hour_in && minute == minute_in && second == second_in) {
2320- skip = TRUE; // no change
2321- } else {
2322- hour = hour_in;
2323- minute = minute_in;
2324- second = second_in;
2325- }
2326- }
2327- else {
2328- gint year_in, month_in, day_in;
2329-
2330- /* coverity[secure_coding] */
2331- scanned = sscanf (text, "%u-%u-%u", &year_in, &month_in, &day_in);
2332-
2333- if (scanned != 3 || year_in < 1 || year_in > 9999 ||
2334- month_in < 1 || month_in > 12 || day_in < 1 || day_in > 31) {
2335- passed = FALSE;
2336- }
2337- if (passed && year == year_in && month == month_in && day == day_in) {
2338- skip = TRUE; // no change
2339- } else {
2340- year = year_in;
2341- month = month_in;
2342- day = day_in;
2343- }
2344- }
2345-
2346- if (!passed) {
2347- g_warning ("Could not understand %s", text);
2348- return TRUE;
2349- }
2350-
2351- if (skip) {
2352- return TRUE;
2353- }
2354-
2355- gboolean prev_changing = self->priv->changing_time;
2356- self->priv->changing_time = TRUE;
2357- GDateTime * new_time = g_date_time_new_local (year, month, day, hour, minute, second);
2358- *value = g_date_time_to_unix (new_time);
2359- self->priv->user_edited_time = TRUE;
2360- g_date_time_unref (new_time);
2361- self->priv->changing_time = prev_changing;
2362-
2363- return TRUE;
2364-}
2365-
2366-static gboolean
2367-format_time_text (GtkWidget * spinner, gpointer user_data G_GNUC_UNUSED)
2368-{
2369- gboolean is_time = (gboolean)GPOINTER_TO_INT (g_object_get_data (G_OBJECT (spinner), "is-time"));
2370-
2371- const gchar * format;
2372- if (is_time) {
2373- if (is_locale_12h ()) { // TODO: make this look-at/watch gsettings?
2374- format = "%I:%M:%S %p";
2375- } else {
2376- format = "%H:%M:%S";
2377- }
2378- }
2379- else {
2380- // This is intentionally not "%x". See https://launchpad.net/bugs/1149696
2381- // If you are willing to do the hard work of writing a locale-sensitive
2382- // date parser, there is an open bug: https://launchpad.net/bugs/729056
2383- format = "%Y-%m-%d";
2384- }
2385-
2386- GDateTime * datetime = g_date_time_new_from_unix_local (gtk_spin_button_get_value (GTK_SPIN_BUTTON (spinner)));
2387- gchar * formatted = g_date_time_format (datetime, format);
2388- gtk_entry_set_text (GTK_ENTRY (spinner), formatted);
2389- g_date_time_unref (datetime);
2390-
2391- return TRUE;
2392-}
2393-
2394-static void
2395-spin_copy_value (GtkSpinButton * spinner, IndicatorDatetimePanel * self)
2396-{
2397- GtkSpinButton * other = NULL;
2398- if (GTK_WIDGET (spinner) == self->priv->date_spin)
2399- other = GTK_SPIN_BUTTON (self->priv->time_spin);
2400- else
2401- other = GTK_SPIN_BUTTON (self->priv->date_spin);
2402-
2403- if (gtk_spin_button_get_value (spinner) != gtk_spin_button_get_value (other)) {
2404- gtk_spin_button_set_value (other, gtk_spin_button_get_value (spinner));
2405- }
2406- if (!self->priv->changing_time) { /* Means user pressed spin buttons */
2407- self->priv->user_edited_time = TRUE;
2408- }
2409-}
2410-
2411-static gboolean
2412-update_spinners (IndicatorDatetimePanel * self)
2413-{
2414- /* Add datetime object to spinner, which will hold the real time value, rather
2415- then using the value of the spinner itself. And don't update while user is
2416- editing. */
2417- if (!are_spinners_focused (self)) {
2418- gboolean prev_changing = self->priv->changing_time;
2419- self->priv->changing_time = TRUE;
2420- GDateTime * now = g_date_time_new_now_local ();
2421- gtk_spin_button_set_value (GTK_SPIN_BUTTON (self->priv->time_spin),
2422- (gdouble)g_date_time_to_unix (now));
2423- /* will be copied to other spin button */
2424- g_date_time_unref (now);
2425- self->priv->changing_time = prev_changing;
2426- }
2427- return TRUE;
2428-}
2429-
2430-static void
2431-setup_time_spinners (IndicatorDatetimePanel * self, GtkWidget * time, GtkWidget * date)
2432-{
2433- g_signal_connect (time, "input", G_CALLBACK (input_time_text), self);
2434- g_signal_connect (date, "input", G_CALLBACK (input_time_text), self);
2435-
2436- g_signal_connect (time, "output", G_CALLBACK (format_time_text), date);
2437- g_signal_connect (date, "output", G_CALLBACK (format_time_text), time);
2438-
2439- g_signal_connect_swapped (time, "focus-in-event", G_CALLBACK (spin_focus_in), self);
2440- g_signal_connect_swapped (date, "focus-in-event", G_CALLBACK (spin_focus_in), self);
2441-
2442- g_signal_connect_swapped (time, "focus-out-event", G_CALLBACK (spin_focus_out), self);
2443- g_signal_connect_swapped (date, "focus-out-event", G_CALLBACK (spin_focus_out), self);
2444-
2445- g_signal_connect (time, "value-changed", G_CALLBACK (spin_copy_value), self);
2446- g_signal_connect (date, "value-changed", G_CALLBACK (spin_copy_value), self);
2447-
2448- g_object_set_data (G_OBJECT (time), "is-time", GINT_TO_POINTER (TRUE));
2449- g_object_set_data (G_OBJECT (date), "is-time", GINT_TO_POINTER (FALSE));
2450-
2451- self->priv->time_spin = time;
2452- self->priv->date_spin = date;
2453-
2454- /* 2 seconds is what the indicator itself uses */
2455- guint time_id = g_timeout_add_seconds (2, (GSourceFunc)update_spinners, self);
2456- g_signal_connect_swapped (self->priv->time_spin, "destroy",
2457- G_CALLBACK (g_source_remove), GINT_TO_POINTER (time_id));
2458- update_spinners (self);
2459-}
2460-
2461-static void
2462-show_locations (IndicatorDatetimePanel * self)
2463-{
2464- if (self->priv->loc_dlg == NULL) {
2465- self->priv->loc_dlg = datetime_setup_locations_dialog (self->priv->tzmap);
2466- GtkWidget * dlg = gtk_widget_get_toplevel (GTK_WIDGET (self));
2467- gtk_window_set_type_hint (GTK_WINDOW(self->priv->loc_dlg), GDK_WINDOW_TYPE_HINT_DIALOG);
2468- gtk_window_set_transient_for (GTK_WINDOW (self->priv->loc_dlg), GTK_WINDOW (dlg));
2469- g_signal_connect (self->priv->loc_dlg, "destroy", G_CALLBACK (gtk_widget_destroyed), &self->priv->loc_dlg);
2470- gtk_widget_show_all (self->priv->loc_dlg);
2471- }
2472- else {
2473- gtk_window_present_with_time (GTK_WINDOW (self->priv->loc_dlg), gtk_get_current_event_time ());
2474- }
2475-}
2476-
2477-static gboolean
2478-timezone_selected (GtkEntryCompletion * widget G_GNUC_UNUSED,
2479- GtkTreeModel * model,
2480- GtkTreeIter * iter,
2481- IndicatorDatetimePanel * self)
2482-{
2483- const gchar * name, * zone;
2484-
2485- gtk_tree_model_get (model, iter,
2486- CC_TIMEZONE_COMPLETION_NAME, &name,
2487- CC_TIMEZONE_COMPLETION_ZONE, &zone,
2488- -1);
2489-
2490- if (zone == NULL || zone[0] == 0) {
2491- const gchar * strlon, * strlat;
2492- gdouble lon = 0.0, lat = 0.0;
2493-
2494- gtk_tree_model_get (model, iter,
2495- CC_TIMEZONE_COMPLETION_LONGITUDE, &strlon,
2496- CC_TIMEZONE_COMPLETION_LATITUDE, &strlat,
2497- -1);
2498-
2499- if (strlon != NULL && strlon[0] != 0) {
2500- lon = g_ascii_strtod(strlon, NULL);
2501- }
2502-
2503- if (strlat != NULL && strlat[0] != 0) {
2504- lat = g_ascii_strtod(strlat, NULL);
2505- }
2506-
2507- zone = cc_timezone_map_get_timezone_at_coords (self->priv->tzmap, lon, lat);
2508- }
2509-
2510- gchar * tz_name = g_strdup_printf ("%s %s", zone, name);
2511- g_settings_set_string (self->priv->settings, SETTINGS_TIMEZONE_NAME_S, tz_name);
2512- g_free (tz_name);
2513-
2514- cc_timezone_map_set_timezone (self->priv->tzmap, zone);
2515-
2516- return FALSE; // Do normal action too
2517-}
2518-
2519-static gboolean
2520-entry_focus_out (GtkEntry * entry,
2521- GdkEventFocus * event G_GNUC_UNUSED,
2522- IndicatorDatetimePanel * self)
2523-{
2524- // If the name left in the entry doesn't match the current timezone name,
2525- // show an error icon. It's always an error for the user to manually type in
2526- // a timezone.
2527- CcTimezoneLocation * location = cc_timezone_map_get_location (self->priv->tzmap);
2528- if (location == NULL)
2529- return FALSE;
2530-
2531- gchar * zone;
2532- g_object_get (location, "zone", &zone, NULL);
2533-
2534- gchar * name = get_timezone_name (zone, self->priv->settings);
2535- gboolean correct = (g_strcmp0 (gtk_entry_get_text (entry), name) == 0);
2536- g_free (name);
2537- g_free (zone);
2538-
2539- gtk_entry_set_icon_from_icon_name (entry, GTK_ENTRY_ICON_SECONDARY,
2540- correct ? NULL : "dialog-error");
2541- gtk_entry_set_icon_tooltip_text (entry, GTK_ENTRY_ICON_SECONDARY,
2542- _("You need to choose a location to change the time zone."));
2543- gtk_entry_set_icon_activatable (entry, GTK_ENTRY_ICON_SECONDARY, FALSE);
2544- return FALSE;
2545-}
2546-
2547-static void
2548-indicator_datetime_panel_init (IndicatorDatetimePanel * self)
2549-{
2550- GError * error;
2551- GSettings * conf;
2552-
2553- self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
2554- INDICATOR_DATETIME_TYPE_PANEL,
2555- IndicatorDatetimePanelPrivate);
2556-
2557- self->priv->settings = conf = g_settings_new (SETTINGS_INTERFACE);
2558-
2559- self->priv->builder = gtk_builder_new ();
2560- gtk_builder_set_translation_domain (self->priv->builder, GETTEXT_PACKAGE);
2561- error = NULL;
2562- gtk_builder_add_from_file (self->priv->builder, DATETIME_DIALOG_UI_FILE, &error);
2563- if (error != NULL) {
2564- /* We have to abort, we can't continue without the ui file */
2565- g_error ("Could not load ui file %s: %s", DATETIME_DIALOG_UI_FILE, error->message);
2566- g_error_free (error);
2567- return;
2568- }
2569-
2570-
2571- /* Add policykit button */
2572- GtkWidget * polkit_button = gtk_lock_button_new (NULL);
2573- g_object_set (G_OBJECT (polkit_button),
2574- "text-unlock", _("Unlock to change these settings"),
2575- "text-lock", _("Lock to prevent further changes"),
2576- NULL);
2577- GtkWidget * alignment = gtk_alignment_new (0.0, 0.5, 0.0, 0.0);
2578- gtk_container_add (GTK_CONTAINER (alignment), polkit_button);
2579- gtk_box_pack_start (GTK_BOX (WIG ("timeDateBox")), alignment, FALSE, TRUE, 0);
2580-
2581- const gchar * polkit_name = "org.gnome.controlcenter.datetime.configure";
2582- polkit_permission_new (polkit_name, NULL, NULL, polkit_perm_ready, polkit_button);
2583-
2584- /* Add map */
2585- self->priv->tzmap = cc_timezone_map_new ();
2586- gtk_container_add (GTK_CONTAINER (WIG ("mapBox")), GTK_WIDGET (self->priv->tzmap));
2587- /* Fufill the CC by Attribution license requirements for the Geonames lookup */
2588- cc_timezone_map_set_watermark (self->priv->tzmap, "Geonames.org");
2589-
2590- /* And completion entry */
2591- self->priv->completion = cc_timezone_completion_new ();
2592- cc_timezone_completion_watch_entry (self->priv->completion, GTK_ENTRY (WIG ("timezoneEntry")));
2593- g_signal_connect (self->priv->completion, "match-selected", G_CALLBACK (timezone_selected), self);
2594- g_signal_connect (WIG ("timezoneEntry"), "focus-out-event", G_CALLBACK (entry_focus_out), self);
2595-
2596- /* Set up settings bindings */
2597- g_settings_bind (conf, SETTINGS_SHOW_CLOCK_S, WIG ("showClockCheck"),
2598- "active", G_SETTINGS_BIND_DEFAULT);
2599- g_settings_bind (conf, SETTINGS_SHOW_DAY_S, WIG ("showWeekdayCheck"),
2600- "active", G_SETTINGS_BIND_DEFAULT);
2601- g_settings_bind (conf, SETTINGS_SHOW_DATE_S, WIG ("showDateAndMonthCheck"),
2602- "active", G_SETTINGS_BIND_DEFAULT);
2603- g_settings_bind (conf, SETTINGS_SHOW_YEAR_S, WIG ("showYearCheck"),
2604- "active", G_SETTINGS_BIND_DEFAULT);
2605- g_settings_bind (conf, SETTINGS_SHOW_SECONDS_S, WIG ("showSecondsCheck"),
2606- "active", G_SETTINGS_BIND_DEFAULT);
2607- g_settings_bind_with_mapping (conf, SETTINGS_TIME_FORMAT_S,
2608- WIG ("show12HourRadio"), "active",
2609- G_SETTINGS_BIND_DEFAULT,
2610- bind_hours_get, bind_hours_set,
2611- GINT_TO_POINTER(TRUE), NULL);
2612- g_settings_bind_with_mapping (conf, SETTINGS_TIME_FORMAT_S,
2613- WIG ("show24HourRadio"), "active",
2614- G_SETTINGS_BIND_DEFAULT,
2615- bind_hours_get, bind_hours_set,
2616- GINT_TO_POINTER(FALSE), NULL);
2617- g_settings_bind (conf, SETTINGS_SHOW_CALENDAR_S, WIG ("showCalendarCheck"),
2618- "active", G_SETTINGS_BIND_DEFAULT);
2619- g_settings_bind (conf, SETTINGS_SHOW_WEEK_NUMBERS_S, WIG ("includeWeekNumbersCheck"),
2620- "active", G_SETTINGS_BIND_DEFAULT);
2621- g_settings_bind (conf, SETTINGS_SHOW_EVENTS_S, WIG ("showEventsCheck"),
2622- "active", G_SETTINGS_BIND_DEFAULT);
2623- g_settings_bind (conf, SETTINGS_SHOW_DETECTED_S, WIG ("showDetectedCheck"),
2624- "active", G_SETTINGS_BIND_DEFAULT);
2625- g_settings_bind (conf, SETTINGS_SHOW_LOCATIONS_S, WIG ("showLocationsCheck"),
2626- "active", G_SETTINGS_BIND_DEFAULT);
2627-
2628- /* Set up sensitivities */
2629- add_widget_dependency (WIG ("showDateAndMonthCheck"), WIG ("showYearCheck"));
2630- add_widget_dependency (WIG ("showCalendarCheck"), WIG ("calendarOptions"));
2631- add_widget_dependency (WIG ("showClockCheck"), WIG ("clockOptions"));
2632- add_widget_dependency (WIG ("showLocationsCheck"), WIG ("locationsButton"));
2633- add_widget_dependency (WIG ("manualTimeRadio"), WIG ("manualOptions"));
2634- add_polkit_dependency (polkit_button, WIG ("timeDateOptions"));
2635-
2636- /* Hacky proxy test for whether evolution-data-server is installed */
2637- gchar * evo_path = g_find_program_in_path ("evolution");
2638- gtk_widget_set_sensitive (WIG ("showEventsCheck"), (evo_path != NULL));
2639- g_free (evo_path);
2640-
2641- setup_time_spinners (self, WIG ("timeSpinner"), WIG ("dateSpinner"));
2642-
2643- GtkWidget * panel = WIG ("timeDatePanel");
2644- self->priv->auto_radio = WIG ("automaticTimeRadio");
2645- self->priv->tz_entry = WIG ("timezoneEntry");
2646-
2647- g_signal_connect_swapped (WIG ("locationsButton"), "clicked", G_CALLBACK (show_locations), self);
2648-
2649- /* Grab proxy for settings daemon */
2650- g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, NULL,
2651- "org.freedesktop.timedate1",
2652- "/org/freedesktop/timedate1",
2653- "org.freedesktop.timedate1",
2654- NULL, (GAsyncReadyCallback)proxy_ready, self);
2655-
2656- /* Grab proxy for datetime service, to see if it's running. It would
2657- actually be more ideal to see if the indicator module itself is running,
2658- but that doesn't yet claim a name on the bus. Presumably the service
2659- would have been started by any such indicator, so this will at least tell
2660- us if there *was* a datetime module run this session. */
2661- self->priv->name_watch_id = g_bus_watch_name (G_BUS_TYPE_SESSION,
2662- BUS_NAME,
2663- G_BUS_NAME_WATCHER_FLAGS_NONE,
2664- on_bus_name_appeared,
2665- on_bus_name_vanished,
2666- self,
2667- NULL);
2668-
2669-#undef WIG
2670-
2671- gtk_widget_show_all (panel);
2672- gtk_container_add (GTK_CONTAINER (self), panel);
2673-}
2674-
2675-static void
2676-indicator_datetime_panel_dispose (GObject * object)
2677-{
2678- IndicatorDatetimePanel * self = (IndicatorDatetimePanel *) object;
2679- IndicatorDatetimePanelPrivate * priv = self->priv;
2680-
2681- g_clear_object (&priv->builder);
2682- g_clear_object (&priv->proxy);
2683- g_clear_object (&priv->settings);
2684-
2685- if (priv->loc_dlg) {
2686- gtk_widget_destroy (priv->loc_dlg);
2687- priv->loc_dlg = NULL;
2688- }
2689-
2690- if (priv->name_watch_id != 0) {
2691- g_bus_unwatch_name (priv->name_watch_id);
2692- priv->name_watch_id = 0;
2693- }
2694-
2695- if (priv->save_time_id) {
2696- g_source_remove (priv->save_time_id);
2697- priv->save_time_id = 0;
2698- }
2699-
2700- if (priv->completion) {
2701- cc_timezone_completion_watch_entry (priv->completion, NULL);
2702- g_clear_object (&priv->completion);
2703- }
2704-
2705- if (priv->tz_entry) {
2706- gtk_widget_destroy (priv->tz_entry);
2707- priv->tz_entry = NULL;
2708- }
2709-
2710- if (priv->time_spin) {
2711- gtk_widget_destroy (priv->time_spin);
2712- priv->time_spin = NULL;
2713- }
2714-
2715- if (priv->date_spin) {
2716- gtk_widget_destroy (priv->date_spin);
2717- priv->date_spin = NULL;
2718- }
2719-
2720- G_OBJECT_CLASS (indicator_datetime_panel_parent_class)->dispose (object);
2721-}
2722-
2723-static void
2724-indicator_datetime_panel_class_finalize (IndicatorDatetimePanelClass *klass G_GNUC_UNUSED)
2725-{
2726-}
2727-
2728-static const char *
2729-indicator_datetime_panel_get_help_uri (CcPanel *panel G_GNUC_UNUSED)
2730-{
2731- return "help:ubuntu-help/clock";
2732-}
2733-
2734-static void
2735-indicator_datetime_panel_class_init (IndicatorDatetimePanelClass *klass)
2736-{
2737- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
2738- CcPanelClass *panel_class = CC_PANEL_CLASS (klass);
2739-
2740- g_type_class_add_private (klass, sizeof (IndicatorDatetimePanelPrivate));
2741-
2742- panel_class->get_help_uri = indicator_datetime_panel_get_help_uri;
2743-
2744- gobject_class->dispose = indicator_datetime_panel_dispose;
2745-}
2746-
2747-void
2748-g_io_module_load (GIOModule *module)
2749-{
2750- bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
2751- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
2752-
2753- indicator_datetime_panel_register_type (G_TYPE_MODULE (module));
2754- g_io_extension_point_implement (CC_SHELL_PANEL_EXTENSION_POINT,
2755- INDICATOR_DATETIME_TYPE_PANEL,
2756-#if USE_UNITY
2757- "datetime", 0);
2758-#else
2759- "indicator-datetime", 0);
2760-#endif
2761-}
2762-
2763-void
2764-g_io_module_unload (GIOModule *module G_GNUC_UNUSED)
2765-{
2766-}
2767
2768=== modified file 'po/CMakeLists.txt'
2769--- po/CMakeLists.txt 2013-10-18 19:22:54 +0000
2770+++ po/CMakeLists.txt 2014-02-11 21:51:37 +0000
2771@@ -1,3 +1,3 @@
2772 include (Translations)
2773 add_translations_directory ("${GETTEXT_PACKAGE}")
2774-add_translations_catalog ("${GETTEXT_PACKAGE}" ../src/ ../panel)
2775+add_translations_catalog ("${GETTEXT_PACKAGE}" ../src/)
2776
2777=== modified file 'po/POTFILES.in'
2778--- po/POTFILES.in 2014-01-28 17:41:01 +0000
2779+++ po/POTFILES.in 2014-02-11 21:51:37 +0000
2780@@ -1,8 +1,3 @@
2781 src/formatter.cpp
2782 src/formatter-desktop.cpp
2783 src/menu.cpp
2784-panel/datetime-prefs.c
2785-panel/datetime-prefs-locations.c
2786-[type: gettext/glade]data/datetime-dialog.ui
2787-data/gnome-indicator-datetime-panel.desktop.in
2788-data/unity-datetime-panel.desktop.in
2789
2790=== modified file 'src/CMakeLists.txt'
2791--- src/CMakeLists.txt 2014-01-30 19:06:33 +0000
2792+++ src/CMakeLists.txt 2014-02-11 21:51:37 +0000
2793@@ -7,11 +7,6 @@
2794 add_definitions (-DTIMEZONE_FILE="/etc/timezone"
2795 -DG_LOG_DOMAIN="Indicator-Datetime")
2796
2797-# let service know how to launch gnome-control-center on the desktop
2798-if (BUILD_PANEL)
2799- add_definitions (-DHAVE_CCPANEL)
2800-endif ()
2801-
2802 add_library (${SERVICE_LIB} STATIC
2803 actions.cpp
2804 actions-live.cpp
2805
2806=== modified file 'src/actions-live.cpp'
2807--- src/actions-live.cpp 2014-01-30 19:00:22 +0000
2808+++ src/actions-live.cpp 2014-02-11 21:51:37 +0000
2809@@ -68,11 +68,7 @@
2810 }
2811 else
2812 {
2813-#ifdef HAVE_CCPANEL
2814- execute_command("gnome-control-center indicator-datetime");
2815-#else
2816 execute_command("gnome-control-center datetime");
2817-#endif
2818 }
2819
2820 g_free (path);

Subscribers

People subscribed via source and target branches