Don't use fstat for readable pipe chars in dtexec.
[oweals/cde.git] / cde / programs / dtcreate / Confirmed.c
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $XConsortium: Confirmed.c /main/5 1996/10/15 14:44:45 rswiston $ */
24 /*******************************************************************************
25         Confirmed.c
26
27        Associated Header file: Confirmed.h
28 *******************************************************************************/
29
30 #include <stdio.h>
31 #include <stdlib.h>
32
33 #include <Xm/Xm.h>
34 #include <Xm/MessageB.h>
35 #include <sys/signal.h>
36
37 #include "dtcreate.h"
38 #include "UxXt.h"
39 #include "CreateActionAppShell.h"
40
41 #define CONTEXT_MACRO_ACCESS 1
42 #include "Confirmed.h"
43 #undef CONTEXT_MACRO_ACCESS
44
45 /*******************************************************************************
46        The following are callback functions for Confirmed dialog.
47 *******************************************************************************/
48
49 /******************************************************************************/
50 /* activateCB_Confirmed_OkButton                                              */
51 /******************************************************************************/
52 void    activateCB_Confirmed_OkButton( Widget  UxWidget,
53                                         XtPointer UxClientData,
54                                         XtPointer UxCallbackArg)
55
56 {
57   XtDestroyWidget(XtParent(UxWidget));
58 }
59 /******************************************************************************/
60 /* display_confirmed_message                                                  */
61 /*                                                                            */
62 /* INPUT:  Widget parent - parent to position dialog on.                      */
63 /*         char *message - message to display in dialog box                   */
64 /* OUTPIT: none                                                               */
65 /*                                                                            */
66 /******************************************************************************/
67 void display_confirmed_message (Widget parent, char *message)
68 {
69
70   Confirmed = XmCreateInformationDialog(parent, "confirmedDialog", NULL, 0);
71   XtUnmanageChild (XmMessageBoxGetChild (Confirmed, XmDIALOG_CANCEL_BUTTON));
72   XtUnmanageChild (XmMessageBoxGetChild (Confirmed, XmDIALOG_HELP_BUTTON));
73
74   XtAddCallback( Confirmed, XmNokCallback,
75           (XtCallbackProc) activateCB_Confirmed_OkButton,
76           (XtPointer) NULL );
77
78   XtVaSetValues (Confirmed,
79                  RES_CONVERT(XmNdialogTitle, GETMESSAGE(6, 41, "Create Action - Confirmation")),
80                  RES_CONVERT(XmNmessageString, message),
81                  NULL);
82   XtRealizeWidget(Confirmed);
83
84   XtManageChild (Confirmed);
85   return;
86 }
87 /*******************************************************************************
88        The following are callback functions for Question dialog
89 *******************************************************************************/
90
91 /******************************************************************************/
92 /*                                                                            */
93 /* cancelCB_QuestionDialog                                                    */
94 /*                                                                            */
95 /******************************************************************************/
96 void    cancelCB_QuestionDialog(Widget UxWidget,
97                                    XtPointer UxClientData,
98                                    XtPointer UxCallbackArg)
99 {
100   XtDestroyWidget(XtParent(UxWidget));
101 }
102
103 /******************************************************************************/
104 /*                                                                            */
105 /* nosaveCB_QuestionDialog                                                    */
106 /*                                                                            */
107 /******************************************************************************/
108 void    nosaveCB_QuestionDialog(Widget UxWidget,
109                                    XtPointer UxClientData,
110                                    XtPointer UxCallbackArg)
111 {
112   XtDestroyWidget(XtParent(UxWidget));
113   FreeResources();
114   exit(0);
115 }
116
117 /******************************************************************************/
118 /*                                                                            */
119 /* saveCallbackB_QuestionDialog                                               */
120 /*                                                                            */
121 /******************************************************************************/
122 void    saveCB_QuestionDialog(Widget UxWidget,
123                                      XtPointer  UxClientData,
124                                      XtPointer UxCallbackArg)
125
126 {
127   XtDestroyWidget(XtParent(UxWidget));
128
129   /********************************************************************/
130   /* Activate the save routine.                                       */
131   /********************************************************************/
132   activateCB_CA_MB_FileSave((Widget)NULL, (XtPointer)NULL, (XtPointer)NULL);
133
134 }
135
136 /******************************************************************************/
137 /* display_question_message                                                   */
138 /*                                                                            */
139 /* INPUT:  Widget parent - parent to position dialog on.                      */
140 /*         char *message - message to display in dialog box                   */
141 /* OUTPIT: none                                                               */
142 /*                                                                            */
143 /******************************************************************************/
144 void display_question_message (Widget parent, char *message,
145                                char *button1, XtCallbackProc cb_button1,
146                                char *button2, XtCallbackProc cb_button2,
147                                char *button3, XtCallbackProc cb_button3)
148 {
149   Widget tmpw;
150
151   QuestionDialog = XmCreateQuestionDialog(parent, "questionDialog", NULL, 0);
152
153   tmpw = XmMessageBoxGetChild(QuestionDialog, XmDIALOG_OK_BUTTON);
154   if (button1) {
155      XtVaSetValues(tmpw,
156                    RES_CONVERT( XmNlabelString, button1),
157                    NULL);
158      XtAddCallback( QuestionDialog, XmNokCallback,
159              (XtCallbackProc) cb_button1,
160              (XtPointer) NULL );
161   } else {
162      XtUnmanageChild (tmpw);
163   }
164
165   tmpw = XmMessageBoxGetChild(QuestionDialog, XmDIALOG_CANCEL_BUTTON);
166   if (button2) {
167      XtVaSetValues(tmpw,
168                    RES_CONVERT( XmNlabelString, button2),
169                    NULL);
170      XtAddCallback( QuestionDialog, XmNcancelCallback,
171              (XtCallbackProc) cb_button2,
172              (XtPointer) NULL );
173   } else {
174      XtUnmanageChild (tmpw);
175   }
176
177   tmpw = XmMessageBoxGetChild(QuestionDialog, XmDIALOG_HELP_BUTTON);
178   if (button3) {
179      XtVaSetValues(tmpw,
180                    RES_CONVERT( XmNlabelString, button3),
181                    NULL);
182      XtAddCallback( QuestionDialog, XmNhelpCallback,
183              (XtCallbackProc) cb_button3,
184              (XtPointer) NULL );
185   } else {
186      XtUnmanageChild (tmpw);
187   }
188
189   XtVaSetValues (QuestionDialog,
190                  RES_CONVERT(XmNdialogTitle, GETMESSAGE(6, 51, "Create Action - Question")),
191                  RES_CONVERT(XmNmessageString, message),
192                  NULL);
193
194   XtManageChild (QuestionDialog);
195   return;
196 }
197 /*******************************************************************************
198        END OF FILE
199 *******************************************************************************/
200