[gnome-builder/wip/chergert/completion] xml: minimal port to new completion engine



commit 305d957de1a8a4d17e452b3dde241c2c21b646e7
Author: Christian Hergert <chergert redhat com>
Date:   Wed Jun 6 02:14:50 2018 -0700

    xml: minimal port to new completion engine
    
    There are definitely more optimized ways we can do this going forward,
    but this starts on a minimal port of the xml-pack copmletion provider
    to the new API.

 src/plugins/xml-pack/ide-xml-completion-provider.c | 284 ++++++++++-----------
 src/plugins/xml-pack/ide-xml-completion-provider.h |   3 -
 src/plugins/xml-pack/ide-xml-proposal.c            |  82 ++++++
 src/plugins/xml-pack/ide-xml-proposal.h            |  34 +++
 src/plugins/xml-pack/meson.build                   |  32 +--
 5 files changed, 258 insertions(+), 177 deletions(-)
---
diff --git a/src/plugins/xml-pack/ide-xml-completion-provider.c 
b/src/plugins/xml-pack/ide-xml-completion-provider.c
index b06a1eb3a..fb5e0d66f 100644
--- a/src/plugins/xml-pack/ide-xml-completion-provider.c
+++ b/src/plugins/xml-pack/ide-xml-completion-provider.c
@@ -19,15 +19,15 @@
 #define G_LOG_DOMAIN "xml-completion"
 
 #include <dazzle.h>
+#include <gtksourceview/gtksource.h>
 #include <libpeas/peas.h>
 
-#include "ide-xml-completion-provider.h"
-
-#include "ide.h"
 #include "ide-xml-completion-attributes.h"
+#include "ide-xml-completion-provider.h"
 #include "ide-xml-completion-values.h"
 #include "ide-xml-path.h"
 #include "ide-xml-position.h"
+#include "ide-xml-proposal.h"
 #include "ide-xml-rng-define.h"
 #include "ide-xml-schema-cache-entry.h"
 #include "ide-xml-service.h"
@@ -39,7 +39,7 @@ struct _IdeXmlCompletionProvider
   IdeObject parent_instance;
 };
 
