Commit 0cef1bbc authored by Christian Hergert's avatar Christian Hergert
Browse files

diagnostics: drop :context property

We can drop this now as the context can be found from the base object.

https://bugzilla.gnome.org/show_bug.cgi?id=779891
parent b319b5d8
......@@ -26,7 +26,7 @@
#include "diagnostics/ide-diagnostics.h"
#include "files/ide-file.h"
G_DEFINE_INTERFACE (IdeDiagnosticProvider, ide_diagnostic_provider, G_TYPE_OBJECT)
G_DEFINE_INTERFACE (IdeDiagnosticProvider, ide_diagnostic_provider, IDE_TYPE_OBJECT)
enum {
INVALIDATED,
......@@ -38,13 +38,6 @@ static guint signals [N_SIGNALS];
static void
ide_diagnostic_provider_default_init (IdeDiagnosticProviderInterface *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)));
/**
* IdeDiagnosticProvider::invlaidated:
*
......@@ -61,12 +54,12 @@ ide_diagnostic_provider_default_init (IdeDiagnosticProviderInterface *iface)
/* If the file does not match a loaded buffer, buffer is %NULL */
void
ide_diagnostic_provider_diagnose_async (IdeDiagnosticProvider *self,
IdeFile *file,
IdeBuffer *buffer,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
ide_diagnostic_provider_diagnose_async (IdeDiagnosticProvider *self,
IdeFile *file,
IdeBuffer *buffer,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
IDE_ENTRY;
......
......@@ -25,14 +25,13 @@ G_BEGIN_DECLS
#define IDE_TYPE_DIAGNOSTIC_PROVIDER (ide_diagnostic_provider_get_type())
G_DECLARE_INTERFACE (IdeDiagnosticProvider, ide_diagnostic_provider, IDE, DIAGNOSTIC_PROVIDER, GObject)
G_DECLARE_INTERFACE (IdeDiagnosticProvider, ide_diagnostic_provider, IDE, DIAGNOSTIC_PROVIDER, IdeObject)
struct _IdeDiagnosticProviderInterface
{
GTypeInterface parent_interface;
void (*set_context) (IdeDiagnosticProvider *self,
IdeContext *context);
void (*load) (IdeDiagnosticProvider *self);
void (*diagnose_async) (IdeDiagnosticProvider *self,
IdeFile *file,
IdeBuffer *buffer,
......@@ -42,7 +41,6 @@ struct _IdeDiagnosticProviderInterface
IdeDiagnostics *(*diagnose_finish) (IdeDiagnosticProvider *self,
GAsyncResult *result,
GError **error);
void (*load) (IdeDiagnosticProvider *self);
};
void ide_diagnostic_provider_diagnose_async (IdeDiagnosticProvider *self,
......
......@@ -22,26 +22,19 @@ using Vala;
namespace Ide
{
public class ValaDiagnosticProvider: GLib.Object, Ide.DiagnosticProvider
public class ValaDiagnosticProvider: Ide.Object, Ide.DiagnosticProvider
{
public async Ide.Diagnostics? diagnose_async (Ide.File file,
Ide.Buffer buffer,
GLib.Cancellable? cancellable)
throws GLib.Error
{
var service = (Ide.ValaService)_context.get_service_typed (typeof (Ide.ValaService));
yield service.index.parse_file (file.file, _context.unsaved_files, cancellable);
var service = (Ide.ValaService)get_context ().get_service_typed (typeof (Ide.ValaService));
yield service.index.parse_file (file.file, get_context ().unsaved_files, cancellable);
var results = yield service.index.get_diagnostics (file.file, cancellable);
return results;
}
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; }
}
}
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