change document_save and document_change_real to async
[roobuilder] / src / Resources.vala
index 5904a60..a2d4ad4 100644 (file)
@@ -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,11 +297,9 @@ 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);
                                }