[vala/wip/dbusgen: 3/6] more work on properties



commit 11b281f593824cb504e8b7ba8e381a2aa35a1652
Author: Chris Daley <chebizarro gmail com>
Date:   Thu Nov 23 05:31:07 2017 -0800

    more work on properties

 dbusgen/valadbusgen.vala           |    4 ++--
 dbusgen/valadbusparser.vala        |   14 ++++++++++----
 dbusgen/valadbusvariantmodule.vala |   15 +++++++++------
 3 files changed, 21 insertions(+), 12 deletions(-)
---
diff --git a/dbusgen/valadbusgen.vala b/dbusgen/valadbusgen.vala
index cff40b4..1a18b68 100644
--- a/dbusgen/valadbusgen.vala
+++ b/dbusgen/valadbusgen.vala
@@ -160,7 +160,7 @@ public class Vala.DBUSGen {
                        return quit ();
                }                               
 
-               var interface_writer = new CodeWriter (CodeWriterType.DUMP);
+               var interface_writer = new CodeWriter (CodeWriterType.FAST);
                
                
                foreach (SourceFile source in context.get_source_files ()) {
@@ -196,7 +196,7 @@ public class Vala.DBUSGen {
                }
 
                if (sources == null) {
-                       stderr.printf ("No API file specified.\n");
+                       stderr.printf ("No source file specified.\n");
                        return 1;
                }
                
diff --git a/dbusgen/valadbusparser.vala b/dbusgen/valadbusparser.vala
index 9abefdb..5029d35 100644
--- a/dbusgen/valadbusparser.vala
+++ b/dbusgen/valadbusparser.vala
@@ -280,7 +280,7 @@ public class Vala.DBusParser : CodeVisitor {
                
                current_node = current_property = new Property (attribs["name"], type, get_access, 
set_access, get_current_src ());
                current_property.is_abstract = true;
-               //current_iface.add_property (current_property);
+               current_iface.add_property (current_property);
                
                next ();
 
@@ -323,13 +323,17 @@ public class Vala.DBusParser : CodeVisitor {
                }
                                
                var type = dbus_module.get_dbus_type (attribs["type"]);
-               
+               type.value_owned = false;
+
                current_node = current_param = new Parameter (attribs["name"], type, get_current_src ());
                
                current_method.add_parameter (current_param);
                
-               if (attribs["direction"] != null && attribs["direction"] == "out") {
-                       current_param.direction = ParameterDirection.OUT;
+               if (current_method is Method) {
+                       if (attribs["direction"] != null && attribs["direction"] == "out") {
+                               current_param.direction = ParameterDirection.OUT;
+                               type.value_owned = true;
+                       }
                }
                
                next ();
@@ -352,6 +356,8 @@ public class Vala.DBusParser : CodeVisitor {
 
                current_node = current_method = new Signal (name, new VoidType ());
                current_iface.add_signal ((Signal)current_node);
+               ((Signal)current_node).access = SymbolAccessibility.PUBLIC;
+
                next ();
                
                parse_method_body ();
diff --git a/dbusgen/valadbusvariantmodule.vala b/dbusgen/valadbusvariantmodule.vala
index f2349ca..a01803c 100644
--- a/dbusgen/valadbusvariantmodule.vala
+++ b/dbusgen/valadbusvariantmodule.vala
@@ -151,6 +151,7 @@ public class Vala.DBusVariantModule {
        
        private DataType get_variant_type (VariantType type) {
                
+               
                if (type.equal (VariantType.BOOLEAN)) {
                        return bool_type;
                } else if (type.equal (VariantType.BYTE)) {
@@ -170,20 +171,25 @@ public class Vala.DBusVariantModule {
                } else if (type.equal (VariantType.DOUBLE)) {
                        return double_type;
                } else if (type.equal (VariantType.STRING)) {
-                       return string_type;
+                       return string_type.copy ();
                } else if (type.equal (VariantType.OBJECT_PATH)) {
                        return string_type;
                } else if (type.equal (VariantType.SIGNATURE)) {
                        return string_type;
                } else if (type.equal (VariantType.VARIANT) || type.equal (VariantType.ANY) || type.equal 
(VariantType.BASIC) || type.equal (VariantType.MAYBE) || type.equal (VariantType.TUPLE)) {
                        return new ObjectType ((ObjectTypeSymbol) gvariant_type);
-               } else if (type.equal (VariantType.UNIT)) {
+               }
+               
+               return new ObjectType ((ObjectTypeSymbol) gvariant_type);
+
+               
+               if (type.equal (VariantType.UNIT)) {
                        return string_type;
                } else if (type.equal (VariantType.MAYBE)) {
                        return string_type;
                } else if (type.equal (VariantType.OBJECT_PATH_ARRAY) || type.equal (VariantType.ARRAY) || 
type.equal (VariantType.STRING_ARRAY) || type.equal (VariantType.BYTESTRING_ARRAY)) {
                        
-                       var element = get_variant_type (type.element ());
+                       var element = new ObjectType ((ObjectTypeSymbol) gvariant_type); //get_variant_type 
(type.element ());
                        return new ArrayType (element, 0, null);
                
                } else if (type.equal (VariantType.DICT_ENTRY)) {
@@ -198,10 +204,7 @@ public class Vala.DBusVariantModule {
                        return string_type;
                }
                
-               return new ObjectType ((ObjectTypeSymbol) gvariant_type);
                
        }
 
-
-       
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]