[Vala] Chain up base constructor troubles with C code...



Hi there,

to avoid some nasty duplicated code I try to use inheritance with a base abstract class and derived views.

I need to create a terminal view and a folder view, while it works fine with my terminal view which is written in Vala, I've some troubles with the folder view which is C code. :(

I have the following :

namespace Manager {

    public class FolderView : Fm.FolderView, BaseView {

        construct {
            base.new (Fm.FolderViewMode.LIST_VIEW);
            //Object ();
            //base (Fm.FolderViewMode.LIST_VIEW);
        }

        public FolderView () {
            //Object (mode: Fm.FolderViewMode.LIST_VIEW);
            //base (Fm.FolderViewMode.LIST_VIEW);

            base.new (Fm.FolderViewMode.LIST_VIEW);
        }
    }
}

I tried a few things without much success, the problem is that the base object doesn't seem to be created.

BaseView is an abstract class in Vala and Fm.FolderView is my base object in C, the one that gives my some troubles. :-P

In my Vapi file for the base object, I have :

[CCode (cheader_filename = "gtk/fm-folder-view.h")]
public class FolderView : Gtk.ScrolledWindow,
                          Atk.Implementor,
                          Gtk.Buildable {

        public Fm.FolderViewMode   mode;

        [CCode (has_construct_function = false,
                cname = "fm_folder_view_new",
                type = "GtkWidget*")]
        
        public FolderView (int mode);

}


The problem is that the new function (fm_folder_view_new) is not called from Vala code.

I tried to use "Object (mode: Fm.FolderViewMode.LIST_VIEW);"
but "mode" is not a property and it fails.

Is there a way so that when doing var = new Manager.FolderView ();
the base function "fm_folder_view_new" is called ?

Thanks. :)


--
Axel FILMORE
#--------------------------------------------#
        https://github.com/afilmore
#--------------------------------------------#
 Vala - Compiler For The GObject Type System
        https://live.gnome.org/Vala
#--------------------------------------------#



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