| 77 guint result; |
77 guint result; |
| 78 gpointer data; |
78 gpointer data; |
| 79 |
79 |
| 80 } GaimGtkIOClosure; |
80 } GaimGtkIOClosure; |
| 81 |
81 |
| 82 static void gaim_gtk_io_destroy(gpointer data) |
82 static void gaim_gnt_io_destroy(gpointer data) |
| 83 { |
83 { |
| 84 g_free(data); |
84 g_free(data); |
| 85 } |
85 } |
| 86 |
86 |
| 87 static gboolean gaim_gtk_io_invoke(GIOChannel *source, GIOCondition condition, gpointer data) |
87 static gboolean gaim_gnt_io_invoke(GIOChannel *source, GIOCondition condition, gpointer data) |
| 88 { |
88 { |
| 89 GaimGtkIOClosure *closure = data; |
89 GaimGtkIOClosure *closure = data; |
| 90 GaimInputCondition gaim_cond = 0; |
90 GaimInputCondition gaim_cond = 0; |
| 91 |
91 |
| 92 if (condition & GAIM_GTK_READ_COND) |
92 if (condition & GAIM_GTK_READ_COND) |
| 101 #endif |
101 #endif |
| 102 |
102 |
| 103 #ifdef _WIN32 |
103 #ifdef _WIN32 |
| 104 if(! gaim_cond) { |
104 if(! gaim_cond) { |
| 105 #if DEBUG |
105 #if DEBUG |
| 106 gaim_debug(GAIM_DEBUG_MISC, "gtk_eventloop", |
106 gaim_debug_misc("gnt_eventloop", |
| 107 "CLOSURE received GIOCondition of 0x%x, which does not" |
107 "CLOSURE received GIOCondition of 0x%x, which does not" |
| 108 " match 0x%x (READ) or 0x%x (WRITE)\n", |
108 " match 0x%x (READ) or 0x%x (WRITE)\n", |
| 109 condition, GAIM_GTK_READ_COND, GAIM_GTK_WRITE_COND); |
109 condition, GAIM_GTK_READ_COND, GAIM_GTK_WRITE_COND); |
| 110 #endif /* DEBUG */ |
110 #endif /* DEBUG */ |
| 111 |
111 |
| 134 if (condition & GAIM_INPUT_WRITE) |
134 if (condition & GAIM_INPUT_WRITE) |
| 135 cond |= GAIM_GTK_WRITE_COND; |
135 cond |= GAIM_GTK_WRITE_COND; |
| 136 |
136 |
| 137 channel = g_io_channel_unix_new(fd); |
137 channel = g_io_channel_unix_new(fd); |
| 138 closure->result = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT, cond, |
138 closure->result = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT, cond, |
| 139 gaim_gtk_io_invoke, closure, gaim_gtk_io_destroy); |
139 gaim_gnt_io_invoke, closure, gaim_gnt_io_destroy); |
| 140 |
140 |
| 141 g_io_channel_unref(channel); |
141 g_io_channel_unref(channel); |
| 142 return closure->result; |
142 return closure->result; |
| 143 } |
143 } |
| 144 |
144 |
| 324 int main(int argc, char **argv) |
324 int main(int argc, char **argv) |
| 325 { |
325 { |
| 326 /* XXX: Don't puke */ |
326 /* XXX: Don't puke */ |
| 327 freopen(".error", "w", stderr); |
327 freopen(".error", "w", stderr); |
| 328 |
328 |
| |
329 signal(SIGPIPE, SIG_IGN); |
| |
330 |
| 329 /* Initialize the libgaim stuff */ |
331 /* Initialize the libgaim stuff */ |
| 330 if (!init_libgaim(argc, argv)) |
332 if (!init_libgaim(argc, argv)) |
| 331 return 0; |
333 return 0; |
| 332 |
334 |
| 333 /* Initialize and run the UI */ |
335 /* Initialize and run the UI */ |