Writing a class from type Gtk3::SourceView::CompletionProvider
- From: max augsburg gmx de
- To: "GTK-Perl List" <gtk-perl-list gnome org>
- Subject: Writing a class from type Gtk3::SourceView::CompletionProvider
- Date: Sat, 21 May 2016 09:42:03 +0200
Hello everybody,
As someone of you know, I try to write a perl module for Gtk3::SourceView. For testing a custom Completion I need an object from Gtk3::SourceView::CompletionProvider for the method $context->add_provider($custom_provider).
As I saw in some python examples about this topic, I tried to create a class for Custom Providers and create the $custom_provider as a object of this class. Here is my code so far for the class from which I create the $custom_provider with $custom_provider=Provider->new():
package Provider;
use Glib ("TRUE","FALSE");
use Gtk3::SourceView;
use Glib::Object::Subclass
"Gtk3::SourceView::CompletionProvider";
sub new {
my $obj = {};
bless $obj;
return $obj;
}
sub get_name {
return 'Custom'
}
sub match {
return TRUE;
}
sub populate {
my ($self, $context) = @_;
my $proposal = Gtk3::SourceView::CompletionItem->new('Hello World','Hello World');
$context->add_proposals($self, $proposal, TRUE);
}
The problem is that I get the following error:
GLib-GObject-WARNING **: cannot derive 'Provider' from non-fundamental parent type 'GtkSourceCompletionProvider' at /usr/local/lib/x86_64-linux-gnu/perl/5.20.2/Glib/Object/Subclass.pm line 235.
GLib-GObject-CRITICAL **: g_type_set_qdata: assertion 'node != NULL' failed at /usr/local/lib/x86_64-linux-gnu/perl/5.20.2/Glib/Object/Subclass.pm line 235.
GLib-GObject-WARNING **: cannot retrieve class for invalid (unclassed) type '<invalid>' at /usr/local/lib/x86_64-linux-gnu/perl/5.20.2/Glib/Object/Subclass.pm line 235.
The error appears also, if I just write:
package Provider;
use Glib ("TRUE","FALSE");
use Gtk3::SourceView;
use Glib::Object::Subclass
"Gtk3::SourceView::CompletionProvider";
Perhaps someone of you knows how to solve this problem?
Thanks much,
Max
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]