GnuCash
5.6-150-g038405b370+
|
Dialog for displaying progress of long-running operations. More...
Files | |
file | dialog-progress.h |
API for displaying progress of long-running operations. | |
Typedefs | |
typedef gboolean(* | GNCProgressCancelFunc) (gpointer user_data) |
Functions | |
GNCProgressDialog * | gnc_progress_dialog_new (GtkWidget *parent, gboolean use_ok_button) |
Displays a pop-up dialog for showing the progress of a long-running activity. More... | |
GNCProgressDialog * | gnc_progress_dialog_custom (GtkLabel *primary, GtkLabel *secondary, GtkProgressBar *bar, GtkLabel *suboperation, GtkTextView *log) |
Creates a dialog for displaying the progress of an activity using existing widgets. More... | |
void | gnc_progress_dialog_set_title (GNCProgressDialog *progress, const char *title) |
Set the title of a pop-up progress dialog. More... | |
void | gnc_progress_dialog_set_primary (GNCProgressDialog *progress, const gchar *str) |
Set the primary text of the progress dialog. More... | |
void | gnc_progress_dialog_set_heading (GNCProgressDialog *progress, const char *heading) |
Set the primary text of the progress dialog. More... | |
void | gnc_progress_dialog_set_secondary (GNCProgressDialog *progress, const gchar *str) |
Set the secondary text of the progress dialog. More... | |
void | gnc_progress_dialog_set_sub (GNCProgressDialog *progress, const gchar *str) |
Set the suboperation text of the progress dialog. More... | |
void | gnc_progress_dialog_reset_log (GNCProgressDialog *progress) |
Show the progress log and delete any existing text. More... | |
void | gnc_progress_dialog_append_log (GNCProgressDialog *progress, const gchar *str) |
Append str to the progress log. More... | |
void | gnc_progress_dialog_pause (GNCProgressDialog *progress) |
Show that progress has been paused by appending "(paused)" to the suboperation text, the window title, or the primary text. More... | |
void | gnc_progress_dialog_resume (GNCProgressDialog *progress) |
Remove any indication that progress has paused by removing any existing "(paused)" suffix from the suboperation text, the window title, and the primary text. More... | |
void | gnc_progress_dialog_set_cancel_func (GNCProgressDialog *progress, GNCProgressCancelFunc cancel_func, gpointer user_data) |
Show a Cancel button and set the C function which will be called when it is pressed by the user. More... | |
void | gnc_progress_dialog_set_cancel_scm_func (GNCProgressDialog *progress, SCM cancel_scm_func) |
Show a Cancel button and set the Guile procedure that will be called when it is pressed by the user. More... | |
void | gnc_progress_dialog_set_value (GNCProgressDialog *progress, gdouble value) |
Set the fraction of the progress bar to fill, where 0 is empty and 1 is full. More... | |
guint | gnc_progress_dialog_push (GNCProgressDialog *progress, gdouble weight) |
Create a new "virtual" progress bar that, as it becomes full, will fill the current bar by the fraction specified by weight. More... | |
guint | gnc_progress_dialog_pop (GNCProgressDialog *progress) |
Moves up one level in the stack of virtual bars. More... | |
guint | gnc_progress_dialog_pop_full (GNCProgressDialog *progress) |
Fills the current progress bar, then calls gnc_progress_dialog_pop(). More... | |
void | gnc_progress_dialog_reset_value (GNCProgressDialog *progress) |
Pop up to the top level and clear the progress bar. More... | |
void | gnc_progress_dialog_update (GNCProgressDialog *progress) |
Update the GUI of the progress dialog, and call any pending cancel callbacks. More... | |
void | gnc_progress_dialog_finish (GNCProgressDialog *progress) |
Set the progress meter to fully complete, change the heading, if any, to "Complete", enable the 'OK' button, and make the dialog non-modal. More... | |
void | gnc_progress_dialog_destroy (GNCProgressDialog *progress) |
Destroy the dialog. More... | |
Dialog for displaying progress of long-running operations.
These functions constitute an API for streamlining the creation and management of progress dialogs. Once registered with the API, the dialog's display and behavior can be controlled via simple calls that prevent the caller from needing to know anything about the underlying GUI.
A pop-up progress dialog can be created, displayed, and registered with the API by calling gnc_progress_dialog_new(). Alternatively, existing widgets can be registered with the API by calling gnc_progress_dialog_custom(). This method allows custom-made dialogs to hand off the management of typical progress-related widgets, and allows long-running operations report progress in a standard way.
void gnc_progress_dialog_append_log | ( | GNCProgressDialog * | progress, |
const gchar * | str | ||
) |
Append str to the progress log.
progress | a ::GNCProgressDialog |
str | the text to be appended |
Definition at line 458 of file dialog-progress.c.
GNCProgressDialog* gnc_progress_dialog_custom | ( | GtkLabel * | primary, |
GtkLabel * | secondary, | ||
GtkProgressBar * | bar, | ||
GtkLabel * | suboperation, | ||
GtkTextView * | log | ||
) |
Creates a dialog for displaying the progress of an activity using existing widgets.
This allows long-running operations to update the progress in a custom dialog instead of a new pop-up.
primary | a GtkLabel widget to use for primary text |
secondary | a GtkLabel widget to use for secondary text |
bar | a GtkProgressBar widget for filling or pulsing |
suboperation | a GtkLabel widget to use for suboperation text |
log | a GtkTextView widget for logging progress textually |
Any of the parameters may be passed as NULL
if management of that visual element is not desired.
Definition at line 286 of file dialog-progress.c.
void gnc_progress_dialog_destroy | ( | GNCProgressDialog * | progress | ) |
Destroy the dialog.
If gnc_progress_dialog_finish has been called, the dialog will not be destroyed until the user dismisses the window. This function must be called in order to reclaim the dialog's memory.
progress | a ::GNCProgressDialog |
Definition at line 782 of file dialog-progress.c.
void gnc_progress_dialog_finish | ( | GNCProgressDialog * | progress | ) |
Set the progress meter to fully complete, change the heading, if any, to "Complete", enable the 'OK' button, and make the dialog non-modal.
progress | a ::GNCProgressDialog |
Definition at line 751 of file dialog-progress.c.
GNCProgressDialog* gnc_progress_dialog_new | ( | GtkWidget * | parent, |
gboolean | use_ok_button | ||
) |
Displays a pop-up dialog for showing the progress of a long-running activity.
By default only a title and progress bar are shown, but additional visual elements such as a Cancel button, text log, and additional labels can be activated by following with calls to some of the other API functions.
parent | The parent window for which the progress dialog becomes modal. |
use_ok_button | If TRUE , an OK button is shown and must be clicked when progress is completed. |
Definition at line 267 of file dialog-progress.c.
void gnc_progress_dialog_pause | ( | GNCProgressDialog * | progress | ) |
Show that progress has been paused by appending "(paused)" to the suboperation text, the window title, or the primary text.
The first that is both known and currently shown will be the one used.
progress | a ::GNCProgressDialog |
Definition at line 478 of file dialog-progress.c.
guint gnc_progress_dialog_pop | ( | GNCProgressDialog * | progress | ) |
Moves up one level in the stack of virtual bars.
See gnc_progress_dialog_push() for an explanation of virtual bars.
progress | a ::GNCProgressDialog |
Definition at line 684 of file dialog-progress.c.
guint gnc_progress_dialog_pop_full | ( | GNCProgressDialog * | progress | ) |
Fills the current progress bar, then calls gnc_progress_dialog_pop().
progress | a ::GNCProgressDialog |
Definition at line 722 of file dialog-progress.c.
guint gnc_progress_dialog_push | ( | GNCProgressDialog * | progress, |
gdouble | weight | ||
) |
Create a new "virtual" progress bar that, as it becomes full, will fill the current bar by the fraction specified by weight.
All calls to gnc_progress_dialog_set_value() will operate on the new bar until gnc_progress_dialog_pop() is called.
This can be used to split an operation into weighted sub-operations. For example, if a particular suboperation should fill 30% of the bar, call gnc_progress_dialog_push() with a weight of 0.3. Calls to gnc_progress_dialog_set_value() will fill the virtual bar, which in turn trickles up at the 0.3 rate.
Multiple calls to gnc_progress_dialog_push() can be used to create a stack of virtual bars, each subordinate to the last. This allows a task to be split into any number of levels of sub-tasks.
progress | a ::GNCProgressDialog |
weight | the requested fraction of the current bar that the new bar will represent (The fraction actually assigned will be the lesser of the requested amount and the amount of the bar that is unfilled.) |
Definition at line 649 of file dialog-progress.c.
void gnc_progress_dialog_reset_log | ( | GNCProgressDialog * | progress | ) |
Show the progress log and delete any existing text.
If the dialog was created via gnc_progress_dialog_new(), the log is not shown by default. Calling this function will make it appear.
progress | a ::GNCProgressDialog |
Definition at line 435 of file dialog-progress.c.
void gnc_progress_dialog_reset_value | ( | GNCProgressDialog * | progress | ) |
Pop up to the top level and clear the progress bar.
progress | a ::GNCProgressDialog |
Definition at line 730 of file dialog-progress.c.
void gnc_progress_dialog_resume | ( | GNCProgressDialog * | progress | ) |
Remove any indication that progress has paused by removing any existing "(paused)" suffix from the suboperation text, the window title, and the primary text.
progress | a ::GNCProgressDialog |
Definition at line 527 of file dialog-progress.c.
void gnc_progress_dialog_set_cancel_func | ( | GNCProgressDialog * | progress, |
GNCProgressCancelFunc | cancel_func, | ||
gpointer | user_data | ||
) |
Show a Cancel button and set the C function which will be called when it is pressed by the user.
The cancel function must return a boolean value. If the value is TRUE
, the window is hidden.
progress | a ::GNCProgressDialog |
cancel_func | the callback function |
user_data | user data to be passed to cancel_func |
Definition at line 581 of file dialog-progress.c.
void gnc_progress_dialog_set_cancel_scm_func | ( | GNCProgressDialog * | progress, |
SCM | cancel_scm_func | ||
) |
Show a Cancel button and set the Guile procedure that will be called when it is pressed by the user.
It will be called after any C function registered with gnc_progress_dialog_set_cancel_func(). The procedure must return #t
if the dialog should be hidden. If there is no C or Guile cancel callback (the default state), the Cancel button is hidden.
progress | a ::GNCProgressDialog |
cancel_scm_func | the Guile callback procedure |
Definition at line 599 of file dialog-progress.c.
void gnc_progress_dialog_set_heading | ( | GNCProgressDialog * | progress, |
const char * | heading | ||
) |
Set the primary text of the progress dialog.
If str is NULL
or blank, the label is hidden (this is the default state).
progress | a ::GNCProgressDialog |
heading | the text to be displayed |
NOTE: For HIG-compliant dialogs, use gnc_progress_dialog_set_primary() instead.
Definition at line 368 of file dialog-progress.c.
void gnc_progress_dialog_set_primary | ( | GNCProgressDialog * | progress, |
const gchar * | str | ||
) |
Set the primary text of the progress dialog.
The text will be displayed using the HIG-recommended style. If str is NULL
or blank, the label is hidden (this is the default state).
progress | a ::GNCProgressDialog |
str | the text to be displayed |
Definition at line 343 of file dialog-progress.c.
void gnc_progress_dialog_set_secondary | ( | GNCProgressDialog * | progress, |
const gchar * | str | ||
) |
Set the secondary text of the progress dialog.
The text will be displayed using the HIG-recommended style. If str is NULL
or blank, the label is hidden (this is the default state).
progress | a ::GNCProgressDialog |
str | the text to be displayed |
Definition at line 389 of file dialog-progress.c.
void gnc_progress_dialog_set_sub | ( | GNCProgressDialog * | progress, |
const gchar * | str | ||
) |
Set the suboperation text of the progress dialog.
The text will be displayed using the HIG-recommended style. If str is NULL
or blank, the label is hidden (this is the default state).
progress | a ::GNCProgressDialog |
str | the text to be displayed |
Definition at line 410 of file dialog-progress.c.
void gnc_progress_dialog_set_title | ( | GNCProgressDialog * | progress, |
const char * | title | ||
) |
Set the title of a pop-up progress dialog.
This function has no effect on dialogs registered using gnc_progress_dialog_custom().
progress | a ::GNCProgressDialog |
title | the window title to display |
Definition at line 324 of file dialog-progress.c.
void gnc_progress_dialog_set_value | ( | GNCProgressDialog * | progress, |
gdouble | value | ||
) |
Set the fraction of the progress bar to fill, where 0 is empty and 1 is full.
If value is over 1, the bar will pulse instead of fill.
progress | a ::GNCProgressDialog |
value | the fraction of the bar to fill |
Definition at line 622 of file dialog-progress.c.
void gnc_progress_dialog_update | ( | GNCProgressDialog * | progress | ) |
Update the GUI of the progress dialog, and call any pending cancel callbacks.
This function will be called automatically by the other functions, including gnc_progress_dialog_set_value.
progress | a ::GNCProgressDialog |
Definition at line 743 of file dialog-progress.c.