summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLucas Rocha <lucasr@gnome.org>2006-07-28 04:18:58 +0000
committerLucas Almeida Rocha <lucasr@src.gnome.org>2006-07-28 04:18:58 +0000
commite46814b46ac4687de519dfdd0fd8f578cfa17946 (patch)
tree1946dc153dc837525460b117e13945795ed78299 /src
parentUpdated German translation. (diff)
downloadzenity-e46814b46ac4687de519dfdd0fd8f578cfa17946.tar.gz
zenity-e46814b46ac4687de519dfdd0fd8f578cfa17946.tar.bz2
zenity-e46814b46ac4687de519dfdd0fd8f578cfa17946.zip
correctly stdin input for text info dialog (Fixes bug #336736).
2006-07-27 Lucas Rocha <lucasr@gnome.org> * src/text.c (zenity_text_handle_stdin): correctly stdin input for text info dialog (Fixes bug #336736).
Diffstat (limited to 'src')
-rw-r--r--src/text.c59
1 files changed, 26 insertions, 33 deletions
diff --git a/src/text.c b/src/text.c
index f3b331d4..1a4a3227 100644
--- a/src/text.c
+++ b/src/text.c
@@ -43,50 +43,43 @@ zenity_text_handle_stdin (GIOChannel *channel,
buffer = GTK_TEXT_BUFFER (data);
- if ((condition == G_IO_IN) || (condition == G_IO_IN + G_IO_HUP)) {
+ if ((condition & G_IO_IN) || (condition & (G_IO_IN | G_IO_HUP))) {
GError *error = NULL;
+ gint status;
while (channel->is_readable != TRUE)
;
- do {
- gint status;
-
- do {
- status = g_io_channel_read_chars (channel, buf, 1024, &len, &error);
-
- while (gtk_events_pending ())
- gtk_main_iteration ();
- } while (status == G_IO_STATUS_AGAIN);
+ do {
+ status = g_io_channel_read_chars (channel, buf, 1024, &len, &error);
- if (status != G_IO_STATUS_NORMAL) {
- if (error) {
- g_warning ("zenity_text_handle_stdin () : %s", error->message);
- g_error_free (error);
- error = NULL;
- }
- continue;
- }
+ while (gtk_events_pending ())
+ gtk_main_iteration ();
- if (len > 0) {
- GtkTextIter end;
- gchar *utftext;
- gsize localelen;
- gsize utflen;
+ } while (status == G_IO_STATUS_AGAIN);
- gtk_text_buffer_get_end_iter (buffer, &end);
- utftext = g_convert_with_fallback (buf, len, "UTF-8", "ISO-8859-1", NULL, &localelen, &utflen, NULL);
- gtk_text_buffer_insert (buffer, &end, utftext, utflen);
- g_free (utftext);
+ if (status != G_IO_STATUS_NORMAL) {
+ if (error) {
+ g_warning ("zenity_text_handle_stdin () : %s", error->message);
+ g_error_free (error);
+ error = NULL;
}
-
- } while (g_io_channel_get_buffer_condition (channel) == G_IO_IN);
+ return FALSE;
+ }
+
+ if (len > 0) {
+ GtkTextIter end;
+ gchar *utftext;
+ gsize localelen;
+ gsize utflen;
+
+ gtk_text_buffer_get_end_iter (buffer, &end);
+ utftext = g_convert_with_fallback (buf, len, "UTF-8", "ISO-8859-1", NULL, &localelen, &utflen, NULL);
+ gtk_text_buffer_insert (buffer, &end, utftext, utflen);
+ g_free (utftext);
+ }
}
- if (condition != G_IO_IN) {
- g_io_channel_shutdown (channel, TRUE, NULL);
- return FALSE;
- }
return TRUE;
}
bgstack15