Interface Vala:D-BUS对象实现接口,属性错误

Interface Vala:D-BUS对象实现接口,属性错误,interface,properties,dbus,vala,Interface,Properties,Dbus,Vala,是否可以使用[DBus name=…]注释类来实现接口 按照上的示例,我正在实现一个D-BUS客户机/服务器应用程序 我发现这个例子有一点很奇怪,那就是没有单独的接口定义。我希望将客户端使用的接口放在一个单独的文件中,并让服务器类实现该接口。这样我可以让编译器告诉我什么时候遗漏了什么 但这似乎不适用于属性。以下定义与我的定义一致: /* interface.vala */ namespace org.test { [DBus (name = "org.test.Items")]

是否可以使用[DBus name=…]注释类来实现接口

按照上的示例,我正在实现一个D-BUS客户机/服务器应用程序

我发现这个例子有一点很奇怪,那就是没有单独的接口定义。我希望将客户端使用的接口放在一个单独的文件中,并让服务器类实现该接口。这样我可以让编译器告诉我什么时候遗漏了什么

但这似乎不适用于属性。以下定义与我的定义一致:

/* interface.vala */
namespace org.test {
    [DBus (name = "org.test.Items")]
    public interface IItems : Object {
        /**
         * The object paths to the item instances.
         *
         * These objects are of type org.test.items.Item.
         */
        public abstract ObjectPath[] items {
            owned get;
        }

        /**
         * The signal that is emitted when a new item is added.
         *
         * When this signal is emitted, the item will be available.
         *
         * @param id
         *     The object path to the item instance.
         */
        public signal void item_added(ObjectPath id);

        /**
         * The signal that is emitted when an item is removed.
         *
         * When this signal is emitted, the item will be unavailable.
         *
         * @param id
         *     The object path to the item instance.
         */
        public signal void item_removed(ObjectPath id);

        /**
         * Adds a new item.
         *
         * The URL will be parsed, and if it contains a valid item, it will be
         * added.
         *
         * @param url
         *     The URL to the item. This should typically be the URL of the
         *     RSS feed.
         * @return the ID of the item added, which can be used to query D-BUS
         *     for it
         * @throws IOError if a D-BUS error occurs
         */
        public abstract ObjectPath add_item(string url) throws IOError;

        /**
         * Removes an item.
         *
         * @param id
         *     The ID of the item to remove.
         * @throws IOError if a D-BUS error occurs
         */
        public abstract void remove_item(ObjectPath id) throws IOError;
    }
}

/* server.vala */
using Gee;

namespace org.test {
    [DBus (name = "org.test.Items")]
    public class Items : DBUSObject, IItems {
        private ArrayList<Item> _items;

        [DBus (visible = false)]
        protected override void dbus_register(DBusConnection conn,
                ObjectPath path) throws IOError {
            conn.register_object(path, this);
        }

        [DBus (visible = false)]
        public Items() {
            base("org.test.Items", "/org/test", "Items", true);
            _items = new ArrayList<Item>();
        }

        [DBus (visible = false)]
        ~Items() {
            unregister();
        }

        /**
         * @see interface.vala::org.test.IItems.comics
         */
        public ObjectPath[] items {
            owned get {
                ObjectPath[] result = {};
                foreach (var item in _items) {
                    result += new ObjectPath(item.path);
                }
                return result;
            }
        }

        /**
         * @see interface.vala::org.test.IItems.add_comic
         */
        public ObjectPath add_item(string url) throws IOError {
            /* . . . */
        }

        /**
         * @see interface.vala::org.test.IItems.remove_item
         */
        public void remove_item(ObjectPath id) throws IOError {
            /* . . . */
        }
    }
}
当我编译它时,我没有从valac得到任何错误,但是当编译生成的C代码时,链接器会抱怨:未定义对“org\u test\u items\u get\u items”的引用


此函数由_dbus\u org\u test\u items\u get\u items引用,但它不存在

这显然是一个bug。报告错误的正确位置是