src/Builder4/MainWindow.bjs
authorAlan Knowles <alan@roojs.com>
Fri, 15 May 2015 08:22:27 +0000 (16:22 +0800)
committerAlan Knowles <alan@roojs.com>
Fri, 15 May 2015 08:22:27 +0000 (16:22 +0800)
src/Builder4/MainWindow.vala

src/Builder4/MainWindow.bjs
src/Builder4/MainWindow.vala

index 2835922..8759657 100644 (file)
@@ -31,8 +31,8 @@
    "items" : [
     {
      "id" : "headerbar",
-     "xtype" : "HeaderBar",
      "* pack" : "set_titlebar",
+     "xtype" : "HeaderBar",
      "bool show_close_button" : true,
      "$ xns" : "Gtk",
      "string title" : "Application Builder",
@@ -44,8 +44,8 @@
        "items" : [
         {
          "bool use_popover" : false,
-         "xtype" : "MenuButton",
          "* pack" : "add",
+         "xtype" : "MenuButton",
          "$ xns" : "Gtk",
          "items" : [
           {
@@ -59,9 +59,9 @@
              "listeners" : {
               "activate" : "  ( ) => {\n        Xcls_MainWindow.singleton().no_windows++;\n        var w = new Xcls_MainWindow();\n        w.ref();\n\n        w.el.show_all();\n        w.initChildren();\n        w.windowstate.switchState(WindowState.State.FILES);\n}"
              },
+             "string label" : "Open a new Window",
              "* pack" : "append",
              "xtype" : "MenuItem",
-             "string label" : "Open a new Window",
              "$ xns" : "Gtk"
             },
             {
              "listeners" : {
               "activate" : " ( ) => {\n         Resources.singleton().fetchStart();\n}"
              },
+             "xtype" : "MenuItem",
              "string label" : "Download updated Resources",
              "* pack" : "append",
-             "xtype" : "MenuItem",
              "$ xns" : "Gtk"
             },
             {
              "listeners" : {
               "activate" : "() => {\n    About.singleton().el.show();\n    }"
              },
+             "* pack" : "append",
              "xtype" : "MenuItem",
              "string label" : "About the Builder",
-             "* pack" : "append",
              "$ xns" : "Gtk"
             }
            ]
           },
           {
+           "utf8 icon_name" : "help-about",
            "* pack" : "set_image",
            "xtype" : "Image",
-           "utf8 icon_name" : "help-about",
            "$ xns" : "Gtk"
           }
          ]
     },
     {
      "id" : "vbox",
-     "* pack" : "add",
      "xtype" : "VBox",
+     "* pack" : "add",
      "$ xns" : "Gtk",
      "$ homogeneous" : false,
      "items" : [
        "items" : [
         {
          "id" : "leftpane",
-         "xtype" : "VBox",
          "* pack" : "add1",
+         "xtype" : "VBox",
          "$ xns" : "Gtk",
          "items" : [
           {
            "id" : "editpane",
-           "xtype" : "VPaned",
            "* pack" : "pack_start,false,true,0",
+           "xtype" : "VPaned",
            "$ xns" : "Gtk",
            "items" : [
             {
              "id" : "tree",
-             "xtype" : "VBox",
              "* pack" : "add1",
+             "xtype" : "VBox",
              "$ xns" : "Gtk"
             },
             {
              "id" : "props",
-             "xtype" : "VBox",
              "* pack" : "add2",
+             "xtype" : "VBox",
              "$ xns" : "Gtk"
             }
            ]
                "items" : [
                 {
                  "* init" : "((Gtk.Container)(this.el.get_widget())).add ( child_0.el);",
-                 "xtype" : "Actor",
                  "* pack" : "add_child",
+                 "xtype" : "Actor",
                  "$ xns" : "GtkClutter",
                  "items" : [
                   {
                     "clicked" : "  ( ) => {\n  \n    _this.windowstate.switchState(WindowState.State.PREVIEW);\n    \n\n}"
                    },
                    "utf8 tooltip_text" : "Back",
-                   "* pack" : false,
                    "xtype" : "Button",
+                   "* pack" : false,
                    "width_request" : 50,
                    "$ xns" : "Gtk",
                    "height_request" : 50,
                    "items" : [
                     {
+                     "xtype" : "Image",
                      "utf8 icon_name" : "go-previous",
                      "* pack" : "set_image",
-                     "xtype" : "Image",
                      "$ xns" : "Gtk"
                     }
                    ]
                "items" : [
                 {
                  "* init" : "((Gtk.Container)(this.el.get_widget())).add ( child_0.el);",
-                 "* pack" : "add_child",
                  "xtype" : "Actor",
+                 "* pack" : "add_child",
                  "$ xns" : "GtkClutter",
                  "items" : [
                   {
                    "$ tooltop_text" : "\"Open File\"",
                    "items" : [
                     {
+                     "* pack" : "set_image",
                      "xtype" : "Image",
                      "utf8 icon_name" : "document-open",
-                     "* pack" : "set_image",
                      "$ xns" : "Gtk"
                     }
                    ]
                "items" : [
                 {
                  "* init" : "((Gtk.Container)(this.el.get_widget())).add ( child_0.el);",
-                 "* pack" : "add_child",
                  "xtype" : "Actor",
+                 "* pack" : "add_child",
                  "$ xns" : "GtkClutter",
                  "items" : [
                   {
                    "height_request" : 50,
                    "items" : [
                     {
+                     "utf8 icon_name" : "document-properties",
                      "* pack" : "set_image",
                      "xtype" : "Image",
-                     "utf8 icon_name" : "document-properties",
                      "$ xns" : "Gtk"
                     }
                    ]
                "items" : [
                 {
                  "* init" : "((Gtk.Container)(this.el.get_widget())).add ( child_0.el);",
-                 "* pack" : "add_child",
                  "xtype" : "Actor",
+                 "* pack" : "add_child",
                  "$ xns" : "GtkClutter",
                  "items" : [
                   {
                    "height_request" : 50,
                    "items" : [
                     {
+                     "xtype" : "Image",
                      "utf8 icon_name" : "emblem-system",
                      "* pack" : "set_image",
-                     "xtype" : "Image",
                      "$ xns" : "Gtk"
                     }
                    ]
                "items" : [
                 {
                  "* init" : "((Gtk.Container)(this.el.get_widget())).add ( child_0.el);",
-                 "* pack" : "add_child",
                  "xtype" : "Actor",
+                 "* pack" : "add_child",
                  "$ xns" : "GtkClutter",
                  "items" : [
                   {
                    "height_request" : 50,
                    "items" : [
                     {
+                     "* pack" : "set_image",
                      "xtype" : "Image",
                      "utf8 icon_name" : "list-add",
-                     "* pack" : "set_image",
                      "$ xns" : "Gtk"
                     }
                    ]
                "items" : [
                 {
                  "* init" : "((Gtk.Container)(this.el.get_widget())).add ( child_0.el);",
-                 "* pack" : "add_child",
                  "xtype" : "Actor",
+                 "* pack" : "add_child",
                  "$ xns" : "GtkClutter",
                  "items" : [
                   {
                    "height_request" : 50,
                    "items" : [
                     {
+                     "utf8 icon_name" : "format-justify-left",
                      "* pack" : "set_image",
                      "xtype" : "Image",
-                     "utf8 icon_name" : "format-justify-left",
                      "$ xns" : "Gtk"
                     }
                    ]
                "items" : [
                 {
                  "* init" : "((Gtk.Container)(this.el.get_widget())).add ( child_0.el);",
-                 "* pack" : "add_child",
                  "xtype" : "Actor",
+                 "* pack" : "add_child",
                  "$ xns" : "GtkClutter",
                  "items" : [
                   {
                    "height_request" : 50,
                    "items" : [
                     {
+                     "xtype" : "Image",
                      "utf8 icon_name" : "appointment-new",
                      "* pack" : "set_image",
-                     "xtype" : "Image",
                      "$ xns" : "Gtk"
                     }
                    ]
                "items" : [
                 {
                  "* init" : "((Gtk.Container)(this.el.get_widget())).add ( child_0.el);",
-                 "* pack" : "add_child",
                  "xtype" : "Actor",
+                 "* pack" : "add_child",
                  "$ xns" : "GtkClutter",
                  "items" : [
                   {
                    "height_request" : 50,
                    "items" : [
                     {
+                     "utf8 icon_name" : "folder-new",
                      "* pack" : "set_image",
                      "xtype" : "Image",
-                     "utf8 icon_name" : "folder-new",
                      "$ xns" : "Gtk"
                     }
                    ]
                "items" : [
                 {
                  "* init" : "((Gtk.Container)(this.el.get_widget())).add ( child_0.el);",
-                 "* pack" : "add_child",
                  "xtype" : "Actor",
+                 "* pack" : "add_child",
                  "$ xns" : "GtkClutter",
                  "items" : [
                   {
                    "height_request" : 50,
                    "items" : [
                     {
+                     "* pack" : "set_image",
                      "xtype" : "Image",
                      "utf8 icon_name" : "document-new",
-                     "* pack" : "set_image",
                      "$ xns" : "Gtk"
                     }
                    ]
                "items" : [
                 {
                  "* init" : "((Gtk.Container)(this.el.get_widget())).add ( child_0.el);",
-                 "* pack" : "add_child",
                  "xtype" : "Actor",
+                 "* pack" : "add_child",
                  "$ xns" : "GtkClutter",
                  "items" : [
                   {
                    "height_request" : 50,
                    "items" : [
                     {
+                     "utf8 icon_name" : "user-trash",
                      "* pack" : "set_image",
                      "xtype" : "Image",
-                     "utf8 icon_name" : "user-trash",
                      "$ xns" : "Gtk"
                     }
                    ]
        "items" : [
         {
          "bool show_text" : true,
-         "id" : "statusbar",
          "ulong handler_id" : "-1",
+         "id" : "statusbar",
          "* init" : "{\n     this.handler_id = Resources.singleton().updateProgress.connect((pos,total) => {\n        if (pos < 1) {\n            this.el.hide();\n            _this.mainpane.el.set_sensitive(true);\n            \n            return;\n        }\n         _this.mainpane.el.set_sensitive(false);\n         this.el.show();\n         this.el.set_fraction ((1.0f * pos) / (1.0f * total));\n         this.el.set_text(\"Fetching Resource : %s/%s\".printf(pos.to_string(), total.to_string()));\n       \n     });\n}\n",
          "xtype" : "ProgressBar",
          "* pack" : "pack_start,true,true,0",
          "$ xns" : "Gtk"
+        },
+        {
+         "listeners" : {
+          "clicked" : "  ( ) => {\n     \n     var cd = DialogConfirm.singleton();\n     cd.el.set_transient_for(_this.el);\n    cd.el.set_modal(true);\n\n     var project =   _this.windowstate.left_projects.getSelectedProject();\n    if (project == null) {\n        print(\"SKIP - no project\\n\");\n        return;\n    }\n    \n        \n     if (Gtk.ResponseType.YES != cd.show(\"Confirm\", \n        \"Are you sure you want to delete project %s\".printf(project.name))) {\n        return;\n    }\n     \n\n    // confirm?\n    Project.Project.remove(project);\n    _this.project = null;\n    \n    _this.windowstate.left_projects.is_loaded =  false;\n    _this.windowstate.left_projects.load();\n    _this.windowstate.clutterfiles.clearFiles();\n\n}"
+         },
+         "* pack" : false,
+         "xtype" : "Button",
+         "width_request" : 50,
+         "$ xns" : "Gtk",
+         "$ tooltip_text" : "\"Delete Project\"",
+         "height_request" : 50,
+         "items" : [
+          {
+           "xtype" : "Image",
+           "utf8 icon_name" : "user-trash",
+           "* pack" : "set_image",
+           "$ xns" : "Gtk"
+          }
+         ]
         }
        ]
       }
index a03e583..4f6b16f 100644 (file)
@@ -2144,6 +2144,8 @@ public class Xcls_MainWindow : Object
             var child_0 = new Xcls_statusbar( _this );
             child_0.ref();
             this.el.pack_start (  child_0.el , true,true,0 );
+            var child_1 = new Xcls_Button68( _this );
+            child_1.ref();
         }
 
         // user defined functions 
@@ -2189,6 +2191,85 @@ public class Xcls_MainWindow : Object
             }
         }
 
+        // user defined functions 
+    }
+    public class Xcls_Button68 : Object 
+    {
+        public Gtk.Button el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Button68(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Button();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.width_request = 50;
+            this.el.height_request = 50;
+            this.el.tooltip_text = "Delete Project";
+            var child_0 = new Xcls_Image69( _this );
+            child_0.ref();
+            this.el.set_image (  child_0.el  );
+
+            // listeners 
+            this.el.clicked.connect( ( ) => {
+                 
+                 var cd = DialogConfirm.singleton();
+                 cd.el.set_transient_for(_this.el);
+                cd.el.set_modal(true);
+            
+                 var project =   _this.windowstate.left_projects.getSelectedProject();
+                if (project == null) {
+                    print("SKIP - no project\n");
+                    return;
+                }
+                
+                    
+                 if (Gtk.ResponseType.YES != cd.show("Confirm", 
+                    "Are you sure you want to delete project %s".printf(project.name))) {
+                    return;
+                }
+                 
+            
+                // confirm?
+                Project.Project.remove(project);
+                _this.project = null;
+                
+                _this.windowstate.left_projects.is_loaded =  false;
+                _this.windowstate.left_projects.load();
+                _this.windowstate.clutterfiles.clearFiles();
+            
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Image69 : Object 
+    {
+        public Gtk.Image el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Image69(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Image();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.icon_name = "user-trash";
+        }
+
         // user defined functions 
     }
 }