diff options
-rw-r--r-- | Makefile.am | 5 | ||||
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | data/Makefile.am | 16 | ||||
-rw-r--r-- | data/com.canonical.indicator.datetime.gschema.xml | 111 | ||||
-rw-r--r-- | data/datetime-dialog.ui | 774 | ||||
-rw-r--r-- | data/indicator-datetime-preferences.desktop.in | 14 | ||||
-rw-r--r-- | libmap/Makefile.am | 77 | ||||
-rw-r--r-- | libmap/README | 5 | ||||
-rw-r--r-- | libmap/backward | 118 | ||||
-rw-r--r-- | libmap/cc-timezone-map.c | 1195 | ||||
-rw-r--r-- | libmap/cc-timezone-map.h | 85 | ||||
-rw-r--r-- | libmap/data/bg.png | bin | 213448 -> 0 bytes | |||
-rw-r--r-- | libmap/data/cc.png | bin | 53948 -> 0 bytes | |||
-rw-r--r-- | libmap/data/olsen_map.png | bin | 54969 -> 0 bytes | |||
-rw-r--r-- | libmap/data/pin.png | bin | 561 -> 0 bytes | |||
-rw-r--r-- | libmap/data/timezone_-1.png | bin | 8012 -> 0 bytes | |||
-rw-r--r-- | libmap/data/timezone_-10.png | bin | 7783 -> 0 bytes | |||
-rw-r--r-- | libmap/data/timezone_-11.png | bin | 7406 -> 0 bytes | |||
-rw-r--r-- | libmap/data/timezone_-2.png | bin | 4333 -> 0 bytes | |||
-rw-r--r-- | libmap/data/timezone_-3.5.png | bin | 740 -> 0 bytes | |||
-rw-r--r-- | libmap/data/timezone_-3.png | bin | 13615 -> 0 bytes | |||
-rw-r--r-- | libmap/data/timezone_-4.5.png | bin | 1900 -> 0 bytes | |||
-rw-r--r-- | libmap/data/timezone_-4.png | bin | 15084 -> 0 bytes | |||
-rw-r--r-- | libmap/data/timezone_-5.5.png | bin | 437 -> 0 bytes | |||
-rw-r--r-- | libmap/data/timezone_-5.png | bin | 19166 -> 0 bytes | |||
-rw-r--r-- | libmap/data/timezone_-6.png | bin | 13764 -> 0 bytes | |||
-rw-r--r-- | libmap/data/timezone_-7.png | bin | 11977 -> 0 bytes | |||
-rw-r--r-- | libmap/data/timezone_-8.png | bin | 6801 -> 0 bytes | |||
-rw-r--r-- | libmap/data/timezone_-9.5.png | bin | 437 -> 0 bytes | |||
-rw-r--r-- | libmap/data/timezone_-9.png | bin | 7908 -> 0 bytes | |||
-rw-r--r-- | libmap/data/timezone_0.png | bin | 11074 -> 0 bytes | |||
-rw-r--r-- | libmap/data/timezone_1.png | bin | 15458 -> 0 bytes | |||
-rw-r--r-- | libmap/data/timezone_10.5.png | bin | 421 -> 0 bytes | |||
-rw-r--r-- | libmap/data/timezone_10.png | bin | 12829 -> 0 bytes | |||
-rw-r--r-- | libmap/data/timezone_11.5.png | bin | 446 -> 0 bytes | |||
-rw-r--r-- | libmap/data/timezone_11.png | bin | 12113 -> 0 bytes | |||
-rw-r--r-- | libmap/data/timezone_12.75.png | bin | 409 -> 0 bytes | |||
-rw-r--r-- | libmap/data/timezone_12.png | bin | 7130 -> 0 bytes | |||
-rw-r--r-- | libmap/data/timezone_13.png | bin | 621 -> 0 bytes | |||
-rw-r--r-- | libmap/data/timezone_2.png | bin | 12854 -> 0 bytes | |||
-rw-r--r-- | libmap/data/timezone_3.5.png | bin | 2142 -> 0 bytes | |||
-rw-r--r-- | libmap/data/timezone_3.png | bin | 17475 -> 0 bytes | |||
-rw-r--r-- | libmap/data/timezone_4.5.png | bin | 1773 -> 0 bytes | |||
-rw-r--r-- | libmap/data/timezone_4.png | bin | 4954 -> 0 bytes | |||
-rw-r--r-- | libmap/data/timezone_5.5.png | bin | 6099 -> 0 bytes | |||
-rw-r--r-- | libmap/data/timezone_5.75.png | bin | 2885 -> 0 bytes | |||
-rw-r--r-- | libmap/data/timezone_5.png | bin | 14539 -> 0 bytes | |||
-rw-r--r-- | libmap/data/timezone_6.5.png | bin | 1609 -> 0 bytes | |||
-rw-r--r-- | libmap/data/timezone_6.png | bin | 8441 -> 0 bytes | |||
-rw-r--r-- | libmap/data/timezone_7.png | bin | 14412 -> 0 bytes | |||
-rw-r--r-- | libmap/data/timezone_8.png | bin | 16725 -> 0 bytes | |||
-rw-r--r-- | libmap/data/timezone_9.5.png | bin | 1959 -> 0 bytes | |||
-rw-r--r-- | libmap/data/timezone_9.png | bin | 12608 -> 0 bytes | |||
-rw-r--r-- | libmap/test-timezone.c | 56 | ||||
-rw-r--r-- | libmap/tz.c | 399 | ||||
-rw-r--r-- | libmap/tz.h | 86 | ||||
-rw-r--r-- | po/LINGUAS | 31 | ||||
-rw-r--r-- | po/POTFILES.in | 8 | ||||
-rw-r--r-- | po/ar.po | 44 | ||||
-rw-r--r-- | po/bg.po | 44 | ||||
-rw-r--r-- | po/cs.po | 45 | ||||
-rw-r--r-- | po/da.po | 45 | ||||
-rw-r--r-- | po/de.po | 45 | ||||
-rw-r--r-- | po/el.po | 45 | ||||
-rw-r--r-- | po/es.po | 45 | ||||
-rw-r--r-- | po/fi.po | 45 | ||||
-rw-r--r-- | po/fr.po | 45 | ||||
-rw-r--r-- | po/he.po | 45 | ||||
-rw-r--r-- | po/hi.po | 44 | ||||
-rw-r--r-- | po/hr.po | 46 | ||||
-rw-r--r-- | po/hu.po | 45 | ||||
-rw-r--r-- | po/it.po | 45 | ||||
-rw-r--r-- | po/ja.po | 45 | ||||
-rw-r--r-- | po/ko.po | 45 | ||||
-rw-r--r-- | po/nb.po | 45 | ||||
-rw-r--r-- | po/nl.po | 45 | ||||
-rw-r--r-- | po/pl.po | 46 | ||||
-rw-r--r-- | po/pt.po | 45 | ||||
-rw-r--r-- | po/pt_BR.po | 45 | ||||
-rw-r--r-- | po/ro.po | 46 | ||||
-rw-r--r-- | po/ru.po | 46 | ||||
-rw-r--r-- | po/sk.po | 45 | ||||
-rw-r--r-- | po/sl.po | 46 | ||||
-rw-r--r-- | po/sr.po | 46 | ||||
-rw-r--r-- | po/sv.po | 45 | ||||
-rw-r--r-- | po/th.po | 44 | ||||
-rw-r--r-- | po/tr.po | 45 | ||||
-rw-r--r-- | po/zh_CN.po | 44 | ||||
-rw-r--r-- | po/zh_TW.po | 44 | ||||
-rw-r--r-- | src/Makefile.am | 20 | ||||
-rw-r--r-- | src/datetime-prefs-locations.c | 500 | ||||
-rw-r--r-- | src/datetime-prefs-locations.h | 35 | ||||
-rw-r--r-- | src/datetime-prefs.c | 769 | ||||
-rw-r--r-- | src/timezone-completion.c | 688 | ||||
-rw-r--r-- | src/timezone-completion.h | 63 |
95 files changed, 2 insertions, 6449 deletions
diff --git a/Makefile.am b/Makefile.am index 4de650a..9dfa7d4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,10 +1,7 @@ SUBDIRS = \ - libmap \ src \ - data \ - tests \ - po + data DISTCHECK_CONFIGURE_FLAGS = --enable-localinstall diff --git a/configure.ac b/configure.ac index 1504c6a..9fe22ed 100644 --- a/configure.ac +++ b/configure.ac @@ -240,7 +240,6 @@ AM_GLIB_GNU_GETTEXT AC_OUTPUT([ Makefile -libmap/Makefile src/Makefile data/Makefile tests/Makefile diff --git a/data/Makefile.am b/data/Makefile.am index b9a9532..9600da4 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -1,26 +1,12 @@ #SUBDIRS = icons -gsettings_SCHEMAS = \ - com.canonical.indicator.datetime.gschema.xml -@GSETTINGS_RULES@ - dbus_servicesdir = $(DBUSSERVICEDIR) dbus_services_DATA = indicator-datetime.service %.service: %.service.in sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@ -pkgdata_DATA = datetime-dialog.ui - -@INTLTOOL_DESKTOP_RULE@ -desktopdir = $(datadir)/applications -desktop_DATA = indicator-datetime-preferences.desktop - EXTRA_DIST = \ - $(gsettings_SCHEMAS) \ - datetime-dialog.ui \ - indicator-datetime-preferences.desktop \ - indicator-datetime-preferences.desktop.in \ indicator-datetime.service.in -CLEANFILES = indicator-datetime-preferences.desktop indicator-datetime.service +CLEANFILES = indicator-datetime.service diff --git a/data/com.canonical.indicator.datetime.gschema.xml b/data/com.canonical.indicator.datetime.gschema.xml deleted file mode 100644 index 8ce75e6..0000000 --- a/data/com.canonical.indicator.datetime.gschema.xml +++ /dev/null @@ -1,111 +0,0 @@ -<schemalist> - <enum id="time-enum"> - <value nick="locale-default" value="0" /> - <value nick="12-hour" value="1" /> - <value nick="24-hour" value="2" /> - <value nick="custom" value="3" /> - </enum> - <schema id="com.canonical.indicator.datetime" path="/com/canonical/indicator/datetime/" gettext-domain="indicator-datetime"> - <key name="show-clock" type="b"> - <default>true</default> - <summary>Show the clock in the panel</summary> - <description> - Controls whether the clock indicator appears in the panel or not. - </description> - </key> - <key name="time-format" enum="time-enum"> - <default>'locale-default'</default> - <summary>What the time format should be</summary> - <description> - Controls the time format that is displayed in the indicator. For almost - all users this should be the default for their locale. If you think the - setting is wrong for your locale please join or talk to the translation - team for your language. If you just want something different you can - adjust this to be either 12 or 24 time. Or, you can use a custom format - string and set the custom-time-format setting. - </description> - </key> - <key name="custom-time-format" type="s"> - <default>"%l:%M %p"</default> - <summary>The format string passed to strftime</summary> - <description> - The format of the time and/or date that is visible on the panel when using - the indicator. For most users this will be a set of predefined values as - determined by the configuration utility, but advanced users can change it - to anything strftime can accept. Look at the man page on strftime for - more information. - </description> - </key> - <key name="show-seconds" type="b"> - <default>false</default> - <summary>Show the number of seconds in the indicator</summary> - <description> - Makes the datetime indicator show the number of seconds in the indicator. - It's important to note that this will cause additional battery drain as - the time will update 60 times as often, so it is not recommended. Also, - this setting will be ignored if the time-format value is set to custom. - </description> - </key> - <key name="show-day" type="b"> - <default>false</default> - <summary>Show the day of the week in the indicator</summary> - <description> - Puts the day of the week on the panel along with the time and/or date - depending on settings. This setting will be ignored if the time-format - value is set to custom. - </description> - </key> - <key name="show-date" type="b"> - <default>false</default> - <summary>Show the month and date in the indicator</summary> - <description> - Puts the month and the date in the panel along with the time and/or day - of the week depending on settings. This setting will be ignored if the - time-format value is set to custom. - </description> - </key> - <key name="show-calendar" type="b"> - <default>true</default> - <summary>Show the monthly calendar in the indicator</summary> - <description> - Puts the monthly calendar in indicator-datetime's menu. - </description> - </key> - <key name="show-week-numbers" type="b"> - <default>false</default> - <summary>Show week numbers in calendar</summary> - <description> - Shows the week numbers in the monthly calendar in indicator-datetime's menu. - </description> - </key> - <key name="show-events" type="b"> - <default>true</default> - <summary>Show events in the indicator</summary> - <description> - Shows events from Evolution in indicator-datetime's menu. - </description> - </key> - <key name="show-locations" type="b"> - <default>false</default> - <summary>Show locations in the indicator</summary> - <description> - Shows custom defined locations in indicator-datetime's menu. - </description> - </key> - <key name="locations" type="as"> - <default>['UTC']</default> - <summary>A List of locations</summary> - <description> - Adds the list of locations the user has configured to display in the - indicator-datetime menu. - </description> - </key> - <key name="timezone-name" type="s"> - <default>''</default> - <summary>The name of the current timezone</summary> - <description> - Some timezones can be known by many different cities or names. This setting describes how the current zone prefers to be named. Format is "TIMEZONE NAME" (e.g. "America/New_York Boston" to name the New_York zone Boston). - </description> - </key> - </schema> -</schemalist> diff --git a/data/datetime-dialog.ui b/data/datetime-dialog.ui deleted file mode 100644 index 8479482..0000000 --- a/data/datetime-dialog.ui +++ /dev/null @@ -1,774 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<interface> - <requires lib="gtk+" version="2.24"/> - <!-- interface-naming-policy project-wide --> - <object class="GtkAdjustment" id="dateAdjustment"> - <property name="upper">1.8446744073709552e+19</property> - <property name="step_increment">86400</property> - <property name="page_increment">864000</property> - </object> - <object class="GtkWindow" id="locationsDialog"> - <property name="can_focus">False</property> - <property name="title" translatable="yes">Locations</property> - <property name="default_width">300</property> - <property name="default_height">200</property> - <property name="destroy_with_parent">True</property> - <property name="icon_name">time-admin</property> - <child> - <object class="GtkVBox" id="vbox1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <child> - <object class="GtkScrolledWindow" id="scrolledwindow1"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hscrollbar_policy">automatic</property> - <property name="vscrollbar_policy">automatic</property> - <child> - <object class="GtkTreeView" id="locationsView"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="model">locationsStore</property> - <property name="reorderable">True</property> - <property name="search_column">0</property> - </object> - </child> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkHSeparator" id="hseparator1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkHBox" id="hbox10"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <child> - <object class="GtkButton" id="addButton"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_action_appearance">False</property> - <child internal-child="accessible"> - <object class="AtkObject" id="addButton-atkobject"> - <property name="AtkObject::accessible-description" translatable="yes">Add a Location…</property> - </object> - </child> - <child> - <object class="GtkImage" id="addImage"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="stock">gtk-add</property> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkButton" id="removeButton"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_action_appearance">False</property> - <child internal-child="accessible"> - <object class="AtkObject" id="removeButton-atkobject"> - <property name="AtkObject::accessible-description" translatable="yes">Remove This Location</property> - </object> - </child> - <child> - <object class="GtkImage" id="removeImage"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="stock">gtk-remove</property> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> - </object> - </child> - </object> - <object class="GtkListStore" id="locationsStore"> - <columns> - <!-- column-name Location --> - <column type="gchararray"/> - <!-- column-name Time --> - <column type="gchararray"/> - <!-- column-name Zone --> - <column type="gchararray"/> - <!-- column-name Visible Name --> - <column type="gchararray"/> - <!-- column-name Icon --> - <column type="gchararray"/> - </columns> - </object> - <object class="GtkAdjustment" id="timeAdjustment"> - <property name="upper">1.8446744073709552e+19</property> - <property name="step_increment">60</property> - <property name="page_increment">3600</property> - </object> - <object class="GtkWindow" id="timeDateDialog"> - <property name="can_focus">False</property> - <property name="border_width">5</property> - <property name="title" translatable="yes">Time & Date</property> - <property name="resizable">False</property> - <property name="icon_name">time-admin</property> - <property name="type_hint">dialog</property> - <child> - <object class="GtkNotebook" id="notebook1"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <child> - <object class="GtkVBox" id="timeDateBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="border_width">12</property> - <property name="spacing">6</property> - <child> - <object class="GtkVBox" id="timeDateOptions"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="spacing">12</property> - <child> - <object class="GtkVBox" id="vbox6"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="spacing">6</property> - <child> - <object class="GtkAspectFrame" id="mapBox"> - <property name="height_request">265</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label_xalign">0</property> - <property name="shadow_type">none</property> - <child> - <placeholder/> - </child> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkHBox" id="hbox1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="spacing">6</property> - <child> - <object class="GtkLabel" id="label5"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">1</property> - <property name="label" translatable="yes">_Location:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">timezoneEntry</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="timezoneEntry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">•</property> - <property name="invisible_char_set">True</property> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkTable" id="table1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="n_rows">2</property> - <property name="n_columns">2</property> - <property name="column_spacing">6</property> - <property name="row_spacing">6</property> - <child> - <object class="GtkHBox" id="hbox2"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="spacing">6</property> - <child> - <object class="GtkRadioButton" id="manualTimeRadio"> - <property name="label" translatable="yes">_Manually</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_action_appearance">False</property> - <property name="use_underline">True</property> - <property name="xalign">0</property> - <property name="active">True</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkRadioButton" id="automaticTimeRadio"> - <property name="label" translatable="yes">_Automatically from the Internet</property> - <property name="visible">True</property> - <property name="sensitive">False</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_action_appearance">False</property> - <property name="use_underline">True</property> - <property name="xalign">0</property> - <property name="draw_indicator">True</property> - <property name="group">manualTimeRadio</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label9"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">1</property> - <property name="label" translatable="yes">Set the time:</property> - </object> - <packing> - <property name="x_options">GTK_FILL</property> - <property name="y_options">GTK_FILL</property> - </packing> - </child> - <child> - <object class="GtkHBox" id="manualOptions"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="spacing">12</property> - <child> - <object class="GtkHBox" id="hbox8"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="spacing">6</property> - <child> - <object class="GtkSpinButton" id="timeSpinner"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">•</property> - <property name="width_chars">11</property> - <property name="xalign">1</property> - <property name="invisible_char_set">True</property> - <property name="adjustment">timeAdjustment</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkHBox" id="hbox9"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="spacing">6</property> - <child> - <object class="GtkLabel" id="label10"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">_Date:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">dateSpinner</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkSpinButton" id="dateSpinner"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">•</property> - <property name="width_chars">11</property> - <property name="xalign">1</property> - <property name="invisible_char_set">True</property> - <property name="adjustment">dateAdjustment</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label11"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">1</property> - <property name="label" translatable="yes">Tim_e:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">timeSpinner</property> - </object> - <packing> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">GTK_FILL</property> - <property name="y_options">GTK_FILL</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="pack_type">end</property> - <property name="position">0</property> - </packing> - </child> - <child> - <placeholder/> - </child> - </object> - </child> - <child type="tab"> - <object class="GtkLabel" id="label1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xpad">1</property> - <property name="label" translatable="yes">_Time & Date</property> - <property name="use_underline">True</property> - </object> - <packing> - <property name="tab_fill">False</property> - </packing> - </child> - <child> - <object class="GtkAlignment" id="alignment1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="yalign">0</property> - <property name="yscale">0</property> - <child> - <object class="GtkVBox" id="clockBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="border_width">12</property> - <property name="spacing">12</property> - <child> - <object class="GtkCheckButton" id="showClockCheck"> - <property name="label" translatable="yes">_Show a clock in the menu bar</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_action_appearance">False</property> - <property name="use_underline">True</property> - <property name="xalign">0</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkHBox" id="clockOptions"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="homogeneous">True</property> - <child> - <object class="GtkVBox" id="vbox2"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="spacing">6</property> - <child> - <object class="GtkLabel" id="label3"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">In the clock, show:</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="showWeekdayCheck"> - <property name="label" translatable="yes">_Weekday</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_action_appearance">False</property> - <property name="use_underline">True</property> - <property name="xalign">0</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="showDateTimeCheck"> - <property name="label" translatable="yes">_Date and month</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_action_appearance">False</property> - <property name="use_underline">True</property> - <property name="xalign">0</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> - <child> - <object class="GtkVBox" id="vbox5"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <child> - <object class="GtkRadioButton" id="show12HourRadio"> - <property name="label" translatable="yes">_12-hour time</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_action_appearance">False</property> - <property name="use_underline">True</property> - <property name="xalign">0</property> - <property name="active">True</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkRadioButton" id="show24HourRadio"> - <property name="label" translatable="yes">_24-hour time</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_action_appearance">False</property> - <property name="use_underline">True</property> - <property name="xalign">0</property> - <property name="draw_indicator">True</property> - <property name="group">show12HourRadio</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">3</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="showSecondsCheck"> - <property name="label" translatable="yes">Seco_nds</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_action_appearance">False</property> - <property name="use_underline">True</property> - <property name="xalign">0</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">4</property> - </packing> - </child> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkVBox" id="vbox3"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="spacing">6</property> - <child> - <object class="GtkLabel" id="label4"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">In the clock’s menu, show:</property> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="showCalendarCheck"> - <property name="label" translatable="yes">_Monthly calendar</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_action_appearance">False</property> - <property name="use_underline">True</property> - <property name="xalign">0</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkAlignment" id="calendarOptions"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="yalign">0</property> - <property name="yscale">0</property> - <property name="left_padding">24</property> - <child> - <object class="GtkVBox" id="vbox4"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="spacing">6</property> - <child> - <object class="GtkCheckButton" id="includeWeekNumbersCheck"> - <property name="label" translatable="yes">Include week num_bers</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_action_appearance">False</property> - <property name="use_underline">True</property> - <property name="xalign">0</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="showEventsCheck"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_action_appearance">False</property> - <property name="use_underline">True</property> - <property name="xalign">0</property> - <property name="draw_indicator">True</property> - <child> - <object class="GtkLabel" id="label12"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Coming _events from Evolution Calendar</property> - <property name="use_underline">True</property> - <property name="wrap">True</property> - <property name="mnemonic_widget">showEventsCheck</property> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">3</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="showLocationsCheck"> - <property name="label" translatable="yes">Time in _other locations</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_action_appearance">False</property> - <property name="use_underline">True</property> - <property name="xalign">0</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">5</property> - </packing> - </child> - <child> - <object class="GtkAlignment" id="alignment2"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="yalign">0</property> - <property name="xscale">0</property> - <property name="yscale">0</property> - <property name="left_padding">24</property> - <child> - <object class="GtkButton" id="locationsButton"> - <property name="label" translatable="yes">Choose _Locations…</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_action_appearance">False</property> - <property name="use_underline">True</property> - <property name="xalign">0</property> - </object> - </child> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">5</property> - </packing> - </child> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - </child> - </object> - <packing> - <property name="position">1</property> - <property name="tab_fill">False</property> - </packing> - </child> - <child type="tab"> - <object class="GtkLabel" id="label2"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">_Clock</property> - <property name="use_underline">True</property> - </object> - <packing> - <property name="position">1</property> - <property name="tab_fill">False</property> - </packing> - </child> - </object> - </child> - </object> - <object class="GtkSizeGroup" id="timeSizeGroup"> - <widgets> - <widget name="label5"/> - <widget name="label9"/> - <widget name="label11"/> - </widgets> - </object> -</interface> diff --git a/data/indicator-datetime-preferences.desktop.in b/data/indicator-datetime-preferences.desktop.in deleted file mode 100644 index f37765b..0000000 --- a/data/indicator-datetime-preferences.desktop.in +++ /dev/null @@ -1,14 +0,0 @@ -[Desktop Entry] -Version=1.0 - -_Name=Time & Date -_Comment=Change your clock and date settings - -Icon=time-admin -TryExec=indicator-datetime-preferences -Exec=indicator-datetime-preferences - -StartupNotify=true - -Type=Application -Categories=GNOME;GTK;Utility;DesktopSettings;Settings; diff --git a/libmap/Makefile.am b/libmap/Makefile.am deleted file mode 100644 index a10b835..0000000 --- a/libmap/Makefile.am +++ /dev/null @@ -1,77 +0,0 @@ -uidir = $(pkgdatadir)/libmap/ui -dist_ui_DATA = \ - data/bg.png \ - data/cc.png \ - data/olsen_map.png \ - data/pin.png \ - data/timezone_0.png \ - data/timezone_-10.png \ - data/timezone_10.png \ - data/timezone_10.5.png \ - data/timezone_-1.png \ - data/timezone_1.png \ - data/timezone_-11.png \ - data/timezone_11.png \ - data/timezone_11.5.png \ - data/timezone_12.png \ - data/timezone_12.75.png \ - data/timezone_13.png \ - data/timezone_-2.png \ - data/timezone_2.png \ - data/timezone_-3.png \ - data/timezone_3.png \ - data/timezone_-3.5.png \ - data/timezone_3.5.png \ - data/timezone_-4.png \ - data/timezone_4.png \ - data/timezone_-4.5.png \ - data/timezone_4.5.png \ - data/timezone_-5.png \ - data/timezone_5.png \ - data/timezone_-5.5.png \ - data/timezone_5.5.png \ - data/timezone_5.75.png \ - data/timezone_-6.png \ - data/timezone_6.png \ - data/timezone_6.5.png \ - data/timezone_-7.png \ - data/timezone_7.png \ - data/timezone_-8.png \ - data/timezone_8.png \ - data/timezone_-9.png \ - data/timezone_9.png \ - data/timezone_-9.5.png \ - data/timezone_9.5.png - -tzdatadir = $(pkgdatadir)/libmap/datetime -dist_tzdata_DATA = backward - -AM_CPPFLAGS = \ - $(LIBMAP_CFLAGS) \ - -DGNOMELOCALEDIR="\"$(datadir)/locale\"" \ - -DGNOMECC_DATA_DIR="\"$(pkgdatadir)/libmap\"" \ - -DDATADIR="\"$(uidir)\"" \ - $(NULL) - -noinst_PROGRAMS = test-timezone - -test_timezone_SOURCES = test-timezone.c tz.c tz.h -test_timezone_LDADD = $(LIBMAP_LIBS) -test_timezone_CFLAGS = $(LIBMAP_CFLAGS) - -all-local: check-local - -# FIXME remove "|| :" when we have all the necessary pixmaps -check-local: test-timezone - $(builddir)/test-timezone $(srcdir)/data || : - -noinst_LTLIBRARIES = libmap.la - -libmap_la_SOURCES = \ - cc-timezone-map.c \ - cc-timezone-map.h \ - tz.c tz.h - -libmap_la_LIBADD = $(LIBMAP_LIBS) -libmap_la_LDFLAGS = $(LIBMAP_LDFLAGS) - diff --git a/libmap/README b/libmap/README deleted file mode 100644 index 6766b42..0000000 --- a/libmap/README +++ /dev/null @@ -1,5 +0,0 @@ -This static library is a copied version of the code in GNOME 3.0's control center panel 'datetime', which itself is a version of Ubiquity's map ported to C. - -Ideally in the future, we can have all three packages using the same code. But for now, for time reasons (hah), it's just a copy. - -To update this copy, put newer versions of the code and data files in place; then fix up any GTK3-isms and add cc_timezone_map_set_coords and friends. And the watermark. diff --git a/libmap/backward b/libmap/backward deleted file mode 100644 index f1f95a8..0000000 --- a/libmap/backward +++ /dev/null @@ -1,118 +0,0 @@ -# <pre> -# @(#)backward 8.9 -# This file is in the public domain, so clarified as of -# 2009-05-17 by Arthur David Olson. - -# This file provides links between current names for time zones -# and their old names. Many names changed in late 1993. - -Link Africa/Asmara Africa/Asmera -Link Africa/Bamako Africa/Timbuktu -Link America/Argentina/Catamarca America/Argentina/ComodRivadavia -Link America/Adak America/Atka -Link America/Argentina/Buenos_Aires America/Buenos_Aires -Link America/Argentina/Catamarca America/Catamarca -Link America/Atikokan America/Coral_Harbour -Link America/Argentina/Cordoba America/Cordoba -Link America/Tijuana America/Ensenada -Link America/Indiana/Indianapolis America/Fort_Wayne -Link America/Indiana/Indianapolis America/Indianapolis -Link America/Argentina/Jujuy America/Jujuy -Link America/Indiana/Knox America/Knox_IN -Link America/Kentucky/Louisville America/Louisville -Link America/Argentina/Mendoza America/Mendoza -Link America/Rio_Branco America/Porto_Acre -Link America/Argentina/Cordoba America/Rosario -Link America/St_Thomas America/Virgin -Link Asia/Ashgabat Asia/Ashkhabad -Link Asia/Chongqing Asia/Chungking -Link Asia/Dhaka Asia/Dacca -Link Asia/Kathmandu Asia/Katmandu -Link Asia/Kolkata Asia/Calcutta -Link Asia/Macau Asia/Macao -Link Asia/Jerusalem Asia/Tel_Aviv -Link Asia/Ho_Chi_Minh Asia/Saigon -Link Asia/Thimphu Asia/Thimbu -Link Asia/Makassar Asia/Ujung_Pandang -Link Asia/Ulaanbaatar Asia/Ulan_Bator -Link Atlantic/Faroe Atlantic/Faeroe -Link Europe/Oslo Atlantic/Jan_Mayen -Link Australia/Sydney Australia/ACT -Link Australia/Sydney Australia/Canberra -Link Australia/Lord_Howe Australia/LHI -Link Australia/Sydney Australia/NSW -Link Australia/Darwin Australia/North -Link Australia/Brisbane Australia/Queensland -Link Australia/Adelaide Australia/South -Link Australia/Hobart Australia/Tasmania -Link Australia/Melbourne Australia/Victoria -Link Australia/Perth Australia/West -Link Australia/Broken_Hill Australia/Yancowinna -Link America/Rio_Branco Brazil/Acre -Link America/Noronha Brazil/DeNoronha -Link America/Sao_Paulo Brazil/East -Link America/Manaus Brazil/West -Link America/Halifax Canada/Atlantic -Link America/Winnipeg Canada/Central -Link America/Regina Canada/East-Saskatchewan -Link America/Toronto Canada/Eastern -Link America/Edmonton Canada/Mountain -Link America/St_Johns Canada/Newfoundland -Link America/Vancouver Canada/Pacific -Link America/Regina Canada/Saskatchewan -Link America/Whitehorse Canada/Yukon -Link America/Santiago Chile/Continental -Link Pacific/Easter Chile/EasterIsland -Link America/Havana Cuba -Link Africa/Cairo Egypt -Link Europe/Dublin Eire -Link Europe/London Europe/Belfast -Link Europe/Chisinau Europe/Tiraspol -Link Europe/London GB -Link Europe/London GB-Eire -Link Etc/GMT GMT+0 -Link Etc/GMT GMT-0 -Link Etc/GMT GMT0 -Link Etc/GMT Greenwich -Link Asia/Hong_Kong Hongkong -Link Atlantic/Reykjavik Iceland -Link Asia/Tehran Iran -Link Asia/Jerusalem Israel -Link America/Jamaica Jamaica -Link Asia/Tokyo Japan -Link Pacific/Kwajalein Kwajalein -Link Africa/Tripoli Libya -Link America/Tijuana Mexico/BajaNorte -Link America/Mazatlan Mexico/BajaSur -Link America/Mexico_City Mexico/General -Link Pacific/Auckland NZ -Link Pacific/Chatham NZ-CHAT -Link America/Denver Navajo -Link Asia/Shanghai PRC -Link Pacific/Pago_Pago Pacific/Samoa -Link Pacific/Chuuk Pacific/Yap -Link Pacific/Chuuk Pacific/Truk -Link Pacific/Pohnpei Pacific/Ponape -Link Europe/Warsaw Poland -Link Europe/Lisbon Portugal -Link Asia/Taipei ROC -Link Asia/Seoul ROK -Link Asia/Singapore Singapore -Link Europe/Istanbul Turkey -Link Etc/UCT UCT -Link America/Anchorage US/Alaska -Link America/Adak US/Aleutian -Link America/Phoenix US/Arizona -Link America/Chicago US/Central -Link America/Indiana/Indianapolis US/East-Indiana -Link America/New_York US/Eastern -Link Pacific/Honolulu US/Hawaii -Link America/Indiana/Knox US/Indiana-Starke -Link America/Detroit US/Michigan -Link America/Denver US/Mountain -Link America/Los_Angeles US/Pacific -Link Pacific/Pago_Pago US/Samoa -Link Etc/UTC UTC -Link Etc/UTC Universal -Link Europe/Moscow W-SU -Link Etc/UTC Zulu diff --git a/libmap/cc-timezone-map.c b/libmap/cc-timezone-map.c deleted file mode 100644 index 7b7d704..0000000 --- a/libmap/cc-timezone-map.c +++ /dev/null @@ -1,1195 +0,0 @@ -/* - * Copyright (C) 2010 Intel, Inc - * Copyright (C) 2011 Canonical Ltd. - * - * Portions from Ubiquity, Copyright (C) 2009 Canonical Ltd. - * Written by Evan Dandrea <evand@ubuntu.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * Author: Thomas Wood <thomas.wood@intel.com> - * - */ - -#include "cc-timezone-map.h" -#include <math.h> -#include "tz.h" - -G_DEFINE_TYPE (CcTimezoneMap, cc_timezone_map, GTK_TYPE_WIDGET) - -#define TIMEZONE_MAP_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_TIMEZONE_MAP, CcTimezoneMapPrivate)) - - -typedef struct -{ - gdouble offset; - guchar red; - guchar green; - guchar blue; - guchar alpha; -} CcTimezoneMapOffset; - -struct _CcTimezoneMapPrivate -{ - GdkPixbuf *orig_background; - GdkPixbuf *orig_color_map; - - GdkPixbuf *background; - GdkPixbuf *color_map; - GdkPixbuf *olsen_map; - - guchar *visible_map_pixels; - gint visible_map_rowstride; - - gint olsen_map_channels; - guchar *olsen_map_pixels; - gint olsen_map_rowstride; - - gdouble selected_offset; - - gchar *watermark; - - TzDB *tzdb; - TzLocation *location; - GHashTable *alias_db; -}; - -enum -{ - LOCATION_CHANGED, - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL]; - - -static CcTimezoneMapOffset color_codes[] = -{ - {-11.0, 43, 0, 0, 255 }, - {-10.0, 85, 0, 0, 255 }, - {-9.5, 102, 255, 0, 255 }, - {-9.0, 128, 0, 0, 255 }, - {-8.0, 170, 0, 0, 255 }, - {-7.0, 212, 0, 0, 255 }, - {-6.0, 255, 0, 1, 255 }, // north - {-6.0, 255, 0, 0, 255 }, // south - {-5.0, 255, 42, 42, 255 }, - {-4.5, 192, 255, 0, 255 }, - {-4.0, 255, 85, 85, 255 }, - {-3.5, 0, 255, 0, 255 }, - {-3.0, 255, 128, 128, 255 }, - {-2.0, 255, 170, 170, 255 }, - {-1.0, 255, 213, 213, 255 }, - {0.0, 43, 17, 0, 255 }, - {1.0, 85, 34, 0, 255 }, - {2.0, 128, 51, 0, 255 }, - {3.0, 170, 68, 0, 255 }, - {3.5, 0, 255, 102, 255 }, - {4.0, 212, 85, 0, 255 }, - {4.5, 0, 204, 255, 255 }, - {5.0, 255, 102, 0, 255 }, - {5.5, 0, 102, 255, 255 }, - {5.75, 0, 238, 207, 247 }, - {6.0, 255, 127, 42, 255 }, - {6.5, 204, 0, 254, 254 }, - {7.0, 255, 153, 85, 255 }, - {8.0, 255, 179, 128, 255 }, - {9.0, 255, 204, 170, 255 }, - {9.5, 170, 0, 68, 250 }, - {10.0, 255, 230, 213, 255 }, - {10.5, 212, 124, 21, 250 }, - {11.0, 212, 170, 0, 255 }, - {11.5, 249, 25, 87, 253 }, - {12.0, 255, 204, 0, 255 }, - {12.75, 254, 74, 100, 248 }, - {13.0, 255, 85, 153, 250 }, - {-100, 0, 0, 0, 0 } -}; - -static const gchar * olsen_map_timezones[] = { - "Africa/Abidjan", - "Africa/Accra", - "Africa/Addis_Ababa", - "Africa/Algiers", - "Africa/Asmara", - "Africa/Bamako", - "Africa/Bangui", - "Africa/Banjul", - "Africa/Bissau", - "Africa/Blantyre", - "Africa/Brazzaville", - "Africa/Bujumbura", - "Africa/Cairo", - "Africa/Casablanca", - "Africa/Conakry", - "Africa/Dakar", - "Africa/Dar_es_Salaam", - "Africa/Djibouti", - "Africa/Douala", - "Africa/El_Aaiun", - "Africa/Freetown", - "Africa/Gaborone", - "Africa/Harare", - "Africa/Johannesburg", - "Africa/Kampala", - "Africa/Khartoum", - "Africa/Kigali", - "Africa/Kinshasa", - "Africa/Lagos", - "Africa/Libreville", - "Africa/Lome", - "Africa/Luanda", - "Africa/Lubumbashi", - "Africa/Lusaka", - "Africa/Malabo", - "Africa/Maputo", - "Africa/Maseru", - "Africa/Mbabane", - "Africa/Mogadishu", - "Africa/Monrovia", - "Africa/Nairobi", - "Africa/Ndjamena", - "Africa/Niamey", - "Africa/Nouakchott", - "Africa/Ouagadougou", - "Africa/Porto-Novo", - "Africa/Sao_Tome", - "Africa/Tripoli", - "Africa/Tunis", - "Africa/Windhoek", - "America/Adak", - "America/Anguilla", - "America/Antigua", - "America/Araguaina", - "America/Argentina/Buenos_Aires", - "America/Argentina/Catamarca", - "America/Argentina/Cordoba", - "America/Argentina/Jujuy", - "America/Argentina/La_Rioja", - "America/Argentina/Mendoza", - "America/Argentina/Rio_Gallegos", - "America/Argentina/San_Juan", - "America/Argentina/San_Luis", - "America/Argentina/Tucuman", - "America/Argentina/Ushuaia", - "America/Aruba", - "America/Asuncion", - "America/Atikokan", - "America/Bahia", - "America/Barbados", - "America/Belem", - "America/Belize", - "America/Blanc-Sablon", - "America/Boa_Vista", - "America/Bogota", - "America/Boise", - "America/Cambridge_Bay", - "America/Campo_Grande", - "America/Cancun", - "America/Caracas", - "America/Cayenne", - "America/Cayman", - "America/Chicago", - "America/Chihuahua", - "America/Coral_Harbour", - "America/Costa_Rica", - "America/Cuiaba", - "America/Curacao", - "America/Dawson", - "America/Dawson_Creek", - "America/Denver", - "America/Dominica", - "America/Edmonton", - "America/Eirunepe", - "America/El_Salvador", - "America/Fortaleza", - "America/Glace_Bay", - "America/Goose_Bay", - "America/Grand_Turk", - "America/Grenada", - "America/Guadeloupe", - "America/Guatemala", - "America/Guayaquil", - "America/Guyana", - "America/Halifax", - "America/Havana", - "America/Hermosillo", - "America/Indiana/Indianapolis", - "America/Indiana/Knox", - "America/Indiana/Marengo", - "America/Indiana/Petersburg", - "America/Indiana/Vevay", - "America/Indiana/Vincennes", - "America/Indiana/Winamac", - "America/Inuvik", - "America/Iqaluit", - "America/Jamaica", - "America/Juneau", - "America/Kentucky/Louisville", - "America/Kentucky/Monticello", - "America/La_Paz", - "America/Lima", - "America/Los_Angeles", - "America/Maceio", - "America/Managua", - "America/Manaus", - "America/Marigot", - "America/Martinique", - "America/Mazatlan", - "America/Menominee", - "America/Merida", - "America/Mexico_City", - "America/Miquelon", - "America/Moncton", - "America/Monterrey", - "America/Montevideo", - "America/Montreal", - "America/Montserrat", - "America/Nassau", - "America/New_York", - "America/Nipigon", - "America/Noronha", - "America/North_Dakota/Center", - "America/North_Dakota/Salem", - "America/Panama", - "America/Pangnirtung", - "America/Paramaribo", - "America/Phoenix", - "America/Port-au-Prince", - "America/Port_of_Spain", - "America/Porto_Velho", - "America/Puerto_Rico", - "America/Rainy_River", - "America/Rankin_Inlet", - "America/Recife", - "America/Regina", - "America/Resolute", - "America/Rio_Branco", - "America/Santarem", - "America/Santiago", - "America/Santo_Domingo", - "America/Sao_Paulo", - "America/St_Barthelemy", - "America/St_Johns", - "America/St_Kitts", - "America/St_Lucia", - "America/St_Thomas", - "America/St_Vincent", - "America/Tegucigalpa", - "America/Thunder_Bay", - "America/Tijuana", - "America/Toronto", - "America/Tortola", - "America/Vancouver", - "America/Whitehorse", - "America/Winnipeg", - "America/Yellowknife", - "Ameriica/Swift_Current", - "Arctic/Longyearbyen", - "Asia/Aden", - "Asia/Almaty", - "Asia/Amman", - "Asia/Anadyr", - "Asia/Aqtau", - "Asia/Aqtobe", - "Asia/Ashgabat", - "Asia/Baghdad", - "Asia/Bahrain", - "Asia/Baku", - "Asia/Bangkok", - "Asia/Beirut", - "Asia/Bishkek", - "Asia/Brunei", - "Asia/Choibalsan", - "Asia/Chongqing", - "Asia/Colombo", - "Asia/Damascus", - "Asia/Dhaka", - "Asia/Dili", - "Asia/Dubai", - "Asia/Dushanbe", - "Asia/Gaza", - "Asia/Harbin", - "Asia/Ho_Chi_Minh", - "Asia/Hong_Kong", - "Asia/Hovd", - "Asia/Irkutsk", - "Asia/Jakarta", - "Asia/Jayapura", - "Asia/Jerusalem", - "Asia/Kabul", - "Asia/Kamchatka", - "Asia/Karachi", - "Asia/Kashgar", - "Asia/Katmandu", - "Asia/Kolkata", - "Asia/Krasnoyarsk", - "Asia/Kuala_Lumpur", - "Asia/Kuching", - "Asia/Kuwait", - "Asia/Macau", - "Asia/Magadan", - "Asia/Makassar", - "Asia/Manila", - "Asia/Muscat", - "Asia/Nicosia", - "Asia/Novosibirsk", - "Asia/Omsk", - "Asia/Oral", - "Asia/Phnom_Penh", - "Asia/Pontianak", - "Asia/Pyongyang", - "Asia/Qatar", - "Asia/Qyzylorda", - "Asia/Rangoon", - "Asia/Riyadh", - "Asia/Sakhalin", - "Asia/Samarkand", - "Asia/Seoul", - "Asia/Shanghai", - "Asia/Singapore", - "Asia/Taipei", - "Asia/Tashkent", - "Asia/Tbilisi", - "Asia/Tehran", - "Asia/Thimphu", - "Asia/Tokyo", - "Asia/Ulaanbaatar", - "Asia/Urumqi", - "Asia/Vientiane", - "Asia/Vladivostok", - "Asia/Yakutsk", - "Asia/Yekaterinburg", - "Asia/Yerevan", - "Atlantic/Azores", - "Atlantic/Bermuda", - "Atlantic/Canary", - "Atlantic/Cape_Verde", - "Atlantic/Faroe", - "Atlantic/Madeira", - "Atlantic/Reykjavik", - "Atlantic/South_Georgia", - "Atlantic/St_Helena", - "Atlantic/Stanley", - "Australia/Adelaide", - "Australia/Brisbane", - "Australia/Broken_Hill", - "Australia/Currie", - "Australia/Darwin", - "Australia/Eucla", - "Australia/Hobart", - "Australia/Lindeman", - "Australia/Lord_Howe", - "Australia/Melbourne", - "Australia/Perth", - "Australia/Sydney", - "Europe/Amsterdam", - "Europe/Andorra", - "Europe/Athens", - "Europe/Belgrade", - "Europe/Berlin", - "Europe/Bratislava", - "Europe/Brussels", - "Europe/Bucharest", - "Europe/Budapest", - "Europe/Chisinau", - "Europe/Copenhagen", - "Europe/Dublin", - "Europe/Gibraltar", - "Europe/Guernsey", - "Europe/Helsinki", - "Europe/Isle_of_Man", - "Europe/Istanbul", - "Europe/Jersey", - "Europe/Kaliningrad", - "Europe/Kiev", - "Europe/Lisbon", - "Europe/Ljubljana", - "Europe/London", - "Europe/Luxembourg", - "Europe/Madrid", - "Europe/Malta", - "Europe/Marienhamn", - "Europe/Minsk", - "Europe/Monaco", - "Europe/Moscow", - "Europe/Oslo", - "Europe/Paris", - "Europe/Podgorica", - "Europe/Prague", - "Europe/Riga", - "Europe/Rome", - "Europe/Samara", - "Europe/San_Marino", - "Europe/Sarajevo", - "Europe/Simferopol", - "Europe/Skopje", - "Europe/Sofia", - "Europe/Stockholm", - "Europe/Tallinn", - "Europe/Tirane", - "Europe/Uzhgorod", - "Europe/Vaduz", - "Europe/Vatican", - "Europe/Vienna", - "Europe/Vilnius", - "Europe/Volgograd", - "Europe/Warsaw", - "Europe/Zagreb", - "Europe/Zaporozhye", - "Europe/Zurich", - "Indian/Antananarivo", - "Indian/Chagos", - "Indian/Christmas", - "Indian/Cocos", - "Indian/Comoro", - "Indian/Kerguelen", - "Indian/Mahe", - "Indian/Maldives", - "Indian/Mauritius", - "Indian/Mayotte", - "Indian/Reunion", - "Pacific/Apia", - "Pacific/Auckland", - "Pacific/Chatham", - "Pacific/Easter", - "Pacific/Efate", - "Pacific/Enderbury", - "Pacific/Fakaofo", - "Pacific/Fiji", - "Pacific/Funafuti", - "Pacific/Galapagos", - "Pacific/Gambier", - "Pacific/Guadalcanal", - "Pacific/Guam", - "Pacific/Honolulu", - "Pacific/Johnston", - "Pacific/Kiritimati", - "Pacific/Kosrae", - "Pacific/Kwajalein", - "Pacific/Majuro", - "Pacific/Marquesas", - "Pacific/Midway", - "Pacific/Nauru", - "Pacific/Niue", - "Pacific/Norfolk", - "Pacific/Noumea", - "Pacific/Pago_Pago", - "Pacific/Palau", - "Pacific/Pitcairn", - "Pacific/Ponape", - "Pacific/Port_Moresby", - "Pacific/Rarotonga", - "Pacific/Saipan", - "Pacific/Tahiti", - "Pacific/Tarawa", - "Pacific/Tongatapu", - "Pacific/Truk", - "Pacific/Wake", - "Pacific/Wallis" -}; - -static void -cc_timezone_map_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec) -{ - switch (property_id) - { - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - } -} - -static void -cc_timezone_map_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec) -{ - switch (property_id) - { - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - } -} - -static void -cc_timezone_map_dispose (GObject *object) -{ - CcTimezoneMapPrivate *priv = CC_TIMEZONE_MAP (object)->priv; - - if (priv->orig_background) - { - g_object_unref (priv->orig_background); - priv->orig_background = NULL; - } - - if (priv->orig_color_map) - { - g_object_unref (priv->orig_color_map); - priv->orig_color_map = NULL; - } - - if (priv->olsen_map) - { - g_object_unref (priv->olsen_map); - priv->olsen_map = NULL; - - priv->olsen_map_channels = 0; - priv->olsen_map_pixels = NULL; - priv->olsen_map_rowstride = 0; - } - - if (priv->background) - { - g_object_unref (priv->background); - priv->background = NULL; - } - - if (priv->color_map) - { - g_object_unref (priv->color_map); - priv->color_map = NULL; - - priv->visible_map_pixels = NULL; - priv->visible_map_rowstride = 0; - } - - if (priv->alias_db) - { - g_hash_table_destroy (priv->alias_db); - priv->alias_db = NULL; - } - - if (priv->watermark) - { - g_free (priv->watermark); - priv->watermark = NULL; - } - - G_OBJECT_CLASS (cc_timezone_map_parent_class)->dispose (object); -} - -static void -cc_timezone_map_finalize (GObject *object) -{ - CcTimezoneMapPrivate *priv = CC_TIMEZONE_MAP (object)->priv; - - if (priv->tzdb) - { - tz_db_free (priv->tzdb); - priv->tzdb = NULL; - } - - - G_OBJECT_CLASS (cc_timezone_map_parent_class)->finalize (object); -} - -/* GtkWidget functions */ -#ifdef CCGTK3 -static void -cc_timezone_map_get_preferred_width (GtkWidget *widget, - gint *minimum, - gint *natural) -{ - /* choose a minimum size small enough to prevent the window - * from growing horizontally - */ - if (minimum != NULL) - *minimum = 300; - if (natural != NULL) - *natural = 300; -} - -static void -cc_timezone_map_get_preferred_height (GtkWidget *widget, - gint *minimum, - gint *natural) -{ - CcTimezoneMapPrivate *priv = CC_TIMEZONE_MAP (widget)->priv; - gint size; - - /* The + 20 here is a slight tweak to make the map fill the - * panel better without causing horizontal growing - */ - size = 300 * gdk_pixbuf_get_height (priv->orig_background) / gdk_pixbuf_get_width (priv->orig_background) + 20; - if (minimum != NULL) - *minimum = size; - if (natural != NULL) - *natural = size; -} - -#else - -static void -cc_timezone_map_size_request (GtkWidget *widget, - GtkRequisition *requisition) -{ - CcTimezoneMapPrivate *priv = CC_TIMEZONE_MAP (widget)->priv; - - if (!requisition) - return; - - /* The + 20 here is a slight tweak to make the map fill the - * panel better without causing horizontal growing - */ - requisition->height = 300 * gdk_pixbuf_get_height (priv->orig_background) / gdk_pixbuf_get_width (priv->orig_background) + 20; - requisition->width = 300; -} -#endif - -static void -cc_timezone_map_size_allocate (GtkWidget *widget, - GtkAllocation *allocation) -{ - CcTimezoneMapPrivate *priv = CC_TIMEZONE_MAP (widget)->priv; - - if (priv->background) - g_object_unref (priv->background); - - priv->background = gdk_pixbuf_scale_simple (priv->orig_background, - allocation->width, - allocation->height, - GDK_INTERP_BILINEAR); - - if (priv->color_map) - g_object_unref (priv->color_map); - - priv->color_map = gdk_pixbuf_scale_simple (priv->orig_color_map, - allocation->width, - allocation->height, - GDK_INTERP_BILINEAR); - - priv->visible_map_pixels = gdk_pixbuf_get_pixels (priv->color_map); - priv->visible_map_rowstride = gdk_pixbuf_get_rowstride (priv->color_map); - - GTK_WIDGET_CLASS (cc_timezone_map_parent_class)->size_allocate (widget, - allocation); -} - -static void -cc_timezone_map_realize (GtkWidget *widget) -{ - GdkWindowAttr attr = { 0, }; - GtkAllocation allocation; - GdkCursor *cursor; - GdkWindow *window; - - gtk_widget_get_allocation (widget, &allocation); - - gtk_widget_set_realized (widget, TRUE); - - attr.window_type = GDK_WINDOW_CHILD; - attr.wclass = GDK_INPUT_OUTPUT; - attr.width = allocation.width; - attr.height = allocation.height; - attr.x = allocation.x; - attr.y = allocation.y; - attr.event_mask = gtk_widget_get_events (widget) - | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK; - - window = gdk_window_new (gtk_widget_get_parent_window (widget), &attr, - GDK_WA_X | GDK_WA_Y); - - gtk_widget_set_style (widget, - gtk_style_attach (gtk_widget_get_style (widget), - window)); - - gdk_window_set_user_data (window, widget); - - cursor = gdk_cursor_new (GDK_HAND2); - gdk_window_set_cursor (window, cursor); - - gtk_widget_set_window (widget, window); -} - - -static gdouble -convert_longtitude_to_x (gdouble longitude, gint map_width) -{ - const gdouble xdeg_offset = -6; - gdouble x; - - x = (map_width * (180.0 + longitude) / 360.0) - + (map_width * xdeg_offset / 180.0); - - return x; -} - -static gdouble -radians (gdouble degrees) -{ - return (degrees / 360.0) * G_PI * 2; -} - -static gdouble -convert_latitude_to_y (gdouble latitude, gdouble map_height) -{ - gdouble bottom_lat = -59; - gdouble top_lat = 81; - gdouble top_per, y, full_range, top_offset, map_range; - - top_per = top_lat / 180.0; - y = 1.25 * log (tan (G_PI_4 + 0.4 * radians (latitude))); - full_range = 4.6068250867599998; - top_offset = full_range * top_per; - map_range = fabs (1.25 * log (tan (G_PI_4 + 0.4 * radians (bottom_lat))) - top_offset); - y = fabs (y - top_offset); - y = y / map_range; - y = y * map_height; - return y; -} - - -static gboolean -cc_timezone_map_draw (GtkWidget *widget, - cairo_t *cr) -{ - CcTimezoneMapPrivate *priv = CC_TIMEZONE_MAP (widget)->priv; - GdkPixbuf *hilight, *orig_hilight, *pin; - GtkAllocation alloc; - gchar *file; - GError *err = NULL; - gdouble pointx, pointy; - gdouble alpha = 1.0; - GtkStyle *style; - char buf[16]; - - gtk_widget_get_allocation (widget, &alloc); - - style = gtk_widget_get_style (widget); - - /* Check if insensitive */ - if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE) - alpha = 0.5; - - /* paint background */ - gdk_cairo_set_source_color (cr, &style->bg[gtk_widget_get_state (widget)]); - cairo_paint (cr); - gdk_cairo_set_source_pixbuf (cr, priv->background, 0, 0); - cairo_paint_with_alpha (cr, alpha); - - /* paint watermark */ - if (priv->watermark) { - cairo_text_extents_t extent; - cairo_select_font_face(cr, "Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL); - cairo_set_font_size(cr, 12.0); - cairo_set_source_rgba(cr, 1, 1, 1, 0.5); - cairo_text_extents(cr, priv->watermark, &extent); - cairo_move_to(cr, alloc.width - extent.x_advance + extent.x_bearing - 5, - alloc.height - extent.height - extent.y_bearing - 5); - cairo_show_text(cr, priv->watermark); - cairo_stroke(cr); - } - - if (!priv->location) { - return TRUE; - } - - /* paint hilight */ - file = g_strdup_printf (DATADIR "/timezone_%s.png", - g_ascii_formatd (buf, sizeof (buf), - "%g", priv->selected_offset)); - orig_hilight = gdk_pixbuf_new_from_file (file, &err); - g_free (file); - file = NULL; - - if (!orig_hilight) - { - g_warning ("Could not load hilight: %s", - (err) ? err->message : "Unknown Error"); - if (err) - g_clear_error (&err); - } - else - { - - hilight = gdk_pixbuf_scale_simple (orig_hilight, alloc.width, - alloc.height, GDK_INTERP_BILINEAR); - gdk_cairo_set_source_pixbuf (cr, hilight, 0, 0); - - cairo_paint_with_alpha (cr, alpha); - g_object_unref (hilight); - g_object_unref (orig_hilight); - } - - /* load pin icon */ - pin = gdk_pixbuf_new_from_file (DATADIR "/pin.png", &err); - - if (err) - { - g_warning ("Could not load pin icon: %s", err->message); - g_clear_error (&err); - } - - pointx = convert_longtitude_to_x (priv->location->longitude, alloc.width); - pointy = convert_latitude_to_y (priv->location->latitude, alloc.height); - - if (pointy > alloc.height) - pointy = alloc.height; - - if (pin) - { - gdk_cairo_set_source_pixbuf (cr, pin, pointx - 8, pointy - 14); - cairo_paint_with_alpha (cr, alpha); - g_object_unref (pin); - } - - return TRUE; -} - -#ifndef CCGTK3 -static gboolean -cc_timezone_map_expose_event (GtkWidget *widget, - GdkEventExpose *event) -{ - gboolean rv; - cairo_t *cr; - cr = gdk_cairo_create (widget->window); - rv = cc_timezone_map_draw (widget, cr); - cairo_destroy (cr); - return rv; -} -#endif - - -static void -cc_timezone_map_class_init (CcTimezoneMapClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - - g_type_class_add_private (klass, sizeof (CcTimezoneMapPrivate)); - - object_class->get_property = cc_timezone_map_get_property; - object_class->set_property = cc_timezone_map_set_property; - object_class->dispose = cc_timezone_map_dispose; - object_class->finalize = cc_timezone_map_finalize; - -#ifdef CCGTK3 - widget_class->get_preferred_width = cc_timezone_map_get_preferred_width; - widget_class->get_preferred_height = cc_timezone_map_get_preferred_height; -#else - widget_class->size_request = cc_timezone_map_size_request; -#endif - widget_class->size_allocate = cc_timezone_map_size_allocate; - widget_class->realize = cc_timezone_map_realize; -#ifdef CCGTK3 - widget_class->draw = cc_timezone_map_draw; -#else - widget_class->expose_event = cc_timezone_map_expose_event; -#endif - - signals[LOCATION_CHANGED] = g_signal_new ("location-changed", - CC_TYPE_TIMEZONE_MAP, - G_SIGNAL_RUN_FIRST, - 0, - NULL, - NULL, - g_cclosure_marshal_VOID__POINTER, - G_TYPE_NONE, 1, - G_TYPE_POINTER); -} - - -static gint -sort_locations (TzLocation *a, - TzLocation *b) -{ - if (a->dist > b->dist) - return 1; - - if (a->dist < b->dist) - return -1; - - return 0; -} - -static void -set_location (CcTimezoneMap *map, - TzLocation *location) -{ - CcTimezoneMapPrivate *priv = map->priv; - TzInfo *info; - - priv->location = location; - - info = tz_info_from_location (priv->location); - - priv->selected_offset = tz_location_get_utc_offset (priv->location) - / (60.0*60.0) + ((info->daylight) ? -1.0 : 0.0); - - g_signal_emit (map, signals[LOCATION_CHANGED], 0, priv->location); - - tz_info_free (info); -} - -static TzLocation * -get_loc_for_xy (GtkWidget * widget, gint x, gint y) -{ - CcTimezoneMapPrivate *priv = CC_TIMEZONE_MAP (widget)->priv; - guchar r, g, b, a; - guchar *pixels; - gint rowstride; - gint i; - - const GPtrArray *array; - gint width, height; - GList *distances = NULL; - GtkAllocation alloc; - - rowstride = priv->visible_map_rowstride; - pixels = priv->visible_map_pixels; - - r = pixels[(rowstride * y + x * 4)]; - g = pixels[(rowstride * y + x * 4) + 1]; - b = pixels[(rowstride * y + x * 4) + 2]; - a = pixels[(rowstride * y + x * 4) + 3]; - - - for (i = 0; color_codes[i].offset != -100; i++) - { - if (color_codes[i].red == r && color_codes[i].green == g - && color_codes[i].blue == b && color_codes[i].alpha == a) - { - priv->selected_offset = color_codes[i].offset; - } - } - - gtk_widget_queue_draw (widget); - - /* work out the co-ordinates */ - - array = tz_get_locations (priv->tzdb); - - gtk_widget_get_allocation (widget, &alloc); - width = alloc.width; - height = alloc.height; - - for (i = 0; i < array->len; i++) - { - gdouble pointx, pointy, dx, dy; - TzLocation *loc = array->pdata[i]; - - pointx = convert_longtitude_to_x (loc->longitude, width); - pointy = convert_latitude_to_y (loc->latitude, height); - - dx = pointx - x; - dy = pointy - y; - - loc->dist = dx * dx + dy * dy; - distances = g_list_prepend (distances, loc); - - } - distances = g_list_sort (distances, (GCompareFunc) sort_locations); - - TzLocation * loc = (TzLocation*) distances->data; - - g_list_free (distances); - - return loc; -} - -static gboolean -button_press_event (GtkWidget *widget, - GdkEventButton *event) -{ - TzLocation * loc = get_loc_for_xy (widget, event->x, event->y); - set_location (CC_TIMEZONE_MAP (widget), loc); - return TRUE; -} - -static void -load_backward_tz (CcTimezoneMap *self) -{ - GError *error = NULL; - char **lines, *contents; - guint i; - - self->priv->alias_db = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); - - if (g_file_get_contents (GNOMECC_DATA_DIR "/datetime/backward", &contents, NULL, &error) == FALSE) - { - g_warning ("Failed to load 'backward' file: %s", error->message); - return; - } - lines = g_strsplit (contents, "\n", -1); - g_free (contents); - for (i = 0; lines[i] != NULL; i++) - { - char **items; - guint j; - char *real, *alias; - - if (g_ascii_strncasecmp (lines[i], "Link\t", 5) != 0) - continue; - - items = g_strsplit (lines[i], "\t", -1); - real = NULL; - alias = NULL; - /* Skip the "Link<tab>" part */ - for (j = 1; items[j] != NULL; j++) - { - if (items[j][0] == '\0') - continue; - if (real == NULL) - { - real = items[j]; - continue; - } - alias = items[j]; - break; - } - - if (real == NULL || alias == NULL) - g_warning ("Could not parse line: %s", lines[i]); - - g_hash_table_insert (self->priv->alias_db, g_strdup (alias), g_strdup (real)); - g_strfreev (items); - } - g_strfreev (lines); -} - -static void -cc_timezone_map_init (CcTimezoneMap *self) -{ - CcTimezoneMapPrivate *priv; - GError *err = NULL; - - priv = self->priv = TIMEZONE_MAP_PRIVATE (self); - - priv->orig_background = gdk_pixbuf_new_from_file (DATADIR "/bg.png", - &err); - - if (!priv->orig_background) - { - g_warning ("Could not load background image: %s", - (err) ? err->message : "Unknown error"); - g_clear_error (&err); - } - - priv->orig_color_map = gdk_pixbuf_new_from_file (DATADIR "/cc.png", - &err); - if (!priv->orig_color_map) - { - g_warning ("Could not load background image: %s", - (err) ? err->message : "Unknown error"); - g_clear_error (&err); - } - - priv->olsen_map = gdk_pixbuf_new_from_file (DATADIR "/olsen_map.png", - &err); - if (!priv->olsen_map) - { - g_warning ("Could not load olsen map: %s", - (err) ? err->message : "Unknown error"); - g_clear_error (&err); - } - priv->olsen_map_channels = gdk_pixbuf_get_n_channels (priv->olsen_map); - priv->olsen_map_pixels = gdk_pixbuf_get_pixels (priv->olsen_map); - priv->olsen_map_rowstride = gdk_pixbuf_get_rowstride (priv->olsen_map); - - priv->tzdb = tz_load_db (); - - g_signal_connect (self, "button-press-event", G_CALLBACK (button_press_event), - NULL); - - load_backward_tz (self); -} - -CcTimezoneMap * -cc_timezone_map_new (void) -{ - return g_object_new (CC_TYPE_TIMEZONE_MAP, NULL); -} - -void -cc_timezone_map_set_timezone (CcTimezoneMap *map, - const gchar *timezone) -{ - GPtrArray *locations; - guint i; - char *real_tz; - - real_tz = g_hash_table_lookup (map->priv->alias_db, timezone); - - locations = tz_get_locations (map->priv->tzdb); - - for (i = 0; i < locations->len; i++) - { - TzLocation *loc = locations->pdata[i]; - - if (!g_strcmp0 (loc->zone, real_tz ? real_tz : timezone)) - { - set_location (map, loc); - break; - } - } - - gtk_widget_queue_draw (GTK_WIDGET (map)); -} - -void -cc_timezone_map_set_coords (CcTimezoneMap *map, gdouble lon, gdouble lat) -{ - const gchar * zone = cc_timezone_map_get_timezone_at_coords (map, lon, lat); - cc_timezone_map_set_timezone (map, zone); -} - -const gchar * -cc_timezone_map_get_timezone_at_coords (CcTimezoneMap *map, gdouble lon, gdouble lat) -{ - gint x = (int)(2048.0 / 360.0 * (180.0 + lon)); - gint y = (int)(1024.0 / 180.0 * (90.0 - lat)); - gint offset = map->priv->olsen_map_rowstride * y + x * map->priv->olsen_map_channels; - guchar color0 = map->priv->olsen_map_pixels[offset]; - guchar color1 = map->priv->olsen_map_pixels[offset + 1]; - gint zone = ((color0 & 248) << 1) + ((color1 >>4) & 15); - - const gchar * city = NULL; - if (zone < G_N_ELEMENTS(olsen_map_timezones)) - city = olsen_map_timezones[zone]; - - if (city != NULL) { - return city; - } - else { - GtkAllocation alloc; - gtk_widget_get_allocation (GTK_WIDGET (map), &alloc); - x = convert_longtitude_to_x(lon, alloc.width); - y = convert_latitude_to_y(lat, alloc.height); - TzLocation * loc = get_loc_for_xy(GTK_WIDGET (map), x, y); - return loc->zone; - } -} - -void -cc_timezone_map_set_watermark (CcTimezoneMap *map, const gchar * watermark) -{ - if (map->priv->watermark) - g_free (map->priv->watermark); - - map->priv->watermark = g_strdup (watermark); - gtk_widget_queue_draw (GTK_WIDGET (map)); -} - -TzLocation * -cc_timezone_map_get_location (CcTimezoneMap *map) -{ - return map->priv->location; -} diff --git a/libmap/cc-timezone-map.h b/libmap/cc-timezone-map.h deleted file mode 100644 index ace1107..0000000 --- a/libmap/cc-timezone-map.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (C) 2010 Intel, Inc - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * Author: Thomas Wood <thomas.wood@intel.com> - * - */ - - -#ifndef _CC_TIMEZONE_MAP_H -#define _CC_TIMEZONE_MAP_H - -#include <gtk/gtk.h> -#include "tz.h" - -G_BEGIN_DECLS - -#define CC_TYPE_TIMEZONE_MAP cc_timezone_map_get_type() - -#define CC_TIMEZONE_MAP(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ - CC_TYPE_TIMEZONE_MAP, CcTimezoneMap)) - -#define CC_TIMEZONE_MAP_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST ((klass), \ - CC_TYPE_TIMEZONE_MAP, CcTimezoneMapClass)) - -#define CC_IS_TIMEZONE_MAP(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ - CC_TYPE_TIMEZONE_MAP)) - -#define CC_IS_TIMEZONE_MAP_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), \ - CC_TYPE_TIMEZONE_MAP)) - -#define CC_TIMEZONE_MAP_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), \ - CC_TYPE_TIMEZONE_MAP, CcTimezoneMapClass)) - -typedef struct _CcTimezoneMap CcTimezoneMap; -typedef struct _CcTimezoneMapClass CcTimezoneMapClass; -typedef struct _CcTimezoneMapPrivate CcTimezoneMapPrivate; - -struct _CcTimezoneMap -{ - GtkWidget parent; - - CcTimezoneMapPrivate *priv; -}; - -struct _CcTimezoneMapClass -{ - GtkWidgetClass parent_class; -}; - -GType cc_timezone_map_get_type (void) G_GNUC_CONST; - -CcTimezoneMap *cc_timezone_map_new (void); - -void cc_timezone_map_set_watermark (CcTimezoneMap * map, - const gchar * watermark); -void cc_timezone_map_set_timezone (CcTimezoneMap *map, - const gchar *timezone); -void cc_timezone_map_set_coords (CcTimezoneMap *map, - gdouble lon, gdouble lat); -const gchar * cc_timezone_map_get_timezone_at_coords (CcTimezoneMap *map, - gdouble lon, gdouble lat); -TzLocation * cc_timezone_map_get_location (CcTimezoneMap *map); - -G_END_DECLS - -#endif /* _CC_TIMEZONE_MAP_H */ diff --git a/libmap/data/bg.png b/libmap/data/bg.png Binary files differdeleted file mode 100644 index 4180ee8..0000000 --- a/libmap/data/bg.png +++ /dev/null diff --git a/libmap/data/cc.png b/libmap/data/cc.png Binary files differdeleted file mode 100644 index 54fb668..0000000 --- a/libmap/data/cc.png +++ /dev/null diff --git a/libmap/data/olsen_map.png b/libmap/data/olsen_map.png Binary files differdeleted file mode 100644 index f9bb75c..0000000 --- a/libmap/data/olsen_map.png +++ /dev/null diff --git a/libmap/data/pin.png b/libmap/data/pin.png Binary files differdeleted file mode 100644 index 599a751..0000000 --- a/libmap/data/pin.png +++ /dev/null diff --git a/libmap/data/timezone_-1.png b/libmap/data/timezone_-1.png Binary files differdeleted file mode 100644 index fb00d83..0000000 --- a/libmap/data/timezone_-1.png +++ /dev/null diff --git a/libmap/data/timezone_-10.png b/libmap/data/timezone_-10.png Binary files differdeleted file mode 100644 index 472eb88..0000000 --- a/libmap/data/timezone_-10.png +++ /dev/null diff --git a/libmap/data/timezone_-11.png b/libmap/data/timezone_-11.png Binary files differdeleted file mode 100644 index 5f8c5d6..0000000 --- a/libmap/data/timezone_-11.png +++ /dev/null diff --git a/libmap/data/timezone_-2.png b/libmap/data/timezone_-2.png Binary files differdeleted file mode 100644 index 30a1ec7..0000000 --- a/libmap/data/timezone_-2.png +++ /dev/null diff --git a/libmap/data/timezone_-3.5.png b/libmap/data/timezone_-3.5.png Binary files differdeleted file mode 100644 index c1df00b..0000000 --- a/libmap/data/timezone_-3.5.png +++ /dev/null diff --git a/libmap/data/timezone_-3.png b/libmap/data/timezone_-3.png Binary files differdeleted file mode 100644 index c22dbb6..0000000 --- a/libmap/data/timezone_-3.png +++ /dev/null diff --git a/libmap/data/timezone_-4.5.png b/libmap/data/timezone_-4.5.png Binary files differdeleted file mode 100644 index 9e3c134..0000000 --- a/libmap/data/timezone_-4.5.png +++ /dev/null diff --git a/libmap/data/timezone_-4.png b/libmap/data/timezone_-4.png Binary files differdeleted file mode 100644 index 4b5a431..0000000 --- a/libmap/data/timezone_-4.png +++ /dev/null diff --git a/libmap/data/timezone_-5.5.png b/libmap/data/timezone_-5.5.png Binary files differdeleted file mode 100644 index b1c788d..0000000 --- a/libmap/data/timezone_-5.5.png +++ /dev/null diff --git a/libmap/data/timezone_-5.png b/libmap/data/timezone_-5.png Binary files differdeleted file mode 100644 index 06c15e6..0000000 --- a/libmap/data/timezone_-5.png +++ /dev/null diff --git a/libmap/data/timezone_-6.png b/libmap/data/timezone_-6.png Binary files differdeleted file mode 100644 index 8505fb1..0000000 --- a/libmap/data/timezone_-6.png +++ /dev/null diff --git a/libmap/data/timezone_-7.png b/libmap/data/timezone_-7.png Binary files differdeleted file mode 100644 index fec235d..0000000 --- a/libmap/data/timezone_-7.png +++ /dev/null diff --git a/libmap/data/timezone_-8.png b/libmap/data/timezone_-8.png Binary files differdeleted file mode 100644 index bdad7bf..0000000 --- a/libmap/data/timezone_-8.png +++ /dev/null diff --git a/libmap/data/timezone_-9.5.png b/libmap/data/timezone_-9.5.png Binary files differdeleted file mode 100644 index b1c788d..0000000 --- a/libmap/data/timezone_-9.5.png +++ /dev/null diff --git a/libmap/data/timezone_-9.png b/libmap/data/timezone_-9.png Binary files differdeleted file mode 100644 index 04cb3cb..0000000 --- a/libmap/data/timezone_-9.png +++ /dev/null diff --git a/libmap/data/timezone_0.png b/libmap/data/timezone_0.png Binary files differdeleted file mode 100644 index e59b773..0000000 --- a/libmap/data/timezone_0.png +++ /dev/null diff --git a/libmap/data/timezone_1.png b/libmap/data/timezone_1.png Binary files differdeleted file mode 100644 index 2053b7e..0000000 --- a/libmap/data/timezone_1.png +++ /dev/null diff --git a/libmap/data/timezone_10.5.png b/libmap/data/timezone_10.5.png Binary files differdeleted file mode 100644 index 6ec7f9f..0000000 --- a/libmap/data/timezone_10.5.png +++ /dev/null diff --git a/libmap/data/timezone_10.png b/libmap/data/timezone_10.png Binary files differdeleted file mode 100644 index 475dcf4..0000000 --- a/libmap/data/timezone_10.png +++ /dev/null diff --git a/libmap/data/timezone_11.5.png b/libmap/data/timezone_11.5.png Binary files differdeleted file mode 100644 index afdedd7..0000000 --- a/libmap/data/timezone_11.5.png +++ /dev/null diff --git a/libmap/data/timezone_11.png b/libmap/data/timezone_11.png Binary files differdeleted file mode 100644 index 6168aa2..0000000 --- a/libmap/data/timezone_11.png +++ /dev/null diff --git a/libmap/data/timezone_12.75.png b/libmap/data/timezone_12.75.png Binary files differdeleted file mode 100644 index 4f74a85..0000000 --- a/libmap/data/timezone_12.75.png +++ /dev/null diff --git a/libmap/data/timezone_12.png b/libmap/data/timezone_12.png Binary files differdeleted file mode 100644 index d0b3531..0000000 --- a/libmap/data/timezone_12.png +++ /dev/null diff --git a/libmap/data/timezone_13.png b/libmap/data/timezone_13.png Binary files differdeleted file mode 100644 index fe2f134..0000000 --- a/libmap/data/timezone_13.png +++ /dev/null diff --git a/libmap/data/timezone_2.png b/libmap/data/timezone_2.png Binary files differdeleted file mode 100644 index ec1e874..0000000 --- a/libmap/data/timezone_2.png +++ /dev/null diff --git a/libmap/data/timezone_3.5.png b/libmap/data/timezone_3.5.png Binary files differdeleted file mode 100644 index 2dc7399..0000000 --- a/libmap/data/timezone_3.5.png +++ /dev/null diff --git a/libmap/data/timezone_3.png b/libmap/data/timezone_3.png Binary files differdeleted file mode 100644 index eda59dc..0000000 --- a/libmap/data/timezone_3.png +++ /dev/null diff --git a/libmap/data/timezone_4.5.png b/libmap/data/timezone_4.5.png Binary files differdeleted file mode 100644 index e09ed90..0000000 --- a/libmap/data/timezone_4.5.png +++ /dev/null diff --git a/libmap/data/timezone_4.png b/libmap/data/timezone_4.png Binary files differdeleted file mode 100644 index 483dc53..0000000 --- a/libmap/data/timezone_4.png +++ /dev/null diff --git a/libmap/data/timezone_5.5.png b/libmap/data/timezone_5.5.png Binary files differdeleted file mode 100644 index f904cc2..0000000 --- a/libmap/data/timezone_5.5.png +++ /dev/null diff --git a/libmap/data/timezone_5.75.png b/libmap/data/timezone_5.75.png Binary files differdeleted file mode 100644 index 827ce1a..0000000 --- a/libmap/data/timezone_5.75.png +++ /dev/null diff --git a/libmap/data/timezone_5.png b/libmap/data/timezone_5.png Binary files differdeleted file mode 100644 index 1bb6d20..0000000 --- a/libmap/data/timezone_5.png +++ /dev/null diff --git a/libmap/data/timezone_6.5.png b/libmap/data/timezone_6.5.png Binary files differdeleted file mode 100644 index d307bf3..0000000 --- a/libmap/data/timezone_6.5.png +++ /dev/null diff --git a/libmap/data/timezone_6.png b/libmap/data/timezone_6.png Binary files differdeleted file mode 100644 index 460f9cf..0000000 --- a/libmap/data/timezone_6.png +++ /dev/null diff --git a/libmap/data/timezone_7.png b/libmap/data/timezone_7.png Binary files differdeleted file mode 100644 index 239115a..0000000 --- a/libmap/data/timezone_7.png +++ /dev/null diff --git a/libmap/data/timezone_8.png b/libmap/data/timezone_8.png Binary files differdeleted file mode 100644 index 3627686..0000000 --- a/libmap/data/timezone_8.png +++ /dev/null diff --git a/libmap/data/timezone_9.5.png b/libmap/data/timezone_9.5.png Binary files differdeleted file mode 100644 index 1c3290c..0000000 --- a/libmap/data/timezone_9.5.png +++ /dev/null diff --git a/libmap/data/timezone_9.png b/libmap/data/timezone_9.png Binary files differdeleted file mode 100644 index 65d2e46..0000000 --- a/libmap/data/timezone_9.png +++ /dev/null diff --git a/libmap/test-timezone.c b/libmap/test-timezone.c deleted file mode 100644 index c1935fd..0000000 --- a/libmap/test-timezone.c +++ /dev/null @@ -1,56 +0,0 @@ -#include <config.h> -#include <locale.h> - -#include "tz.h" - -int main (int argc, char **argv) -{ - TzDB *db; - GPtrArray *locs; - guint i; - char *pixmap_dir; - int retval = 0; - - setlocale (LC_ALL, ""); - - if (argc == 2) { - pixmap_dir = g_strdup (argv[1]); - } else if (argc == 1) { - pixmap_dir = g_strdup ("data/"); - } else { - g_message ("Usage: %s [PIXMAP DIRECTORY]", argv[0]); - return 1; - } - - db = tz_load_db (); - locs = tz_get_locations (db); - for (i = 0; i < locs->len ; i++) { - TzLocation *loc = locs->pdata[i]; - TzInfo *info; - char *filename, *path; - gdouble selected_offset; - char buf[16]; - - info = tz_info_from_location (loc); - selected_offset = tz_location_get_utc_offset (loc) - / (60.0*60.0) + ((info->daylight) ? -1.0 : 0.0); - - filename = g_strdup_printf ("timezone_%s.png", - g_ascii_formatd (buf, sizeof (buf), - "%g", selected_offset)); - path = g_build_filename (pixmap_dir, filename, NULL); - - if (g_file_test (path, G_FILE_TEST_IS_REGULAR) == FALSE) { - g_message ("File '%s' missing for zone '%s'", filename, loc->zone); - retval = 1; - } - - g_free (filename); - g_free (path); - tz_info_free (info); - } - tz_db_free (db); - g_free (pixmap_dir); - - return retval; -} diff --git a/libmap/tz.c b/libmap/tz.c deleted file mode 100644 index b77a8ef..0000000 --- a/libmap/tz.c +++ /dev/null @@ -1,399 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* Generic timezone utilities. - * - * Copyright (C) 2000-2001 Ximian, Inc. - * - * Authors: Hans Petter Jansson <hpj@ximian.com> - * - * Largely based on Michael Fulbright's work on Anaconda. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - - -#include <glib.h> -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <time.h> -#include <math.h> -#include <string.h> -#include "tz.h" - - -/* Forward declarations for private functions */ - -static float convert_pos (gchar *pos, int digits); -static int compare_country_names (const void *a, const void *b); -static void sort_locations_by_country (GPtrArray *locations); -static gchar * tz_data_file_get (void); - - -/* ---------------- * - * Public interface * - * ---------------- */ -TzDB * -tz_load_db (void) -{ - gchar *tz_data_file; - TzDB *tz_db; - FILE *tzfile; - char buf[4096]; - - tz_data_file = tz_data_file_get (); - if (!tz_data_file) { - g_warning ("Could not get the TimeZone data file name"); - return NULL; - } - tzfile = fopen (tz_data_file, "r"); - if (!tzfile) { - g_warning ("Could not open *%s*\n", tz_data_file); - g_free (tz_data_file); - return NULL; - } - - tz_db = g_new0 (TzDB, 1); - tz_db->locations = g_ptr_array_new (); - - while (fgets (buf, sizeof(buf), tzfile)) - { - gchar **tmpstrarr; - gchar *latstr, *lngstr, *p; - TzLocation *loc; - - if (*buf == '#') continue; - - g_strchomp(buf); - tmpstrarr = g_strsplit(buf,"\t", 6); - - latstr = g_strdup (tmpstrarr[1]); - p = latstr + 1; - while (*p != '-' && *p != '+') p++; - lngstr = g_strdup (p); - *p = '\0'; - - loc = g_new0 (TzLocation, 1); - loc->country = g_strdup (tmpstrarr[0]); - loc->zone = g_strdup (tmpstrarr[2]); - loc->latitude = convert_pos (latstr, 2); - loc->longitude = convert_pos (lngstr, 3); - -#ifdef __sun - if (tmpstrarr[3] && *tmpstrarr[3] == '-' && tmpstrarr[4]) - loc->comment = g_strdup (tmpstrarr[4]); - - if (tmpstrarr[3] && *tmpstrarr[3] != '-' && !islower(loc->zone)) { - TzLocation *locgrp; - - /* duplicate entry */ - locgrp = g_new0 (TzLocation, 1); - locgrp->country = g_strdup (tmpstrarr[0]); - locgrp->zone = g_strdup (tmpstrarr[3]); - locgrp->latitude = convert_pos (latstr, 2); - locgrp->longitude = convert_pos (lngstr, 3); - locgrp->comment = (tmpstrarr[4]) ? g_strdup (tmpstrarr[4]) : NULL; - - g_ptr_array_add (tz_db->locations, (gpointer) locgrp); - } -#else - loc->comment = (tmpstrarr[3]) ? g_strdup(tmpstrarr[3]) : NULL; -#endif - - g_ptr_array_add (tz_db->locations, (gpointer) loc); - - g_free (latstr); - g_free (lngstr); - g_strfreev (tmpstrarr); - } - - fclose (tzfile); - - /* now sort by country */ - sort_locations_by_country (tz_db->locations); - - g_free (tz_data_file); - - return tz_db; -} - -static void -tz_location_free (TzLocation *loc) -{ - g_free (loc->country); - g_free (loc->zone); - g_free (loc->comment); - - g_free (loc); -} - -void -tz_db_free (TzDB *db) -{ - g_ptr_array_foreach (db->locations, (GFunc) tz_location_free, NULL); - g_ptr_array_free (db->locations, TRUE); - g_free (db); -} - -static gint -sort_locations (TzLocation *a, - TzLocation *b) -{ - if (a->dist > b->dist) - return 1; - - if (a->dist < b->dist) - return -1; - - return 0; -} - -static gdouble -convert_longtitude_to_x (gdouble longitude, gint map_width) -{ - const gdouble xdeg_offset = -6; - gdouble x; - - x = (map_width * (180.0 + longitude) / 360.0) - + (map_width * xdeg_offset / 180.0); - - return x; -} - -static gdouble -radians (gdouble degrees) -{ - return (degrees / 360.0) * G_PI * 2; -} - -static gdouble -convert_latitude_to_y (gdouble latitude, gdouble map_height) -{ - gdouble bottom_lat = -59; - gdouble top_lat = 81; - gdouble top_per, y, full_range, top_offset, map_range; - - top_per = top_lat / 180.0; - y = 1.25 * log (tan (G_PI_4 + 0.4 * radians (latitude))); - full_range = 4.6068250867599998; - top_offset = full_range * top_per; - map_range = fabs (1.25 * log (tan (G_PI_4 + 0.4 * radians (bottom_lat))) - top_offset); - y = fabs (y - top_offset); - y = y / map_range; - y = y * map_height; - return y; -} - -GPtrArray * -tz_get_locations (TzDB *db) -{ - return db->locations; -} - - -gchar * -tz_location_get_country (TzLocation *loc) -{ - return loc->country; -} - - -gchar * -tz_location_get_zone (TzLocation *loc) -{ - return loc->zone; -} - - -gchar * -tz_location_get_comment (TzLocation *loc) -{ - return loc->comment; -} - - -void -tz_location_get_position (TzLocation *loc, double *longitude, double *latitude) -{ - *longitude = loc->longitude; - *latitude = loc->latitude; -} - -glong -tz_location_get_utc_offset (TzLocation *loc) -{ - TzInfo *tz_info; - glong offset; - - tz_info = tz_info_from_location (loc); - offset = tz_info->utc_offset; - tz_info_free (tz_info); - return offset; -} - -gint -tz_location_set_locally (TzLocation *loc) -{ - time_t curtime; - struct tm *curzone; - gboolean is_dst = FALSE; - gint correction = 0; - - g_return_val_if_fail (loc != NULL, 0); - g_return_val_if_fail (loc->zone != NULL, 0); - - curtime = time (NULL); - curzone = localtime (&curtime); - is_dst = curzone->tm_isdst; - - setenv ("TZ", loc->zone, 1); -#if 0 - curtime = time (NULL); - curzone = localtime (&curtime); - - if (!is_dst && curzone->tm_isdst) { - correction = (60 * 60); - } - else if (is_dst && !curzone->tm_isdst) { - correction = 0; - } -#endif - - return correction; -} - -TzInfo * -tz_info_from_location (TzLocation *loc) -{ - TzInfo *tzinfo; - time_t curtime; - struct tm *curzone; - - g_return_val_if_fail (loc != NULL, NULL); - g_return_val_if_fail (loc->zone != NULL, NULL); - - setenv ("TZ", loc->zone, 1); - -#if 0 - tzset (); -#endif - tzinfo = g_new0 (TzInfo, 1); - - curtime = time (NULL); - curzone = localtime (&curtime); - -#ifndef __sun - /* Currently this solution doesnt seem to work - I get that */ - /* America/Phoenix uses daylight savings, which is wrong */ - tzinfo->tzname_normal = g_strdup (curzone->tm_zone); - if (curzone->tm_isdst) - tzinfo->tzname_daylight = - g_strdup (&curzone->tm_zone[curzone->tm_isdst]); - else - tzinfo->tzname_daylight = NULL; - - tzinfo->utc_offset = curzone->tm_gmtoff; -#else - tzinfo->tzname_normal = NULL; - tzinfo->tzname_daylight = NULL; - tzinfo->utc_offset = 0; -#endif - - tzinfo->daylight = curzone->tm_isdst; - - return tzinfo; -} - - -void -tz_info_free (TzInfo *tzinfo) -{ - g_return_if_fail (tzinfo != NULL); - - if (tzinfo->tzname_normal) g_free (tzinfo->tzname_normal); - if (tzinfo->tzname_daylight) g_free (tzinfo->tzname_daylight); - g_free (tzinfo); -} - -/* ----------------- * - * Private functions * - * ----------------- */ - -static gchar * -tz_data_file_get (void) -{ - gchar *file; - - file = g_strdup (TZ_DATA_FILE); - - return file; -} - -static float -convert_pos (gchar *pos, int digits) -{ - gchar whole[10]; - gchar *fraction; - gint i; - float t1, t2; - - if (!pos || strlen(pos) < 4 || digits > 9) return 0.0; - - for (i = 0; i < digits + 1; i++) whole[i] = pos[i]; - whole[i] = '\0'; - fraction = pos + digits + 1; - - t1 = g_strtod (whole, NULL); - t2 = g_strtod (fraction, NULL); - - if (t1 >= 0.0) return t1 + t2/pow (10.0, strlen(fraction)); - else return t1 - t2/pow (10.0, strlen(fraction)); -} - - -#if 0 - -/* Currently not working */ -static void -free_tzdata (TzLocation *tz) -{ - - if (tz->country) - g_free(tz->country); - if (tz->zone) - g_free(tz->zone); - if (tz->comment) - g_free(tz->comment); - - g_free(tz); -} -#endif - - -static int -compare_country_names (const void *a, const void *b) -{ - const TzLocation *tza = * (TzLocation **) a; - const TzLocation *tzb = * (TzLocation **) b; - - return strcmp (tza->zone, tzb->zone); -} - - -static void -sort_locations_by_country (GPtrArray *locations) -{ - qsort (locations->pdata, locations->len, sizeof (gpointer), - compare_country_names); -} diff --git a/libmap/tz.h b/libmap/tz.h deleted file mode 100644 index 91281a5..0000000 --- a/libmap/tz.h +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* Generic timezone utilities. - * - * Copyright (C) 2000-2001 Ximian, Inc. - * - * Authors: Hans Petter Jansson <hpj@ximian.com> - * - * Largely based on Michael Fulbright's work on Anaconda. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - - -#ifndef _E_TZ_H -#define _E_TZ_H - -#include <glib.h> - -#ifndef __sun -# define TZ_DATA_FILE "/usr/share/zoneinfo/zone.tab" -#else -# define TZ_DATA_FILE "/usr/share/lib/zoneinfo/tab/zone_sun.tab" -#endif - -typedef struct _TzDB TzDB; -typedef struct _TzLocation TzLocation; -typedef struct _TzInfo TzInfo; - - -struct _TzDB -{ - GPtrArray *locations; -}; - -struct _TzLocation -{ - gchar *country; - gdouble latitude; - gdouble longitude; - gchar *zone; - gchar *comment; - - gdouble dist; /* distance to clicked point for comparison */ -}; - -/* see the glibc info page information on time zone information */ -/* tzname_normal is the default name for the timezone */ -/* tzname_daylight is the name of the zone when in daylight savings */ -/* utc_offset is offset in seconds from utc */ -/* daylight if non-zero then location obeys daylight savings */ - -struct _TzInfo -{ - gchar *tzname_normal; - gchar *tzname_daylight; - glong utc_offset; - gint daylight; -}; - - -TzDB *tz_load_db (void); -void tz_db_free (TzDB *db); -GPtrArray *tz_get_locations (TzDB *db); -void tz_location_get_position (TzLocation *loc, - double *longitude, double *latitude); -char *tz_location_get_country (TzLocation *loc); -gchar *tz_location_get_zone (TzLocation *loc); -gchar *tz_location_get_comment (TzLocation *loc); -glong tz_location_get_utc_offset (TzLocation *loc); -gint tz_location_set_locally (TzLocation *loc); -TzInfo *tz_info_from_location (TzLocation *loc); -void tz_info_free (TzInfo *tz_info); - -#endif diff --git a/po/LINGUAS b/po/LINGUAS deleted file mode 100644 index dd5940e..0000000 --- a/po/LINGUAS +++ /dev/null @@ -1,31 +0,0 @@ -ar -bg -cs -da -de -el -es -fi -fr -he -hi -hr -hu -it -ja -ko -nb -nl -pl -pt -pt_BR -ro -ru -sk -sl -sr -sv -th -tr -zh_CN -zh_TW diff --git a/po/POTFILES.in b/po/POTFILES.in index d22e5f9..e69de29 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,8 +0,0 @@ -src/indicator-datetime.c -src/datetime-service.c -src/datetime-prefs.c -src/datetime-prefs-locations.c -src/utils.c -src/settings-shared.h -[type: gettext/glade]data/datetime-dialog.ui -data/indicator-datetime-preferences.desktop.in diff --git a/po/ar.po b/po/ar.po deleted file mode 100644 index 96ad24b..0000000 --- a/po/ar.po +++ /dev/null @@ -1,44 +0,0 @@ -# Arabic translations for PACKAGE package.
-# Copyright (C) 2010 THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# Canonical OEM, 2010.
-#
-msgid "" -msgstr "" -"Project-Id-Version: indicator-datetime\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-03-10 15:20-0500\n" -"PO-Revision-Date: 2010-03-03 10:05-0500\n" -"Last-Translator: Canonical OEM\n" -"Language-Team: Arabic\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" - -#: ../src/indicator-datetime.c:177 -msgid "Error getting time" -msgstr "خطأ في الحصول على الوقت" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:259 -#, c-format -msgid "%d%d:%d%d AM" -msgstr "%d%d:%d%d صباحا" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:266 -#, c-format -msgid "%d%d:%d%d PM" -msgstr "%d%d:%d%d مساء" - -#: ../src/indicator-datetime.c:351 -msgid "Open Calendar" -msgstr "التقويم المفتوح (Open Calendar)" - -#: ../src/indicator-datetime.c:361 -msgid "Set Time and Date..." -msgstr "ضبط الوقت والتاريخ..." diff --git a/po/bg.po b/po/bg.po deleted file mode 100644 index 0eaac8a..0000000 --- a/po/bg.po +++ /dev/null @@ -1,44 +0,0 @@ -# Bulgarian translations for PACKAGE package.
-# Copyright (C) 2010 THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# Canonical OEM, 2010.
-#
-msgid "" -msgstr "" -"Project-Id-Version: indicator-datetime\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-03-10 15:20-0500\n" -"PO-Revision-Date: 2010-03-03 10:05-0500\n" -"Last-Translator: Canonical OEM\n" -"Language-Team: Bulgarian\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" - -#: ../src/indicator-datetime.c:177 -msgid "Error getting time" -msgstr "Грешка при проверка на време" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:259 -#, c-format -msgid "%d%d:%d%d AM" -msgstr "%d%d:%d%d преди обяд" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:266 -#, c-format -msgid "%d%d:%d%d PM" -msgstr "%d%d:%d%d следобед" - -#: ../src/indicator-datetime.c:351 -msgid "Open Calendar" -msgstr "Отвори календар" - -#: ../src/indicator-datetime.c:361 -msgid "Set Time and Date..." -msgstr "Свери час и дата..." diff --git a/po/cs.po b/po/cs.po deleted file mode 100644 index 6cfd9bb..0000000 --- a/po/cs.po +++ /dev/null @@ -1,45 +0,0 @@ -# Czech translations for PACKAGE package.
-# Copyright (C) 2010 THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# Canonical OEM, 2010.
-#
-msgid "" -msgstr "" -"Project-Id-Version: indicator-datetime\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-03-10 15:20-0500\n" -"PO-Revision-Date: 2010-03-03 10:06-0500\n" -"Last-Translator: Canonical OEM\n" -"Language-Team: Czech\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n" - -#: ../src/indicator-datetime.c:177 -msgid "Error getting time" -msgstr "Chyba získání času" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:259 -#, c-format -msgid "%d%d:%d%d AM" -msgstr "%d%d:%d%d dop." - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:266 -#, c-format -msgid "%d%d:%d%d PM" -msgstr "%d%d:%d%d odp." - -#: ../src/indicator-datetime.c:351 -msgid "Open Calendar" -msgstr "Otevřít kalendář" - -#: ../src/indicator-datetime.c:361 -msgid "Set Time and Date..." -msgstr "Nastavit čas a datum..." diff --git a/po/da.po b/po/da.po deleted file mode 100644 index 684f89e..0000000 --- a/po/da.po +++ /dev/null @@ -1,45 +0,0 @@ -# Danish translations for PACKAGE package.
-# Copyright (C) 2010 THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# Canonical OEM, 2010.
-#
-msgid "" -msgstr "" -"Project-Id-Version: indicator-datetime\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-03-10 15:20-0500\n" -"PO-Revision-Date: 2010-03-03 10:06-0500\n" -"Last-Translator: Canonical OEM\n" -"Language-Team: Danish\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: ../src/indicator-datetime.c:177 -msgid "Error getting time" -msgstr "Fejl ved hentning af klokkeslæt" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:259 -#, c-format -msgid "%d%d:%d%d AM" -msgstr "%d%d.%d%d AM" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:266 -#, c-format -msgid "%d%d:%d%d PM" -msgstr "%d%d.%d%d PM" - -#: ../src/indicator-datetime.c:351 -msgid "Open Calendar" -msgstr "Åbn Kalender" - -#: ../src/indicator-datetime.c:361 -msgid "Set Time and Date..." -msgstr "Indstil klokkeslæt og dato..." diff --git a/po/de.po b/po/de.po deleted file mode 100644 index 93f2748..0000000 --- a/po/de.po +++ /dev/null @@ -1,45 +0,0 @@ -# German translations for PACKAGE package.
-# Copyright (C) 2010 THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# Canonical OEM, 2010.
-#
-msgid "" -msgstr "" -"Project-Id-Version: indicator-datetime\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-03-10 15:20-0500\n" -"PO-Revision-Date: 2010-03-03 10:06-0500\n" -"Last-Translator: Canonical OEM\n" -"Language-Team: German\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: ../src/indicator-datetime.c:177 -msgid "Error getting time" -msgstr "Fehler beim Abrufen der Zeit" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:259 -#, c-format -msgid "%d%d:%d%d AM" -msgstr "%d%d:%d%d AM" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:266 -#, c-format -msgid "%d%d:%d%d PM" -msgstr "%d%d:%d%d PM" - -#: ../src/indicator-datetime.c:351 -msgid "Open Calendar" -msgstr "Kalender öffnen" - -#: ../src/indicator-datetime.c:361 -msgid "Set Time and Date..." -msgstr "Datum und Uhrzeit einstellen." diff --git a/po/el.po b/po/el.po deleted file mode 100644 index 9355a53..0000000 --- a/po/el.po +++ /dev/null @@ -1,45 +0,0 @@ -# Greek translations for PACKAGE package.
-# Copyright (C) 2010 THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# Canonical OEM, 2010.
-#
-msgid "" -msgstr "" -"Project-Id-Version: indicator-datetime\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-03-10 15:20-0500\n" -"PO-Revision-Date: 2010-03-03 10:06-0500\n" -"Last-Translator: Canonical OEM\n" -"Language-Team: Greek\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: ../src/indicator-datetime.c:177 -msgid "Error getting time" -msgstr "Σφάλμα κατά τη λήψη του χρόνου" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:259 -#, c-format -msgid "%d%d:%d%d AM" -msgstr "%d%d:%d%d π.μ." - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:266 -#, c-format -msgid "%d%d:%d%d PM" -msgstr "%d%d:%d%d μ.μ." - -#: ../src/indicator-datetime.c:351 -msgid "Open Calendar" -msgstr "Άνοιγμα ημερολογίου" - -#: ../src/indicator-datetime.c:361 -msgid "Set Time and Date..." -msgstr "Ορισμός ώρας και ημερομηνίας..." diff --git a/po/es.po b/po/es.po deleted file mode 100644 index 4dcafd3..0000000 --- a/po/es.po +++ /dev/null @@ -1,45 +0,0 @@ -# Spanish translations for PACKAGE package.
-# Copyright (C) 2010 THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# Canonical OEM, 2010.
-#
-msgid "" -msgstr "" -"Project-Id-Version: indicator-datetime\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-03-10 15:20-0500\n" -"PO-Revision-Date: 2010-03-03 10:06-0500\n" -"Last-Translator: Canonical OEM\n" -"Language-Team: Spanish\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: ../src/indicator-datetime.c:177 -msgid "Error getting time" -msgstr "Error al obtener la hora" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:259 -#, c-format -msgid "%d%d:%d%d AM" -msgstr "%d%d:%d%d AM" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:266 -#, c-format -msgid "%d%d:%d%d PM" -msgstr "%d%d:%d%d PM" - -#: ../src/indicator-datetime.c:351 -msgid "Open Calendar" -msgstr "Abrir calendario" - -#: ../src/indicator-datetime.c:361 -msgid "Set Time and Date..." -msgstr "Ajustar fecha y hora..." diff --git a/po/fi.po b/po/fi.po deleted file mode 100644 index ed15e58..0000000 --- a/po/fi.po +++ /dev/null @@ -1,45 +0,0 @@ -# Finnish translations for PACKAGE package.
-# Copyright (C) 2010 THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# Canonical OEM, 2010.
-#
-msgid "" -msgstr "" -"Project-Id-Version: indicator-datetime\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-03-10 15:20-0500\n" -"PO-Revision-Date: 2010-03-03 10:06-0500\n" -"Last-Translator: Canonical OEM\n" -"Language-Team: Finnish\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: ../src/indicator-datetime.c:177 -msgid "Error getting time" -msgstr "Virheen noudettaessa aikaa" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:259 -#, c-format -msgid "%d%d:%d%d AM" -msgstr "%d%d:%d%d AP" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:266 -#, c-format -msgid "%d%d:%d%d PM" -msgstr "%d%d:%d%d IP" - -#: ../src/indicator-datetime.c:351 -msgid "Open Calendar" -msgstr "Avaa kalenteri" - -#: ../src/indicator-datetime.c:361 -msgid "Set Time and Date..." -msgstr "Aseta kellonaika ja päivämäärä..." diff --git a/po/fr.po b/po/fr.po deleted file mode 100644 index 930ef4d..0000000 --- a/po/fr.po +++ /dev/null @@ -1,45 +0,0 @@ -# French translations for PACKAGE package.
-# Copyright (C) 2010 THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# Canonical OEM, 2010.
-#
-msgid "" -msgstr "" -"Project-Id-Version: indicator-datetime\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-03-10 15:20-0500\n" -"PO-Revision-Date: 2010-03-03 10:06-0500\n" -"Last-Translator: Canonical OEM\n" -"Language-Team: French\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n > 1);\n" - -#: ../src/indicator-datetime.c:177 -msgid "Error getting time" -msgstr "Erreur lors de l'obtention de l'heure" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:259 -#, c-format -msgid "%d%d:%d%d AM" -msgstr "%d%d:%d%d AM" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:266 -#, c-format -msgid "%d%d:%d%d PM" -msgstr "%d%d:%d%d PM" - -#: ../src/indicator-datetime.c:351 -msgid "Open Calendar" -msgstr "Ouvrir le calendrier" - -#: ../src/indicator-datetime.c:361 -msgid "Set Time and Date..." -msgstr "Régler la date et l'heure..." diff --git a/po/he.po b/po/he.po deleted file mode 100644 index 20b41bb..0000000 --- a/po/he.po +++ /dev/null @@ -1,45 +0,0 @@ -# Hebrew translations for PACKAGE package.
-# Copyright (C) 2010 THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# Canonical OEM, 2010.
-#
-msgid "" -msgstr "" -"Project-Id-Version: indicator-datetime\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-03-10 15:20-0500\n" -"PO-Revision-Date: 2010-03-03 10:06-0500\n" -"Last-Translator: Canonical OEM\n" -"Language-Team: Hebrew\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: ../src/indicator-datetime.c:177 -msgid "Error getting time" -msgstr "שגיאה בקבלת השעה" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:259 -#, c-format -msgid "%d%d:%d%d AM" -msgstr "%d%d:%d%d AM" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:266 -#, c-format -msgid "%d%d:%d%d PM" -msgstr "%d%d:%d%d PM" - -#: ../src/indicator-datetime.c:351 -msgid "Open Calendar" -msgstr "פתח לוח שנה" - -#: ../src/indicator-datetime.c:361 -msgid "Set Time and Date..." -msgstr "הגדרת שעה ותאריך..." diff --git a/po/hi.po b/po/hi.po deleted file mode 100644 index 3f453c0..0000000 --- a/po/hi.po +++ /dev/null @@ -1,44 +0,0 @@ -# Hindi translations for PACKAGE package.
-# Copyright (C) 2010 THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# Canonical OEM, 2010.
-#
-msgid "" -msgstr "" -"Project-Id-Version: indicator-datetime\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-03-10 15:20-0500\n" -"PO-Revision-Date: 2010-03-03 10:06-0500\n" -"Last-Translator: Canonical OEM\n" -"Language-Team: Hindi\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" - -#: ../src/indicator-datetime.c:177 -msgid "Error getting time" -msgstr "समय प्राप्त करने में त्रुटि" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:259 -#, c-format -msgid "%d%d:%d%d AM" -msgstr "प्रातः %d%d:%d%d बजे" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:266 -#, c-format -msgid "%d%d:%d%d PM" -msgstr "सायं %d%d:%d%d बजे" - -#: ../src/indicator-datetime.c:351 -msgid "Open Calendar" -msgstr "कैलेंडर खोलें" - -#: ../src/indicator-datetime.c:361 -msgid "Set Time and Date..." -msgstr "समय और तिथि सेट करें..." diff --git a/po/hr.po b/po/hr.po deleted file mode 100644 index 66c28d4..0000000 --- a/po/hr.po +++ /dev/null @@ -1,46 +0,0 @@ -# Croatian translations for PACKAGE package.
-# Copyright (C) 2010 THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# Canonical OEM, 2010.
-#
-msgid "" -msgstr "" -"Project-Id-Version: indicator-datetime\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-03-10 15:20-0500\n" -"PO-Revision-Date: 2010-03-03 10:06-0500\n" -"Last-Translator: Canonical OEM\n" -"Language-Team: Croatian\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%" -"10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" - -#: ../src/indicator-datetime.c:177 -msgid "Error getting time" -msgstr "Greška pri dohvaćanju vremena" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:259 -#, c-format -msgid "%d%d:%d%d AM" -msgstr "%d%d%d%d AM" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:266 -#, c-format -msgid "%d%d:%d%d PM" -msgstr "%d%d%d%d PM" - -#: ../src/indicator-datetime.c:351 -msgid "Open Calendar" -msgstr "Otvori kalendar" - -#: ../src/indicator-datetime.c:361 -msgid "Set Time and Date..." -msgstr "Postavi vrijeme i datum..." diff --git a/po/hu.po b/po/hu.po deleted file mode 100644 index de2bcee..0000000 --- a/po/hu.po +++ /dev/null @@ -1,45 +0,0 @@ -# Hungarian translations for PACKAGE package.
-# Copyright (C) 2010 THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# Canonical OEM, 2010.
-#
-msgid "" -msgstr "" -"Project-Id-Version: indicator-datetime\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-03-10 15:20-0500\n" -"PO-Revision-Date: 2010-03-03 10:06-0500\n" -"Last-Translator: Canonical OEM\n" -"Language-Team: Hungarian\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: ../src/indicator-datetime.c:177 -msgid "Error getting time" -msgstr "Hiba az idő lekérésekor" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:259 -#, c-format -msgid "%d%d:%d%d AM" -msgstr "%d%d:%d%d de." - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:266 -#, c-format -msgid "%d%d:%d%d PM" -msgstr "%d%d:%d%d du." - -#: ../src/indicator-datetime.c:351 -msgid "Open Calendar" -msgstr "Naptár megnyitása" - -#: ../src/indicator-datetime.c:361 -msgid "Set Time and Date..." -msgstr "Idő és dátum beállítása..." diff --git a/po/it.po b/po/it.po deleted file mode 100644 index 839ab2e..0000000 --- a/po/it.po +++ /dev/null @@ -1,45 +0,0 @@ -# Italian translations for PACKAGE package.
-# Copyright (C) 2010 THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# Canonical OEM, 2010.
-#
-msgid "" -msgstr "" -"Project-Id-Version: indicator-datetime\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-03-10 15:20-0500\n" -"PO-Revision-Date: 2010-03-03 10:06-0500\n" -"Last-Translator: Canonical OEM\n" -"Language-Team: Italian\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: ../src/indicator-datetime.c:177 -msgid "Error getting time" -msgstr "Errore nell'acquisizione dell'orario" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:259 -#, c-format -msgid "%d%d:%d%d AM" -msgstr "%d%d:%d%d AM" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:266 -#, c-format -msgid "%d%d:%d%d PM" -msgstr "%d%d:%d%d PM" - -#: ../src/indicator-datetime.c:351 -msgid "Open Calendar" -msgstr "Apri calendario" - -#: ../src/indicator-datetime.c:361 -msgid "Set Time and Date..." -msgstr "Imposta data e ora..." diff --git a/po/ja.po b/po/ja.po deleted file mode 100644 index 02c90b7..0000000 --- a/po/ja.po +++ /dev/null @@ -1,45 +0,0 @@ -# Japanese translations for PACKAGE package.
-# Copyright (C) 2010 THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# Canonical OEM, 2010.
-#
-msgid "" -msgstr "" -"Project-Id-Version: indicator-datetime\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-03-10 15:20-0500\n" -"PO-Revision-Date: 2010-03-03 10:06-0500\n" -"Last-Translator: Canonical OEM\n" -"Language-Team: Japanese\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" - -#: ../src/indicator-datetime.c:177 -msgid "Error getting time" -msgstr "時刻を取得できません" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:259 -#, c-format -msgid "%d%d:%d%d AM" -msgstr "午前 %d%d:%d%d" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:266 -#, c-format -msgid "%d%d:%d%d PM" -msgstr "午後 %d%d:%d%d" - -#: ../src/indicator-datetime.c:351 -msgid "Open Calendar" -msgstr "カレンダーを開く" - -#: ../src/indicator-datetime.c:361 -msgid "Set Time and Date..." -msgstr "時刻と日付の設定..." diff --git a/po/ko.po b/po/ko.po deleted file mode 100644 index 0406690..0000000 --- a/po/ko.po +++ /dev/null @@ -1,45 +0,0 @@ -# Korean translations for PACKAGE package.
-# Copyright (C) 2010 THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# Canonical OEM, 2010.
-#
-msgid "" -msgstr "" -"Project-Id-Version: indicator-datetime\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-03-10 15:20-0500\n" -"PO-Revision-Date: 2010-03-03 10:06-0500\n" -"Last-Translator: Canonical OEM\n" -"Language-Team: Korean\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" - -#: ../src/indicator-datetime.c:177 -msgid "Error getting time" -msgstr "시간 가져오기 오류" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:259 -#, c-format -msgid "%d%d:%d%d AM" -msgstr "오전 %d%d:%d%d" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:266 -#, c-format -msgid "%d%d:%d%d PM" -msgstr "오후 %d%d:%d%d" - -#: ../src/indicator-datetime.c:351 -msgid "Open Calendar" -msgstr "일정 열기" - -#: ../src/indicator-datetime.c:361 -msgid "Set Time and Date..." -msgstr "시간 및 날짜 설정..." diff --git a/po/nb.po b/po/nb.po deleted file mode 100644 index deb0de8..0000000 --- a/po/nb.po +++ /dev/null @@ -1,45 +0,0 @@ -# Norwegian Bokmal translations for PACKAGE package.
-# Copyright (C) 2010 THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# Canonical OEM, 2010.
-#
-msgid "" -msgstr "" -"Project-Id-Version: indicator-datetime\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-03-10 15:20-0500\n" -"PO-Revision-Date: 2010-03-03 10:06-0500\n" -"Last-Translator: Canonical OEM\n" -"Language-Team: Norwegian Bokmal\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: ../src/indicator-datetime.c:177 -msgid "Error getting time" -msgstr "Feil under henting av klokkeslett" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:259 -#, c-format -msgid "%d%d:%d%d AM" -msgstr "%d%d:%d%d AM" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:266 -#, c-format -msgid "%d%d:%d%d PM" -msgstr "%d%d:%d%d PM" - -#: ../src/indicator-datetime.c:351 -msgid "Open Calendar" -msgstr "Åpne kalender" - -#: ../src/indicator-datetime.c:361 -msgid "Set Time and Date..." -msgstr "Angi dato og klokkeslett..." diff --git a/po/nl.po b/po/nl.po deleted file mode 100644 index 96df725..0000000 --- a/po/nl.po +++ /dev/null @@ -1,45 +0,0 @@ -# Dutch translations for PACKAGE package.
-# Copyright (C) 2010 THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# Canonical OEM, 2010.
-#
-msgid "" -msgstr "" -"Project-Id-Version: indicator-datetime\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-03-10 15:20-0500\n" -"PO-Revision-Date: 2010-03-03 10:06-0500\n" -"Last-Translator: Canonical OEM\n" -"Language-Team: Dutch\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: ../src/indicator-datetime.c:177 -msgid "Error getting time" -msgstr "Fout bij lezen van tijd" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:259 -#, c-format -msgid "%d%d:%d%d AM" -msgstr "%d%d%d%d VM" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:266 -#, c-format -msgid "%d%d:%d%d PM" -msgstr "%d%d%d%d NM" - -#: ../src/indicator-datetime.c:351 -msgid "Open Calendar" -msgstr "Kalender openen" - -#: ../src/indicator-datetime.c:361 -msgid "Set Time and Date..." -msgstr "Datum en tijd instellen..." diff --git a/po/pl.po b/po/pl.po deleted file mode 100644 index 6be96db..0000000 --- a/po/pl.po +++ /dev/null @@ -1,46 +0,0 @@ -# Polish translations for PACKAGE package.
-# Copyright (C) 2010 THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# Canonical OEM, 2010.
-#
-msgid "" -msgstr "" -"Project-Id-Version: indicator-datetime\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-03-10 15:20-0500\n" -"PO-Revision-Date: 2010-03-03 10:06-0500\n" -"Last-Translator: Canonical OEM\n" -"Language-Team: Polish\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " -"|| n%100>=20) ? 1 : 2);\n" - -#: ../src/indicator-datetime.c:177 -msgid "Error getting time" -msgstr "Wystąpił błąd pobierania godziny" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:259 -#, c-format -msgid "%d%d:%d%d AM" -msgstr "%d%d:%d%d AM" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:266 -#, c-format -msgid "%d%d:%d%d PM" -msgstr "%d%d:%d%d PM" - -#: ../src/indicator-datetime.c:351 -msgid "Open Calendar" -msgstr "Otwórz kalendarz" - -#: ../src/indicator-datetime.c:361 -msgid "Set Time and Date..." -msgstr "Ustaw godzinę i datę..." diff --git a/po/pt.po b/po/pt.po deleted file mode 100644 index fb6a0f0..0000000 --- a/po/pt.po +++ /dev/null @@ -1,45 +0,0 @@ -# Portuguese translations for PACKAGE package.
-# Copyright (C) 2010 THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# Canonical OEM, 2010.
-#
-msgid "" -msgstr "" -"Project-Id-Version: indicator-datetime\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-03-10 15:20-0500\n" -"PO-Revision-Date: 2010-03-03 10:06-0500\n" -"Last-Translator: Canonical OEM\n" -"Language-Team: Portuguese\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: ../src/indicator-datetime.c:177 -msgid "Error getting time" -msgstr "Erro na obtenção das horas" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:259 -#, c-format -msgid "%d%d:%d%d AM" -msgstr "%d%d:%d%d AM" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:266 -#, c-format -msgid "%d%d:%d%d PM" -msgstr "%d%d:%d%d PM" - -#: ../src/indicator-datetime.c:351 -msgid "Open Calendar" -msgstr "Abrir Calendário" - -#: ../src/indicator-datetime.c:361 -msgid "Set Time and Date..." -msgstr "Acertar Hora e Data..." diff --git a/po/pt_BR.po b/po/pt_BR.po deleted file mode 100644 index 1795ceb..0000000 --- a/po/pt_BR.po +++ /dev/null @@ -1,45 +0,0 @@ -# Portuguese translations for PACKAGE package.
-# Copyright (C) 2010 THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# Canonical OEM, 2010.
-#
-msgid "" -msgstr "" -"Project-Id-Version: indicator-datetime\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-03-10 15:20-0500\n" -"PO-Revision-Date: 2010-03-03 10:06-0500\n" -"Last-Translator: Canonical OEM\n" -"Language-Team: Brazilian Portuguese\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n > 1);\n" - -#: ../src/indicator-datetime.c:177 -msgid "Error getting time" -msgstr "Erro ao obter hora" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:259 -#, c-format -msgid "%d%d:%d%d AM" -msgstr "%d%d:%d%d AM" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:266 -#, c-format -msgid "%d%d:%d%d PM" -msgstr "%d%d:%d%d PM" - -#: ../src/indicator-datetime.c:351 -msgid "Open Calendar" -msgstr "Abrir o calendário" - -#: ../src/indicator-datetime.c:361 -msgid "Set Time and Date..." -msgstr "Ajustar data e hora..." diff --git a/po/ro.po b/po/ro.po deleted file mode 100644 index 3eb1bf9..0000000 --- a/po/ro.po +++ /dev/null @@ -1,46 +0,0 @@ -# Romanian translations for PACKAGE package.
-# Copyright (C) 2010 THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# Canonical OEM, 2010.
-#
-msgid "" -msgstr "" -"Project-Id-Version: indicator-datetime\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-03-10 15:20-0500\n" -"PO-Revision-Date: 2010-03-03 10:06-0500\n" -"Last-Translator: Canonical OEM\n" -"Language-Team: Romanian\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=3; plural=n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 < " -"20)) ? 1 : 2;\n" - -#: ../src/indicator-datetime.c:177 -msgid "Error getting time" -msgstr "Eroare la obținerea orei" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:259 -#, c-format -msgid "%d%d:%d%d AM" -msgstr "%d%d:%d%d AM" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:266 -#, c-format -msgid "%d%d:%d%d PM" -msgstr "%d%d:%d%d PM" - -#: ../src/indicator-datetime.c:351 -msgid "Open Calendar" -msgstr "Deschide calendarul" - -#: ../src/indicator-datetime.c:361 -msgid "Set Time and Date..." -msgstr "Setare oră și dată..." diff --git a/po/ru.po b/po/ru.po deleted file mode 100644 index b4e54e2..0000000 --- a/po/ru.po +++ /dev/null @@ -1,46 +0,0 @@ -# Russian translations for PACKAGE package.
-# Copyright (C) 2010 THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# Canonical OEM, 2010.
-#
-msgid "" -msgstr "" -"Project-Id-Version: indicator-datetime\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-03-10 15:20-0500\n" -"PO-Revision-Date: 2010-03-03 10:06-0500\n" -"Last-Translator: Canonical OEM\n" -"Language-Team: Russian\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%" -"10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" - -#: ../src/indicator-datetime.c:177 -msgid "Error getting time" -msgstr "Ошибка получения времени" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:259 -#, c-format -msgid "%d%d:%d%d AM" -msgstr "%d%d:%d%d AM" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:266 -#, c-format -msgid "%d%d:%d%d PM" -msgstr "%d%d:%d%d PM" - -#: ../src/indicator-datetime.c:351 -msgid "Open Calendar" -msgstr "Открыть календарь" - -#: ../src/indicator-datetime.c:361 -msgid "Set Time and Date..." -msgstr "Установить время и дату..." diff --git a/po/sk.po b/po/sk.po deleted file mode 100644 index 9c47050..0000000 --- a/po/sk.po +++ /dev/null @@ -1,45 +0,0 @@ -# Slovak translations for PACKAGE package.
-# Copyright (C) 2010 THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# Canonical OEM, 2010.
-#
-msgid "" -msgstr "" -"Project-Id-Version: indicator-datetime\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-03-10 15:20-0500\n" -"PO-Revision-Date: 2010-03-03 10:06-0500\n" -"Last-Translator: Canonical OEM\n" -"Language-Team: Slovak\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n" - -#: ../src/indicator-datetime.c:177 -msgid "Error getting time" -msgstr "Čas zistenia chyby" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:259 -#, c-format -msgid "%d%d:%d%d AM" -msgstr "%d%d:%d%d AM" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:266 -#, c-format -msgid "%d%d:%d%d PM" -msgstr "%d%d:%d%d PM" - -#: ../src/indicator-datetime.c:351 -msgid "Open Calendar" -msgstr "Otvoriť kalendár" - -#: ../src/indicator-datetime.c:361 -msgid "Set Time and Date..." -msgstr "Nastaviť čas a dátum..." diff --git a/po/sl.po b/po/sl.po deleted file mode 100644 index 012ff00..0000000 --- a/po/sl.po +++ /dev/null @@ -1,46 +0,0 @@ -# Slovenian translations for PACKAGE package.
-# Copyright (C) 2010 THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# Canonical OEM, 2010.
-#
-msgid "" -msgstr "" -"Project-Id-Version: indicator-datetime\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-03-10 15:20-0500\n" -"PO-Revision-Date: 2010-03-03 10:06-0500\n" -"Last-Translator: Canonical OEM\n" -"Language-Team: Slovenian\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n" -"%100==4 ? 2 : 3);\n" - -#: ../src/indicator-datetime.c:177 -msgid "Error getting time" -msgstr "Napaka pri pridobivanju podatka o času" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:259 -#, c-format -msgid "%d%d:%d%d AM" -msgstr "%d%d:%d%d AM" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:266 -#, c-format -msgid "%d%d:%d%d PM" -msgstr "%d%d:%d%d PM" - -#: ../src/indicator-datetime.c:351 -msgid "Open Calendar" -msgstr "Odpri koledar" - -#: ../src/indicator-datetime.c:361 -msgid "Set Time and Date..." -msgstr "Nastavi čas in datum ..." diff --git a/po/sr.po b/po/sr.po deleted file mode 100644 index df6149a..0000000 --- a/po/sr.po +++ /dev/null @@ -1,46 +0,0 @@ -# Serbian translations for PACKAGE package.
-# Copyright (C) 2010 THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# Canonical OEM, 2010.
-#
-msgid "" -msgstr "" -"Project-Id-Version: indicator-datetime\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-03-10 15:20-0500\n" -"PO-Revision-Date: 2010-03-03 10:06-0500\n" -"Last-Translator: Canonical OEM\n" -"Language-Team: Serbian\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%" -"10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" - -#: ../src/indicator-datetime.c:177 -msgid "Error getting time" -msgstr "Greška u prikazu vremena" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:259 -#, c-format -msgid "%d%d:%d%d AM" -msgstr "%d%d%d%d pre podne" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:266 -#, c-format -msgid "%d%d:%d%d PM" -msgstr "%d%d%d%d popodne" - -#: ../src/indicator-datetime.c:351 -msgid "Open Calendar" -msgstr "Otvori kalendar" - -#: ../src/indicator-datetime.c:361 -msgid "Set Time and Date..." -msgstr "Podesi vreme i datum" diff --git a/po/sv.po b/po/sv.po deleted file mode 100644 index 585daeb..0000000 --- a/po/sv.po +++ /dev/null @@ -1,45 +0,0 @@ -# Swedish translations for PACKAGE package.
-# Copyright (C) 2010 THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# Canonical OEM, 2010.
-#
-msgid "" -msgstr "" -"Project-Id-Version: indicator-datetime\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-03-10 15:20-0500\n" -"PO-Revision-Date: 2010-03-03 10:06-0500\n" -"Last-Translator: Canonical OEM\n" -"Language-Team: Swedish\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: ../src/indicator-datetime.c:177 -msgid "Error getting time" -msgstr "Ett fel uppstod då tid hämtades" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:259 -#, c-format -msgid "%d%d:%d%d AM" -msgstr "%d%d:%d%d FM" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:266 -#, c-format -msgid "%d%d:%d%d PM" -msgstr "%d%d:%d%d EM" - -#: ../src/indicator-datetime.c:351 -msgid "Open Calendar" -msgstr "Öppna kalender" - -#: ../src/indicator-datetime.c:361 -msgid "Set Time and Date..." -msgstr "Ange tid och datum..." diff --git a/po/th.po b/po/th.po deleted file mode 100644 index fd7e2ac..0000000 --- a/po/th.po +++ /dev/null @@ -1,44 +0,0 @@ -# Thai translations for PACKAGE package.
-# Copyright (C) 2010 THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# Canonical OEM, 2010.
-#
-msgid "" -msgstr "" -"Project-Id-Version: indicator-datetime\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-03-10 15:20-0500\n" -"PO-Revision-Date: 2010-03-03 10:06-0500\n" -"Last-Translator: Canonical OEM\n" -"Language-Team: Thai\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" - -#: ../src/indicator-datetime.c:177 -msgid "Error getting time" -msgstr "ข้อผิดพลาดการขอข้อมูลเวลา" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:259 -#, c-format -msgid "%d%d:%d%d AM" -msgstr "%d%d:%d%d AM" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:266 -#, c-format -msgid "%d%d:%d%d PM" -msgstr "%d%d:%d%d PM" - -#: ../src/indicator-datetime.c:351 -msgid "Open Calendar" -msgstr "เปิดปฏิทิน" - -#: ../src/indicator-datetime.c:361 -msgid "Set Time and Date..." -msgstr "ตั้งเวลาและวันที่..." diff --git a/po/tr.po b/po/tr.po deleted file mode 100644 index 8ad85a6..0000000 --- a/po/tr.po +++ /dev/null @@ -1,45 +0,0 @@ -# Turkish translations for PACKAGE package.
-# Copyright (C) 2010 THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# Canonical OEM, 2010.
-#
-msgid "" -msgstr "" -"Project-Id-Version: indicator-datetime\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-03-10 15:20-0500\n" -"PO-Revision-Date: 2010-03-03 10:06-0500\n" -"Last-Translator: Canonical OEM\n" -"Language-Team: Turkish\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" - -#: ../src/indicator-datetime.c:177 -msgid "Error getting time" -msgstr "Saati alma hatâsı" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:259 -#, c-format -msgid "%d%d:%d%d AM" -msgstr "Öğleden Önce %d%d:%d%d" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:266 -#, c-format -msgid "%d%d:%d%d PM" -msgstr "Öğleden Sonra %d%d:%d%d" - -#: ../src/indicator-datetime.c:351 -msgid "Open Calendar" -msgstr "Takvimi Aç" - -#: ../src/indicator-datetime.c:361 -msgid "Set Time and Date..." -msgstr "Saati ve Târihi Ayarla..." diff --git a/po/zh_CN.po b/po/zh_CN.po deleted file mode 100644 index fb74d02..0000000 --- a/po/zh_CN.po +++ /dev/null @@ -1,44 +0,0 @@ -# Chinese translations for PACKAGE package.
-# Copyright (C) 2010 THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# Canonical OEM, 2010.
-#
-msgid "" -msgstr "" -"Project-Id-Version: indicator-datetime\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-03-10 15:20-0500\n" -"PO-Revision-Date: 2010-03-03 10:06-0500\n" -"Last-Translator: Canonical OEM\n" -"Language-Team: Chinese (simplified)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" - -#: ../src/indicator-datetime.c:177 -msgid "Error getting time" -msgstr "获取时间出错" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:259 -#, c-format -msgid "%d%d:%d%d AM" -msgstr "%d%d:%d%d 上午" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:266 -#, c-format -msgid "%d%d:%d%d PM" -msgstr "%d%d:%d%d 下午" - -#: ../src/indicator-datetime.c:351 -msgid "Open Calendar" -msgstr "打开日历" - -#: ../src/indicator-datetime.c:361 -msgid "Set Time and Date..." -msgstr "设置时间和日期..." diff --git a/po/zh_TW.po b/po/zh_TW.po deleted file mode 100644 index ec58031..0000000 --- a/po/zh_TW.po +++ /dev/null @@ -1,44 +0,0 @@ -# Chinese translations for PACKAGE package.
-# Copyright (C) 2010 THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# Canonical OEM, 2010.
-#
-msgid "" -msgstr "" -"Project-Id-Version: indicator-datetime\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-03-10 15:20-0500\n" -"PO-Revision-Date: 2010-03-03 10:06-0500\n" -"Last-Translator: Canonical OEM\n" -"Language-Team: Chinese (traditional)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" - -#: ../src/indicator-datetime.c:177 -msgid "Error getting time" -msgstr "獲得時間發生錯誤" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:259 -#, c-format -msgid "%d%d:%d%d AM" -msgstr "%d%d:%d%d 上午" - -#. TRANSLATORS: This string is used for measuring the size of -#. the font used for showing the time and is not shown to the -#. user anywhere. -#: ../src/indicator-datetime.c:266 -#, c-format -msgid "%d%d:%d%d PM" -msgstr "%d%d:%d%d 下午" - -#: ../src/indicator-datetime.c:351 -msgid "Open Calendar" -msgstr "開啟行事曆" - -#: ../src/indicator-datetime.c:361 -msgid "Set Time and Date..." -msgstr "設定時間和日期..." diff --git a/src/Makefile.am b/src/Makefile.am index 6d388c7..26447f7 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,5 +1,4 @@ -bin_PROGRAMS = indicator-datetime-preferences libexec_PROGRAMS = indicator-datetime-service indicator_datetime_service_SOURCES = \ @@ -41,25 +40,6 @@ libdatetime_la_LDFLAGS = \ -module \ -avoid-version -indicator_datetime_preferences_SOURCES =\ - datetime-prefs.c \ - datetime-prefs-locations.c \ - datetime-prefs-locations.h \ - timezone-completion.c \ - timezone-completion.h \ - utils.c \ - utils.h \ - settings-shared.h -indicator_datetime_preferences_CFLAGS = \ - -Wall \ - -Werror \ - -I$(top_srcdir)/libmap \ - $(PREF_CFLAGS) \ - -DPKGDATADIR="\"$(pkgdatadir)\"" -indicator_datetime_preferences_LDADD = \ - $(top_builddir)/libmap/libmap.la \ - $(PREF_LIBS) - gen-%.xml.c: %.xml @echo "Building $@ from $<" @echo "const char * _$(subst -,_,$(subst .,_,$(basename $<))) = " > $@ diff --git a/src/datetime-prefs-locations.c b/src/datetime-prefs-locations.c deleted file mode 100644 index af0e10d..0000000 --- a/src/datetime-prefs-locations.c +++ /dev/null @@ -1,500 +0,0 @@ -/* -*- Mode: C; coding: utf-8; indent-tabs-mode: nil; tab-width: 2 -*- - -A dialog for setting time and date preferences. - -Copyright 2011 Canonical Ltd. - -Authors: - Michael Terry <michael.terry@canonical.com> - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published -by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR -PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <stdlib.h> -#include <glib/gi18n-lib.h> -#include <gtk/gtk.h> - -#include "datetime-prefs-locations.h" -#include "settings-shared.h" -#include "utils.h" -#include "timezone-completion.h" - -#define DATETIME_DIALOG_UI_FILE PKGDATADIR "/datetime-dialog.ui" - -#define COL_NAME 0 -#define COL_TIME 1 -#define COL_ZONE 2 -#define COL_VISIBLE_NAME 3 -#define COL_ICON 4 - -static gboolean update_times (GtkWidget * dlg); -static void save_when_idle (GtkWidget * dlg); - -static void -handle_add (GtkWidget * button, GtkTreeView * tree) -{ - GtkListStore * store = GTK_LIST_STORE (gtk_tree_view_get_model (tree)); - - GtkTreeIter iter; - gtk_list_store_append (store, &iter); - - GtkTreePath * path = gtk_tree_model_get_path (GTK_TREE_MODEL (store), &iter); - gtk_tree_view_set_cursor (tree, path, gtk_tree_view_get_column (tree, 0), TRUE); - gtk_tree_path_free (path); -} - -static void -handle_remove (GtkWidget * button, GtkTreeView * tree) -{ - GtkListStore * store = GTK_LIST_STORE (gtk_tree_view_get_model (tree)); - GtkTreeSelection * selection = gtk_tree_view_get_selection (tree); - - GList * paths = gtk_tree_selection_get_selected_rows (selection, NULL); - - /* Convert all paths to iters so we can safely delete multiple paths. For a - GtkListStore, iters persist past model changes. */ - GList * tree_iters = NULL; - GList * iter; - for (iter = paths; iter; iter = iter->next) { - GtkTreeIter * tree_iter = g_new(GtkTreeIter, 1); - if (gtk_tree_model_get_iter (GTK_TREE_MODEL (store), tree_iter, (GtkTreePath *)iter->data)) { - tree_iters = g_list_prepend (tree_iters, tree_iter); - } - gtk_tree_path_free (iter->data); - } - g_list_free (paths); - - // Find the next item to select - GtkTreeIter *last_selected = g_list_nth_data(tree_iters, 0); - GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL (store), last_selected); - GtkTreeIter titer; - if (!gtk_tree_model_get_iter(GTK_TREE_MODEL (store), &titer, path)) { - g_debug("Failed to get last selected iter from path"); - last_selected = NULL; - } else { - if (!gtk_tree_model_iter_next(GTK_TREE_MODEL (store), &titer)) { - if (gtk_tree_path_prev(path)) { - if (!gtk_tree_model_get_iter(GTK_TREE_MODEL (store), &titer, path)) { - g_debug("Failed to get iter from path"); - last_selected = NULL; - } else { - last_selected = &titer; - } - } else { - g_debug("handle_remove: Failed to find another location to select (assume single selected)"); - last_selected = NULL; - } - } else { - g_debug("Got next item in model"); - last_selected = &titer; - } - } - - if (last_selected) { - gboolean clear = TRUE; - path = gtk_tree_model_get_path(GTK_TREE_MODEL (store), last_selected); - - // Step over the path to find an item which isn't in the delete list - if (g_list_length(tree_iters) > 1) { - for (iter = tree_iters; iter; iter = iter->next) { - GtkTreePath *ipath = gtk_tree_model_get_path(GTK_TREE_MODEL (store), (GtkTreeIter *)iter->data); - if (gtk_tree_path_compare(path, ipath) == 0) { - clear = FALSE; - break; - } - } - while (clear == FALSE) { - if (gtk_tree_path_prev(path)) { - clear = TRUE; - for (iter = tree_iters; iter; iter = iter->next) { - GtkTreePath *ipath = gtk_tree_model_get_path(GTK_TREE_MODEL (store), (GtkTreeIter *)iter->data); - if (gtk_tree_path_compare(path, ipath) == 0) { - clear = FALSE; - break; - } - } - if (clear) { - if (!gtk_tree_model_get_iter(GTK_TREE_MODEL (store), &titer, path)) { - g_debug("Failed to get iter from path"); - last_selected = NULL; - } else { - last_selected = &titer; - } - } - } else { - last_selected = NULL; - break; - } - } - } - } - - /* Now delete each iterator */ - for (iter = tree_iters; iter; iter = iter->next) { - gtk_list_store_remove (store, (GtkTreeIter *)iter->data); - g_free (iter->data); - } - g_list_free (tree_iters); - - if (last_selected) - gtk_tree_selection_select_iter(selection, last_selected); -} - -static void -handle_edit (GtkCellRendererText * renderer, gchar * path, gchar * new_text, - GtkListStore * store) -{ - GtkTreeIter iter; - - // Manual user edits are always wrong (unless they are undoing a previous - // edit), so we set the error icon here if needed. Common way to get to - // this code path is to lose entry focus. - if (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (store), &iter, path)) { - const gchar * name; - gtk_tree_model_get (GTK_TREE_MODEL (store), &iter, COL_NAME, &name, -1); - gboolean correct = g_strcmp0 (name, new_text) == 0; - - gtk_list_store_set (store, &iter, - COL_VISIBLE_NAME, new_text, - COL_ICON, correct ? NULL : GTK_STOCK_DIALOG_ERROR, - -1); - } -} - -static gboolean -timezone_selected (GtkEntryCompletion * widget, GtkTreeModel * model, - GtkTreeIter * iter, GtkWidget * dlg) -{ - const gchar * zone, * name; - - gtk_tree_model_get (model, iter, - TIMEZONE_COMPLETION_ZONE, &zone, - TIMEZONE_COMPLETION_NAME, &name, - -1); - - if (zone == NULL || zone[0] == 0) { - const gchar * strlon, * strlat; - gdouble lon = 0.0, lat = 0.0; - - gtk_tree_model_get (model, iter, - TIMEZONE_COMPLETION_LONGITUDE, &strlon, - TIMEZONE_COMPLETION_LATITUDE, &strlat, - -1); - - if (strlon != NULL && strlon[0] != 0) { - lon = strtod(strlon, NULL); - } - - if (strlat != NULL && strlat[0] != 0) { - lat = strtod(strlat, NULL); - } - - CcTimezoneMap * tzmap = CC_TIMEZONE_MAP (g_object_get_data (G_OBJECT (widget), "tzmap")); - zone = cc_timezone_map_get_timezone_at_coords (tzmap, lon, lat); - } - - GtkListStore * store = GTK_LIST_STORE (g_object_get_data (G_OBJECT (widget), "store")); - GtkTreeIter * store_iter = (GtkTreeIter *)g_object_get_data (G_OBJECT (widget), "store_iter"); - if (store != NULL && store_iter != NULL) { - gtk_list_store_set (store, store_iter, - COL_VISIBLE_NAME, name, - COL_ICON, NULL, - COL_NAME, name, - COL_ZONE, zone, -1); - } - - update_times (dlg); - - return FALSE; // Do normal action too -} - -static gboolean -query_tooltip (GtkTreeView * tree, gint x, gint y, gboolean keyboard_mode, - GtkTooltip * tooltip, GtkCellRenderer * cell) -{ - GtkTreeModel * model; - GtkTreeIter iter; - if (!gtk_tree_view_get_tooltip_context (tree, &x, &y, keyboard_mode, - &model, NULL, &iter)) - return FALSE; - - const gchar * icon; - gtk_tree_model_get (model, &iter, COL_ICON, &icon, -1); - if (icon == NULL) - return FALSE; - - GtkTreeViewColumn * col = gtk_tree_view_get_column (tree, 0); - gtk_tree_view_set_tooltip_cell (tree, tooltip, NULL, col, cell); - gtk_tooltip_set_text (tooltip, _("You need to complete this location for it to appear in the menu.")); - return TRUE; -} - -static void -handle_edit_started (GtkCellRendererText * renderer, GtkCellEditable * editable, - gchar * path, TimezoneCompletion * completion) -{ - if (GTK_IS_ENTRY (editable)) { - GtkEntry *entry = GTK_ENTRY (editable); - timezone_completion_watch_entry (completion, entry); - - GtkListStore * store = GTK_LIST_STORE (g_object_get_data (G_OBJECT (completion), "store")); - GtkTreeIter * store_iter = g_new(GtkTreeIter, 1); - if (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (store), store_iter, path)) { - g_object_set_data_full (G_OBJECT (completion), "store_iter", store_iter, g_free); - } - } -} - -static gboolean -update_times (GtkWidget * dlg) -{ - /* For each entry, check zone in column 2 and set column 1 to it's time */ - TimezoneCompletion * completion = TIMEZONE_COMPLETION (g_object_get_data (G_OBJECT (dlg), "completion")); - GtkListStore * store = GTK_LIST_STORE (g_object_get_data (G_OBJECT (completion), "store")); - GObject * cell = G_OBJECT (g_object_get_data (G_OBJECT (completion), "name-cell")); - - gboolean editing; - g_object_get (cell, "editing", &editing, NULL); - if (editing) { /* No updates while editing, it cancels the edit */ - return TRUE; - } - - g_signal_handlers_block_by_func (store, save_when_idle, dlg); - - GDateTime * now = g_date_time_new_now_local (); - - GtkTreeIter iter; - if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter)) { - do { - const gchar * strzone; - - gtk_tree_model_get (GTK_TREE_MODEL (store), &iter, COL_ZONE, &strzone, -1); - - if (strzone != NULL && strzone[0] != 0) { - GTimeZone * tz = g_time_zone_new (strzone); - GDateTime * now_tz = g_date_time_to_timezone (now, tz); - gchar * format = generate_format_string_at_time (now_tz); - gchar * time_str = g_date_time_format (now_tz, format); - - gtk_list_store_set (store, &iter, COL_TIME, time_str, -1); - - g_free (time_str); - g_free (format); - g_date_time_unref (now_tz); - g_time_zone_unref (tz); - } - } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter)); - } - - g_date_time_unref (now); - - g_signal_handlers_unblock_by_func (store, save_when_idle, dlg); - - return TRUE; -} - -static void -fill_from_settings (GObject * store, GSettings * conf) -{ - gchar ** locations = g_settings_get_strv (conf, SETTINGS_LOCATIONS_S); - - gtk_list_store_clear (GTK_LIST_STORE (store)); - - gchar ** striter; - GtkTreeIter iter; - for (striter = locations; *striter; ++striter) { - gchar * zone, * name; - split_settings_location (*striter, &zone, &name); - - gtk_list_store_append (GTK_LIST_STORE (store), &iter); - gtk_list_store_set (GTK_LIST_STORE (store), &iter, - COL_VISIBLE_NAME, name, - COL_ICON, NULL, - COL_NAME, name, - COL_ZONE, zone, -1); - - g_free (zone); - g_free (name); - } - - g_strfreev (locations); -} - -static void -save_to_settings (GObject * store, GSettings * conf) -{ - gboolean empty = TRUE; - GVariantBuilder builder; - g_variant_builder_init (&builder, G_VARIANT_TYPE_ARRAY); - - GtkTreeIter iter; - if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter)) { - do { - const gchar * strzone, * strname; - - gtk_tree_model_get (GTK_TREE_MODEL (store), &iter, - COL_NAME, &strname, - COL_ZONE, &strzone, - -1); - - if (strzone != NULL && strzone[0] != 0 && strname != NULL && strname[0] != 0) { - gchar * settings_string = g_strdup_printf("%s %s", strzone, strname); - g_variant_builder_add (&builder, "s", settings_string); - g_free (settings_string); - empty = FALSE; - } - } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter)); - } - - if (empty) { - /* Empty list */ - g_variant_builder_clear (&builder); - g_settings_set_strv (conf, SETTINGS_LOCATIONS_S, NULL); - } - else { - GVariant * locations = g_variant_builder_end (&builder); - g_settings_set_strv (conf, SETTINGS_LOCATIONS_S, g_variant_get_strv (locations, NULL)); - g_variant_unref (locations); - } -} - -static gboolean -save_now (GtkWidget *dlg) -{ - GSettings * conf = G_SETTINGS (g_object_get_data (G_OBJECT (dlg), "conf")); - GObject * completion = G_OBJECT (g_object_get_data (G_OBJECT (dlg), "completion")); - GObject * store = G_OBJECT (g_object_get_data (completion, "store")); - - save_to_settings (store, conf); - - g_object_set_data (G_OBJECT (dlg), "save-id", GINT_TO_POINTER(0)); - - return FALSE; -} - -static void -save_when_idle (GtkWidget *dlg) -{ - guint save_id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (dlg), "save-id")); - - if (save_id == 0) { - save_id = g_idle_add ((GSourceFunc)save_now, dlg); - g_object_set_data (G_OBJECT (dlg), "save-id", GINT_TO_POINTER(save_id)); - } -} - -static void -dialog_closed (GtkWidget * dlg, GObject * store) -{ - /* Cleanup a tad */ - guint time_id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (dlg), "time-id")); - g_source_remove (time_id); - - guint save_id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (dlg), "save-id")); - if (save_id > 0) - g_source_remove (save_id); -} - -static void -selection_changed (GtkTreeSelection * selection, GtkWidget * remove_button) -{ - gint count = gtk_tree_selection_count_selected_rows (selection); - gtk_widget_set_sensitive (remove_button, count > 0); -} - -GtkWidget * -datetime_setup_locations_dialog (CcTimezoneMap * map) -{ - GError * error = NULL; - GtkBuilder * builder = gtk_builder_new (); - gtk_builder_add_from_file (builder, DATETIME_DIALOG_UI_FILE, &error); - if (error != NULL) { - /* We have to abort, we can't continue without the ui file */ - g_error ("Could not load ui file %s: %s", DATETIME_DIALOG_UI_FILE, error->message); - g_error_free (error); - return NULL; - } - - gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE); - - GSettings * conf = g_settings_new (SETTINGS_INTERFACE); - -#define WIG(name) GTK_WIDGET (gtk_builder_get_object (builder, name)) - - GtkWidget * dlg = WIG ("locationsDialog"); - GtkWidget * tree = WIG ("locationsView"); - GObject * store = gtk_builder_get_object (builder, "locationsStore"); - - /* Configure tree */ - TimezoneCompletion * completion = timezone_completion_new (); - g_object_set_data (G_OBJECT (completion), "tzmap", map); - g_object_set_data (G_OBJECT (completion), "store", store); - g_signal_connect (completion, "match-selected", G_CALLBACK (timezone_selected), dlg); - - GtkCellRenderer * cell = gtk_cell_renderer_text_new (); - g_object_set (cell, "editable", TRUE, NULL); - g_signal_connect (cell, "editing-started", G_CALLBACK (handle_edit_started), completion); - g_signal_connect (cell, "edited", G_CALLBACK (handle_edit), store); - gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tree), -1, - _("Location"), cell, - "text", COL_VISIBLE_NAME, NULL); - GtkTreeViewColumn * loc_col = gtk_tree_view_get_column (GTK_TREE_VIEW (tree), 0); - gtk_tree_view_column_set_expand (loc_col, TRUE); - g_object_set_data (G_OBJECT (completion), "name-cell", cell); - - cell = gtk_cell_renderer_pixbuf_new (); - gtk_tree_view_column_pack_start (loc_col, cell, FALSE); - gtk_tree_view_column_add_attribute (loc_col, cell, "icon-name", COL_ICON); - - gtk_widget_set_has_tooltip (tree, TRUE); - g_signal_connect (tree, "query-tooltip", G_CALLBACK (query_tooltip), cell); - - cell = gtk_cell_renderer_text_new (); - gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tree), -1, - _("Time"), cell, - "text", COL_TIME, NULL); - - GtkTreeSelection * selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree)); - gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE); - g_signal_connect (selection, "changed", G_CALLBACK (selection_changed), WIG ("removeButton")); - selection_changed (selection, WIG ("removeButton")); - - g_signal_connect (WIG ("addButton"), "clicked", G_CALLBACK (handle_add), tree); - g_signal_connect (WIG ("removeButton"), "clicked", G_CALLBACK (handle_remove), tree); - - fill_from_settings (store, conf); - g_signal_connect_swapped (store, "row-deleted", G_CALLBACK (save_when_idle), dlg); - g_signal_connect_swapped (store, "row-inserted", G_CALLBACK (save_when_idle), dlg); - g_signal_connect_swapped (store, "row-changed", G_CALLBACK (save_when_idle), dlg); - g_signal_connect_swapped (store, "rows-reordered", G_CALLBACK (save_when_idle), dlg); - - g_object_set_data_full (G_OBJECT (dlg), "conf", g_object_ref (conf), g_object_unref); - g_object_set_data_full (G_OBJECT (dlg), "completion", completion, g_object_unref); - g_signal_connect (dlg, "destroy", G_CALLBACK (dialog_closed), store); - - guint time_id = g_timeout_add_seconds (2, (GSourceFunc)update_times, dlg); - g_object_set_data (G_OBJECT (dlg), "time-id", GINT_TO_POINTER(time_id)); - update_times (dlg); - -#undef WIG - - g_object_unref (conf); - g_object_unref (builder); - - return dlg; -} - diff --git a/src/datetime-prefs-locations.h b/src/datetime-prefs-locations.h deleted file mode 100644 index e312894..0000000 --- a/src/datetime-prefs-locations.h +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- Mode: C; coding: utf-8; indent-tabs-mode: nil; tab-width: 2 -*- - -A dialog for setting time and date preferences. - -Copyright 2011 Canonical Ltd. - -Authors: - Michael Terry <michael.terry@canonical.com> - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published -by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR -PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#ifndef __DATETIME_PREFS_LOCATIONS_H__ -#define __DATETIME_PREFS_LOCATIONS_H__ - -#include <gtk/gtk.h> -#include "cc-timezone-map.h" - -G_BEGIN_DECLS - -GtkWidget * datetime_setup_locations_dialog (CcTimezoneMap * map); - -G_END_DECLS - -#endif diff --git a/src/datetime-prefs.c b/src/datetime-prefs.c deleted file mode 100644 index 9b00e60..0000000 --- a/src/datetime-prefs.c +++ /dev/null @@ -1,769 +0,0 @@ -/* -*- Mode: C; coding: utf-8; indent-tabs-mode: nil; tab-width: 2 -*- - -A dialog for setting time and date preferences. - -Copyright 2011 Canonical Ltd. - -Authors: - Ted Gould <ted@canonical.com> - Michael Terry <michael.terry@canonical.com> - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published -by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR -PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <stdlib.h> -#include <libintl.h> -#include <locale.h> -#include <langinfo.h> -#include <glib/gi18n-lib.h> -#include <gdk/gdkkeysyms.h> -#include <gtk/gtk.h> -#include <unique/unique.h> -#include <polkitgtk/polkitgtk.h> - -#include "dbus-shared.h" -#include "settings-shared.h" -#include "utils.h" -#include "datetime-prefs-locations.h" -#include "timezone-completion.h" -#include "cc-timezone-map.h" - -#define DATETIME_DIALOG_UI_FILE PKGDATADIR "/datetime-dialog.ui" - -GDBusProxy * proxy = NULL; -GtkWidget * auto_radio = NULL; -GtkWidget * tz_entry = NULL; -CcTimezoneMap * tzmap = NULL; -GtkWidget * time_spin = NULL; -GtkWidget * date_spin = NULL; -guint save_time_id = 0; -gboolean user_edited_time = FALSE; -gboolean changing_time = FALSE; -GtkWidget * loc_dlg = NULL; - -/* Turns the boolean property into a string gsettings */ -static GVariant * -bind_hours_set (const GValue * value, const GVariantType * type, gpointer user_data) -{ - const gchar * output = NULL; - gboolean is_12hour_button = (gboolean)GPOINTER_TO_INT(user_data); - - if (g_value_get_boolean(value)) { - /* Only do anything if we're setting active = true */ - output = is_12hour_button ? "12-hour" : "24-hour"; - } else { - return NULL; - } - - return g_variant_new_string (output); -} - -/* Turns a string gsettings into a boolean property */ -static gboolean -bind_hours_get (GValue * value, GVariant * variant, gpointer user_data) -{ - const gchar * str = g_variant_get_string(variant, NULL); - gboolean output = FALSE; - gboolean is_12hour_button = (gboolean)GPOINTER_TO_INT(user_data); - - if (g_strcmp0(str, "locale-default") == 0) { - output = (is_12hour_button == is_locale_12h ()); - } else if (g_strcmp0(str, "12-hour") == 0) { - output = is_12hour_button; - } else if (g_strcmp0(str, "24-hour") == 0) { - output = !is_12hour_button; - } else { - return FALSE; - } - - g_value_set_boolean (value, output); - return TRUE; -} - -static void -widget_dependency_cb (GtkWidget * parent, GParamSpec *pspec, GtkWidget * dependent) -{ - gboolean active, sensitive; - g_object_get (G_OBJECT (parent), - "active", &active, - "sensitive", &sensitive, NULL); - gtk_widget_set_sensitive (dependent, active && sensitive); -} - -static void -add_widget_dependency (GtkWidget * parent, GtkWidget * dependent) -{ - g_signal_connect (parent, "notify::active", G_CALLBACK(widget_dependency_cb), - dependent); - g_signal_connect (parent, "notify::sensitive", G_CALLBACK(widget_dependency_cb), - dependent); - widget_dependency_cb (parent, NULL, dependent); -} - -static void -polkit_dependency_cb (GtkWidget * parent, GParamSpec *pspec, GtkWidget * dependent) -{ - gboolean authorized, sensitive; - g_object_get (G_OBJECT (parent), - "is-authorized", &authorized, - "sensitive", &sensitive, NULL); - gtk_widget_set_sensitive (dependent, authorized && sensitive); -} - -static void -add_polkit_dependency (GtkWidget * parent, GtkWidget * dependent) -{ - g_signal_connect (parent, "notify::is-authorized", G_CALLBACK(polkit_dependency_cb), - dependent); - g_signal_connect (parent, "notify::sensitive", G_CALLBACK(polkit_dependency_cb), - dependent); - polkit_dependency_cb (parent, NULL, dependent); -} - -static void -dbus_set_answered (GObject *object, GAsyncResult *res, gpointer command) -{ - GError * error = NULL; - GVariant * answers = g_dbus_proxy_call_finish (proxy, res, &error); - - if (error != NULL) { - g_warning("Could not set '%s' for SettingsDaemon: %s", (gchar *)command, error->message); - g_error_free(error); - return; - } - - g_variant_unref (answers); -} - -static void -toggle_ntp (GtkWidget * radio, GParamSpec * pspec, gpointer user_data) -{ - gboolean active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio)); - - g_dbus_proxy_call (proxy, "SetUsingNtp", g_variant_new ("(b)", active), - G_DBUS_CALL_FLAGS_NONE, -1, NULL, dbus_set_answered, "using_ntp"); -} - -static void -ntp_query_answered (GObject *object, GAsyncResult *res, gpointer user_data) -{ - GError * error = NULL; - GVariant * answers = g_dbus_proxy_call_finish (proxy, res, &error); - - if (error != NULL) { - g_warning("Could not query DBus proxy for SettingsDaemon: %s", error->message); - g_error_free(error); - return; - } - - gboolean can_use_ntp, is_using_ntp; - g_variant_get (answers, "(bb)", &can_use_ntp, &is_using_ntp); - - gtk_widget_set_sensitive (GTK_WIDGET (auto_radio), can_use_ntp); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (auto_radio), is_using_ntp); - - g_signal_connect (auto_radio, "notify::active", G_CALLBACK (toggle_ntp), NULL); - - g_variant_unref (answers); -} - -static void -sync_entry (const gchar * location) -{ - gchar * name = get_current_zone_name (location); - gtk_entry_set_text (GTK_ENTRY (tz_entry), name); - g_free (name); - - gtk_entry_set_icon_from_stock (GTK_ENTRY (tz_entry), GTK_ENTRY_ICON_SECONDARY, NULL); -} - -static void -tz_changed (CcTimezoneMap * map, TzLocation * location) -{ - if (location == NULL) - return; - - gchar * file = g_build_filename ("/usr/share/zoneinfo", location->zone, NULL); - g_dbus_proxy_call (proxy, "SetTimezone", g_variant_new ("(s)", file), - G_DBUS_CALL_FLAGS_NONE, -1, NULL, dbus_set_answered, "timezone"); - g_free (file); - - sync_entry (location->zone); -} - -static void -tz_query_answered (GObject *object, GAsyncResult *res, gpointer user_data) -{ - GError * error = NULL; - GVariant * answers = g_dbus_proxy_call_finish (proxy, res, &error); - - if (error != NULL) { - g_warning("Could not query DBus proxy for SettingsDaemon: %s", error->message); - g_error_free(error); - return; - } - - const gchar * timezone; - g_variant_get (answers, "(&s)", &timezone); - - cc_timezone_map_set_timezone (tzmap, timezone); - - sync_entry (timezone); - g_signal_connect (tzmap, "location-changed", G_CALLBACK (tz_changed), NULL); - - g_variant_unref (answers); -} - -static void -proxy_ready (GObject *object, GAsyncResult *res, gpointer user_data) -{ - GError * error = NULL; - - proxy = g_dbus_proxy_new_for_bus_finish (res, &error); - - if (error != NULL) { - g_critical("Could not grab DBus proxy for SettingsDaemon: %s", error->message); - g_error_free(error); - return; - } - - /* And now, do initial proxy configuration */ - g_dbus_proxy_call (proxy, "GetUsingNtp", NULL, G_DBUS_CALL_FLAGS_NONE, -1, - NULL, ntp_query_answered, auto_radio); - g_dbus_proxy_call (proxy, "GetTimezone", NULL, G_DBUS_CALL_FLAGS_NONE, -1, - NULL, tz_query_answered, NULL); -} - -static void -service_name_owner_changed (GDBusProxy * proxy, GParamSpec *pspec, gpointer user_data) -{ - GtkWidget * widget = GTK_WIDGET (user_data); - gchar * owner = g_dbus_proxy_get_name_owner (proxy); - - gtk_widget_set_sensitive (widget, (owner != NULL)); - - g_free (owner); -} - -static void -service_proxy_ready (GObject *object, GAsyncResult *res, gpointer user_data) -{ - GError * error = NULL; - - proxy = g_dbus_proxy_new_for_bus_finish (res, &error); - - if (error != NULL) { - g_critical("Could not grab DBus proxy for indicator-datetime-service: %s", error->message); - g_error_free(error); - return; - } - - /* And now, do initial proxy configuration */ - g_signal_connect (proxy, "notify::g-name-owner", G_CALLBACK (service_name_owner_changed), user_data); - service_name_owner_changed (proxy, NULL, user_data); -} - -static gboolean -are_spinners_focused (void) -{ - // save_time_id means that we were in focus and haven't finished our save - // yet, so act like we are still focused. - return save_time_id || gtk_widget_has_focus (time_spin) || gtk_widget_has_focus (date_spin); -} - -static gboolean -save_time (gpointer user_data) -{ - if (user_edited_time) { - gdouble current_value = gtk_spin_button_get_value (GTK_SPIN_BUTTON (date_spin)); - g_dbus_proxy_call (proxy, "SetTime", g_variant_new ("(x)", (guint64)current_value), - G_DBUS_CALL_FLAGS_NONE, -1, NULL, dbus_set_answered, "time"); - } - user_edited_time = FALSE; - save_time_id = 0; - return FALSE; -} - -static gboolean -spin_focus_in (void) -{ - if (save_time_id > 0) { - g_source_remove (save_time_id); - save_time_id = 0; - } - return FALSE; -} - -static gboolean -spin_focus_out (void) -{ - /* We want to only save when both spinners are unfocused. But it's difficult - to tell who is about to get focus during a focus-out. So we set an idle - callback to save the time if we don't focus in to another spinner by that - time. */ - if (save_time_id == 0) { - save_time_id = g_idle_add ((GSourceFunc)save_time, NULL); - } - return FALSE; -} - -static int -input_time_text (GtkWidget * spinner, gdouble * value, gpointer user_data) -{ - gboolean is_time = (gboolean)GPOINTER_TO_INT (g_object_get_data (G_OBJECT (spinner), "is-time")); - const gchar * text = gtk_entry_get_text (GTK_ENTRY (spinner)); - - gdouble current_value = gtk_spin_button_get_value (GTK_SPIN_BUTTON (spinner)); - *value = current_value; - - GDateTime * now = g_date_time_new_from_unix_local (current_value); - gint year, month, day, hour, minute, second; - year = g_date_time_get_year (now); - month = g_date_time_get_month (now); - day = g_date_time_get_day_of_month (now); - hour = g_date_time_get_hour (now); - minute = g_date_time_get_minute (now); - second = g_date_time_get_second (now); - g_date_time_unref (now); - - /* Parse this string as if it were in the output format */ - gint scanned = 0; - gboolean passed = TRUE, skip = FALSE; - if (is_time) { - gint hour_in, minute_in, second_in; - - if (is_locale_12h ()) { // TODO: make this look-at/watch gsettings? - char ampm[51]; - - scanned = sscanf (text, "%u:%u:%u %50s", &hour_in, &minute_in, &second_in, ampm); - passed = (scanned == 4); - - if (passed) { - const char *pm_str = nl_langinfo (PM_STR); - if (g_ascii_strcasecmp (pm_str, ampm) == 0) { - hour_in += 12; - } - } - } else { - scanned = sscanf (text, "%u:%u:%u", &hour_in, &minute_in, &second_in); - passed = (scanned == 3); - } - - if (passed && (hour_in > 23 || minute_in > 59 || second_in > 59)) { - passed = FALSE; - } - if (passed && hour == hour_in && minute == minute_in && second == second_in) { - skip = TRUE; // no change - } else { - hour = hour_in; - minute = minute_in; - second = second_in; - } - } - else { - gint year_in, month_in, day_in; - - scanned = sscanf (text, "%u-%u-%u", &year_in, &month_in, &day_in); - - if (scanned != 3 || year_in < 1 || year_in > 9999 || - month_in < 1 || month_in > 12 || day_in < 1 || day_in > 31) { - passed = FALSE; - } - if (passed && year == year_in && month == month_in && day == day_in) { - skip = TRUE; // no change - } else { - year = year_in; - month = month_in; - day = day_in; - } - } - - if (!passed) { - g_warning ("Could not understand %s", text); - return TRUE; - } - - if (skip) { - return TRUE; - } - - gboolean prev_changing = changing_time; - changing_time = TRUE; - GDateTime * new_time = g_date_time_new_local (year, month, day, hour, minute, second); - *value = g_date_time_to_unix (new_time); - user_edited_time = TRUE; - g_date_time_unref (new_time); - changing_time = prev_changing; - - return TRUE; -} - -static gboolean -format_time_text (GtkWidget * spinner, gpointer user_data) -{ - gboolean is_time = (gboolean)GPOINTER_TO_INT (g_object_get_data (G_OBJECT (spinner), "is-time")); - - const gchar * format; - if (is_time) { - if (is_locale_12h ()) { // TODO: make this look-at/watch gsettings? - format = "%I:%M:%S %p"; - } else { - format = "%H:%M:%S"; - } - } - else { - format = "%Y-%m-%d"; - } - - GDateTime * datetime = g_date_time_new_from_unix_local (gtk_spin_button_get_value (GTK_SPIN_BUTTON (spinner))); - gchar * formatted = g_date_time_format (datetime, format); - gtk_entry_set_text (GTK_ENTRY (spinner), formatted); - g_date_time_unref (datetime); - - return TRUE; -} - -static void -spin_copy_value (GtkSpinButton * spinner, GtkSpinButton * other) -{ - if (gtk_spin_button_get_value (spinner) != gtk_spin_button_get_value (other)) { - gtk_spin_button_set_value (other, gtk_spin_button_get_value (spinner)); - } - if (!changing_time) { /* Means user pressed spin buttons */ - user_edited_time = TRUE; - } -} - -static gboolean -update_spinners (void) -{ - /* Add datetime object to spinner, which will hold the real time value, rather - then using the value of the spinner itself. And don't update while user is - editing. */ - if (!are_spinners_focused ()) { - gboolean prev_changing = changing_time; - changing_time = TRUE; - GDateTime * now = g_date_time_new_now_local (); - gtk_spin_button_set_value (GTK_SPIN_BUTTON (time_spin), (gdouble)g_date_time_to_unix (now)); - /* will be copied to other spin button */ - g_date_time_unref (now); - changing_time = prev_changing; - } - return TRUE; -} - -static void -setup_time_spinners (GtkWidget * time, GtkWidget * date) -{ - g_signal_connect (time, "input", G_CALLBACK (input_time_text), date); - g_signal_connect (date, "input", G_CALLBACK (input_time_text), time); - - g_signal_connect (time, "output", G_CALLBACK (format_time_text), date); - g_signal_connect (date, "output", G_CALLBACK (format_time_text), time); - - g_signal_connect (time, "focus-in-event", G_CALLBACK (spin_focus_in), date); - g_signal_connect (date, "focus-in-event", G_CALLBACK (spin_focus_in), time); - - g_signal_connect (time, "focus-out-event", G_CALLBACK (spin_focus_out), date); - g_signal_connect (date, "focus-out-event", G_CALLBACK (spin_focus_out), time); - - g_signal_connect (time, "value-changed", G_CALLBACK (spin_copy_value), date); - g_signal_connect (date, "value-changed", G_CALLBACK (spin_copy_value), time); - - g_object_set_data (G_OBJECT (time), "is-time", GINT_TO_POINTER (TRUE)); - g_object_set_data (G_OBJECT (date), "is-time", GINT_TO_POINTER (FALSE)); - - time_spin = time; - date_spin = date; - - /* 2 seconds is what the indicator itself uses */ - guint time_id = g_timeout_add_seconds (2, (GSourceFunc)update_spinners, NULL); - g_signal_connect_swapped (time_spin, "destroy", G_CALLBACK (g_source_remove), GINT_TO_POINTER (time_id)); - update_spinners (); -} - -static void -hide_locations () -{ - if (loc_dlg != NULL) - gtk_widget_destroy (loc_dlg); -} - -static void -show_locations (GtkWidget * button, GtkWidget * dlg) -{ - if (loc_dlg == NULL) { - loc_dlg = datetime_setup_locations_dialog (tzmap); - gtk_window_set_transient_for (GTK_WINDOW (loc_dlg), GTK_WINDOW (dlg)); - g_signal_connect (loc_dlg, "destroy", G_CALLBACK (gtk_widget_destroyed), &loc_dlg); - g_signal_connect (dlg, "focus-in-event", G_CALLBACK (hide_locations), NULL); - gtk_widget_show_all (loc_dlg); - } - else { - gtk_window_present_with_time (GTK_WINDOW (loc_dlg), gtk_get_current_event_time ()); - } -} - -static gboolean -timezone_selected (GtkEntryCompletion * widget, GtkTreeModel * model, - GtkTreeIter * iter, gpointer user_data) -{ - const gchar * name, * zone; - - gtk_tree_model_get (model, iter, - TIMEZONE_COMPLETION_NAME, &name, - TIMEZONE_COMPLETION_ZONE, &zone, - -1); - - if (zone == NULL || zone[0] == 0) { - const gchar * strlon, * strlat; - gdouble lon = 0.0, lat = 0.0; - - gtk_tree_model_get (model, iter, - TIMEZONE_COMPLETION_LONGITUDE, &strlon, - TIMEZONE_COMPLETION_LATITUDE, &strlat, - -1); - - if (strlon != NULL && strlon[0] != 0) { - lon = strtod(strlon, NULL); - } - - if (strlat != NULL && strlat[0] != 0) { - lat = strtod(strlat, NULL); - } - - zone = cc_timezone_map_get_timezone_at_coords (tzmap, lon, lat); - } - - GSettings * conf = g_settings_new (SETTINGS_INTERFACE); - gchar * tz_name = g_strdup_printf ("%s %s", zone, name); - g_settings_set_string (conf, SETTINGS_TIMEZONE_NAME_S, tz_name); - g_free (tz_name); - g_object_unref (conf); - - cc_timezone_map_set_timezone (tzmap, zone); - - return FALSE; // Do normal action too -} - -static gboolean -entry_focus_out (GtkEntry * entry, GdkEventFocus * event) -{ - // If the name left in the entry doesn't match the current timezone name, - // show an error icon. It's always an error for the user to manually type in - // a timezone. - TzLocation * location = cc_timezone_map_get_location (tzmap); - if (location == NULL) - return FALSE; - - gchar * name = get_current_zone_name (location->zone); - gboolean correct = (g_strcmp0 (gtk_entry_get_text (entry), name) == 0); - g_free (name); - - gtk_entry_set_icon_from_stock (entry, GTK_ENTRY_ICON_SECONDARY, - correct ? NULL : GTK_STOCK_DIALOG_ERROR); - gtk_entry_set_icon_tooltip_text (entry, GTK_ENTRY_ICON_SECONDARY, - _("You need to choose a location to change the time zone.")); - gtk_entry_set_icon_activatable (entry, GTK_ENTRY_ICON_SECONDARY, FALSE); - return FALSE; -} - -static gboolean -key_pressed (GtkWidget * widget, GdkEventKey * event, gpointer user_data) -{ - switch (event->keyval) { - case GDK_KEY_Escape: - gtk_widget_destroy (widget); - return TRUE; - } - return FALSE; -} - -static GtkWidget * -get_child_of_type (GtkContainer * parent, GType type) -{ - GList * children, * iter; - - children = gtk_container_get_children (parent); - for (iter = children; iter; iter = iter->next) { - if (G_TYPE_CHECK_INSTANCE_TYPE (iter->data, type)) { - return GTK_WIDGET (iter->data); - } - } - - return NULL; -} - -static GtkWidget * -create_dialog (void) -{ - GError * error = NULL; - - GtkBuilder * builder = gtk_builder_new (); - gtk_builder_add_from_file (builder, DATETIME_DIALOG_UI_FILE, &error); - if (error != NULL) { - /* We have to abort, we can't continue without the ui file */ - g_error ("Could not load ui file %s: %s", DATETIME_DIALOG_UI_FILE, error->message); - g_error_free (error); - return NULL; - } - - gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE); - - GSettings * conf = g_settings_new (SETTINGS_INTERFACE); - -#define WIG(name) GTK_WIDGET (gtk_builder_get_object (builder, name)) - - /* Add policykit button */ - GtkWidget * polkit_button = polkit_lock_button_new ("org.gnome.settingsdaemon.datetimemechanism.configure"); - polkit_lock_button_set_unlock_text (POLKIT_LOCK_BUTTON (polkit_button), _("Unlock to change these settings")); - polkit_lock_button_set_lock_text (POLKIT_LOCK_BUTTON (polkit_button), _("Lock to prevent further changes")); - gtk_box_pack_start (GTK_BOX (WIG ("timeDateBox")), polkit_button, FALSE, TRUE, 0); - /* Make sure border around button is visible */ - GtkWidget * polkit_button_button = get_child_of_type (GTK_CONTAINER (polkit_button), GTK_TYPE_BUTTON); - if (polkit_button_button != NULL) { - gtk_button_set_relief (GTK_BUTTON (polkit_button_button), GTK_RELIEF_NORMAL); - } - - /* Add map */ - tzmap = cc_timezone_map_new (); - gtk_container_add (GTK_CONTAINER (WIG ("mapBox")), GTK_WIDGET (tzmap)); - /* Fufill the CC by Attribution license requirements for the Geonames lookup */ - cc_timezone_map_set_watermark (tzmap, "Geonames.org"); - - /* And completion entry */ - TimezoneCompletion * completion = timezone_completion_new (); - timezone_completion_watch_entry (completion, GTK_ENTRY (WIG ("timezoneEntry"))); - g_signal_connect (completion, "match-selected", G_CALLBACK (timezone_selected), NULL); - g_signal_connect (WIG ("timezoneEntry"), "focus-out-event", G_CALLBACK (entry_focus_out), NULL); - - /* Set up settings bindings */ - g_settings_bind (conf, SETTINGS_SHOW_CLOCK_S, WIG ("showClockCheck"), - "active", G_SETTINGS_BIND_DEFAULT); - g_settings_bind (conf, SETTINGS_SHOW_DAY_S, WIG ("showWeekdayCheck"), - "active", G_SETTINGS_BIND_DEFAULT); - g_settings_bind (conf, SETTINGS_SHOW_DATE_S, WIG ("showDateTimeCheck"), - "active", G_SETTINGS_BIND_DEFAULT); - g_settings_bind (conf, SETTINGS_SHOW_SECONDS_S, WIG ("showSecondsCheck"), - "active", G_SETTINGS_BIND_DEFAULT); - g_settings_bind_with_mapping (conf, SETTINGS_TIME_FORMAT_S, - WIG ("show12HourRadio"), "active", - G_SETTINGS_BIND_DEFAULT, - bind_hours_get, bind_hours_set, - GINT_TO_POINTER(TRUE), NULL); - g_settings_bind_with_mapping (conf, SETTINGS_TIME_FORMAT_S, - WIG ("show24HourRadio"), "active", - G_SETTINGS_BIND_DEFAULT, - bind_hours_get, bind_hours_set, - GINT_TO_POINTER(FALSE), NULL); - g_settings_bind (conf, SETTINGS_SHOW_CALENDAR_S, WIG ("showCalendarCheck"), - "active", G_SETTINGS_BIND_DEFAULT); - g_settings_bind (conf, SETTINGS_SHOW_WEEK_NUMBERS_S, WIG ("includeWeekNumbersCheck"), - "active", G_SETTINGS_BIND_DEFAULT); - g_settings_bind (conf, SETTINGS_SHOW_EVENTS_S, WIG ("showEventsCheck"), - "active", G_SETTINGS_BIND_DEFAULT); - g_settings_bind (conf, SETTINGS_SHOW_LOCATIONS_S, WIG ("showLocationsCheck"), - "active", G_SETTINGS_BIND_DEFAULT); - - /* Set up sensitivities */ - add_widget_dependency (WIG ("showCalendarCheck"), WIG ("calendarOptions")); - add_widget_dependency (WIG ("showClockCheck"), WIG ("clockOptions")); - add_widget_dependency (WIG ("showLocationsCheck"), WIG ("locationsButton")); - add_widget_dependency (WIG ("manualTimeRadio"), WIG ("manualOptions")); - add_polkit_dependency (polkit_button, WIG ("timeDateOptions")); - - /* Hacky proxy test for whether evolution-data-server is installed */ - gchar * evo_path = g_find_program_in_path ("evolution"); - gtk_widget_set_sensitive (WIG ("showEventsCheck"), (evo_path != NULL)); - g_free (evo_path); - - setup_time_spinners (WIG ("timeSpinner"), WIG ("dateSpinner")); - - GtkWidget * dlg = WIG ("timeDateDialog"); - auto_radio = WIG ("automaticTimeRadio"); - tz_entry = WIG ("timezoneEntry"); - - g_signal_connect (WIG ("locationsButton"), "clicked", G_CALLBACK (show_locations), dlg); - g_signal_connect (dlg, "key-press-event", G_CALLBACK (key_pressed), NULL); - - /* Grab proxy for settings daemon */ - g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, NULL, - "org.gnome.SettingsDaemon.DateTimeMechanism", - "/", - "org.gnome.SettingsDaemon.DateTimeMechanism", - NULL, proxy_ready, NULL); - - /* Grab proxy for datetime service, to see if it's running. It would - actually be more ideal to see if the indicator module itself is running, - but that doesn't yet claim a name on the bus. Presumably the service - would have been started by any such indicator, so this will at least tell - us if there *was* a datetime module run this session. */ - g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START, NULL, - SERVICE_NAME, SERVICE_OBJ, SERVICE_IFACE, - NULL, service_proxy_ready, WIG ("showClockCheck")); - -#undef WIG - - g_object_unref (conf); - g_object_unref (builder); - - return dlg; -} - -static UniqueResponse -message_received (UniqueApp * app, gint command, UniqueMessageData *message_data, - guint time, gpointer user_data) -{ - if (command == UNIQUE_ACTIVATE) { - gtk_window_present_with_time (GTK_WINDOW (user_data), time); - return UNIQUE_RESPONSE_OK; - } - return UNIQUE_RESPONSE_PASSTHROUGH; -} - -int -main (int argc, char ** argv) -{ - g_type_init (); - - /* Setting up i18n and gettext. Apparently, we need - all of these. */ - setlocale (LC_ALL, ""); - bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); - textdomain (GETTEXT_PACKAGE); - - gtk_init (&argc, &argv); - - UniqueApp * app = unique_app_new ("com.canonical.indicator.datetime.preferences", NULL); - - if (unique_app_is_running (app)) { - unique_app_send_message (app, UNIQUE_ACTIVATE, NULL); - } else { - // We're first instance. Yay! - GtkWidget * dlg = create_dialog (); - - g_signal_connect (app, "message-received", G_CALLBACK(message_received), dlg); - unique_app_watch_window (app, GTK_WINDOW (dlg)); - - gtk_widget_show_all (dlg); - g_signal_connect (dlg, "destroy", G_CALLBACK(gtk_main_quit), NULL); - gtk_main (); - } - - return 0; -} - diff --git a/src/timezone-completion.c b/src/timezone-completion.c deleted file mode 100644 index 7dcc28e..0000000 --- a/src/timezone-completion.c +++ /dev/null @@ -1,688 +0,0 @@ -/* -*- Mode: C; coding: utf-8; indent-tabs-mode: nil; tab-width: 2 -*- - -Copyright 2011 Canonical Ltd. - -Authors: - Michael Terry <michael.terry@canonical.com> - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published -by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR -PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <json-glib/json-glib.h> -#include <gdk/gdk.h> -#include <gdk/gdkkeysyms.h> -#include <glib/gi18n.h> -#include "timezone-completion.h" -#include "tz.h" - -enum { - LAST_SIGNAL -}; - -/* static guint signals[LAST_SIGNAL] = { }; */ - -typedef struct _TimezoneCompletionPrivate TimezoneCompletionPrivate; -struct _TimezoneCompletionPrivate -{ - GtkTreeModel * initial_model; - GtkEntry * entry; - guint queued_request; - guint changed_id; - guint keypress_id; - GCancellable * cancel; - gchar * request_text; - GHashTable * request_table; -}; - -#define TIMEZONE_COMPLETION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), TIMEZONE_COMPLETION_TYPE, TimezoneCompletionPrivate)) - -#define GEONAME_URL "http://geoname-lookup.ubuntu.com/?query=%s&release=%s&lang=%s" - -/* Prototypes */ -static void timezone_completion_class_init (TimezoneCompletionClass *klass); -static void timezone_completion_init (TimezoneCompletion *self); -static void timezone_completion_dispose (GObject *object); -static void timezone_completion_finalize (GObject *object); - -G_DEFINE_TYPE (TimezoneCompletion, timezone_completion, GTK_TYPE_ENTRY_COMPLETION); - -static gboolean -match_func (GtkEntryCompletion *completion, const gchar *key, - GtkTreeIter *iter, gpointer user_data) -{ - // geonames does the work for us - return TRUE; -} - -static void -save_and_use_model (TimezoneCompletion * completion, GtkTreeModel * model) -{ - TimezoneCompletionPrivate * priv = TIMEZONE_COMPLETION_GET_PRIVATE(completion); - - g_hash_table_insert (priv->request_table, g_strdup (priv->request_text), g_object_ref_sink (model)); - - if (model == priv->initial_model) - gtk_entry_completion_set_match_func (GTK_ENTRY_COMPLETION (completion), NULL, NULL, NULL); - else - gtk_entry_completion_set_match_func (GTK_ENTRY_COMPLETION (completion), match_func, NULL, NULL); - - gtk_entry_completion_set_model (GTK_ENTRY_COMPLETION (completion), model); - - if (priv->entry != NULL) { - gtk_entry_completion_complete (GTK_ENTRY_COMPLETION (completion)); - - /* By this time, the changed signal has come and gone. We didn't give a - model to use, so no popup appeared for user. Poke the entry again to show - popup in 300ms. */ - g_signal_emit_by_name (priv->entry, "changed"); - } -} - -static gint -sort_zone (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, - gpointer user_data) -{ - /* Anything that has text as a prefix goes first, in mostly sorted order. - Then everything else goes after, in mostly sorted order. */ - const gchar *casefolded_text = (const gchar *)user_data; - - const gchar *namea = NULL, *nameb = NULL; - gtk_tree_model_get (model, a, TIMEZONE_COMPLETION_NAME, &namea, -1); - gtk_tree_model_get (model, b, TIMEZONE_COMPLETION_NAME, &nameb, -1); - - gchar *casefolded_namea = NULL, *casefolded_nameb = NULL; - casefolded_namea = g_utf8_casefold (namea, -1); - casefolded_nameb = g_utf8_casefold (nameb, -1); - - gboolean amatches = FALSE, bmatches = FALSE; - amatches = strncmp (casefolded_text, casefolded_namea, strlen(casefolded_text)) == 0; - bmatches = strncmp (casefolded_text, casefolded_nameb, strlen(casefolded_text)) == 0; - - gint rv; - if (amatches && !bmatches) - rv = -1; - else if (bmatches && !amatches) - rv = 1; - else - rv = g_utf8_collate (casefolded_namea, casefolded_nameb); - - g_free (casefolded_namea); - g_free (casefolded_nameb); - return rv; -} - -static void -json_parse_ready (GObject *object, GAsyncResult *res, gpointer user_data) -{ - TimezoneCompletion * completion = TIMEZONE_COMPLETION (user_data); - TimezoneCompletionPrivate * priv = TIMEZONE_COMPLETION_GET_PRIVATE(completion); - GError * error = NULL; - const gchar * prev_name = NULL; - const gchar * prev_admin1 = NULL; - const gchar * prev_country = NULL; - - json_parser_load_from_stream_finish (JSON_PARSER (object), res, &error); - - if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) && priv->cancel) { - g_cancellable_reset (priv->cancel); - } - - if (error != NULL) { - if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) - save_and_use_model (completion, priv->initial_model); - g_warning ("Could not parse geoname JSON data: %s", error->message); - g_error_free (error); - return; - } - - GtkListStore * store = gtk_list_store_new (TIMEZONE_COMPLETION_LAST, - G_TYPE_STRING, - G_TYPE_STRING, - G_TYPE_STRING, - G_TYPE_STRING, - G_TYPE_STRING, - G_TYPE_STRING); - - JsonReader * reader = json_reader_new (json_parser_get_root (JSON_PARSER (object))); - - if (!json_reader_is_array (reader)) { - g_warning ("Could not parse geoname JSON data"); - save_and_use_model (completion, priv->initial_model); - g_object_unref (G_OBJECT (reader)); - return; - } - - gint i, count = json_reader_count_elements (reader); - for (i = 0; i < count; ++i) { - if (!json_reader_read_element (reader, i)) - continue; - - if (json_reader_is_object (reader)) { - const gchar * name = NULL; - const gchar * admin1 = NULL; - const gchar * country = NULL; - const gchar * longitude = NULL; - const gchar * latitude = NULL; - gboolean skip = FALSE; - if (json_reader_read_member (reader, "name")) { - name = json_reader_get_string_value (reader); - json_reader_end_member (reader); - } - if (json_reader_read_member (reader, "admin1")) { - admin1 = json_reader_get_string_value (reader); - json_reader_end_member (reader); - } - if (json_reader_read_member (reader, "country")) { - country = json_reader_get_string_value (reader); - json_reader_end_member (reader); - } - if (json_reader_read_member (reader, "longitude")) { - longitude = json_reader_get_string_value (reader); - json_reader_end_member (reader); - } - if (json_reader_read_member (reader, "latitude")) { - latitude = json_reader_get_string_value (reader); - json_reader_end_member (reader); - } - - if (g_strcmp0(name, prev_name) == 0 && - g_strcmp0(admin1, prev_admin1) == 0 && - g_strcmp0(country, prev_country) == 0) { - // Sometimes the data will have duplicate entries that only differ - // in longitude and latitude. e.g. "rio de janeiro", "wellington" - skip = TRUE; - } - - if (!skip) { - GtkTreeIter iter; - gtk_list_store_append (store, &iter); - gtk_list_store_set (store, &iter, - TIMEZONE_COMPLETION_ZONE, NULL, - TIMEZONE_COMPLETION_NAME, name, - TIMEZONE_COMPLETION_ADMIN1, admin1, - TIMEZONE_COMPLETION_COUNTRY, country, - TIMEZONE_COMPLETION_LONGITUDE, longitude, - TIMEZONE_COMPLETION_LATITUDE, latitude, - -1); - gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (store), - TIMEZONE_COMPLETION_NAME, sort_zone, - g_utf8_casefold(priv->request_text, -1), - g_free); - gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store), - TIMEZONE_COMPLETION_NAME, - GTK_SORT_ASCENDING); - } - - prev_name = name; - prev_admin1 = admin1; - prev_country = country; - } - - json_reader_end_element (reader); - } - - if (strlen (priv->request_text) < 4) { - gchar * lower_text = g_ascii_strdown (priv->request_text, -1); - if (g_strcmp0 (lower_text, "ut") == 0 || - g_strcmp0 (lower_text, "utc") == 0) { - GtkTreeIter iter; - gtk_list_store_append (store, &iter); - gtk_list_store_set (store, &iter, - TIMEZONE_COMPLETION_ZONE, "UTC", - TIMEZONE_COMPLETION_NAME, "UTC", - -1); - } - g_free (lower_text); - } - - save_and_use_model (completion, GTK_TREE_MODEL (store)); - g_object_unref (G_OBJECT (reader)); -} - -static void -geonames_data_ready (GObject *object, GAsyncResult *res, gpointer user_data) -{ - TimezoneCompletion * completion = TIMEZONE_COMPLETION (user_data); - TimezoneCompletionPrivate * priv = TIMEZONE_COMPLETION_GET_PRIVATE (completion); - GError * error = NULL; - GFileInputStream * stream; - - stream = g_file_read_finish (G_FILE (object), res, &error); - - if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) && priv->cancel) { - g_cancellable_reset (priv->cancel); - } - - if (error != NULL) { - if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) - save_and_use_model (completion, priv->initial_model); - g_warning ("Could not connect to geoname lookup server: %s", error->message); - g_error_free (error); - return; - } - - JsonParser * parser = json_parser_new (); - json_parser_load_from_stream_async (parser, G_INPUT_STREAM (stream), priv->cancel, - json_parse_ready, user_data); -} - -/* Returns message locale, with possible country info too like en_US */ -static gchar * -get_locale (void) -{ - /* Check LANGUAGE, LC_ALL, LC_MESSAGES, and LANG, treat as colon-separated */ - const gchar *env_names[] = {"LANGUAGE", "LC_ALL", "LC_MESSAGES", "LANG", NULL}; - const gchar *env = NULL; - gint i; - - for (i = 0; env_names[i]; i++) { - env = g_getenv (env_names[i]); - if (env != NULL && env[0] != 0) - break; - } - - if (env == NULL) - return NULL; - - /* Now, we split on colons as expected, but also on . and @ to filter out - extra pieces of locale we don't care about as we only use first chunk. */ - gchar **split = g_strsplit_set (env, ":.@", 2); - if (split == NULL) - return NULL; - - if (split[0] == NULL) { - g_strfreev (split); - return NULL; - } - - gchar *locale = g_strdup (split[0]); - g_strfreev (split); - return locale; -} - -static gchar * -get_version (void) -{ - static gchar *version = NULL; - - if (version == NULL) { - gchar *stdout = NULL; - g_spawn_command_line_sync ("lsb_release -rs", &stdout, NULL, NULL, NULL); - - if (stdout != NULL) - version = g_strstrip (stdout); - else - version = g_strdup(""); - } - - return version; -} - -static gboolean -request_zones (TimezoneCompletion * completion) -{ - TimezoneCompletionPrivate * priv = TIMEZONE_COMPLETION_GET_PRIVATE (completion); - - priv->queued_request = 0; - - if (priv->entry == NULL) { - return FALSE; - } - - /* Cancel any ongoing request */ - if (priv->cancel) { - g_cancellable_cancel (priv->cancel); - g_cancellable_reset (priv->cancel); - } - g_free (priv->request_text); - - const gchar * text = gtk_entry_get_text (priv->entry); - priv->request_text = g_strdup (text); - - gchar * escaped = g_uri_escape_string (text, NULL, FALSE); - gchar * version = get_version (); - gchar * locale = get_locale (); - gchar * url = g_strdup_printf (GEONAME_URL, escaped, version, locale); - g_free (locale); - g_free (version); - g_free (escaped); - - GFile * file = g_file_new_for_uri (url); - g_free (url); - - g_file_read_async (file, G_PRIORITY_DEFAULT, priv->cancel, - geonames_data_ready, completion); - - return FALSE; -} - -static void -entry_changed (GtkEntry * entry, TimezoneCompletion * completion) -{ - TimezoneCompletionPrivate * priv = TIMEZONE_COMPLETION_GET_PRIVATE (completion); - - if (priv->queued_request) { - g_source_remove (priv->queued_request); - priv->queued_request = 0; - } - - /* See if we've already got this one */ - const gchar * text = gtk_entry_get_text (priv->entry); - gpointer data; - if (g_hash_table_lookup_extended (priv->request_table, text, NULL, &data)) { - gtk_entry_completion_set_model (GTK_ENTRY_COMPLETION (completion), GTK_TREE_MODEL (data)); - } - else { - priv->queued_request = g_timeout_add (300, (GSourceFunc)request_zones, completion); - gtk_entry_completion_set_model (GTK_ENTRY_COMPLETION (completion), NULL); - } - gtk_entry_completion_complete (GTK_ENTRY_COMPLETION (completion)); -} - -static GtkWidget * -get_descendent (GtkWidget * parent, GType type) -{ - if (g_type_is_a (G_OBJECT_TYPE (parent), type)) - return parent; - - if (GTK_IS_CONTAINER (parent)) { - GList * children = gtk_container_get_children (GTK_CONTAINER (parent)); - GList * iter; - for (iter = children; iter; iter = iter->next) { - GtkWidget * found = get_descendent (GTK_WIDGET (iter->data), type); - if (found) { - g_list_free (children); - return found; - } - } - g_list_free (children); - } - - return NULL; -} - -/** - * The popup window and its GtkTreeView are private to our parent completion - * object. We can't get access to discover if there is a highlighted item or - * even if the window is showing right now. So this is a super hack to find - * it by looking through our toplevel's window group and finding a window with - * a GtkTreeView that points at our model. There should be only one ever, so - * we'll use the first one we find. - */ -static GtkTreeView * -find_popup_treeview (GtkWidget * widget, GtkTreeModel * model) -{ - GtkWidget * toplevel = gtk_widget_get_toplevel (widget); - if (!GTK_IS_WINDOW (toplevel)) - return NULL; - - GtkWindowGroup * group = gtk_window_get_group (GTK_WINDOW (toplevel)); - GList * windows = gtk_window_group_list_windows (group); - GList * iter; - for (iter = windows; iter; iter = iter->next) { - if (iter->data == toplevel) - continue; // Skip our own window, we don't have it - GtkWidget * view = get_descendent (GTK_WIDGET (iter->data), GTK_TYPE_TREE_VIEW); - if (view != NULL) { - GtkTreeModel * tree_model = gtk_tree_view_get_model (GTK_TREE_VIEW (view)); - if (GTK_IS_TREE_MODEL_FILTER (tree_model)) - tree_model = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (tree_model)); - if (tree_model == model) { - g_list_free (windows); - return GTK_TREE_VIEW (view); - } - } - } - g_list_free (windows); - - return NULL; -} - -static gboolean -entry_keypress (GtkEntry * entry, GdkEventKey *event, TimezoneCompletion * completion) -{ - if (event->keyval == GDK_ISO_Enter || - event->keyval == GDK_KP_Enter || - event->keyval == GDK_Return) { - /* Make sure that user has a selection to choose, otherwise ignore */ - GtkTreeModel * model = gtk_entry_completion_get_model (GTK_ENTRY_COMPLETION (completion)); - GtkTreeView * view = find_popup_treeview (GTK_WIDGET (entry), model); - if (view == NULL) { - // Just beep if popup hasn't appeared yet. - gtk_widget_error_bell (GTK_WIDGET (entry)); - return TRUE; - } - - GtkTreeSelection * sel = gtk_tree_view_get_selection (view); - GtkTreeModel * sel_model = NULL; - if (!gtk_tree_selection_get_selected (sel, &sel_model, NULL)) { - // No selection, we should help them out and select first item in list - GtkTreeIter iter; - if (gtk_tree_model_get_iter_first (sel_model, &iter)) - gtk_tree_selection_select_iter (sel, &iter); - // And fall through to normal handler code - } - } - - return FALSE; -} - -void -timezone_completion_watch_entry (TimezoneCompletion * completion, GtkEntry * entry) -{ - TimezoneCompletionPrivate * priv = TIMEZONE_COMPLETION_GET_PRIVATE (completion); - - if (priv->queued_request) { - g_source_remove (priv->queued_request); - priv->queued_request = 0; - } - if (priv->entry) { - g_signal_handler_disconnect (priv->entry, priv->changed_id); - g_signal_handler_disconnect (priv->entry, priv->keypress_id); - g_object_remove_weak_pointer (G_OBJECT (priv->entry), (gpointer *)&priv->entry); - gtk_entry_set_completion (priv->entry, NULL); - } - - guint id = g_signal_connect (entry, "changed", G_CALLBACK (entry_changed), completion); - priv->changed_id = id; - - id = g_signal_connect (entry, "key-press-event", G_CALLBACK (entry_keypress), completion); - priv->keypress_id = id; - - priv->entry = entry; - g_object_add_weak_pointer (G_OBJECT (entry), (gpointer *)&priv->entry); - - gtk_entry_set_completion (entry, GTK_ENTRY_COMPLETION (completion)); -} - -static GtkListStore * -get_initial_model (void) -{ - TzDB * db = tz_load_db (); - GPtrArray * locations = tz_get_locations (db); - - GtkListStore * store = gtk_list_store_new (TIMEZONE_COMPLETION_LAST, - G_TYPE_STRING, - G_TYPE_STRING, - G_TYPE_STRING, - G_TYPE_STRING, - G_TYPE_STRING, - G_TYPE_STRING); - - gint i; - for (i = 0; i < locations->len; ++i) { - TzLocation * loc = g_ptr_array_index (locations, i); - GtkTreeIter iter; - gtk_list_store_append (store, &iter); - - /* FIXME: need something better than below for non-English locales */ - const gchar * last_bit = ((const gchar *)strrchr (loc->zone, '/')) + 1; - if (last_bit == NULL) - last_bit = loc->zone; - gchar * name = g_strdup (last_bit); - gchar * underscore; - while ((underscore = strchr (name, '_'))) { - *underscore = ' '; - } - - gtk_list_store_set (store, &iter, - TIMEZONE_COMPLETION_ZONE, loc->zone, - TIMEZONE_COMPLETION_NAME, name, - TIMEZONE_COMPLETION_COUNTRY, loc->country, - -1); - - g_free (name); - } - - GtkTreeIter iter; - gtk_list_store_append (store, &iter); - gtk_list_store_set (store, &iter, - TIMEZONE_COMPLETION_ZONE, "UTC", - TIMEZONE_COMPLETION_NAME, "UTC", - -1); - - tz_db_free (db); - return store; -} - -static void -data_func (GtkCellLayout *cell_layout, GtkCellRenderer *cell, - GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer user_data) -{ - const gchar * name, * admin1, * country; - - gtk_tree_model_get (GTK_TREE_MODEL (tree_model), iter, - TIMEZONE_COMPLETION_NAME, &name, - TIMEZONE_COMPLETION_ADMIN1, &admin1, - TIMEZONE_COMPLETION_COUNTRY, &country, - -1); - - gchar * user_name; - if (country == NULL || country[0] == 0) { - user_name = g_strdup (name); - } else if (admin1 == NULL || admin1[0] == 0) { - user_name = g_strdup_printf ("%s <small>(%s)</small>", name, country); - } else { - user_name = g_strdup_printf ("%s <small>(%s, %s)</small>", name, admin1, country); - } - - g_object_set (G_OBJECT (cell), "markup", user_name, NULL); -} - -static void -timezone_completion_class_init (TimezoneCompletionClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - g_type_class_add_private (klass, sizeof (TimezoneCompletionPrivate)); - - object_class->dispose = timezone_completion_dispose; - object_class->finalize = timezone_completion_finalize; - - return; -} - -static void -timezone_completion_init (TimezoneCompletion * self) -{ - TimezoneCompletionPrivate * priv = TIMEZONE_COMPLETION_GET_PRIVATE (self); - - priv->initial_model = GTK_TREE_MODEL (get_initial_model ()); - - g_object_set (G_OBJECT (self), - "text-column", TIMEZONE_COMPLETION_NAME, - "popup-set-width", FALSE, - NULL); - - priv->cancel = g_cancellable_new (); - - priv->request_table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref); - - GtkCellRenderer * cell = gtk_cell_renderer_text_new (); - gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (self), cell, TRUE); - gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (self), cell, data_func, NULL, NULL); - - return; -} - -static void -timezone_completion_dispose (GObject * object) -{ - G_OBJECT_CLASS (timezone_completion_parent_class)->dispose (object); - - TimezoneCompletion * completion = TIMEZONE_COMPLETION (object); - TimezoneCompletionPrivate * priv = TIMEZONE_COMPLETION_GET_PRIVATE (completion); - - if (priv->changed_id) { - if (priv->entry) - g_signal_handler_disconnect (priv->entry, priv->changed_id); - priv->changed_id = 0; - } - - if (priv->keypress_id) { - if (priv->entry) - g_signal_handler_disconnect (priv->entry, priv->keypress_id); - priv->keypress_id = 0; - } - - if (priv->entry != NULL) { - g_object_remove_weak_pointer (G_OBJECT (priv->entry), (gpointer *)&priv->entry); - } - - if (priv->initial_model != NULL) { - g_object_unref (G_OBJECT (priv->initial_model)); - priv->initial_model = NULL; - } - - if (priv->queued_request) { - g_source_remove (priv->queued_request); - priv->queued_request = 0; - } - - if (priv->cancel != NULL) { - g_cancellable_cancel (priv->cancel); - g_object_unref (priv->cancel); - priv->cancel = NULL; - } - - if (priv->request_text != NULL) { - g_free (priv->request_text); - priv->request_text = NULL; - } - - if (priv->request_table != NULL) { - g_hash_table_destroy (priv->request_table); - priv->request_table = NULL; - } - - return; -} - -static void -timezone_completion_finalize (GObject * object) -{ - G_OBJECT_CLASS (timezone_completion_parent_class)->finalize (object); - return; -} - -TimezoneCompletion * -timezone_completion_new () -{ - TimezoneCompletion * self = g_object_new (TIMEZONE_COMPLETION_TYPE, NULL); - return self; -} - diff --git a/src/timezone-completion.h b/src/timezone-completion.h deleted file mode 100644 index fdfb234..0000000 --- a/src/timezone-completion.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- Mode: C; coding: utf-8; indent-tabs-mode: nil; tab-width: 2 -*- - -Copyright 2011 Canonical Ltd. - -Authors: - Michael Terry <michael.terry@canonical.com> - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published -by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR -PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#ifndef __TIMEZONE_COMPLETION_H__ -#define __TIMEZONE_COMPLETION_H__ - -#include <glib.h> -#include <glib-object.h> -#include <gtk/gtk.h> - -G_BEGIN_DECLS - -#define TIMEZONE_COMPLETION_TYPE (timezone_completion_get_type ()) -#define TIMEZONE_COMPLETION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TIMEZONE_COMPLETION_TYPE, TimezoneCompletion)) -#define TIMEZONE_COMPLETION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TIMEZONE_COMPLETION_TYPE, TimezoneCompletionClass)) -#define IS_TIMEZONE_COMPLETION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TIMEZONE_COMPLETION_TYPE)) -#define IS_TIMEZONE_COMPLETION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TIMEZONE_COMPLETION_TYPE)) -#define TIMEZONE_COMPLETION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TIMEZONE_COMPLETION_TYPE, TimezoneCompletionClass)) - -typedef struct _TimezoneCompletion TimezoneCompletion; -typedef struct _TimezoneCompletionClass TimezoneCompletionClass; - -struct _TimezoneCompletionClass { - GtkEntryCompletionClass parent_class; -}; - -struct _TimezoneCompletion { - GtkEntryCompletion parent; -}; - -#define TIMEZONE_COMPLETION_ZONE 0 -#define TIMEZONE_COMPLETION_NAME 1 -#define TIMEZONE_COMPLETION_ADMIN1 2 -#define TIMEZONE_COMPLETION_COUNTRY 3 -#define TIMEZONE_COMPLETION_LONGITUDE 4 -#define TIMEZONE_COMPLETION_LATITUDE 5 -#define TIMEZONE_COMPLETION_LAST 6 - -GType timezone_completion_get_type (void); -TimezoneCompletion * timezone_completion_new (); -void timezone_completion_watch_entry (TimezoneCompletion * completion, GtkEntry * entry); - -G_END_DECLS - -#endif /* __TIMEZONE_COMPLETION_H__ */ - |