mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Allow progress dialog to be used without ok button.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3146 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
1d50e884f6
commit
1d695f82c5
@ -46,6 +46,7 @@ struct _GNCProgressDialog
|
||||
|
||||
SCM cancel_scm_func;
|
||||
|
||||
gboolean use_ok_button;
|
||||
gboolean closed;
|
||||
gboolean finished;
|
||||
gboolean destroyed;
|
||||
@ -184,6 +185,9 @@ gnc_progress_dialog_create(GtkWidget * parent, GNCProgressDialog *progress)
|
||||
gtk_signal_connect(GTK_OBJECT(progress->ok_button), "clicked",
|
||||
GTK_SIGNAL_FUNC(ok_cb), progress);
|
||||
|
||||
if (!progress->use_ok_button)
|
||||
gtk_widget_hide (progress->ok_button);
|
||||
|
||||
progress->cancel_button = gtk_object_get_data(tdo, "cancel_button");
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(progress->cancel_button), "clicked",
|
||||
@ -201,12 +205,14 @@ gnc_progress_dialog_create(GtkWidget * parent, GNCProgressDialog *progress)
|
||||
}
|
||||
|
||||
GNCProgressDialog *
|
||||
gnc_progress_dialog_new (GtkWidget * parent)
|
||||
gnc_progress_dialog_new (GtkWidget * parent, gboolean use_ok_button)
|
||||
{
|
||||
GNCProgressDialog *progress;
|
||||
|
||||
progress = g_new0(GNCProgressDialog, 1);
|
||||
|
||||
progress->use_ok_button = use_ok_button;
|
||||
|
||||
gnc_progress_dialog_create(parent, progress);
|
||||
|
||||
gtk_widget_show(progress->dialog);
|
||||
@ -322,6 +328,12 @@ gnc_progress_dialog_finish (GNCProgressDialog *progress)
|
||||
if (progress == NULL)
|
||||
return;
|
||||
|
||||
if (!progress->use_ok_button)
|
||||
{
|
||||
gtk_widget_hide (progress->dialog);
|
||||
progress->closed = TRUE;
|
||||
}
|
||||
|
||||
gtk_progress_set_percentage (GTK_PROGRESS (progress->progress_bar), 1.0);
|
||||
|
||||
gtk_widget_set_sensitive (progress->ok_button, TRUE);
|
||||
|
@ -34,7 +34,8 @@ typedef gboolean (*GNCProgressCancelFunc) (gpointer user_data);
|
||||
|
||||
/* Create and return a dialog for displaying the progress of
|
||||
* an activity. Useful for long-running operations. */
|
||||
GNCProgressDialog * gnc_progress_dialog_new (GtkWidget *parent);
|
||||
GNCProgressDialog * gnc_progress_dialog_new (GtkWidget *parent,
|
||||
gboolean use_ok_button);
|
||||
|
||||
/* Set the title of the progress dialog. */
|
||||
void gnc_progress_dialog_set_title (GNCProgressDialog *progress,
|
||||
|
@ -68,13 +68,13 @@
|
||||
(list "Extensions" "")
|
||||
(lambda () (gnc:main-win-account-group-write win))))
|
||||
|
||||
(define export-item
|
||||
(define progress-item
|
||||
(gnc:make-menu-item "Test progress dialog"
|
||||
"Test progress dialog"
|
||||
(list "Extensions" "")
|
||||
(lambda ()
|
||||
(let ((dialog (gnc:progress-dialog-new
|
||||
(gnc:get-ui-data)))
|
||||
(gnc:get-ui-data) #f))
|
||||
(canceled #f))
|
||||
(gnc:progress-dialog-set-cancel-scm-func
|
||||
dialog
|
||||
@ -104,6 +104,7 @@
|
||||
|
||||
(gnc:add-extension menu)
|
||||
(gnc:add-extension export-item)
|
||||
(gnc:add-extension progress-item)
|
||||
|
||||
(if (gnc:debugging?)
|
||||
(gnc:add-extension strings-item)))
|
||||
|
@ -47,7 +47,7 @@
|
||||
|
||||
(if (> file-size 10000)
|
||||
(begin
|
||||
(set! progress-dialog (gnc:progress-dialog-new #f))
|
||||
(set! progress-dialog (gnc:progress-dialog-new #f #f))
|
||||
(gnc:progress-dialog-set-title progress-dialog "Progress")
|
||||
(gnc:progress-dialog-set-heading progress-dialog
|
||||
"Loading QIF file...")
|
||||
|
@ -225,7 +225,7 @@
|
||||
|
||||
(if (> work-to-do 100)
|
||||
(begin
|
||||
(set! progress-dialog (gnc:progress-dialog-new #f))
|
||||
(set! progress-dialog (gnc:progress-dialog-new #f #f))
|
||||
(gnc:progress-dialog-set-title progress-dialog "Progress")
|
||||
(gnc:progress-dialog-set-heading progress-dialog
|
||||
"Importing transactions...")
|
||||
|
Loading…
Reference in New Issue
Block a user