Commit 6e719557 authored by Bastien Nocera's avatar Bastien Nocera

datetime: We shouldn't have to know where TZ files live

That's a job for the backend to sort out.
parent 06573b29
......@@ -257,7 +257,6 @@ apply_button_clicked_cb (GtkButton *button,
CcDateTimePanelPrivate *priv = self->priv;
guint mon, y, d;
time_t unixtime;
gchar *filename;
GDateTime *old_date;
old_date = priv->date;
......@@ -278,10 +277,7 @@ apply_button_clicked_cb (GtkButton *button,
if (priv->current_location)
{
filename = g_build_filename (SYSTEM_ZONEINFODIR,
priv->current_location->zone,
NULL);
set_system_timezone_async (filename, (GFunc) set_timezone_cb, self, NULL);
set_system_timezone_async (priv->current_location->zone, (GFunc) set_timezone_cb, self, NULL);
}
}
......
......@@ -148,7 +148,7 @@ typedef struct {
gint ref_count;
gchar *call;
gint64 time;
gchar *filename;
gchar *tz;
GFunc callback;
gpointer data;
GDestroyNotify notify;
......@@ -163,7 +163,7 @@ free_data (gpointer d)
if (data->ref_count == 0) {
if (data->notify)
data->notify (data->data);
g_free (data->filename);
g_free (data->tz);
g_free (data);
}
}
......@@ -241,7 +241,7 @@ set_time_async (SetTimeCallbackData *data)
data, free_data,
INT_MAX,
/* parameters: */
G_TYPE_STRING, data->filename,
G_TYPE_STRING, data->tz,
G_TYPE_INVALID,
/* return values: */
G_TYPE_INVALID);
......@@ -262,7 +262,7 @@ set_system_time_async (gint64 time,
data->ref_count = 1;
data->call = "SetTime";
data->time = time;
data->filename = NULL;
data->tz = NULL;
data->callback = callback;
data->data = d;
data->notify = notify;
......@@ -272,21 +272,20 @@ set_system_time_async (gint64 time,
}
void
set_system_timezone_async (const gchar *filename,
set_system_timezone_async (const gchar *tz,
GFunc callback,
gpointer d,
GDestroyNotify notify)
{
SetTimeCallbackData *data;
if (filename == NULL)
return;
g_return_if_fail (tz != NULL);
data = g_new0 (SetTimeCallbackData, 1);
data->ref_count = 1;
data->call = "SetTimezone";
data->time = -1;
data->filename = g_strdup (filename);
data->tz = g_strdup (tz);
data->callback = callback;
data->data = d;
data->notify = notify;
......
......@@ -41,17 +41,9 @@ void set_system_time_async (gint64 time,
gpointer data,
GDestroyNotify notify);
void set_system_timezone_async (const gchar *filename,
void set_system_timezone_async (const gchar *tz,
GFunc callback,
gpointer data,
GDestroyNotify notify);
#ifdef HAVE_SOLARIS
#define SYSTEM_ZONEINFODIR "/usr/share/lib/zoneinfo/tab"
#else
#define SYSTEM_ZONEINFODIR "/usr/share/zoneinfo"
#endif
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment