]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Add --disable-dbus-transformation command-line option to disable case
authorJürg Billeter <j@bitron.ch>
Thu, 13 Nov 2008 16:27:14 +0000 (16:27 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Thu, 13 Nov 2008 16:27:14 +0000 (16:27 +0000)
2008-11-13  Jürg Billeter  <j@bitron.ch>

* vala/valacodecontext.vala:
* gobject/valadbusclientmodule.vala:
* compiler/valacompiler.vala:

Add --disable-dbus-transformation command-line option to disable
case transformation of D-Bus member names in dynamic D-Bus client
support, this option will be removed again when Vala gains static
D-Bus client support

svn path=/trunk/; revision=2013

ChangeLog
compiler/valacompiler.vala
gobject/valadbusclientmodule.vala
vala/valacodecontext.vala

index 6cc272d55fc5b22b4b8584c19d53f3a2a4fb0fd5..885af2840fea616d53fd653d664fd29cf9ed827d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2008-11-13  Jürg Billeter  <j@bitron.ch>
+
+       * vala/valacodecontext.vala:
+       * gobject/valadbusclientmodule.vala:
+       * compiler/valacompiler.vala:
+
+       Add --disable-dbus-transformation command-line option to disable
+       case transformation of D-Bus member names in dynamic D-Bus client
+       support, this option will be removed again when Vala gains static
+       D-Bus client support
+
 2008-11-13  Jürg Billeter  <j@bitron.ch>
 
        * gobject/valadbusclientmodule.vala:
index 922f78b3d21a1881d95ad298314403e07452fa9f..2c8ecbb0af4da7c38167bfdd774715d11977d214 100644 (file)
@@ -45,6 +45,7 @@ class Vala.Compiler {
        static bool enable_checking;
        static bool disable_non_null;
        static bool non_null_experimental;
+       static bool disable_dbus_transformation;
        static string cc_command;
        [NoArrayLength]
        static string[] cc_options;
@@ -69,6 +70,7 @@ class Vala.Compiler {
                { "enable-checking", 0, 0, OptionArg.NONE, ref enable_checking, "Enable additional run-time checks", null },
                { "disable-non-null", 0, 0, OptionArg.NONE, ref disable_non_null, "Disable non-null types", null },
                { "enable-non-null-experimental", 0, 0, OptionArg.NONE, ref non_null_experimental, "Enable experimental enhancements for non-null types", null },
+               { "disable-dbus-transformation", 0, 0, OptionArg.NONE, ref disable_dbus_transformation, "Disable transformation of D-Bus member names", null },
                { "cc", 0, 0, OptionArg.STRING, ref cc_command, "Use COMMAND as C compiler command", "COMMAND" },
                { "Xcc", 'X', 0, OptionArg.STRING_ARRAY, ref cc_options, "Pass OPTION to the C compiler", "OPTION..." },
                { "save-temps", 0, 0, OptionArg.NONE, ref save_temps, "Keep temporary files", null },
@@ -150,6 +152,7 @@ class Vala.Compiler {
                context.checking = enable_checking;
                context.non_null = !disable_non_null || non_null_experimental;
                context.non_null_experimental = non_null_experimental;
+               context.dbus_transformation = !disable_dbus_transformation;
                Report.set_verbose_errors (!quiet_mode);
 
                context.ccode_only = ccode_only;
index 92273619dee214ea58c54cef77f901a001137dd8..068c7f2d9df5c6ab690d0ab072175f18456fa6f1 100644 (file)
@@ -35,6 +35,16 @@ public class Vala.DBusClientModule : GAsyncModule {
                base (codegen, next);
        }
 
+       string get_dynamic_dbus_name (string vala_name) {
+               // TODO switch default to no transformation as soon as we have static D-Bus client support
+               // keep transformation by default for static D-Bus client and server support
+               if (context.dbus_transformation) {
+                       return Symbol.lower_case_to_camel_case (vala_name);
+               } else {
+                       return vala_name;
+               }
+       }
+
        public override void generate_dynamic_method_wrapper (DynamicMethod method) {
                var dynamic_method = (DynamicMethod) method;
 
@@ -107,7 +117,7 @@ public class Vala.DBusClientModule : GAsyncModule {
                        arg_index++;
                }
 
-               ccall.add_argument (new CCodeConstant ("\"%s\"".printf (Symbol.lower_case_to_camel_case (method.name))));
+               ccall.add_argument (new CCodeConstant ("\"%s\"".printf (get_dynamic_dbus_name (method.name))));
 
                if (callback != null) {
                        var reply_method = (Method) callback.symbol_reference;
@@ -614,7 +624,7 @@ public class Vala.DBusClientModule : GAsyncModule {
                ccall.add_argument (get_iface);
 
                ccall.add_argument (new CCodeIdentifier ("G_TYPE_STRING"));
-               ccall.add_argument (new CCodeConstant ("\"%s\"".printf (Symbol.lower_case_to_camel_case (node.name))));
+               ccall.add_argument (new CCodeConstant ("\"%s\"".printf (get_dynamic_dbus_name (node.name))));
 
                ccall.add_argument (new CCodeIdentifier ("G_TYPE_INVALID"));
 
@@ -675,7 +685,7 @@ public class Vala.DBusClientModule : GAsyncModule {
                ccall.add_argument (get_iface);
 
                ccall.add_argument (new CCodeIdentifier ("G_TYPE_STRING"));
-               ccall.add_argument (new CCodeConstant ("\"%s\"".printf (Symbol.lower_case_to_camel_case (node.name))));
+               ccall.add_argument (new CCodeConstant ("\"%s\"".printf (get_dynamic_dbus_name (node.name))));
 
                ccall.add_argument (new CCodeIdentifier ("G_TYPE_VALUE"));
                ccall.add_argument (val_ptr);
@@ -751,7 +761,7 @@ public class Vala.DBusClientModule : GAsyncModule {
 
                var add_call = new CCodeFunctionCall (new CCodeIdentifier ("dbus_g_proxy_add_signal"));
                add_call.add_argument (new CCodeIdentifier ("obj"));
-               add_call.add_argument (new CCodeConstant ("\"%s\"".printf (Symbol.lower_case_to_camel_case (sig.name))));
+               add_call.add_argument (new CCodeConstant ("\"%s\"".printf (get_dynamic_dbus_name (sig.name))));
 
                bool first = true;
                foreach (FormalParameter param in m.get_parameters ()) {
index acfd460c6dd065b9d1b95b22e3a5400b5c0d92c8..67252c63157f7f7d8331ec461d853f7698d8d755 100644 (file)
@@ -60,6 +60,11 @@ public class Vala.CodeContext {
         */
        public bool non_null_experimental { get; set; }
 
+       /**
+        * Enable transformation of D-Bus member names in dynamic client support.
+        */
+       public bool dbus_transformation { get; set; }
+
        /**
         * Output C code, don't compile to object code.
         */