Fix #8107 - use lsp hover to provide context bar at top (next step help provider)
[roobuilder] / src / Resources.vala
index 5904a60..6dceca7 100644 (file)
@@ -90,11 +90,11 @@ public class Resources : Object
        public void initFiles()
        {       
                string[] avail_files = { 
-                       "roodata.json",
-                       "flutter_tree.json",
-                       "*",
-                       "Editors/*.js",
-                       "vapi/*"
+                       "roodata.json", /// << this is the only one we get now..
+//                     "flutter_tree.json",
+//                     "*",
+       //              "Editors/*.js",
+//                     "vapi/*"
                        
                };
                this.fetch_files = new Gee.ArrayList<ResourcesItem>();
@@ -108,7 +108,7 @@ public class Resources : Object
                        if (target == "flutter_tree.json") {
                                src = "https://raw.githubusercontent.com/roojs/flutter-docs-json/master/tree.json";
                        }
-                       
+                       /*
                        if (target.contains("*")) {
                                var split = target.split("*");
                                
@@ -119,7 +119,7 @@ public class Resources : Object
                                }
                                
                        }
-                       
+                       */
                        this.fetch_files.add(new ResourcesItem(src,target, ""));
                }
        
@@ -164,18 +164,18 @@ public class Resources : Object
                
                // this has to check the required files, not the list...
                string[] required =  {
-                       "bootstrap.builder.html",
+                       /*"bootstrap.builder.html",
                        "bootstrap4.builder.html",
                         
                        "mailer.builder.html",
                        "roo.builder.html",
                        "roo.builder.js",
-                       
+                       */
                        
                        "roodata.json",
                        
                        //"RooUsage.txt" ?? not needed it's doen from roodata.
-                       "Gir.overides" //?? needed anymnore?
+               //      "Gir.overides" //?? needed anymnore?
                        
                };
 
@@ -262,12 +262,22 @@ public class Resources : Object
                var session = new Soup.Session ();
                session.user_agent = "App Builder ";
            var message = new Soup.Message ("GET",  item.src );
-        session.queue_message (message, (sess, mess) => {
+        session.send_and_read_async.begin( message, 0,  null, (obj, res) => {
+               GLib.Bytes bytes;
+                try {
+                               bytes = session.send_and_read_async.end(res);
+                         } catch (GLib.Error e) {
+                               GLib.debug("Failed to fetch stream %s" , e.message);
+                               this.fetchNext();
+                               return;
+                       }
+                               
                        
+               
                        if (item.target.contains("*")) {
                                // then it's a directory listing in JSON, and we need to add any new items to our list..
                                // it's used to fetch Editors (and maybe other stuff..)
-                               this.parseDirectory((string) message.response_body.data,item.target );
+                               this.parseDirectory( (string) bytes.get_data(),item.target );
                                this.fetchNext();
                                return;
                        }
@@ -287,15 +297,14 @@ public class Resources : Object
                        }
                        
                        
-                       
-                       
                        // set data??? - if it's binary?
                        try {
-                        FileUtils.set_contents(  tfn, (string) message.response_body.data );
+                        FileUtils.set_contents(  tfn,  (string) bytes.get_data());
             } catch(GLib.Error e) {
                                        GLib.error("Problem writing data %s", e.message);
                                }
             switch (item.target) {
+            /*
                                case "Gir.overides":
                                        // clear all the project caches....
                                        foreach(var p in Project.Project.allProjectsByName()) { 
@@ -305,7 +314,7 @@ public class Resources : Object
                                        }
 
                                        break;
-                                
+                               */ 
                                        
                                case "roodata.json":
                                        Palete.Roo.classes_cache = null; // clear the cache.