Aw: Re: Writing a class from type Gtk3::SourceView::CompletionProvider



Dear oldtechaa,
Thank you very much for your answer. Unfortunately the Gtk3::SourceCompletion::get_providers method doesn't create a new Provider, but only returns the providers which has been added to the Gtk3::Completion with the function Gtk3::SourceCompletion::add_provider. For the last command I need a created Provider... The API ist unfortunately very circular :-)
I read in https://developer.gnome.org/gtksourceview/stable/GtkSourceCompletionProvider.html that one prerequisit is GObject. Perhaps this is the reason, why it doesn't work at the moment.
A dirty work-aroung could be to use Gtk3::Source::CompletionWords which is a implementation of CompletionProvider and try to change this word completion (I need special characters, so that CompletionWords is not enough). I will try this later but I don't know whether the structure of CompletionWords is the same. I don't think so...
 
Gesendet: Sonntag, 22. Mai 2016 um 14:05 Uhr
Von: oldtechaa <oldtechaa gmail com>
An: gtk-perl-list gnome org
Betreff: Re: Writing a class from type Gtk3::SourceView::CompletionProvider

I looked up the hierarchy and I see what you mean about no constructor. It seems, in fact, that CompletionProviders can only be constructed by the SourceView itself. The course I probably would recommend is to use your class to subclass every CompletionProvider returned by your SourceView's Completion object's get_providers() function. Here are the links:

https://developer.gnome.org/gtksourceview/stable/GtkSourceView.html#gtk-source-view-get-completion

https://developer.gnome.org/gtksourceview/stable/GtkSourceCompletion.html#gtk-source-completion-get-providers

When get_providers() returns the list, you can use each element and pass it to your class constructor, where it can be blessed. Then your constructor would look more like this:

sub new {
    return bless $_[1];
}

This way you return a blessed version of the class you pass to it from wherever you call your constructor.

_______________________________________________ gtk-perl-list mailing list gtk-perl-list gnome org https://mail.gnome.org/mailman/listinfo/gtk-perl-list
 
 


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