[gtk-vnc] Improve error message in gvncviewer when connection fails



commit 7f223d491c93d1aab8b7671d5e6b925ea501f722
Author: Michal Suchanek <hramrach centrum cz>
Date:   Sat Mar 20 18:34:08 2010 +0000

    Improve error message in gvncviewer when connection fails
    
    The 'vnc-disconnected' signal is emitted both when a connection
    closes, and when a connection fails to initialize at all. The
    gvncviewer demo was not taking account of this, so providing a
    misleading diagnostic message
    
    * examples/gvncviewer.c: Distinguish errors conditions in
      disconnect signal

 examples/gvncviewer.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/examples/gvncviewer.c b/examples/gvncviewer.c
index 28b0fb8..c3fbd74 100644
--- a/examples/gvncviewer.c
+++ b/examples/gvncviewer.c
@@ -84,9 +84,12 @@ static void vnc_ungrab(GtkWidget *vncdisplay, GtkWidget *window)
 	set_title(VNC_DISPLAY(vncdisplay), window, FALSE);
 }
 
+static int connected = 0;
+
 static void vnc_connected(GtkWidget *vncdisplay G_GNUC_UNUSED)
 {
 	printf("Connected to server\n");
+	connected = 1;
 }
 
 static void vnc_initialized(GtkWidget *vncdisplay, GtkWidget *window)
@@ -110,7 +113,10 @@ static void vnc_desktop_resize(GtkWidget *vncdisplay G_GNUC_UNUSED,
 
 static void vnc_disconnected(GtkWidget *vncdisplay G_GNUC_UNUSED)
 {
-	printf("Disconnected from server\n");
+	if(connected)
+		printf("Disconnected from server\n");
+	else
+		printf("Failed to connect to server\n");
 	gtk_main_quit();
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]