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 this.content_type = ct;
31 var cts = ct.split("/");
32 this.language = "plain-text";
34 if (ct.length > 1 && cts.length > 1) {
36 this.language = cts[1];
38 this.language = (new Regex("^x-")).replace( this.language, this.language.length, 0, "");
39 print("got language %s\n", this.language);
49 this.id = "file-plain-%d".printf(plid++);
51 // various loader methods..
53 // Class = list of arguments ... and which property to use as a value.
62 setNSID : function(id)
65 this.items[0]['*class'] = id;
74 public override void removeFiles() {
75 if (FileUtils.test(this.path, FileTest.EXISTS)) {
76 GLib.FileUtils.remove(this.path);
81 public override void loadItems() throws GLib.Error // : function(cb, sync) == original was async.
84 GLib.FileUtils.get_contents(this.path, out this.contents);
90 public override string toSourcePreview()
94 public override void setSource(string str) {
97 public override string toSource()
105 public override void save() {
106 this.writeFile(this.path, this.contents);
109 // ignore these calls.
110 public override void saveHTML ( string html ) {}
116 * save as a javascript file.
117 * why is this not save...???
122 string getHelpUrl(string cls)
126 public override void findTransStrings(Node? node )