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 var f = File.new_for_path (path) ;
28 var info = f.query_info ("standard::*", 0);
29 var ct = info.get_content_type();
30 var cts = ct.split("/");
31 this.language = "plain-text";
33 if (ct.length > 1 && cts.length > 1) {
35 this.language = cts[1];
36 print("got language %s\n", this.language);
46 this.id = "file-plain-%d".printf(plid++);
48 // various loader methods..
50 // Class = list of arguments ... and which property to use as a value.
59 setNSID : function(id)
62 this.items[0]['*class'] = id;
71 public override void removeFiles() {
72 if (FileUtils.test(this.path, FileTest.EXISTS)) {
73 GLib.FileUtils.remove(this.path);
78 public override void loadItems() throws GLib.Error // : function(cb, sync) == original was async.
81 GLib.FileUtils.get_contents(this.path, out this.contents);
87 public override string toSourcePreview()
91 public override void setSource(string str) {
94 public override string toSource()
102 public override void save() {
103 this.writeFile(this.path, this.contents);
106 // ignore these calls.
107 public override void saveHTML ( string html ) {}
113 * save as a javascript file.
114 * why is this not save...???
119 string getHelpUrl(string cls)
123 public override void findTransStrings(Node? node )