Re: [PATCH] Do not select symlinked dirs as files

2003-06-18 Thread David Sterba
Hi,

> I think it's a wrong place.  Whether you want to select symlinks to
> directories depends on the data you are working with, not on what kind
> of user you are.
Yes, I agree. 

> This should be in the select dialog.
Done.

Select/Unselect input dialog now shows the option.
I added new functions to handle the extended input dialog and let
(only) the select/unselect dialog to use it. Other input dialogs are left
unchanged (layout, contents and calling functions).
See changelog for details.


David
diff -S ChangeLog -X .diffignore -urNp mc/src/ChangeLog mc-sel/src/ChangeLog
--- mc/src/ChangeLog	Sun Jun 15 21:15:13 2003
+++ mc-sel/src/ChangeLog	Wed Jun 18 12:19:37 2003
@@ -0,0 +1,18 @@
+2003-06-18  David Sterba  <[EMAIL PROTECTED]>
+
+	* background.c: Set number of supported arguments for background
+	jobs to 6 due to extensions of quick dialog.
+	(background_attention): Handle the count.
+	(message_3s): Fix the incorrect number of params passed.
+	(input_dialog_help): Adjust call to real_input_dialog_help.
+	(input_dialog_help_ext): New function.
+	* cmd.c (select_cmd, unselect_cmd, reverse_selection_cmd):
+	Handle symlinked directories as directories in file selections
+	if wanted. Add a variable for it.
+	(unselect_cmd, select_cmd): Add extended option to selection dialog.
+	* main.h: Extern the variable.
+	* wtools.c (real_input_dialog_help): New param for dlg extension.
+	Split widget sets into basic and extended. Update layout of dialog.
+	(input_dialog_ext): New function. Extends the basic input dialog.
+	* wtools.h: Add new functions and extension enum. 
+
diff -S ChangeLog -X .diffignore -urNp mc/src/background.c mc-sel/src/background.c
--- mc/src/background.c	Mon Jun  2 20:13:43 2003
+++ mc-sel/src/background.c	Wed Jun 18 12:09:20 2003
@@ -66,7 +66,7 @@ int socketpair(int, int, int, int fd[2])
 /* File descriptor for talking to our parent */
 static int parent_fd;
 
-#define MAXCALLARGS 4		/* Number of arguments supported */
+#define MAXCALLARGS 6		/* Number of arguments supported */
 #define mymsg "Desde el hijo\n\r"
 
 struct TaskList *task_list = NULL;
