summaryrefslogtreecommitdiff
blob: 0b4f1c77d400d383cfd32091867846982aa3f2df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
From c89ce9c3812fdc3a2637fd76b42a07385ad50684 Mon Sep 17 00:00:00 2001
From: Arx Cruz <arxcruz@gnome.org>
Date: Tue, 04 Jun 2013 19:27:48 +0000
Subject: Bug #653468. Fixed by Kurt Miller <kurt@intricatesoftware.com>.

Fix the broken auto-close option in progress and list dialogs.
---
diff --git a/src/progress.c b/src/progress.c
index c382d74..055699c 100644
--- a/src/progress.c
+++ b/src/progress.c
@@ -81,12 +81,13 @@ zenity_progress_handle_stdin (GIOChannel   *channel,
   static GObject *progress_bar;
   static GObject *progress_label;
   float percentage = 0.0;
+  GIOStatus status = G_IO_STATUS_NORMAL;
   
   progress_data = (ZenityProgressData *) data;
   progress_bar = gtk_builder_get_object (builder, "zenity_progress_bar");
   progress_label = gtk_builder_get_object (builder, "zenity_progress_text");
 
-  if ((condition == G_IO_IN) || (condition == G_IO_IN + G_IO_HUP)) {
+  if ((condition & G_IO_IN) != 0) {
     GString *string;
     GError *error = NULL;
 
@@ -95,8 +96,6 @@ zenity_progress_handle_stdin (GIOChannel   *channel,
     while (channel->is_readable != TRUE)
       ;
     do {
-      gint status;
-
       do {
         status = g_io_channel_read_line_string (channel, string, NULL, &error);
 
@@ -175,11 +174,11 @@ zenity_progress_handle_stdin (GIOChannel   *channel,
         }
       }
 
-    } while (g_io_channel_get_buffer_condition (channel) == G_IO_IN);
+    } while ((g_io_channel_get_buffer_condition (channel) & G_IO_IN) == G_IO_IN && status != G_IO_STATUS_EOF);
     g_string_free (string, TRUE);
   }
 
-  if ((condition != G_IO_IN) && (condition != G_IO_IN + G_IO_HUP)) {
+  if ((condition & G_IO_IN) != G_IO_IN || status == G_IO_STATUS_EOF) {
     /* We assume that we are done, so stop the pulsating and de-sensitize the buttons */
     GtkWidget *button;
 
diff --git a/src/tree.c b/src/tree.c
index 031765e..4634ba1 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -139,6 +139,7 @@ zenity_tree_handle_stdin (GIOChannel  *channel,
   static gboolean editable;
   static gboolean toggles;
   static gboolean first_time = TRUE;
+  GIOStatus status = G_IO_STATUS_NORMAL;
 
   tree_view = GTK_TREE_VIEW (data);
   n_columns = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (tree_view), "n_columns"));
@@ -152,7 +153,7 @@ zenity_tree_handle_stdin (GIOChannel  *channel,
     gtk_list_store_append (GTK_LIST_STORE (model), &iter);
   }
 
-  if ((condition == G_IO_IN) || (condition == G_IO_IN + G_IO_HUP)) {
+  if ((condition & G_IO_IN) == G_IO_IN) {
     GString *string;
     GError *error = NULL;
 
@@ -161,8 +162,6 @@ zenity_tree_handle_stdin (GIOChannel  *channel,
     while ((g_io_channel_get_flags(channel) & G_IO_FLAG_IS_READABLE) != G_IO_FLAG_IS_READABLE)
       ;
     do {
-      gint status;
-
       do {
         if (g_io_channel_get_flags(channel) & G_IO_FLAG_IS_READABLE)
           status = g_io_channel_read_line_string (channel, string, NULL, &error);
@@ -221,11 +220,11 @@ zenity_tree_handle_stdin (GIOChannel  *channel,
 
       column_count++;
 
-    } while (g_io_channel_get_buffer_condition (channel) == G_IO_IN); 
+    } while ((g_io_channel_get_buffer_condition (channel) & G_IO_IN) == G_IO_IN && status != G_IO_STATUS_EOF); 
     g_string_free (string, TRUE);
   }
 
-  if ((condition != G_IO_IN) && (condition != G_IO_IN + G_IO_HUP)) {
+  if ((condition & G_IO_IN) != G_IO_IN || status == G_IO_STATUS_EOF) {
     g_io_channel_shutdown (channel, TRUE, NULL);
     return FALSE;
   }
--
cgit v0.9.2