Builder4/ValaProjectSettings.bjs
authorAlan Knowles <alan@roojs.com>
Wed, 19 Nov 2014 11:26:05 +0000 (19:26 +0800)
committerAlan Knowles <alan@roojs.com>
Wed, 19 Nov 2014 11:26:05 +0000 (19:26 +0800)
Builder4/ValaProjectSettings.vala

Builder4/ValaProjectSettings.bjs
Builder4/ValaProjectSettings.vala

index 5b1e8f5..6f499a3 100644 (file)
                                     "xtype" : "ScrolledWindow",
                                     "$ xns" : "Gtk",
                                     "items" : [
+                                        {
+                                            "id" : "default_directory_menu",
+                                            "xtype" : "Menu",
+                                            "* pack" : "add",
+                                            "$ xns" : "Gtk",
+                                            "items" : [
+                                                {
+                                                    "listeners" : {
+                                                        "activate" : "()  => {\n    \n    var  chooser = new Gtk.FileChooserDialog (\n\t\"Add a directory\", _this.window.el, Gtk.FileChooserAction.SELECT_FOLDER ,\n\t\"_Cancel\",\n\tGtk.ResponseType.CANCEL,\n\t\"_Add\",\n\tGtk.ResponseType.ACCEPT);\n    if (chooser.run () != Gtk.ResponseType.ACCEPT) {\n        chooser.close ();\n           return;\n       }\n       chooser.close ();\n       // add the directory..\n       var fn = _this.project.relPath(chooser.get_filename());\n       _this.project.compilegroups.get(\"_default_\").sources.add(fn);\n       _this.default_directory_tree_store.load();\n}"
+                                                    },
+                                                    "* pack" : "add",
+                                                    "xtype" : "MenuItem",
+                                                    "$ xns" : "Gtk",
+                                                    "utf8 label" : "Add Directory"
+                                                },
+                                                {
+                                                    "listeners" : {
+                                                        "activate" : "()  => {\n    \n    var  chooser = new Gtk.FileChooserDialog (\n\t\"Add a directory\", _this.window.el, Gtk.FileChooserAction.OPEN ,\n\t\"_Cancel\",\n\tGtk.ResponseType.CANCEL,\n\t\"_Add\",\n\tGtk.ResponseType.ACCEPT);\n    if (chooser.run () != Gtk.ResponseType.ACCEPT) {\n        chooser.close ();\n           return;\n       }\n       chooser.close ();\n       // add the directory..\n       var fn = _this.project.relPath(chooser.get_filename());\n       _this.project.compilegroups.get(\"_default_\").sources.add(fn);\n       _this.default_directory_tree_store.load();\n}"
+                                                    },
+                                                    "* pack" : "add",
+                                                    "xtype" : "MenuItem",
+                                                    "$ xns" : "Gtk",
+                                                    "utf8 label" : "Add File"
+                                                },
+                                                {
+                                                    "* pack" : "add",
+                                                    "xtype" : "SeparatorMenuItem",
+                                                    "$ xns" : "Gtk"
+                                                },
+                                                {
+                                                    "listeners" : {
+                                                        "activate" : "()  => {\n    \n     //\n        Gtk.TreeModel mod;\n        Gtk.TreeIter iter;\n        if (!_this.default_directory_tree.el.get_selection().get_selected(out mod, out iter)) {\n               print(\"nothing selected\\n\");\n            return;\n        }\n\n            \n       // add the directory..\n       \n       \n       GLib.Value val;\n        mod.get_value(iter,0, out val);\n       var fn =  (string) val;\n       \n       print(\"remove: %s\\n\", fn);\n       if (!_this.project.compilegroups.get(\"_default_\").sources.remove(fn)) {\n                  print(\"remove failed\");\n              }\n       _this.default_directory_tree_store.load();\n}"
+                                                    },
+                                                    "* pack" : "add",
+                                                    "xtype" : "MenuItem",
+                                                    "$ xns" : "Gtk",
+                                                    "utf8 label" : "Remove File/Directory"
+                                                }
+                                            ]
+                                        },
                                         {
                                             "id" : "targets_tree",
                                             "xtype" : "TreeView",
index 6211891..0b44eba 100644 (file)
@@ -22,6 +22,7 @@ public class ValaProjectSettings : Object
     public Xcls_default_directory_tree_store default_directory_tree_store;
     public Xcls_directory_render directory_render;
     public Xcls_default_directory_menu default_directory_menu;
+    public Xcls_default_directory_menu default_directory_menu;
     public Xcls_targets_tree targets_tree;
     public Xcls_targets_tree_store targets_tree_store;
     public Xcls_targets_render targets_render;
@@ -900,9 +901,12 @@ public class ValaProjectSettings : Object
             // my vars (dec)
 
             // set gobject values
-            var child_0 = new Xcls_targets_tree( _this );
+            var child_0 = new Xcls_default_directory_menu( _this );
             child_0.ref();
             this.el.add (  child_0.el  );
+            var child_1 = new Xcls_targets_tree( _this );
+            child_1.ref();
+            this.el.add (  child_1.el  );
 
             // init method 
 
@@ -913,6 +917,193 @@ public class ValaProjectSettings : Object
 
         // user defined functions 
     }
+    public class Xcls_default_directory_menu : Object 
+    {
+        public Gtk.Menu el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_default_directory_menu(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            _this.default_directory_menu = this;
+            this.el = new Gtk.Menu();
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_MenuItem30( _this );
+            child_0.ref();
+            this.el.add (  child_0.el  );
+            var child_1 = new Xcls_MenuItem31( _this );
+            child_1.ref();
+            this.el.add (  child_1.el  );
+            var child_2 = new Xcls_SeparatorMenuItem32( _this );
+            child_2.ref();
+            this.el.add (  child_2.el  );
+            var child_3 = new Xcls_MenuItem33( _this );
+            child_3.ref();
+            this.el.add (  child_3.el  );
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_MenuItem30 : Object 
+    {
+        public Gtk.MenuItem el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_MenuItem30(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.MenuItem();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.label = "Add Directory";
+
+            // listeners 
+            this.el.activate.connect( ()  => {
+                
+                var  chooser = new Gtk.FileChooserDialog (
+               "Add a directory", _this.window.el, Gtk.FileChooserAction.SELECT_FOLDER ,
+               "_Cancel",
+               Gtk.ResponseType.CANCEL,
+               "_Add",
+               Gtk.ResponseType.ACCEPT);
+                if (chooser.run () != Gtk.ResponseType.ACCEPT) {
+                    chooser.close ();
+                       return;
+                   }
+                   chooser.close ();
+                   // add the directory..
+                   var fn = _this.project.relPath(chooser.get_filename());
+                   _this.project.compilegroups.get("_default_").sources.add(fn);
+                   _this.default_directory_tree_store.load();
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_MenuItem31 : Object 
+    {
+        public Gtk.MenuItem el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_MenuItem31(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.MenuItem();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.label = "Add File";
+
+            // listeners 
+            this.el.activate.connect( ()  => {
+                
+                var  chooser = new Gtk.FileChooserDialog (
+               "Add a directory", _this.window.el, Gtk.FileChooserAction.OPEN ,
+               "_Cancel",
+               Gtk.ResponseType.CANCEL,
+               "_Add",
+               Gtk.ResponseType.ACCEPT);
+                if (chooser.run () != Gtk.ResponseType.ACCEPT) {
+                    chooser.close ();
+                       return;
+                   }
+                   chooser.close ();
+                   // add the directory..
+                   var fn = _this.project.relPath(chooser.get_filename());
+                   _this.project.compilegroups.get("_default_").sources.add(fn);
+                   _this.default_directory_tree_store.load();
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_SeparatorMenuItem32 : Object 
+    {
+        public Gtk.SeparatorMenuItem el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_SeparatorMenuItem32(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.SeparatorMenuItem();
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_MenuItem33 : Object 
+    {
+        public Gtk.MenuItem el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_MenuItem33(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.MenuItem();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.label = "Remove File/Directory";
+
+            // listeners 
+            this.el.activate.connect( ()  => {
+                
+                 //
+                    Gtk.TreeModel mod;
+                    Gtk.TreeIter iter;
+                    if (!_this.default_directory_tree.el.get_selection().get_selected(out mod, out iter)) {
+                           print("nothing selected\n");
+                        return;
+                    }
+            
+                        
+                   // add the directory..
+                   
+                   
+                   GLib.Value val;
+                    mod.get_value(iter,0, out val);
+                   var fn =  (string) val;
+                   
+                   print("remove: %s\n", fn);
+                   if (!_this.project.compilegroups.get("_default_").sources.remove(fn)) {
+                              print("remove failed");
+                          }
+                   _this.default_directory_tree_store.load();
+            });
+        }
+
+        // user defined functions 
+    }
     public class Xcls_targets_tree : Object 
     {
         public Gtk.TreeView el;
@@ -934,7 +1125,7 @@ public class ValaProjectSettings : Object
             var child_0 = new Xcls_targets_tree_store( _this );
             child_0.ref();
             this.el.set_model (  child_0.el  );
-            var child_1 = new Xcls_TreeViewColumn31( _this );
+            var child_1 = new Xcls_TreeViewColumn36( _this );
             child_1.ref();
             this.el.append_column (  child_1.el  );
         }
@@ -987,7 +1178,7 @@ public class ValaProjectSettings : Object
             
         }
     }
-    public class Xcls_TreeViewColumn31 : Object 
+    public class Xcls_TreeViewColumn36 : Object 
     {
         public Gtk.TreeViewColumn el;
         private ValaProjectSettings  _this;
@@ -996,7 +1187,7 @@ public class ValaProjectSettings : Object
             // my vars (def)
 
         // ctor 
-        public Xcls_TreeViewColumn31(ValaProjectSettings _owner )
+        public Xcls_TreeViewColumn36(ValaProjectSettings _owner )
         {
             _this = _owner;
             this.el = new Gtk.TreeViewColumn();
@@ -1057,29 +1248,29 @@ public class ValaProjectSettings : Object
             // my vars (dec)
 
             // set gobject values
-            var child_0 = new Xcls_Label34( _this );
+            var child_0 = new Xcls_Label39( _this );
             child_0.ref();
             this.el.pack_start (  child_0.el , false,false,0 );
             var child_1 = new Xcls_build_pack_target( _this );
             child_1.ref();
             this.el.pack_start (  child_1.el , false,false,0 );
-            var child_2 = new Xcls_Label36( _this );
+            var child_2 = new Xcls_Label41( _this );
             child_2.ref();
             this.el.pack_start (  child_2.el , false,false,0 );
             var child_3 = new Xcls_build_compile_flags( _this );
             child_3.ref();
             this.el.pack_start (  child_3.el , false,false,0 );
-            var child_4 = new Xcls_Label38( _this );
+            var child_4 = new Xcls_Label43( _this );
             child_4.ref();
             this.el.pack_start (  child_4.el , false,false,0 );
-            var child_5 = new Xcls_ScrolledWindow39( _this );
+            var child_5 = new Xcls_ScrolledWindow44( _this );
             child_5.ref();
             this.el.pack_start (  child_5.el , true,true,0 );
         }
 
         // user defined functions 
     }
-    public class Xcls_Label34 : Object 
+    public class Xcls_Label39 : Object 
     {
         public Gtk.Label el;
         private ValaProjectSettings  _this;
@@ -1088,7 +1279,7 @@ public class ValaProjectSettings : Object
             // my vars (def)
 
         // ctor 
-        public Xcls_Label34(ValaProjectSettings _owner )
+        public Xcls_Label39(ValaProjectSettings _owner )
         {
             _this = _owner;
             this.el = new Gtk.Label( "target filename" );
@@ -1121,7 +1312,7 @@ public class ValaProjectSettings : Object
 
         // user defined functions 
     }
-    public class Xcls_Label36 : Object 
+    public class Xcls_Label41 : Object 
     {
         public Gtk.Label el;
         private ValaProjectSettings  _this;
@@ -1130,7 +1321,7 @@ public class ValaProjectSettings : Object
             // my vars (def)
 
         // ctor 
-        public Xcls_Label36(ValaProjectSettings _owner )
+        public Xcls_Label41(ValaProjectSettings _owner )
         {
             _this = _owner;
             this.el = new Gtk.Label( "compile flags" );
@@ -1163,7 +1354,7 @@ public class ValaProjectSettings : Object
 
         // user defined functions 
     }
-    public class Xcls_Label38 : Object 
+    public class Xcls_Label43 : Object 
     {
         public Gtk.Label el;
         private ValaProjectSettings  _this;
@@ -1172,7 +1363,7 @@ public class ValaProjectSettings : Object
             // my vars (def)
 
         // ctor 
-        public Xcls_Label38(ValaProjectSettings _owner )
+        public Xcls_Label43(ValaProjectSettings _owner )
         {
             _this = _owner;
             this.el = new Gtk.Label( "Files to compile" );
@@ -1184,7 +1375,7 @@ public class ValaProjectSettings : Object
 
         // user defined functions 
     }
-    public class Xcls_ScrolledWindow39 : Object 
+    public class Xcls_ScrolledWindow44 : Object 
     {
         public Gtk.ScrolledWindow el;
         private ValaProjectSettings  _this;
@@ -1193,7 +1384,7 @@ public class ValaProjectSettings : Object
             // my vars (def)
 
         // ctor 
-        public Xcls_ScrolledWindow39(ValaProjectSettings _owner )
+        public Xcls_ScrolledWindow44(ValaProjectSettings _owner )
         {
             _this = _owner;
             this.el = new Gtk.ScrolledWindow( null, null );
@@ -1224,17 +1415,17 @@ public class ValaProjectSettings : Object
             // my vars (dec)
 
             // set gobject values
-            var child_0 = new Xcls_ListStore41( _this );
+            var child_0 = new Xcls_ListStore46( _this );
             child_0.ref();
             this.el.set_model (  child_0.el  );
-            var child_1 = new Xcls_TreeViewColumn42( _this );
+            var child_1 = new Xcls_TreeViewColumn47( _this );
             child_1.ref();
             this.el.append_column (  child_1.el  );
         }
 
         // user defined functions 
     }
-    public class Xcls_ListStore41 : Object 
+    public class Xcls_ListStore46 : Object 
     {
         public Gtk.ListStore el;
         private ValaProjectSettings  _this;
@@ -1243,7 +1434,7 @@ public class ValaProjectSettings : Object
             // my vars (def)
 
         // ctor 
-        public Xcls_ListStore41(ValaProjectSettings _owner )
+        public Xcls_ListStore46(ValaProjectSettings _owner )
         {
             _this = _owner;
             this.el = new Gtk.ListStore( 2,     typeof(string),  // 0 key type
@@ -1257,7 +1448,7 @@ public class ValaProjectSettings : Object
 
         // user defined functions 
     }
-    public class Xcls_TreeViewColumn42 : Object 
+    public class Xcls_TreeViewColumn47 : Object 
     {
         public Gtk.TreeViewColumn el;
         private ValaProjectSettings  _this;
@@ -1266,7 +1457,7 @@ public class ValaProjectSettings : Object
             // my vars (def)
 
         // ctor 
-        public Xcls_TreeViewColumn42(ValaProjectSettings _owner )
+        public Xcls_TreeViewColumn47(ValaProjectSettings _owner )
         {
             _this = _owner;
             this.el = new Gtk.TreeViewColumn();