Re: [Vala] Inheriting Gtk.ListStore



Hi,

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

(It makes it hard to respond to independent points and keep the context
logical when you top-post)

On Fri, Aug 28, 2009 at 19:53:23 +0200, Uwe Strempel wrote:
it seems to be a bug, because in vapi its defined correctly

    [CCode (cname = "gtk_list_store_newv", has_construct_function = false)]
        public ListStore.newv ([CCode (array_length_pos = 0.9)] GLib.Type[]
types);

and the method gtk_list_store_newv exits but not
gtk_list_store_construct_newv.

Well, if the construct function does not exist, than that constructor cannot
be used constructor of derived class. The declaration means an error should
come from Vala, but it cannot possibly work.

The idea of calling a base constructor is completely alien to GObject and no
non-vala classes can have their non-default constructor called by subclass.
The reason is, that the *_new functions are NOT constructors, they are
allocators. A constructor is the member in GObjectClass and that always takes
just the array of construct-time properties.

In case of Gtk.ListStore, the type list is not a property, but there is
a setter for it. So the correct code is:

class CustListStore : Gtk.ListStore {
    public CustListStore(Type[] types) {
        set_column_types(types);
    }
}

I am trying to inherit ListStore object, but with no success.

It's complaining the following message when I compile
"undefined reference to `gtk_list_store_construct'"

Does anyone know how to inherit vala object?

vala version: 0.7.5

class CustListStore : Gtk.ListStore {

   public CustListStore (Type[] types) {
       base.newv(types);
   }

}

-- 
                                                 Jan 'Bulb' Hudec <bulb ucw cz>



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