After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 644751 - gio-2.0 and codegen: Support for manual dbus object registration
gio-2.0 and codegen: Support for manual dbus object registration
Status: RESOLVED OBSOLETE
Product: vala
Classification: Core
Component: D-Bus
0.11.x
Other Linux
: Normal enhancement
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on: 643489 644779
Blocks:
 
 
Reported: 2011-03-14 18:57 UTC by Marco Trevisan (Treviño)
Modified: 2018-05-22 13:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gio-2.0 and codegen: Support for manual dbus object registration (3.29 KB, patch)
2011-03-14 18:57 UTC, Marco Trevisan (Treviño)
none Details | Review

Description Marco Trevisan (Treviño) 2011-03-14 18:57:19 UTC
Created attachment 183372 [details] [review]
gio-2.0 and codegen: Support for manual dbus object registration

Added the new GIO function DBusConnection.register_object_vtable
it allows to register a dbus object using the manual GDBus registration
via interface info and interface vtable.

An implementation example follows:

const string introspection_xml =
"""<node>
  <interface name='org.example.ManualObject'>
    <method name='Hello'>"
      <arg type='s' name='greeting' direction='in'/>
      <arg type='s' name='response' direction='out'/>
    </method>"
  </interface>
</node>""";

const GLib.DBusInterfaceVTable ivtable = { method_call, null, null };
public void method_call(GLib.DBusConnection connection, string sender, string object_path, string interface_name, string method_name, GLib.Variant parameters, GLib.DBusMethodInvocation invocation) {
	var s = @"Method $interface_name.$method_name called on $object_path with parameters:\n$(parameters.print(true))";
	print(s+"\n");

	invocation.return_value(new Variant("(s)", s));
}

void on_bus_aquired (DBusConnection conn) {
	try {
		var iface_node = new DBusNodeInfo.for_xml(introspection_xml);
		var iface_info = iface_node.lookup_interface("org.example.ManualObject");
		conn.register_object_vtable ("/org/example/demo/manual_object", iface_info, ivtable);
	} catch (Error e) {
		stderr.printf (@"Could not register service $(e.message)\n");
	}
}

void main () {
	Bus.own_name (BusType.SESSION, "org.example.Demo", BusNameOwnerFlags.NONE,
	                on_bus_aquired,
	                () => {},
	                () => stderr.printf ("Could not aquire name\n"));

	new MainLoop ().run ();
}
Comment 1 GNOME Infrastructure Team 2018-05-22 13:58:13 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/vala/issues/180.