Top | ![]() |
![]() |
![]() |
![]() |
GObject ╰── GInitiallyUnowned ╰── GtkWidget ╰── GtkContainer ╰── GtkBin ╰── GtkWindow ╰── GtkDialog ╰── GtkMessageDialog ╰── PtProgressDialog
PtProgressDialog is a ready to use dialog, intended to show progress while
loading wave data. Note, that it is supposed to be shown via
gtk_widget_show_all()
and loading wave data should be done asynchronously.
Using the synchronous version the dialog will not show up.
Assuming you have set up a PtPlayer *player, typical usage would be:
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 |
static void progress_response_cb (GtkWidget *dialog, gint response, gpointer *user_data) { PtPlayer *player = (PtPlayer *) user_data; if (response == GTK_RESPONSE_CANCEL) pt_player_cancel (player); } ... static void open_cb (PtPlayer *player, GAsyncResult *res, gpointer *user_data) { PtProgressDialog *dlg = (PtProgressDialog *) user_data; gtk_widget_destroy (GTK_WIDGET (dlg)); ... } ... progress_dlg = GTK_WIDGET (pt_progress_dialog_new (GTK_WINDOW (parent))); g_signal_connect (progress_dlg, "response", G_CALLBACK (progress_response_cb), player); g_signal_connect_swapped (player, "load-progress", G_CALLBACK (pt_progress_dialog_set_progress), PT_PROGRESS_DIALOG (progress_dlg)); gtk_widget_show_all (win->priv->progress_dlg); pt_player_open_uri_async (player, uri, (GAsyncReadyCallback) open_cb, progress_dlg); |
PtProgressDialog *
pt_progress_dialog_new (GtkWindow *win
);
A GtkMessageDialog with a label "Loading file...", a progress bar and a cancel button.
After use gtk_widget_destroy()
it.
void pt_progress_dialog_set_progress (PtProgressDialog *dlg
,gdouble progress
);
Sets the progress bar to the new value.
struct PtProgressDialog;
The PtProgressDialog contains only private fields and should not be directly accessed.