changeset 22957: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 f1dfc0d70d19
children 52edd9681dd9
files pidgin/Makefile.mingw pidgin/gtkeventloop.c
diffstat 2 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/Makefile.mingw	Thu May 15 15:22:04 2008 +0000
+++ b/pidgin/Makefile.mingw	Thu May 15 19:53:05 2008 +0000
@@ -20,8 +20,6 @@
 
 LDFLAGS := $(WINAPP)
 
-#CFLAGS += -DWINPIDGIN_USE_GLIB_IO_CHANNEL=1
-
 ##
 ## INCLUDE PATHS
 ##
--- a/pidgin/gtkeventloop.c	Thu May 15 15:22:04 2008 +0000
+++ b/pidgin/gtkeventloop.c	Thu May 15 19:53:05 2008 +0000
@@ -87,6 +87,12 @@
 	PidginIOClosure *closure = g_new0(PidginIOClosure, 1);
 	GIOChannel *channel;
 	GIOCondition cond = 0;
+#ifdef _WIN32
+	static int use_glib_io_channel = -1;
+
+	if (use_glib_io_channel == -1)
+		use_glib_io_channel = (g_getenv("PIDGIN_GLIB_IO_CHANNEL") != NULL) ? 1 : 0;
+#endif
 
 	closure->function = function;
 	closure->data = data;
@@ -97,10 +103,12 @@
 		cond |= PIDGIN_WRITE_COND;
 
 #ifdef _WIN32
-	channel = wpurple_g_io_channel_win32_new_socket(fd);
-#else
+	if (use_glib_io_channel == 0)
+		channel = wpurple_g_io_channel_win32_new_socket(fd);
+	else
+#endif
 	channel = g_io_channel_unix_new(fd);
-#endif
+
 	closure->result = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT, cond,
 					      pidgin_io_invoke, closure, pidgin_io_destroy);