@@ -330,6 +330,14 @@ background_attention (int fd, void *clos
 		result = (*(int (*)(int, char *, char *, char *, char *))routine)
 		(Background, data [0], data [1], data [2], data [3]);
 		break;
+	case 5:
+		result = (*(int (*)(int, char *, char *, char *, char *, char *))routine)
+		(Background, data [0], data [1], data [2], data [3], data [4]);
+		break;
+	case 6:
+		result = (*(int (*)(int, char *, char *, char *, char *, char *, char *))routine)
+		(Background, data [0], data [1], data [2], data [3], data [4], data [5]);
+		break;
 	}
 	else
 	switch (argc){
@@ -349,6 +357,14 @@ background_attention (int fd, void *clos
 		result = (*(int (*)(FileOpContext *, int, char *, char *, char *, char *))routine)
 		(ctx, Background, data [0], data [1], data [2], data [3]);
 		break;
+	case 5:
+		result = (*(int (*)(FileOpContext *, int, char *, char *, char *, char *, char *))routine)
+		(ctx, Background, data [0], data [1], data [2], data [3], data [4]);
+		break;
+	case 6:
+		result = (*(int (*)(FileOpContext *, int, char *, char *, char *, char *, char *, char *))routine)
+		(ctx, Background, data [0], data [1], data [2], data [3], data [4], data [5]);
+		break;
 	}
 
 	/* Send the result code and the value for shared variables */
@@ -378,6 +394,14 @@ background_attention (int fd, void *clos
 	resstr = (*(char * (*)(char *, char *, char *, char *))routine)
 		(data [0], data [1], data [2], data [3]);
 	break;
+	case 5:
+	resstr = (*(char * (*)(char *, char *, char *, char *, char *))routine)
+		(data [0], data [1], data [2], data [3], data [4]);
+	break;
+	case 6:
+	resstr = (*(char * (*)(char *, char *, char *, char *, char *, char*))routine)
+		(data [0], data [1], data [2], data [3], data [4], data [5]);
+	break;
 	default: g_assert_not_reached();
 	}
 	if (resstr){
@@ -509,7 +533,7 @@ message_3s (int flags, char *title, cons
 	const char *str2, const char *str3)
 {
 if (we_are_background)
-	parent_call ((void *)real_message_3s, NULL, 3, sizeof (flags), &flags,
+	parent_call ((void *)real_message_3s, NULL, 5, sizeof (flags), &flags,
 		 strlen (title), title, strlen (str1), str1,
 	 strlen (str2), str2, strlen (str3), str3);
 else
@@ -526,7 +550,21 @@ input_dialog_help (char *header, char *t
    strlen (help), help,
    strlen (def_text), def_text);
 else
-	return real_input_dialog_help (header, text, help, def_text);
+	return real_input_dialog_help (0, header, text, help, def_text);
+}
+
+char *
+input_dialog_help_ext (DlgExtensions ext, char *header, char *text, char *help, char *def_text)
+{
+if (we_are_background)
+	return parent_call_string ((void *)real_input_dialog_help, 5,
+   sizeof (ext),  &ext,
+   strlen (header),   header,
+   strlen (text), text,
+   strlen (help), help,
+

Re: [PATCH] Do not select symlinked dirs as files

2003-06-16 Thread Pavel Roskin
Hello, David!

Sorry I couldn't participate in the discussion earlier.

> so, now it is possible to choose in 'Configuration' menu whether to select
> symlinked dir as file or directory.

I think it's a wrong place.  Whether you want to select symlinks to
directories depends on the data you are working with, not on what kind
of user you are.  This should be in the select dialog.

I'm not saying that there should be no preference to keep the default, but
it shouldn't be the only place to chose the behavior.

Let's take an easier example.  The option for case sensitive search is in
the "Find File", not in preferences.  Some users mostly use with texts in
natural languages and use primarily case insensitive search.  Other work
mostly with programs and use case sensitive search.

This doesn't mean that a programmer doesn't need case insensitive search.
But he can change the setting right in the dialog rather than in the
global preferences.  If it was only in preferences and not in the dialog,
he would forget what he set there last time.  And it would take more
keystrokes to do a simple task.

What we don't have unfortunately is saving of the settings made in the
dialogs.  If I used case insensitive search last time, the search should
default to case insensitive after I restart mc.

I believe we need a more fine-grained mechanism to control which settings
are saved.  "Auto save setup" in the configuration in just inadequate.
But as the first step, settings made in dialogs should be saved if and
only if "Auto save setup" is on.

Once that is done, we can add more and more settings that appear only in
the applicable dialogs and don't clutter the configuration dialog.

Sorry, writing user-friendly programs is not easy.

-- 
Regards,
Pavel Roskin
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: [PATCH] Do not select symlinked dirs as files

2003-06-13 Thread David Sterba
Hi,

so, now it is possible to choose in 'Configuration' menu whether to select
symlinked dir as file or directory.

The default (after first run of patched mc) is as before (i.e.
sym. dir as file).

Patch uploaded to MC patch tracking system.

David

___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: [PATCH] Do not select symlinked dirs as files

2003-06-11 Thread David Sterba
Hi,

> I don't like this. I want when selecting all that symlinks are being
> selected as well. With other words. It should behave as it is now.

Well, let's make it optional then (in 'Configuration' menu), because
it is not always the desired behaviour.

David

___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: [PATCH] Do not select symlinked dirs as files

2003-06-11 Thread Ali Akcaagac
On Wed, 2003-06-11 at 13:16, David Sterba wrote:
> I think this i correct behaviour.

I don't like this. I want when selecting all that symlinks are being
selected as well. With other words. It should behave as it is now.

___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel


[PATCH] Do not select symlinked dirs as files

2003-06-11 Thread David Sterba
Hi,

this patch changes selection of files and dirs so that
symlinked dirs are not selected as files, but only
as directories (i.e. with "/" appended to file mask in selection dialog).

'Select', 'Unselect' and 'Reverse select' are consistent.

I think this i correct behaviour.

David
2003-06-11  David Sterba  <[EMAIL PROTECTED]>

* cmd.c (select_cmd, unselect_cmd, reverse_selection_cmd):
Handle symlinked directories as directories in file selections.

diff -X .diffignore -urNp mc/src/cmd.c mc-1ft/src/cmd.c
--- mc-sel/src/cmd.c	Tue Feb 18 06:25:45 2003
+++ mc/src/cmd.c	Wed Jun 11 12:46:03 2003
@@ -502,7 +502,8 @@ void reverse_selection_cmd (void)
 
 for (i = 0; i < cpanel->count; i++){
 	file = &cpanel->dir.list [i];
-	if (S_ISDIR (file->buf.st_mode))
+	if (S_ISDIR (file->buf.st_mode) ||
+	link_isdir ( &(cpanel->dir.list [i]) ))
 	continue;
 	do_file_mark (cpanel, i, !file->f.marked);
 }
@@ -535,7 +536,8 @@ void select_cmd (void)
 for (i = 0; i < cpanel->count; i++){
 if (!strcmp (cpanel->dir.list [i].fname, ".."))
 continue;
-	if (S_ISDIR (cpanel->dir.list [i].buf.st_mode)){
+	if (S_ISDIR (cpanel->dir.list [i].buf.st_mode) ||
+	link_isdir ( &(cpanel->dir.list [i]) )) {
 	if (!dirflag)
 continue;
 } else {
@@ -579,9 +581,10 @@ void unselect_cmd (void)
 reg_exp_t [strlen(reg_exp_t) - 1] = 0;
 }
 for (i = 0; i < cpanel->count; i++){
-if (!strcmp (cpanel->dir.list [i].fname, "..")) 
+if (!strcmp (cpanel->dir.list [i].fname, ".."))
 continue;
-	if (S_ISDIR (cpanel->dir.list [i].buf.st_mode)){
+	if (S_ISDIR (cpanel->dir.list [i].buf.st_mode) ||
+	link_isdir ( &(cpanel->dir.list [i]) )) {
 	if (!dirflag)
 	continue;
 } else {