Trim aoview_serial_set_callback args down to just port and callback
authorKeith Packard <keithp@keithp.com>
Sat, 18 Jul 2009 07:43:22 +0000 (00:43 -0700)
committerKeith Packard <keithp@keithp.com>
Sat, 18 Jul 2009 07:43:22 +0000 (00:43 -0700)
aoview/aoview.h
aoview/aoview_eeprom.c
aoview/aoview_monitor.c
aoview/aoview_serial.c

index 800349ec09c68ed9b1f1ce054e40dcd3e434a9b7..4ed0ffaba51804005c83fd05a42ba7419c06f137 100644 (file)
@@ -160,9 +160,7 @@ typedef void (*aoview_serial_callback)(gpointer user_data, struct aoview_serial
 
 void
 aoview_serial_set_callback(struct aoview_serial *serial,
-                          aoview_serial_callback func,
-                          gpointer data,
-                          GDestroyNotify notify);
+                          aoview_serial_callback func);
 
 void
 aoview_serial_printf(struct aoview_serial *serial, char *format, ...);
index 826afc43390354837dae423e180d461ead5ff17f..34e2deedad12c0aa7bece87e4fc1ec4594daa6f8 100644 (file)
@@ -140,7 +140,7 @@ aoview_eeprom_save(const char *device)
        serial = aoview_serial_open(device);
        if (!serial)
                return FALSE;
-       aoview_serial_set_callback(serial, aoview_eeprom_callback, serial, NULL);
+       aoview_serial_set_callback(serial, aoview_eeprom_callback);
        aoview_serial_printf(serial, "v\nl\n");
        return TRUE;
 }
index 8d120091ab2209a466298c1362d61db3e5d7182e..dd0e60196515924eccc7a65e80859fa6a9a99624 100644 (file)
@@ -189,8 +189,6 @@ aoview_monitor_connect(char *tty)
        aoview_table_clear();
        aoview_state_reset();
        aoview_serial_set_callback(monitor_serial,
-                                  aoview_monitor_callback,
-                                  monitor_serial,
-                                  NULL);
+                                  aoview_monitor_callback);
        return TRUE;
 }
index 1d8fefcedc94cb9ee1df1135bbb57cef005cbf56..f5142ea51ad4e8a8a07aac36eca47143bcf08714 100644 (file)
@@ -250,6 +250,7 @@ aoview_serial_open(const char *tty)
        serial->poll_fd.events = G_IO_IN | G_IO_OUT | G_IO_HUP | G_IO_ERR;
        g_source_attach(&serial->source, NULL);
        g_source_add_poll(&serial->source,&serial->poll_fd);
+       aoview_serial_set_callback(serial, NULL);
        return serial;
 }
 
@@ -257,16 +258,13 @@ void
 aoview_serial_close(struct aoview_serial *serial)
 {
        g_source_remove_poll(&serial->source, &serial->poll_fd);
+       close(serial->fd);
        g_source_destroy(&serial->source);
-       g_source_unref(&serial->source);
-       free(serial);
 }
 
 void
 aoview_serial_set_callback(struct aoview_serial *serial,
-                          aoview_serial_callback func,
-                          gpointer data,
-                          GDestroyNotify notify)
+                          aoview_serial_callback func)
 {
-       g_source_set_callback(&serial->source, (GSourceFunc) func, data, notify);
+       g_source_set_callback(&serial->source, (GSourceFunc) func, serial, NULL);
 }