diff --git a/src/frontend/stmclient.cc b/src/frontend/stmclient.cc index 18633b0..e4f148c 100644 --- a/src/frontend/stmclient.cc +++ b/src/frontend/stmclient.cc @@ -417,9 +417,7 @@ void STMClient::main( void ) network->tick(); } catch ( Network::NetworkException e ) { if ( !network->shutdown_in_progress() ) { - wchar_t tmp[ 128 ]; - swprintf( tmp, 128, L"%s: %s", e.function.c_str(), strerror( e.the_errno ) ); - overlays.get_notification_engine().set_notification_string( wstring( tmp ) ); + overlays.get_notification_engine().set_network_exception( e ); } struct timespec req; diff --git a/src/frontend/terminaloverlay.h b/src/frontend/terminaloverlay.h index 876a141..68d42e3 100644 --- a/src/frontend/terminaloverlay.h +++ b/src/frontend/terminaloverlay.h @@ -137,12 +137,28 @@ namespace Overlay { bool need_countup( uint64_t ts ) const { return server_late( ts ) || reply_late( ts ); } void adjust_message( void ); void apply( Framebuffer &fb ) const; - void set_notification_string( const wstring &s_message, bool permanent = false ) { message = s_message; if ( permanent ) { message_expiration = -1; } else { message_expiration = timestamp() + 1000; } } const wstring &get_notification_string( void ) const { return message; } void server_heard( uint64_t s_last_word ) { last_word_from_server = s_last_word; } void server_acked( uint64_t s_last_acked ) { last_acked_state = s_last_acked; } uint64_t get_message_expiration( void ) const { return message_expiration; } + void set_notification_string( const wstring &s_message, bool permanent = false ) + { + message = s_message; + if ( permanent ) { + message_expiration = -1; + } else { + message_expiration = timestamp() + 1000; + } + } + + void set_network_exception( const NetworkException &e ) + { + wchar_t tmp[ 128 ]; + swprintf( tmp, 128, L"%s: %s", e.function.c_str(), strerror( e.the_errno ) ); + set_notification_string( wstring( tmp ) ); + } + NotificationEngine(); };