2 valac --pkg gio-2.0 --pkg posix --pkg gtk+-3.0 --pkg libnotify --pkg gtksourceview-3.0 --pkg libwnck-3.0 \
3 /tmp/ClutterFiles.vala -o /tmp/ClutterFiles
8 static int main (string[] args) {
10 new Xcls_ClutterFiles();
11 ClutterFiles.show_all();
18 public static Xcls_ClutterFiles ClutterFiles;
20 public class Xcls_ClutterFiles : Object
22 public Clutter.ScrollActor el;
23 private Xcls_ClutterFiles _this;
25 public Xcls_filelayout filelayout;
26 public Xcls_filelayout_manager filelayout_manager;
29 public signal void open(JsRender.JsRender file);
32 public Xcls_ClutterFiles()
36 this.el = new Clutter.ScrollActor();
41 this.el.reactive = true;
42 var child_0 = new Xcls_filelayout( _this );
44 this.el.add_child ( child_0.el );
47 this.fileitems = new Gee.ArrayList<Xcls_fileitem>();
50 // userdefined functions
52 // skip |xns - no return type
53 public void clearFiles() {
55 this.filelayout.el.remove_all_children();
56 // we need to unref all the chidren that we loaded though...
59 public void loadProject(Project.Project pr) {
60 // list all the files, and create new Xcls_fileitem for each one.
62 // LEAK --- we should unref all the chilren...
65 print("clutter files - load project: " + pr.name +"\n");
66 // should unref.. them hopefully.
67 this.fileitems = new Gee.ArrayList<Xcls_fileitem>();
69 var fiter = pr.files.map_iterator();
70 while (fiter.next()) {
71 var a = new Xcls_fileitem(this,fiter.get_value());
72 this.fileitems.add(a);
75 print("add to clutter file view: " + fiter.get_value().name + "\n");
76 this.filelayout.el.add_child(a.el);
80 public void set_size(float w, float h)
82 if (this.el == null) {
83 print("object not ready yet?");
86 _this.filelayout_manager.el.max_column_width = w - 150;
87 this.el.set_size(this.el.get_stage().width-150,
88 this.el.get_stage().height);
89 this.el.set_position(100,50);
91 public class Xcls_filelayout : Object
93 public Clutter.Actor el;
94 private Xcls_ClutterFiles _this;
100 public Xcls_filelayout(Xcls_ClutterFiles _owner )
103 _this.filelayout = this;
104 this.el = new Clutter.Actor();
108 // set gobject values
109 this.el.reactive = true;
110 var child_0 = new Xcls_filelayout_manager( _this );
112 this.el.layout_manager = child_0.el;
115 this.el.add_constraint(
116 new Clutter.BindConstraint(_this.el,Clutter.BindCoordinate.SIZE, 0.0f)
120 // userdefined functions
122 // skip |xns - no return type
124 public class Xcls_filelayout_manager : Object
126 public Clutter.FlowLayout el;
127 private Xcls_ClutterFiles _this;
133 public Xcls_filelayout_manager(Xcls_ClutterFiles _owner )
136 _this.filelayout_manager = this;
137 this.el = new Clutter.FlowLayout( Clutter.FlowOrientation.HORIZONTAL );
141 // set gobject values
142 this.el.column_spacing = 20;
143 this.el.homogeneous = true;
144 this.el.row_spacing = 20;
147 // userdefined functions
149 // skip |xns - no return type
151 public class Xcls_fileitem : Object
153 public Clutter.Actor el;
154 private Xcls_ClutterFiles _this;
158 public JsRender.JsRender file;
159 public Xcls_image image;
160 public Xcls_typetitle typetitle;
161 public Xcls_title title;
164 public Xcls_fileitem(Xcls_ClutterFiles _owner , JsRender.JsRender file)
167 this.el = new Clutter.Actor();
171 // set gobject values
172 this.el.reactive = true;
173 var child_0 = new Xcls_BoxLayout5( _this );
175 this.el.layout_manager = child_0.el;
176 var child_1 = new Xcls_image( _this ,file);
178 this.el.add_child ( child_1.el );
179 this.image = child_1;
180 var child_2 = new Xcls_typetitle( _this ,file);
182 this.el.add_child ( child_2.el );
183 this.typetitle = child_2;
184 var child_3 = new Xcls_title( _this ,file);
186 this.el.add_child ( child_3.el );
187 this.title = child_3;
191 this.el.set_size(100,100);
194 this.el.enter_event.connect( ( event) => {
195 this.el.background_color = new Clutter.Color.from_string("#333");
198 this.el.leave_event.connect( ( event) => {
199 this.el.background_color = new Clutter.Color.from_string("#000");
202 this.el.button_press_event.connect( ( event) => {
203 _this.open(this.file);
208 // userdefined functions
210 // skip |xns - no return type
212 public class Xcls_BoxLayout5 : Object
214 public Clutter.BoxLayout el;
215 private Xcls_ClutterFiles _this;
221 public Xcls_BoxLayout5(Xcls_ClutterFiles _owner )
224 this.el = new Clutter.BoxLayout();
228 // set gobject values
229 this.el.orientation = Clutter.Orientation.VERTICAL;
233 // userdefined functions
235 // skip |xns - no return type
237 public class Xcls_image : Object
239 public Clutter.Texture el;
240 private Xcls_ClutterFiles _this;
246 public Xcls_image(Xcls_ClutterFiles _owner , JsRender.JsRender file)
249 this.el = new Clutter.Texture.from_file(file.getIconFileName(true));
253 // set gobject values
254 this.el.margin_left = 5;
255 this.el.margin_right = 5;
256 this.el.margin_top = 5;
257 this.el.x_align = Clutter.ActorAlign.START;
258 this.el.x_expand = true;
259 this.el.y_align = Clutter.ActorAlign.START;
260 this.el.y_expand = false;
263 // userdefined functions
265 // skip |xns - no return type
267 public class Xcls_typetitle : Object
269 public Clutter.Text el;
270 private Xcls_ClutterFiles _this;
276 public Xcls_typetitle(Xcls_ClutterFiles _owner , JsRender.JsRender file)
279 this.el = new Clutter.Text.full("Sans 10px", file.nickType(),new Clutter.Color.from_string("#fff"));
283 // set gobject values
284 this.el.x_align = Clutter.ActorAlign.START;
285 this.el.x_expand = true;
286 this.el.y_align = Clutter.ActorAlign.START;
287 this.el.y_expand = false;
290 // userdefined functions
292 // skip |xns - no return type
294 public class Xcls_title : Object
296 public Clutter.Text el;
297 private Xcls_ClutterFiles _this;
303 public Xcls_title(Xcls_ClutterFiles _owner , JsRender.JsRender file)
306 this.el = new Clutter.Text.full("Sans 10px", file.nickName(),new Clutter.Color.from_string("#fff"));
310 // set gobject values
311 this.el.x_align = Clutter.ActorAlign.START;
312 this.el.x_expand = true;
313 this.el.y_align = Clutter.ActorAlign.START;
314 this.el.y_expand = false;
317 // userdefined functions
319 // skip |xns - no return type