Guest User

Untitled

a guest
Oct 20th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. using Gtk;
  2.  
  3. class GLess : Gtk.Window
  4. {
  5. private TextView text_view;
  6.  
  7. public GLess () {
  8. this.title = "GLess";
  9. this.position = WindowPosition.CENTER;
  10.  
  11. this.text_view = new TextView();
  12. this.text_view.editable = false;
  13. this.text_view.cursor_visible = false;
  14.  
  15. var scroll = new ScrolledWindow (null, null);
  16. scroll.set_policy(PolicyType.AUTOMATIC, PolicyType.AUTOMATIC);
  17. scroll.add(this.text_view);
  18.  
  19. var vbox = new VBox(false, 0);
  20. vbox.pack_start(scroll, true, true, 0);
  21. add(vbox);
  22.  
  23. var input = new StringBuilder();
  24. var buffer = new char[1024];
  25.  
  26. while (!stdin.eof()) {
  27. string read_chunk = stdin.gets(buffer);
  28. if (read_chunk != null) {
  29. input.append(read_chunk);
  30. }
  31. }
  32.  
  33. this.text_view.buffer.text = input.str;
  34. }
  35.  
  36. public static int main (string[] args) {
  37. Gtk.init (ref args);
  38.  
  39. var app = new GLess();
  40. app.show_all();
  41.  
  42. app.destroy.connect(Gtk.main_quit);
  43.  
  44. Gtk.main();
  45.  
  46.  
  47. return 0;
  48. }
  49. }
Add Comment
Please, Sign In to add comment