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             
28             // fixme...
29             this.language = "vala";
30             
31                         this.contents = "";
32             
33             // super?!?!
34             this.id = "file-plain-%d".printf(plid++);
35             //console.dump(this);
36             // various loader methods..
37
38             // Class = list of arguments ... and which property to use as a value.
39        
40
41             
42             
43         }
44           
45
46         /*
47         setNSID : function(id)
48         {
49             
50             this.items[0]['*class'] = id;
51             
52             
53         },
54         getType: function() {
55             return 'Gtk';
56         },
57         */
58
59                 public   override void   removeFiles() {
60                         if (FileUtils.test(this.path, FileTest.EXISTS)) {
61                                 GLib.FileUtils.remove(this.path);
62                         }
63                          
64                 }
65         
66                 public   override void  loadItems() throws GLib.Error // : function(cb, sync) == original was async.
67                 {
68                    
69                    GLib.FileUtils.get_contents(this.path, out this.contents);
70                    
71                 }
72          
73         
74                 
75         public override string toSourcePreview()
76         {
77                          return "";
78                 }
79                 public override void setSource(string str) {
80                         this.contents = str;
81                 }
82         public override string toSource()
83         {
84                         return this.contents;
85             
86              
87             
88         }
89                 
90         public override void save() {
91             this.writeFile(this.path, this.contents);
92             
93         }
94             // ignore these calls.
95         public override void saveHTML ( string html ) {}
96             
97                     
98         /** 
99          *  saveJS
100          * 
101          * save as a javascript file.
102          * why is this not save...???
103          * 
104          */ 
105          
106    
107         string getHelpUrl(string cls)
108         {
109             return ""; 
110         }
111         public override void  findTransStrings(Node? node )
112                 {
113                         // not yet..
114                 }
115         
116         
117           
118
119                 
120
121         }
122 }
123
124
125