]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
D-Bus: Register error domains before calls in GDBus clients
authorJürg Billeter <j@bitron.ch>
Fri, 22 Oct 2010 10:46:24 +0000 (12:46 +0200)
committerJürg Billeter <j@bitron.ch>
Sat, 23 Oct 2010 16:11:47 +0000 (18:11 +0200)
Error domains need to be registered with GDBus to support error
type mapping.

codegen/valagdbusclientmodule.vala

index 65bebfcd8bbcea77327071dd801b7edca1b383b0..95eb641f2adff9716017b0c0a9d7d9138f774490 100644 (file)
@@ -433,6 +433,14 @@ public class Vala.GDBusClientModule : GDBusModule {
                        var timeout = new CCodeFunctionCall (new CCodeIdentifier ("g_dbus_proxy_get_default_timeout"));
                        timeout.add_argument (new CCodeIdentifier ("self"));
 
+                       // register errors
+                       foreach (var error_type in m.get_error_types ()) {
+                               var errtype = (ErrorType) error_type;
+                               if (errtype.error_domain != null) {
+                                       ccode.add_expression (new CCodeIdentifier (errtype.error_domain.get_upper_case_cname ()));
+                               }
+                       }
+
                        // build D-Bus message
 
                        ccode.add_declaration ("GDBusMessage", new CCodeVariableDeclarator ("*_message"));