| 75 if (condition & GAIM_READ_COND) |
75 if (condition & GAIM_READ_COND) |
| 76 gaim_cond |= GAIM_INPUT_READ; |
76 gaim_cond |= GAIM_INPUT_READ; |
| 77 if (condition & GAIM_WRITE_COND) |
77 if (condition & GAIM_WRITE_COND) |
| 78 gaim_cond |= GAIM_INPUT_WRITE; |
78 gaim_cond |= GAIM_INPUT_WRITE; |
| 79 |
79 |
| |
80 /* |
| 80 debug_printf("CLOSURE: callback for %d, fd is %d\n", |
81 debug_printf("CLOSURE: callback for %d, fd is %d\n", |
| 81 closure->result, g_io_channel_unix_get_fd(source)); |
82 closure->result, g_io_channel_unix_get_fd(source)); |
| |
83 */ |
| 82 |
84 |
| 83 closure->function(closure->data, g_io_channel_unix_get_fd(source), gaim_cond); |
85 closure->function(closure->data, g_io_channel_unix_get_fd(source), gaim_cond); |
| 84 |
86 |
| 85 return TRUE; |
87 return TRUE; |
| 86 } |
88 } |
| 101 |
103 |
| 102 channel = g_io_channel_unix_new(source); |
104 channel = g_io_channel_unix_new(source); |
| 103 closure->result = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT, cond, |
105 closure->result = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT, cond, |
| 104 gaim_io_invoke, closure, gaim_io_destroy); |
106 gaim_io_invoke, closure, gaim_io_destroy); |
| 105 |
107 |
| 106 debug_printf("CLOSURE: adding input watcher %d for fd %d\n", closure->result, source); |
108 /* debug_printf("CLOSURE: adding input watcher %d for fd %d\n", closure->result, source); */ |
| 107 |
109 |
| 108 g_io_channel_unref(channel); |
110 g_io_channel_unref(channel); |
| 109 return closure->result; |
111 return closure->result; |
| 110 } |
112 } |
| 111 |
113 |
| 112 void gaim_input_remove(gint tag) |
114 void gaim_input_remove(gint tag) |
| 113 { |
115 { |
| 114 debug_printf("CLOSURE: removing input watcher %d\n", tag); |
116 /* debug_printf("CLOSURE: removing input watcher %d\n", tag); */ |
| 115 if (tag > 0) |
117 if (tag > 0) |
| 116 g_source_remove(tag); |
118 g_source_remove(tag); |
| 117 } |
119 } |
| 118 |
120 |
| 119 static void no_one_calls(gpointer data, gint source, GaimInputCondition cond) |
121 static void no_one_calls(gpointer data, gint source, GaimInputCondition cond) |