From 2347a5e66d2b986932631e862ea3fc8b987d5b0b Mon Sep 17 00:00:00 2001 From: raveit65 Date: Sun, 29 May 2016 23:58:26 +0200 Subject: libgdict: fix emission of lookup-start Emit lookup-start at the beginning of every lookup command instead of after receiving response from server. https://bugzilla.gnome.org/show_bug.cgi?id=537807 taken from: https://git.gnome.org/browse/gnome-dictionary/commit/?id=4bf5701 --- mate-dictionary/libgdict/gdict-client-context.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/mate-dictionary/libgdict/gdict-client-context.c b/mate-dictionary/libgdict/gdict-client-context.c index 118a0d91..af13e800 100644 --- a/mate-dictionary/libgdict/gdict-client-context.c +++ b/mate-dictionary/libgdict/gdict-client-context.c @@ -1395,8 +1395,6 @@ gdict_client_context_parse_line (GdictClientContext *context, p = g_utf8_next_char (p); GDICT_NOTE (DICT, "server replied: %d databases found", atoi (p)); - - g_signal_emit_by_name (context, "lookup-start"); } else if (0 == strcmp (buffer, ".")) priv->command->state = S_FINISH; @@ -1447,8 +1445,6 @@ gdict_client_context_parse_line (GdictClientContext *context, p = g_utf8_next_char (p); GDICT_NOTE (DICT, "server replied: %d strategies found", atoi (p)); - - g_signal_emit_by_name (context, "lookup-start"); } else if (0 == strcmp (buffer, ".")) priv->command->state = S_FINISH; @@ -1502,8 +1498,6 @@ gdict_client_context_parse_line (GdictClientContext *context, priv->command->data = def; priv->command->data_destroy = (GDestroyNotify) gdict_definition_unref; - - g_signal_emit_by_name (context, "lookup-start"); } else if (priv->status_code == GDICT_STATUS_WORD_DB_NAME) { @@ -1611,8 +1605,6 @@ gdict_client_context_parse_line (GdictClientContext *context, p = g_utf8_next_char (p); GDICT_NOTE (DICT, "server replied: %d matches found", atoi (p)); - - g_signal_emit_by_name (context, "lookup-start"); } else if (0 == strcmp (buffer, ".")) priv->command->state = S_FINISH; @@ -2046,6 +2038,8 @@ gdict_client_context_get_databases (GdictContext *context, client_ctx = GDICT_CLIENT_CONTEXT (context); + g_signal_emit_by_name (context, "lookup-start"); + if (!gdict_client_context_is_connected (client_ctx)) { GError *connect_error = NULL; @@ -2053,6 +2047,8 @@ gdict_client_context_get_databases (GdictContext *context, gdict_client_context_connect (client_ctx, &connect_error); if (connect_error) { + g_signal_emit_by_name (context, "lookup-end"); + g_propagate_error (error, connect_error); return FALSE; @@ -2075,6 +2071,8 @@ gdict_client_context_get_strategies (GdictContext *context, client_ctx = GDICT_CLIENT_CONTEXT (context); + g_signal_emit_by_name (context, "lookup-start"); + if (!gdict_client_context_is_connected (client_ctx)) { GError *connect_error = NULL; @@ -2082,6 +2080,8 @@ gdict_client_context_get_strategies (GdictContext *context, gdict_client_context_connect (client_ctx, &connect_error); if (connect_error) { + g_signal_emit_by_name (context, "lookup-end"); + g_propagate_error (error, connect_error); return FALSE; @@ -2106,6 +2106,8 @@ gdict_client_context_define_word (GdictContext *context, client_ctx = GDICT_CLIENT_CONTEXT (context); + g_signal_emit_by_name (context, "lookup-start"); + if (!gdict_client_context_is_connected (client_ctx)) { GError *connect_error = NULL; @@ -2113,6 +2115,8 @@ gdict_client_context_define_word (GdictContext *context, gdict_client_context_connect (client_ctx, &connect_error); if (connect_error) { + g_signal_emit_by_name (context, "lookup-end"); + g_propagate_error (error, connect_error); return FALSE; @@ -2140,6 +2144,8 @@ gdict_client_context_match_word (GdictContext *context, client_ctx = GDICT_CLIENT_CONTEXT (context); + g_signal_emit_by_name (context, "lookup-start"); + if (!gdict_client_context_is_connected (client_ctx)) { GError *connect_error = NULL; @@ -2147,6 +2153,8 @@ gdict_client_context_match_word (GdictContext *context, gdict_client_context_connect (client_ctx, &connect_error); if (connect_error) { + g_signal_emit_by_name (context, "lookup-end"); + g_propagate_error (error, connect_error); return FALSE; -- cgit v1.2.1