datetime: Load backward file from GResource

So it doesn't warn when not installed in the target prefix yet.

https://bugzilla.gnome.org/show_bug.cgi?id=752831
This commit is contained in:
Bastien Nocera 2015-07-23 22:07:41 +02:00
parent 062807d19d
commit 557dc46d97
3 changed files with 13 additions and 13 deletions

View file

@ -16,9 +16,6 @@ dist_icons256_DATA = icons/256x256/preferences-system-time.png
iconsscalabledir = $(datadir)/icons/hicolor/scalable/apps
dist_iconsscalable_DATA = icons/scalable/preferences-system-time.svg
tzdatadir = $(pkgdatadir)/datetime
dist_tzdata_DATA = backward
AM_CPPFLAGS = \
$(PANEL_CFLAGS) \
$(DATETIME_PANEL_CFLAGS) \
@ -28,11 +25,11 @@ AM_CPPFLAGS = \
noinst_PROGRAMS = test-timezone-gfx test-endianess test-timezone
test_timezone_SOURCES = test-timezone.c cc-timezone-map.h cc-timezone-map.c tz.c tz.h
test_timezone_SOURCES = test-timezone.c cc-timezone-map.h cc-timezone-map.c tz.c tz.h cc-datetime-resources.c cc-datetime-resources.h
test_timezone_LDADD = $(DATETIME_PANEL_LIBS)
test_timezone_CFLAGS = $(DATETIME_PANEL_CFLAGS)
test_timezone_gfx_SOURCES = test-timezone-gfx.c tz.c tz.h
test_timezone_gfx_SOURCES = test-timezone-gfx.c tz.c tz.h cc-datetime-resources.c cc-datetime-resources.h
test_timezone_gfx_LDADD = $(DATETIME_PANEL_LIBS)
test_timezone_gfx_CFLAGS = $(DATETIME_PANEL_CFLAGS)

View file

@ -6,6 +6,7 @@
<file preprocess="xml-stripblanks">big.ui</file>
<file preprocess="xml-stripblanks">middle.ui</file>
<file preprocess="xml-stripblanks">ydm.ui</file>
<file>backward</file>
<file alias="bg.png">data/bg.png</file>
<file alias="bg_dim.png">data/bg_dim.png</file>
<file alias="cc.png">data/cc.png</file>

View file

@ -30,6 +30,7 @@
#include <math.h>
#include <string.h>
#include "tz.h"
#include "cc-datetime-resources.h"
/* Forward declarations for private functions */
@ -426,19 +427,20 @@ sort_locations_by_country (GPtrArray *locations)
static void
load_backward_tz (TzDB *tz_db)
{
GError *error = NULL;
char **lines, *contents;
char **lines;
GBytes *bytes;
const char *contents;
guint i;
tz_db->backward = 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;
}
bytes = g_resources_lookup_data ("/org/gnome/control-center/datetime/backward",
G_RESOURCE_LOOKUP_FLAGS_NONE, NULL);
contents = (const char *) g_bytes_get_data (bytes, NULL);
lines = g_strsplit (contents, "\n", -1);
g_free (contents);
g_bytes_unref (bytes);
for (i = 0; lines[i] != NULL; i++)
{
char **items;