Commit f01bbc5b authored by Victor Ananjevsky's avatar Victor Ananjevsky

fix pulsate behavior in progress dialog

parent 7d56d064
......@@ -31,16 +31,8 @@ static GtkWidget *progress_log;
static GtkTextBuffer *log_buffer;
static gboolean
pulsate_progress_bar (gpointer user_data)
{
gtk_progress_bar_pulse (GTK_PROGRESS_BAR (progress_bar));
return TRUE;
}
static gboolean
handle_stdin (GIOChannel * channel, GIOCondition condition, gpointer data)
{
static guint pulsate_timeout = 0;
float percentage = 0.0;
if ((condition == G_IO_IN) || (condition == G_IO_IN + G_IO_HUP))
......@@ -50,13 +42,7 @@ handle_stdin (GIOChannel * channel, GIOCondition condition, gpointer data)
string = g_string_new (NULL);
if (options.progress_data.pulsate)
{
if (pulsate_timeout == 0)
pulsate_timeout = g_timeout_add (100, pulsate_progress_bar, NULL);
}
while (channel->is_readable != TRUE);
while (channel->is_readable != TRUE) ;
do
{
......@@ -109,7 +95,7 @@ handle_stdin (GIOChannel * channel, GIOCondition condition, gpointer data)
gtk_progress_bar_set_text (GTK_PROGRESS_BAR (progress_bar), match);
g_free (match);
}
else
else if (!options.progress_data.pulsate)
{
if (g_ascii_isdigit (*(string->str)))
{
......@@ -126,6 +112,9 @@ handle_stdin (GIOChannel * channel, GIOCondition condition, gpointer data)
}
}
if (options.progress_data.pulsate)
gtk_progress_bar_pulse (GTK_PROGRESS_BAR (progress_bar));
}
while (g_io_channel_get_buffer_condition (channel) == G_IO_IN);
g_string_free (string, TRUE);
......@@ -135,18 +124,13 @@ handle_stdin (GIOChannel * channel, GIOCondition condition, gpointer data)
{
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress_bar), 1.0);
if (options.progress_data.pulsate)
{
g_source_remove (pulsate_timeout);
pulsate_timeout = 0;
}
if (options.progress_data.autoclose && options.plug == -1)
yad_exit (options.data.def_resp);
g_io_channel_shutdown (channel, TRUE, NULL);
return FALSE;
}
return TRUE;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment