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 libraries 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>
76 #include <Dt/SharedProcs.h>
82 #include "SharedProcs.h"
85 #include "sharedFuncs.h"
90 #define VERTICAL_SPACING 5
91 #define HORIZONTAL_SPACING 10
92 #define TOP_SPACING (VERTICAL_SPACING + 3)
94 /* types of messages sent through the pipe */
95 /* these messages are also defined & used in FileOp.c */
96 #define PIPEMSG_CANCEL 101
97 #define PIPEMSG_PROCEED 102
98 #define PIPEMSG_MERGE 103
99 #define PIPEMSG_REPLACE_BUFFER 104
100 #define PIPEMSG_RENAME_BUFFER 105
101 #define PIPEMSG_MULTI_PROCEED 106
103 #define RADIO_REPLACE 0
104 #define RADIO_RENAME 1
107 /* global variables */
108 Boolean G_initImages = True;
109 int G_filop_confirm_fd = -1;
110 char G_directory[MAX_PATH];
111 char G_file[MAX_PATH];
112 String *G_fileList = NULL;
113 int G_nCollisions = 0;
114 Widget G_dialogShell = NULL;
115 Widget G_rename_text = NULL;
116 Widget G_rename_toggle = NULL;
117 Widget G_merge_toggle = NULL;
118 Widget G_multi_rename_toggle = NULL;
123 vm_replaceCannotDeleteFolder, /* 80 81 */
124 vm_replaceCannotDeleteFile, /* 82 */
125 vm_multiCannotRenameMany, /* 83 84 */
126 vm_multiCannotRenameOne, /* 85 84 */
127 vm_multiCannotDeleteFolderMany, /* 86 */
128 vm_multiCannotDeleteFolderOne, /* 87 */
129 vm_multiCannotDeleteFileMany, /* 88 */
130 vm_multiCannotDeleteFileOne /* 89 */
133 /* local functions */
134 static void replaceError_ok_callback(
136 XtPointer client_data,
137 XtPointer call_data);
138 static void renameError_ok_callback(
140 XtPointer client_data,
141 XtPointer call_data);
142 static void multiReplaceError_ok_callback(
144 XtPointer client_data,
145 XtPointer call_data);
146 static void multiRenameError_ok_callback(
148 XtPointer client_data,
149 XtPointer call_data);
150 static char * getVariableMessage(
151 VariableMessage message,
153 static Boolean IsReplaceable(
157 /*--------------------------------------------------------------------
159 *------------------------------------------------------------------*/
163 replace_rename_ok_callback(
165 XtPointer client_data,
168 const int rc = PIPEMSG_PROCEED;
169 String newFile, renameNewName, destinationName;
172 static char msg[30+(3*MAX_PATH)];
174 char *newFileDir = NULL;
175 char *newFileName = NULL;
178 Boolean same = (Boolean)(XtArgVal)client_data;
180 /* if same is true, then the object is tring to be copied into the same
181 * folder as itself. So the existing files stay the same and the new files
182 * being created take on the new names.
185 /* Rename was selected */
186 if (XmToggleButtonGetState(G_rename_toggle))
188 newFile = XmTextFieldGetString(G_rename_text);
189 renameNewName = build_path(G_directory,newFile);
190 destinationName = build_path(G_directory,G_file);
192 /* make sure renameNewName does not exist */
193 if ( (lstat(renameNewName, &buf)) == 0)
196 GETMESSAGE(9, 38, "%s\nalready exists: choose another name."),
198 title = XtNewString(GETMESSAGE(9, 37, "Object Rename - Error"));
199 _DtMessageDialog (G_dialogShell, title, msg, 0, FALSE, NULL,
200 renameError_ok_callback, NULL, NULL, False, ERROR_DIALOG);
202 XtFree(renameNewName);
203 XtFree(destinationName);
209 /* attempt the rename ... since rename function is being used, this*/
210 /* only allows renames within the same filesystem */
212 DirectoryFileModified(home_host_name, G_directory, G_file);
213 if (DtStrchr(newFile, '/') == NULL)
214 DirectoryFileModified(home_host_name, G_directory, newFile);
217 newFileName = strrchr(renameNewName, '/');
218 newFileDirLen = newFileName - renameNewName;
221 newFileDir = XtMalloc(newFileDirLen + 1);
222 strncpy(newFileDir, renameNewName, newFileDirLen);
223 newFileDir[newFileDirLen] = '\0';
225 DirectoryBeginModify(home_host_name, newFileDir);
226 DirectoryFileModified(home_host_name, newFileDir, newFileName);
230 rename_rc = rename(destinationName, renameNewName);
232 if (newFileDir != NULL)
234 DirectoryEndModify(home_host_name, newFileDir);
242 GETMESSAGE(9, 39, "%s\ncannot be renamed to\n%s\n%s"),
243 destinationName, renameNewName, strerror(saveError));
244 title = XtNewString(GETMESSAGE(9, 37, "Object Rename - Error"));
245 _DtMessageDialog (G_dialogShell, title, msg, 0, FALSE, NULL,
246 renameError_ok_callback, NULL, NULL, False, ERROR_DIALOG);
248 XtFree(renameNewName);
249 XtFree(destinationName);
253 XtFree(renameNewName);
254 XtFree(destinationName);
257 /* Replace was selected ... remove the offending target */
260 destinationName = build_path(G_directory,G_file);
261 DirectoryFileModified(home_host_name, G_directory, G_file);
262 if(IsReplaceable(destinationName))
263 fsErase(destinationName,&saveError,False);
266 if ( saveError == 0 )
268 /* removal succeeded */
269 XtFree(destinationName);
275 stat(destinationName,&buf);
276 title = XtNewString(GETMESSAGE(9, 40, "Object Replace - Error"));
278 if (S_ISDIR(buf.st_mode))
280 strcpy(msg,getVariableMessage(vm_replaceCannotDeleteFolder, G_mode));
285 getVariableMessage(vm_replaceCannotDeleteFile, G_mode),
289 _DtMessageDialog (G_dialogShell, title, msg, 0, FALSE, NULL,
290 replaceError_ok_callback, NULL, NULL, False, ERROR_DIALOG);
292 XtFree(destinationName);
297 /* close the dialog */
298 XtDestroyWidget(G_dialogShell);
299 G_dialogShell = NULL;
301 /* send return code through the pipe to the background proc */
302 write(G_filop_confirm_fd, &rc, sizeof(int));
303 G_filop_confirm_fd = -1;
305 } /* end replace_rename_ok_callback */
309 buffer_replace_rename_ok_callback(
311 XtPointer client_data,
315 String newFile, renameNewName, destinationName;
318 static char msg[38+MAX_PATH];
322 /* Rename was selected */
323 if (XmToggleButtonGetState(G_rename_toggle))
325 newFile = XmTextFieldGetString(G_rename_text);
326 renameNewName = build_path(G_directory,newFile);
327 destinationName = build_path(G_directory,G_file);
329 /* make sure renameNewName does not exist */
330 if ( (lstat(renameNewName, &buf)) == 0)
333 GETMESSAGE(9, 38, "%s\nalready exists: choose another name."),
335 title = XtNewString(GETMESSAGE(9, 37, "Object Rename - Error"));
336 _DtMessageDialog (G_dialogShell, title, msg, 0, FALSE, NULL,
337 renameError_ok_callback, NULL, NULL, False, ERROR_DIALOG);
339 XtFree(renameNewName);
340 XtFree(destinationName);
345 /* Perform the actual rename in the child process */
346 /* set up pipe message */
347 rc = PIPEMSG_RENAME_BUFFER;
350 XtFree(renameNewName);
351 XtFree(destinationName);
353 /* Replace was selected ... remove the offending target */
356 destinationName = build_path(G_directory,G_file);
357 if(IsReplaceable(destinationName))
358 fsErase(destinationName,&saveError,False);
361 if ( saveError == 0 )
364 rc = PIPEMSG_REPLACE_BUFFER;
365 /* removal succeeded */
366 XtFree(destinationName);
373 stat(destinationName,&buf);
374 title = XtNewString(GETMESSAGE(9, 40, "Object Replace - Error"));
376 if (S_ISDIR(buf.st_mode))
378 strcpy(msg,getVariableMessage(vm_replaceCannotDeleteFolder, COPY_FILE));
383 getVariableMessage(vm_replaceCannotDeleteFile, COPY_FILE),
388 _DtMessageDialog (G_dialogShell, title, msg, 0, FALSE, NULL,
389 replaceError_ok_callback, NULL, NULL, False, ERROR_DIALOG);
391 XtFree(destinationName);
396 /* close the dialog */
397 XtDestroyWidget(G_dialogShell);
398 G_dialogShell = NULL;
400 /* send return code through the pipe to the background proc */
401 write(G_filop_confirm_fd, &rc, sizeof(int));
403 /* write the the new name on the pipe if rename is selected */
404 if (XmToggleButtonGetState(G_rename_toggle))
406 DPRINTF(("Writing %s to %d\n", newFile ,G_filop_confirm_fd));
407 PipeWriteString(G_filop_confirm_fd, newFile);
410 G_filop_confirm_fd = -1;
412 } /* end buffer_replace_rename_ok_callback */
416 replace_rename_cancel_callback(
418 XtPointer client_data,
421 const int rc = PIPEMSG_CANCEL;
423 /* close the dialog */
424 XtDestroyWidget(G_dialogShell);
425 G_dialogShell = NULL;
427 /* send negative return code through the pipe to the background proc */
428 write(G_filop_confirm_fd, &rc, sizeof(int));
429 G_filop_confirm_fd = -1;
431 } /* end replace_rename_cancel_callback */
435 replace_rename_radio_callback(
437 XtPointer client_data,
440 XmToggleButtonCallbackStruct *state = (XmToggleButtonCallbackStruct *)call_data;
444 switch ((int)(XtArgVal) client_data)
447 XtVaSetValues (G_rename_text,
453 XtVaSetValues (G_rename_text,
456 XmProcessTraversal(G_rename_text, XmTRAVERSE_CURRENT);
464 } /* end replace_rename_radio_callback */
469 renameError_ok_callback(
471 XtPointer client_data,
474 XtDestroyWidget((Widget)client_data);
475 XmProcessTraversal(G_rename_text, XmTRAVERSE_CURRENT);
478 } /* end renameError_ok_callback */
482 replace_merge_ok_callback(
484 XtPointer client_data,
488 String newFile=NULL, renameNewName, renameOldName;
493 char *destinationPath = build_path(G_directory,G_file);
495 if (XmToggleButtonGetState(G_merge_toggle))
499 rc = PIPEMSG_PROCEED;
500 if(DirectoryBusy(destinationPath))
504 msg = GETMESSAGE(11,30, "Cannot move or rename the folder %s.\n\
505 All File Manager views displayed for a folder or its sub-folders\n\
506 must be closed before a folder can be moved or renamed.");
508 errmsg = XtMalloc(strlen(msg)+strlen(destinationPath)+1);
509 sprintf(errmsg,msg,destinationPath);
510 title = XtNewString(GETMESSAGE(9, 40, "Object Replace - Error"));
511 _DtMessage(toplevel, title, errmsg, NULL, HelpRequestCB);
514 XtFree(destinationPath);
519 /* close the dialog */
520 XtDestroyWidget(G_dialogShell);
521 G_dialogShell = NULL;
523 /* send return code through the pipe to the background proc */
524 write(G_filop_confirm_fd, &rc, sizeof(int));
525 G_filop_confirm_fd = -1;
527 } /* end replace_merge_ok_callback */
532 replace_merge_cancel_callback(
534 XtPointer client_data,
537 const int rc = PIPEMSG_CANCEL;
539 /* close the dialog */
540 XtDestroyWidget(G_dialogShell);
541 G_dialogShell = NULL;
543 /* send negative return code through the pipe to the background proc */
544 write(G_filop_confirm_fd, &rc, sizeof(int));
545 G_filop_confirm_fd = -1;
547 } /* end replace_merge_cancel_callback */
552 multicollide_cancel_callback(
554 XtPointer client_data,
557 const int rc = PIPEMSG_CANCEL;
560 /* close the dialog */
561 XtDestroyWidget(G_dialogShell);
562 G_dialogShell = NULL;
564 /* de-allocate the file list */
565 for ( i = 0; i < G_nCollisions; i++)
566 XtFree((char *)G_fileList[i]);
567 XtFree((char *)G_fileList);
570 /* send return code through the pipe to the background proc */
571 write(G_filop_confirm_fd, &rc, sizeof(int));
572 G_filop_confirm_fd = -1;
574 } /* end multicollide_cancel_callback */
578 multicollide_ok_callback(
580 XtPointer client_data,
583 const int rc = PIPEMSG_MULTI_PROCEED;
586 String destinationPath;
588 static char msg[1024];
592 Boolean same = (Boolean)(XtArgVal)client_data;
594 /* if same is true, then the object is tring to be copied into the same
595 * folder as itself. So the existing files stay the same and the new files
596 * being created take on the new names.
599 if (XmToggleButtonGetState(G_multi_rename_toggle))
602 title = XtNewString(GETMESSAGE(9, 37, "Object Rename - Error"));
604 write(G_filop_confirm_fd, &rc, sizeof(int));
605 /* Auto rename was selected */
606 for ( i = 0; i < G_nCollisions; i++)
611 destinationPath = build_path(G_directory,G_fileList[i]);
612 DirectoryFileModified(home_host_name, G_directory, G_fileList[i]);
613 if ( auto_rename(destinationPath) != 0)
617 names = (char *) XtNewString(destinationPath);
620 names = (char *)XtRealloc(names,strlen(names)+
621 strlen(destinationPath)+2);
623 strcat(names,destinationPath);
628 write(G_filop_confirm_fd, &saveError, sizeof(int));
629 XtFree(destinationPath);
635 write(G_filop_confirm_fd, &saveError, sizeof(int));
645 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);
646 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);
647 _DtMessage(toplevel, title, buf, NULL, HelpRequestCB);
658 title = XtNewString(GETMESSAGE(9, 40, "Object Replace - Error"));
659 write(G_filop_confirm_fd, &rc, sizeof(int));
661 /* Replace was selected ... remove the offending targets */
662 for ( i = 0; i < G_nCollisions; i++)
664 destinationPath = build_path(G_directory,G_fileList[i]);
665 if(IsReplaceable(destinationPath))
667 if(DirectoryBusy(destinationPath))
671 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.");
673 errmsg = XtMalloc(strlen(msg)+strlen(destinationPath)+1);
674 sprintf(errmsg,msg,destinationPath);
675 _DtMessage(toplevel, title, errmsg, NULL, HelpRequestCB);
677 XtFree(destinationPath);
681 fsErase(destinationPath,&saveError,False);
685 write(G_filop_confirm_fd, &saveError, sizeof(int));
689 names = (char *) XtNewString(destinationPath);
692 names = (char *)XtRealloc(names,strlen(names)+
693 strlen(destinationPath)+2);
695 strcat(names,destinationPath);
698 XtFree(destinationPath);
704 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);
705 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);
706 _DtMessage(toplevel, title, buf, NULL, HelpRequestCB);
714 /* close the dialog */
715 XtDestroyWidget(G_dialogShell);
716 G_dialogShell = NULL;
718 /* de-allocate the file list */
719 for ( i = 0; i < G_nCollisions; i++)
720 XtFree((char *)G_fileList[i]);
721 XtFree((char *)G_fileList);
724 /* send return code through the pipe to the background proc */
726 write(G_filop_confirm_fd, &rc, sizeof(int));
728 G_filop_confirm_fd = -1;
729 } /* end multicollide_ok_callback */
733 buffer_multicollide_ok_callback(
735 XtPointer client_data,
741 String destinationPath;
743 char newPath[MAX_PATH];
745 static char msg[1024];
749 if (XmToggleButtonGetState(G_multi_rename_toggle))
751 /* send return code through the pipe to the background proc */
752 rc = PIPEMSG_RENAME_BUFFER;
753 write(G_filop_confirm_fd, &rc, sizeof(int));
755 /* Auto rename was selected */
756 for ( i = 0; i < G_nCollisions; i++)
758 /* automatically generated new name */
759 destinationPath = build_path(G_directory,G_fileList[i]);
760 generate_NewPath(newPath, destinationPath);
761 newFile= strrchr(newPath,'/') + 1 ;
763 DPRINTF (("buffer_multicollide_ok_callback: new file is %s\n", newFile));
765 /* write new name on the pipe */
767 PipeWriteString(G_filop_confirm_fd, newFile);
769 XtFree(destinationPath);
771 } /* endif multi auto-rename */
774 title = XtNewString(GETMESSAGE(9, 40, "Object Replace - Error"));
776 /* Replace was selected ... remove the offending targets */
777 for ( i = 0; i < G_nCollisions; i++)
779 /* set the pipe msg */
780 rc = PIPEMSG_REPLACE_BUFFER;
782 destinationPath = build_path(G_directory,G_fileList[i]);
783 fsErase(destinationPath,&saveError,False);
784 if ( saveError != 0 )
787 stat(destinationPath,&buf);
789 if ( S_ISDIR(buf.st_mode) && i != 1 )
792 getVariableMessage(vm_multiCannotDeleteFolderMany, COPY_FILE),
795 else if ( S_ISDIR(buf.st_mode) && i == 1)
798 getVariableMessage(vm_multiCannotDeleteFolderOne, COPY_FILE),
801 else if ( ! S_ISDIR(buf.st_mode) && i != 1 )
804 getVariableMessage(vm_multiCannotDeleteFileMany, COPY_FILE),
807 else /* ! S_ISDIR(buf.st_mode) && i == 1 ) */
810 getVariableMessage(vm_multiCannotDeleteFileOne, COPY_FILE),
813 _DtMessageDialog (G_dialogShell, title, msg, 0, FALSE, NULL,
814 multiReplaceError_ok_callback, NULL, NULL, False, ERROR_DIALOG);
815 XtFree(destinationPath);
820 /* send return code through the pipe to the background proc */
821 rc = PIPEMSG_REPLACE_BUFFER;
822 write(G_filop_confirm_fd, &rc, sizeof(int));
824 XtFree(destinationPath);
830 /* close the dialog */
831 XtDestroyWidget(G_dialogShell);
832 G_dialogShell = NULL;
834 /* de-allocate the file list */
835 for ( i = 0; i < G_nCollisions; i++)
836 XtFree((char *)G_fileList[i]);
837 XtFree((char *)G_fileList);
840 G_filop_confirm_fd = -1;
842 } /* end multicollide_ok_callback */
847 replaceError_ok_callback(
849 XtPointer client_data,
852 XtDestroyWidget((Widget)client_data);
855 } /* end replaceError_ok_callback */
860 multiReplaceError_ok_callback(
862 XtPointer client_data,
865 XtDestroyWidget((Widget)client_data);
868 } /* end multiReplaceError_ok_callback */
873 multiRenameError_ok_callback(
875 XtPointer client_data,
878 XtDestroyWidget((Widget)client_data);
881 } /* end multiRenameError_ok_callback */
885 /*--------------------------------------------------------------------
886 * create replace/rename dialog
887 *------------------------------------------------------------------*/
890 create_replace_rename_dialog(Widget parent_widget,
894 int filop_confirm_fd,
895 ActionAreaDefn actions,
909 Pixel background, foreground;
910 char path[MAX_PATH], newDir[MAX_PATH], newFile[MAX_PATH];
920 XBell( XtDisplay( G_dialogShell ), 100 );
924 /* make args available to callback functions */
925 G_filop_confirm_fd = filop_confirm_fd;
927 strcpy(G_directory,directory);
930 /* Initialize images for error, warning, ... icons */
933 ImageInitialize(XtDisplay(toplevel));
934 G_initImages = False;
937 /* Initialize mode-dependent things */
939 orig_label = actions.actionList[1].label;
940 orig_msg_num = actions.actionList[1].msg_num;
943 title = XtNewString(GETMESSAGE(9, 34, "File Manager - Move Warning"));
944 XtSetArg (args[n], XmNtitle, title);
946 actions.actionList[1].label = XtNewString(GETMESSAGE(9, 30, "Cancel Move"));
947 actions.actionList[1].msg_num = 30;
950 title = XtNewString(GETMESSAGE(9, 35, "File Manager - Copy Warning"));
951 XtSetArg (args[n], XmNtitle, title);
953 actions.actionList[1].label = XtNewString(GETMESSAGE(9, 31, "Cancel Copy"));
954 actions.actionList[1].msg_num = 31;
957 title = XtNewString(GETMESSAGE(9, 36, "File Manager - Link Warning"));
958 XtSetArg (args[n], XmNtitle, title);
960 actions.actionList[1].label = XtNewString(GETMESSAGE(9, 32, "Cancel Link"));
961 actions.actionList[1].msg_num = 32;
964 title = XtNewString(GETMESSAGE(9, 33, "File Manager - Move/Copy/Link Warning"));
965 XtSetArg (args[n], XmNtitle, title);
971 /* Create the dialog shell for the dialog */
972 G_dialogShell = XmCreateDialogShell (parent_widget, "replace/rename dialog", args, n);
975 /* Create the Manager Widget, form, for the copy dialog */
976 form = XtVaCreateWidget ("dialog_form",
977 xmFormWidgetClass, G_dialogShell,
978 XmNverticalSpacing, VERTICAL_SPACING,
979 XmNhorizontalSpacing, HORIZONTAL_SPACING,
980 XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL,
983 /* Create a question dialog icon */
985 XtSetArg (args[n], XmNbackground, &background); n++;
986 XtSetArg (args[n], XmNforeground, &foreground); n++;
987 XtGetValues (form, args, n);
989 px = XmGetPixmapByDepth(XtScreen(form), "xm_question",
990 foreground, background, form->core.depth);
991 if (px == XmUNSPECIFIED_PIXMAP)
992 px = XmGetPixmapByDepth(XtScreen(form), "default_xm_question",
993 foreground, background, form->core.depth);
995 icon = XtVaCreateManagedWidget("question_icon",
996 xmLabelWidgetClass, form,
997 XmNlabelType, XmPIXMAP,
999 XmNtopAttachment, XmATTACH_FORM,
1000 XmNleftAttachment, XmATTACH_FORM,
1003 /* Create the message label */
1005 + strlen( GETMESSAGE(9, 16, "An object named\n%s\nalready exists inside the folder\n%s") )
1007 + strlen( directory ) );
1009 GETMESSAGE(9, 16, "An object named\n%s\nalready exists inside the folder\n%s"),
1013 xs = XmStringCreateLocalized(s);
1014 msg_label = XtVaCreateManagedWidget("msg_header",
1015 xmLabelWidgetClass, form,
1017 XmNalignment, XmALIGNMENT_BEGINNING,
1018 XmNtopAttachment, XmATTACH_FORM,
1019 XmNleftAttachment, XmATTACH_WIDGET,
1020 XmNleftWidget, icon,
1021 XmNleftOffset, HORIZONTAL_SPACING,
1022 XmNrightAttachment, XmATTACH_FORM,
1028 /* create the action-question */
1029 xs = XmStringCreateLocalized(GETMESSAGE(9, 20, "What do you want to do?"));
1030 action_label = XtVaCreateManagedWidget("action-question",
1031 xmLabelWidgetClass, form,
1033 XmNalignment, XmALIGNMENT_BEGINNING,
1034 XmNtopAttachment, XmATTACH_WIDGET,
1035 XmNtopWidget, msg_label,
1036 XmNtopOffset, 3*VERTICAL_SPACING,
1037 XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
1038 XmNleftWidget, msg_label,
1043 /* create radio box */
1046 XtSetArg (args[n], XmNorientation, XmVERTICAL); n++;
1047 XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
1048 XtSetArg (args[n], XmNtopWidget, action_label); n++;
1049 XtSetArg (args[n], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
1050 XtSetArg (args[n], XmNleftWidget, action_label); n++;
1051 XtSetArg (args[n], XmNleftOffset, 2*HORIZONTAL_SPACING); n++;
1052 radio = (Widget) XmCreateRadioBox(form, "radio_box", args, n);
1054 if( mode == MAKE_BUFFER )
1058 /* if the object is have the operation done to the same folder (i.e.
1059 being done to itself, we want the default to be to create a new name
1068 /* create the radio buttons ... default button is replace */
1069 xs = XmStringCreateLocalized(GETMESSAGE(9, 21, "Replace existing object"));
1070 radioButton1 = XtVaCreateManagedWidget("radio_toggle1",
1071 xmToggleButtonWidgetClass, radio,
1072 XmNalignment, XmALIGNMENT_BEGINNING,
1079 XtSetSensitive(radioButton1, True);
1080 XtAddCallback(radioButton1, XmNvalueChangedCallback, replace_rename_radio_callback, (XtPointer) RADIO_REPLACE);
1083 XtSetSensitive(radioButton1, False);
1085 if( mode == MAKE_BUFFER )
1087 xs = XmStringCreateLocalized(GETMESSAGE(10,48, "New Object Name:"));
1094 xs = XmStringCreateLocalized(GETMESSAGE(9, 140, "Rename new object to:"));
1099 xs = XmStringCreateLocalized(GETMESSAGE(9, 22, "Rename existing object to:"));
1103 G_rename_toggle = XtVaCreateManagedWidget("radio_toggle2",
1104 xmToggleButtonWidgetClass, radio,
1105 XmNalignment, XmALIGNMENT_BEGINNING,
1110 XtAddCallback(G_rename_toggle, XmNvalueChangedCallback, replace_rename_radio_callback, (XtPointer) RADIO_RENAME);
1112 XtManageChild(radio);
1115 /* create text field for entering a new file name */
1116 /* a name is generated to use as the default */
1117 _DtBuildPath(path,directory,file);
1118 generate_NewPath(path,path);
1119 split_path(path, newDir, newFile);
1120 G_rename_text = XtVaCreateManagedWidget("rename_text",
1121 xmTextFieldWidgetClass, form,
1122 XmNrightAttachment, XmATTACH_FORM,
1123 XmNleftAttachment, XmATTACH_WIDGET,
1124 XmNleftWidget, radio,
1125 XmNleftOffset, HORIZONTAL_SPACING,
1126 XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
1127 XmNbottomWidget, radio,
1130 XmNcursorPosition, strlen(newFile),
1133 /* create the action area */
1134 actionArea = Create_Action_Area(form, actions, NULL);
1135 separator = XtVaCreateManagedWidget("separator",
1136 xmSeparatorWidgetClass, form,
1137 XmNtopAttachment, XmATTACH_WIDGET,
1138 XmNtopWidget, radio,
1139 XmNbottomAttachment, XmATTACH_WIDGET,
1140 XmNbottomWidget, actionArea,
1141 XmNleftAttachment, XmATTACH_FORM,
1142 XmNrightAttachment, XmATTACH_FORM,
1146 /* set initial keyborad focus to the action button area */
1148 XmNinitialFocus, actionArea,
1151 /* Manage the dialog */
1152 XtManageChild(form);
1156 XtFree(actions.actionList[1].label);
1157 actions.actionList[1].label = orig_label;
1158 actions.actionList[1].msg_num = orig_msg_num;
1161 } /* end create_replace_rename_dialog */
1165 /*--------------------------------------------------------------------
1166 * create replace/merge dialog
1167 *------------------------------------------------------------------*/
1170 create_replace_merge_dialog(Widget parent_widget,
1174 int filop_confirm_fd,
1175 ActionAreaDefn actions)
1181 Widget action_label;
1184 Widget radioButton1;
1188 Pixel background, foreground;
1189 char path[MAX_PATH], newDir[MAX_PATH], newFile[MAX_PATH];
1198 XBell( XtDisplay( G_dialogShell ), 100 );
1202 /* make args available to callback functions */
1203 G_filop_confirm_fd = filop_confirm_fd;
1205 strcpy(G_directory,directory);
1206 strcpy(G_file,file);
1208 /* Initialize images for error, warning, ... icons */
1211 ImageInitialize(XtDisplay(toplevel));
1212 G_initImages = False;
1215 /* Initialize mode-dependent things */
1217 orig_label = actions.actionList[1].label;
1218 orig_msg_num = actions.actionList[1].msg_num;
1221 title = XtNewString(GETMESSAGE(9, 34, "File Manager - Move Warning"));
1222 XtSetArg (args[n], XmNtitle, title);
1224 actions.actionList[1].label = XtNewString(GETMESSAGE(9, 30, "Cancel Move"));
1225 actions.actionList[1].msg_num = 30;
1228 title = XtNewString(GETMESSAGE(9, 35, "File Manager - Copy Warning"));
1229 XtSetArg (args[n], XmNtitle, title);
1231 actions.actionList[1].label = XtNewString(GETMESSAGE(9, 31, "Cancel Copy"));
1232 actions.actionList[1].msg_num = 31;
1235 title = XtNewString(GETMESSAGE(9, 36, "File Manager - Link Warning"));
1236 XtSetArg (args[n], XmNtitle, title);
1238 actions.actionList[1].label = XtNewString(GETMESSAGE(9, 32, "Cancel Link"));
1239 actions.actionList[1].msg_num = 32;
1242 title = XtNewString(GETMESSAGE(9, 33, "File Manager - Move/Copy/Link Warning"));
1243 XtSetArg (args[n], XmNtitle, title);
1249 /* Create the dialog shell for the dialog */
1250 G_dialogShell = XmCreateDialogShell (parent_widget, "replace/merge dialog", args, n);
1253 /* Create the Manager Widget, form, for the copy dialog */
1254 form = XtVaCreateWidget ("dialog_form",
1255 xmFormWidgetClass, G_dialogShell,
1256 XmNverticalSpacing, VERTICAL_SPACING,
1257 XmNhorizontalSpacing, HORIZONTAL_SPACING,
1258 XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL,
1261 /* Create a question dialog icon */
1263 XtSetArg (args[n], XmNbackground, &background); n++;
1264 XtSetArg (args[n], XmNforeground, &foreground); n++;
1265 XtGetValues (form, args, n);
1267 px = XmGetPixmapByDepth(XtScreen(form), "xm_question",
1268 foreground, background, form->core.depth);
1269 if (px == XmUNSPECIFIED_PIXMAP)
1270 px = XmGetPixmapByDepth(XtScreen(form), "default_xm_question",
1271 foreground, background, form->core.depth);
1273 icon = XtVaCreateManagedWidget("question_icon",
1274 xmLabelWidgetClass, form,
1275 XmNlabelType, XmPIXMAP,
1277 XmNtopAttachment, XmATTACH_FORM,
1278 XmNleftAttachment, XmATTACH_FORM,
1281 /* Create the message label */
1283 + strlen( GETMESSAGE(9, 17, "A folder named\n%s\nalready exists inside the folder\n%s") )
1285 + strlen( directory ) );
1287 sprintf(s, GETMESSAGE(9, 17, "A folder named\n%s\nalready exists inside the folder\n%s"), file, directory);
1289 xs = XmStringCreateLocalized(s);
1290 msg_label = XtVaCreateManagedWidget("msg_header",
1291 xmLabelWidgetClass, form,
1293 XmNalignment, XmALIGNMENT_BEGINNING,
1294 XmNtopAttachment, XmATTACH_FORM,
1295 XmNleftAttachment, XmATTACH_WIDGET,
1296 XmNleftWidget, icon,
1297 XmNleftOffset, HORIZONTAL_SPACING,
1298 XmNrightAttachment, XmATTACH_FORM,
1304 /* create the action-question */
1305 xs = XmStringCreateLocalized(GETMESSAGE(9, 20, "What do you want to do?"));
1306 action_label = XtVaCreateManagedWidget("action-question",
1307 xmLabelWidgetClass, form,
1309 XmNalignment, XmALIGNMENT_BEGINNING,
1310 XmNtopAttachment, XmATTACH_WIDGET,
1311 XmNtopWidget, msg_label,
1312 XmNtopOffset, 3*VERTICAL_SPACING,
1313 XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
1314 XmNleftWidget, msg_label,
1319 /* create radio box */
1322 XtSetArg (args[n], XmNorientation, XmVERTICAL); n++;
1323 XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
1324 XtSetArg (args[n], XmNtopWidget, action_label); n++;
1325 XtSetArg (args[n], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
1326 XtSetArg (args[n], XmNleftWidget, action_label); n++;
1327 XtSetArg (args[n], XmNleftOffset, 2*HORIZONTAL_SPACING); n++;
1328 radio = (Widget) XmCreateRadioBox(form, "radio_box", args, n);
1330 /* create the radio buttons ... default button is replace */
1331 xs = XmStringCreateLocalized(GETMESSAGE(9, 25, "Replace existing folder"));
1332 radioButton1 = XtVaCreateManagedWidget("radio_toggle1",
1333 xmToggleButtonWidgetClass, radio,
1334 XmNalignment, XmALIGNMENT_BEGINNING,
1340 xs = XmStringCreateLocalized(GETMESSAGE(9, 24, "Merge contents of the two folders"));
1341 G_merge_toggle = XtVaCreateManagedWidget("radio_toggle2",
1342 xmToggleButtonWidgetClass, radio,
1343 XmNalignment, XmALIGNMENT_BEGINNING,
1348 XtManageChild(radio);
1351 /* create the action area */
1352 actionArea = Create_Action_Area(form, actions, NULL);
1353 separator = XtVaCreateManagedWidget("separator",
1354 xmSeparatorWidgetClass, form,
1355 XmNtopAttachment, XmATTACH_WIDGET,
1356 XmNtopWidget, radio,
1357 XmNbottomAttachment, XmATTACH_WIDGET,
1358 XmNbottomWidget, actionArea,
1359 XmNleftAttachment, XmATTACH_FORM,
1360 XmNrightAttachment, XmATTACH_FORM,
1364 /* set initial keyborad focus to the action button area */
1366 XmNinitialFocus, actionArea,
1369 /* Manage the dialog */
1370 XtManageChild(form);
1374 XtFree(actions.actionList[1].label);
1375 actions.actionList[1].label = orig_label;
1376 actions.actionList[1].msg_num = orig_msg_num;
1379 } /* end create_replace_merge_dialog */
1384 /*--------------------------------------------------------------------
1385 * create multicollide dialog
1386 *------------------------------------------------------------------*/
1389 create_multicollide_dialog(Widget parent_widget,
1395 int filop_confirm_fd,
1396 ActionAreaDefn actions,
1403 Widget action_label;
1406 Widget radioButton1;
1410 Pixel background, foreground;
1411 String s, s1, eMsgOne, eMsgMany;
1421 XBell( XtDisplay( G_dialogShell ), 100 );
1425 /* make args available to callback functions */
1426 G_filop_confirm_fd = filop_confirm_fd;
1427 strcpy(G_directory,destination);
1428 G_fileList = fileList;
1429 G_nCollisions = nCollisions;
1432 /* Initialize images for error, warning, ... icons */
1435 ImageInitialize(XtDisplay(toplevel));
1436 G_initImages = False;
1439 /* Initialize mode-dependent things */
1441 orig_label = actions.actionList[1].label;
1442 orig_msg_num = actions.actionList[1].msg_num;
1445 title = XtNewString(GETMESSAGE(9, 34, "File Manager - Move Warning"));
1446 XtSetArg (args[n], XmNtitle, title);
1448 actions.actionList[1].label =
1449 XtNewString(GETMESSAGE(9, 30, "Cancel Move"));
1450 actions.actionList[1].msg_num = 30;
1451 eMsgOne = XtNewString(GETMESSAGE(9, 127, "1 object moved."));
1452 eMsgMany = XtNewString(GETMESSAGE(9, 128, "%d objects moved."));
1455 title = XtNewString(GETMESSAGE(9, 35, "File Manager - Copy Warning"));
1456 XtSetArg (args[n], XmNtitle, title);
1458 actions.actionList[1].label =
1459 XtNewString(GETMESSAGE(9, 31, "Cancel Copy"));
1460 actions.actionList[1].msg_num = 31;
1461 eMsgOne = XtNewString(GETMESSAGE(9, 129, "1 object copied."));
1462 eMsgMany = XtNewString(GETMESSAGE(9, 130, "%d objects copied."));
1465 title = XtNewString(GETMESSAGE(9, 36, "File Manager - Link Warning"));
1466 XtSetArg (args[n], XmNtitle, title);
1468 actions.actionList[1].label =
1469 XtNewString(GETMESSAGE(9, 32, "Cancel Link"));
1470 actions.actionList[1].msg_num = 32;
1471 eMsgOne = XtNewString(GETMESSAGE(9, 131, "1 object linked."));
1472 eMsgMany = XtNewString(GETMESSAGE(9, 132, "%d objects linked."));
1475 title = XtNewString(GETMESSAGE(9, 33, "File Manager - Move/Copy/Link Warning"));
1476 XtSetArg (args[n], XmNtitle, title);
1478 eMsgOne = XtNewString(GETMESSAGE(9, 133, "1 object changed."));
1479 eMsgMany = XtNewString(GETMESSAGE(9, 134, "%d objects changed."));
1484 /* Create the dialog shell for the dialog */
1485 G_dialogShell = XmCreateDialogShell (parent_widget, "multicollide dialog", args, n);
1488 /* Create the Manager Widget, form, for the copy dialog */
1489 form = XtVaCreateWidget ("dialog_form",
1490 xmFormWidgetClass, G_dialogShell,
1491 XmNverticalSpacing, VERTICAL_SPACING,
1492 XmNhorizontalSpacing, HORIZONTAL_SPACING,
1493 XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL,
1496 /* Create a question dialog icon */
1498 XtSetArg (args[n], XmNbackground, &background); n++;
1499 XtSetArg (args[n], XmNforeground, &foreground); n++;
1500 XtGetValues (form, args, n);
1502 px = XmGetPixmapByDepth(XtScreen(form), "xm_question",
1503 foreground, background, form->core.depth);
1504 if (px == XmUNSPECIFIED_PIXMAP)
1505 px = XmGetPixmapByDepth(XtScreen(form), "default_xm_question",
1506 foreground, background, form->core.depth);
1508 icon = XtVaCreateManagedWidget("question_icon",
1509 xmLabelWidgetClass, form,
1510 XmNlabelType, XmPIXMAP,
1512 XmNtopAttachment, XmATTACH_FORM,
1513 XmNleftAttachment, XmATTACH_FORM,
1516 /* Create the message label */
1518 nChanged = (nSelected - nCollisions);
1519 if ( nChanged == 0 )
1520 /* This is really stupid but Sun requires it
1521 For now just get it work.
1523 s1 = (char *)XtCalloc( 1, 1 );
1524 else if ( nChanged == 1 )
1526 s1 = XtNewString(eMsgOne);
1530 s1 = (char *)XtMalloc( 20 + strlen(eMsgMany) );
1532 sprintf(s1, eMsgMany, nChanged);
1535 if (nCollisions > 1)
1537 int tmp_len = (s1)?strlen(s1):0;
1538 char *tmpmsg,*filemsg=NULL;
1541 filemsg = XtMalloc(strlen(destination)+3);
1542 sprintf(filemsg,"%s\n",destination);
1543 for(i = 0;i < nCollisions; i++)
1548 tmpmsg = GETMESSAGE(27,98, "(Plus %d additional object(s))");
1549 addmsg = XtMalloc(strlen(tmpmsg)+10);
1550 sprintf(addmsg,tmpmsg,nCollisions-8);
1551 filemsg = XtRealloc(filemsg,strlen(filemsg)+strlen(addmsg)+4);
1552 strcat(filemsg,"\n\n");
1553 strcat(filemsg,addmsg);
1557 filemsg = XtRealloc(filemsg,strlen(filemsg)+strlen(destination)+
1558 strlen(fileList[i])+3);
1559 strcat(filemsg,"\n");
1560 strcat(filemsg,destination);
1561 strcat(filemsg,"/");
1562 strcat(filemsg,fileList[i]);
1564 filemsg = XtRealloc(filemsg,strlen(filemsg)+2);
1566 tmpmsg = GETMESSAGE(9, 70,
1567 "%s\n%d objects have the same name as objects in the folder\n%s");
1568 s = (char *)XtMalloc( tmp_len + strlen(tmpmsg) + strlen(filemsg) + 10);
1569 sprintf(s,tmpmsg,s1, nCollisions, filemsg);
1574 int tmp_len = (s1)?strlen(s1):0;
1575 s = (char *)XtMalloc( tmp_len + 10
1576 + strlen( GETMESSAGE(9, 71, "%s\n1 object has the same name as an object in the folder\n%s") )
1577 + strlen( destination ) );
1578 sprintf(s, GETMESSAGE(9, 71, "%s\n1 object has the same name as an object in the folder\n%s"), s1, destination);
1581 xs = XmStringCreateLocalized(s);
1582 msg_label = XtVaCreateManagedWidget("msg_header",
1583 xmLabelWidgetClass, form,
1585 XmNalignment, XmALIGNMENT_BEGINNING,
1586 XmNtopAttachment, XmATTACH_FORM,
1587 XmNleftAttachment, XmATTACH_WIDGET,
1588 XmNleftWidget, icon,
1589 XmNleftOffset, HORIZONTAL_SPACING,
1590 XmNrightAttachment, XmATTACH_FORM,
1599 /* create the action-question */
1600 xs = XmStringCreateLocalized(GETMESSAGE(9, 20, "What do you want to do?"));
1601 action_label = XtVaCreateManagedWidget("action-question",
1602 xmLabelWidgetClass, form,
1604 XmNalignment, XmALIGNMENT_BEGINNING,
1605 XmNtopAttachment, XmATTACH_WIDGET,
1606 XmNtopWidget, msg_label,
1607 XmNtopOffset, 3*VERTICAL_SPACING,
1608 XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
1609 XmNleftWidget, msg_label,
1614 /* create radio box */
1617 XtSetArg (args[n], XmNorientation, XmVERTICAL); n++;
1618 XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
1619 XtSetArg (args[n], XmNtopWidget, action_label); n++;
1620 XtSetArg (args[n], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
1621 XtSetArg (args[n], XmNleftWidget, action_label); n++;
1622 XtSetArg (args[n], XmNleftOffset, 2*HORIZONTAL_SPACING); n++;
1623 radio = (Widget) XmCreateRadioBox(form, "radio_box", args, n);
1625 /* create the radio buttons ... default button is replace */
1626 xs = XmStringCreateLocalized(GETMESSAGE(9, 56, "Replace existing objects"));
1633 radioButton1 = XtVaCreateManagedWidget("radio_toggle1",
1634 xmToggleButtonWidgetClass, radio,
1635 XmNalignment, XmALIGNMENT_BEGINNING,
1642 XtSetSensitive(radioButton1, False);
1644 xs = XmStringCreateLocalized(GETMESSAGE(9, 141, "Rename new objects by appending a number"));
1648 XtSetSensitive(radioButton1, True);
1650 xs = XmStringCreateLocalized(GETMESSAGE(9, 57, "Rename existing objects by appending a number"));
1653 G_multi_rename_toggle = XtVaCreateManagedWidget("radio_toggle2",
1654 xmToggleButtonWidgetClass, radio,
1655 XmNalignment, XmALIGNMENT_BEGINNING,
1661 XtManageChild(radio);
1664 /* create the action area */
1665 actionArea = Create_Action_Area(form, actions, NULL);
1666 separator = XtVaCreateManagedWidget("separator",
1667 xmSeparatorWidgetClass, form,
1668 XmNtopAttachment, XmATTACH_WIDGET,
1669 XmNtopWidget, radio,
1670 XmNbottomAttachment, XmATTACH_WIDGET,
1671 XmNbottomWidget, actionArea,
1672 XmNleftAttachment, XmATTACH_FORM,
1673 XmNrightAttachment, XmATTACH_FORM,
1677 /* set initial keyborad focus to the action button area */
1679 XmNinitialFocus, actionArea,
1682 /* Manage the dialog */
1683 XtManageChild(form);
1687 XtFree(actions.actionList[1].label);
1688 actions.actionList[1].label = orig_label;
1689 actions.actionList[1].msg_num = orig_msg_num;
1692 } /* end create_multicollide_dialog */
1696 /*--------------------------------------------------------------------
1698 * Create Action Area
1700 * Use of this function requires #include "sharedFuncs.h"
1701 * The source for Create_Action_Area is in dtfile/OverWrite.c and
1702 * dtfile/dtcopy/utils.c. Because it uses GETMESSAGE, it could not
1703 * be placed in dtcopy/sharedFunc.c.
1705 *------------------------------------------------------------------*/
1709 Widget parent_widget,
1710 ActionAreaDefn actions,
1711 Widget *pushbutton_array)
1713 Widget action_area, widget;
1715 int fractbase_value;
1719 if (actions.defaultAction < 0 || actions.defaultAction > actions.numActions-1)
1720 actions.defaultAction = 0;
1722 fractbase_value = (TIGHTNESS * actions.numActions) - 1;
1723 action_area = XtVaCreateWidget("action_area", xmFormWidgetClass ,parent_widget,
1724 XmNfractionBase, fractbase_value,
1725 XmNleftAttachment, XmATTACH_FORM,
1726 XmNrightAttachment, XmATTACH_FORM,
1727 XmNbottomAttachment, XmATTACH_FORM,
1730 for (i=0; i < actions.numActions ;i++ )
1732 xm_string = XmStringCreateLocalized(GETMESSAGE(actions.actionList[i].msg_set,
1733 actions.actionList[i].msg_num,
1734 actions.actionList[i].label));
1735 widget = XtVaCreateManagedWidget(actions.actionList[i].label,
1736 xmPushButtonWidgetClass, action_area,
1737 XmNleftAttachment, (i ? XmATTACH_POSITION: XmATTACH_FORM),
1738 XmNleftPosition, (TIGHTNESS * i),
1739 XmNtopAttachment, XmATTACH_FORM,
1740 XmNbottomAttachment, XmATTACH_FORM,
1742 ((i != (actions.numActions - 1)) ? XmATTACH_POSITION: XmATTACH_FORM),
1743 XmNrightPosition, ((TIGHTNESS*i) + (TIGHTNESS - 1)),
1744 XmNshowAsDefault, (i == actions.defaultAction),
1745 XmNdefaultButtonShadowThickness, 1,
1746 XmNlabelString, xm_string,
1748 XmStringFree(xm_string);
1752 if (actions.actionList[i].callback)
1754 XtAddCallback(widget, XmNactivateCallback,
1755 actions.actionList[i].callback, actions.actionList[i].data);
1758 if (i == actions.defaultAction)
1761 Dimension height, h;
1762 XtVaGetValues (action_area, XmNmarginHeight, &heightptr, NULL);
1763 height = (Dimension)heightptr;
1764 XtVaGetValues (widget, XmNheight, &heightptr, NULL);
1765 h = (Dimension)heightptr;
1768 XtVaSetValues (action_area,
1769 XmNdefaultButton, widget,
1770 XmNpaneMaximum, height,
1771 XmNpaneMinimum, height,
1776 if (pushbutton_array != NULL)
1777 pushbutton_array[i] = widget;
1781 XtManageChild(action_area);
1784 } /* end Create_Action_Area */
1788 /*--------------------------------------------------------------------
1790 * Get Variable Message
1792 * Return the appropriate message for the current mode (move, copy,
1795 *------------------------------------------------------------------*/
1799 VariableMessage message,
1804 case vm_replaceCannotDeleteFolder:
1808 return GETMESSAGE(9, 95, "Move Canceled - the folder was not moved.\n\n\
1809 The folder you want to replace could not be deleted\n\
1810 because an object inside that folder could not be deleted.\n\
1811 Some other objects inside that folder may have already been\n\
1812 deleted before the move process was halted.\n\n\
1813 The most probable cause of this problem is that you do not\n\
1814 have Write permission for the object that could not be removed.\n\
1815 Change Write permission or manually rename the folder you\n\
1816 are moving so it no longer has the same name.");
1819 return GETMESSAGE(9, 96, "Copy Canceled - the folder was not copied.\n\n\
1820 The folder you want to replace could not be deleted\n\
1821 because an object inside that folder could not be deleted.\n\
1822 Some other objects inside that folder may have already been\n\
1823 deleted before the copy process was halted.\n\n\
1824 The most probable cause of this problem is that you do not\n\
1825 have Write permission for the object that could not be removed.\n\
1826 Change Write permission or manually rename the folder you\n\
1827 are copying so it no longer has the same name.");
1830 return GETMESSAGE(9, 97, "Link Canceled - the folder was not linked.\n\n\
1831 The folder you want to replace could not be deleted\n\
1832 because an object inside that folder could not be deleted.\n\
1833 Some other objects inside that folder may have already been\n\
1834 deleted before the link process was halted.\n\n\
1835 The most probable cause of this problem is that you do not\n\
1836 have Write permission for the object that could not be removed.\n\
1837 Change Write permission or manually rename the folder you\n\
1838 are linking so it no longer has the same name.");
1841 return GETMESSAGE(9, 98, "Operation Canceled - the folder was not changed.\n\n\
1842 The folder you want to replace could not be deleted\n\
1843 because an object inside that folder could not be deleted.\n\
1844 Some other objects inside that folder may have already been\n\
1845 deleted before the process was halted.\n\n\
1846 The most probable cause of this problem is that you do not\n\
1847 have Write permission for the object that could not be removed.\n\
1848 Change Write permission or manually rename the folder you\n\
1849 are changing so it no longer has the same name.");
1851 } /* end switch (mode) */
1853 case vm_replaceCannotDeleteFile:
1857 return GETMESSAGE(9, 99, "Move Canceled\n\n\
1859 cannot be removed.\n\n\
1860 The most probable cause of this problem is that\n\
1861 you do not have Write permission for the file.\n\
1862 Change Write permission or manually rename the\n\
1863 file you are moving so it no longer has the same name.");
1866 return GETMESSAGE(9, 100, "Copy Canceled\n\n\
1868 cannot be removed.\n\n\
1869 The most probable cause of this problem is that\n\
1870 you do not have Write permission for the file.\n\
1871 Change Write permission or manually rename the\n\
1872 file you are copying so it no longer has the same name.");
1875 return GETMESSAGE(9, 101, "Link Canceled\n\n\
1877 cannot be removed.\n\n\
1878 The most probable cause of this problem is that\n\
1879 you do not have Write permission for the file.\n\
1880 Change Write permission or manually rename the\n\
1881 file you are linking so it no longer has the same name.");
1884 return GETMESSAGE(9, 102, "Operation Canceled\n\n\
1886 cannot be removed.\n\n\
1887 The most probable cause of this problem is that\n\
1888 you do not have Write permission for the file.\n\
1889 Change Write permission or manually rename the\n\
1890 file you are changing so it no longer has the same name.");
1892 } /* end switch (mode) */
1894 case vm_multiCannotRenameMany:
1898 return GETMESSAGE(9, 103, "Move Canceled - None of the objects were moved.\n\n\
1899 The following object could not be automatically renamed\n\
1901 %d objects were renamed before the move process was halted.\n\n\
1902 The most probable cause of this problem is that you do not have Write\n\
1903 permission for the above object. Change Write permission or manually\n\
1904 rename the object you are moving so it no longer has the same name.");
1907 return GETMESSAGE(9, 104, "Copy Canceled - None of the objects were copied.\n\n\
1908 The following object could not be automatically renamed\n\
1910 %d objects were renamed before the copy process was halted.\n\n\
1911 The most probable cause of this problem is that you do not have Write\n\
1912 permission for the above object. Change Write permission or manually\n\
1913 rename the object you are copying so it no longer has the same name.");
1916 return GETMESSAGE(9, 105, "Link Canceled - None of the objects were linked.\n\n\
1917 The following object could not be automatically renamed\n\
1919 %d objects were renamed before the link process was halted.\n\n\
1920 The most probable cause of this problem is that you do not have Write\n\
1921 permission for the above object. Change Write permission or manually\n\
1922 rename the object you are linking so it no longer has the same name.");
1925 return GETMESSAGE(9, 106, "Operation Canceled - None of the objects were changed.\n\n\
1926 The following object could not be automatically renamed\n\
1928 %d objects were renamed before the process was halted.\n\n\
1929 The most probable cause of this problem is that you do not have Write\n\
1930 permission for the above object. Change Write permission or manually\n\
1931 rename the object you are changing so it no longer has the same name.");
1933 } /* end switch (mode) */
1935 case vm_multiCannotRenameOne:
1939 return GETMESSAGE(9, 107, "Move Canceled - None of the objects were moved.\n\n\
1940 The following object could not be automatically renamed\n\
1942 1 object was renamed before the move process was halted.\n\n\
1943 The most probable cause of this problem is that you do not have Write\n\
1944 permission for the above object. Change Write permission or manually\n\
1945 rename the object you are moving so it no longer has the same name.");
1948 return GETMESSAGE(9, 108, "Copy Canceled - None of the objects were copied.\n\n\
1949 The following object could not be automatically renamed\n\
1951 1 object was renamed before the copy process was halted.\n\n\
1952 The most probable cause of this problem is that you do not have Write\n\
1953 permission for the above object. Change Write permission or manually\n\
1954 rename the object you are copying so it no longer has the same name.");
1957 return GETMESSAGE(9, 109, "Link Canceled - None of the objects were linked.\n\n\
1958 The following object could not be automatically renamed\n\
1960 1 object was renamed before the link process was halted.\n\n\
1961 The most probable cause of this problem is that you do not have Write\n\
1962 permission for the above object. Change Write permission or manually\n\
1963 rename the object you are linking so it no longer has the same name.");
1966 return GETMESSAGE(9, 110, "Operation Canceled - None of the objects were changed.\n\n\
1967 The following object could not be automatically renamed\n\
1969 1 object was renamed before the process was halted.\n\n\
1970 The most probable cause of this problem is that you do not have Write\n\
1971 permission for the above object. Change Write permission or manually\n\
1972 rename the object you are changing so it no longer has the same name.");
1974 } /* end switch (mode) */
1976 case vm_multiCannotDeleteFolderMany:
1980 return GETMESSAGE(9, 111, "Move Canceled - none of the objects were moved.\n\n\
1981 A folder that you want to replace could not be deleted.\n\
1983 Some objects inside this folder may have been deleted\n\
1984 before the move process was halted.\n\n\
1985 %d other objects have been deleted.\n\n\
1986 The most probable cause of this problem is that you do not have Write\n\
1987 permission for the above folder. Change Write permission or manually\n\
1988 rename the folder you are moving so it no longer has the same name.");
1991 return GETMESSAGE(9, 112, "Copy Canceled - none of the objects were copied.\n\n\
1992 A folder that you want to replace could not be deleted.\n\
1994 Some objects inside this folder may have been deleted\n\
1995 before the copy process was halted.\n\n\
1996 %d other objects have been deleted.\n\n\
1997 The most probable cause of this problem is that you do not have Write\n\
1998 permission for the above folder. Change Write permission or manually\n\
1999 rename the folder you are copying so it no longer has the same name.");
2002 return GETMESSAGE(9, 113, "Link Canceled - none of the objects were linked.\n\n\
2003 A folder that you want to replace could not be deleted.\n\
2005 Some objects inside this folder may have been deleted\n\
2006 before the link process was halted.\n\n\
2007 %d other objects have been deleted.\n\n\
2008 The most probable cause of this problem is that you do not have Write\n\
2009 permission for the above folder. Change Write permission or manually\n\
2010 rename the folder you are linking so it no longer has the same name.");
2013 return GETMESSAGE(9, 114, "Operation Canceled - none of the objects were changed.\n\n\
2014 A folder that you want to replace could not be deleted.\n\
2016 Some objects inside this folder may have been deleted\n\
2017 before the process was halted.\n\n\
2018 %d other objects have been deleted.\n\n\
2019 The most probable cause of this problem is that you do not have Write\n\
2020 permission for the above folder. Change Write permission or manually\n\
2021 rename the folder you are changing so it no longer has the same name.");
2023 } /* end switch (mode) */
2025 case vm_multiCannotDeleteFolderOne:
2029 return GETMESSAGE(9, 115, "Move Canceled - none of the objects were moved.\n\n\
2030 A folder that you want to replace could not be deleted.\n\
2032 Some objects inside this folder may have been deleted\n\
2033 before the move process was halted.\n\n\
2034 1 other object has been deleted.\n\n\
2035 The most probable cause of this problem is that you do not have Write\n\
2036 permission for the above folder. Change Write permission or manually\n\
2037 rename the folder you are moving so it no longer has the same name.");
2040 return GETMESSAGE(9, 116, "Copy Canceled - none of the objects were copied.\n\n\
2041 A folder that you want to replace could not be deleted.\n\
2043 Some objects inside this folder may have been deleted\n\
2044 before the copy process was halted.\n\n\
2045 1 other object has been deleted.\n\n\
2046 The most probable cause of this problem is that you do not have Write\n\
2047 permission for the above folder. Change Write permission or manually\n\
2048 rename the folder you are copying so it no longer has the same name.");
2051 return GETMESSAGE(9, 117, "Link Canceled - none of the objects were linked.\n\n\
2052 A folder that you want to replace could not be deleted.\n\
2054 Some objects inside this folder may have been deleted\n\
2055 before the link process was halted.\n\n\
2056 1 other object has been deleted.\n\n\
2057 The most probable cause of this problem is that you do not have Write\n\
2058 permission for the above folder. Change Write permission or manually\n\
2059 rename the folder you are linking so it no longer has the same name.");
2062 return GETMESSAGE(9, 118, "Operation Canceled - none of the objects were changed.\n\n\
2063 A folder that you want to replace could not be deleted.\n\
2065 Some objects inside this folder may have been deleted\n\
2066 before the process was halted.\n\n\
2067 1 other object has been deleted.\n\n\
2068 The most probable cause of this problem is that you do not have Write\n\
2069 permission for the above folder. Change Write permission or manually\n\
2070 rename the folder you are changing so it no longer has the same name.");
2072 } /* end switch (mode) */
2074 case vm_multiCannotDeleteFileMany:
2078 return GETMESSAGE(9, 119, "Move Canceled - none of the objects were moved.\n\n\
2079 A file that you want to replace could not be deleted.\n\
2081 %d other objects have been deleted.\n\n\
2082 The most probable cause of this problem is that you do not have Write\n\
2083 permission for the above file. Change Write permission or manually\n\
2084 rename the file you are moving so it no longer has the same name.");
2087 return GETMESSAGE(9, 120, "Copy Canceled - none of the objects were copied.\n\n\
2088 A file that you want to replace could not be deleted.\n\
2090 %d other objects have been deleted.\n\n\
2091 The most probable cause of this problem is that you do not have Write\n\
2092 permission for the above file. Change Write permission or manually\n\
2093 rename the file you are copying so it no longer has the same name.");
2096 return GETMESSAGE(9, 121, "Link Canceled - none of the objects were linked.\n\n\
2097 A file that you want to replace could not be deleted.\n\
2099 %d other objects have been deleted.\n\n\
2100 The most probable cause of this problem is that you do not have Write\n\
2101 permission for the above file. Change Write permission or manually\n\
2102 rename the file you are linking so it no longer has the same name.");
2105 return GETMESSAGE(9, 122, "Operation Canceled - none of the objects were changed.\n\n\
2106 A file that you want to replace could not be deleted.\n\
2108 %d other objects have been deleted.\n\n\
2109 The most probable cause of this problem is that you do not have Write\n\
2110 permission for the above file. Change Write permission or manually\n\
2111 rename the file you are changing so it no longer has the same name.");
2113 } /* end switch (mode) */
2115 case vm_multiCannotDeleteFileOne:
2119 return GETMESSAGE(9, 123, "Move Canceled - none of the objects were moved.\n\n\
2120 A file that you want to replace could not be deleted.\n\
2122 1 other object has been deleted.\n\n\
2123 The most probable cause of this problem is that you do not have Write\n\
2124 permission for the above file. Change Write permission or manually\n\
2125 rename the file you are moving so it no longer has the same name.");
2128 return GETMESSAGE(9, 124, "Copy Canceled - none of the objects were copied.\n\n\
2129 A file that you want to replace could not be deleted.\n\
2131 1 other object has been deleted.\n\n\
2132 The most probable cause of this problem is that you do not have Write\n\
2133 permission for the above file. Change Write permission or manually\n\
2134 rename the file you are copying so it no longer has the same name.");
2137 return GETMESSAGE(9, 125, "Link Canceled - none of the objects were linked.\n\n\
2138 A file that you want to replace could not be deleted.\n\
2140 1 other object has been deleted.\n\n\
2141 The most probable cause of this problem is that you do not have Write\n\
2142 permission for the above file. Change Write permission or manually\n\
2143 rename the file you are linking so it no longer has the same name.");
2146 return GETMESSAGE(9, 126, "Operation Canceled - none of the objects were changed.\n\n\
2147 A file that you want to replace could not be deleted.\n\
2149 1 other object has been deleted.\n\n\
2150 The most probable cause of this problem is that you do not have Write\n\
2151 permission for the above file. Change Write permission or manually\n\
2152 rename the file you are changing so it no longer has the same name.");
2154 } /* end switch (mode) */
2156 } /* end switch (message) */
2158 } /* end getVariableMessage */
2166 if(lstat(name,&s1) < 0)
2168 if (S_ISDIR(s1.st_mode))
2170 if(!access(name,02|01))
2176 if(!access(name,02))