4 * this is the code represents a File when using the Gtk view..
18 public class PlainFile : JsRender
22 public PlainFile(Project.Project project, string path) {
25 this.xtype = "PlainFile";
27 // if the file does not exist...
28 if (GLib.FileUtils.test(path, GLib.FileTest.EXISTS)) {
29 var f = File.new_for_path (path) ;
30 var info = f.query_info ("standard::*", 0);
31 var ct = info.get_content_type();
32 this.content_type = ct;
34 this.content_type = "text/plain"; // hopefully..
35 // var ar = path.split(".");
36 // var ext = ar[ar.length -1]; // hopefully not fail...
53 this.id = "file-plain-%d".printf(plid++);
55 // various loader methods..
57 // Class = list of arguments ... and which property to use as a value.
66 setNSID : function(id)
69 this.items[0]['*class'] = id;
78 public override void removeFiles() {
79 if (FileUtils.test(this.path, FileTest.EXISTS)) {
80 GLib.FileUtils.remove(this.path);
85 public override void loadItems() throws GLib.Error // : function(cb, sync) == original was async.
90 GLib.FileUtils.get_contents(this.path, out this.contents);
96 public override string toSourcePreview()
100 public override void setSource(string str) {
103 public override string toSource()
105 return this.contents;
110 public override string toSourceCode()
112 return this.contents;
117 public override void save() {
119 print("Ignoring Save - as file was never loaded?\n");
123 this.writeFile(this.path, this.contents);
124 } catch (GLib.Error e) {
129 // ignore these calls.
130 public override void saveHTML ( string html ) {}
136 * save as a javascript file.
137 * why is this not save...???
142 string getHelpUrl(string cls)
146 public override void findTransStrings(Node? node )