1 // SPDX-License-Identifier: GPL-2.0
5 #include "../helpline.h"
10 void perf_gtk__signal(int sig
)
12 perf_gtk__exit(false);
16 void perf_gtk__resize_window(GtkWidget
*window
)
24 screen
= gtk_widget_get_screen(window
);
26 monitor
= gdk_screen_get_monitor_at_window(screen
, window
->window
);
28 gdk_screen_get_monitor_geometry(screen
, monitor
, &rect
);
30 width
= rect
.width
* 3 / 4;
31 height
= rect
.height
* 3 / 4;
33 gtk_window_resize(GTK_WINDOW(window
), width
, height
);
36 const char *perf_gtk__get_percent_color(double percent
)
38 if (percent
>= MIN_RED
)
39 return "<span fgcolor='red'>";
40 if (percent
>= MIN_GREEN
)
41 return "<span fgcolor='dark green'>";
45 #ifdef HAVE_GTK_INFO_BAR_SUPPORT
46 GtkWidget
*perf_gtk__setup_info_bar(void)
50 GtkWidget
*content_area
;
52 info_bar
= gtk_info_bar_new();
53 gtk_widget_set_no_show_all(info_bar
, TRUE
);
55 label
= gtk_label_new("");
56 gtk_widget_show(label
);
58 content_area
= gtk_info_bar_get_content_area(GTK_INFO_BAR(info_bar
));
59 gtk_container_add(GTK_CONTAINER(content_area
), label
);
61 gtk_info_bar_add_button(GTK_INFO_BAR(info_bar
), GTK_STOCK_OK
,
63 g_signal_connect(info_bar
, "response",
64 G_CALLBACK(gtk_widget_hide
), NULL
);
66 pgctx
->info_bar
= info_bar
;
67 pgctx
->message_label
= label
;
73 GtkWidget
*perf_gtk__setup_statusbar(void)
78 stbar
= gtk_statusbar_new();
80 ctxid
= gtk_statusbar_get_context_id(GTK_STATUSBAR(stbar
),
82 pgctx
->statbar
= stbar
;
83 pgctx
->statbar_ctx_id
= ctxid
;