src/Builder4/MainWindow.bjs
authorAlan Knowles <alan@roojs.com>
Tue, 2 Jun 2015 12:56:15 +0000 (20:56 +0800)
committerAlan Knowles <alan@roojs.com>
Tue, 2 Jun 2015 12:56:15 +0000 (20:56 +0800)
src/Builder4/MainWindow.vala

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

index 7998005..75404ac 100644 (file)
         },
         {
          "listeners" : {
-          "changed" : "() => {\n\tif (this.el.text == \"\") {\n\t\treturn;\n\t}\n\tGee.ArrayList<int> res = new Gee.ArrayList<int>();\n\tswitch(_this.windowstate.state) {\n\t\tcase WindowState.State.CODEONLY:\n\t\tcase WindowState.State.CODE:\n\t\t\t// search the code being edited..\n\t\t\tres = _this.windowstate.code_editor.search(this.el.text);\n\t\t\t\n\t\t\tbreak;\n\t\tcase WindowState.State.PREVIEW:\n\t\t\tif (_this.windowstate.file.xtype == \"Gtk\") {\n\t\t\t\t res = _this.windowstate.window_gladeview.search(this.el.text);\n\t\t\t}\n\t\t\n\t\t\n\t\t\tbreak;\n\t}\n\tif (res.size > 0) {\n\t\t_this.search_results.el.label = \"%d Matches\".printf(res.size);\n\t} else {\n\t\t_this.search_results.el.label = \"No Matches\";\n\t}\n\t\t\n\t\n\t\n}\n"
+          "changed" : "() => {\n\tif (this.el.text == \"\") {\n\t\treturn;\n\t}\n\tvar res = 0;\n\tswitch(_this.windowstate.state) {\n\t\tcase WindowState.State.CODEONLY:\n\t\tcase WindowState.State.CODE:\n\t\t\t// search the code being edited..\n\t\t\tres = _this.windowstate.code_editor.search(this.el.text);\n\t\t\t\n\t\t\tbreak;\n\t\tcase WindowState.State.PREVIEW:\n\t\t\tif (_this.windowstate.file.xtype == \"Gtk\") {\n\t\t\t\t res = _this.windowstate.window_gladeview.search(this.el.text);\n\t\t\t}\n\t\t\n\t\t\n\t\t\tbreak;\n\t}\n\tif (res > 0) {\n\t\t_this.search_results.el.label = \"%d Matches\".printf(res);\n\t} else {\n\t\t_this.search_results.el.label = \"No Matches\";\n\t}\n\t\t\n\t\n\t\n}\n"
          },
          "id" : "search_entry",
          "* init" : "var description =   Pango.FontDescription.from_string(\"monospace\");\n\tdescription.set_size(8000);\n\t this.el.override_font(description);\n\n",
index 2eeb9f8..de7a19f 100644 (file)
@@ -2350,7 +2350,7 @@ public class Xcls_MainWindow : Object
                if (this.el.text == "") {
                        return;
                }
-               Gee.ArrayList<int> res = new Gee.ArrayList<int>();
+               var res = 0;
                switch(_this.windowstate.state) {
                        case WindowState.State.CODEONLY:
                        case WindowState.State.CODE:
@@ -2366,8 +2366,8 @@ public class Xcls_MainWindow : Object
                        
                                break;
                }
-               if (res.size > 0) {
-                       _this.search_results.el.label = "%d Matches".printf(res.size);
+               if (res > 0) {
+                       _this.search_results.el.label = "%d Matches".printf(res);
                } else {
                        _this.search_results.el.label = "No Matches";
                }