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 gid = 1;
16
17   
18     public  class PlainFile : JsRender
19     {
20        
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           
32             
33             // super?!?!
34             this.id = "file-plain-%d".printf(gid++);
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.pat, FileTest.EXISTS)) {
61                                 GLib.FileUtils.remove(this.pat);
62                         }
63                          
64                 }
65         
66                 public   override void  loadItems() throws GLib.Error // : function(cb, sync) == original was async.
67                 {
68                    return;
69                 }
70          
71         
72                 
73         public override string toSourcePreview()
74         {
75                         return "";
76                 }
77       
78         public override string toSource()
79         {
80                         return "";
81             
82              
83             
84         }
85                 
86         public override void save() {
87             this.saveBJS();
88             // this.saveJS(); - disabled at present.. project settings will probably enable this later..
89                 
90             this.saveVala();
91         }
92             // ignore these calls.
93         public override void saveHTML ( string html ) {}
94             
95                     
96         /** 
97          *  saveJS
98          * 
99          * save as a javascript file.
100          * why is this not save...???
101          * 
102          */ 
103           
104         void saveJS()
105         {
106              
107             var fn = GLib.Path.get_dirname(this.path) + "/" + this.name + ".js";
108             print("WRITE :%s\n " , fn);
109             this.writeFile(fn, this.toSource());
110             
111         }
112         
113        void  saveVala()
114         {
115                 if (this.tree == null) {
116                         return;
117                 }
118                 var fn = GLib.Path.get_dirname(this.path) + "/" + this.name + ".vala";
119                 print("WRITE :%s\n " , fn);
120                         this.writeFile(fn,  NodeToVala.mungeFile(this));
121             
122             
123         }
124                 /*
125         valaCompileCmd : function()
126         {
127             
128             var fn = '/tmp/' + this.name + '.vala';
129             print("WRITE : " + fn);
130             File.write(fn, this.toVala(true));
131             
132             
133             
134             return ["valac",
135                    "--pkg",  "gio-2.0",
136                    "--pkg" , "posix" ,
137                    "--pkg" , "gtk+-3.0",
138                    "--pkg",  "libnotify",
139                    "--pkg",  "gtksourceview-3.0",
140                    "--pkg", "libwnck-3.0",
141                    fn ,   "-o", "/tmp/" + this.name];
142             
143            
144              
145             
146         },
147         */
148         
149    
150         string getHelpUrl(string cls)
151         {
152             return "http://devel.akbkhome.com/seed/" + cls + ".html";
153         }
154         public override void  findTransStrings(Node? node )
155                 {
156                         // not yet..
157                 }
158         
159         
160           
161
162                 
163
164         }
165 }
166
167
168