diff options
Diffstat (limited to 'src/timezone-completion.c')
-rw-r--r-- | src/timezone-completion.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/timezone-completion.c b/src/timezone-completion.c index ab74219..ddeef29 100644 --- a/src/timezone-completion.c +++ b/src/timezone-completion.c @@ -134,14 +134,15 @@ json_parse_ready (GObject *object, GAsyncResult *res, gpointer user_data) json_parser_load_from_stream_finish (JSON_PARSER (object), res, &error); - if (priv->cancel && (error == NULL || error->code != G_IO_ERROR_CANCELLED)) { + 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); - save_and_use_model (completion, priv->initial_model); return; } @@ -259,14 +260,15 @@ geonames_data_ready (GObject *object, GAsyncResult *res, gpointer user_data) stream = g_file_read_finish (G_FILE (object), res, &error); - if (priv->cancel && (error == NULL || error->code != G_IO_ERROR_CANCELLED)) { + 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); - save_and_use_model (completion, priv->initial_model); return; } |