-typedef struct _MatchingState
+typedef struct
 {
   GArray           *stack;
   IdeXmlSymbolNode *parent_node;
@@ -64,50 +64,43 @@ typedef struct _StateStackItem
 
 typedef struct
 {
-  IdeXmlCompletionProvider    *self;
-  GtkSourceCompletionContext  *completion_context;
-  GCancellable                *cancellable;
-  IdeFile                     *ifile;
-  IdeBuffer                   *buffer;
-  gint                         line;
-  gint                         line_offset;
+  IdeFile *ifile;
+  gint     line;
+  gint     line_offset;
 } PopulateState;
 
-typedef struct _CompletionItem
+typedef struct
 {
   gchar           *label;
   IdeXmlRngDefine *define;
 } CompletionItem;
 
-static void      completion_provider_init (GtkSourceCompletionProviderIface *);
-static gboolean  process_matching_state   (MatchingState                    *state,
-                                           IdeXmlRngDefine                  *define);
-
-G_DEFINE_TYPE_EXTENDED (IdeXmlCompletionProvider,
-                        ide_xml_completion_provider,
-                        IDE_TYPE_OBJECT,
-                        0,
-                        G_IMPLEMENT_INTERFACE (GTK_SOURCE_TYPE_COMPLETION_PROVIDER, completion_provider_init)
-                        G_IMPLEMENT_INTERFACE (IDE_TYPE_COMPLETION_PROVIDER, NULL))
+static void      completion_provider_init (IdeCompletionProviderInterface *iface);
+static gboolean  process_matching_state   (MatchingState                  *state,
+                                           IdeXmlRngDefine                *define);
 
-enum {
-  PROP_0,
-  N_PROPS
-};
+G_DEFINE_TYPE_WITH_CODE (IdeXmlCompletionProvider,
+                         ide_xml_completion_provider,
+                         IDE_TYPE_OBJECT,
+                         G_IMPLEMENT_INTERFACE (IDE_TYPE_COMPLETION_PROVIDER, completion_provider_init))
 
 static void
 populate_state_free (PopulateState *state)
 {
   g_assert (state != NULL);
 
-  g_clear_object (&state->self);
-  g_clear_object (&state->completion_context);
   g_clear_object (&state->ifile);
-  g_clear_object (&state->buffer);
-  g_clear_object (&state->cancellable);
   g_slice_free (PopulateState, state);
 }
 
+static void
+add_to_store (GListStore  *store,
+              const GList *list)
+{
+  for (const GList *iter = list; iter; iter = iter->next)
+    g_list_store_append (store, iter->data);
+}
+
 static GPtrArray *
 copy_children (GPtrArray *children)
 {
@@ -767,11 +760,11 @@ process_matching_state (MatchingState   *state,
 }
 
 static GList *
-get__element_proposals (IdeXmlPosition *position,
-                        GPtrArray      *items)
+get_element_proposals (IdeXmlPosition *position,
+                       GPtrArray      *items)
 {
   CompletionItem *completion_item;
-  GtkSourceCompletionItem *item;
+  IdeXmlProposal *item;
   GList *results = NULL;
   gchar *start = "";
 
@@ -786,13 +779,12 @@ get__element_proposals (IdeXmlPosition *position,
       g_autofree gchar *label = NULL;
       g_autofree gchar *text = NULL;
 
+      /* TODO: This should probably use snippets */
+
       completion_item = g_ptr_array_index (items, i);
-      label = g_strconcat ("<", completion_item->label, ">", NULL);
+      label = g_strconcat ("&lt;", completion_item->label, "&gt;", NULL);
       text = g_strconcat (start, completion_item->label, ">", "</", completion_item->label, ">", NULL);
-      item = g_object_new (GTK_SOURCE_TYPE_COMPLETION_ITEM,
-                           "text", text,
-                           "label", label,
-                           NULL);
+      item = ide_xml_proposal_new (text, label);
 
       results = g_list_prepend (results, item);
     }
@@ -805,7 +797,7 @@ get_attributes_proposals (IdeXmlPosition  *position,
                           IdeXmlRngDefine *define)
 {
   IdeXmlSymbolNode *node;
-  GtkSourceCompletionItem *item;
+  IdeXmlProposal *item;
   g_autoptr(GPtrArray) attributes = NULL;
   GList *results = NULL;
 
@@ -826,10 +818,7 @@ get_attributes_proposals (IdeXmlPosition  *position,
             name = g_strdup (match_item->name);
 
           text = g_strconcat (match_item->name, "=\"\"", NULL);
-          item = g_object_new (GTK_SOURCE_TYPE_COMPLETION_ITEM,
-                               "markup", name,
-                               "text", text,
-                               NULL);
+          item = ide_xml_proposal_new (text, name);
 
           results = g_list_prepend (results, item);
         }
@@ -846,7 +835,7 @@ get_values_proposals (IdeXmlPosition  *position,
   IdeXmlRngDefine *attr_define = NULL;
   g_autoptr(GPtrArray) attributes = NULL;
   g_autoptr(GPtrArray) values = NULL;
-  GtkSourceCompletionItem *item;
+  IdeXmlProposal *item;
   GList *results = NULL;
 
   node = ide_xml_position_get_child_node (position);
@@ -883,10 +872,8 @@ get_values_proposals (IdeXmlPosition  *position,
                 {
                   ValueMatchItem *value_match_item = g_ptr_array_index (values, i);
 
-                  item = g_object_new (GTK_SOURCE_TYPE_COMPLETION_ITEM,
-                                       "markup", value_match_item->name,
-                                       "text", value_match_item->name,
-                                       NULL);
+                  item = ide_xml_proposal_new (value_match_item->name,
+                                               value_match_item->name);
 
                   results = g_list_prepend (results, item);
                 }
@@ -902,14 +889,15 @@ populate_cb (GObject      *object,
              GAsyncResult *result,
              gpointer      user_data)
 {
+  IdeXmlCompletionProvider *self;
   IdeXmlService *service = (IdeXmlService *)object;
-  PopulateState *state = user_data;
+  g_autoptr(IdeTask) task = user_data;
   g_autoptr(IdeXmlPosition) position = NULL;
   g_autoptr(IdeXmlPath) path = NULL;
   g_autoptr(GPtrArray) candidates = NULL;
   g_autoptr(GPtrArray) items = NULL;
+  g_autoptr(GListStore) proposals = NULL;
   g_autoptr(GError) error = NULL;
-  IdeXmlCompletionProvider *self;
   IdeXmlSymbolNode *root_node;
   IdeXmlSymbolNode *node;
   IdeXmlSymbolNode *candidate_node;
@@ -921,27 +909,26 @@ populate_cb (GObject      *object,
   IdeXmlPositionKind kind;
   gboolean complete_attributes = FALSE;
   gboolean complete_values = FALSE;
-  gboolean did_final_add = FALSE;
   gint child_pos;
 
   g_assert (IDE_IS_XML_SERVICE (service));
-  g_assert (state != NULL);
-  g_assert (IDE_IS_XML_COMPLETION_PROVIDER (state->self));
   g_assert (G_IS_ASYNC_RESULT (result));
-  g_assert (GTK_SOURCE_IS_COMPLETION_CONTEXT (state->completion_context));
+  g_assert (IDE_IS_TASK (task));
 
-  self = state->self;
-
-  /* Check cancellation state first, as that tells us we should
-   * not notify the context of any proposals.
-   */
-  if (g_cancellable_is_cancelled (state->cancellable))
-    goto free_state;
+  self = ide_task_get_source_object (task);
 
   position = ide_xml_service_get_position_from_cursor_finish (service, result, &error);
 
   if (error != NULL)
-    goto cleanup;
+    {
+      ide_task_return_error (task, g_steal_pointer (&error));
+      return;
+    }
+
+  if (ide_task_return_error_if_cancelled (task))
+    return;
+
+  proposals = g_list_store_new (IDE_TYPE_COMPLETION_PROPOSAL);
 
   analysis = ide_xml_position_get_analysis (position);
   schemas = ide_xml_analysis_get_schemas (analysis);
@@ -974,7 +961,7 @@ populate_cb (GObject      *object,
   if (schemas == NULL)
     goto cleanup;
 
-  if (NULL != (candidates = get_matching_candidates (self, schemas, path)))
+  if ((candidates = get_matching_candidates (self, schemas, path)))
     {
       if (complete_attributes)
         {
@@ -984,11 +971,7 @@ populate_cb (GObject      *object,
 
               def = g_ptr_array_index (candidates, i);
               results = get_attributes_proposals (position, def);
-              gtk_source_completion_context_add_proposals (state->completion_context,
-                                                           GTK_SOURCE_COMPLETION_PROVIDER (self),
-                                                           results,
-                                                           TRUE);
-              did_final_add = TRUE;
+              add_to_store (proposals, results);
             }
         }
       else if (complete_values)
@@ -999,11 +982,7 @@ populate_cb (GObject      *object,
 
               def = g_ptr_array_index (candidates, i);
               results = get_values_proposals (position, def);
-              gtk_source_completion_context_add_proposals (state->completion_context,
-                                                           GTK_SOURCE_COMPLETION_PROVIDER (self),
-                                                           results,
-                                                           TRUE);
-              did_final_add = TRUE;
+              add_to_store (proposals, results);
             }
         }
       else
@@ -1026,118 +1005,137 @@ populate_cb (GObject      *object,
               matching_state_free (initial_state);
             }
 
-          results = get__element_proposals (position, items);
-          gtk_source_completion_context_add_proposals (state->completion_context,
-                                                       GTK_SOURCE_COMPLETION_PROVIDER (self),
-                                                       results,
-                                                       TRUE);
-          did_final_add = TRUE;
+          results = get_element_proposals (position, items);
+          add_to_store (proposals, results);
         }
     }
 
 cleanup:
-  if (!did_final_add)
-    gtk_source_completion_context_add_proposals (state->completion_context,
-                                                 GTK_SOURCE_COMPLETION_PROVIDER (self),
-                                                 NULL, TRUE);
 
-free_state:
-  populate_state_free (state);
+  ide_task_return_object (task, g_steal_pointer (&proposals));
 }
 
 static void
-ide_xml_completion_provider_populate (GtkSourceCompletionProvider *self,
-                                      GtkSourceCompletionContext  *completion_context)
+ide_xml_completion_provider_populate_async (IdeCompletionProvider *provider,
+                                            IdeCompletionContext  *context,
+                                            GCancellable          *cancellable,
+                                            GAsyncReadyCallback    callback,
+                                            gpointer               user_data)
 {
-  IdeContext *ide_context;
+  IdeXmlCompletionProvider *self = (IdeXmlCompletionProvider *)provider;
+  g_autoptr(IdeTask) task = NULL;
+  GtkTextBuffer *buffer;
   IdeXmlService *service;
-  GtkTextIter iter;
-  IdeBuffer *buffer;
   PopulateState *state;
+  IdeContext *ide_context;
+  GtkTextIter iter;
 
   g_assert (IDE_IS_XML_COMPLETION_PROVIDER (self));
-  g_assert (GTK_SOURCE_IS_COMPLETION_CONTEXT (completion_context));
+  g_assert (IDE_IS_COMPLETION_CONTEXT (context));
+  g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
+
+  task = ide_task_new (self, cancellable, callback, user_data);
+  ide_task_set_source_tag (task, ide_xml_completion_provider_populate_async);
 
   ide_context = ide_object_get_context (IDE_OBJECT (self));
   service = ide_context_get_service_typed (ide_context, IDE_TYPE_XML_SERVICE);
 
-  gtk_source_completion_context_get_iter (completion_context, &iter);
-
-  buffer = IDE_BUFFER (gtk_text_iter_get_buffer (&iter));
+  buffer = ide_completion_context_get_buffer (context);
+  ide_completion_context_get_bounds (context, &iter, NULL);
 
   state = g_slice_new0 (PopulateState);
-  state->self = g_object_ref (IDE_XML_COMPLETION_PROVIDER (self));
-  state->completion_context = g_object_ref (completion_context);
-  state->cancellable = g_cancellable_new ();
-  state->buffer = g_object_ref (buffer);
-  state->ifile = g_object_ref (ide_buffer_get_file (buffer));
+  state->ifile = g_object_ref (ide_buffer_get_file (IDE_BUFFER (buffer)));
   state->line = gtk_text_iter_get_line (&iter) + 1;
   state->line_offset = gtk_text_iter_get_line_offset (&iter) + 1;
 
-  g_signal_connect_object (completion_context,
-                           "cancelled",
-                           G_CALLBACK (g_cancellable_cancel),
-                           state->cancellable,
-                           G_CONNECT_SWAPPED);
+  ide_task_set_task_data (task, state, (GDestroyNotify)populate_state_free);
 
   ide_xml_service_get_position_from_cursor_async (service,
                                                   state->ifile,
-                                                  buffer,
+                                                  IDE_BUFFER (buffer),
                                                   state->line,
                                                   state->line_offset,
-                                                  state->cancellable,
+                                                  cancellable,
                                                   populate_cb,
-                                                  state);
+                                                  g_steal_pointer (&task));
 }
 
-static GdkPixbuf *
-ide_xml_completion_provider_get_icon (GtkSourceCompletionProvider *provider)
+static GListModel *
+ide_xml_completion_provider_populate_finish (IdeCompletionProvider  *provider,
+                                             GAsyncResult           *result,
+                                             GError                **error)
 {
-  return NULL;
+  g_assert (IDE_IS_XML_COMPLETION_PROVIDER (provider));
+  g_assert (IDE_IS_TASK (result));
+
+  return ide_task_propagate_object (IDE_TASK (result), error);
 }
 
-IdeXmlCompletionProvider *
-ide_xml_completion_provider_new (void)
+static gboolean
+ide_xml_completion_provider_refilter (IdeCompletionProvider *provider,
+                                      IdeCompletionContext  *context,
+                                      GListModel            *model)
 {
-  return g_object_new (IDE_TYPE_XML_COMPLETION_PROVIDER, NULL);
+  g_assert (IDE_IS_XML_COMPLETION_PROVIDER (provider));
+  g_assert (IDE_IS_COMPLETION_CONTEXT (context));
+  g_assert (G_IS_LIST_MODEL (model));
+
+  return TRUE;
 }
 
 static void
-ide_xml_completion_provider_finalize (GObject *object)
+ide_xml_completion_provider_display_proposal (IdeCompletionProvider   *provider,
+                                              IdeCompletionListBoxRow *row,
+                                              IdeCompletionContext    *context,
+                                              const gchar             *typed_text,
+                                              IdeCompletionProposal   *proposal)
 {
-  G_GNUC_UNUSED IdeXmlCompletionProvider *self = (IdeXmlCompletionProvider *)object;
+  IdeXmlProposal *item = (IdeXmlProposal *)proposal;
+  const gchar *label;
 
-  G_OBJECT_CLASS (ide_xml_completion_provider_parent_class)->finalize (object);
+  g_assert (IDE_IS_XML_COMPLETION_PROVIDER (provider));
+  g_assert (IDE_IS_COMPLETION_LIST_BOX_ROW (row));
+  g_assert (IDE_IS_COMPLETION_CONTEXT (context));
+  g_assert (IDE_IS_COMPLETION_PROPOSAL (proposal));
+
+  label = ide_xml_proposal_get_label (item);
+
+  ide_completion_list_box_row_set_icon_name (row, NULL);
+  ide_completion_list_box_row_set_left (row, NULL);
+  ide_completion_list_box_row_set_right (row, NULL);
+  ide_completion_list_box_row_set_center_markup (row, label);
 }
 
 static void
-ide_xml_completion_provider_get_property (GObject    *object,
-                                          guint       prop_id,
-                                          GValue     *value,
-                                          GParamSpec *pspec)
+ide_xml_completion_provider_activate_proposal (IdeCompletionProvider *provider,
+                                               IdeCompletionContext  *context,
+                                               IdeCompletionProposal *proposal,
+                                               const GdkEventKey     *key)
 {
-  G_GNUC_UNUSED IdeXmlCompletionProvider *self = IDE_XML_COMPLETION_PROVIDER (object);
+  IdeXmlProposal *item = (IdeXmlProposal *)proposal;
+  GtkTextBuffer *buffer;
+  GtkTextIter begin, end;
+  const gchar *text;
 
-  switch (prop_id)
-    {
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-    }
+  g_assert (IDE_IS_XML_COMPLETION_PROVIDER (provider));
+  g_assert (IDE_IS_COMPLETION_CONTEXT (context));
+  g_assert (IDE_IS_COMPLETION_PROPOSAL (proposal));
+
+  text = ide_xml_proposal_get_text (item);
+
+  buffer = ide_completion_context_get_buffer (context);
+  ide_completion_context_get_bounds (context, &begin, &end);
+
+  gtk_text_buffer_begin_user_action (buffer);
+  gtk_text_buffer_delete (buffer, &begin, &end);
+  gtk_text_buffer_insert (buffer, &begin, text, -1);
+  gtk_text_buffer_end_user_action (buffer);
 }
 
 static void
-ide_xml_completion_provider_set_property (GObject      *object,
-                                          guint         prop_id,
-                                          const GValue *value,
-                                          GParamSpec   *pspec)
+ide_xml_completion_provider_finalize (GObject *object)
 {
-  G_GNUC_UNUSED IdeXmlCompletionProvider *self = IDE_XML_COMPLETION_PROVIDER (object);
-
-  switch (prop_id)
-    {
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-    }
+  G_OBJECT_CLASS (ide_xml_completion_provider_parent_class)->finalize (object);
 }
 
 static void
@@ -1146,19 +1144,19 @@ ide_xml_completion_provider_class_init (IdeXmlCompletionProviderClass *klass)
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
   object_class->finalize = ide_xml_completion_provider_finalize;
-  object_class->get_property = ide_xml_completion_provider_get_property;
-  object_class->set_property = ide_xml_completion_provider_set_property;
 }
 
 static void
 ide_xml_completion_provider_init (IdeXmlCompletionProvider *self)
 {
-  ;
 }
 
 static void
-completion_provider_init (GtkSourceCompletionProviderIface *iface)
+completion_provider_init (IdeCompletionProviderInterface *iface)
 {
-  iface->get_icon = ide_xml_completion_provider_get_icon;
-  iface->populate = ide_xml_completion_provider_populate;
+  iface->activate_proposal = ide_xml_completion_provider_activate_proposal;
+  iface->display_proposal = ide_xml_completion_provider_display_proposal;
+  iface->populate_async = ide_xml_completion_provider_populate_async;
+  iface->populate_finish = ide_xml_completion_provider_populate_finish;
+  iface->refilter = ide_xml_completion_provider_refilter;
 }
diff --git a/src/plugins/xml-pack/ide-xml-completion-provider.h 
b/src/plugins/xml-pack/ide-xml-completion-provider.h
index 51c486d74..10ad92bc8 100644
--- a/src/plugins/xml-pack/ide-xml-completion-provider.h
+++ b/src/plugins/xml-pack/ide-xml-completion-provider.h
@@ -18,7 +18,6 @@
 
 #pragma once
 
-#include <gtksourceview/gtksource.h>
 #include <ide.h>
 
 G_BEGIN_DECLS
@@ -27,6 +26,4 @@ G_BEGIN_DECLS
 
 G_DECLARE_FINAL_TYPE (IdeXmlCompletionProvider, ide_xml_completion_provider, IDE, XML_COMPLETION_PROVIDER, 
IdeObject)
 
-IdeXmlCompletionProvider *ide_xml_completion_provider_new (void);
-
 G_END_DECLS
diff --git a/src/plugins/xml-pack/ide-xml-proposal.c b/src/plugins/xml-pack/ide-xml-proposal.c
new file mode 100644
index 000000000..20d9f8ac2
--- /dev/null
+++ b/src/plugins/xml-pack/ide-xml-proposal.c
@@ -0,0 +1,82 @@
+/* ide-xml-proposal.c
+ *
+ * Copyright 2018 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#define G_LOG_DOMAIN "ide-xml-proposal"
+
+#include "ide-xml-proposal.h"
+
+struct _IdeXmlProposal
+{
+  GObject parent_instance;
+  gchar *label;
+  gchar *text;
+};
+
+G_DEFINE_TYPE_WITH_CODE (IdeXmlProposal, ide_xml_proposal, G_TYPE_OBJECT,
+                         G_IMPLEMENT_INTERFACE (IDE_TYPE_COMPLETION_PROPOSAL, NULL))
+
+static void
+ide_xml_proposal_finalize (GObject *object)
+{
+  IdeXmlProposal *self = (IdeXmlProposal *)object;
+
+  g_clear_pointer (&self->label, g_free);
+  g_clear_pointer (&self->text, g_free);
+
+  G_OBJECT_CLASS (ide_xml_proposal_parent_class)->finalize (object);
+}
+
+static void
+ide_xml_proposal_class_init (IdeXmlProposalClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->finalize = ide_xml_proposal_finalize;
+}
+
+static void
+ide_xml_proposal_init (IdeXmlProposal *self)
+{
+}
+
+IdeXmlProposal *
+ide_xml_proposal_new (const gchar *text,
+                      const gchar *label)
+{
+  IdeXmlProposal *self;
+  
+  self = g_object_new (IDE_TYPE_XML_PROPOSAL, NULL);
+  self->text = g_strdup (text);
+  self->label = g_strdup (label);
+
+  return self;
+}
+
+const gchar *
+ide_xml_proposal_get_label (IdeXmlProposal *self)
+{
+  return self->label;
+}
+
+const gchar *
+ide_xml_proposal_get_text (IdeXmlProposal *self)
+{
+  return self->text;
+}
diff --git a/src/plugins/xml-pack/ide-xml-proposal.h b/src/plugins/xml-pack/ide-xml-proposal.h
new file mode 100644
index 000000000..7b78fdc2c
--- /dev/null
+++ b/src/plugins/xml-pack/ide-xml-proposal.h
@@ -0,0 +1,34 @@
+/* ide-xml-proposal.h
+ *
+ * Copyright 2018 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#include <ide.h>
+
+G_BEGIN_DECLS
+
+#define IDE_TYPE_XML_PROPOSAL (ide_xml_proposal_get_type())
+
+G_DECLARE_FINAL_TYPE (IdeXmlProposal, ide_xml_proposal, IDE, XML_PROPOSAL, GObject)
+
+IdeXmlProposal *ide_xml_proposal_new       (const gchar    *text,
+                                            const gchar    *label);
+const gchar    *ide_xml_proposal_get_label (IdeXmlProposal *self);
+const gchar    *ide_xml_proposal_get_text  (IdeXmlProposal *self);
+
+G_END_DECLS
diff --git a/src/plugins/xml-pack/meson.build b/src/plugins/xml-pack/meson.build
index 9d595863f..5ae92897d 100644
--- a/src/plugins/xml-pack/meson.build
+++ b/src/plugins/xml-pack/meson.build
@@ -8,65 +8,35 @@ xml_pack_resources = gnome.compile_resources(
 
 xml_pack_sources = [
   'ide-xml-analysis.c',
-  'ide-xml-analysis.h',
   'ide-xml-completion-attributes.c',
-  'ide-xml-completion-attributes.h',
   'ide-xml-completion-values.c',
-  'ide-xml-completion-values.h',
   'ide-xml-completion-provider.c',
-  'ide-xml-completion-provider.h',
   'ide-xml-diagnostic-provider.c',
-  'ide-xml-diagnostic-provider.h',
   'ide-xml-hash-table.c',
-  'ide-xml-hash-table.h',
   'ide-xml-highlighter.c',
-  'ide-xml-highlighter.h',
   'ide-xml-indenter.c',
-  'ide-xml-indenter.h',
   'ide-xml-parser.c',
-  'ide-xml-parser.h',
   'ide-xml-parser-generic.c',
-  'ide-xml-parser-generic.h',
-  'ide-xml-parser-private.h',
   'ide-xml-parser-ui.c',
-  'ide-xml-parser-ui.h',
   'ide-xml-path.c',
-  'ide-xml-path.h',
   'ide-xml-position.c',
-  'ide-xml-position.h',
+  'ide-xml-proposal.c',
   'ide-xml-rng-define.c',
-  'ide-xml-rng-define.h',
   'ide-xml-rng-grammar.c',
-  'ide-xml-rng-grammar.h',
   'ide-xml-rng-parser.c',
-  'ide-xml-rng-parser.h',
   'ide-xml-sax.c',
-  'ide-xml-sax.h',
   'ide-xml-schema.c',
-  'ide-xml-schema.h',
   'ide-xml-schema-cache-entry.c',
-  'ide-xml-schema-cache-entry.h',
   'ide-xml-service.c',
-  'ide-xml-service.h',
   'ide-xml-stack.c',
-  'ide-xml-stack.h',
   'ide-xml-symbol-node.c',
-  'ide-xml-symbol-node.h',
   'ide-xml-symbol-resolver.c',
-  'ide-xml-symbol-resolver.h',
   'ide-xml-symbol-tree.c',
-  'ide-xml-symbol-tree.h',
   'ide-xml-tree-builder.c',
-  'ide-xml-tree-builder.h',
   'ide-xml-tree-builder-utils.c',
-  'ide-xml-tree-builder-utils-private.h',
-  'ide-xml-types.h',
   'ide-xml-utils.c',
-  'ide-xml-utils.h',
   'ide-xml-validator.c',
-  'ide-xml-validator.h',
   'ide-xml.c',
-  'ide-xml.h',
   'xml-pack-plugin.c',
 ]
 


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