diegotoral

JavaScript and Vte

May 16th, 2012
97
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const Gtk = imports.gi.Gtk;
  2. const GLib = imports.gi.GLib;
  3. const Vte = imports.gi.Vte;
  4.  
  5. // Initialize the gtk
  6. Gtk.init(null, 0);
  7.  
  8. let mwindow = new Gtk.Window ({type : Gtk.WindowType.TOPLEVEL});
  9. let label = new Gtk.Label ({label : "Hello World"});
  10. let terminal = new Vte.Terminal ();
  11.  
  12. let pty = terminal.pty_new (Vte.PtyFlags.DEFAULT);
  13. terminal.set_pty_object (pty);
  14.  
  15. //var argv = [];
  16. //terminal.fork_command_full (Vte.PtyFlags.DEFAULT, null, argv, null, GLib.SpawnFlags.DO_NOT_REPEAT_CHILD, null, null, null);
  17.  
  18. // Set the window title
  19. mwindow.title = "Hello World!";
  20. mwindow.connect ("destroy", function(){Gtk.main_quit()});
  21.  
  22. // Add the label
  23. mwindow.add (terminal);
  24.  
  25. // Show the widgets
  26. mwindow.show_all();
  27.  
  28. Gtk.main();
RAW Paste Data