Commit 7cd2a992 authored by Christian Hergert's avatar Christian Hergert
Browse files

completion: drop use of :context and add load vfunc

Instead of requiring the :context property (which causes weird conflicts
with vala), use a load vfunc and ensure it gets used.

https://bugzilla.gnome.org/show_bug.cgi?id=779891
parent 252a71fb
......@@ -19,19 +19,11 @@
#include "ide-completion-provider.h"
#include "ide-context.h"
G_DEFINE_INTERFACE (IdeCompletionProvider,
ide_completion_provider,
GTK_SOURCE_TYPE_COMPLETION_PROVIDER)
G_DEFINE_INTERFACE (IdeCompletionProvider, ide_completion_provider, GTK_SOURCE_TYPE_COMPLETION_PROVIDER)
static void
ide_completion_provider_default_init (IdeCompletionProviderInterface *iface)
{
g_object_interface_install_property (iface,
g_param_spec_object ("context",
"Context",
"Context",
IDE_TYPE_CONTEXT,
(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)));
}
gboolean
......@@ -115,10 +107,12 @@ ide_completion_provider_context_current_word (GtkSourceCompletionContext *contex
}
void
ide_completion_provider_load (IdeCompletionProvider *self)
ide_completion_provider_load (IdeCompletionProvider *self,
IdeContext *context)
{
g_return_if_fail (IDE_IS_COMPLETION_PROVIDER (self));
g_return_if_fail (IDE_IS_CONTEXT (context));
if (IDE_COMPLETION_PROVIDER_GET_IFACE (self)->load)
IDE_COMPLETION_PROVIDER_GET_IFACE (self)->load (self);
IDE_COMPLETION_PROVIDER_GET_IFACE (self)->load (self, context);
}
......@@ -37,18 +37,16 @@ struct _IdeCompletionProviderInterface
{
GtkSourceCompletionProviderIface parent_interface;
/* Pacify Vala */
void (*set_context) (IdeCompletionProvider *self,
IdeContext *context);
void (*load) (IdeCompletionProvider *self);
void (*load) (IdeCompletionProvider *self,
IdeContext *context);
};
GType ide_completion_provider_get_type (void);
gboolean ide_completion_provider_context_in_comment (GtkSourceCompletionContext *context);
gboolean ide_completion_provider_context_in_comment_or_string (GtkSourceCompletionContext *context);
gchar *ide_completion_provider_context_current_word (GtkSourceCompletionContext *context);
void ide_completion_provider_load (IdeCompletionProvider *self);
void ide_completion_provider_load (IdeCompletionProvider *self,
IdeContext *context);
G_END_DECLS
......
......@@ -30,6 +30,7 @@ namespace Ide
int line = -1;
int column = -1;
Ide.CompletionResults? results;
Ide.Context? _context;
public void populate (Gtk.SourceCompletionContext context)
{
......@@ -146,13 +147,8 @@ namespace Ide
return 200;
}
public void load () {}
// This code shouldn't have to exist.
// If we can fixup libide+vala to not have such weird interaction that
// would be great.
Ide.Context? _context;
public Ide.Context context { construct { _context = value; } }
public void set_context (Ide.Context context) { _context = context; }
public void load (Ide.Context context) {
this._context = context;
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment