Fix #8089 - phase 1 - code ast navigation
[roobuilder] / src / JsRender / NodeToGlade.vala
index 23ec814..bc86248 100644 (file)
@@ -75,7 +75,6 @@ public class JsRender.NodeToGlade : Object {
        
        public Xml.Node* mungeNode()
        {
-                
                var is_top = false;
                if (this.parent == null) {
                        is_top = true;
@@ -95,9 +94,19 @@ public class JsRender.NodeToGlade : Object {
                var gdata = Palete.Gir.factoryFqn(this.project, this.node.fqn());
                if (gdata == null || !gdata.inherits.contains("Gtk.Buildable")) {
                        switch(cls) {
-                               case "GtkColumnViewColumn": //exception to the rule..
+                       //exception to the rule.. (must be buildable to work with glade?
+                               
+                               case "GtkNotebookPage": 
+                                       if (this.node.childstore.get_n_items() < 1) {
+                                               return null;
+                                       }
+                                       break;
+                               
+                               case "GtkColumnViewColumn": 
                                        break;
+                               
                                default:
+                                       GLib.debug("Skip %s - is not buildable / no data", cls);
                                        return null;
                        }
                }
@@ -107,10 +116,11 @@ public class JsRender.NodeToGlade : Object {
                // what namespaces are supported
                switch(this.node.NS) {
                        case "Gtk":
-                       case "Webkit": //??
+                       case "WebKit": //??
                        case "Adw": // works if you call adw.init() in main!
                                break;
                        default:
+                               GLib.debug("Skip %s - NS is not available", cls);
                                return null;
                }
                
@@ -204,7 +214,19 @@ public class JsRender.NodeToGlade : Object {
                var items = this.node.readItems();
                for (var i = 0; i < items.size; i++ ) {
                        var cn = items.get(i);
-                       var child  = this.create_element("child");
+                       
+                       var childname = "child";
+                       var pname = "";
+                       if (cn.has("* prop")) { // && cn.get_prop("* prop").val == "child") {
+                               childname = "property";
+                               pname = cn.get_prop("* prop").val;
+                       }
+                       
+                       var child  = this.create_element(childname);
+                       if (pname != "") {
+                               child->set_prop("name", pname);
+                       }
+                       
                        if ((cls == "GtkWindow" || cls == "GtkApplicationWindow") && cn.fqn() == "Gtk.HeaderBar") {
                                child->set_prop("type", "label");
                        }