Skip to content

Instantly share code, notes, and snippets.

@arteymix
Created June 30, 2017 14:05
Show Gist options
  • Save arteymix/28252bcc99fe7fdafaa4b254cecc8e11 to your computer and use it in GitHub Desktop.
Save arteymix/28252bcc99fe7fdafaa4b254cecc8e11 to your computer and use it in GitHub Desktop.
class ErrorHandler {
public signal void publish (Error err);
private static ErrorHandler _default;
public static ErrorHandler get_default () {
if (_default == null) {
_default = new ErrorHandler ();
}
return _default;
}
}
// from the main window
ErrorHandler.get_default ().publish.connect ((err) => {
// handle error
});
// from the GtkBox
ErrorHandler.get_default ().publish (new IOError.FAILED (""));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment