-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSeErr.c
134 lines (111 loc) · 3.09 KB
/
SeErr.c
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/*
* This file is part of the Seyon, Copyright (c) 1992-1993 by Muhammad M.
* Saggaf. All rights reserved.
*
* See the file COPYING (1-COPYING) or the manual page seyon(1) for a full
* statement of rights and permissions for this program.
*/
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <X11/Shell.h>
#include <X11/Xaw/Dialog.h>
#include "seyon.h"
#include "SeDecl.h"
#define AddPopupTopLevelNoGeom(name, parent) \
SeAddPopupWG(name, parent, NULL, NULL, 0, 0, True, False)
#define AddPopupCentered(name, parent, geomW) \
SeAddPopupWG(name, parent, geomW, geomW, SeWidgetWidth(geomW)/2, \
SeWidgetHeight(geomW)/2, False, True)
extern Widget topLevel;
void
ErrorExitCallback(widget, exitProc)
Widget widget;
XtPointer exitProc;
{
/* Can you believe this? */
(*((int (*)())exitProc)) (1);
/* I'm just casting the variable to be a function returning int
and then calling the function pointed to by the variable */
}
void
PopupInitError(name, callback)
String name;
void (*callback) ();
{
Widget popup,
dialog;
popup = AddPopupTopLevelNoGeom("initError", topLevel);
dialog = SeAddDialog(name, popup);
XawDialogAddButton(dialog, "exit", ErrorExitCallback, (XtPointer) callback);
PopupCenteredOnRoot(popup);
Beep();
XtMapWidget(popup);
}
void
PopupFatalError(name)
String name;
{
Widget popup,
dialog;
void cleanup_exit();
if (XtIsRealized(topLevel))
popup = AddSimplePopup("fatalError", topLevel);
else
popup = AddPopupTopLevelNoGeom("fatalError", topLevel);
dialog = SeAddDialog(name, popup);
XawDialogAddButton(dialog, "exit", ErrorExitCallback,
(XtPointer) cleanup_exit);
Beep();
if (XtIsRealized(topLevel))
{PopupCentered(popup, topLevel); return;}
PopupCenteredOnRoot(popup);
XtMapWidget(popup);
XtAppMainLoop(app_con);
}
void
PopupError(name, parent)
String name;
Widget parent;
{
Widget popup,
dialog;
if (!parent) parent = topLevel;
if (XtIsRealized(parent))
popup = AddSimplePopup("error", parent, topLevel);
else
popup = AddPopupTopLevelNoGeom("error", parent);
dialog = SeAddDialog(name, popup);
XawDialogAddButton(dialog, "dismiss", DestroyShellCallBack,
(XtPointer)popup);
Beep();
if (XtIsRealized(parent))
{PopupCentered(popup, parent); return;}
PopupCenteredOnRoot(popup);
XtMapWidget(popup);
}
#ifdef notdef
void
SePopupWarningF(parent, fmt, a, b, c, d)
Widget parent;
String fmt,
a,
b,
c,
d;
{
SePopupNoticeF(parent, 0, "Seyon Warning", DestroyParentPopup,
fmt, a, b, c, d);
}
void
SePopupInitWarningF(parent, fmt, a, b, c, d)
Widget parent;
String fmt,
a,
b,
c,
d;
{
SePopupNoticeF(parent, 0, "Seyon Initialization Warning",
DestroyParentPopup, fmt, a, b, c, d);
}
#endif