2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
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)
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
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
23 /*** DTB_USER_CODE_START vvv Add file header below vvv ***/
25 * $XConsortium: cgen_env_stubs.c /main/4 1996/04/18 13:17:55 drk $
27 * @(#)cgen_env_stubs.c 1.15 16 Feb 1995 cde_app_builder/src/ab
29 * RESTRICTED CONFIDENTIAL INFORMATION:
31 * The information in this document is subject to special
32 * restrictions in a confidential disclosure agreement between
33 * HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
34 * document outside HP, IBM, Sun, USL, SCO, or Univel without
35 * Sun's specific written approval. This document and all copies
36 * and derivative works thereof must be returned or destroyed at
39 * Copyright 1993 Sun Microsystems, Inc. All rights reserved.
43 /*** DTB_USER_CODE_END ^^^ Add file header above ^^^ ***/
46 * File: cgen_env_stubs.c
47 * Contains: Module callbacks and connection functions
49 * This file was generated by dtcodegen, from module cgen_env
51 * Any text may be added between the DTB_USER_CODE_START and
52 * DTB_USER_CODE_END comments (even non-C code). Descriptive comments
53 * are provided only as an aid.
55 * ** EDIT ONLY WITHIN SECTIONS MARKED WITH DTB_USER_CODE COMMENTS. **
56 * ** ALL OTHER MODIFICATIONS WILL BE OVERWRITTEN. DO NOT MODIFY OR **
57 * ** DELETE THE GENERATED COMMENTS! **
62 #include "dtb_utils.h"
63 #include "dtbuilder.h"
64 #include "cgen_env_ui.h"
67 /**************************************************************************
68 *** DTB_USER_CODE_START
70 *** All necessary header files have been included.
72 *** Add include files, types, macros, externs, and user functions here.
78 #include "dtbuilder.h"
79 #include "cgen_env_ui.h"
80 #include <ab_private/strlist.h>
81 #include "palette_ui.h"
83 #include "dtb_utils.h"
85 /*** DTB_USER_CODE_END
87 *** End of user code section
89 **************************************************************************/
100 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
102 DtbCgenEnvDialogInfo env_dlg = (DtbCgenEnvDialogInfo)clientData;
103 STRING var_name = NULL;
104 STRING var_value = NULL;
107 var_name = XmTextFieldGetString(env_dlg->name_textf);
108 if (util_strempty(var_name))
110 /* clean out the value textpane */
111 XmTextSetString(env_dlg->textpane, NULL);
115 if (strlist_str_exists(user_env_vars, var_name))
117 var_value = (STRING) strlist_get_str_data(user_env_vars, var_name);
122 var_value = getenv(var_name);
124 if (var_value == NULL)
126 XmTextSetString(env_dlg->textpane, catgets(Dtb_project_catd, 100, 58, "*** Not Set ***"));
130 XmTextSetString(env_dlg->textpane, var_value);
135 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
137 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
138 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
145 XtPointer clientData,
149 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
151 DtbCgenEnvDialogInfo env_dlg = (DtbCgenEnvDialogInfo)clientData;
152 STRING var_name = NULL;
153 STRING var_value = NULL;
154 STRING old_var_value = NULL;
156 var_name = XmTextFieldGetString(env_dlg->name_textf);
158 if (util_strempty(var_name))
161 var_value = XmTextGetString(env_dlg->textpane);
163 if (strlist_str_exists(user_env_vars, var_name))
165 /* the user has set this before - we need to deallocate
166 * the string we allocated
168 old_var_value = (STRING) strlist_get_str_data(user_env_vars, var_name);
169 util_free(old_var_value);
170 strlist_remove_str(user_env_vars, var_name);
172 if (!util_strempty(var_value))
173 strlist_add_str(user_env_vars, var_name, (void *)strdup(var_value));
175 strlist_add_str(user_env_vars, var_name, (void *)NULL);
177 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
179 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
180 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
187 XtPointer clientData,
191 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
192 DtbCgenEnvDialogInfo env_dlg = (DtbCgenEnvDialogInfo)clientData;
193 STRING var_name = NULL;
194 STRING var_value = NULL;
196 var_name = XmTextFieldGetString(env_dlg->name_textf);
198 if (util_strempty(var_name))
201 if (strlist_str_exists(user_env_vars, var_name))
203 /* the user has set this before - we need to deallocate
204 * the string we allocated
206 var_value = (STRING) strlist_get_str_data(user_env_vars, var_name);
207 util_free(var_value);
208 strlist_remove_str(user_env_vars, var_name);
210 var_value = getenv(var_name);
212 if (var_value == NULL)
214 XmTextSetString(env_dlg->textpane, catgets(Dtb_project_catd, 100, 58, "*** Not Set ***"));
218 XmTextSetString(env_dlg->textpane, var_value);
221 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
223 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
224 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
231 XtPointer clientData,
235 DtbCgenEnvDialogInfo dtbSource = (DtbCgenEnvDialogInfo)callData;
237 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
239 if (user_env_vars == NULL)
241 user_env_vars = strlist_create();
244 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
246 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
247 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
254 XtPointer clientData,
258 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
259 DtbCgenEnvDialogInfo env_dlg = (DtbCgenEnvDialogInfo)clientData;
263 XmTextFieldSetString(env_dlg->name_textf, buf);
264 XmTextSetString(env_dlg->textpane, buf);
266 XtPopdown(env_dlg->dialog);
268 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
270 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
271 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
276 /**************************************************************************
277 *** DTB_USER_CODE_START
279 *** All automatically-generated data and functions have been defined.
281 *** Add new functions here, or at the top of the file.
283 /*** DTB_USER_CODE_END
285 *** End of user code section
287 **************************************************************************/