" var pix = pixdef;",
" var fn = \"/usr/share/glade/pixmaps/hicolor/16x16/actions/widget-gtk-\" + sub + \".png\";",
" if (FileUtils.test (fn, FileTest.IS_REGULAR)) {",
- "\t pix = new Gdk.Pixbuf.from_file (fn);",
+ " \ttry {",
+ "\t \tpix = new Gdk.Pixbuf.from_file (fn);",
+ " \t} catch (Error e) {}",
+ " \t",
" }",
" ",
" ",
var pix = pixdef;
var fn = "/usr/share/glade/pixmaps/hicolor/16x16/actions/widget-gtk-" + sub + ".png";
if (FileUtils.test (fn, FileTest.IS_REGULAR)) {
- pix = new Gdk.Pixbuf.from_file (fn);
+ try {
+ pix = new Gdk.Pixbuf.from_file (fn);
+ } catch (Error e) {}
+
}
"\t//}",
"",
"\tif (!isNew) {",
- "\t try {",
+ "\t // try {",
"\t _this.updateFileFromEntry();",
- "\t } catch( JsRender.Error.RENAME_FILE_EXISTS er) {",
- "\t Xcls_StandardErrorDialog.singleton().show(",
- "\t _this.mainwindow.el,",
- "\t \"The name you used already exists \"",
- "\t );",
- "\t return;",
+ "\t // } catch( JsRender.Error.RENAME_FILE_EXISTS er) {",
+ "\t // Xcls_StandardErrorDialog.singleton().show(",
+ "\t // _this.mainwindow.el,",
+ "\t // \"The name you used already exists \"",
+ "\t // );",
+ "\t // return;",
"\t ",
- "\t }",
+ "\t //}",
"",
"\t _this.done = true;",
"\t _this.file.save();",
"\t",
"\t// strip the file type off the end..",
"\t",
- "\t",
- " var rx = new GLib.Regex(\"\\\\.\" + ext + \"$\",GLib.RegexCompileFlags.CASELESS);",
- " targetfile = rx.replace(targetfile, targetfile.length, 0, \"\"); ",
- " ",
+ "\ttry {",
+ "\t\tvar rx = new GLib.Regex(\"\\\\.\" + ext + \"$\",GLib.RegexCompileFlags.CASELESS);",
+ "\t\ttargetfile = rx.replace(targetfile, targetfile.length, 0, \"\"); ",
+ "\t } catch (RegexError e) {} // ignore.",
+ "\t ",
"\tif (GLib.FileUtils.test(targetfile + \".\" + ext, GLib.FileTest.EXISTS)) {",
"\t Xcls_StandardErrorDialog.singleton().show(",
"\t _this.mainwindow.el,",
"\t ); ",
"\t return;",
"\t}",
- " ",
- " var f = JsRender.JsRender.factory(",
- "\t\text == \"bjs\" ? _this.file.project.xtype : \"PlainFile\", ",
- "\t\t_this.file.project, ",
- "\t\ttargetfile + \".\" + ext);",
- "",
+ "\tJsRender.JsRender f;",
+ " try {",
+ "\t f = JsRender.JsRender.factory(",
+ "\t\t\text == \"bjs\" ? _this.file.project.xtype : \"PlainFile\", ",
+ "\t\t\t_this.file.project, ",
+ "\t\t\ttargetfile + \".\" + ext);",
+ "\t} catch (JsRender.Error e) {",
+ "\t\treturn;",
+ "\t}",
"\t_this.file = f;",
"\t",
+ "\t",
"",
"\t",
"\t_this.updateFileFromEntry();",
"\t_this.file.loaded = true;",
"\t_this.file.save();",
"\tif (ext == \"bjs\") {",
- "\t\t_this.file.project.addFile(_this.file);",
+ "\t\t",
+ "\t\t\t_this.file.project.addFile(_this.file);",
+ "\t\t ",
"\t}",
"\t",
" ",
" _this.file.modOrder = _this.modOrder.el.get_text();",
" ",
" if (_this.file.name.length > 0 && _this.file.name != _this.name.el.get_text()) {",
- " _this.file.renameTo(_this.name.el.get_text());",
+ " try {",
+ " \t_this.file.renameTo(_this.name.el.get_text());",
+ " \t} catch (JsRender.Error e) { } // do nothing?",
" }",
" // store the module...",
" _this.file.build_module = \"\"; ",
_this.file.modOrder = _this.modOrder.el.get_text();
if (_this.file.name.length > 0 && _this.file.name != _this.name.el.get_text()) {
- _this.file.renameTo(_this.name.el.get_text());
+ try {
+ _this.file.renameTo(_this.name.el.get_text());
+ } catch (JsRender.Error e) { } // do nothing?
}
// store the module...
_this.file.build_module = "";
//}
if (!isNew) {
- try {
+ // try {
_this.updateFileFromEntry();
- } catch( JsRender.Error.RENAME_FILE_EXISTS er) {
- Xcls_StandardErrorDialog.singleton().show(
- _this.mainwindow.el,
- "The name you used already exists "
- );
- return;
+ // } catch( JsRender.Error.RENAME_FILE_EXISTS er) {
+ // Xcls_StandardErrorDialog.singleton().show(
+ // _this.mainwindow.el,
+ // "The name you used already exists "
+ // );
+ // return;
- }
+ //}
_this.done = true;
_this.file.save();
// strip the file type off the end..
-
- var rx = new GLib.Regex("\\." + ext + "$",GLib.RegexCompileFlags.CASELESS);
- targetfile = rx.replace(targetfile, targetfile.length, 0, "");
-
+ try {
+ var rx = new GLib.Regex("\\." + ext + "$",GLib.RegexCompileFlags.CASELESS);
+ targetfile = rx.replace(targetfile, targetfile.length, 0, "");
+ } catch (RegexError e) {} // ignore.
+
if (GLib.FileUtils.test(targetfile + "." + ext, GLib.FileTest.EXISTS)) {
Xcls_StandardErrorDialog.singleton().show(
_this.mainwindow.el,
);
return;
}
-
- var f = JsRender.JsRender.factory(
- ext == "bjs" ? _this.file.project.xtype : "PlainFile",
- _this.file.project,
- targetfile + "." + ext);
-
+ JsRender.JsRender f;
+ try {
+ f = JsRender.JsRender.factory(
+ ext == "bjs" ? _this.file.project.xtype : "PlainFile",
+ _this.file.project,
+ targetfile + "." + ext);
+ } catch (JsRender.Error e) {
+ return;
+ }
_this.file = f;
+
_this.updateFileFromEntry();
_this.file.loaded = true;
_this.file.save();
if (ext == "bjs") {
- _this.file.project.addFile(_this.file);
+
+ _this.file.project.addFile(_this.file);
+
}
" if (_this.selectedProject == null) {",
" \treturn;",
" }",
- " ",
- " var f = JsRender.JsRender.factory(_this.selectedProject.xtype, _this.selectedProject, \"\");",
- " _this.win.windowstate.file_details.show( f, this.el, _this.new_window );",
- " ",
+ " 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) {}",
"",
"}"
]
"",
"\tGtk.TreePath path;",
"\tGtk.CellRenderer cell;",
- "\tvar s = _this.iconview.el.get_item_at_pos(x,y + (int) _this.iconscroll.el.vadjustment.value, out path, out cell);",
+ "\t_this.iconview.el.get_item_at_pos(x,y + (int) _this.iconscroll.el.vadjustment.value, out path, out cell);",
"\t",
"\t",
" // GLib.debug(\"Tooltip? %d,%d scroll: %d\",x,y, (int)_this.iconscroll.el.vadjustment.value);",
"\t}",
" _this.win.windowstate.project = _this.selectedProject;",
" _this.el.hide();",
- " ",
- " var f = JsRender.JsRender.factory(\"PlainFile\", _this.selectedProject, fn);",
- " ",
- " ",
- " _this.win.windowstate.fileViewOpen(f, _this.new_window);",
- " ",
+ " try {",
+ "\t\tvar f = JsRender.JsRender.factory(\"PlainFile\", _this.selectedProject, fn);",
+ "\t\t_this.win.windowstate.fileViewOpen(f, _this.new_window);",
+ "\t} catch (JsRender.Error e) {} ",
" ",
"}"
]
" m.set(iter, 2,file.nickType() ); // file type?",
" ",
" ",
+ " ",
+ "\t ",
+ "\t pixbuf = file.getIcon(92);",
+ "\t\tbigpixbuf = file.getIcon(368);",
"",
- " try {",
- "\t\t ",
- "\t\t pixbuf = file.getIcon(92);",
- "\t\t\tbigpixbuf = file.getIcon(368);",
- "",
- "\t\t} catch (Error e) {",
- "\t\t // noop",
- "\t\t",
- "\t\t} ",
- " ",
+ "\t\t ",
" ",
" if (pixbuf == null) {",
" \tGLib.debug(\"PIXBUF is null? %s\", file.name);",
" // min 450?",
"\t// max hieght ...",
"\t",
- "\tvar ww = on_el.get_allocated_width();",
+ "\t//var ww = on_el.get_allocated_width();",
"\t",
"\t// width = should be max = w-ww , or 600 at best..?",
"\t ",
// min 450?
// max hieght ...
- var ww = on_el.get_allocated_width();
+ //var ww = on_el.get_allocated_width();
// width = should be max = w-ww , or 600 at best..?
m.set(iter, 2,file.nickType() ); // file type?
+
+
+ pixbuf = file.getIcon(92);
+ bigpixbuf = file.getIcon(368);
- try {
-
- pixbuf = file.getIcon(92);
- bigpixbuf = file.getIcon(368);
-
- } catch (Error e) {
- // noop
-
- }
-
+
if (pixbuf == null) {
GLib.debug("PIXBUF is null? %s", file.name);
if (_this.selectedProject == null) {
return;
}
-
- var f = JsRender.JsRender.factory(_this.selectedProject.xtype, _this.selectedProject, "");
- _this.win.windowstate.file_details.show( f, this.el, _this.new_window );
-
+ 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) {}
});
}
Gtk.TreePath path;
Gtk.CellRenderer cell;
- var s = _this.iconview.el.get_item_at_pos(x,y + (int) _this.iconscroll.el.vadjustment.value, out path, out cell);
+ _this.iconview.el.get_item_at_pos(x,y + (int) _this.iconscroll.el.vadjustment.value, out path, out cell);
// GLib.debug("Tooltip? %d,%d scroll: %d",x,y, (int)_this.iconscroll.el.vadjustment.value);
}
_this.win.windowstate.project = _this.selectedProject;
_this.el.hide();
-
- var f = JsRender.JsRender.factory("PlainFile", _this.selectedProject, fn);
-
-
- _this.win.windowstate.fileViewOpen(f, _this.new_window);
-
+ try {
+ var f = JsRender.JsRender.factory("PlainFile", _this.selectedProject, fn);
+ _this.win.windowstate.fileViewOpen(f, _this.new_window);
+ } catch (JsRender.Error e) {}
});
this.el.cursor_changed.connect( () => {
" return false;",
" ",
" }",
- " ",
- " var pf = JsRender.JsRender.factory(\"PlainFile\", p, fname);",
- " _this.window.windowstate.fileViewOpen(pf, true, line);",
- " ",
+ " try {",
+ "\t\tvar pf = JsRender.JsRender.factory(\"PlainFile\", p, fname);",
+ "\t\t_this.window.windowstate.fileViewOpen(pf, true, line);",
+ " } catch (JsRender.Error e) {}",
" // try hiding the left nav..",
" ",
" return false;",
return false;
}
-
- var pf = JsRender.JsRender.factory("PlainFile", p, fname);
- _this.window.windowstate.fileViewOpen(pf, true, line);
-
+ try {
+ var pf = JsRender.JsRender.factory("PlainFile", p, fname);
+ _this.window.windowstate.fileViewOpen(pf, true, line);
+ } catch (JsRender.Error e) {}
// try hiding the left nav..
return false;
"| void iterSetValues" : [
"(Gtk.TreeIter iter, JsRender.Node node) {",
"\tvar ic = Gtk.IconTheme.get_default();",
- " Gdk.Pixbuf pix;",
+ " Gdk.Pixbuf pix = null,addi = null;",
" ",
" var o = GLib.Value(typeof(Object));",
" o.set_object((Object)node);",
" var clsb = clsname.split(\".\");",
" var sub = clsb.length > 1 ? clsb[1].down() : \"\";",
" ",
- " var addi = ic.load_icon(\"list-add\", 16,0);",
+ " ",
" var fn = \"/usr/share/glade/pixmaps/hicolor/16x16/actions/widget-gtk-\" + sub + \".png\";",
- " if (FileUtils.test (fn, FileTest.IS_REGULAR)) {",
- " pix = new Gdk.Pixbuf.from_file (fn);",
- " } else {",
- " \tpix = ic.load_icon(\"emblem-new\", 16,0);",
- " }",
+ " try { ",
+ "\t\taddi = ic.load_icon(\"list-add\", 16,0);",
+ "\t\tif (FileUtils.test (fn, FileTest.IS_REGULAR)) {",
+ "\t\t\t",
+ "\t\t \tpix = new Gdk.Pixbuf.from_file (fn);",
+ "\t\t\t",
+ "\t\t} else {",
+ "\t\t \tpix = ic.load_icon(\"emblem-new\", 16,0);",
+ "\t \t}",
+ " \t} catch (GLib.Error e) {}",
" ",
" var fqn = node.fqn();",
" var cn = _this.main_window.windowstate.project.palete.getChildList(fqn);",
}
public void iterSetValues (Gtk.TreeIter iter, JsRender.Node node) {
var ic = Gtk.IconTheme.get_default();
- Gdk.Pixbuf pix;
+ Gdk.Pixbuf pix = null,addi = null;
var o = GLib.Value(typeof(Object));
o.set_object((Object)node);
var clsb = clsname.split(".");
var sub = clsb.length > 1 ? clsb[1].down() : "";
- var addi = ic.load_icon("list-add", 16,0);
+
var fn = "/usr/share/glade/pixmaps/hicolor/16x16/actions/widget-gtk-" + sub + ".png";
- if (FileUtils.test (fn, FileTest.IS_REGULAR)) {
- pix = new Gdk.Pixbuf.from_file (fn);
- } else {
- pix = ic.load_icon("emblem-new", 16,0);
- }
+ try {
+ addi = ic.load_icon("list-add", 16,0);
+ if (FileUtils.test (fn, FileTest.IS_REGULAR)) {
+
+ pix = new Gdk.Pixbuf.from_file (fn);
+
+ } else {
+ pix = ic.load_icon("emblem-new", 16,0);
+ }
+ } catch (GLib.Error e) {}
var fqn = node.fqn();
var cn = _this.main_window.windowstate.project.palete.getChildList(fqn);
// set gobject values
this.el.label = "Delete Element";
+ this.el.show();
//listeners
this.el.activate.connect( ( ) => {
// set gobject values
this.el.label = "Save as Template";
+ this.el.show();
//listeners
this.el.activate.connect( () => {
// set gobject values
this.el.label = "Save as Module";
+ this.el.show();
//listeners
this.el.activate.connect( () => {
" ",
" ",
" \tif (event.keyval == Gdk.Key.Return && this.el.text.length > 0) {",
- "\t\tvar res = _this.search(this.el.text);",
+ "\t\t _this.search(this.el.text);",
"\t\t _this.search_results.updateResults();",
"",
"\t\tGLib.Timeout.add_seconds(2,() => {",
" var win = this.el.get_parent_window();",
" var width = win.get_width();",
" // var height = win.get_height();",
- " try { ",
+ " ",
" Gdk.Pixbuf screenshot = Gdk.pixbuf_get_from_window(win, 0, 0, width, this.paned.el.position);",
" this.file.writeIcon(screenshot);",
" ",
- " } catch(Error e) {",
- " //noop",
- " }",
+ " ",
"",
" ",
" ",
"\t\treturn;",
"\t}",
"\tthis.notebook.el.page = 1;",
- "\tGtk.TextIter beg, st,en, stl;",
+ "\tGtk.TextIter beg, st,en;",
"\t",
"\tvar buf = this.sourceview.el.get_buffer();",
"\tbuf.get_iter_at_offset(out beg, this.last_search_end);",
return;
}
this.notebook.el.page = 1;
- Gtk.TextIter beg, st,en, stl;
+ Gtk.TextIter beg, st,en;
var buf = this.sourceview.el.get_buffer();
buf.get_iter_at_offset(out beg, this.last_search_end);
var win = this.el.get_parent_window();
var width = win.get_width();
// var height = win.get_height();
- try {
+
Gdk.Pixbuf screenshot = Gdk.pixbuf_get_from_window(win, 0, 0, width, this.paned.el.position);
this.file.writeIcon(screenshot);
- } catch(Error e) {
- //noop
- }
+
if (event.keyval == Gdk.Key.Return && this.el.text.length > 0) {
- var res = _this.search(this.el.text);
+ _this.search(this.el.text);
_this.search_results.updateResults();
GLib.Timeout.add_seconds(2,() => {
if (file.xtype == "PlainFile") {
this.win.codeeditviewbox.el.show();
this.switchState (State.CODEONLY);
- file.loadItems();
+ try {
+ file.loadItems();
+ } catch (Error e) {}
this.code_editor_tab.show(file, null, null);
} else {
}
// normally we are going from preview to another state.
// and different windows hide the preview in differnt ways..
+ break;
+ case State.CODEONLY:
+ case State.CODE:
+ case State.NONE:
break;
}
this.state = new_state;
- this.buttonsShowHide();
+
switch (this.state) {
// -- buttons show hide.....
-
- public void buttonsShowHide()
- {
- // basically hide everything, then show the relivant..
-
- // top bar btns
- //this.win.openbtn.el.hide();
- //this.win.openbackbtn.el.hide();
-
- //this.win.backbutton.el.hide();
-
-
-
-
-
-
-
- switch (this.state) {
-
- case State.PREVIEW: // this is the default state when working...
-
-
-
-
-
-
-
- // this.win.openbtn.el.show();
-
- break;
-
- case State.CODEONLY:
- // this.win.openbtn.el.show();
-
- break;
-
-
- /*
- case State.FILES:
- if (this.left_projects.getSelectedProject() != null ) {
- if (this.left_tree.getActiveFile() != null) {
-
- this.win.openbackbtn.el.show();
- }
- this.win.addfilebutton.el.show();
- this.win.search_entry.el.show();
- this.win.projecteditbutton.el.show();
- }
-
-
- this.win.addprojectbutton.el.show();
- this.win.delprojectbutton.el.show();
-
-
-
-
- break;
- */
- }
-
-
-
- }
+
public void showCompileResult(Json.Object obj)
return;
}
var fn = this.targetName();
- print("WRITE :%s\n " , fn);
- this.writeFile(fn, NodeToVala.mungeFile(this));
+ GLib.debug("WRITE :%s\n " , fn);
+ try {
+ this.writeFile(fn, NodeToVala.mungeFile(this));
+ } catch (GLib.Error e) {}
}
*/
- string getHelpUrl(string cls)
- {
- return "http://devel.akbkhome.com/seed/" + cls + ".html";
- }
+
public override void findTransStrings(Node? node )
{
// not yet..
switch (size) {
case 0:
if (this.screenshot == null) {
- this.screenshot = new Gdk.Pixbuf.from_file(fname);
+ try {
+ this.screenshot = new Gdk.Pixbuf.from_file(fname);
+ } catch (GLib.Error e) {}
}
return this.screenshot;
public void writeIcon(Gdk.Pixbuf pixbuf) {
- pixbuf.save(this.getIconFileName( ),"png");
- this.screenshot = pixbuf;
this.screenshot92 = null;
this.screenshot368 = null;
+ this.screenshot = null;
+ try {
+ pixbuf.save(this.getIconFileName( ),"png");
+ this.screenshot = pixbuf;
+
+ } catch (GLib.Error e) {}
+
+
}
;
- print("WRITE :%s\n " , this.path);// + "\n" + JSON.stringify(write));
+ GLib.debug("WRITE :%s\n " , this.path);// + "\n" + JSON.stringify(write));
try {
this.writeFile(this.path, this.toJsonString());
- } catch(Error e) {
+ } catch(GLib.Error e) {
print("Save failed");
}
}
var array_len = array.get_length();
var pretty = this.pretty;
- var indent = this.indent;
+
buffer.append_c( '[');
var pretty = this.pretty;
- var indent = this.indent;
+
buffer.append_c('{');
public bool getPropertyRange(string prop, out int start, out int end)
{
+ end = 0;
start = -1;
foreach(int el in this.lines) {
if (start < 0) {
var funcs = "";
var props = "";
var listen = "";
- var signals = "";
+
var uprops = "";
// sort?
case "float":
case "double":
default:
- return this.val;
+ break;
}
var cls = this.node.fqn().replace(".", "");
- var girdata = Palete.Gir.factoryFqn(this.project, this.node.fqn());
+ Palete.Gir.factoryFqn(this.project, this.node.fqn());
-
-
- /// check if it's a GtkWidget?
- // maybe not?
- // how are models handled?
-
-
- //var b = new global::Gtk.Builder();
-
- // this might be needed if we are using non-Gtk elements?
- //var gtype = b.get_type_from_name(cls);
- //GLib.debug ("Type: %s ?= %s\n", this.node.fqn(), gtype.name());
-
-
- /*
- var ns = this.node.fqn().split(".")[0];
- if (ns == "Clutter") {
- return "";
- }
- //if (ns == "GtkClutter") {
- // return "";
- //}
- if (ns == "WebKit") {
- return "";
- }
- */
- /*
-
- switch(cls) {
- // things we can not do yet...
-
- //case "GtkView": // SourceView?
- case "GtkTreeStore": // top level.. - named and referenced
- case "GtkListStore": // top level.. - named and referenced
- case "GtkTreeViewColumn": // part of liststore?!?!
- case "GtkMenu": // top level..
- case "GtkCellRendererText":
- case "GtkSourceBuffer":
- case "GtkClutterActor"://fixme..
- ///case "GtkClutterEmbed"://fixme..
- return "";
- }
- */
+
// should really use GXml...
var obj = this.create_element("object");
var new_node = new Node();
var pa = new Json.Parser();
pa.load_from_data(ret);
+
var rnode = pa.get_root();
this.node = new_node;
} catch (Palete.JavascriptError e) {
- print("Error: %s\n", e.message);
+ GLib.debug("Error: %s\n", e.message);
+ } catch (GLib.Error e) {
+ GLib.debug("Error: %s\n", e.message);
}
var parent = this.parentObj.wrapped_object;
- var do_pack =true;
+
if (parent == null) { // no parent.. can not pack.
return; ///
Palete.Gir.checkParamOverride(mparams.get(i));
var k = mparams.get(i).name;
- Value cur_val;
+
var type = mparams.get(i).type;
type = Palete.Gir.fqtypeLookup(this.project, type, ns);
return ret;
default:
- return null;
+ break;
/*
var sval = GLib.Value(typeof(string));
sval.set_string(val);
// .vala props..
- string[] cargs = {};
+
var cargs_str = "";
// ctor..
this.addLine();
this.addLine(this.ipad + "this.el = new " + this.node.fqn() + ".newv( " + args_str + " );");
return;
- break;
+
case "Gtk.LinkButton": // args filled with values.
if (this.node.has("label")) {
var k = iter.get();
- var ar = k.strip().split(" ");
- var kname = ar[ar.length-1];
-
+
var prop = this.node.props.get(k);
var v = prop.val.strip();
return;
default:
// do nothing
- return;
+ break;
}
return;
aconstruct( project, path);
this.xtype = "PlainFile";
+ this.content_type = "text/plain";
// if the file does not exist...
if (GLib.FileUtils.test(path, GLib.FileTest.EXISTS)) {
var f = File.new_for_path (path) ;
- var info = f.query_info ("standard::*", 0);
- var ct = info.get_content_type();
- this.content_type = ct;
+ try {
+ var info = f.query_info ("standard::*", 0);
+ var ct = info.get_content_type();
+ this.content_type = ct;
+ } catch (GLib.Error e) {}
+
} else {
this.content_type = "text/plain"; // hopefully..
// var ar = path.split(".");
*/
- string getHelpUrl(string cls)
- {
- return "";
- }
+
public override void findTransStrings(Node? node )
{
// not yet..
class Roo : JsRender
{
- string region;
+
bool disabled;
//print("TO SOURCE in " + ((new Date()) - d) + "ms");
try {
this.writeFile(js, js_src);
- } catch (FileError e ) {
+ } catch (GLib.Error e ) {
print("Save failed\n");
}
// for bootstrap - we can write the HTML to the templates directory..
print("SAVE HTML (%d) -- %s\n",html.length, targetdir + "/" + bn);
try {
this.writeFile(targetdir + "/" + bn , html);
- } catch (FileError e ) {
+ } catch (GLib.Error e ) {
print("SaveHtml failed\n");
}
print("Failed to find file by name?\n");
continue;
}
-
- sf.loadItems();
- sf.findTransStrings(sf.tree);
- var xinc_str = sf.toSource();
-
- //string xinc_str;
- //FileUtils.get_contents(js, out xinc_str);
- prefix_data += "\n" + xinc_str + "\n";
+ try {
+ sf.loadItems();
+ sf.findTransStrings(sf.tree);
+ var xinc_str = sf.toSource();
+
+ //string xinc_str;
+ //FileUtils.get_contents(js, out xinc_str);
+ prefix_data += "\n" + xinc_str + "\n";
+ } catch (GLib.Error e) {}
}
}
- public new string? guessName (Node? ar) // turns the object into full name.
- {
- // eg. xns: Roo, xtype: XXX -> Roo.xxx
- if (ar == null) {
- return null;
- }
-
- string[] ret = {} ;
- ret += (ar.get("|xns").length < 1 ? "Roo": ar.get("|xns"));
-
-
- if ( ar.get("xtype").length < 1) {
- return null;
- }
-
- var xtype = ar.get("xtype");
-
- if (xtype[0] == '*') { // prefixes????
- xtype = xtype.substring(1);
- }
- if (! Regex.match_simple("^Roo", xtype)) {
-
- // already starts with roo...
- ret = {};
- }
- ret += xtype;
- var str = string.joinv(".", ret);
-
- return str;
- //
- //Palete.Palete.factory("Roo").guessName(str);
-
-
-
- }
- string getHelpUrl(string cls)
- {
- return "http://www.roojs.com/roojs1/docs/symbols/" + cls + ".html";
- }
public override string toGlade()
{
return "Roo files do not convert to glade";
var w = Xcls_MainWindow.singleton();
- app.addWindow(w);
+ BuilderApplication.addWindow(w);
w.el.show_all();
// it looks like showall after children causes segfault on ubuntu 14.4
w.initChildren();
{
return -1;
}
-
+/*
public bool get_start_iter (SourceCompletionContext context, SourceCompletionProposal proposal, out TextIter iter)
{
+ iter = new TextIter();
return false;
}
-
+*/
public void update_info (SourceCompletionProposal proposal, SourceCompletionInfo info)
{
return space.isspace() || space.to_string() == "";
}
- private bool is_forward_space(unichar space){
- return !(
- space.to_string() == " "
- ||
- space.to_string() == ""
- ||
- space.to_string() == "\n"
- ||
- space.to_string() == ")"
- ||
- space.to_string() == "("
-
- );
- }
+
}
{
// overrides should be in a file Gir.overides
// in that "Gtk.Label.new.str" : "label"
+
loadOverrides();
var key = "%s.%s.%s".printf(cls,method,param);
//print("Chekcing for key %s\n", key);
}
- public static void loadOverrides(bool force = false)
+ public static void loadOverrides(bool force = false)
{
if (overrides_loaded && ! force) {
return;
}
-
+ Json.Node node = null;
var pa = new Json.Parser();
- pa.load_from_file(BuilderApplication.configDirectory() + "/resources/Gir.overides");
- var node = pa.get_root();
-
- if (node.get_node_type () != Json.NodeType.OBJECT) {
- throw new GirError.INVALID_FORMAT ("Error loading gir.overides : Unexpected element type %s", node.type_name ());
+ try {
+ pa.load_from_file(BuilderApplication.configDirectory() + "/resources/Gir.overides");
+ node = pa.get_root();
+ if (node.get_node_type () != Json.NodeType.OBJECT) {
+ GLib.debug("Error loading gir.overides : Unexpected element type %s", node.type_name ());
+
+ return;
+ //throw new GirError.INVALID_FORMAT ("Error loading gir.overides : Unexpected element type %s", node.type_name ());
+ }
+ } catch (GLib.Error e) {
+ return;
}
+
overrides = new Gee.HashMap<string,string>();
public static Gee.HashMap<string,Gir> global_cache = null;
- public static Gir? factory(Project.Project project, string ns)
+ public static Gir? factory(Project.Project? project, string ns)
{
if (global_cache == null) {
global_cache = new Gee.HashMap<string,Gir>();
public override void load ()
{
- var gtk = Gir.factory(this.project, "Gtk"); // triggers a load...
+ Gir.factory(this.project, "Gtk"); // triggers a load...
var pr = (Project.Gtk) this.project;
public void add_special_children(string parent, string child, string prop)
{
- var cls = this.getClass(parent);
+ this.getClass(parent);
var cls_cn = this.getClass(child);
var localopts_r = new Gee.ArrayList<string>();
var localopts_l = new Gee.ArrayList<string>();
}
- public override Gee.HashMap<string,GirObject> getPropertiesFor( string ename, JsRender.NodePropType ptype)
+ public override Gee.HashMap<string,GirObject> getPropertiesFor( string ename, JsRender.NodePropType ptype)
{
//print("Loading for " + ename);
case JsRender.NodePropType.CTOR: // needed to query the arguments of a ctor.
return cls.ctors;
default:
- throw new Error.INVALID_VALUE( "getPropertiesFor called with: " + ptype.to_string());
+ GLib.error( "getPropertiesFor called with: " + ptype.to_string());
//var ret = new Gee.HashMap<string,GirObject>();
//return ret;
}
ret.add(Path.get_basename(fn).replace(".vapi", ""));
}
- } catch(Error e) {
+ } catch(GLib.Error e) {
print("oops - something went wrong scanning the packages\n");
}
return ret;
{
JSCore.Value ex;
unowned JSCore.GlobalContext ctx = this.js_global_context;
- var ret = this.js_global_context.check_script_syntax(
+ this.js_global_context.check_script_syntax(
new JSCore.String.with_utf8_c_string(code),
null,
0,
var exo = ex.to_object(ctx, null);
- unowned JSCore.PropertyNameArray property_names = exo.copy_property_names (ctx);
+ //unowned JSCore.PropertyNameArray property_names = exo.copy_property_names (ctx);
if (!FileUtils.test (fname, FileTest.EXISTS)) {
throw new JavascriptError.MISSING_FILE("Plugin: file not found %s", fname);
}
-
- FileUtils.get_contents(fname, out file_data);
-
+ try {
+ FileUtils.get_contents(fname, out file_data);
+ } catch (GLib.Error e) {
+ GLib.debug("Error file load failed: %s", e.message);
+ return "";
+ }
var jfile_data = new JSCore.String.with_utf8_c_string(file_data);
var jmethod = new JSCore.String.with_utf8_c_string(call_method);
//var json_args = new JSCore.String.with_utf8_c_string(js_data);
- JSCore.Value exa;
- JSCore.Value exb;
+ JSCore.Value exa;
+ JSCore.Value exb;
unowned JSCore.Value exc;
JSCore.Value exd;
unowned JSCore.Value exe;
var ctx = new JSCore.GlobalContext(goc);
var othis = ctx.get_global_object();
- var eval = ctx.evaluate_script (
+ ctx.evaluate_script (
jfile_data,
othis,
null,
- string guessName(JsRender.Node ar) throws Error // turns the object into full name.
- {
- throw new Error.NEED_IMPLEMENTING("xxx. guessName needs implimenting");
- }
-
+
// store it in user's directory..
var appdir = GLib.Environment.get_home_dir() + "/.Builder";
-
- if (!GLib.FileUtils.test(appdir+ "/" + gn, GLib.FileTest.IS_DIR)) {
- GLib.File.new_for_path (appdir+ "/" + gn).make_directory ();
-
- }
- GLib.FileUtils.set_contents(appdir+ "/" + gn + "/" + name + ".json", data.toJsonString());
-
+ try {
+ if (!GLib.FileUtils.test(appdir+ "/" + gn, GLib.FileTest.IS_DIR)) {
+ GLib.File.new_for_path (appdir+ "/" + gn).make_directory ();
+
+ }
+ GLib.FileUtils.set_contents(appdir+ "/" + gn + "/" + name + ".json", data.toJsonString());
+ } catch (GLib.Error e) {
+ GLib.debug("Error : %s", e.message);
+ }
}
/**
var f = File.new_for_path(dir);
-
+ try {
var file_enum = f.enumerate_children(GLib.FileAttribute.STANDARD_DISPLAY_NAME, GLib.FileQueryInfoFlags.NONE, null);
FileInfo next_file;
}
ret.append( dir + "/" + n);
}
+ } catch (GLib.Error e) {
+ GLib.debug("Error : %s", e.message);
+ }
return ret;
}
{
var pa = new Json.Parser();
- pa.load_from_file(path);
+ try {
+ pa.load_from_file(path);
+ } catch(GLib.Error e) {
+ GLib.debug("Error : %s", e.message);
+ return null;
+ }
var node = pa.get_root();
if (node.get_node_type () != Json.NodeType.OBJECT) {
print("Palete Load called\n");
string raw;
if (!FileUtils.test (fname, FileTest.EXISTS)) {
- throw new Error.MISSING_FILE(fname + " not found");
+ GLib.error("Missing File: %s", fname);
+ ;
+ }
+ try {
+ FileUtils.get_contents(fname, out raw);
+ } catch (GLib.Error e) {
+ GLib.error("Error %s", e.message);
}
-
- FileUtils.get_contents(fname, out raw);
// print(data);
var data = raw.split("\n");
var state = 0;
var add_to = new Gee.HashMap<string,Gee.ArrayList<string>>();
var pa = new Json.Parser();
- pa.load_from_file(BuilderApplication.configDirectory() + "/resources/roodata.json");
+ try {
+ pa.load_from_file(BuilderApplication.configDirectory() + "/resources/roodata.json");
+ } catch(GLib.Error e) {
+ GLib.error("Could not load %s",BuilderApplication.configDirectory() + "/resources/roodata.json");
+ }
var node = pa.get_root();
var clist = node.get_object(); /// was in data... .get_object_member("data");
case JsRender.NodePropType.CTOR:
return ret;
default:
- throw new Error.INVALID_VALUE( "getPropertiesFor called with: " + ptype.to_string());
+ GLib.error( "getPropertiesFor called with: " + ptype.to_string());
//var ret = new Gee.HashMap<string,GirObject>();
//return ret;
return false;
}
-
- var hash = prop.ptype == JsRender.NodePropType.LISTENER ? node.listeners : node.props;
// untill we get a smarter renderer..
// we have some scenarios where changing the value does not work
return false;
}
-
+ File tmpfile;
FileIOStream iostream;
- var tmpfile = File.new_tmp ("test-XXXXXX.vala", out iostream);
- tmpfile.ref();
+ try {
+ tmpfile = File.new_tmp ("test-XXXXXX.vala", out iostream);
+ tmpfile.ref(); // why??
+ } catch(GLib.Error e) {
+ GLib.debug("failed to create temporary file");
+ return false;
+ }
OutputStream ostream = iostream.output_stream;
DataOutputStream dostream = new DataOutputStream (ostream);
- dostream.put_string (contents);
-
+ try {
+ dostream.put_string (contents);
+ } catch(GLib.Error e) {
+ GLib.debug("failed to write to temporary file");
+ return false;
+ }
var valafn = "";
try {
var regex = new Regex("\\.bjs$");
args += valafn;
-
- this.compiler = new Spawn("/tmp", args);
+ try {
+ this.compiler = new Spawn("/tmp", args);
+ } catch (GLib.Error e) {
+ GLib.debug("Spawn failed: %s", e.message);
+ return false;
+ }
this.compiler.complete.connect(spawnResult);
this.spinner(true);
try {
this.compiler.run();
- } catch (GLib.SpawnError e) {
- GLib.debug(e.message);
+ } catch (GLib.Error e) {
+ GLib.debug("Error %s",e.message);
this.spinner(false);
this.compiler = null;
return false;
FileIOStream iostream;
- var tmpfile = File.new_tmp ("test-XXXXXX.vala", out iostream);
- tmpfile.ref();
-
+ File tmpfile;
+ try {
+ tmpfile = File.new_tmp ("test-XXXXXX.vala", out iostream);
+ tmpfile.ref();
+ } catch(GLib.Error e) {
+ GLib.debug("Failed to create tempoary file %s", e.message);
+ return false;
+ }
OutputStream ostream = iostream.output_stream;
DataOutputStream dostream = new DataOutputStream (ostream);
- dostream.put_string (contents);
-
+ try {
+ dostream.put_string (contents);
+ } catch(GLib.Error e) {
+ GLib.debug("Failed to write to tempoary file %s", e.message);
+ return false;
+ }
var target = pr.firstBuildModule();
if (target.length < 1) {
return false;
// should be home directory...
-
- var exec = new Spawn(GLib.Environment.get_home_dir() , args);
- exec.detach = true;
- exec.run();
+ try {
+ var exec = new Spawn(GLib.Environment.get_home_dir() , args);
+ exec.detach = true;
+ exec.run();
+ } catch(GLib.Error e) {
+ GLib.debug("Failed to spawn: %s", e.message);
+ return;
+ }
}
}
}
}
string ostr;
- FileUtils.get_contents(fn, out ostr);
+ try {
+ FileUtils.get_contents(fn, out ostr);
+ } catch (GLib.Error e) {
+ GLib.debug("failed loading deps %s", e.message);
+ return {};
+ }
return ostr.split("\n");
if (context.report.get_errors () > 0) {
GLib.error("failed check VAPIS, so we can not write file correctly");
// throw new VapiParserError.PARSE_FAILED("failed check VAPIS, so we can not write file correctly");
- Vala.CodeContext.pop ();
+ //Vala.CodeContext.pop ();
- return;
+ //return;
}
var f = GLib.File.new_for_path(fn);
- var data_out = new GLib.DataOutputStream(
- f.replace(null, false, GLib.FileCreateFlags.NONE, null)
- );
- data_out.put_string(this.configToString(), null);
- data_out.close(null);
+ try {
+ var data_out = new GLib.DataOutputStream(
+ f.replace(null, false, GLib.FileCreateFlags.NONE, null)
+ );
+ data_out.put_string(this.configToString(), null);
+ data_out.close(null);
+ } catch (GLib.Error e) {
+ GLib.debug("Error writing config: %s", e.message);
+ return;
+ }
this.gir_cache_loaded = false; // force a reload.
- return ;
+
}
/**
return prefix + target.substring(bb.length );
}
if (bb.length < 1) {
- throw new Error.INVALID_FORMAT ("Could not work out relative path %s to %s",
+ GLib.error("Could not work out relative path %s to %s",
basename, target);
}
bb = GLib.Path.get_dirname(bb);
}
- } catch(Error e) {
+ } catch(GLib.Error e) {
GLib.warning("oops - something went wrong scanning the projects\n");
}
{
var allfiles = this.filesAll(in_path,abspath);
var ret = new Gee.ArrayList<string>();
-
-
+ Regex is_c;
+ try {
+ is_c = new Regex("\\.c$");
+ } catch (RegexError e) {
+ GLib.error("Regex failed :%s", e.message);
+ }
for (var i = 0; i < allfiles.size; i ++) {
var fn = allfiles.get(i);
try {
// is the c file the same as a vala file...
+
+ var vv = is_c.replace( fn, fn.length, 0, ".vala");
- var vv = (new Regex("\\.c$")).replace( fn, fn.length, 0, ".vala");
-
+
if (allfiles.index_of( vv) > -1) {
}
// add the 'c' file..
ret.add(fn);
- } catch (Error e) {
+ } catch (GLib.Error e) {
continue;
}
}
var ret = new Gee.ArrayList<string>();
GLib.debug("SCAN %s - %d files",in_path, allfiles.size);
+ Regex is_c, is_vala;
+ try {
+ is_c = new Regex("\\.c$");
+ is_vala = new Regex("\\.vala$");
+ } catch (RegexError e) {
+ GLib.error("Regex failed :%s", e.message);
+ }
+
+
for (var i = 0; i < allfiles.size; i ++) {
var fn = allfiles.get(i);
var bn = GLib.Path.get_basename(fn);
continue;
}
if (Regex.match_simple("\\.vala$", fn)) {
- var vv = (new Regex("\\.vala$")).replace( fn, fn.length, 0, ".bjs");
+ var vv = is_vala.replace( fn, fn.length, 0, ".bjs");
if (allfiles.index_of( vv) > -1) {
GLib.debug("SKIP %s - .vala (got bjs)",fn);
continue;
// not a c file...
if (Regex.match_simple("\\.c$", fn)) {
- var vv = (new Regex("\\.c$")).replace( fn, fn.length, 0, ".vala");
+ var vv = is_c.replace( fn, fn.length, 0, ".vala");
if (allfiles.index_of( vv) > -1) {
GLib.debug("SKIP %s - .c (got vala)",fn);
continue;
GLib.debug("ADD %s",fn);
// add the 'c' file..
ret.add(fn);
- } catch (Error e) {
+ } catch (GLib.Error e) {
GLib.debug("Exception %s",e.message);
continue;
}
var dirname = GLib.Environment.get_home_dir() + "/.Builder";
var dir = File.new_for_path(dirname);
- if (!dir.query_exists()) {
- dir.make_directory();
+ if (!dir.query_exists()) {
+ try {
+ dir.make_directory();
+ } catch(GLib.Error e) {
+ GLib.error("could not make builder directory");
+ }
return;
}
projects = new Gee.HashMap<string,Project>();
}
factoryFromFile(dirname + "/" + fn);
}
- } catch(Error e) {
+ } catch(GLib.Error e) {
GLib.warning("oops - something went wrong scanning the projects\n");
}
}
- public static Project getProject(string name)
+ public static Project? getProject(string name)
{
var iter = projects.map_iterator();
- public static Project getProjectByHash(string fn)
+ public static Project? getProjectByHash(string fn)
{
var iter = projects.map_iterator();
GLib.debug("parse %s", jsonfile);
var pa = new Json.Parser();
- pa.load_from_file(jsonfile);
+ try {
+ pa.load_from_file(jsonfile);
+ } catch (GLib.Error e) {
+ GLib.error("could not load json file %s", e.message);
+ }
var node = pa.get_root();
//var str = "%l:%l".printf(tv.tv_sec,tv.tv_usec);
var str = this.firstPath();
- this.fn = GLib.Checksum.compute_for_string(GLib.ChecksumType.MD5, str, str.length);
+ this.fn = GLib.Checksum.compute_for_string(GLib.ChecksumType.MD5, str, str.length);
}
var dirname = GLib.Environment.get_home_dir() + "/.Builder";
var s = this.toJSON(false);
- FileUtils.set_contents(dirname + "/" + this.fn + ".json", s, s.length);
-
+ try {
+ FileUtils.set_contents(dirname + "/" + this.fn + ".json", s, s.length);
+ } catch (GLib.Error e) {
+ GLib.error("failed to save file %s", e.message);
+ }
}
-
public string toJSON(bool show_all)
{
public JsRender.JsRender newFile (string name)
{
- var ret = JsRender.JsRender.factory(this.xtype,
+ try {
+ var ret = JsRender.JsRender.factory(this.xtype,
this,
this.firstPath() + "/" + name + ".bjs");
- this.addFile(ret);
- return ret;
+ this.addFile(ret);
+ return ret;
+ } catch (JsRender.Error e) {
+ GLib.error("failed to create file %s", e.message);
+ }
}
public JsRender.JsRender loadFileOnly (string path)
{
var xt = this.xtype;
- return JsRender.JsRender.factory(xt, this, path);
+ try {
+ return JsRender.JsRender.factory(xt, this, path);
+ } catch (JsRender.Error e) {
+ GLib.error("failed to create file %s", e.message);
+ }
}
}
uint8[] data;
uint8[] zero = { 0 };
- GLib.FileUtils.get_data(tfn, out data);
-
- var file = File.new_for_path (tfn);
-
- var info = file.query_info(
- "standard::*",
- FileQueryInfoFlags.NONE
- );
- var csdata = new GLib.ByteArray.take("blob %s".printf(info.get_size().to_string()).data);
- csdata.append(zero);
- csdata.append(data);
-
- // git method... blob %d\0...string...
- this.cur_sha = GLib.Checksum.compute_for_data(GLib.ChecksumType.SHA1, csdata.data );
+ try {
+ GLib.FileUtils.get_data(tfn, out data);
+
+ var file = File.new_for_path (tfn);
+
+ var info = file.query_info(
+ "standard::*",
+ FileQueryInfoFlags.NONE
+ );
+ var csdata = new GLib.ByteArray.take("blob %s".printf(info.get_size().to_string()).data);
+ csdata.append(zero);
+ csdata.append(data);
+
+ // git method... blob %d\0...string...
+ this.cur_sha = GLib.Checksum.compute_for_data(GLib.ChecksumType.SHA1, csdata.data );
+ } catch (GLib.Error e) {
+ GLib.debug("Failed to update SHA: %s", e.message);
+ }
}
}
public void parseDirectory(string json, string target)
{
- print("%s\n", json);
+ GLib.debug("%s\n", json);
var pa = new Json.Parser();
- pa.load_from_data(json);
+ try {
+ pa.load_from_data(json);
+ } catch (GLib.Error e) {
+ GLib.debug("Faile dto load json file %s", e.message);
+ return;
+ }
var node = pa.get_root();
if (node.get_node_type () != Json.NodeType.ARRAY) {
return;
// create parent directory if needed
if (!GLib.FileUtils.test (GLib.Path.get_dirname(tfn), FileTest.IS_DIR)) {
var f = GLib.File.new_for_path(GLib.Path.get_dirname(tfn));
- f.make_directory_with_parents ();
+ try {
+ f.make_directory_with_parents ();
+ } catch(GLib.Error e) {
+ GLib.error("Problem creating directory %s", e.message);
+ }
}
// set data??? - if it's binary?
- FileUtils.set_contents( tfn, (string) message.response_body.data );
-
+ try {
+ FileUtils.set_contents( tfn, (string) message.response_body.data );
+ } catch(GLib.Error e) {
+ GLib.error("Problem writing data %s", e.message);
+ }
switch (item.target) {
case "Gir.overides":
// clear all the project caches....
stdout.printf ("%s\n", cmdline);
}
+ int exit_status = 0;
try {
- int exit_status;
Process.spawn_command_line_sync (cmdline, null, null, out exit_status);
- if (exit_status != 0) {
- Report.error (null, "cc exited with status %d", exit_status);
- }
- } catch (SpawnError e) {
+ } catch (Error e) {
Report.error (null, e.message);
}
+ if (exit_status != 0) {
+ Report.error (null, "cc exited with status %d", exit_status);
+ }
+
/* remove generated C source and header files */
if (!context.save_csources) {