Mercurial > pidgin.yaz
comparison pidgin/gtkeventloop.c @ 22959:2555e069cd8c
Add the ability on win32 to choose at runtime whether we use the GIOChannel
implementation from glib or the one in libpurple. I'm not sure if anyone else
will use this, but I've used it for testing and here it is.
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Thu, 15 May 2008 19:53:05 +0000 |
parents | 6bf32c9e15a7 |
children | fd2d15e57763 |
comparison
equal
deleted
inserted
replaced
22958:f1dfc0d70d19 | 22959:2555e069cd8c |
---|---|
85 gpointer data) | 85 gpointer data) |
86 { | 86 { |
87 PidginIOClosure *closure = g_new0(PidginIOClosure, 1); | 87 PidginIOClosure *closure = g_new0(PidginIOClosure, 1); |
88 GIOChannel *channel; | 88 GIOChannel *channel; |
89 GIOCondition cond = 0; | 89 GIOCondition cond = 0; |
90 #ifdef _WIN32 | |
91 static int use_glib_io_channel = -1; | |
92 | |
93 if (use_glib_io_channel == -1) | |
94 use_glib_io_channel = (g_getenv("PIDGIN_GLIB_IO_CHANNEL") != NULL) ? 1 : 0; | |
95 #endif | |
90 | 96 |
91 closure->function = function; | 97 closure->function = function; |
92 closure->data = data; | 98 closure->data = data; |
93 | 99 |
94 if (condition & PURPLE_INPUT_READ) | 100 if (condition & PURPLE_INPUT_READ) |
95 cond |= PIDGIN_READ_COND; | 101 cond |= PIDGIN_READ_COND; |
96 if (condition & PURPLE_INPUT_WRITE) | 102 if (condition & PURPLE_INPUT_WRITE) |
97 cond |= PIDGIN_WRITE_COND; | 103 cond |= PIDGIN_WRITE_COND; |
98 | 104 |
99 #ifdef _WIN32 | 105 #ifdef _WIN32 |
100 channel = wpurple_g_io_channel_win32_new_socket(fd); | 106 if (use_glib_io_channel == 0) |
101 #else | 107 channel = wpurple_g_io_channel_win32_new_socket(fd); |
108 else | |
109 #endif | |
102 channel = g_io_channel_unix_new(fd); | 110 channel = g_io_channel_unix_new(fd); |
103 #endif | 111 |
104 closure->result = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT, cond, | 112 closure->result = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT, cond, |
105 pidgin_io_invoke, closure, pidgin_io_destroy); | 113 pidgin_io_invoke, closure, pidgin_io_destroy); |
106 | 114 |
107 #if 0 | 115 #if 0 |
108 purple_debug(PURPLE_DEBUG_MISC, "gtk_eventloop", | 116 purple_debug(PURPLE_DEBUG_MISC, "gtk_eventloop", |