Re: [Nautilus-list] XALF patch



Looks fine. Just a few nitpicks:

> +            name = nautilus_file_get_uri (file);
> +            df = nautilus_desktop_file_new ();

How can df be NULL after this? I don't think it can be. This the checks of
df below are not needed.

> +            /* As desktop file loader only test gnome vfs result, we have
> +             * to also test for a valid desktop file by querying the hash
> */
> -            command = uri + strlen (NAUTILUS_COMMAND_SPECIFIER);
> -            eel_gnome_shell_execute (command);
> +            if (df &&
> +                nautilus_desktop_file_load (name, &df) == GNOME_VFS_OK &&
> +                nautilus_desktop_file_get_string(df, NULL, "Exec", &command))
> +            {
> +                g_free (name);
> +                g_free (command);
> +                nautilus_desktop_file_launch (df);
> +                nautilus_desktop_file_free (df);
> +            }
> +            else
> +            {
> +                /* desktop file alloc failed or not a desktop file */
> +                if (df)
> +                {
> +                    nautilus_desktop_file_free (df);
> +                }
> +                
> +                /* As an additional precaution, only execute
> +                 * commands without any parameters, which is
> +                 * enforced by using a call that uses
> +                 * fork/execlp instead of system.
> +                 * cf.: nautilus-program-choosing.c
> +                 */
> +                command = uri + strlen (NAUTILUS_COMMAND_SPECIFIER);
> +                nautilus_launch_application_from_command("",
> +                                     command,
> +                                     NULL, /* param */
> +                                     FALSE);
> +                g_free (name);
> +            }

The g_free (name) and nautilus_desktop_file_free (df) should be moved out of
the if statement.

    -- Darin





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]