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                 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(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             
88             this.saveVala();
89         }
90             // ignore these calls.
91         public override void saveHTML ( string html ) {}
92             
93                     
94         /** 
95          *  saveJS
96          * 
97          * save as a javascript file.
98          * why is this not save...???
99          * 
100          */ 
101           
102         void saveJS()
103         {
104              
105             var fn = GLib.Path.get_dirname(this.path) + "/" + this.name + ".js";
106             print("WRITE :%s\n " , fn);
107             this.writeFile(fn, this.toSource());
108             
109         }
110         
111        void  saveVala()
112         {
113                 if (this.tree == null) {
114                         return;
115                 }
116                 var fn = GLib.Path.get_dirname(this.path) + "/" + this.name + ".vala";
117                 print("WRITE :%s\n " , fn);
118                         this.writeFile(fn,  NodeToVala.mungeFile(this));
119             
120             
121         }
122                 /*
123         valaCompileCmd : function()
124         {
125             
126             var fn = '/tmp/' + this.name + '.vala';
127             print("WRITE : " + fn);
128             File.write(fn, this.toVala(true));
129             
130             
131             
132             return ["valac",
133                    "--pkg",  "gio-2.0",
134                    "--pkg" , "posix" ,
135                    "--pkg" , "gtk+-3.0",
136                    "--pkg",  "libnotify",
137                    "--pkg",  "gtksourceview-3.0",
138                    "--pkg", "libwnck-3.0",
139                    fn ,   "-o", "/tmp/" + this.name];
140             
141            
142              
143             
144         },
145         */
146         
147    
148         string getHelpUrl(string cls)
149         {
150             return "http://devel.akbkhome.com/seed/" + cls + ".html";
151         }
152         public override void  findTransStrings(Node? node )
153                 {
154                         // not yet..
155                 }
156         
157         
158           
159
160                 
161
162         }
163 }
164
165
166