delete file
authorAlan <alan@roojs.com>
Fri, 7 Oct 2022 07:51:55 +0000 (15:51 +0800)
committerAlan <alan@roojs.com>
Fri, 7 Oct 2022 07:51:55 +0000 (15:51 +0800)
src/Builder4/PopoverFiles.bjs
src/Builder4/PopoverFiles.vala

index abca660..cebf6b2 100644 (file)
            "string label" : "Delete Project",
            "xtype" : "ToolButton"
           },
+          {
+           "$ xns" : "Gtk",
+           "* pack" : "add",
+           "listeners" : {
+            "clicked" : [
+             " () => {",
+             "    // create a new file in project..",
+             "    print(\"add file selected\\n\");",
+             "    ",
+             "    if (_this.selectedProject == null) {",
+             "    \treturn;",
+             "    }",
+             "    try {",
+             "    \tvar f = JsRender.JsRender.factory(_this.selectedProject.xtype,  _this.selectedProject, \"\");",
+             "     \t_this.win.windowstate.file_details.show( f, this.el, _this.new_window );",
+             "     } catch (JsRender.Error e) {}",
+             "",
+             "}"
+            ]
+           },
+           "string icon_name" : "document-new",
+           "string label" : "New File",
+           "xtype" : "ToolButton"
+          },
           {
            "$ xns" : "Gtk",
            "* pack" : "add",
index 3e53ba5..1d01fab 100644 (file)
@@ -398,7 +398,7 @@ public class Xcls_PopoverFiles : Object
             var child_0 = new Xcls_Box3( _this );
             child_0.ref();
             this.el.add (  child_0.el  );
-            var child_1 = new Xcls_Box9( _this );
+            var child_1 = new Xcls_Box10( _this );
             child_1.ref();
             this.el.add (  child_1.el  );
         }
@@ -459,6 +459,9 @@ public class Xcls_PopoverFiles : Object
             var child_3 = new Xcls_ToolButton8( _this );
             child_3.ref();
             this.el.add (  child_3.el  );
+            var child_4 = new Xcls_ToolButton9( _this );
+            child_4.ref();
+            this.el.add (  child_4.el  );
         }
 
         // user defined functions
@@ -634,9 +637,47 @@ public class Xcls_PopoverFiles : Object
         // user defined functions
     }
 
