[gnome-builder] code-assist: avoid extra code assistant calls if service was not found



commit 6e1e7b69310da4e4906bcb1a9ae54661fd0c9f23
Author: Christian Hergert <christian hergert me>
Date:   Thu Dec 25 00:15:28 2014 -0800

    code-assist: avoid extra code assistant calls if service was not found

 src/code-assistant/gb-source-code-assistant.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/code-assistant/gb-source-code-assistant.c b/src/code-assistant/gb-source-code-assistant.c
index 38e57d1..432f3e8 100644
--- a/src/code-assistant/gb-source-code-assistant.c
+++ b/src/code-assistant/gb-source-code-assistant.c
@@ -47,6 +47,8 @@ struct _GbSourceCodeAssistantPrivate
 
   guint           parse_timeout;
   guint           active;
+
+  guint           service_unknown : 1;
 };
 
 enum {
@@ -315,6 +317,8 @@ gb_source_code_assistant_parse_cb (GObject      *source_object,
 
   if (!gca_service_call_parse_finish (service, &document_path, result, &error))
     {
+      if (g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_SERVICE_UNKNOWN))
+        priv->service_unknown = 1;
       g_warning ("%s", error->message);
       GOTO (failure);
     }
@@ -482,6 +486,7 @@ gb_source_code_assistant_buffer_notify_language (GbSourceCodeAssistant *assistan
   g_return_if_fail (GB_IS_SOURCE_CODE_ASSISTANT (assistant));
   g_return_if_fail (GTK_SOURCE_IS_BUFFER (buffer));
 
+  assistant->priv->service_unknown = 0;
   gb_source_code_assistant_load_service (assistant);
 
   EXIT;
@@ -494,7 +499,8 @@ gb_source_code_assistant_buffer_changed (GbSourceCodeAssistant *assistant,
   g_return_if_fail (GB_IS_SOURCE_CODE_ASSISTANT (assistant));
   g_return_if_fail (GTK_IS_TEXT_BUFFER (buffer));
 
-  gb_source_code_assistant_queue_parse (assistant);
+  if (!assistant->priv->service_unknown)
+    gb_source_code_assistant_queue_parse (assistant);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]