chiark / gitweb /
update control buttons when disconnection detected
[disorder] / disobedience / client.c
index d03e9de2776ed89ed906c3333f673a1ed411c4c0..ea0dbd9acd321f21042c9c808399ea4320fb4fb4 100644 (file)
@@ -110,6 +110,8 @@ static void gtkclient_poll(void *u,
 static void gtkclient_comms_error(void attribute((unused)) *u,
                                  const char *msg) {
   D(("gtkclient_comms_error %s", msg));
+  /* Control buttons might have become unusable */
+  control_update();
   gtk_label_set_text(GTK_LABEL(report_label), msg);
 }
 
@@ -161,6 +163,10 @@ disorder_eclient *gtkclient(void) {
   esource = (struct eclient_source *)source;
   esource->pollfd.fd = -1;
   esource->client = disorder_eclient_new(&gtkclient_callbacks, source);
+  if(!esource->client) {
+    g_source_destroy(source);
+    return 0;
+  }
   g_source_attach(source, 0);
   return esource->client;
 }
@@ -173,4 +179,3 @@ fill-column:79
 indent-tabs-mode:nil
 End:
 */
-/* arch-tag:32Qju8BYS5FZvqbPHElgcg */