diff options
author | Scott Pakin <pakin@lanl.gov> | 2014-08-05 15:22:12 -0600 |
---|---|---|
committer | Arx Cruz <arxcruz@gnome.org> | 2014-10-21 15:22:11 +0200 |
commit | 673550b6d326e111867fa78ba4d796045715202e (patch) | |
tree | ca8d8eae3c976e532d4e283f3bb393c91e0b4fd0 /src/option.c | |
parent | fc76e0c19be22d47cf6044ca591f0e01010a1a80 (diff) | |
download | zenity-673550b6d326e111867fa78ba4d796045715202e.tar.gz |
Added time-remaining support to progress bars
Introduced a --time-remaining command-line option that uses the time
and percent complete to extrapolate the time remaining until progress
reaches 100%.
Diffstat (limited to 'src/option.c')
-rw-r--r-- | src/option.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/option.c b/src/option.c index f5c84d5..c1e3a77 100644 --- a/src/option.c +++ b/src/option.c @@ -98,6 +98,7 @@ static gboolean zenity_progress_pulsate; static gboolean zenity_progress_auto_close; static gboolean zenity_progress_auto_kill; static gboolean zenity_progress_no_cancel; +static gboolean zenity_progress_time_remaining; /* Question Dialog Options */ static gboolean zenity_question_active; @@ -767,6 +768,15 @@ static GOptionEntry progress_options[] = { N_("Hide Cancel button"), NULL }, + { + "time-remaining", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_progress_time_remaining, + N_("Estimate when progress will reach 100%"), + NULL + }, { NULL } @@ -1551,6 +1561,7 @@ zenity_progress_pre_callback (GOptionContext *context, zenity_progress_auto_close = FALSE; zenity_progress_auto_kill = FALSE; zenity_progress_no_cancel = FALSE; + zenity_progress_time_remaining = FALSE; return TRUE; } @@ -1935,6 +1946,7 @@ zenity_progress_post_callback (GOptionContext *context, results->progress_data->autokill = zenity_progress_auto_kill; results->progress_data->percentage = zenity_progress_percentage; results->progress_data->no_cancel = zenity_progress_no_cancel; + results->progress_data->time_remaining = zenity_progress_time_remaining; } else { if (zenity_progress_pulsate) zenity_option_error (zenity_option_get_name (progress_options, &zenity_progress_pulsate), @@ -1951,9 +1963,14 @@ zenity_progress_post_callback (GOptionContext *context, if (zenity_progress_auto_kill) zenity_option_error (zenity_option_get_name (progress_options, &zenity_progress_auto_kill), ERROR_SUPPORT); + if (zenity_progress_no_cancel) zenity_option_error (zenity_option_get_name (progress_options, &zenity_progress_no_cancel), ERROR_SUPPORT); + + if (zenity_progress_time_remaining) + zenity_option_error (zenity_option_get_name (progress_options, &zenity_progress_time_remaining), + ERROR_SUPPORT); } return TRUE; |