[gnome-builder] code-assist: create proxy asynchronously
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] code-assist: create proxy asynchronously
- Date: Tue, 21 Oct 2014 07:38:22 +0000 (UTC)
commit a46229437bbd55001d18f93c9dfb42613bc75f1b
Author: Christian Hergert <christian hergert me>
Date: Mon Oct 20 21:17:31 2014 -0700
code-assist: create proxy asynchronously
src/editor/gb-editor-code-assistant.c | 52 ++++++++++++++++++++++-----------
1 files changed, 35 insertions(+), 17 deletions(-)
---
diff --git a/src/editor/gb-editor-code-assistant.c b/src/editor/gb-editor-code-assistant.c
index 847574b..ebd00a5 100644
--- a/src/editor/gb-editor-code-assistant.c
+++ b/src/editor/gb-editor-code-assistant.c
@@ -169,13 +169,40 @@ cleanup:
}
static void
+diagnostics_proxy_new_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ GcaDiagnostics *proxy = NULL;
+ GbEditorTab *tab = user_data;
+ GError *error = NULL;
+
+ proxy = gca_diagnostics_proxy_new_finish (result, &error);
+
+ if (!proxy)
+ {
+ g_warning ("%s", error->message);
+ g_clear_error (&error);
+ GOTO (cleanup);
+ }
+
+ gca_diagnostics_call_diagnostics (proxy, NULL,
+ gb_editor_code_assistant_diag_cb,
+ g_object_ref (tab));
+
+
+cleanup:
+ g_clear_object (&tab);
+ g_clear_object (&proxy);
+}
+
+static void
gb_editor_code_assistant_parse_cb (GObject *source_object,
GAsyncResult *result,
gpointer user_data)
{
GbEditorTab *tab = user_data;
GcaService *service = (GcaService *)source_object;
- GcaDiagnostics *diag_proxy = NULL;
const gchar *lang_id;
GError *error = NULL;
gchar *document_path = NULL;
@@ -199,24 +226,15 @@ gb_editor_code_assistant_parse_cb (GObject *source_object,
name = g_strdup_printf ("org.gnome.CodeAssist.v1.%s", lang_id);
- diag_proxy = gca_diagnostics_proxy_new_sync (gSessionBus,
- G_DBUS_PROXY_FLAGS_NONE,
- name, document_path,
- NULL, &error);
-
- if (!diag_proxy)
- {
- g_warning ("%s", error->message);
- g_clear_error (&error);
- GOTO (cleanup);
- }
-
- gca_diagnostics_call_diagnostics (diag_proxy, NULL,
- gb_editor_code_assistant_diag_cb,
- g_object_ref (tab));
+ gca_diagnostics_proxy_new (gSessionBus,
+ G_DBUS_PROXY_FLAGS_NONE,
+ name,
+ document_path,
+ NULL,
+ diagnostics_proxy_new_cb,
+ g_object_ref (tab));
cleanup:
- g_clear_object (&diag_proxy);
g_free (name);
g_free (document_path);
g_object_unref (tab);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]