sync
authorAlan Knowles <alan@akbkhome.com>
Mon, 13 Dec 2010 04:55:00 +0000 (12:55 +0800)
committerAlan Knowles <alan@akbkhome.com>
Mon, 13 Dec 2010 04:55:00 +0000 (12:55 +0800)
DependTree/BuildLists.js
DependTree/Window.bjs
DependTree/Window.js
XObjectBase/GtkListStore.js
gir-1.1

index 2c858dd..da200d5 100644 (file)
@@ -73,7 +73,7 @@ function BuildLists () {
     
     for (cls in classes) {
         var odata = classes[cls];
-        methods[cls] = {}
+        //methods[cls] = {}
            
         implementations[odata.alias] = odata.titleType == 'Class' ? odata.childClasses :  odata.implementedBy;  
         //print(JSON.stringify(odata.methods,null,4));
@@ -93,6 +93,10 @@ function BuildLists () {
                     allchildren.push(p.type);
                 }
                 
+                if (typeof(methods[cls]) == 'undefined') {
+                    methods[cls] = {}
+                }
+                
                 if (typeof(methods[cls][p.type]) == 'undefined') {
                     methods[cls][p.type] = [];
                 }
@@ -129,6 +133,12 @@ function BuildLists () {
 }
 
 
+
+
+
+
+
+
 // we now have a list of classes / methods that can be used..
 // we now need a ui to flag stuff as "don't bother with"
 
index cbb78b0..c5cb514 100644 (file)
@@ -7,10 +7,11 @@
     "items": [
         {
             "listeners": {
-                "show": "function (self) {\n    print(\"SHOW\");\n    var BuildLists = imports['BuildLists.js'].BuildLists;\n    this.data = new BuildLists();\n    print(JSON.stringify(this.data.allmethods, null,4));\n    \n    var ls = this.get('method-list-store');\n    this.data.allmethods.forEach(function(v) {\n        ls.append( [ v , false, true ]);\n    });\n    var ls = this.get('children-list-store');\n    this.data.allchildren.forEach(function(v) {\n        ls.append( [ v , false, true ]);\n    });\n    var ls = this.get('class-list-store');\n    var i =0;\n    for (var c in this.data.methods) {\n        i++;\n        ls.append( [ c , true ,   true]);\n    };\n    \n    \n    \n}"
+                "show": "function (self) {\n    print(\"SHOW\");\n    var BuildLists = imports['BuildLists.js'].BuildLists;\n    this.data = new BuildLists();\n    print(JSON.stringify(this.data.allmethods, null,4));\n    \n    var ls = this.get('method-list-store');\n    this.data.allmethods.forEach(function(v) {\n        ls.append( [ v , true, true ]);\n    });\n    \n    var ls = this.get('children-list-store');\n    this.data.allchildren.forEach(function(v) {\n        ls.append( [ v , true, true ]);\n    });\n    var ls = this.get('class-list-store');\n    var i =0;\n    for (var c in this.data.methods) {\n        i++;\n        ls.append( [ c , true ,   true]);\n    };\n    print(JSON.stringify(this.data.methods['Gtk.AccelGroup']));\n    \n    \n    \n}"
             },
             "default_height": 500,
             "default_width": 600,
+            "id": "window",
             "xtype": "Window",
             "|init": "function() {\n    XObject.prototype.init.call(this);\n    this.el.show_all();\n}\n",
             "|xns": "Gtk",
@@ -44,7 +45,7 @@
                                     "items": [
                                         {
                                             "listeners": {
-                                                "cursor_changed": "function (self) {\n    if (!this.selection) {\n        this.selection  = this.el.get_selection();\n    }\n    \n    var iter = new Gtk.TreeIter();\n    this.selection.get_selected(this.model.el, iter);\n    \n    var tp = this.model.el.get_path(iter).to_string();\n    print(tp);\n    // \n    var cls = this.model.getValue(tp, 0);\n    print(cls);\n    \n}"
+                                                "cursor_changed": "function (self) {\n\n    var sel  = this.el.get_selection();\n\n    \n    var iter = new Gtk.TreeIter();\n    sel.get_selected(this.model.el, iter);\n    \n    var tp = this.model.el.get_path(iter).to_string();\n    print(tp);\n    // \n    var cls = this.model.getValue(tp, 0);\n    print(cls);\n    var data = this.get('/window').data;\n    \n\n    // hide all the rows in the methods list.\n    var tp = false; \n    var cstore = this.get('/window.children-list-store');\n    var meths = [];\n    while (false !== (tp = cstore.nextPath(tp))) {\n        var mname = cstore.getValue(tp, 0);\n        var show = typeof(data.methods[cls][mname]) == 'undefined' ? false :true;\n        if (show) {\n            meths.push.apply(meths, data.methods[cls][mname]);\n        }\n        cstore.setValue(tp, 2, show); // hide..  \n\n        \n    }    \n    print(JSON.stringify(meths));\n\n    tp = false; \n    var mstore = this.get('/window.method-list-store');\n    while (false !== (tp = mstore.nextPath(tp))) {\n        var mname = mstore.getValue(tp, 0);\n        var show = meths.indexOf(mname) > -1  ? true :false;\n    \n        mstore.setValue(tp, 2, show); // hide..  \n    }\n    \n    \n    \n}"
                                             },
                                             "xtype": "TreeView",
                                             "|xns": "Gtk",
index 5d82e2a..984b8b5 100644 (file)
@@ -22,11 +22,12 @@ Window=new XObject({
             
             var ls = this.get('method-list-store');
             this.data.allmethods.forEach(function(v) {
-                ls.append( [ v , false, true ]);
+                ls.append( [ v , true, true ]);
             });
+            
             var ls = this.get('children-list-store');
             this.data.allchildren.forEach(function(v) {
-                ls.append( [ v , false, true ]);
+                ls.append( [ v , true, true ]);
             });
             var ls = this.get('class-list-store');
             var i =0;
@@ -34,6 +35,7 @@ Window=new XObject({
                 i++;
                 ls.append( [ c , true ,   true]);
             };
+            print(JSON.stringify(this.data.methods['Gtk.AccelGroup']));
             
             
             
@@ -41,6 +43,7 @@ Window=new XObject({
     },
     default_height : 500,
     default_width : 600,
+    id : "window",
     init : function() {
         XObject.prototype.init.call(this);
         this.el.show_all();
@@ -69,18 +72,47 @@ Window=new XObject({
                                     xtype: Gtk.TreeView,
                                     listeners : {
                                         cursor_changed : function (self) {
-                                            if (!this.selection) {
-                                                this.selection  = this.el.get_selection();
-                                            }
+                                        
+                                            var sel  = this.el.get_selection();
+                                        
                                             
                                             var iter = new Gtk.TreeIter();
-                                            this.selection.get_selected(this.model.el, iter);
+                                            sel.get_selected(this.model.el, iter);
                                             
                                             var tp = this.model.el.get_path(iter).to_string();
                                             print(tp);
                                             // 
                                             var cls = this.model.getValue(tp, 0);
                                             print(cls);
+                                            var data = this.get('/window').data;
+                                            
+                                        
+                                            // hide all the rows in the methods list.
+                                            var tp = false; 
+                                            var cstore = this.get('/window.children-list-store');
+                                            var meths = [];
+                                            while (false !== (tp = cstore.nextPath(tp))) {
+                                                var mname = cstore.getValue(tp, 0);
+                                                var show = typeof(data.methods[cls][mname]) == 'undefined' ? false :true;
+                                                if (show) {
+                                                    meths.push.apply(meths, data.methods[cls][mname]);
+                                                }
+                                                cstore.setValue(tp, 2, show); // hide..  
+                                        
+                                                
+                                            }    
+                                            print(JSON.stringify(meths));
+                                        
+                                            tp = false; 
+                                            var mstore = this.get('/window.method-list-store');
+                                            while (false !== (tp = mstore.nextPath(tp))) {
+                                                var mname = mstore.getValue(tp, 0);
+                                                var show = meths.indexOf(mname) > -1  ? true :false;
+                                            
+                                                mstore.setValue(tp, 2, show); // hide..  
+                                            }
+                                            
+                                            
                                             
                                         }
                                     },
index 382ba19..1b67522 100644 (file)
@@ -40,6 +40,27 @@ GtkListStore = XObject.define(
             }
             
         },
+        nextPath : function(path)
+        {
+            if (path === false) {
+                var iter = new Gtk.TreeIter();
+                this.el.get_iter_first(iter);
+                return this.el.get_path(iter);    
+            }
+            var tpath = path;
+            if (typeof(path) == 'string' ) {
+                tpath = new Gtk.TreePath.from_string(path);     
+            }
+            var iter = new Gtk.TreeIter();
+            
+            this.el.get_iter (iter, tpath) ;
+            
+            if (!this.el.iter_next(iter)) {
+                return false;
+            };
+            return this.el.get_path(iter);
+        },
+        
         getValue  : function ( path, col)
         {
             // not very type safe...
diff --git a/gir-1.1 b/gir-1.1
index 6167de4..1b4f89f 160000 (submodule)
--- a/gir-1.1
+++ b/gir-1.1
@@ -1 +1 @@
-Subproject commit 6167de400f7cc2594b574657de7b042a6a4a2ddb
+Subproject commit 1b4f89f56242f6fa0e090cb94d9bc79254e8fb03