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);
30 public Gee.ArrayList<Xcls_fileitem> fileitems;
33 public Xcls_ClutterFiles()
37 this.el = new Clutter.ScrollActor();
42 this.el.reactive = true;
43 var child_0 = new Xcls_filelayout( _this );
45 this.el.add_child ( child_0.el );
48 this.fileitems = new Gee.ArrayList<Xcls_fileitem>();
51 // userdefined functions
52 public void clearFiles() {
54 this.filelayout.el.remove_all_children();
55 // we need to unref all the chidren that we loaded though...
58 public void loadProject(Project.Project pr) {
59 // list all the files, and create new Xcls_fileitem for each one.
61 // LEAK --- we should unref all the chilren...
64 print("clutter files - load project: " + pr.name +"\n");
65 // should unref.. them hopefully.
66 this.fileitems = new Gee.ArrayList<Xcls_fileitem>();
68 var fiter = pr.files.map_iterator();
69 while (fiter.next()) {
70 var a = new Xcls_fileitem(this,fiter.get_value());
71 this.fileitems.add(a);
74 print("add to clutter file view: " + fiter.get_value().name + "\n");
75 this.filelayout.el.add_child(a.el);
79 public void set_size(float w, float h)
81 if (this.el == null) {
82 print("object not ready yet?");
85 _this.filelayout_manager.el.max_column_width = w - 150;
86 this.el.set_size(this.el.get_stage().width-150,
87 this.el.get_stage().height);
88 this.el.set_position(100,50);
91 // skip |xns - no return type
92 public class Xcls_filelayout : Object
94 public Clutter.Actor el;
95 private Xcls_ClutterFiles _this;
101 public Xcls_filelayout(Xcls_ClutterFiles _owner )
104 _this.filelayout = this;
105 this.el = new Clutter.Actor();
109 // set gobject values
110 this.el.reactive = true;
111 var child_0 = new Xcls_filelayout_manager( _this );
113 this.el.layout_manager = child_0.el;
116 this.el.add_constraint(
117 new Clutter.BindConstraint(_this.el,Clutter.BindCoordinate.SIZE, 0.0f)
121 // userdefined functions
123 // skip |xns - no return type
125 public class Xcls_filelayout_manager : Object
127 public Clutter.FlowLayout el;
128 private Xcls_ClutterFiles _this;
134 public Xcls_filelayout_manager(Xcls_ClutterFiles _owner )
137 _this.filelayout_manager = this;
138 this.el = new Clutter.FlowLayout( Clutter.FlowOrientation.HORIZONTAL );
142 // set gobject values
143 this.el.column_spacing = 20;
144 this.el.homogeneous = true;
145 this.el.row_spacing = 20;
148 // userdefined functions
150 // skip |xns - no return type
152 public class Xcls_fileitem : Object
154 public Clutter.Actor el;
155 private Xcls_ClutterFiles _this;
159 public JsRender.JsRender file;
160 public Xcls_image image;
161 public Xcls_typetitle typetitle;
162 public Xcls_title title;
165 public Xcls_fileitem(Xcls_ClutterFiles _owner , JsRender.JsRender file)
168 this.el = new Clutter.Actor();
172 // set gobject values
173 this.el.reactive = true;
174 var child_0 = new Xcls_BoxLayout5( _this );
176 this.el.layout_manager = child_0.el;
177 var child_1 = new Xcls_image( _this ,file);
179 this.el.add_child ( child_1.el );
180 this.image = child_1;
181 var child_2 = new Xcls_typetitle( _this ,file);
183 this.el.add_child ( child_2.el );
184 this.typetitle = child_2;
185 var child_3 = new Xcls_title( _this ,file);
187 this.el.add_child ( child_3.el );
188 this.title = child_3;
192 this.el.set_size(100,100);
195 this.el.enter_event.connect( ( event) => {
196 this.el.background_color = new Clutter.Color.from_string("#333");
199 this.el.leave_event.connect( ( event) => {
200 this.el.background_color = new Clutter.Color.from_string("#000");
203 this.el.button_press_event.connect( ( event) => {
204 _this.open(this.file);
209 // userdefined functions
211 // skip |xns - no return type
213 public class Xcls_BoxLayout5 : Object
215 public Clutter.BoxLayout el;
216 private Xcls_ClutterFiles _this;
222 public Xcls_BoxLayout5(Xcls_ClutterFiles _owner )
225 this.el = new Clutter.BoxLayout();
229 // set gobject values
230 this.el.orientation = Clutter.Orientation.VERTICAL;
234 // userdefined functions
236 // skip |xns - no return type
238 public class Xcls_image : Object
240 public Clutter.Texture el;
241 private Xcls_ClutterFiles _this;
247 public Xcls_image(Xcls_ClutterFiles _owner , JsRender.JsRender file)
250 this.el = new Clutter.Texture.from_file(file.getIconFileName(true));
254 // set gobject values
255 this.el.margin_left = 5;
256 this.el.margin_right = 5;
257 this.el.margin_top = 5;
258 this.el.x_align = Clutter.ActorAlign.START;
259 this.el.x_expand = true;
260 this.el.y_align = Clutter.ActorAlign.START;
261 this.el.y_expand = false;
264 // userdefined functions
266 // skip |xns - no return type
268 public class Xcls_typetitle : Object
270 public Clutter.Text el;
271 private Xcls_ClutterFiles _this;
277 public Xcls_typetitle(Xcls_ClutterFiles _owner , JsRender.JsRender file)
280 this.el = new Clutter.Text.full("Sans 10px", file.nickType(),new Clutter.Color.from_string("#fff"));
284 // set gobject values
285 this.el.x_align = Clutter.ActorAlign.START;
286 this.el.x_expand = true;
287 this.el.y_align = Clutter.ActorAlign.START;
288 this.el.y_expand = false;
291 // userdefined functions
293 // skip |xns - no return type
295 public class Xcls_title : Object
297 public Clutter.Text el;
298 private Xcls_ClutterFiles _this;
304 public Xcls_title(Xcls_ClutterFiles _owner , JsRender.JsRender file)
307 this.el = new Clutter.Text.full("Sans 10px", file.nickName(),new Clutter.Color.from_string("#fff"));
311 // set gobject values
312 this.el.x_align = Clutter.ActorAlign.START;
313 this.el.x_expand = true;
314 this.el.y_align = Clutter.ActorAlign.START;
315 this.el.y_expand = false;
318 // userdefined functions
320 // skip |xns - no return type