diff options
Diffstat (limited to 'tools/perf/ui/gtk/progress.c')
-rw-r--r-- | tools/perf/ui/gtk/progress.c | 20 |
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 @@ | |||
7 | static GtkWidget *dialog; | 7 | static GtkWidget *dialog; |
8 | static GtkWidget *progress; | 8 | static GtkWidget *progress; |
9 | 9 | ||
10 | static void gtk_progress_update(u64 curr, u64 total, const char *title) | 10 | static 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 | ||
43 | static void gtk_progress_finish(void) | 43 | static 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 | ||
51 | static struct ui_progress gtk_progress_fns = { | 51 | static 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 | ||
56 | void perf_gtk__init_progress(void) | 56 | void gtk_ui_progress__init(void) |
57 | { | 57 | { |
58 | progress_fns = >k_progress_fns; | 58 | ui_progress__ops = >k_ui_progress__ops; |
59 | } | 59 | } |