Debian Codegraph @

src/window-modal.h

raw symbols SCIP
1 // SPDX-FileCopyrightText: 2024-2025 Geoffrey D. Bennett <[email protected]>
2 // SPDX-License-Identifier: GPL-3.0-or-later
3
4 #pragma once
5
6 #include <gtk/gtk.h>
7 #include "alsa.h"
8
9 // create a modal window with a message and yes/no buttons
10 // the callback is called with the modal_data when yes is clicked
11
12 struct modal_data;
13
14 typedef void (*modal_callback)(struct modal_data *data);
15
16 struct modal_data {
17 struct alsa_card *card;
18 char *serial;
19 const char *title_active;
20 GtkWidget *dialog;
21 GtkWidget *label;
22 GtkWidget *button_box;
23 GtkWidget *progress_bar;
24 guint timeout_id;
25 modal_callback callback;
26 GtkWidget *parent_label;
27 int had_error;
28 int in_progress;
29 };
30
31 void create_modal_window(
32 GtkWidget *w,
33 struct alsa_card *card,
34 const char *title,
35 const char *title_active,
36 const char *message,
37 modal_callback callback
38 );
39
40 // Same as create_modal_window but starts immediately without yes/no confirmation
41 // If parent_label is provided, it will be updated on error when the modal closes
42 void create_modal_window_autostart(
43 GtkWidget *w,
44 struct alsa_card *card,
45 const char *title,
46 const char *title_active,
47 const char *message,
48 modal_callback callback,
49 GtkWidget *parent_label
50 );
51
52 // update the progress bar in a modal window
53
54 struct progress_data {
55 struct modal_data *modal_data;
56 char *text;
57 int progress;
58 };
59
60 gboolean modal_update_progress(gpointer user_data);
61
62 // start a progress bar for a reboot
63
64 gboolean modal_start_reboot_progress(gpointer user_data);