Re: gtk-app-devel-list Digest, Vol 81, Issue 20



Hi,

I did some hacking into this.  If you want a simple form of completion
you can use the following implementation-

#include <gtksourceview/gtksourcecompletion.h>
#include <gtksourceview/gtksourcecompletioninfo.h>
#include <gtksourceview/gtksourcecompletionitem.h>
#include
<gtksourceview/completion-providers/words/gtksourcecompletionwords.h>

GtkSourceCompletionWords *prov_words;

comp = gtk_source_view_get_completion (GTK_SOURCE_VIEW (textview));

prov_words = gtk_source_completion_words_new (NULL, NULL);

gtk_source_completion_words_register (prov_words,
  gtk_text_view_get_buffer (GTK_TEXT_VIEW (textview)));

gtk_source_completion_add_provider (comp,
  GTK_SOURCE_COMPLETION_PROVIDER (prov_words)NULL);

I added more than needed #includes above for safety. You may want to
test the code and remove some of them. If you want to make a more
complex you have to build your own provider from scratch with a
structure, create it as an object and pass it into
gtk_source_completion_add_provider, because GtkSourceCompletionProvider
has no constructor, which is weird.

Craig Bakalian


On Wed, 2011-01-19 at 12:00 +0000, gtk-app-devel-list-request gnome org
wrote:
As far as I can see GtkSourceCompletion is not obsolete, it has just
become
part of the GtkSourceView library.
See here: http://library.gnome.org/devel/gtksourceview/stable/

I also started looking for the examples of its usage.
You can find an example in GtkSourceView code itself and in Anjuta
code.
But I agree, there is no good example out there.

Documentation is also quite terse, and it is not clear on what needs
to be 
done
to have your custom implementation, passing your own word list for
example.
GtkSourceView provides sample completion provider named 
gtksourcecompletionwords,
but it is undocumented, so it seems it will need effort to use this.

Regards,
  Miroslav 




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