src/Palete/Gtk.vala
[app.Builder.js] / src / Palete / Gtk.vala
index 77da236..2bb7c2f 100644 (file)
@@ -34,6 +34,9 @@ namespace Palete {
                    var context = new Vala.CodeContext ();
                         
                    this.package_cache = this.loadPackages(Path.get_dirname (context.get_vapi_path("glib-2.0")));
+                   this.package_cache.add_all(
+                           this.loadPackages(Path.get_dirname (context.get_vapi_path("gee-1.0")))
+                   );
                                //this.load();
                    // various loader methods..
                      //this.map = [];
@@ -227,9 +230,15 @@ namespace Palete {
 
                        var ret = new  Gee.ArrayList<string>();
                        //this.package_cache = new Gee.ArrayList<string>();
-                        
+                       
+                       if (!GLib.FileUtils.test(dirname,  FileTest.IS_DIR)) {
+                               print("opps package directory %s does not exist", dirname);
+                               return ret;
+                       }
                         
                        var dir = File.new_for_path(dirname);
+                       
+                       
                        try {
                                var file_enum = dir.enumerate_children(
                                        GLib.FileAttribute.STANDARD_DISPLAY_NAME, 
@@ -371,6 +380,7 @@ namespace Palete {
                                var is_last = i == parts.length -1;
                                
                                
+                                
                                // look up all the properties of the type...
                                var cls = Gir.factoryFqn(curtype);
                                if (cls == null && curtype[0] != '*') {
@@ -388,6 +398,9 @@ namespace Palete {
                                        
                                        // only exact matches from here on...
                                        if (cur_instance) {
+                                               if (cls == null) {
+                                                       return ret;
+                                               }
                                                if (cls.props.has_key(parts[i])) {
                                                        var prop = cls.props.get(parts[i]);
                                                        if (prop.type.index_of(".",0) > -1) {
@@ -474,7 +487,9 @@ namespace Palete {
                                        return ret;
                                }
                                print("matching property");
-                               
+                               if (cls == null) {
+                                       return ret;
+                               }
                                
                                
                                var citer = cls.methods.map_iterator();