PtProgressDialog

PtProgressDialog — Progress dialog while loading wave data.

Stability Level

Unstable, unless otherwise indicated

Functions

Types and Values

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── GtkWidget
            ╰── GtkContainer
                ╰── GtkBin
                    ╰── GtkWindow
                        ╰── GtkDialog
                            ╰── GtkMessageDialog
                                ╰── PtProgressDialog

Implemented Interfaces

PtProgressDialog implements AtkImplementorIface and GtkBuildable.

Includes

#include <parlatype/pt-progress-dialog.h>

Description

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);

Functions

pt_progress_dialog_new ()

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.

Parameters

win

parent window, NULL is allowed, but discouraged.

[allow-none]

Returns

a new PtProgressDialog.

[transfer none]


pt_progress_dialog_set_progress ()

void
pt_progress_dialog_set_progress (PtProgressDialog *dlg,
                                 gdouble progress);

Sets the progress bar to the new value.

Parameters

dlg

the dialog

 

progress

the new value for the progress bar, ranging from 0.0 to 1.0

 

Types and Values

struct PtProgressDialog

struct PtProgressDialog;

The PtProgressDialog contains only private fields and should not be directly accessed.