diff options
Diffstat (limited to 'panels/datetime')
-rw-r--r-- | panels/datetime/backward | 34 | ||||
-rw-r--r-- | panels/datetime/cc-datetime-panel.c | 2 | ||||
-rw-r--r-- | panels/datetime/meson.build | 25 | ||||
-rw-r--r-- | panels/datetime/test-endianess.c | 65 | ||||
-rw-r--r-- | panels/datetime/test-timezone-gfx.c | 61 | ||||
-rw-r--r-- | panels/datetime/test-timezone.c | 108 |
6 files changed, 26 insertions, 269 deletions
diff --git a/panels/datetime/backward b/panels/datetime/backward index f1f95a894..8594be65f 100644 --- a/panels/datetime/backward +++ b/panels/datetime/backward @@ -1,13 +1,12 @@ -# <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 TARGET LINK-NAME +Link Africa/Nairobi Africa/Asmera +Link Africa/Abidjan Africa/Timbuktu Link America/Argentina/Catamarca America/Argentina/ComodRivadavia Link America/Adak America/Atka Link America/Argentina/Buenos_Aires America/Buenos_Aires @@ -21,17 +20,25 @@ 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/Toronto America/Montreal Link America/Rio_Branco America/Porto_Acre Link America/Argentina/Cordoba America/Rosario -Link America/St_Thomas America/Virgin +Link America/Tijuana America/Santa_Isabel +Link America/Denver America/Shiprock +Link America/Port_of_Spain America/Virgin +Link Pacific/Auckland Antarctica/South_Pole Link Asia/Ashgabat Asia/Ashkhabad -Link Asia/Chongqing Asia/Chungking +Link Asia/Kolkata Asia/Calcutta +Link Asia/Shanghai Asia/Chongqing +Link Asia/Shanghai Asia/Chungking Link Asia/Dhaka Asia/Dacca +Link Asia/Shanghai Asia/Harbin +Link Asia/Urumqi Asia/Kashgar Link Asia/Kathmandu Asia/Katmandu -Link Asia/Kolkata Asia/Calcutta Link Asia/Macau Asia/Macao -Link Asia/Jerusalem Asia/Tel_Aviv +Link Asia/Yangon Asia/Rangoon Link Asia/Ho_Chi_Minh Asia/Saigon +Link Asia/Jerusalem Asia/Tel_Aviv Link Asia/Thimphu Asia/Thimbu Link Asia/Makassar Asia/Ujung_Pandang Link Asia/Ulaanbaatar Asia/Ulan_Bator @@ -54,7 +61,9 @@ 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 +# This line is commented out, as the name exceeded the 14-character limit +# and was an unused misnomer. +#Link America/Regina Canada/East-Saskatchewan Link America/Toronto Canada/Eastern Link America/Edmonton Canada/Mountain Link America/St_Johns Canada/Newfoundland @@ -89,10 +98,11 @@ Link Pacific/Auckland NZ Link Pacific/Chatham NZ-CHAT Link America/Denver Navajo Link Asia/Shanghai PRC +Link Pacific/Honolulu Pacific/Johnston +Link Pacific/Pohnpei Pacific/Ponape Link Pacific/Pago_Pago Pacific/Samoa -Link Pacific/Chuuk Pacific/Yap Link Pacific/Chuuk Pacific/Truk -Link Pacific/Pohnpei Pacific/Ponape +Link Pacific/Chuuk Pacific/Yap Link Europe/Warsaw Poland Link Europe/Lisbon Portugal Link Asia/Taipei ROC @@ -115,4 +125,4 @@ Link Pacific/Pago_Pago US/Samoa Link Etc/UTC UTC Link Etc/UTC Universal Link Europe/Moscow W-SU -Link Etc/UTC Zulu +Link Etc/UTC Zulu
\ No newline at end of file diff --git a/panels/datetime/cc-datetime-panel.c b/panels/datetime/cc-datetime-panel.c index 2ea385188..15f3dd8c3 100644 --- a/panels/datetime/cc-datetime-panel.c +++ b/panels/datetime/cc-datetime-panel.c @@ -25,7 +25,7 @@ #include <langinfo.h> #include <sys/time.h> -#include "shell/list-box-helper.h" +#include "list-box-helper.h" #include "cc-timezone-map.h" #include "timedated.h" #include "date-endian.h" diff --git a/panels/datetime/meson.build b/panels/datetime/meson.build index ba82618f2..5073f263d 100644 --- a/panels/datetime/meson.build +++ b/panels/datetime/meson.build @@ -183,33 +183,14 @@ cflags += [ '-DGNOMELOCALEDIR="@0@"'.format(control_center_localedir) ] -panels_libs += static_library( +datetime_panel_lib = static_library( cappletname, sources: sources + resources, - include_directories: top_inc, + include_directories: [ top_inc, common_inc ], dependencies: deps, c_args: cflags ) - -test_cflags = '-DSRCDIR="@0@"'.format(meson.current_source_dir()) - -test_units = [ - #['test-timezone', ['cc-timezone-map.c', 'tz.c'] + resources, [m_dep], []], - ['test-timezone-gfx', ['tz.c'] + resources, [m_dep], [test_cflags]], - ['test-endianess', ['date-endian.c'], [], []] -] - -foreach unit: test_units - exe = executable( - unit[0], - [unit[0] + '.c'] + unit[1], - include_directories: top_inc, - dependencies: deps + unit[2], - c_args: cflags + unit[3] - ) - - test(unit[0], exe) -endforeach +panels_libs += datetime_panel_lib subdir('po-timezones') subdir('icons') diff --git a/panels/datetime/test-endianess.c b/panels/datetime/test-endianess.c deleted file mode 100644 index 06b26131b..000000000 --- a/panels/datetime/test-endianess.c +++ /dev/null @@ -1,65 +0,0 @@ -#include <glib.h> -#include <glib/gi18n.h> -#include <locale.h> -#include "date-endian.h" - -static int verbose = 0; - -static void -print_endianess (const char *lang) -{ - DateEndianess endianess; - - if (lang != NULL) { - setlocale (LC_TIME, lang); - endianess = date_endian_get_for_lang (lang, verbose); - } else { - endianess = date_endian_get_default (verbose); - } - if (verbose) - g_print ("\t\t%s\n", date_endian_to_string (endianess)); -} - -static void -test_endianess (void) -{ - GDir *dir; - const char *name; - - dir = g_dir_open ("/usr/share/i18n/locales/", 0, NULL); - if (dir == NULL) { - /* Try with /usr/share/locale/ - * https://bugzilla.gnome.org/show_bug.cgi?id=646780 */ - dir = g_dir_open ("/usr/share/locale/", 0, NULL); - if (dir == NULL) { - g_assert_not_reached (); - } - } - - while ((name = g_dir_read_name (dir)) != NULL) - print_endianess (name); -} - -int main (int argc, char **argv) -{ - setlocale (LC_ALL, ""); - bind_textdomain_codeset ("libc", "UTF-8"); - - g_test_init (&argc, &argv, NULL); - - g_setenv ("G_DEBUG", "fatal_warnings", FALSE); - - if (argv[1] != NULL) { - verbose = 1; - - if (g_str_equal (argv[1], "-c")) - print_endianess (NULL); - else - print_endianess (argv[1]); - return 0; - } - - g_test_add_func ("/datetime/endianess", test_endianess); - - return g_test_run (); -} diff --git a/panels/datetime/test-timezone-gfx.c b/panels/datetime/test-timezone-gfx.c deleted file mode 100644 index 2beda3f7c..000000000 --- a/panels/datetime/test-timezone-gfx.c +++ /dev/null @@ -1,61 +0,0 @@ -#include <config.h> -#include <locale.h> - -#include "tz.h" - -static void -test_timezone_gfx (gconstpointer data) -{ - const char *pixmap_dir = data; - g_autoptr(TzDB) db = NULL; - GPtrArray *locs; - guint i; - - db = tz_load_db (); - locs = tz_get_locations (db); - for (i = 0; i < locs->len ; i++) { - TzLocation *loc = locs->pdata[i]; - TzInfo *info; - g_autofree gchar *filename = NULL; - g_autofree gchar *path = NULL; - 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); - g_test_fail (); - } - } -} - -int main (int argc, char **argv) -{ - char *pixmap_dir; - - setlocale (LC_ALL, ""); - g_test_init (&argc, &argv, NULL); - - g_setenv ("G_DEBUG", "fatal_warnings", FALSE); - - if (argc == 2) { - pixmap_dir = g_strdup (argv[1]); - } else if (argc == 1) { - pixmap_dir = g_strdup (SRCDIR "/data/"); - } else { - g_message ("Usage: %s [PIXMAP DIRECTORY]", argv[0]); - return 1; - } - - g_test_add_data_func ("/datetime/timezone-gfx", pixmap_dir, test_timezone_gfx); - - return g_test_run (); -} diff --git a/panels/datetime/test-timezone.c b/panels/datetime/test-timezone.c deleted file mode 100644 index ca9860118..000000000 --- a/panels/datetime/test-timezone.c +++ /dev/null @@ -1,108 +0,0 @@ -#include <locale.h> -#include <gtk/gtk.h> -#include "cc-timezone-map.h" - -#define TZ_DIR "/usr/share/zoneinfo/" - -static GList * -get_timezone_list (GList *tzs, - const char *top_path, - const char *subpath) -{ - GDir *dir; - char *fullpath; - const char *name; - - if (subpath == NULL) - fullpath = g_strdup (top_path); - else - fullpath = g_build_filename (top_path, subpath, NULL); - dir = g_dir_open (fullpath, 0, NULL); - if (dir == NULL) { - g_warning ("Could not open %s", fullpath); - return NULL; - } - while ((name = g_dir_read_name (dir)) != NULL) { - g_autofree gchar *path = NULL; - - if (g_str_has_suffix (name, ".tab")) - continue; - - if (subpath != NULL) - path = g_build_filename (top_path, subpath, name, NULL); - else - path = g_build_filename (top_path, name, NULL); - if (g_file_test (path, G_FILE_TEST_IS_DIR)) { - if (subpath == NULL) { - tzs = get_timezone_list (tzs, top_path, name); - } else { - g_autofree gchar *new_subpath = NULL; - new_subpath = g_strdup_printf ("%s/%s", subpath, name); - tzs = get_timezone_list (tzs, top_path, new_subpath); - } - } else if (g_file_test (path, G_FILE_TEST_IS_REGULAR)) { - if (subpath == NULL) - tzs = g_list_prepend (tzs, g_strdup (name)); - else { - char *tz; - tz = g_strdup_printf ("%s/%s", subpath, name); - tzs = g_list_prepend (tzs, tz); - } - } - } - g_dir_close (dir); - - return tzs; -} - -static void -test_timezone (void) -{ - CcTimezoneMap *map; - TzDB *tz_db; - GList *tzs, *l; - GHashTable *ht; - - ht = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); - map = cc_timezone_map_new (); - tz_db = tz_load_db (); - tzs = get_timezone_list (NULL, TZ_DIR, NULL); - for (l = tzs; l != NULL; l = l->next) { - const gchar *timezone = l->data; - g_autofree gchar *clean_tz = NULL; - - clean_tz = tz_info_get_clean_name (tz_db, timezone); - - if (cc_timezone_map_set_timezone (map, clean_tz) == FALSE) { - if (g_hash_table_lookup (ht, clean_tz) == NULL) { - if (g_strcmp0 (clean_tz, timezone) == 0) - g_print ("Failed to locate timezone '%s'\n", timezone); - else - g_print ("Failed to locate timezone '%s' (original name: '%s')\n", clean_tz, timezone); - g_hash_table_insert (ht, g_strdup (clean_tz), GINT_TO_POINTER (TRUE)); - g_test_fail (); - } - /* We don't warn for those two, we'll just fallback - * in the panel code */ - if (!g_str_equal (clean_tz, "posixrules") && - !g_str_equal (clean_tz, "Factory")) - g_test_fail (); - } - } - g_list_free_full (tzs, g_free); - tz_db_free (tz_db); - g_hash_table_destroy (ht); -} - -int main (int argc, char **argv) -{ - setlocale (LC_ALL, ""); - gtk_init (NULL, NULL); - g_test_init (&argc, &argv, NULL); - - g_setenv ("G_DEBUG", "fatal_warnings", FALSE); - - g_test_add_func ("/datetime/timezone", test_timezone); - - return g_test_run (); -} |