[Vala] Fail to generate C code for following vala code, is this a bug?



Hi list,
I tried to use Vala for the first time and the following code failed
to generate correct C code.
Is this a bug of vala or what's wrong with my code? (code is attached
to the end of this mail)

In addition, if I want to override a virtual function in a parent
class with the prototype like this:
public virtual unowned GLib.List get_volumes ();

How can I return an unowned GLib.List in my override function? I tried
and tried but nothing works.
This doesn't seem to be in Vala tutorial and I couldn't find
information on google.
The section in the tutorial related to weak ref and unowned didn't
talk about using this with GLib.List.
The tutorial for GLib.List doesn't mention this, either.
I have used gtk+/glib with C language for years and now I really want
to try Vala. Please help me.
Thank you very much!

--------------------------------------------------------------------------------------------------------------------------------------------------

using GLib;

namespace UDisks
{

public class Volume : GLib.Object, GLib.Volume
{
    public Volume() {
    }

    public bool can_eject () {
        return true;
    }

    public bool can_mount () {
        return true;
    }

    public async bool eject (GLib.MountUnmountFlags flags,
GLib.Cancellable? cancellable) throws GLib.Error {
        return true;
    }

    public bool eject_finish (GLib.AsyncResult _result) throws GLib.Error {
        return true;
    }

    public async bool eject_with_operation (GLib.MountUnmountFlags
flags, GLib.MountOperation? mount_operation, GLib.Cancellable?
cancellable) throws GLib.Error {
        return true;
    }

    public bool eject_with_operation_finish (GLib.AsyncResult _result)
throws GLib.Error {
        return true;
    }

    public unowned string enumerate_identifiers () {
        return "";
    }

    public unowned GLib.File get_activation_root (){
        return null;
    }

    public unowned GLib.Drive get_drive () {
        return null;
    }

    public unowned GLib.Icon get_icon () {
        return null;
    }

    public unowned string get_identifier (string kind)
    {
        return "";
    }

    public unowned GLib.Mount get_mount () {
        return null;
    }

    public unowned string get_name () {
        return "";
    }

    public unowned string get_uuid () {
        return "";
    }

    public bool mount_finish (GLib.AsyncResult _result) throws GLib.Error {
        return true;
    }

    public void mount_fn (GLib.MountMountFlags flags,
GLib.MountOperation? mount_operation, GLib.Cancellable? cancellable,
GLib.AsyncReadyCallback callback) {

    }

    public bool should_automount () {
        return false;
    }
}

}



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