src/JsRender/PlainFile.vala
[app.Builder.js] / src / JsRender / PlainFile.vala
1
2 /**
3  * 
4  *  this is the code represents a File when using the Gtk view..
5  *   
6  *  It ues NodeToGtk
7  * 
8  * 
9  */
10
11 namespace JsRender {
12
13
14  
15     int plid = 1;
16
17   
18     public  class PlainFile : JsRender
19     {
20                 string contents;
21
22         public PlainFile(Project.Project project, string path) {
23         
24             base( project, path);
25             this.xtype = "PlainFile";
26             
27             var f = File.new_for_path (path) ;
28             var info = file.query_info ("standard::*", 0);
29             
30             // fixme...
31             this.language = "vala";
32             
33                         this.contents = "";
34             
35             // super?!?!
36             this.id = "file-plain-%d".printf(plid++);
37             //console.dump(this);
38             // various loader methods..
39
40             // Class = list of arguments ... and which property to use as a value.
41        
42
43             
44             
45         }
46           
47
48         /*
49         setNSID : function(id)
50         {
51             
52             this.items[0]['*class'] = id;
53             
54             
55         },
56         getType: function() {
57             return 'Gtk';
58         },
59         */
60
61         public   override void   removeFiles() {
62                 if (FileUtils.test(this.path, FileTest.EXISTS)) {
63                         GLib.FileUtils.remove(this.path);
64                 }
65                  
66         }
67     
68         public   override void  loadItems() throws GLib.Error // : function(cb, sync) == original was async.
69         {
70            
71            GLib.FileUtils.get_contents(this.path, out this.contents);
72            
73         }
74      
75         
76                 
77         public override string toSourcePreview()
78         {
79                          return "";
80                 }
81                 public override void setSource(string str) {
82                         this.contents = str;
83                 }
84         public override string toSource()
85         {
86                         return this.contents;
87             
88              
89             
90         }
91                 
92         public override void save() {
93             this.writeFile(this.path, this.contents);
94             
95         }
96             // ignore these calls.
97         public override void saveHTML ( string html ) {}
98             
99                     
100         /** 
101          *  saveJS
102          * 
103          * save as a javascript file.
104          * why is this not save...???
105          * 
106          */ 
107          
108    
109         string getHelpUrl(string cls)
110         {
111             return ""; 
112         }
113         public override void  findTransStrings(Node? node )
114                 {
115                         // not yet..
116                 }
117         
118         
119           
120
121                 
122
123         }
124 }
125
126
127