On Wed, 2005-06-22 at 15:16, Pavel Tsekov wrote:
> No. The condition `edit_one_file != NULL' is valid only when you invoke
> the editor as mcedit (directly from the command line) and not from within
> the file manager i.e. pressing F4 on a file. I use `edit_one_file' to
> recognize the difference. If the editor is called from the file
> manager it is ok to use `panel' because it contains valid data.

I think you misunderstand my question. See:

    WPanel *panel = NULL;
    if (edit_one_file != NULL)
        fname = edit_widget->filename; /* panel == NULL */
    else if (islower ((unsigned char) c))
        panel = current_panel; /* panel != NULL */
    else {
        if (get_other_type () != view_listing)
            return g_strdup ("");
        panel = other_panel; /* panel == NULL */
    }
    if (panel) /* Why test here as we already know if panel is assigned
above */
        fname = panel->dir.list[panel->selected].fname;

If I am not mistaken this can be rewritten as:

    WPanel *panel = NULL;
    if (edit_one_file != NULL) /* panel == NULL */
        fname = edit_widget->filename;
    else {
        if (islower ((unsigned char) c))
            panel = current_panel;
        else {
            if (get_other_type () != view_listing)
                return g_strdup ("");
            panel = other_panel;
        }
        /* panel != NULL */
        fname = panel->dir.list[panel->selected].fname;
    }

Correct?

Leonard.

-- 
mount -t life -o ro /dev/dna /genetic/research


_______________________________________________
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel

Reply via email to