[gnome-builder/wip/gtk4-port] plugins/ctags: port to GTK 4
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port] plugins/ctags: port to GTK 4
- Date: Tue, 19 Apr 2022 03:36:54 +0000 (UTC)
commit 7b5f906c55359c73740104b037f0023572a517c4
Author: Christian Hergert <chergert redhat com>
Date: Mon Apr 18 20:11:43 2022 -0700
plugins/ctags: port to GTK 4
We are dropping the preferences addin here since it is really just a
toggle for the plugin type.
src/plugins/ctags/ctags-plugin.c | 7 +-
src/plugins/ctags/ide-ctags-completion-item.c | 48 +++---
src/plugins/ctags/ide-ctags-completion-item.h | 14 +-
src/plugins/ctags/ide-ctags-completion-provider.c | 180 ++++++++++++----------
src/plugins/ctags/ide-ctags-index.c | 20 ---
src/plugins/ctags/ide-ctags-preferences-addin.c | 89 -----------
src/plugins/ctags/ide-ctags-preferences-addin.h | 31 ----
src/plugins/ctags/ide-ctags-results.c | 4 +-
src/plugins/ctags/ide-ctags-service.c | 26 ++--
src/plugins/ctags/meson.build | 1 -
src/plugins/meson.build | 2 +-
11 files changed, 149 insertions(+), 273 deletions(-)
---
diff --git a/src/plugins/ctags/ctags-plugin.c b/src/plugins/ctags/ctags-plugin.c
index af6b794fb..9f5ab2612 100644
--- a/src/plugins/ctags/ctags-plugin.c
+++ b/src/plugins/ctags/ctags-plugin.c
@@ -22,6 +22,7 @@
#include <libpeas/peas.h>
#include <gtksourceview/gtksource.h>
+
#include <libide-code.h>
#include <libide-gui.h>
#include <libide-sourceview.h>
@@ -33,21 +34,17 @@
#include "ide-ctags-completion-provider.h"
#include "ide-ctags-highlighter.h"
#include "ide-ctags-index.h"
-#include "ide-ctags-preferences-addin.h"
#include "ide-ctags-symbol-resolver.h"
_IDE_EXTERN void
_ide_ctags_register_types (PeasObjectModule *module)
{
peas_object_module_register_extension_type (module,
- IDE_TYPE_COMPLETION_PROVIDER,
+ GTK_SOURCE_TYPE_COMPLETION_PROVIDER,
IDE_TYPE_CTAGS_COMPLETION_PROVIDER);
peas_object_module_register_extension_type (module,
IDE_TYPE_HIGHLIGHTER,
IDE_TYPE_CTAGS_HIGHLIGHTER);
- peas_object_module_register_extension_type (module,
- IDE_TYPE_PREFERENCES_ADDIN,
- IDE_TYPE_CTAGS_PREFERENCES_ADDIN);
peas_object_module_register_extension_type (module,
IDE_TYPE_SYMBOL_RESOLVER,
IDE_TYPE_CTAGS_SYMBOL_RESOLVER);
diff --git a/src/plugins/ctags/ide-ctags-completion-item.c b/src/plugins/ctags/ide-ctags-completion-item.c
index 414e8244f..aa345d9dc 100644
--- a/src/plugins/ctags/ide-ctags-completion-item.c
+++ b/src/plugins/ctags/ide-ctags-completion-item.c
@@ -20,7 +20,8 @@
#define G_LOG_DOMAIN "ide-ctags-completion-item"
-#include <dazzle.h>
+#include "config.h"
+
#include <glib/gi18n.h>
#include "ide-ctags-completion-item.h"
@@ -28,11 +29,9 @@
#include "ide-ctags-results.h"
G_DEFINE_FINAL_TYPE_WITH_CODE (IdeCtagsCompletionItem,
- ide_ctags_completion_item,
- G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE (IDE_TYPE_COMPLETION_PROPOSAL, NULL))
-
-DZL_DEFINE_COUNTER (instances, "IdeCtagsCompletionItem", "Instances", "Number of IdeCtagsCompletionItems")
+ ide_ctags_completion_item,
+ G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (GTK_SOURCE_TYPE_COMPLETION_PROPOSAL, NULL))
IdeCtagsCompletionItem *
ide_ctags_completion_item_new (IdeCtagsResults *results,
@@ -57,8 +56,6 @@ static void
ide_ctags_completion_item_finalize (GObject *object)
{
G_OBJECT_CLASS (ide_ctags_completion_item_parent_class)->finalize (object);
-
- DZL_COUNTER_DEC (instances);
}
static void
@@ -72,7 +69,6 @@ ide_ctags_completion_item_class_init (IdeCtagsCompletionItemClass *klass)
static void
ide_ctags_completion_item_init (IdeCtagsCompletionItem *self)
{
- DZL_COUNTER_INC (instances);
}
gboolean
@@ -84,43 +80,43 @@ ide_ctags_completion_item_is_function (IdeCtagsCompletionItem *self)
return self->entry->kind == IDE_CTAGS_INDEX_ENTRY_FUNCTION;
}
-IdeSnippet *
+GtkSourceSnippet *
ide_ctags_completion_item_get_snippet (IdeCtagsCompletionItem *self,
IdeFileSettings *file_settings)
{
- g_autoptr(IdeSnippet) ret = NULL;
- g_autoptr(IdeSnippetChunk) chunk1 = NULL;
+ g_autoptr(GtkSourceSnippet) ret = NULL;
+ g_autoptr(GtkSourceSnippetChunk) chunk1 = NULL;
g_return_val_if_fail (IDE_IS_CTAGS_COMPLETION_ITEM (self), NULL);
g_return_val_if_fail (!file_settings || IDE_IS_FILE_SETTINGS (file_settings), NULL);
- ret = ide_snippet_new (NULL, NULL);
+ ret = gtk_source_snippet_new (NULL, NULL);
- chunk1 = ide_snippet_chunk_new ();
- ide_snippet_chunk_set_spec (chunk1, self->entry->name);
- ide_snippet_add_chunk (ret, chunk1);
+ chunk1 = gtk_source_snippet_chunk_new ();
+ gtk_source_snippet_chunk_set_spec (chunk1, self->entry->name);
+ gtk_source_snippet_add_chunk (ret, chunk1);
if (ide_ctags_completion_item_is_function (self))
{
- g_autoptr(IdeSnippetChunk) chunk2 = ide_snippet_chunk_new ();
- g_autoptr(IdeSnippetChunk) chunk3 = ide_snippet_chunk_new ();
- g_autoptr(IdeSnippetChunk) chunk4 = ide_snippet_chunk_new ();
+ g_autoptr(GtkSourceSnippetChunk) chunk2 = gtk_source_snippet_chunk_new ();
+ g_autoptr(GtkSourceSnippetChunk) chunk3 = gtk_source_snippet_chunk_new ();
+ g_autoptr(GtkSourceSnippetChunk) chunk4 = gtk_source_snippet_chunk_new ();
IdeSpacesStyle style = IDE_SPACES_STYLE_BEFORE_LEFT_PAREN;
if (file_settings != NULL)
style = ide_file_settings_get_spaces_style (file_settings);
if (style & IDE_SPACES_STYLE_BEFORE_LEFT_PAREN)
- ide_snippet_chunk_set_spec (chunk2, " (");
+ gtk_source_snippet_chunk_set_spec (chunk2, " (");
else
- ide_snippet_chunk_set_spec (chunk2, "(");
+ gtk_source_snippet_chunk_set_spec (chunk2, "(");
- ide_snippet_chunk_set_tab_stop (chunk3, 0);
- ide_snippet_chunk_set_spec (chunk4, ")");
+ gtk_source_snippet_chunk_set_focus_position (chunk3, 0);
+ gtk_source_snippet_chunk_set_spec (chunk4, ")");
- ide_snippet_add_chunk (ret, chunk2);
- ide_snippet_add_chunk (ret, chunk3);
- ide_snippet_add_chunk (ret, chunk4);
+ gtk_source_snippet_add_chunk (ret, chunk2);
+ gtk_source_snippet_add_chunk (ret, chunk3);
+ gtk_source_snippet_add_chunk (ret, chunk4);
}
return g_steal_pointer (&ret);
diff --git a/src/plugins/ctags/ide-ctags-completion-item.h b/src/plugins/ctags/ide-ctags-completion-item.h
index 1894be5fc..d364af980 100644
--- a/src/plugins/ctags/ide-ctags-completion-item.h
+++ b/src/plugins/ctags/ide-ctags-completion-item.h
@@ -34,15 +34,15 @@ G_DECLARE_FINAL_TYPE (IdeCtagsCompletionItem, ide_ctags_completion_item, IDE, CT
struct _IdeCtagsCompletionItem
{
- GObject parent_instance;
+ GObject parent_instance;
const IdeCtagsIndexEntry *entry;
- IdeCtagsResults *results;
+ IdeCtagsResults *results;
};
-IdeCtagsCompletionItem *ide_ctags_completion_item_new (IdeCtagsResults *results,
- const IdeCtagsIndexEntry *entry);
-gboolean ide_ctags_completion_item_is_function (IdeCtagsCompletionItem *self);
-IdeSnippet *ide_ctags_completion_item_get_snippet (IdeCtagsCompletionItem *self,
- IdeFileSettings *file_settings);
+IdeCtagsCompletionItem *ide_ctags_completion_item_new (IdeCtagsResults *results,
+ const IdeCtagsIndexEntry *entry);
+gboolean ide_ctags_completion_item_is_function (IdeCtagsCompletionItem *self);
+GtkSourceSnippet *ide_ctags_completion_item_get_snippet (IdeCtagsCompletionItem *self,
+ IdeFileSettings *file_settings);
G_END_DECLS
diff --git a/src/plugins/ctags/ide-ctags-completion-provider.c
b/src/plugins/ctags/ide-ctags-completion-provider.c
index 02756b4d6..76b0a2ae9 100644
--- a/src/plugins/ctags/ide-ctags-completion-provider.c
+++ b/src/plugins/ctags/ide-ctags-completion-provider.c
@@ -30,14 +30,14 @@
#include "ide-ctags-service.h"
#include "ide-ctags-util.h"
-static void provider_iface_init (IdeCompletionProviderInterface *iface);
-
-static GHashTable *reserved;
+static void provider_iface_init (GtkSourceCompletionProviderInterface *iface);
G_DEFINE_FINAL_TYPE_WITH_CODE (IdeCtagsCompletionProvider,
- ide_ctags_completion_provider,
- IDE_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE (IDE_TYPE_COMPLETION_PROVIDER, provider_iface_init))
+ ide_ctags_completion_provider,
+ IDE_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (GTK_SOURCE_TYPE_COMPLETION_PROVIDER,
provider_iface_init))
+
+static GHashTable *reserved;
static const gchar *
get_icon_name (IdeCtagsCompletionItem *item)
@@ -135,20 +135,6 @@ ide_ctags_completion_provider_add_index (IdeCtagsCompletionProvider *self,
g_ptr_array_add (self->indexes, g_object_ref (index));
}
-static void
-ide_ctags_completion_provider_load (IdeCompletionProvider *provider,
- IdeContext *context)
-{
- IdeCtagsCompletionProvider *self = (IdeCtagsCompletionProvider *)provider;
- g_autoptr(IdeCtagsService) service = NULL;
-
- g_assert (IDE_IS_CTAGS_COMPLETION_PROVIDER (self));
- g_assert (IDE_IS_CONTEXT (context));
-
- if ((service = ide_object_get_child_typed (IDE_OBJECT (context), IDE_TYPE_CTAGS_SERVICE)))
- ide_ctags_service_register_completion (service, self);
-}
-
static void
ide_ctags_completion_provider_dispose (GObject *object)
{
@@ -174,10 +160,31 @@ ide_ctags_completion_provider_finalize (GObject *object)
G_OBJECT_CLASS (ide_ctags_completion_provider_parent_class)->finalize (object);
}
+static void
+ide_ctags_completion_provider_parent_set (IdeObject *object,
+ IdeObject *parent)
+{
+ IdeCtagsCompletionProvider *self = (IdeCtagsCompletionProvider *)object;
+ g_autoptr(IdeCtagsService) service = NULL;
+ IdeContext *context;
+
+ g_assert (IDE_IS_CTAGS_COMPLETION_PROVIDER (self));
+ g_assert (!parent || IDE_IS_OBJECT (parent));
+
+ if (parent == NULL)
+ return;
+
+ context = ide_object_get_context (parent);
+
+ if ((service = ide_object_get_child_typed (IDE_OBJECT (context), IDE_TYPE_CTAGS_SERVICE)))
+ ide_ctags_service_register_completion (service, self);
+}
+
static void
ide_ctags_completion_provider_class_init (IdeCtagsCompletionProviderClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ IdeObjectClass *i_object_class = IDE_OBJECT_CLASS (klass);
static const gchar *reserved_keywords[] = {
"break", "continue", "default", "do", "elif", "else", "enum", "for",
"goto", "if", "pass", "return", "struct", "sizeof", "switch", "typedef",
@@ -187,6 +194,8 @@ ide_ctags_completion_provider_class_init (IdeCtagsCompletionProviderClass *klass
object_class->dispose = ide_ctags_completion_provider_dispose;
object_class->finalize = ide_ctags_completion_provider_finalize;
+ i_object_class->parent_set = ide_ctags_completion_provider_parent_set;
+
reserved = g_hash_table_new (g_str_hash, g_str_equal);
for (guint i = 0; i < G_N_ELEMENTS (reserved_keywords); i++)
g_hash_table_insert (reserved, (gchar *)reserved_keywords[i], NULL);
@@ -219,16 +228,16 @@ ide_ctags_completion_provider_init (IdeCtagsCompletionProvider *self)
}
static const gchar * const *
-get_allowed_suffixes (IdeCompletionContext *context)
+get_allowed_suffixes (GtkSourceCompletionContext *context)
{
GtkSourceLanguage *language;
- GtkTextBuffer *buffer;
+ GtkSourceBuffer *buffer;
const gchar *lang_id = NULL;
- g_assert (IDE_IS_COMPLETION_CONTEXT (context));
+ g_assert (GTK_SOURCE_IS_COMPLETION_CONTEXT (context));
- buffer = ide_completion_context_get_buffer (context);
- if ((language = gtk_source_buffer_get_language (GTK_SOURCE_BUFFER (buffer))))
+ buffer = gtk_source_completion_context_get_buffer (context);
+ if ((language = gtk_source_buffer_get_language (buffer)))
lang_id = gtk_source_language_get_id (language);
return ide_ctags_get_allowed_suffixes (lang_id);
@@ -252,11 +261,11 @@ ide_ctags_completion_provider_populate_cb (GObject *object,
}
static void
-ide_ctags_completion_provider_populate_async (IdeCompletionProvider *provider,
- IdeCompletionContext *context,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+ide_ctags_completion_provider_populate_async (GtkSourceCompletionProvider *provider,
+ GtkSourceCompletionContext *context,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
IdeCtagsCompletionProvider *self = (IdeCtagsCompletionProvider *)provider;
g_autoptr(IdeCtagsResults) model = NULL;
@@ -265,7 +274,7 @@ ide_ctags_completion_provider_populate_async (IdeCompletionProvider *provider,
GtkTextIter begin, end;
g_assert (IDE_IS_CTAGS_COMPLETION_PROVIDER (self));
- g_assert (IDE_IS_COMPLETION_CONTEXT (context));
+ g_assert (GTK_SOURCE_IS_COMPLETION_CONTEXT (context));
g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
task = ide_task_new (self, cancellable, callback, user_data);
@@ -280,7 +289,7 @@ ide_ctags_completion_provider_populate_async (IdeCompletionProvider *provider,
return;
}
- ide_completion_context_get_bounds (context, &begin, &end);
+ gtk_source_completion_context_get_bounds (context, &begin, &end);
word = gtk_text_iter_get_slice (&begin, &end);
model = ide_ctags_results_new ();
@@ -296,9 +305,9 @@ ide_ctags_completion_provider_populate_async (IdeCompletionProvider *provider,
}
static GListModel *
-ide_ctags_completion_provider_populate_finish (IdeCompletionProvider *provider,
- GAsyncResult *result,
- GError **error)
+ide_ctags_completion_provider_populate_finish (GtkSourceCompletionProvider *provider,
+ GAsyncResult *result,
+ GError **error)
{
g_return_val_if_fail (IDE_IS_CTAGS_COMPLETION_PROVIDER (provider), NULL);
g_return_val_if_fail (IDE_IS_TASK (result), NULL);
@@ -307,8 +316,8 @@ ide_ctags_completion_provider_populate_finish (IdeCompletionProvider *provider,
}
static gint
-ide_ctags_completion_provider_get_priority (IdeCompletionProvider *provider,
- IdeCompletionContext *context)
+ide_ctags_completion_provider_get_priority (GtkSourceCompletionProvider *provider,
+ GtkSourceCompletionContext *context)
{
return IDE_CTAGS_COMPLETION_PROVIDER_PRIORITY;
}
@@ -321,30 +330,29 @@ is_reserved_word (const gchar *word)
}
static void
-ide_ctags_completion_provider_activate_proposal (IdeCompletionProvider *provider,
- IdeCompletionContext *context,
- IdeCompletionProposal *proposal,
- const GdkEventKey *key)
+ide_ctags_completion_provider_activate (GtkSourceCompletionProvider *provider,
+ GtkSourceCompletionContext *context,
+ GtkSourceCompletionProposal *proposal)
{
IdeCtagsCompletionItem *item = (IdeCtagsCompletionItem *)proposal;
g_autofree gchar *slice = NULL;
- g_autoptr(IdeSnippet) snippet = NULL;
+ g_autoptr(GtkSourceSnippet) snippet = NULL;
IdeFileSettings *file_settings;
- GtkTextBuffer *buffer;
- GtkTextView *view;
+ GtkSourceBuffer *buffer;
+ GtkSourceView *view;
GtkTextIter begin;
GtkTextIter end;
g_assert (IDE_IS_CTAGS_COMPLETION_PROVIDER (provider));
g_assert (IDE_IS_CTAGS_COMPLETION_ITEM (item));
- g_assert (IDE_IS_COMPLETION_CONTEXT (context));
+ g_assert (GTK_SOURCE_IS_COMPLETION_CONTEXT (context));
- ide_completion_context_get_bounds (context, &begin, &end);
+ gtk_source_completion_context_get_bounds (context, &begin, &end);
- view = ide_completion_context_get_view (context);
+ view = gtk_source_completion_context_get_view (context);
g_assert (IDE_IS_SOURCE_VIEW (view));
- buffer = ide_completion_context_get_buffer (context);
+ buffer = gtk_source_completion_context_get_buffer (context);
g_assert (IDE_IS_BUFFER (buffer));
file_settings = ide_buffer_get_file_settings (IDE_BUFFER (buffer));
@@ -357,59 +365,75 @@ ide_ctags_completion_provider_activate_proposal (IdeCompletionProvider *provider
snippet = ide_ctags_completion_item_get_snippet (item, file_settings);
- gtk_text_buffer_begin_user_action (buffer);
- gtk_text_buffer_delete (buffer, &begin, &end);
- ide_source_view_push_snippet (IDE_SOURCE_VIEW (view), snippet, &begin);
- gtk_text_buffer_end_user_action (buffer);
+ gtk_text_buffer_begin_user_action (GTK_TEXT_BUFFER (buffer));
+ gtk_text_buffer_delete (GTK_TEXT_BUFFER (buffer), &begin, &end);
+ gtk_source_view_push_snippet (GTK_SOURCE_VIEW (view), snippet, &begin);
+ gtk_text_buffer_end_user_action (GTK_TEXT_BUFFER (buffer));
}
-static gboolean
-ide_ctags_completion_provider_refilter (IdeCompletionProvider *self,
- IdeCompletionContext *context,
- GListModel *model)
+static void
+ide_ctags_completion_provider_refilter (GtkSourceCompletionProvider *self,
+ GtkSourceCompletionContext *context,
+ GListModel *model)
{
g_autofree gchar *word = NULL;
- GtkTextIter begin, end;
g_assert (IDE_IS_CTAGS_COMPLETION_PROVIDER (self));
- g_assert (IDE_IS_COMPLETION_CONTEXT (context));
+ g_assert (GTK_SOURCE_IS_COMPLETION_CONTEXT (context));
g_assert (IDE_IS_CTAGS_RESULTS (model));
- ide_completion_context_get_bounds (context, &begin, &end);
- word = gtk_text_iter_get_slice (&begin, &end);
+ gtk_source_completion_context_get_word (context);
ide_ctags_results_set_word (IDE_CTAGS_RESULTS (model), word);
ide_ctags_results_refilter (IDE_CTAGS_RESULTS (model));
-
- return TRUE;
}
static void
-ide_ctags_completion_provider_display_proposal (IdeCompletionProvider *provider,
- IdeCompletionListBoxRow *row,
- IdeCompletionContext *context,
- const gchar *typed_text,
- IdeCompletionProposal *proposal)
+ide_ctags_completion_provider_display (GtkSourceCompletionProvider *provider,
+ GtkSourceCompletionContext *context,
+ GtkSourceCompletionProposal *proposal,
+ GtkSourceCompletionCell *cell)
{
IdeCtagsCompletionItem *item = IDE_CTAGS_COMPLETION_ITEM (proposal);
- g_autofree gchar *highlight = NULL;
+ GtkSourceCompletionColumn column;
- highlight = ide_completion_fuzzy_highlight (item->entry->name, typed_text);
+ g_assert (GTK_SOURCE_IS_COMPLETION_PROVIDER (provider));
+ g_assert (GTK_SOURCE_IS_COMPLETION_CONTEXT (context));
+ g_assert (GTK_SOURCE_IS_COMPLETION_PROPOSAL (proposal));
+ g_assert (GTK_SOURCE_IS_COMPLETION_CELL (cell));
- ide_completion_list_box_row_set_icon_name (row, get_icon_name (item));
- ide_completion_list_box_row_set_left (row, NULL);
- ide_completion_list_box_row_set_center_markup (row, highlight);
- ide_completion_list_box_row_set_right (row, NULL);
-}
+ column = gtk_source_completion_cell_get_column (cell);
+ switch (column)
+ {
+ case GTK_SOURCE_COMPLETION_COLUMN_ICON:
+ gtk_source_completion_cell_set_icon_name (cell, get_icon_name (item));
+ break;
+
+ case GTK_SOURCE_COMPLETION_COLUMN_TYPED_TEXT:
+ {
+ g_autofree char *word = gtk_source_completion_context_get_word (context);
+ g_autoptr(PangoAttrList) attrs = gtk_source_completion_fuzzy_highlight (item->entry->name, word);
+ gtk_source_completion_cell_set_text_with_attributes (cell, item->entry->name, attrs);
+ break;
+ }
+
+ case GTK_SOURCE_COMPLETION_COLUMN_BEFORE:
+ case GTK_SOURCE_COMPLETION_COLUMN_AFTER:
+ case GTK_SOURCE_COMPLETION_COLUMN_COMMENT:
+ case GTK_SOURCE_COMPLETION_COLUMN_DETAILS:
+ default:
+ gtk_source_completion_cell_set_text (cell, NULL);
+ break;
+ }
+}
static void
-provider_iface_init (IdeCompletionProviderInterface *iface)
+provider_iface_init (GtkSourceCompletionProviderInterface *iface)
{
- iface->load = ide_ctags_completion_provider_load;
+ iface->activate = ide_ctags_completion_provider_activate;
+ iface->display = ide_ctags_completion_provider_display;
iface->get_priority = ide_ctags_completion_provider_get_priority;
- iface->activate_proposal = ide_ctags_completion_provider_activate_proposal;
iface->populate_async = ide_ctags_completion_provider_populate_async;
iface->populate_finish = ide_ctags_completion_provider_populate_finish;
iface->refilter = ide_ctags_completion_provider_refilter;
- iface->display_proposal = ide_ctags_completion_provider_display_proposal;
}
diff --git a/src/plugins/ctags/ide-ctags-index.c b/src/plugins/ctags/ide-ctags-index.c
index de67c0c54..a11ee63b0 100644
--- a/src/plugins/ctags/ide-ctags-index.c
+++ b/src/plugins/ctags/ide-ctags-index.c
@@ -20,7 +20,6 @@
#define G_LOG_DOMAIN "ide-ctags-index"
-#include <dazzle.h>
#include <glib/gi18n.h>
#include <stdlib.h>
#include <string.h>
@@ -56,10 +55,6 @@ static void async_initable_iface_init (GAsyncInitableIface *iface);
G_DEFINE_FINAL_TYPE_WITH_CODE (IdeCtagsIndex, ide_ctags_index, IDE_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE, async_initable_iface_init))
-DZL_DEFINE_COUNTER (instances, "IdeCtagsIndex", "Instances", "Number of IdeCtagsIndex instances.")
-DZL_DEFINE_COUNTER (index_entries, "IdeCtagsIndex", "N Entries", "Number of entries in indexes.")
-DZL_DEFINE_COUNTER (heap_size, "IdeCtagsIndex", "Heap Size", "Size of index string heaps.")
-
static GParamSpec *properties [LAST_PROP];
static gint
@@ -247,9 +242,6 @@ ide_ctags_index_build_index (IdeTask *task,
self->index = index;
self->buffer = g_bytes_new_take (contents, length);
- DZL_COUNTER_ADD (index_entries, (gint64)index->len);
- DZL_COUNTER_ADD (heap_size, (gint64)length);
-
ide_task_return_boolean (task, TRUE);
IDE_EXIT;
@@ -361,23 +353,12 @@ ide_ctags_index_finalize (GObject *object)
{
IdeCtagsIndex *self = (IdeCtagsIndex *)object;
- if (self->index != NULL)
- DZL_COUNTER_SUB (index_entries, (gint64)self->index->len);
-
- if (self->buffer != NULL)
- {
- gsize len = g_bytes_get_size (self->buffer);
- DZL_COUNTER_SUB (heap_size, (gint64)len);
- }
-
g_clear_object (&self->file);
g_clear_pointer (&self->index, g_array_unref);
g_clear_pointer (&self->buffer, g_bytes_unref);
g_clear_pointer (&self->path_root, g_free);
G_OBJECT_CLASS (ide_ctags_index_parent_class)->finalize (object);
-
- DZL_COUNTER_DEC (instances);
}
static void
@@ -418,7 +399,6 @@ ide_ctags_index_class_init (IdeCtagsIndexClass *klass)
static void
ide_ctags_index_init (IdeCtagsIndex *self)
{
- DZL_COUNTER_INC (instances);
}
static void
diff --git a/src/plugins/ctags/ide-ctags-results.c b/src/plugins/ctags/ide-ctags-results.c
index ce5a0ae15..5cf42511b 100644
--- a/src/plugins/ctags/ide-ctags-results.c
+++ b/src/plugins/ctags/ide-ctags-results.c
@@ -62,7 +62,7 @@ populate_free (Populate *state)
static GType
ide_ctags_results_get_item_type (GListModel *model)
{
- return IDE_TYPE_COMPLETION_PROPOSAL;
+ return GTK_SOURCE_TYPE_COMPLETION_PROPOSAL;
}
static gpointer
@@ -187,7 +187,7 @@ ide_ctags_results_populate_worker (IdeTask *task,
if (!ide_ctags_is_allowed (entry, p->suffixes))
continue;
- if (ide_completion_fuzzy_match (entry->name, p->casefold, &priority))
+ if (gtk_source_completion_fuzzy_match (entry->name, p->casefold, &priority))
{
Item item;
diff --git a/src/plugins/ctags/ide-ctags-service.c b/src/plugins/ctags/ide-ctags-service.c
index e6f9d6b83..40c301f36 100644
--- a/src/plugins/ctags/ide-ctags-service.c
+++ b/src/plugins/ctags/ide-ctags-service.c
@@ -20,9 +20,9 @@
#define G_LOG_DOMAIN "ide-ctags-service"
-#include <dazzle.h>
#include <glib/gi18n.h>
#include <gtksourceview/gtksource.h>
+
#include <libide-code.h>
#include <libide-vcs.h>
@@ -39,7 +39,7 @@ struct _IdeCtagsService
{
IdeObject parent_instance;
- DzlTaskCache *indexes;
+ IdeTaskCache *indexes;
GCancellable *cancellable;
GPtrArray *highlighters;
GPtrArray *completions;
@@ -246,7 +246,7 @@ resolve_path_root (IdeCtagsService *self,
}
static void
-ide_ctags_service_build_index_cb (DzlTaskCache *cache,
+ide_ctags_service_build_index_cb (IdeTaskCache *cache,
gconstpointer key,
GTask *task,
gpointer user_data)
@@ -287,17 +287,17 @@ ide_ctags_service_tags_loaded_cb (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
- DzlTaskCache *cache = (DzlTaskCache *)object;
+ IdeTaskCache *cache = (IdeTaskCache *)object;
g_autoptr(IdeCtagsService) self = user_data;
g_autoptr(IdeCtagsIndex) index = NULL;
GError *error = NULL;
IDE_ENTRY;
- g_assert (DZL_IS_TASK_CACHE (cache));
+ g_assert (IDE_IS_TASK_CACHE (cache));
g_assert (IDE_IS_CTAGS_SERVICE (self));
- if (!(index = dzl_task_cache_get_finish (cache, result, &error)))
+ if (!(index = ide_task_cache_get_finish (cache, result, &error)))
{
/* don't log if it was an empty file */
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NONE))
@@ -350,13 +350,13 @@ do_load (gpointer data)
GFile *file;
} *pair = data;
- if ((prev = dzl_task_cache_peek (pair->self->indexes, pair->file)))
+ if ((prev = ide_task_cache_peek (pair->self->indexes, pair->file)))
{
if (!file_is_newer (prev, pair->file))
goto cleanup;
}
- dzl_task_cache_get_async (pair->self->indexes,
+ ide_task_cache_get_async (pair->self->indexes,
pair->file,
TRUE,
pair->self->cancellable,
@@ -834,7 +834,7 @@ ide_ctags_service_init (IdeCtagsService *self)
(GEqualFunc)g_file_equal,
g_object_unref, NULL);
- self->indexes = dzl_task_cache_new ((GHashFunc)g_file_hash,
+ self->indexes = ide_task_cache_new ((GHashFunc)g_file_hash,
(GEqualFunc)g_file_equal,
g_object_ref,
g_object_unref,
@@ -845,7 +845,7 @@ ide_ctags_service_init (IdeCtagsService *self)
self,
NULL);
- dzl_task_cache_set_name (self->indexes, "ctags index cache");
+ ide_task_cache_set_name (self->indexes, "ctags index cache");
}
/**
@@ -864,7 +864,7 @@ ide_ctags_service_get_indexes (IdeCtagsService *self)
{
g_return_val_if_fail (IDE_IS_CTAGS_SERVICE (self), NULL);
- return dzl_task_cache_get_values (self->indexes);
+ return ide_task_cache_get_values (self->indexes);
}
void
@@ -877,7 +877,7 @@ ide_ctags_service_register_highlighter (IdeCtagsService *self,
g_return_if_fail (IDE_IS_CTAGS_SERVICE (self));
g_return_if_fail (IDE_IS_CTAGS_HIGHLIGHTER (highlighter));
- values = dzl_task_cache_get_values (self->indexes);
+ values = ide_task_cache_get_values (self->indexes);
for (i = 0; i < values->len; i++)
{
@@ -908,7 +908,7 @@ ide_ctags_service_register_completion (IdeCtagsService *self,
g_return_if_fail (IDE_IS_CTAGS_SERVICE (self));
g_return_if_fail (IDE_IS_CTAGS_COMPLETION_PROVIDER (completion));
- values = dzl_task_cache_get_values (self->indexes);
+ values = ide_task_cache_get_values (self->indexes);
for (i = 0; i < values->len; i++)
{
diff --git a/src/plugins/ctags/meson.build b/src/plugins/ctags/meson.build
index 36c8da888..0d58f1dbf 100644
--- a/src/plugins/ctags/meson.build
+++ b/src/plugins/ctags/meson.build
@@ -7,7 +7,6 @@ plugins_sources += files([
'ide-ctags-completion-provider.c',
'ide-ctags-highlighter.c',
'ide-ctags-index.c',
- 'ide-ctags-preferences-addin.c',
'ide-ctags-results.c',
'ide-ctags-service.c',
'ide-ctags-symbol-node.c',
diff --git a/src/plugins/meson.build b/src/plugins/meson.build
index 320133a57..5894e10b6 100644
--- a/src/plugins/meson.build
+++ b/src/plugins/meson.build
@@ -57,7 +57,7 @@ subdir('comment-code')
subdir('copyright')
subdir('c-pack')
#subdir('create-project')
-#subdir('ctags')
+subdir('ctags')
subdir('debuggerui')
#subdir('devhelp')
#subdir('deviceui')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]