Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Gtk;
- class GLess : Gtk.Window
- {
- private TextView text_view;
- public GLess () {
- this.title = "GLess";
- this.position = WindowPosition.CENTER;
- this.text_view = new TextView();
- this.text_view.editable = false;
- this.text_view.cursor_visible = false;
- var scroll = new ScrolledWindow (null, null);
- scroll.set_policy(PolicyType.AUTOMATIC, PolicyType.AUTOMATIC);
- scroll.add(this.text_view);
- var vbox = new VBox(false, 0);
- vbox.pack_start(scroll, true, true, 0);
- add(vbox);
- var input = new StringBuilder();
- var buffer = new char[1024];
- while (!stdin.eof()) {
- string read_chunk = stdin.gets(buffer);
- if (read_chunk != null) {
- input.append(read_chunk);
- }
- }
- this.text_view.buffer.text = input.str;
- }
- public static int main (string[] args) {
- Gtk.init (ref args);
- var app = new GLess();
- app.show_all();
- app.destroy.connect(Gtk.main_quit);
- Gtk.main();
- return 0;
- }
- }
Add Comment
Please, Sign In to add comment