[gnome-builder] plugins/words: implement get_typed_text



commit 04baa1f2501be8b2cd75a267d88c008bac407865
Author: Christian Hergert <chergert redhat com>
Date:   Sun Sep 4 00:04:07 2022 -0700

    plugins/words: implement get_typed_text

 src/plugins/words/gbp-word-proposal.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/src/plugins/words/gbp-word-proposal.c b/src/plugins/words/gbp-word-proposal.c
index a716674d2..75f5e739a 100644
--- a/src/plugins/words/gbp-word-proposal.c
+++ b/src/plugins/words/gbp-word-proposal.c
@@ -29,11 +29,23 @@
 struct _GbpWordProposal
 {
   GObject parent_instance;
-  gchar *word;
+  char *word;
 };
 
+static char *
+gbp_word_proposal_get_typed_text (GtkSourceCompletionProposal *proposal)
+{
+  return g_strdup (GBP_WORD_PROPOSAL (proposal)->word);
+}
+
+static void
+proposal_iface_init (GtkSourceCompletionProposalInterface *iface)
+{
+  iface->get_typed_text = gbp_word_proposal_get_typed_text;
+}
+
 G_DEFINE_FINAL_TYPE_WITH_CODE (GbpWordProposal, gbp_word_proposal, G_TYPE_OBJECT,
-                               G_IMPLEMENT_INTERFACE (GTK_SOURCE_TYPE_COMPLETION_PROPOSAL, NULL))
+                               G_IMPLEMENT_INTERFACE (GTK_SOURCE_TYPE_COMPLETION_PROPOSAL, 
proposal_iface_init))
 
 static void
 gbp_word_proposal_finalize (GObject *object)
@@ -69,7 +81,7 @@ gbp_word_proposal_new (const gchar *word)
   return self;
 }
 
-const gchar *
+const char *
 gbp_word_proposal_get_word (GbpWordProposal *self)
 {
   g_return_val_if_fail (GBP_IS_WORD_PROPOSAL (self), NULL);


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