summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--client/application.cpp26
-rw-r--r--client/application.h8
-rw-r--r--client/red_client.cpp10
3 files changed, 16 insertions, 28 deletions
diff --git a/client/application.cpp b/client/application.cpp
index 9add9d37..e96a9c4a 100644
--- a/client/application.cpp
+++ b/client/application.cpp
@@ -62,21 +62,7 @@ void ConnectedEvent::response(AbstractProcessLoop& events_loop)
void DisconnectedEvent::response(AbstractProcessLoop& events_loop)
{
Application* app = static_cast<Application*>(events_loop.get_owner());
-#ifdef RED_DEBUG
- app->show_splash(0);
-#else
- app->do_quit(SPICEC_ERROR_CODE_SUCCESS);
-#endif
-}
-
-void ConnectionErrorEvent::response(AbstractProcessLoop& events_loop)
-{
- Application* app = static_cast<Application*>(events_loop.get_owner());
-#ifdef RED_DEBUG
- app->show_splash(0);
-#else
- app->do_quit(_error_code);
-#endif
+ app->on_disconnected(_error_code);
}
void VisibilityEvent::response(AbstractProcessLoop& events_loop)
@@ -601,6 +587,16 @@ void Application::unpress_all()
void Application::on_connected()
{
+
+}
+
+void Application::on_disconnected(int error_code)
+{
+#ifdef RED_DEBUG
+ show_splash(0);
+#else
+ do_quit(error_code);
+#endif
}
void Application::on_visibility_start(int screen_id)
diff --git a/client/application.h b/client/application.h
index 757ee3a2..c2b81e6c 100644
--- a/client/application.h
+++ b/client/application.h
@@ -44,13 +44,10 @@ public:
class DisconnectedEvent: public Event {
public:
+ DisconnectedEvent() : _error_code (SPICEC_ERROR_CODE_SUCCESS) {}
+ DisconnectedEvent(int error_code) : _error_code (error_code) {}
virtual void response(AbstractProcessLoop& events_loop);
-};
-class ConnectionErrorEvent: public Event {
-public:
- ConnectionErrorEvent(int error_code) : _error_code (error_code) {}
- virtual void response(AbstractProcessLoop& events_loop);
private:
int _error_code;
};
@@ -152,6 +149,7 @@ public:
virtual void on_monitors_change();
virtual void on_display_mode_change();
void on_connected();
+ void on_disconnected(int spice_error_code);
void on_disconnecting();
void on_visibility_start(int screen_id);
diff --git a/client/red_client.cpp b/client/red_client.cpp
index bc9e1128..8fcb81d6 100644
--- a/client/red_client.cpp
+++ b/client/red_client.cpp
@@ -469,14 +469,8 @@ void RedClient::on_channel_disconnected(RedChannel& channel)
if (_notify_disconnect) {
_notify_disconnect = false;
int connection_error = channel.get_connection_error();
- if (connection_error == SPICEC_ERROR_CODE_SUCCESS) {
- AutoRef<DisconnectedEvent> disconn_event(new DisconnectedEvent());
- LOG_INFO("disconneted");
- push_event(*disconn_event);
- } else {
- AutoRef<ConnectionErrorEvent> error_event(new ConnectionErrorEvent(connection_error));
- push_event(*error_event);
- }
+ AutoRef<DisconnectedEvent> disconn_event(new DisconnectedEvent(connection_error));
+ push_event(*disconn_event);
}
disconnect_channels();
RedPeer::disconnect();