comparison console/libgnt/gntmain.c @ 14202:c3f5ac1f57a9

[gaim-migrate @ 16875] some tweakings. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 19 Aug 2006 06:45:42 +0000
parents 44ec6c7cbc76
children 2925098c9b95
comparison
equal deleted inserted replaced
14201:cb6bbd248941 14202:c3f5ac1f57a9
661 661
662 void gnt_init() 662 void gnt_init()
663 { 663 {
664 static GIOChannel *channel = NULL; 664 static GIOChannel *channel = NULL;
665 char *filename; 665 char *filename;
666 int result;
667 const char *locale;
668
669 if (channel)
670 return;
666 671
667 if (channel) 672 channel = g_io_channel_unix_new(STDIN_FILENO);
668 return;
669
670 channel = g_io_channel_unix_new(0);
671 673
672 g_io_channel_set_encoding(channel, NULL, NULL); 674 g_io_channel_set_encoding(channel, NULL, NULL);
673 g_io_channel_set_buffered(channel, FALSE); 675 g_io_channel_set_buffered(channel, FALSE);
674 g_io_channel_set_flags(channel, G_IO_FLAG_NONBLOCK, NULL ); 676 g_io_channel_set_flags(channel, G_IO_FLAG_NONBLOCK, NULL );
675 677
676 int result = g_io_add_watch(channel, 678 result = g_io_add_watch_full(channel, G_PRIORITY_HIGH,
677 (G_IO_IN | G_IO_HUP | G_IO_ERR), 679 (G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_PRI | G_IO_NVAL),
678 io_invoke, NULL); 680 io_invoke, NULL, NULL);
679 const char *locale = setlocale(LC_ALL, ""); 681
682 locale = setlocale(LC_ALL, "");
683
684 g_io_channel_unref(channel);
680 685
681 if (locale && (strstr(locale, "UTF") || strstr(locale, "utf"))) 686 if (locale && (strstr(locale, "UTF") || strstr(locale, "utf")))
682 ascii_only = FALSE; 687 ascii_only = FALSE;
683 else 688 else
684 ascii_only = TRUE; 689 ascii_only = TRUE;