aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/ui/gtk/progress.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/ui/gtk/progress.c')
-rw-r--r--tools/perf/ui/gtk/progress.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/tools/perf/ui/gtk/progress.c b/tools/perf/ui/gtk/progress.c
index 482bcf3df9b7..b656655fbc39 100644
--- a/tools/perf/ui/gtk/progress.c
+++ b/tools/perf/ui/gtk/progress.c
@@ -7,14 +7,14 @@
7static GtkWidget *dialog; 7static GtkWidget *dialog;
8static GtkWidget *progress; 8static GtkWidget *progress;
9 9
10static void gtk_progress_update(u64 curr, u64 total, const char *title) 10static void gtk_ui_progress__update(struct ui_progress *p)
11{ 11{
12 double fraction = total ? 1.0 * curr / total : 0.0; 12 double fraction = p->total ? 1.0 * p->curr / p->total : 0.0;
13 char buf[1024]; 13 char buf[1024];
14 14
15 if (dialog == NULL) { 15 if (dialog == NULL) {
16 GtkWidget *vbox = gtk_vbox_new(TRUE, 5); 16 GtkWidget *vbox = gtk_vbox_new(TRUE, 5);
17 GtkWidget *label = gtk_label_new(title); 17 GtkWidget *label = gtk_label_new(p->title);
18 18
19 dialog = gtk_window_new(GTK_WINDOW_TOPLEVEL); 19 dialog = gtk_window_new(GTK_WINDOW_TOPLEVEL);
20 progress = gtk_progress_bar_new(); 20 progress = gtk_progress_bar_new();
@@ -32,7 +32,7 @@ static void gtk_progress_update(u64 curr, u64 total, const char *title)
32 } 32 }
33 33
34 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress), fraction); 34 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress), fraction);
35 snprintf(buf, sizeof(buf), "%"PRIu64" / %"PRIu64, curr, total); 35 snprintf(buf, sizeof(buf), "%"PRIu64" / %"PRIu64, p->curr, p->total);
36 gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progress), buf); 36 gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progress), buf);
37 37
38 /* we didn't call gtk_main yet, so do it manually */ 38 /* we didn't call gtk_main yet, so do it manually */
@@ -40,7 +40,7 @@ static void gtk_progress_update(u64 curr, u64 total, const char *title)
40 gtk_main_iteration(); 40 gtk_main_iteration();
41} 41}
42 42
43static void gtk_progress_finish(void) 43static void gtk_ui_progress__finish(void)
44{ 44{
45 /* this will also destroy all of its children */ 45 /* this will also destroy all of its children */
46 gtk_widget_destroy(dialog); 46 gtk_widget_destroy(dialog);
@@ -48,12 +48,12 @@ static void gtk_progress_finish(void)
48 dialog = NULL; 48 dialog = NULL;
49} 49}
50 50
51static struct ui_progress gtk_progress_fns = { 51static struct ui_progress_ops gtk_ui_progress__ops = {
52 .update = gtk_progress_update, 52 .update = gtk_ui_progress__update,
53 .finish = gtk_progress_finish, 53 .finish = gtk_ui_progress__finish,
54}; 54};
55 55
56void perf_gtk__init_progress(void) 56void gtk_ui_progress__init(void)
57{ 57{
58 progress_fns = &gtk_progress_fns; 58 ui_progress__ops = &gtk_ui_progress__ops;
59} 59}