Mercurial > pidgin
comparison src/gtkeventloop.c @ 8280:084ed9f7ac19
[gaim-migrate @ 9004]
Soem tweaks from Scott Lamb for the event loop code.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Tue, 17 Feb 2004 08:43:44 +0000 |
parents | f24172f53650 |
children | ef881489396e |
comparison
equal
deleted
inserted
replaced
8279:319448d52b33 | 8280:084ed9f7ac19 |
---|---|
61 closure->function(closure->data, g_io_channel_unix_get_fd(source), gaim_cond); | 61 closure->function(closure->data, g_io_channel_unix_get_fd(source), gaim_cond); |
62 | 62 |
63 return TRUE; | 63 return TRUE; |
64 } | 64 } |
65 | 65 |
66 static gint gaim_gtk_input_add(gint source, GaimInputCondition condition, GaimInputFunction function, | 66 static guint gaim_gtk_input_add(gint fd, GaimInputCondition condition, GaimInputFunction function, |
67 gpointer data) | 67 gpointer data) |
68 { | 68 { |
69 GaimGtkIOClosure *closure = g_new0(GaimGtkIOClosure, 1); | 69 GaimGtkIOClosure *closure = g_new0(GaimGtkIOClosure, 1); |
70 GIOChannel *channel; | 70 GIOChannel *channel; |
71 GIOCondition cond = 0; | 71 GIOCondition cond = 0; |
76 if (condition & GAIM_INPUT_READ) | 76 if (condition & GAIM_INPUT_READ) |
77 cond |= GAIM_GTK_READ_COND; | 77 cond |= GAIM_GTK_READ_COND; |
78 if (condition & GAIM_INPUT_WRITE) | 78 if (condition & GAIM_INPUT_WRITE) |
79 cond |= GAIM_GTK_WRITE_COND; | 79 cond |= GAIM_GTK_WRITE_COND; |
80 | 80 |
81 channel = g_io_channel_unix_new(source); | 81 channel = g_io_channel_unix_new(fd); |
82 closure->result = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT, cond, | 82 closure->result = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT, cond, |
83 gaim_gtk_io_invoke, closure, gaim_gtk_io_destroy); | 83 gaim_gtk_io_invoke, closure, gaim_gtk_io_destroy); |
84 | 84 |
85 #if 0 | 85 #if 0 |
86 gaim_debug(GAIM_DEBUG_MISC, "gtk_eventloop", | 86 gaim_debug(GAIM_DEBUG_MISC, "gtk_eventloop", |
87 "CLOSURE: adding input watcher %d for fd %d\n", | 87 "CLOSURE: adding input watcher %d for fd %d\n", |
88 closure->result, source); | 88 closure->result, fd); |
89 #endif | 89 #endif |
90 | 90 |
91 g_io_channel_unref(channel); | 91 g_io_channel_unref(channel); |
92 return closure->result; | 92 return closure->result; |
93 } | 93 } |
94 | 94 |
95 static void gaim_gtk_input_remove(gint tag) | 95 static void gaim_gtk_input_remove(guint tag) |
96 { | 96 { |
97 /* gaim_debug(GAIM_DEBUG_MISC, "proxy", | 97 /* gaim_debug(GAIM_DEBUG_MISC, "proxy", |
98 "CLOSURE: removing input watcher %d\n", tag); */ | 98 "CLOSURE: removing input watcher %d\n", tag); */ |
99 if (tag > 0) | 99 if (tag > 0) |
100 g_source_remove(tag); | 100 g_source_remove(tag); |