Enable null return in gobject-introspection

TEST=src/IBus.gir bindings/vala/ibus.vapi

Review URL: https://codereview.appspot.com/236410043
This commit is contained in:
fujiwarat 2015-05-21 14:12:22 +09:00
Родитель 0f9ea3d82a
Коммит 7ecbccc716
4 изменённых файлов: 74 добавлений и 28 удалений

Просмотреть файл

@ -46,6 +46,9 @@ public int main(string[] args) {
int id = 0;
factory.create_engine.connect((factory, name) => {
if (!name.has_prefix("xkb:"))
return null;
const string path = "/org/freedesktop/IBus/engine/simple/%d";
IBus.Engine engine = new IBus.Engine.with_type(

Просмотреть файл

@ -1,8 +1,8 @@
/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
/* vim:set et sts=4: */
/* ibus - The Input Bus
* Copyright (C) 2008-2013 Peng Huang <shawn.p.huang@gmail.com>
* Copyright (C) 2008-2013 Red Hat, Inc.
* Copyright (C) 2008-2015 Peng Huang <shawn.p.huang@gmail.com>
* Copyright (C) 2008-2015 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -164,7 +164,7 @@ ibus_factory_class_init (IBusFactoryClass *class)
* IBusFactory::create-engine:
* @factory: the factory which received the signal
* @engine_name: the engine_name which received the signal
* @returns: (transfer full): An IBusEngine
* @returns: (nullable) (transfer full): An IBusEngine
*
* The ::create-engine signal is a signal to create IBusEngine
* with @engine_name, which gets emitted when IBusFactory

Просмотреть файл

@ -1,8 +1,8 @@
/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
/* vim:set et sts=4: */
/* ibus - The Input Bus
* Copyright (C) 2008-2013 Peng Huang <shawn.p.huang@gmail.com>
* Copyright (C) 2008-2013 Red Hat, Inc.
* Copyright (C) 2008-2015 Peng Huang <shawn.p.huang@gmail.com>
* Copyright (C) 2008-2015 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -79,6 +79,20 @@ struct _IBusServiceClass {
/*< public >*/
/* virtual functions */
/**
* IBusServiceClass::service_method_call:
* @service: An #IBusService.
* @connection: A dbus connection.
* @sender: A sender.
* @object_path: An object path.
* @interface_name: An interface name.
* @method_name: A method name.
* @parameters: A parameters.
* @invocation: A dbus method invocation.
*
* The ::service_method_call class method is to connect
* GDBusInterfaceMethodCallFunc().
*/
void (* service_method_call)
(IBusService *service,
GDBusConnection *connection,
@ -89,6 +103,20 @@ struct _IBusServiceClass {
GVariant *parameters,
GDBusMethodInvocation
*invocation);
/**
* IBusServiceClass::service_get_property:
* @service: An #IBusService.
* @connection: A dbus connection.
* @sender: A sender.
* @object_path: An object path.
* @interface_name: An interface name.
* @property_name: A property name.
* @error: Return location for error or %NULL.
* @returns: (nullable) (transfer full): A variant.
*
* The ::service_get_property class method is to connect
* GDBusInterfaceGetPropertyFunc().
*/
GVariant * (* service_get_property)
(IBusService *service,
GDBusConnection *connection,
@ -97,6 +125,21 @@ struct _IBusServiceClass {
const gchar *interface_name,
const gchar *property_name,
GError **error);
/**
* IBusServiceClass::service_set_property:
* @service: An #IBusService.
* @connection: A dbus connection.
* @sender: A sender.
* @object_path: An object path.
* @interface_name: An interface name.
* @property_name: An property name.
* @value: An property value.
* @error: Return location for error or %NULL.
* @returns: %TRUE if set the value else %FALSE.
*
* The ::service_set_property class method is to connect
* GDBusInterfaceSetPropertyFunc().
*/
gboolean (* service_set_property)
(IBusService *service,
GDBusConnection *connection,

Просмотреть файл

@ -219,45 +219,45 @@ class Indicator : IBus.Service
activate();
}
private GLib.Variant _get_id(GLib.DBusConnection connection) {
private GLib.Variant? _get_id(GLib.DBusConnection connection) {
return new GLib.Variant.string(this.id);
}
private GLib.Variant _get_category(GLib.DBusConnection connection) {
private GLib.Variant? _get_category(GLib.DBusConnection connection) {
return new GLib.Variant.string(this.category_s);
}
private GLib.Variant _get_status(GLib.DBusConnection connection) {
private GLib.Variant? _get_status(GLib.DBusConnection connection) {
return new GLib.Variant.string(this.status_s);
}
private GLib.Variant _get_icon_name(GLib.DBusConnection connection) {
private GLib.Variant? _get_icon_name(GLib.DBusConnection connection) {
return new GLib.Variant.string(this.icon_name);
}
private GLib.Variant _get_icon_vector(GLib.DBusConnection connection) {
private GLib.Variant? _get_icon_vector(GLib.DBusConnection connection) {
return this.icon_vector;
}
private GLib.Variant _get_icon_desc(GLib.DBusConnection connection) {
private GLib.Variant? _get_icon_desc(GLib.DBusConnection connection) {
return new GLib.Variant.string(this.icon_desc);
}
private GLib.Variant _get_attention_icon_name(GLib.DBusConnection
connection) {
private GLib.Variant? _get_attention_icon_name(GLib.DBusConnection
connection) {
return new GLib.Variant.string(this.attention_icon_name);
}
private GLib.Variant _get_attention_icon_desc(GLib.DBusConnection
connection) {
private GLib.Variant? _get_attention_icon_desc(GLib.DBusConnection
connection) {
return new GLib.Variant.string(this.attention_icon_desc);
}
private GLib.Variant _get_title(GLib.DBusConnection connection) {
private GLib.Variant? _get_title(GLib.DBusConnection connection) {
return new GLib.Variant.string(this.title);
}
private GLib.Variant _get_icon_theme_path(GLib.DBusConnection connection) {
private GLib.Variant? _get_icon_theme_path(GLib.DBusConnection connection) {
return new GLib.Variant.string(this.icon_theme_path);
}
@ -265,17 +265,17 @@ class Indicator : IBus.Service
return null;
}
private GLib.Variant _get_xayatana_label(GLib.DBusConnection connection) {
private GLib.Variant? _get_xayatana_label(GLib.DBusConnection connection) {
return new GLib.Variant.string(this.label_s);
}
private GLib.Variant _get_xayatana_label_guide(GLib.DBusConnection
connection) {
private GLib.Variant? _get_xayatana_label_guide(GLib.DBusConnection
connection) {
return new GLib.Variant.string(this.label_guide_s);
}
private GLib.Variant _get_xayatana_ordering_index(GLib.DBusConnection
connection) {
private GLib.Variant? _get_xayatana_ordering_index(GLib.DBusConnection
connection) {
return new GLib.Variant.uint32(this.ordering_index);
}
@ -304,12 +304,12 @@ class Indicator : IBus.Service
method_name);
}
public override GLib.Variant service_get_property(GLib.DBusConnection
connection,
string sender,
string object_path,
string interface_name,
string property_name) {
public override GLib.Variant? service_get_property(GLib.DBusConnection
connection,
string sender,
string object_path,
string interface_name,
string property_name) {
GLib.return_val_if_fail (object_path == this.object_path, null);
GLib.return_val_if_fail (
interface_name == NOTIFICATION_ITEM_DBUS_IFACE,