[gnome-builder/wip/error-highlight: 1/6] code-assist: save session bus handle
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/error-highlight: 1/6] code-assist: save session bus handle
- Date: Tue, 21 Oct 2014 04:18:20 +0000 (UTC)
commit b6c4e54d6c79f4999d5d6c6ffa655881806fa2c8
Author: Christian Hergert <christian hergert me>
Date: Mon Oct 20 17:18:02 2014 -0700
code-assist: save session bus handle
src/editor/gb-editor-code-assistant.c | 25 +++++++++++++++++--------
1 files changed, 17 insertions(+), 8 deletions(-)
---
diff --git a/src/editor/gb-editor-code-assistant.c b/src/editor/gb-editor-code-assistant.c
index 0c0c9d7..c137d3d 100644
--- a/src/editor/gb-editor-code-assistant.c
+++ b/src/editor/gb-editor-code-assistant.c
@@ -29,6 +29,8 @@
#define PARSE_TIMEOUT_MSEC 250
+static GDBusConnection *gSessionBus;
+
static void
add_diagnostic_range (GbEditorTab *tab,
GcaDiagnostic *diag,
@@ -197,11 +199,11 @@ 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_for_bus_sync (G_BUS_TYPE_SESSION,
- G_DBUS_PROXY_FLAGS_NONE,
- name, document_path,
- NULL, &error);
+ 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);
@@ -370,6 +372,13 @@ gb_editor_code_assistant_init (GbEditorTab *tab)
priv = tab->priv;
+ if (!gSessionBus)
+ {
+ gSessionBus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
+ if (!gSessionBus)
+ EXIT;
+ }
+
lang_id = get_language (tab->priv->source_view);
if (!lang_id)
EXIT;
@@ -378,9 +387,9 @@ gb_editor_code_assistant_init (GbEditorTab *tab)
path = g_strdup_printf ("/org/gnome/CodeAssist/v1/%s", lang_id);
priv->gca_service =
- gca_service_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
- G_DBUS_PROXY_FLAGS_NONE,
- name, path, NULL, NULL);
+ gca_service_proxy_new_sync (gSessionBus,
+ G_DBUS_PROXY_FLAGS_NONE,
+ name, path, NULL, NULL);
g_free (name);
g_free (path);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]