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 /* $TOG: OverWrite.c /main/8 1998/10/26 12:40:12 mgreess $ */
24 /************************************<+>*************************************
25 ****************************************************************************
29 * COMPONENT_NAME: Desktop File Manager (dtfile)
31 * Description: Contains routines for collision dialog during
32 * move/copy/link operations.
34 * FUNCTIONS: Create_Action_Area
35 * buffer_multicollide_ok_callback
36 * buffer_replace_rename_ok_callback
37 * create_multicollide_dialog
38 * create_replace_merge_dialog
39 * create_replace_rename_dialog
41 * multiRenameError_ok_callback
42 * multiReplaceError_ok_callback
43 * multicollide_cancel_callback
44 * multicollide_ok_callback
45 * renameError_ok_callback
46 * replaceError_ok_callback
47 * replace_merge_cancel_callback
48 * replace_merge_ok_callback
49 * replace_rename_cancel_callback
50 * replace_rename_ok_callback
51 * replace_rename_radio_callback
53 * (c) Copyright 1993, 1994, 1995 Hewlett-Packard Company
54 * (c) Copyright 1993, 1994, 1995 International Business Machines Corp.
55 * (c) Copyright 1993, 1994, 1995 Sun Microsystems, Inc.
56 * (c) Copyright 1993, 1994, 1995 Novell, Inc.
58 ****************************************************************************
59 ************************************<+>*************************************/
64 #include <Xm/DialogS.h>
69 #include <Xm/RowColumn.h>
70 #include <Xm/ToggleB.h>
72 #include <Xm/Separator.h>
75 #include <Dt/DtNlUtils.h>
81 #include "SharedProcs.h"
84 #include "sharedFuncs.h"
89 #define VERTICAL_SPACING 5
90 #define HORIZONTAL_SPACING 10
91 #define TOP_SPACING (VERTICAL_SPACING + 3)
93 /* types of messages sent through the pipe */
94 /* these messages are also defined & used in FileOp.c */
95 #define PIPEMSG_CANCEL 101
96 #define PIPEMSG_PROCEED 102
97 #define PIPEMSG_MERGE 103
98 #define PIPEMSG_REPLACE_BUFFER 104
99 #define PIPEMSG_RENAME_BUFFER 105
100 #define PIPEMSG_MULTI_PROCEED 106
102 #define RADIO_REPLACE 0
103 #define RADIO_RENAME 1
106 /* global variables */
107 Boolean G_initImages = True;
108 int G_filop_confirm_fd = -1;
109 char G_directory[MAX_PATH];
110 char G_file[MAX_PATH];
111 String *G_fileList = NULL;
112 int G_nCollisions = 0;
113 Widget G_dialogShell = NULL;
114 Widget G_rename_text = NULL;
115 Widget G_rename_toggle = NULL;
116 Widget G_merge_toggle = NULL;
117 Widget G_multi_rename_toggle = NULL;
122 vm_replaceCannotDeleteFolder, /* 80 81 */
123 vm_replaceCannotDeleteFile, /* 82 */
124 vm_multiCannotRenameMany, /* 83 84 */
125 vm_multiCannotRenameOne, /* 85 84 */
126 vm_multiCannotDeleteFolderMany, /* 86 */
127 vm_multiCannotDeleteFolderOne, /* 87 */
128 vm_multiCannotDeleteFileMany, /* 88 */
129 vm_multiCannotDeleteFileOne /* 89 */
132 /* local functions */
133 static void replaceError_ok_callback(
135 XtPointer client_data,
136 XtPointer call_data);
137 static void renameError_ok_callback(
139 XtPointer client_data,
140 XtPointer call_data);
141 static void multiReplaceError_ok_callback(
143 XtPointer client_data,
144 XtPointer call_data);
145 static void multiRenameError_ok_callback(
147 XtPointer client_data,
148 XtPointer call_data);
149 static char * getVariableMessage(
150 VariableMessage message,
152 static Boolean IsReplaceable(
156 /*--------------------------------------------------------------------
158 *------------------------------------------------------------------*/
162 replace_rename_ok_callback(
164 XtPointer client_data,
167 const int rc = PIPEMSG_PROCEED;
168 String newFile, renameNewName, destinationName;
171 static char msg[30+(3*MAX_PATH)];
173 char *newFileDir = NULL;
174 char *newFileName = NULL;
177 Boolean same = (Boolean)client_data;
179 /* if same is true, then the object is tring to be copied into the same
180 * folder as itself. So the existing files stay the same and the new files
181 * being created take on the new names.
184 /* Rename was selected */
185 if (XmToggleButtonGetState(G_rename_toggle))
187 newFile = XmTextFieldGetString(G_rename_text);
188 renameNewName = build_path(G_directory,newFile);
189 destinationName = build_path(G_directory,G_file);
191 /* make sure renameNewName does not exist */
192 if ( (lstat(renameNewName, &buf)) == 0)
195 GETMESSAGE(9, 38, "%s\nalready exists: choose another name."),
197 title = XtNewString(GETMESSAGE(9, 37, "Object Rename - Error"));
198 _DtMessageDialog (G_dialogShell, title, msg, 0, FALSE, NULL,
199 renameError_ok_callback, NULL, NULL, False, ERROR_DIALOG);
201 XtFree(renameNewName);
202 XtFree(destinationName);
208 /* attempt the rename ... since rename function is being used, this*/
209 /* only allows renames within the same filesystem */
211 DirectoryFileModified(home_host_name, G_directory, G_file);
212 if (DtStrchr(newFile, '/') == NULL)
213 DirectoryFileModified(home_host_name, G_directory, newFile);
216 newFileName = strrchr(renameNewName, '/');
217 newFileDirLen = newFileName - renameNewName;
220 newFileDir = XtMalloc(newFileDirLen + 1);
221 strncpy(newFileDir, renameNewName, newFileDirLen);
222 newFileDir[newFileDirLen] = '\0';
224 DirectoryBeginModify(home_host_name, newFileDir);
225 DirectoryFileModified(home_host_name, newFileDir, newFileName);
229 rename_rc = rename(destinationName, renameNewName);
231 if (newFileDir != NULL)
233 DirectoryEndModify(home_host_name, newFileDir);
241 GETMESSAGE(9, 39, "%s\ncannot be renamed to\n%s\n%s"),
242 destinationName, renameNewName, strerror(saveError));
243 title = XtNewString(GETMESSAGE(9, 37, "Object Rename - Error"));
244 _DtMessageDialog (G_dialogShell, title, msg, 0, FALSE, NULL,
245 renameError_ok_callback, NULL, NULL, False, ERROR_DIALOG);
247 XtFree(renameNewName);
248 XtFree(destinationName);
252 XtFree(renameNewName);
253 XtFree(destinationName);
256 /* Replace was selected ... remove the offending target */
259 destinationName = build_path(G_directory,G_file);
260 DirectoryFileModified(home_host_name, G_directory, G_file);
261 if(IsReplaceable(destinationName))
262 fsErase(destinationName,&saveError,False);
265 if ( saveError == 0 )
267 /* removal succeeded */
268 XtFree(destinationName);
274 stat(destinationName,&buf);
275 title = XtNewString(GETMESSAGE(9, 40, "Object Replace - Error"));
277 if (S_ISDIR(buf.st_mode))
279 strcpy(msg,getVariableMessage(vm_replaceCannotDeleteFolder, G_mode));
284 getVariableMessage(vm_replaceCannotDeleteFile, G_mode),
288 _DtMessageDialog (G_dialogShell, title, msg, 0, FALSE, NULL,
289 replaceError_ok_callback, NULL, NULL, False, ERROR_DIALOG);
291 XtFree(destinationName);
296 /* close the dialog */
297 XtDestroyWidget(G_dialogShell);
298 G_dialogShell = NULL;
300 /* send return code through the pipe to the background proc */
301 write(G_filop_confirm_fd, &rc, sizeof(int));
302 G_filop_confirm_fd = -1;
304 } /* end replace_rename_ok_callback */
308 buffer_replace_rename_ok_callback(
310 XtPointer client_data,
314 String newFile, renameNewName, destinationName;
317 static char msg[38+MAX_PATH];
321 /* Rename was selected */
322 if (XmToggleButtonGetState(G_rename_toggle))
324 newFile = XmTextFieldGetString(G_rename_text);
325 renameNewName = build_path(G_directory,newFile);
326 destinationName = build_path(G_directory,G_file);
328 /* make sure renameNewName does not exist */
329 if ( (lstat(renameNewName, &buf)) == 0)
332 GETMESSAGE(9, 38, "%s\nalready exists: choose another name."),
334 title = XtNewString(GETMESSAGE(9, 37, "Object Rename - Error"));
335 _DtMessageDialog (G_dialogShell, title, msg, 0, FALSE, NULL,
336 renameError_ok_callback, NULL, NULL, False, ERROR_DIALOG);
338 XtFree(renameNewName);
339 XtFree(destinationName);
344 /* Perform the actual rename in the child process */
345 /* set up pipe message */
346 rc = PIPEMSG_RENAME_BUFFER;
349 XtFree(renameNewName);
350 XtFree(destinationName);
352 /* Replace was selected ... remove the offending target */
355 destinationName = build_path(G_directory,G_file);
356 if(IsReplaceable(destinationName))
357 fsErase(destinationName,&saveError,False);
360 if ( saveError == 0 )
363 rc = PIPEMSG_REPLACE_BUFFER;
364 /* removal succeeded */
365 XtFree(destinationName);
372 stat(destinationName,&buf);
373 title = XtNewString(GETMESSAGE(9, 40, "Object Replace - Error"));
375 if (S_ISDIR(buf.st_mode))
377 strcpy(msg,getVariableMessage(vm_replaceCannotDeleteFolder, COPY_FILE));
382 getVariableMessage(vm_replaceCannotDeleteFile, COPY_FILE),
387 _DtMessageDialog (G_dialogShell, title, msg, 0, FALSE, NULL,
388 replaceError_ok_callback, NULL, NULL, False, ERROR_DIALOG);
390 XtFree(destinationName);
395 /* close the dialog */
396 XtDestroyWidget(G_dialogShell);
397 G_dialogShell = NULL;
399 /* send return code through the pipe to the background proc */
400 write(G_filop_confirm_fd, &rc, sizeof(int));
402 /* write the the new name on the pipe if rename is selected */
403 if (XmToggleButtonGetState(G_rename_toggle))
405 DPRINTF(("Writing %s to %d\n", newFile ,G_filop_confirm_fd));
406 PipeWriteString(G_filop_confirm_fd, newFile);
409 G_filop_confirm_fd = -1;
411 } /* end buffer_replace_rename_ok_callback */
415 replace_rename_cancel_callback(
417 XtPointer client_data,
420 const int rc = PIPEMSG_CANCEL;
422 /* close the dialog */
423 XtDestroyWidget(G_dialogShell);
424 G_dialogShell = NULL;
426 /* send negative return code through the pipe to the background proc */
427 write(G_filop_confirm_fd, &rc, sizeof(int));
428 G_filop_confirm_fd = -1;
430 } /* end replace_rename_cancel_callback */
434 replace_rename_radio_callback(
436 XtPointer client_data,
439 XmToggleButtonCallbackStruct *state = (XmToggleButtonCallbackStruct *)call_data;
443 switch ((int) client_data)
446 XtVaSetValues (G_rename_text,
452 XtVaSetValues (G_rename_text,
455 XmProcessTraversal(G_rename_text, XmTRAVERSE_CURRENT);
463 } /* end replace_rename_radio_callback */
468 renameError_ok_callback(
470 XtPointer client_data,
473 XtDestroyWidget((Widget)client_data);
474 XmProcessTraversal(G_rename_text, XmTRAVERSE_CURRENT);
477 } /* end renameError_ok_callback */
481 replace_merge_ok_callback(
483 XtPointer client_data,
487 String newFile=NULL, renameNewName, renameOldName;
492 char *destinationPath = build_path(G_directory,G_file);
494 if (XmToggleButtonGetState(G_merge_toggle))
498 rc = PIPEMSG_PROCEED;
499 if(DirectoryBusy(destinationPath))
503 msg = GETMESSAGE(11,30, "Cannot move or rename the folder %s.\n\
504 All File Manager views displayed for a folder or its sub-folders\n\
505 must be closed before a folder can be moved or renamed.");
507 errmsg = XtMalloc(strlen(msg)+strlen(destinationPath)+1);
508 sprintf(errmsg,msg,destinationPath);
509 title = XtNewString(GETMESSAGE(9, 40, "Object Replace - Error"));
510 _DtMessage(toplevel, title, errmsg, NULL, HelpRequestCB);
513 XtFree(destinationPath);
518 /* close the dialog */
519 XtDestroyWidget(G_dialogShell);
520 G_dialogShell = NULL;
522 /* send return code through the pipe to the background proc */
523 write(G_filop_confirm_fd, &rc, sizeof(int));
524 G_filop_confirm_fd = -1;
526 } /* end replace_merge_ok_callback */
531 replace_merge_cancel_callback(
533 XtPointer client_data,
536 const int rc = PIPEMSG_CANCEL;
538 /* close the dialog */
539 XtDestroyWidget(G_dialogShell);
540 G_dialogShell = NULL;
542 /* send negative return code through the pipe to the background proc */
543 write(G_filop_confirm_fd, &rc, sizeof(int));
544 G_filop_confirm_fd = -1;
546 } /* end replace_merge_cancel_callback */
551 multicollide_cancel_callback(
553 XtPointer client_data,
556 const int rc = PIPEMSG_CANCEL;
559 /* close the dialog */
560 XtDestroyWidget(G_dialogShell);
561 G_dialogShell = NULL;
563 /* de-allocate the file list */
564 for ( i = 0; i < G_nCollisions; i++)
565 XtFree((char *)G_fileList[i]);
566 XtFree((char *)G_fileList);
569 /* send return code through the pipe to the background proc */
570 write(G_filop_confirm_fd, &rc, sizeof(int));
571 G_filop_confirm_fd = -1;
573 } /* end multicollide_cancel_callback */
577 multicollide_ok_callback(
579 XtPointer client_data,
582 const int rc = PIPEMSG_MULTI_PROCEED;
585 String destinationPath;
587 static char msg[1024];
591 Boolean same = (Boolean)client_data;
593 /* if same is true, then the object is tring to be copied into the same
594 * folder as itself. So the existing files stay the same and the new files
595 * being created take on the new names.
598 if (XmToggleButtonGetState(G_multi_rename_toggle))
601 title = XtNewString(GETMESSAGE(9, 37, "Object Rename - Error"));
603 write(G_filop_confirm_fd, &rc, sizeof(int));
604 /* Auto rename was selected */
605 for ( i = 0; i < G_nCollisions; i++)
610 destinationPath = build_path(G_directory,G_fileList[i]);
611 DirectoryFileModified(home_host_name, G_directory, G_fileList[i]);
612 if ( auto_rename(destinationPath) != 0)
616 names = (char *) XtNewString(destinationPath);
619 names = (char *)XtRealloc(names,strlen(names)+
620 strlen(destinationPath)+2);
622 strcat(names,destinationPath);
627 write(G_filop_confirm_fd, &saveError, sizeof(int));
628 XtFree(destinationPath);
634 write(G_filop_confirm_fd, &saveError, sizeof(int));
644 buf = XtMalloc(strlen(GETMESSAGE(9,138, "Failed to rename the following object(s)\n\n%s\n\nThe most likely cause is that you do not have\npermission to rename these objects(s)"))+strlen(names)+10);
645 sprintf(buf,GETMESSAGE(9,138, "Failed to rename the following object(s)\n\n%s\n\nThe most likely cause is that you do not have\npermission to rename these object(s)"),names);
646 _DtMessage(toplevel, title, buf, NULL, HelpRequestCB);
657 title = XtNewString(GETMESSAGE(9, 40, "Object Replace - Error"));
658 write(G_filop_confirm_fd, &rc, sizeof(int));
660 /* Replace was selected ... remove the offending targets */
661 for ( i = 0; i < G_nCollisions; i++)
663 destinationPath = build_path(G_directory,G_fileList[i]);
664 if(IsReplaceable(destinationPath))
666 if(DirectoryBusy(destinationPath))
670 msg = GETMESSAGE(11,30, "Cannot move or rename the folder%s.\nAll File Manager views displayed for a folder or its sub-folders\nmust be closed before a folder can be moved or renamed.");
672 errmsg = XtMalloc(strlen(msg)+strlen(destinationPath)+1);
673 sprintf(errmsg,msg,destinationPath);
674 _DtMessage(toplevel, title, errmsg, NULL, HelpRequestCB);
676 XtFree(destinationPath);
680 fsErase(destinationPath,&saveError,False);
684 write(G_filop_confirm_fd, &saveError, sizeof(int));
688 names = (char *) XtNewString(destinationPath);
691 names = (char *)XtRealloc(names,strlen(names)+
692 strlen(destinationPath)+2);
694 strcat(names,destinationPath);
697 XtFree(destinationPath);
703 buf = XtMalloc(strlen(GETMESSAGE(9,139, "Failed to replace the following object(s)\n\n%s\n\nThe most likely cause is that you do not have\npermission to replace these object(s)"))+strlen(names)+10);
704 sprintf(buf,GETMESSAGE(9,139, "Failed to replace the following object(s)\n\n%s\n\nThe most likely cause is that you do not have\npermission to replace these object(s)"),names);
705 _DtMessage(toplevel, title, buf, NULL, HelpRequestCB);
713 /* close the dialog */
714 XtDestroyWidget(G_dialogShell);
715 G_dialogShell = NULL;
717 /* de-allocate the file list */
718 for ( i = 0; i < G_nCollisions; i++)
719 XtFree((char *)G_fileList[i]);
720 XtFree((char *)G_fileList);
723 /* send return code through the pipe to the background proc */
725 write(G_filop_confirm_fd, &rc, sizeof(int));
727 G_filop_confirm_fd = -1;
728 } /* end multicollide_ok_callback */
732 buffer_multicollide_ok_callback(
734 XtPointer client_data,
740 String destinationPath;
742 char newPath[MAX_PATH];
744 static char msg[1024];
748 if (XmToggleButtonGetState(G_multi_rename_toggle))
750 /* send return code through the pipe to the background proc */
751 rc = PIPEMSG_RENAME_BUFFER;
752 write(G_filop_confirm_fd, &rc, sizeof(int));
754 /* Auto rename was selected */
755 for ( i = 0; i < G_nCollisions; i++)
757 /* automatically generated new name */
758 destinationPath = build_path(G_directory,G_fileList[i]);
759 generate_NewPath(newPath, destinationPath);
760 newFile= strrchr(newPath,'/') + 1 ;
762 DPRINTF (("buffer_multicollide_ok_callback: new file is %s\n", newFile));
764 /* write new name on the pipe */
766 PipeWriteString(G_filop_confirm_fd, newFile);
768 XtFree(destinationPath);
770 } /* endif multi auto-rename */
773 title = XtNewString(GETMESSAGE(9, 40, "Object Replace - Error"));
775 /* Replace was selected ... remove the offending targets */
776 for ( i = 0; i < G_nCollisions; i++)
778 /* set the pipe msg */
779 rc = PIPEMSG_REPLACE_BUFFER;
781 destinationPath = build_path(G_directory,G_fileList[i]);
782 fsErase(destinationPath,&saveError,False);
783 if ( saveError != 0 )
786 stat(destinationPath,&buf);
788 if ( S_ISDIR(buf.st_mode) && i != 1 )
791 getVariableMessage(vm_multiCannotDeleteFolderMany, COPY_FILE),
794 else if ( S_ISDIR(buf.st_mode) && i == 1)
797 getVariableMessage(vm_multiCannotDeleteFolderOne, COPY_FILE),
800 else if ( ! S_ISDIR(buf.st_mode) && i != 1 )
803 getVariableMessage(vm_multiCannotDeleteFileMany, COPY_FILE),
806 else /* ! S_ISDIR(buf.st_mode) && i == 1 ) */
809 getVariableMessage(vm_multiCannotDeleteFileOne, COPY_FILE),
812 _DtMessageDialog (G_dialogShell, title, msg, 0, FALSE, NULL,
813 multiReplaceError_ok_callback, NULL, NULL, False, ERROR_DIALOG);
814 XtFree(destinationPath);
819 /* send return code through the pipe to the background proc */
820 rc = PIPEMSG_REPLACE_BUFFER;
821 write(G_filop_confirm_fd, &rc, sizeof(int));
823 XtFree(destinationPath);
829 /* close the dialog */
830 XtDestroyWidget(G_dialogShell);
831 G_dialogShell = NULL;
833 /* de-allocate the file list */
834 for ( i = 0; i < G_nCollisions; i++)
835 XtFree((char *)G_fileList[i]);
836 XtFree((char *)G_fileList);
839 G_filop_confirm_fd = -1;
841 } /* end multicollide_ok_callback */
846 replaceError_ok_callback(
848 XtPointer client_data,
851 XtDestroyWidget((Widget)client_data);
854 } /* end replaceError_ok_callback */
859 multiReplaceError_ok_callback(
861 XtPointer client_data,
864 XtDestroyWidget((Widget)client_data);
867 } /* end multiReplaceError_ok_callback */
872 multiRenameError_ok_callback(
874 XtPointer client_data,
877 XtDestroyWidget((Widget)client_data);
880 } /* end multiRenameError_ok_callback */
884 /*--------------------------------------------------------------------
885 * create replace/rename dialog
886 *------------------------------------------------------------------*/
889 create_replace_rename_dialog(Widget parent_widget,
893 int filop_confirm_fd,
894 ActionAreaDefn actions,
908 Pixel background, foreground;
909 char path[MAX_PATH], newDir[MAX_PATH], newFile[MAX_PATH];
919 XBell( XtDisplay( G_dialogShell ), 100 );
923 /* make args available to callback functions */
924 G_filop_confirm_fd = filop_confirm_fd;
926 strcpy(G_directory,directory);
929 /* Initialize images for error, warning, ... icons */
932 ImageInitialize(XtDisplay(toplevel));
933 G_initImages = False;
936 /* Initialize mode-dependent things */
938 orig_label = actions.actionList[1].label;
939 orig_msg_num = actions.actionList[1].msg_num;
942 title = XtNewString(GETMESSAGE(9, 34, "File Manager - Move Warning"));
943 XtSetArg (args[n], XmNtitle, title);
945 actions.actionList[1].label = XtNewString(GETMESSAGE(9, 30, "Cancel Move"));
946 actions.actionList[1].msg_num = 30;
949 title = XtNewString(GETMESSAGE(9, 35, "File Manager - Copy Warning"));
950 XtSetArg (args[n], XmNtitle, title);
952 actions.actionList[1].label = XtNewString(GETMESSAGE(9, 31, "Cancel Copy"));
953 actions.actionList[1].msg_num = 31;
956 title = XtNewString(GETMESSAGE(9, 36, "File Manager - Link Warning"));
957 XtSetArg (args[n], XmNtitle, title);
959 actions.actionList[1].label = XtNewString(GETMESSAGE(9, 32, "Cancel Link"));
960 actions.actionList[1].msg_num = 32;
963 title = XtNewString(GETMESSAGE(9, 33, "File Manager - Move/Copy/Link Warning"));
964 XtSetArg (args[n], XmNtitle, title);
970 /* Create the dialog shell for the dialog */
971 G_dialogShell = XmCreateDialogShell (parent_widget, "replace/rename dialog", args, n);
974 /* Create the Manager Widget, form, for the copy dialog */
975 form = XtVaCreateWidget ("dialog_form",
976 xmFormWidgetClass, G_dialogShell,
977 XmNverticalSpacing, VERTICAL_SPACING,
978 XmNhorizontalSpacing, HORIZONTAL_SPACING,
979 XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL,
982 /* Create a question dialog icon */
984 XtSetArg (args[n], XmNbackground, &background); n++;
985 XtSetArg (args[n], XmNforeground, &foreground); n++;
986 XtGetValues (form, args, n);
988 px = XmGetPixmapByDepth(XtScreen(form), "xm_question",
989 foreground, background, form->core.depth);
990 if (px == XmUNSPECIFIED_PIXMAP)
991 px = XmGetPixmapByDepth(XtScreen(form), "default_xm_question",
992 foreground, background, form->core.depth);
994 icon = XtVaCreateManagedWidget("question_icon",
995 xmLabelWidgetClass, form,
996 XmNlabelType, XmPIXMAP,
998 XmNtopAttachment, XmATTACH_FORM,
999 XmNleftAttachment, XmATTACH_FORM,
1002 /* Create the message label */
1004 + strlen( GETMESSAGE(9, 16, "An object named\n%s\nalready exists inside the folder\n%s") )
1006 + strlen( directory ) );
1008 GETMESSAGE(9, 16, "An object named\n%s\nalready exists inside the folder\n%s"),
1012 xs = XmStringCreateLocalized(s);
1013 msg_label = XtVaCreateManagedWidget("msg_header",
1014 xmLabelWidgetClass, form,
1016 XmNalignment, XmALIGNMENT_BEGINNING,
1017 XmNtopAttachment, XmATTACH_FORM,
1018 XmNleftAttachment, XmATTACH_WIDGET,
1019 XmNleftWidget, icon,
1020 XmNleftOffset, HORIZONTAL_SPACING,
1021 XmNrightAttachment, XmATTACH_FORM,
1027 /* create the action-question */
1028 xs = XmStringCreateLocalized(GETMESSAGE(9, 20, "What do you want to do?"));
1029 action_label = XtVaCreateManagedWidget("action-question",
1030 xmLabelWidgetClass, form,
1032 XmNalignment, XmALIGNMENT_BEGINNING,
1033 XmNtopAttachment, XmATTACH_WIDGET,
1034 XmNtopWidget, msg_label,
1035 XmNtopOffset, 3*VERTICAL_SPACING,
1036 XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
1037 XmNleftWidget, msg_label,
1042 /* create radio box */
1045 XtSetArg (args[n], XmNorientation, XmVERTICAL); n++;
1046 XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
1047 XtSetArg (args[n], XmNtopWidget, action_label); n++;
1048 XtSetArg (args[n], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
1049 XtSetArg (args[n], XmNleftWidget, action_label); n++;
1050 XtSetArg (args[n], XmNleftOffset, 2*HORIZONTAL_SPACING); n++;
1051 radio = (Widget) XmCreateRadioBox(form, "radio_box", args, n);
1053 if( mode == MAKE_BUFFER )
1057 /* if the object is have the operation done to the same folder (i.e.
1058 being done to itself, we want the default to be to create a new name
1067 /* create the radio buttons ... default button is replace */
1068 xs = XmStringCreateLocalized(GETMESSAGE(9, 21, "Replace existing object"));
1069 radioButton1 = XtVaCreateManagedWidget("radio_toggle1",
1070 xmToggleButtonWidgetClass, radio,
1071 XmNalignment, XmALIGNMENT_BEGINNING,
1078 XtSetSensitive(radioButton1, True);
1079 XtAddCallback(radioButton1, XmNvalueChangedCallback, replace_rename_radio_callback, (XtPointer) RADIO_REPLACE);
1082 XtSetSensitive(radioButton1, False);
1084 if( mode == MAKE_BUFFER )
1086 xs = XmStringCreateLocalized(GETMESSAGE(10,48, "New Object Name:"));
1093 xs = XmStringCreateLocalized(GETMESSAGE(9, 140, "Rename new object to:"));
1098 xs = XmStringCreateLocalized(GETMESSAGE(9, 22, "Rename existing object to:"));
1102 G_rename_toggle = XtVaCreateManagedWidget("radio_toggle2",
1103 xmToggleButtonWidgetClass, radio,
1104 XmNalignment, XmALIGNMENT_BEGINNING,
1109 XtAddCallback(G_rename_toggle, XmNvalueChangedCallback, replace_rename_radio_callback, (XtPointer) RADIO_RENAME);
1111 XtManageChild(radio);
1114 /* create text field for entering a new file name */
1115 /* a name is generated to use as the default */
1116 _DtBuildPath(path,directory,file);
1117 generate_NewPath(path,path);
1118 split_path(path, newDir, newFile);
1119 G_rename_text = XtVaCreateManagedWidget("rename_text",
1120 xmTextFieldWidgetClass, form,
1121 XmNrightAttachment, XmATTACH_FORM,
1122 XmNleftAttachment, XmATTACH_WIDGET,
1123 XmNleftWidget, radio,
1124 XmNleftOffset, HORIZONTAL_SPACING,
1125 XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
1126 XmNbottomWidget, radio,
1129 XmNcursorPosition, strlen(newFile),
1132 /* create the action area */
1133 actionArea = Create_Action_Area(form, actions, NULL);
1134 separator = XtVaCreateManagedWidget("separator",
1135 xmSeparatorWidgetClass, form,
1136 XmNtopAttachment, XmATTACH_WIDGET,
1137 XmNtopWidget, radio,
1138 XmNbottomAttachment, XmATTACH_WIDGET,
1139 XmNbottomWidget, actionArea,
1140 XmNleftAttachment, XmATTACH_FORM,
1141 XmNrightAttachment, XmATTACH_FORM,
1145 /* set initial keyborad focus to the action button area */
1147 XmNinitialFocus, actionArea,
1150 /* Manage the dialog */
1151 XtManageChild(form);
1155 XtFree(actions.actionList[1].label);
1156 actions.actionList[1].label = orig_label;
1157 actions.actionList[1].msg_num = orig_msg_num;
1160 } /* end create_replace_rename_dialog */
1164 /*--------------------------------------------------------------------
1165 * create replace/merge dialog
1166 *------------------------------------------------------------------*/
1169 create_replace_merge_dialog(Widget parent_widget,
1173 int filop_confirm_fd,
1174 ActionAreaDefn actions)
1180 Widget action_label;
1183 Widget radioButton1;
1187 Pixel background, foreground;
1188 char path[MAX_PATH], newDir[MAX_PATH], newFile[MAX_PATH];
1197 XBell( XtDisplay( G_dialogShell ), 100 );
1201 /* make args available to callback functions */
1202 G_filop_confirm_fd = filop_confirm_fd;
1204 strcpy(G_directory,directory);
1205 strcpy(G_file,file);
1207 /* Initialize images for error, warning, ... icons */
1210 ImageInitialize(XtDisplay(toplevel));
1211 G_initImages = False;
1214 /* Initialize mode-dependent things */
1216 orig_label = actions.actionList[1].label;
1217 orig_msg_num = actions.actionList[1].msg_num;
1220 title = XtNewString(GETMESSAGE(9, 34, "File Manager - Move Warning"));
1221 XtSetArg (args[n], XmNtitle, title);
1223 actions.actionList[1].label = XtNewString(GETMESSAGE(9, 30, "Cancel Move"));
1224 actions.actionList[1].msg_num = 30;
1227 title = XtNewString(GETMESSAGE(9, 35, "File Manager - Copy Warning"));
1228 XtSetArg (args[n], XmNtitle, title);
1230 actions.actionList[1].label = XtNewString(GETMESSAGE(9, 31, "Cancel Copy"));
1231 actions.actionList[1].msg_num = 31;
1234 title = XtNewString(GETMESSAGE(9, 36, "File Manager - Link Warning"));
1235 XtSetArg (args[n], XmNtitle, title);
1237 actions.actionList[1].label = XtNewString(GETMESSAGE(9, 32, "Cancel Link"));
1238 actions.actionList[1].msg_num = 32;
1241 title = XtNewString(GETMESSAGE(9, 33, "File Manager - Move/Copy/Link Warning"));
1242 XtSetArg (args[n], XmNtitle, title);
1248 /* Create the dialog shell for the dialog */
1249 G_dialogShell = XmCreateDialogShell (parent_widget, "replace/merge dialog", args, n);
1252 /* Create the Manager Widget, form, for the copy dialog */
1253 form = XtVaCreateWidget ("dialog_form",
1254 xmFormWidgetClass, G_dialogShell,
1255 XmNverticalSpacing, VERTICAL_SPACING,
1256 XmNhorizontalSpacing, HORIZONTAL_SPACING,
1257 XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL,
1260 /* Create a question dialog icon */
1262 XtSetArg (args[n], XmNbackground, &background); n++;
1263 XtSetArg (args[n], XmNforeground, &foreground); n++;
1264 XtGetValues (form, args, n);
1266 px = XmGetPixmapByDepth(XtScreen(form), "xm_question",
1267 foreground, background, form->core.depth);
1268 if (px == XmUNSPECIFIED_PIXMAP)
1269 px = XmGetPixmapByDepth(XtScreen(form), "default_xm_question",
1270 foreground, background, form->core.depth);
1272 icon = XtVaCreateManagedWidget("question_icon",
1273 xmLabelWidgetClass, form,
1274 XmNlabelType, XmPIXMAP,
1276 XmNtopAttachment, XmATTACH_FORM,
1277 XmNleftAttachment, XmATTACH_FORM,
1280 /* Create the message label */
1282 + strlen( GETMESSAGE(9, 17, "A folder named\n%s\nalready exists inside the folder\n%s") )
1284 + strlen( directory ) );
1286 sprintf(s, GETMESSAGE(9, 17, "A folder named\n%s\nalready exists inside the folder\n%s"), file, directory);
1288 xs = XmStringCreateLocalized(s);
1289 msg_label = XtVaCreateManagedWidget("msg_header",
1290 xmLabelWidgetClass, form,
1292 XmNalignment, XmALIGNMENT_BEGINNING,
1293 XmNtopAttachment, XmATTACH_FORM,
1294 XmNleftAttachment, XmATTACH_WIDGET,
1295 XmNleftWidget, icon,
1296 XmNleftOffset, HORIZONTAL_SPACING,
1297 XmNrightAttachment, XmATTACH_FORM,
1303 /* create the action-question */
1304 xs = XmStringCreateLocalized(GETMESSAGE(9, 20, "What do you want to do?"));
1305 action_label = XtVaCreateManagedWidget("action-question",
1306 xmLabelWidgetClass, form,
1308 XmNalignment, XmALIGNMENT_BEGINNING,
1309 XmNtopAttachment, XmATTACH_WIDGET,
1310 XmNtopWidget, msg_label,
1311 XmNtopOffset, 3*VERTICAL_SPACING,
1312 XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
1313 XmNleftWidget, msg_label,
1318 /* create radio box */
1321 XtSetArg (args[n], XmNorientation, XmVERTICAL); n++;
1322 XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
1323 XtSetArg (args[n], XmNtopWidget, action_label); n++;
1324 XtSetArg (args[n], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
1325 XtSetArg (args[n], XmNleftWidget, action_label); n++;
1326 XtSetArg (args[n], XmNleftOffset, 2*HORIZONTAL_SPACING); n++;
1327 radio = (Widget) XmCreateRadioBox(form, "radio_box", args, n);
1329 /* create the radio buttons ... default button is replace */
1330 xs = XmStringCreateLocalized(GETMESSAGE(9, 25, "Replace existing folder"));
1331 radioButton1 = XtVaCreateManagedWidget("radio_toggle1",
1332 xmToggleButtonWidgetClass, radio,
1333 XmNalignment, XmALIGNMENT_BEGINNING,
1339 xs = XmStringCreateLocalized(GETMESSAGE(9, 24, "Merge contents of the two folders"));
1340 G_merge_toggle = XtVaCreateManagedWidget("radio_toggle2",
1341 xmToggleButtonWidgetClass, radio,
1342 XmNalignment, XmALIGNMENT_BEGINNING,
1347 XtManageChild(radio);
1350 /* create the action area */
1351 actionArea = Create_Action_Area(form, actions, NULL);
1352 separator = XtVaCreateManagedWidget("separator",
1353 xmSeparatorWidgetClass, form,
1354 XmNtopAttachment, XmATTACH_WIDGET,
1355 XmNtopWidget, radio,
1356 XmNbottomAttachment, XmATTACH_WIDGET,
1357 XmNbottomWidget, actionArea,
1358 XmNleftAttachment, XmATTACH_FORM,
1359 XmNrightAttachment, XmATTACH_FORM,
1363 /* set initial keyborad focus to the action button area */
1365 XmNinitialFocus, actionArea,
1368 /* Manage the dialog */
1369 XtManageChild(form);
1373 XtFree(actions.actionList[1].label);
1374 actions.actionList[1].label = orig_label;
1375 actions.actionList[1].msg_num = orig_msg_num;
1378 } /* end create_replace_merge_dialog */
1383 /*--------------------------------------------------------------------
1384 * create multicollide dialog
1385 *------------------------------------------------------------------*/
1388 create_multicollide_dialog(Widget parent_widget,
1394 int filop_confirm_fd,
1395 ActionAreaDefn actions,
1402 Widget action_label;
1405 Widget radioButton1;
1409 Pixel background, foreground;
1410 String s, s1, eMsgOne, eMsgMany;
1420 XBell( XtDisplay( G_dialogShell ), 100 );
1424 /* make args available to callback functions */
1425 G_filop_confirm_fd = filop_confirm_fd;
1426 strcpy(G_directory,destination);
1427 G_fileList = fileList;
1428 G_nCollisions = nCollisions;
1431 /* Initialize images for error, warning, ... icons */
1434 ImageInitialize(XtDisplay(toplevel));
1435 G_initImages = False;
1438 /* Initialize mode-dependent things */
1440 orig_label = actions.actionList[1].label;
1441 orig_msg_num = actions.actionList[1].msg_num;
1444 title = XtNewString(GETMESSAGE(9, 34, "File Manager - Move Warning"));
1445 XtSetArg (args[n], XmNtitle, title);
1447 actions.actionList[1].label =
1448 XtNewString(GETMESSAGE(9, 30, "Cancel Move"));
1449 actions.actionList[1].msg_num = 30;
1450 eMsgOne = XtNewString(GETMESSAGE(9, 127, "1 object moved."));
1451 eMsgMany = XtNewString(GETMESSAGE(9, 128, "%d objects moved."));
1454 title = XtNewString(GETMESSAGE(9, 35, "File Manager - Copy Warning"));
1455 XtSetArg (args[n], XmNtitle, title);
1457 actions.actionList[1].label =
1458 XtNewString(GETMESSAGE(9, 31, "Cancel Copy"));
1459 actions.actionList[1].msg_num = 31;
1460 eMsgOne = XtNewString(GETMESSAGE(9, 129, "1 object copied."));
1461 eMsgMany = XtNewString(GETMESSAGE(9, 130, "%d objects copied."));
1464 title = XtNewString(GETMESSAGE(9, 36, "File Manager - Link Warning"));
1465 XtSetArg (args[n], XmNtitle, title);
1467 actions.actionList[1].label =
1468 XtNewString(GETMESSAGE(9, 32, "Cancel Link"));
1469 actions.actionList[1].msg_num = 32;
1470 eMsgOne = XtNewString(GETMESSAGE(9, 131, "1 object linked."));
1471 eMsgMany = XtNewString(GETMESSAGE(9, 132, "%d objects linked."));
1474 title = XtNewString(GETMESSAGE(9, 33, "File Manager - Move/Copy/Link Warning"));
1475 XtSetArg (args[n], XmNtitle, title);
1477 eMsgOne = XtNewString(GETMESSAGE(9, 133, "1 object changed."));
1478 eMsgMany = XtNewString(GETMESSAGE(9, 134, "%d objects changed."));
1483 /* Create the dialog shell for the dialog */
1484 G_dialogShell = XmCreateDialogShell (parent_widget, "multicollide dialog", args, n);
1487 /* Create the Manager Widget, form, for the copy dialog */
1488 form = XtVaCreateWidget ("dialog_form",
1489 xmFormWidgetClass, G_dialogShell,
1490 XmNverticalSpacing, VERTICAL_SPACING,
1491 XmNhorizontalSpacing, HORIZONTAL_SPACING,
1492 XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL,
1495 /* Create a question dialog icon */
1497 XtSetArg (args[n], XmNbackground, &background); n++;
1498 XtSetArg (args[n], XmNforeground, &foreground); n++;
1499 XtGetValues (form, args, n);
1501 px = XmGetPixmapByDepth(XtScreen(form), "xm_question",
1502 foreground, background, form->core.depth);
1503 if (px == XmUNSPECIFIED_PIXMAP)
1504 px = XmGetPixmapByDepth(XtScreen(form), "default_xm_question",
1505 foreground, background, form->core.depth);
1507 icon = XtVaCreateManagedWidget("question_icon",
1508 xmLabelWidgetClass, form,
1509 XmNlabelType, XmPIXMAP,
1511 XmNtopAttachment, XmATTACH_FORM,
1512 XmNleftAttachment, XmATTACH_FORM,
1515 /* Create the message label */
1517 nChanged = (nSelected - nCollisions);
1518 if ( nChanged == 0 )
1519 /* This is really stupid but Sun requires it
1520 For now just get it work.
1522 s1 = (char *)XtCalloc( 1, 1 );
1523 else if ( nChanged == 1 )
1529 s1 = (char *)XtMalloc( 20 + strlen(eMsgMany) );
1531 sprintf(s1, eMsgMany, nChanged);
1534 if (nCollisions > 1)
1536 int tmp_len = (s1)?strlen(s1):0;
1537 char *tmpmsg,*filemsg=NULL;
1540 filemsg = XtMalloc(strlen(destination)+3);
1541 sprintf(filemsg,"%s\n",destination);
1542 for(i = 0;i < nCollisions; i++)
1547 tmpmsg = GETMESSAGE(27,98, "(Plus %d additional object(s))");
1548 addmsg = XtMalloc(strlen(tmpmsg)+10);
1549 sprintf(addmsg,tmpmsg,nCollisions-8);
1550 filemsg = XtRealloc(filemsg,strlen(filemsg)+strlen(addmsg)+4);
1551 strcat(filemsg,"\n\n");
1552 strcat(filemsg,addmsg);
1556 filemsg = XtRealloc(filemsg,strlen(filemsg)+strlen(destination)+
1557 strlen(fileList[i])+3);
1558 strcat(filemsg,"\n");
1559 strcat(filemsg,destination);
1560 strcat(filemsg,"/");
1561 strcat(filemsg,fileList[i]);
1563 filemsg = XtRealloc(filemsg,strlen(filemsg)+2);
1565 tmpmsg = GETMESSAGE(9, 70,
1566 "%s\n%d objects have the same name as objects in the folder\n%s");
1567 s = (char *)XtMalloc( tmp_len + strlen(tmpmsg) + strlen(filemsg) + 10);
1568 sprintf(s,tmpmsg,s1, nCollisions, filemsg);
1573 int tmp_len = (s1)?strlen(s1):0;
1574 s = (char *)XtMalloc( tmp_len + 10
1575 + strlen( GETMESSAGE(9, 71, "%s\n1 object has the same name as an object in the folder\n%s") )
1576 + strlen( destination ) );
1577 sprintf(s, GETMESSAGE(9, 71, "%s\n1 object has the same name as an object in the folder\n%s"), s1, destination);
1580 xs = XmStringCreateLocalized(s);
1581 msg_label = XtVaCreateManagedWidget("msg_header",
1582 xmLabelWidgetClass, form,
1584 XmNalignment, XmALIGNMENT_BEGINNING,
1585 XmNtopAttachment, XmATTACH_FORM,
1586 XmNleftAttachment, XmATTACH_WIDGET,
1587 XmNleftWidget, icon,
1588 XmNleftOffset, HORIZONTAL_SPACING,
1589 XmNrightAttachment, XmATTACH_FORM,
1598 /* create the action-question */
1599 xs = XmStringCreateLocalized(GETMESSAGE(9, 20, "What do you want to do?"));
1600 action_label = XtVaCreateManagedWidget("action-question",
1601 xmLabelWidgetClass, form,
1603 XmNalignment, XmALIGNMENT_BEGINNING,
1604 XmNtopAttachment, XmATTACH_WIDGET,
1605 XmNtopWidget, msg_label,
1606 XmNtopOffset, 3*VERTICAL_SPACING,
1607 XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
1608 XmNleftWidget, msg_label,
1613 /* create radio box */
1616 XtSetArg (args[n], XmNorientation, XmVERTICAL); n++;
1617 XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
1618 XtSetArg (args[n], XmNtopWidget, action_label); n++;
1619 XtSetArg (args[n], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
1620 XtSetArg (args[n], XmNleftWidget, action_label); n++;
1621 XtSetArg (args[n], XmNleftOffset, 2*HORIZONTAL_SPACING); n++;
1622 radio = (Widget) XmCreateRadioBox(form, "radio_box", args, n);
1624 /* create the radio buttons ... default button is replace */
1625 xs = XmStringCreateLocalized(GETMESSAGE(9, 56, "Replace existing objects"));
1632 radioButton1 = XtVaCreateManagedWidget("radio_toggle1",
1633 xmToggleButtonWidgetClass, radio,
1634 XmNalignment, XmALIGNMENT_BEGINNING,
1641 XtSetSensitive(radioButton1, False);
1643 xs = XmStringCreateLocalized(GETMESSAGE(9, 141, "Rename new objects by appending a number"));
1647 XtSetSensitive(radioButton1, True);
1649 xs = XmStringCreateLocalized(GETMESSAGE(9, 57, "Rename existing objects by appending a number"));
1652 G_multi_rename_toggle = XtVaCreateManagedWidget("radio_toggle2",
1653 xmToggleButtonWidgetClass, radio,
1654 XmNalignment, XmALIGNMENT_BEGINNING,
1660 XtManageChild(radio);
1663 /* create the action area */
1664 actionArea = Create_Action_Area(form, actions, NULL);
1665 separator = XtVaCreateManagedWidget("separator",
1666 xmSeparatorWidgetClass, form,
1667 XmNtopAttachment, XmATTACH_WIDGET,
1668 XmNtopWidget, radio,
1669 XmNbottomAttachment, XmATTACH_WIDGET,
1670 XmNbottomWidget, actionArea,
1671 XmNleftAttachment, XmATTACH_FORM,
1672 XmNrightAttachment, XmATTACH_FORM,
1676 /* set initial keyborad focus to the action button area */
1678 XmNinitialFocus, actionArea,
1681 /* Manage the dialog */
1682 XtManageChild(form);
1686 XtFree(actions.actionList[1].label);
1687 actions.actionList[1].label = orig_label;
1688 actions.actionList[1].msg_num = orig_msg_num;
1691 } /* end create_multicollide_dialog */
1695 /*--------------------------------------------------------------------
1697 * Create Action Area
1699 * Use of this function requires #include "sharedFuncs.h"
1700 * The source for Create_Action_Area is in dtfile/OverWrite.c and
1701 * dtfile/dtcopy/utils.c. Because it uses GETMESSAGE, it could not
1702 * be placed in dtcopy/sharedFunc.c.
1704 *------------------------------------------------------------------*/
1708 Widget parent_widget,
1709 ActionAreaDefn actions,
1710 Widget *pushbutton_array)
1712 Widget action_area, widget;
1714 int fractbase_value;
1718 if (actions.defaultAction < 0 || actions.defaultAction > actions.numActions-1)
1719 actions.defaultAction = 0;
1721 fractbase_value = (TIGHTNESS * actions.numActions) - 1;
1722 action_area = XtVaCreateWidget("action_area", xmFormWidgetClass ,parent_widget,
1723 XmNfractionBase, fractbase_value,
1724 XmNleftAttachment, XmATTACH_FORM,
1725 XmNrightAttachment, XmATTACH_FORM,
1726 XmNbottomAttachment, XmATTACH_FORM,
1729 for (i=0; i < actions.numActions ;i++ )
1731 xm_string = XmStringCreateLocalized(GETMESSAGE(actions.actionList[i].msg_set,
1732 actions.actionList[i].msg_num,
1733 actions.actionList[i].label));
1734 widget = XtVaCreateManagedWidget(actions.actionList[i].label,
1735 xmPushButtonWidgetClass, action_area,
1736 XmNleftAttachment, (i ? XmATTACH_POSITION: XmATTACH_FORM),
1737 XmNleftPosition, (TIGHTNESS * i),
1738 XmNtopAttachment, XmATTACH_FORM,
1739 XmNbottomAttachment, XmATTACH_FORM,
1741 ((i != (actions.numActions - 1)) ? XmATTACH_POSITION: XmATTACH_FORM),
1742 XmNrightPosition, ((TIGHTNESS*i) + (TIGHTNESS - 1)),
1743 XmNshowAsDefault, (i == actions.defaultAction),
1744 XmNdefaultButtonShadowThickness, 1,
1745 XmNlabelString, xm_string,
1747 XmStringFree(xm_string);
1751 if (actions.actionList[i].callback)
1753 XtAddCallback(widget, XmNactivateCallback,
1754 actions.actionList[i].callback, actions.actionList[i].data);
1757 if (i == actions.defaultAction)
1759 Dimension height, h;
1760 XtVaGetValues (action_area, XmNmarginHeight, &h, NULL);
1761 XtVaGetValues (widget, XmNheight, &height, NULL);
1764 XtVaSetValues (action_area,
1765 XmNdefaultButton, widget,
1766 XmNpaneMaximum, height,
1767 XmNpaneMinimum, height,
1772 if (pushbutton_array != NULL)
1773 pushbutton_array[i] = widget;
1777 XtManageChild(action_area);
1780 } /* end Create_Action_Area */
1784 /*--------------------------------------------------------------------
1786 * Get Variable Message
1788 * Return the appropriate message for the current mode (move, copy,
1791 *------------------------------------------------------------------*/
1795 VariableMessage message,
1800 case vm_replaceCannotDeleteFolder:
1804 return GETMESSAGE(9, 95, "Move Canceled - the folder was not moved.\n\n\
1805 The folder you want to replace could not be deleted\n\
1806 because an object inside that folder could not be deleted.\n\
1807 Some other objects inside that folder may have already been\n\
1808 deleted before the move process was halted.\n\n\
1809 The most probable cause of this problem is that you do not\n\
1810 have Write permission for the object that could not be removed.\n\
1811 Change Write permission or manually rename the folder you\n\
1812 are moving so it no longer has the same name.");
1815 return GETMESSAGE(9, 96, "Copy Canceled - the folder was not copied.\n\n\
1816 The folder you want to replace could not be deleted\n\
1817 because an object inside that folder could not be deleted.\n\
1818 Some other objects inside that folder may have already been\n\
1819 deleted before the copy process was halted.\n\n\
1820 The most probable cause of this problem is that you do not\n\
1821 have Write permission for the object that could not be removed.\n\
1822 Change Write permission or manually rename the folder you\n\
1823 are copying so it no longer has the same name.");
1826 return GETMESSAGE(9, 97, "Link Canceled - the folder was not linked.\n\n\
1827 The folder you want to replace could not be deleted\n\
1828 because an object inside that folder could not be deleted.\n\
1829 Some other objects inside that folder may have already been\n\
1830 deleted before the link process was halted.\n\n\
1831 The most probable cause of this problem is that you do not\n\
1832 have Write permission for the object that could not be removed.\n\
1833 Change Write permission or manually rename the folder you\n\
1834 are linking so it no longer has the same name.");
1837 return GETMESSAGE(9, 98, "Operation Canceled - the folder was not changed.\n\n\
1838 The folder you want to replace could not be deleted\n\
1839 because an object inside that folder could not be deleted.\n\
1840 Some other objects inside that folder may have already been\n\
1841 deleted before the process was halted.\n\n\
1842 The most probable cause of this problem is that you do not\n\
1843 have Write permission for the object that could not be removed.\n\
1844 Change Write permission or manually rename the folder you\n\
1845 are changing so it no longer has the same name.");
1847 } /* end switch (mode) */
1849 case vm_replaceCannotDeleteFile:
1853 return GETMESSAGE(9, 99, "Move Canceled\n\n\
1855 cannot be removed.\n\n\
1856 The most probable cause of this problem is that\n\
1857 you do not have Write permission for the file.\n\
1858 Change Write permission or manually rename the\n\
1859 file you are moving so it no longer has the same name.");
1862 return GETMESSAGE(9, 100, "Copy Canceled\n\n\
1864 cannot be removed.\n\n\
1865 The most probable cause of this problem is that\n\
1866 you do not have Write permission for the file.\n\
1867 Change Write permission or manually rename the\n\
1868 file you are copying so it no longer has the same name.");
1871 return GETMESSAGE(9, 101, "Link Canceled\n\n\
1873 cannot be removed.\n\n\
1874 The most probable cause of this problem is that\n\
1875 you do not have Write permission for the file.\n\
1876 Change Write permission or manually rename the\n\
1877 file you are linking so it no longer has the same name.");
1880 return GETMESSAGE(9, 102, "Operation Canceled\n\n\
1882 cannot be removed.\n\n\
1883 The most probable cause of this problem is that\n\
1884 you do not have Write permission for the file.\n\
1885 Change Write permission or manually rename the\n\
1886 file you are changing so it no longer has the same name.");
1888 } /* end switch (mode) */
1890 case vm_multiCannotRenameMany:
1894 return GETMESSAGE(9, 103, "Move Canceled - None of the objects were moved.\n\n\
1895 The following object could not be automatically renamed\n\
1897 %d objects were renamed before the move process was halted.\n\n\
1898 The most probable cause of this problem is that you do not have Write\n\
1899 permission for the above object. Change Write permission or manually\n\
1900 rename the object you are moving so it no longer has the same name.");
1903 return GETMESSAGE(9, 104, "Copy Canceled - None of the objects were copied.\n\n\
1904 The following object could not be automatically renamed\n\
1906 %d objects were renamed before the copy process was halted.\n\n\
1907 The most probable cause of this problem is that you do not have Write\n\
1908 permission for the above object. Change Write permission or manually\n\
1909 rename the object you are copying so it no longer has the same name.");
1912 return GETMESSAGE(9, 105, "Link Canceled - None of the objects were linked.\n\n\
1913 The following object could not be automatically renamed\n\
1915 %d objects were renamed before the link process was halted.\n\n\
1916 The most probable cause of this problem is that you do not have Write\n\
1917 permission for the above object. Change Write permission or manually\n\
1918 rename the object you are linking so it no longer has the same name.");
1921 return GETMESSAGE(9, 106, "Operation Canceled - None of the objects were changed.\n\n\
1922 The following object could not be automatically renamed\n\
1924 %d objects were renamed before the process was halted.\n\n\
1925 The most probable cause of this problem is that you do not have Write\n\
1926 permission for the above object. Change Write permission or manually\n\
1927 rename the object you are changing so it no longer has the same name.");
1929 } /* end switch (mode) */
1931 case vm_multiCannotRenameOne:
1935 return GETMESSAGE(9, 107, "Move Canceled - None of the objects were moved.\n\n\
1936 The following object could not be automatically renamed\n\
1938 1 object was renamed before the move process was halted.\n\n\
1939 The most probable cause of this problem is that you do not have Write\n\
1940 permission for the above object. Change Write permission or manually\n\
1941 rename the object you are moving so it no longer has the same name.");
1944 return GETMESSAGE(9, 108, "Copy Canceled - None of the objects were copied.\n\n\
1945 The following object could not be automatically renamed\n\
1947 1 object was renamed before the copy process was halted.\n\n\
1948 The most probable cause of this problem is that you do not have Write\n\
1949 permission for the above object. Change Write permission or manually\n\
1950 rename the object you are copying so it no longer has the same name.");
1953 return GETMESSAGE(9, 109, "Link Canceled - None of the objects were linked.\n\n\
1954 The following object could not be automatically renamed\n\
1956 1 object was renamed before the link process was halted.\n\n\
1957 The most probable cause of this problem is that you do not have Write\n\
1958 permission for the above object. Change Write permission or manually\n\
1959 rename the object you are linking so it no longer has the same name.");
1962 return GETMESSAGE(9, 110, "Operation Canceled - None of the objects were changed.\n\n\
1963 The following object could not be automatically renamed\n\
1965 1 object was renamed before the process was halted.\n\n\
1966 The most probable cause of this problem is that you do not have Write\n\
1967 permission for the above object. Change Write permission or manually\n\
1968 rename the object you are changing so it no longer has the same name.");
1970 } /* end switch (mode) */
1972 case vm_multiCannotDeleteFolderMany:
1976 return GETMESSAGE(9, 111, "Move Canceled - none of the objects were moved.\n\n\
1977 A folder that you want to replace could not be deleted.\n\
1979 Some objects inside this folder may have been deleted\n\
1980 before the move process was halted.\n\n\
1981 %d other objects have been deleted.\n\n\
1982 The most probable cause of this problem is that you do not have Write\n\
1983 permission for the above folder. Change Write permission or manually\n\
1984 rename the folder you are moving so it no longer has the same name.");
1987 return GETMESSAGE(9, 112, "Copy Canceled - none of the objects were copied.\n\n\
1988 A folder that you want to replace could not be deleted.\n\
1990 Some objects inside this folder may have been deleted\n\
1991 before the copy process was halted.\n\n\
1992 %d other objects have been deleted.\n\n\
1993 The most probable cause of this problem is that you do not have Write\n\
1994 permission for the above folder. Change Write permission or manually\n\
1995 rename the folder you are copying so it no longer has the same name.");
1998 return GETMESSAGE(9, 113, "Link Canceled - none of the objects were linked.\n\n\
1999 A folder that you want to replace could not be deleted.\n\
2001 Some objects inside this folder may have been deleted\n\
2002 before the link process was halted.\n\n\
2003 %d other objects have been deleted.\n\n\
2004 The most probable cause of this problem is that you do not have Write\n\
2005 permission for the above folder. Change Write permission or manually\n\
2006 rename the folder you are linking so it no longer has the same name.");
2009 return GETMESSAGE(9, 114, "Operation Canceled - none of the objects were changed.\n\n\
2010 A folder that you want to replace could not be deleted.\n\
2012 Some objects inside this folder may have been deleted\n\
2013 before the process was halted.\n\n\
2014 %d other objects have been deleted.\n\n\
2015 The most probable cause of this problem is that you do not have Write\n\
2016 permission for the above folder. Change Write permission or manually\n\
2017 rename the folder you are changing so it no longer has the same name.");
2019 } /* end switch (mode) */
2021 case vm_multiCannotDeleteFolderOne:
2025 return GETMESSAGE(9, 115, "Move Canceled - none of the objects were moved.\n\n\
2026 A folder that you want to replace could not be deleted.\n\
2028 Some objects inside this folder may have been deleted\n\
2029 before the move process was halted.\n\n\
2030 1 other object has been deleted.\n\n\
2031 The most probable cause of this problem is that you do not have Write\n\
2032 permission for the above folder. Change Write permission or manually\n\
2033 rename the folder you are moving so it no longer has the same name.");
2036 return GETMESSAGE(9, 116, "Copy Canceled - none of the objects were copied.\n\n\
2037 A folder that you want to replace could not be deleted.\n\
2039 Some objects inside this folder may have been deleted\n\
2040 before the copy process was halted.\n\n\
2041 1 other object has been deleted.\n\n\
2042 The most probable cause of this problem is that you do not have Write\n\
2043 permission for the above folder. Change Write permission or manually\n\
2044 rename the folder you are copying so it no longer has the same name.");
2047 return GETMESSAGE(9, 117, "Link Canceled - none of the objects were linked.\n\n\
2048 A folder that you want to replace could not be deleted.\n\
2050 Some objects inside this folder may have been deleted\n\
2051 before the link process was halted.\n\n\
2052 1 other object has been deleted.\n\n\
2053 The most probable cause of this problem is that you do not have Write\n\
2054 permission for the above folder. Change Write permission or manually\n\
2055 rename the folder you are linking so it no longer has the same name.");
2058 return GETMESSAGE(9, 118, "Operation Canceled - none of the objects were changed.\n\n\
2059 A folder that you want to replace could not be deleted.\n\
2061 Some objects inside this folder may have been deleted\n\
2062 before the process was halted.\n\n\
2063 1 other object has been deleted.\n\n\
2064 The most probable cause of this problem is that you do not have Write\n\
2065 permission for the above folder. Change Write permission or manually\n\
2066 rename the folder you are changing so it no longer has the same name.");
2068 } /* end switch (mode) */
2070 case vm_multiCannotDeleteFileMany:
2074 return GETMESSAGE(9, 119, "Move Canceled - none of the objects were moved.\n\n\
2075 A file that you want to replace could not be deleted.\n\
2077 %d other objects have been deleted.\n\n\
2078 The most probable cause of this problem is that you do not have Write\n\
2079 permission for the above file. Change Write permission or manually\n\
2080 rename the file you are moving so it no longer has the same name.");
2083 return GETMESSAGE(9, 120, "Copy Canceled - none of the objects were copied.\n\n\
2084 A file that you want to replace could not be deleted.\n\
2086 %d other objects have been deleted.\n\n\
2087 The most probable cause of this problem is that you do not have Write\n\
2088 permission for the above file. Change Write permission or manually\n\
2089 rename the file you are copying so it no longer has the same name.");
2092 return GETMESSAGE(9, 121, "Link Canceled - none of the objects were linked.\n\n\
2093 A file that you want to replace could not be deleted.\n\
2095 %d other objects have been deleted.\n\n\
2096 The most probable cause of this problem is that you do not have Write\n\
2097 permission for the above file. Change Write permission or manually\n\
2098 rename the file you are linking so it no longer has the same name.");
2101 return GETMESSAGE(9, 122, "Operation Canceled - none of the objects were changed.\n\n\
2102 A file that you want to replace could not be deleted.\n\
2104 %d other objects have been deleted.\n\n\
2105 The most probable cause of this problem is that you do not have Write\n\
2106 permission for the above file. Change Write permission or manually\n\
2107 rename the file you are changing so it no longer has the same name.");
2109 } /* end switch (mode) */
2111 case vm_multiCannotDeleteFileOne:
2115 return GETMESSAGE(9, 123, "Move Canceled - none of the objects were moved.\n\n\
2116 A file that you want to replace could not be deleted.\n\
2118 1 other object has been deleted.\n\n\
2119 The most probable cause of this problem is that you do not have Write\n\
2120 permission for the above file. Change Write permission or manually\n\
2121 rename the file you are moving so it no longer has the same name.");
2124 return GETMESSAGE(9, 124, "Copy Canceled - none of the objects were copied.\n\n\
2125 A file that you want to replace could not be deleted.\n\
2127 1 other object has been deleted.\n\n\
2128 The most probable cause of this problem is that you do not have Write\n\
2129 permission for the above file. Change Write permission or manually\n\
2130 rename the file you are copying so it no longer has the same name.");
2133 return GETMESSAGE(9, 125, "Link Canceled - none of the objects were linked.\n\n\
2134 A file that you want to replace could not be deleted.\n\
2136 1 other object has been deleted.\n\n\
2137 The most probable cause of this problem is that you do not have Write\n\
2138 permission for the above file. Change Write permission or manually\n\
2139 rename the file you are linking so it no longer has the same name.");
2142 return GETMESSAGE(9, 126, "Operation Canceled - none of the objects were changed.\n\n\
2143 A file that you want to replace could not be deleted.\n\
2145 1 other object has been deleted.\n\n\
2146 The most probable cause of this problem is that you do not have Write\n\
2147 permission for the above file. Change Write permission or manually\n\
2148 rename the file you are changing so it no longer has the same name.");
2150 } /* end switch (mode) */
2152 } /* end switch (message) */
2154 } /* end getVariableMessage */
2162 if(lstat(name,&s1) < 0)
2164 if (S_ISDIR(s1.st_mode))
2166 if(!access(name,02|01))
2172 if(!access(name,02))