datetime: Return FALSE when we fail to find a timezone
This commit is contained in:
parent
9ab02da28b
commit
cb3c0af71d
2 changed files with 10 additions and 4 deletions
|
@ -636,17 +636,19 @@ cc_timezone_map_new (void)
|
|||
return g_object_new (CC_TYPE_TIMEZONE_MAP, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
gboolean
|
||||
cc_timezone_map_set_timezone (CcTimezoneMap *map,
|
||||
const gchar *timezone)
|
||||
{
|
||||
GPtrArray *locations;
|
||||
guint i;
|
||||
char *real_tz;
|
||||
gboolean ret;
|
||||
|
||||
real_tz = g_hash_table_lookup (map->priv->alias_db, timezone);
|
||||
|
||||
locations = tz_get_locations (map->priv->tzdb);
|
||||
ret = FALSE;
|
||||
|
||||
for (i = 0; i < locations->len; i++)
|
||||
{
|
||||
|
@ -655,11 +657,15 @@ cc_timezone_map_set_timezone (CcTimezoneMap *map,
|
|||
if (!g_strcmp0 (loc->zone, real_tz ? real_tz : timezone))
|
||||
{
|
||||
set_location (map, loc);
|
||||
ret = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ret)
|
||||
gtk_widget_queue_draw (GTK_WIDGET (map));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
TzLocation *
|
||||
|
|
|
@ -70,7 +70,7 @@ GType cc_timezone_map_get_type (void) G_GNUC_CONST;
|
|||
|
||||
CcTimezoneMap *cc_timezone_map_new (void);
|
||||
|
||||
void cc_timezone_map_set_timezone (CcTimezoneMap *map,
|
||||
gboolean cc_timezone_map_set_timezone (CcTimezoneMap *map,
|
||||
const gchar *timezone);
|
||||
TzLocation * cc_timezone_map_get_location (CcTimezoneMap *map);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue