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 534806 - Support interfaces for D-Bus services
Support interfaces for D-Bus services
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Code Generator
0.3.x
Other All
: Normal normal
: ---
Assigned To: Philip Van Hoof
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2008-05-25 19:34 UTC by Jürg Billeter
Modified: 2008-05-25 21:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Experimental implementation (21.00 KB, patch)
2008-05-25 19:45 UTC, Philip Van Hoof
none Details | Review
Test being used to test this feature (1.53 KB, text/plain)
2008-05-25 19:52 UTC, Philip Van Hoof
  Details
Improvement (21.23 KB, patch)
2008-05-25 20:23 UTC, Philip Van Hoof
none Details | Review
Improvement (21.23 KB, patch)
2008-05-25 20:25 UTC, Philip Van Hoof
none Details | Review
Generated code (7.91 KB, text/plain)
2008-05-25 20:26 UTC, Philip Van Hoof
  Details
Improvement (21.17 KB, patch)
2008-05-25 20:32 UTC, Philip Van Hoof
none Details | Review
Improvement, fixed overwriting the codegen.class_init_fragment (21.17 KB, patch)
2008-05-25 20:37 UTC, Philip Van Hoof
none Details | Review
Nitpicking by Jürg :) (21.18 KB, patch)
2008-05-25 20:42 UTC, Philip Van Hoof
none Details | Review

Description Jürg Billeter 2008-05-25 19:34:19 UTC
It should be possible to use Vala interfaces instead of classes to define D-Bus services. Usage should be exactly the same.
Comment 1 Philip Van Hoof 2008-05-25 19:45:45 UTC
Created attachment 111521 [details] [review]
Experimental implementation

This is not yet tested, for preview purposes. Please let me know if this is heading in the right direction, Jürg.
Comment 2 Philip Van Hoof 2008-05-25 19:52:31 UTC
Created attachment 111523 [details]
Test being used to test this feature

pvanhoof@nerts:~/repos/gnome/vala/trunk/tests$ /opt/vala-trunk/bin/valac test-dbus-interfaces.vala --pkg=dbus-glib-1

** (valac:22206): CRITICAL **: vala_ccode_fragment_append: assertion `VALA_IS_CCODE_FRAGMENT (self)' failed

** (valac:22206): CRITICAL **: vala_ccode_fragment_append: assertion `VALA_IS_CCODE_FRAGMENT (self)' failed

** (valac:22206): CRITICAL **: vala_ccode_fragment_append: assertion `VALA_IS_CCODE_FRAGMENT (self)' failed
pvanhoof@nerts:~/repos/gnome/vala/trunk/tests$
Comment 3 Philip Van Hoof 2008-05-25 20:01:22 UTC
pvanhoof@nerts:~/repos/gnome/vala/trunk/tests$ gdb /opt/vala-trunk/bin/valac test-dbus-interfaces.vala --pkg=dbus-glib-1
pvanhoof@nerts:~/repos/gnome/vala/trunk/tests$ gdb /opt/vala-trunk/bin/valac 
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...
(gdb) set args test-dbus-interfaces.vala --pkg=dbus-glib-1
(gdb) break g_log
Function "g_log" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (g_log) pending.
(gdb) run
Starting program: /opt/vala-trunk/bin/valac test-dbus-interfaces.vala --pkg=dbus-glib-1

Breakpoint 1, 0xb7f21e66 in g_log () from /usr/lib/libglib-2.0.so.0
(gdb) bt
  • #0 g_log
    from /usr/lib/libglib-2.0.so.0
  • #1 g_return_if_fail_warning
    from /usr/lib/libglib-2.0.so.0
  • #2 vala_ccode_fragment_append
    at valaccodefragment.vala line 37
  • #3 vala_ccode_object_typesymbol_binding_register_dbus_info
    at valaccodeobjecttypesymbolbinding.vala line 194
  • #4 vala_ccode_interface_binding_real_emit
    at valaccodeinterfacebinding.vala line 144
  • #5 vala_ccode_binding_emit
    at valaccodebinding.vala line 37
  • #6 vala_ccode_generator_real_visit_interface
    at valaccodegenerator.vala line 280
  • #7 vala_code_visitor_visit_interface
    at valacodevisitor.vala line 67
  • #8 vala_interface_real_accept
    at valainterface.vala line 318
  • #9 vala_code_node_accept
    at valacodenode.vala line 113
  • #10 vala_source_file_accept_children
    at valasourcefile.vala line 155
  • #11 vala_ccode_generator_real_visit_source_file
    at valaccodegeneratorsourcefile.vala line 264
  • #12 vala_code_visitor_visit_source_file
    at valacodevisitor.vala line 35
  • #13 vala_source_file_accept
    at valasourcefile.vala line 146
  • #14 vala_ccode_generator_real_emit
    at valaccodegenerator.vala line 270
  • #15 vala_code_generator_emit
    at valacodegenerator.vala line 34
  • #16 vala_compiler_main
    at valacompiler.vala line 275
  • #17 main
    at valacompiler.vala line 393

Comment 4 Philip Van Hoof 2008-05-25 20:23:55 UTC
Created attachment 111525 [details] [review]
Improvement

This removes the warning
Comment 5 Philip Van Hoof 2008-05-25 20:25:15 UTC
Created attachment 111526 [details] [review]
Improvement

This removes the warning
Comment 6 Philip Van Hoof 2008-05-25 20:26:43 UTC
Created attachment 111527 [details]
Generated code

Generated code added for review
Comment 7 Philip Van Hoof 2008-05-25 20:27:13 UTC
Comment on attachment 111526 [details] [review]
Improvement

Obsolete
Comment 8 Philip Van Hoof 2008-05-25 20:32:47 UTC
Created attachment 111528 [details] [review]
Improvement

No more tricks with class_init_fragment
Comment 9 Philip Van Hoof 2008-05-25 20:37:45 UTC
Created attachment 111529 [details] [review]
Improvement, fixed overwriting the codegen.class_init_fragment

Fixes a bug
Comment 10 Philip Van Hoof 2008-05-25 20:42:12 UTC
Created attachment 111530 [details] [review]
Nitpicking by Jürg :)

Fixes ordering on filename in the Makefile.ams and a copyright year issue
Comment 11 Philip Van Hoof 2008-05-25 20:46:41 UTC
Term-1
pvanhoof@nerts:~/repos/gnome/vala/trunk/tests$ ./test-dbus-interfaces 
** Message: Hello from Vala
** Message: Hello from Vala
** Message: Hello from Vala
** Message: Hello from Vala
** Message: Hello from Vala


Term-2
pvanhoof@nerts:~/repos/gnome/vala/trunk/tests$ ./test-dbus-interfaces 
** Message: 0
pvanhoof@nerts:~/repos/gnome/vala/trunk/tests$ ./test-dbus-interfaces 
** Message: 1
pvanhoof@nerts:~/repos/gnome/vala/trunk/tests$ ./test-dbus-interfaces 
** Message: 2
pvanhoof@nerts:~/repos/gnome/vala/trunk/tests$ ./test-dbus-interfaces 
** Message: 3
pvanhoof@nerts:~/repos/gnome/vala/trunk/tests$ ./test-dbus-interfaces 
** Message: 4
pvanhoof@nerts:~/repos/gnome/vala/trunk/tests$ 
Comment 12 Philip Van Hoof 2008-05-25 21:06:56 UTC
Committed as rev. 1440