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

Builder4/ValaProjectSettings.bjs
Builder4/ValaProjectSettings.vala

index a5c2536..6d375f7 100644 (file)
                                             "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}"
+                                                        "activate" : "()  => {\n    \n       if (_this.project.compilegroups.has_key(\"NEW GROUP\")) {\n        return;\n    }\n      \n       // add the directory..\n       \n       _this.project.compilegroups.set(\"NEW GROUP\", new Project.GtkValaSettings(\"NEW GROUP\"));\n       _this.targets_tree_store.load();\n}"
                                                     },
                                                     "* pack" : "add",
                                                     "xtype" : "MenuItem",
index 9bddaa6..4bc870a 100644 (file)
@@ -970,21 +970,14 @@ public class ValaProjectSettings : Object
             // 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 ();
+                   if (_this.project.compilegroups.has_key("NEW GROUP")) {
+                    return;
+                }
+                  
                    // 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();
+                   
+                   _this.project.compilegroups.set("NEW GROUP", new Project.GtkValaSettings("NEW GROUP"));
+                   _this.targets_tree_store.load();
             });
         }