6 #include "../helpline.h"
11 void perf_gtk__signal(int sig
)
13 perf_gtk__exit(false);
17 void perf_gtk__resize_window(GtkWidget
*window
)
25 screen
= gtk_widget_get_screen(window
);
27 monitor
= gdk_screen_get_monitor_at_window(screen
, window
->window
);
29 gdk_screen_get_monitor_geometry(screen
, monitor
, &rect
);
31 width
= rect
.width
* 3 / 4;
32 height
= rect
.height
* 3 / 4;
34 gtk_window_resize(GTK_WINDOW(window
), width
, height
);
37 const char *perf_gtk__get_percent_color(double percent
)
39 if (percent
>= MIN_RED
)
40 return "<span fgcolor='red'>";
41 if (percent
>= MIN_GREEN
)
42 return "<span fgcolor='dark green'>";
46 #ifdef HAVE_GTK_INFO_BAR_SUPPORT
47 GtkWidget
*perf_gtk__setup_info_bar(void)
51 GtkWidget
*content_area
;
53 info_bar
= gtk_info_bar_new();
54 gtk_widget_set_no_show_all(info_bar
, TRUE
);
56 label
= gtk_label_new("");
57 gtk_widget_show(label
);
59 content_area
= gtk_info_bar_get_content_area(GTK_INFO_BAR(info_bar
));
60 gtk_container_add(GTK_CONTAINER(content_area
), label
);
62 gtk_info_bar_add_button(GTK_INFO_BAR(info_bar
), GTK_STOCK_OK
,
64 g_signal_connect(info_bar
, "response",
65 G_CALLBACK(gtk_widget_hide
), NULL
);
67 pgctx
->info_bar
= info_bar
;
68 pgctx
->message_label
= label
;
74 GtkWidget
*perf_gtk__setup_statusbar(void)
79 stbar
= gtk_statusbar_new();
81 ctxid
= gtk_statusbar_get_context_id(GTK_STATUSBAR(stbar
),
83 pgctx
->statbar
= stbar
;
84 pgctx
->statbar_ctx_id
= ctxid
;