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



Dear oldtechaa,
Thank you for all your help. But this is exactly the problem. Gtk3::SourceView::CompletionProvider has no "new"-method. Enclosed you will find the solution of this problem in python. I don't master this language, but perhaps someone is also experienced in python and can help to translate this in the perl syntax:
class TestProvider(GObject.Object, GtkSource.CompletionProvider):
    __gtype_name__ = 'TestProvider'
    def __init__(self):
        GObject.Object.__init__(self)
        self.priority = 1
        theme = Gtk.IconTheme.get_default()
        icon = theme.load_icon(Gtk.STOCK_DIALOG_INFO, 16, 0)
        self.proposals = []
        self.proposals.append(GtkSource.CompletionItem.new("Proposal 1", "Proposal 1", icon, "blah 1"))
        self.proposals.append(GtkSource.CompletionItem.new("Proposal 2", "Proposal 2", icon, "blah 2"))
        self.proposals.append(GtkSource.CompletionItem.new("Proposal 3", "Proposal 3", icon, "blah 3"))
    def do_get_name(self):
        return "Test Provider"
    def do_get_priority(self):
        return self.priority
    def do_match(self, context):
        return True
    def do_populate(self, context):
    proposals = [
            GtkSource.CompletionItem(label='Hello World!', text='Hello World!', icon=None, info=None)  # always proposed
        context.add_proposals(self, self.proposals, True)
    def set_priority(self, priority):
        self.priority = priority
GObject.type_register(TestProvider)
[.....]
 
 


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