blob: 04837df1c5991845f633b5fd51c2f52355b7a14b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
namespace JadupcSupport
{
namespace utils
{
internal string get_message_icon(Gtk.MessageType type)
{
switch (type) {
case ERROR:
return "dialog-error";
case INFO:
return "dialog-information";
case QUESTION:
return "dialog-question";
case WARNING:
return "dialog-warning";
default:
return "image-missing";
}
}
// This function takes a visible Gtk Widget and recursively realizes
// the childrens as Gtk whines on key event if even one
// ((great)grand)children widget is not realized...
internal void realize_all(Gtk.Container container)
{
if (!container.get_realized())
container.realize();
container.foreach((widget) => {
if (widget is Gtk.Container) realize_all(widget as Gtk.Container);
else if (!widget.get_realized()) widget.realize();
});
}
internal string strret(int ret, string[] retstrs = {})
{
if (0 < ret <= 64 && !(ret == 11 || ret == 28 || 3 <= ret <= 8))
return "%s".printf(strsignal(ret) ?? _("Unknown Signal - %d").printf(ret));
else if (128 < ret < 256)
return "%s".printf(strsignal(ret - 128) ?? _("Unknown Signal - %d").printf(ret));
else if (ret % 256 == 0)
return _("Process returned %d").printf(ret / 256);
return _("Exit status - %d (unknown)").printf(ret);
}
}
}
|