+    public class Xcls_ToolButton9 : Object
+    {
+        public Gtk.ToolButton el;
+        private Xcls_PopoverFiles  _this;
+
+
+            // my vars (def)
+
+        // ctor
+        public Xcls_ToolButton9(Xcls_PopoverFiles _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.ToolButton( null, "New File" );
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.icon_name = "document-new";
+
+            //listeners
+            this.el.clicked.connect( () => {
+                // create a new file in project..
+                print("add file selected\n");
+                
+                if (_this.selectedProject == null) {
+                       return;
+                }
+                try {
+                       var f = JsRender.JsRender.factory(_this.selectedProject.xtype,  _this.selectedProject, "");
+                       _this.win.windowstate.file_details.show( f, this.el, _this.new_window );
+                 } catch (JsRender.Error e) {}
+            
+            });
+        }
+
+        // user defined functions
+    }
 
 
-    public class Xcls_Box9 : Object
+
+    public class Xcls_Box10 : Object
     {
         public Gtk.Box el;
         private Xcls_PopoverFiles  _this;
@@ -645,7 +686,7 @@ public class Xcls_PopoverFiles : Object
             // my vars (def)
 
         // ctor
-        public Xcls_Box9(Xcls_PopoverFiles _owner )
+        public Xcls_Box10(Xcls_PopoverFiles _owner )
         {
             _this = _owner;
             this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
@@ -654,10 +695,10 @@ public class Xcls_PopoverFiles : Object
 
             // set gobject values
             this.el.homogeneous = false;
-            var child_0 = new Xcls_ScrolledWindow10( _this );
+            var child_0 = new Xcls_ScrolledWindow11( _this );
             child_0.ref();
             this.el.add (  child_0.el  );
-            var child_1 = new Xcls_Box15( _this );
+            var child_1 = new Xcls_Box16( _this );
             child_1.ref();
             this.el.add(  child_1.el );
             var child_2 = new Xcls_file_container( _this );
@@ -667,7 +708,7 @@ public class Xcls_PopoverFiles : Object
 
         // user defined functions
     }
-    public class Xcls_ScrolledWindow10 : Object
+    public class Xcls_ScrolledWindow11 : Object
     {
         public Gtk.ScrolledWindow el;
         private Xcls_PopoverFiles  _this;
@@ -676,7 +717,7 @@ public class Xcls_PopoverFiles : Object
             // my vars (def)
 
         // ctor
-        public Xcls_ScrolledWindow10(Xcls_PopoverFiles _owner )
+        public Xcls_ScrolledWindow11(Xcls_PopoverFiles _owner )
         {
             _this = _owner;
             this.el = new Gtk.ScrolledWindow( null, null );
@@ -723,7 +764,7 @@ public class Xcls_PopoverFiles : Object
             var child_0 = new Xcls_model( _this );
             child_0.ref();
             this.el.set_model (  child_0.el  );
-            var child_1 = new Xcls_TreeViewColumn13( _this );
+            var child_1 = new Xcls_TreeViewColumn14( _this );
             child_1.ref();
             this.el.append_column (  child_1.el  );
 
@@ -807,7 +848,7 @@ public class Xcls_PopoverFiles : Object
         // user defined functions
     }
 
-    public class Xcls_TreeViewColumn13 : Object
+    public class Xcls_TreeViewColumn14 : Object
     {
         public Gtk.TreeViewColumn el;
         private Xcls_PopoverFiles  _this;
@@ -816,7 +857,7 @@ public class Xcls_PopoverFiles : Object
             // my vars (def)
 
         // ctor
-        public Xcls_TreeViewColumn13(Xcls_PopoverFiles _owner )
+        public Xcls_TreeViewColumn14(Xcls_PopoverFiles _owner )
         {
             _this = _owner;
             this.el = new Gtk.TreeViewColumn();
@@ -862,7 +903,7 @@ public class Xcls_PopoverFiles : Object
 
 
 
-    public class Xcls_Box15 : Object
+    public class Xcls_Box16 : Object
     {
         public Gtk.Box el;
         private Xcls_PopoverFiles  _this;
@@ -871,7 +912,7 @@ public class Xcls_PopoverFiles : Object
             // my vars (def)
 
         // ctor
-        public Xcls_Box15(Xcls_PopoverFiles _owner )
+        public Xcls_Box16(Xcls_PopoverFiles _owner )
         {
             _this = _owner;
             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
@@ -881,7 +922,7 @@ public class Xcls_PopoverFiles : Object
             // set gobject values
             this.el.width_request = 600;
             this.el.expand = true;
-            var child_0 = new Xcls_Box16( _this );
+            var child_0 = new Xcls_Box17( _this );
             child_0.ref();
             this.el.add(  child_0.el );
             var child_1 = new Xcls_iconscroll( _this );
@@ -891,7 +932,7 @@ public class Xcls_PopoverFiles : Object
 
         // user defined functions
     }
-    public class Xcls_Box16 : Object
+    public class Xcls_Box17 : Object
     {
         public Gtk.Box el;
         private Xcls_PopoverFiles  _this;
@@ -900,7 +941,7 @@ public class Xcls_PopoverFiles : Object
             // my vars (def)
 
         // ctor
-        public Xcls_Box16(Xcls_PopoverFiles _owner )
+        public Xcls_Box17(Xcls_PopoverFiles _owner )
         {
             _this = _owner;
             this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
@@ -1163,7 +1204,7 @@ public class Xcls_PopoverFiles : Object
             var child_0 = new Xcls_filemodel( _this );
             child_0.ref();
             this.el.set_model (  child_0.el  );
-            var child_1 = new Xcls_TreeViewColumn24( _this );
+            var child_1 = new Xcls_TreeViewColumn25( _this );
             child_1.ref();
             this.el.append_column (  child_1.el  );
 
@@ -1271,7 +1312,7 @@ public class Xcls_PopoverFiles : Object
         // user defined functions
     }
 
-    public class Xcls_TreeViewColumn24 : Object
+    public class Xcls_TreeViewColumn25 : Object
     {
         public Gtk.TreeViewColumn el;
         private Xcls_PopoverFiles  _this;
@@ -1280,7 +1321,7 @@ public class Xcls_PopoverFiles : Object
             // my vars (def)
 
         // ctor
-        public Xcls_TreeViewColumn24(Xcls_PopoverFiles _owner )
+        public Xcls_TreeViewColumn25(Xcls_PopoverFiles _owner )
         {
             _this = _owner;
             this.el = new Gtk.TreeViewColumn();