2 #include "../../util/debug.h"
14 ctx =
malloc(
sizeof(*pgctx));
23 if (!perf_gtk__is_active_context(*ctx))
36 if (!perf_gtk__is_active_context(pgctx) ||
37 vasprintf(&msg, format, args) < 0) {
44 dialog = gtk_message_dialog_new_with_markup(GTK_WINDOW(pgctx->
main_window),
45 GTK_DIALOG_DESTROY_WITH_PARENT,
48 "<b>Error</b>\n\n%s", msg);
49 gtk_dialog_run(GTK_DIALOG(dialog));
51 gtk_widget_destroy(dialog);
56 #ifdef HAVE_GTK_INFO_BAR
57 static int perf_gtk__warning_info_bar(
const char *format,
va_list args)
61 if (!perf_gtk__is_active_context(pgctx) ||
62 vasprintf(&msg, format, args) < 0) {
69 gtk_label_set_text(GTK_LABEL(pgctx->message_label), msg);
70 gtk_info_bar_set_message_type(GTK_INFO_BAR(pgctx->info_bar),
72 gtk_widget_show(pgctx->info_bar);
78 static int perf_gtk__warning_statusbar(
const char *format,
va_list args)
82 if (!perf_gtk__is_active_context(pgctx) ||
83 vasprintf(&msg, format, args) < 0) {
90 gtk_statusbar_pop(GTK_STATUSBAR(pgctx->
statbar),
98 gtk_statusbar_push(GTK_STATUSBAR(pgctx->
statbar),
107 .error = perf_gtk__error,
108 #ifdef HAVE_GTK_INFO_BAR
109 .warning = perf_gtk__warning_info_bar,
111 .warning = perf_gtk__warning_statusbar,
121 const char *title __maybe_unused)