Skip to content

Instantly share code, notes, and snippets.

@davidboy
Created August 10, 2011 00:18
Show Gist options
  • Save davidboy/1135605 to your computer and use it in GitHub Desktop.
Save davidboy/1135605 to your computer and use it in GitHub Desktop.
using Gtk;
using WebKit;
public class CatbirdWindow : Window {
private WebView web_view;
public CatbirdWindow () {
this.title = "Catbird";
set_default_size (800, 600);
create_widgets ();
connect_signals ();
}
private void create_widgets () {
this.web_view = new WebView ();
var scrolled_window = new ScrolledWindow (null, null);
scrolled_window.set_policy (PolicyType.AUTOMATIC, PolicyType.AUTOMATIC);
scrolled_window.add (this.web_view);
add (scrolled_window);
}
private void connect_signals () {
this.destroy.connect (Gtk.main_quit);
this.web_view.load_error.connect ((view, frame, uri, error) => {
Thread.usleep (200000);
this.web_view.load_uri ("http://localhost:3000");
return true;
});
}
public void run () {
show_all ();
this.web_view.open ("http://localhost:3000");
}
public static int main (string[] args) {
Gtk.init (ref args);
var catbird = new CatbirdWindow ();
catbird.run ();
Gtk.main ();
return 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment