Commit 39c3dcc0 authored by Darin Adler's avatar Darin Adler

Changed the system(3) call to launch application from command. Instead use

	* libnautilus-private/nautilus-program-choosing.c
	(nautilus_launch_application_from_command): Changed the system(3) call to
	launch application from command. Instead use eel_gnome_shell_execute.

	* src/file-manager/fm-directory-view.c (activate_callback):
	Now use newly public NautilusDesktopFile class & nautilus_desktop_file_launch
	to launch the corresponding command.

	* libnautilus-private/nautilus-desktop-file-loader.c:
	* libnautilus-private/nautilus-desktop-file-loader.h:
	Made the NautilusDesktopFile class public. The struct has been moved
	from the source to the header. The nautilus_desktop_file_new method
	is not static any more.

	* libnautilus-private/nautilus-desktop-file-loader.c
	(nautilus_desktop_file_launch):
	Add the locale name taken from the desktop file to display it
	through xalf (launch feedback).
parent aa251344
2002-01-28 Remi Cohen-Scali <remi@cohen-scali.com>
* libnautilus-private/nautilus-program-choosing.c
(nautilus_launch_application_from_command): Changed the system(3) call to
launch application from command. Instead use eel_gnome_shell_execute.
* src/file-manager/fm-directory-view.c (activate_callback):
Now use newly public NautilusDesktopFile class & nautilus_desktop_file_launch
to launch the corresponding command.
* libnautilus-private/nautilus-desktop-file-loader.c:
* libnautilus-private/nautilus-desktop-file-loader.h:
Made the NautilusDesktopFile class public. The struct has been moved
from the source to the header. The nautilus_desktop_file_new method
is not static any more.
* libnautilus-private/nautilus-desktop-file-loader.c
(nautilus_desktop_file_launch):
Add the locale name taken from the desktop file to display it
through xalf (launch feedback).
2002-01-28 Seth Nickell <snickell@stanford.edu>
* icons/Makefile.am:
......
......@@ -102,7 +102,6 @@ void nautilus_desktop_file_foreach_key (NautilusDesk
NautilusDesktopFileForeachFunc func,
gpointer user_data);
static NautilusDesktopFile * nautilus_desktop_file_new (void);
static void hash_lines (NautilusDesktopFile *df);
static NautilusDesktopFileSection* section_new (const char *name,
char **start_line);
......@@ -115,7 +114,7 @@ static NautilusDesktopFileAddition* addition_new (Nauti
static void addition_free (NautilusDesktopFileAddition *addition);
static NautilusDesktopFile*
NautilusDesktopFile*
nautilus_desktop_file_new (void)
{
NautilusDesktopFile *df;
......@@ -1099,8 +1098,7 @@ nautilus_desktop_file_launch (NautilusDesktopFile *df)
char *url;
char *exec;
char *subst;
char *name;
if (!nautilus_desktop_file_get_string (df, NULL, "Type", &type)) {
return;
......@@ -1126,11 +1124,13 @@ nautilus_desktop_file_launch (NautilusDesktopFile *df)
in_terminal = FALSE;
nautilus_desktop_file_get_boolean (df, NULL, "Terminal", &in_terminal);
nautilus_desktop_file_get_locale_string (df, NULL, "Name", &name);
nautilus_launch_application_from_command ("",
nautilus_launch_application_from_command (name,
subst,
NULL,
in_terminal);
g_free (name);
g_free (subst);
}
......
......@@ -40,6 +40,7 @@ typedef struct NautilusDesktopFile NautilusDesktopFile;
* and put it in another library for use by the panel, nautilus etc.
*/
NautilusDesktopFile *nautilus_desktop_file_new (void);
GnomeVFSResult nautilus_desktop_file_load (const char *uri,
NautilusDesktopFile **desktop_file);
NautilusDesktopFile *nautilus_desktop_file_from_string (const char *data);
......
......@@ -674,16 +674,16 @@ nautilus_launch_application_from_command (const char *name,
}
xalf_prefix = get_xalf_prefix (name);
final_command = g_strconcat (xalf_prefix, full_command, NULL);
g_free (full_command);
g_free (xalf_prefix);
if (use_terminal) {
final_command = g_strconcat (xalf_prefix, full_command, NULL);
eel_gnome_open_terminal (final_command);
} else {
final_command = g_strconcat (xalf_prefix, full_command, " &", NULL);
system (final_command);
eel_gnome_shell_execute (final_command);
}
g_free (final_command);
g_free (full_command);
g_free (xalf_prefix);
}
......@@ -74,6 +74,7 @@
#include <libnautilus-private/nautilus-trash-directory.h>
#include <libnautilus-private/nautilus-trash-monitor.h>
#include <libnautilus-private/nautilus-view-identifier.h>
#include <libnautilus-private/nautilus-desktop-file-loader.h>
#include <libnautilus/nautilus-bonobo-ui.h>
#include <math.h>
#include <unistd.h>
......@@ -4627,6 +4628,7 @@ activate_callback (NautilusFile *file, gpointer callback_data)
char *uri, *command, *executable_path, *quoted_path, *name;
GnomeVFSMimeApplication *application;
ActivationAction action;
NautilusDesktopFile *df;
parameters = callback_data;
......@@ -4658,13 +4660,42 @@ activate_callback (NautilusFile *file, gpointer callback_data)
fm_directory_view_get_containing_window (view));
action = ACTIVATION_ACTION_DO_NOTHING;
} else {
/* As an additional precaution, only execute
* commands without any parameters, which is
* enforced by using a call that uses
* fork/execlp instead of system.
name = nautilus_file_get_uri (file);
df = nautilus_desktop_file_new ();
/* 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);
}
action = ACTIVATION_ACTION_DO_NOTHING;
}
}
......
......@@ -12,11 +12,6 @@
_tip="Go to the previous visited location"/>
<cmd name="Forward" accel="*Control*bracketright"
_tip="Go to the next visited location"/>
<cmd name="Find" accel="*Control*f"
_tip="Search this computer for files"/>
<cmd name="Toggle Find Mode"
_label="Find"
_tip="Search this computer for files"/>
<cmd name="New Window"
_label="New Window"
_tip="Open another Nautilus window for the displayed location"/>
......@@ -68,18 +63,6 @@
<placeholder name="General Status Placeholder" delimit="top"/>
<placeholder name="File Items Placeholder" delimit="top"/>
<placeholder name="Dangerous File Items Placeholder" delimit="top"/>
<separator/>
<menuitem name="Find"
_label="_Find"
verb="Find"/>
<menuitem name="Go to Web Search"
_label="We_b Search"
_tip="Search the World Wide Web"
accel="*Control**Shift*f"
verb="Go to Web Search"/>
<placeholder name="Global File Items Placeholder" delimit="top"/>
</submenu>
......@@ -316,16 +299,6 @@
min_width="48"
pixtype="stock" pixname="gtk-home"
verb="Home"/>
<toolitem name="Toggle Find Mode"
min_width="48"
type="toggle"
pixtype="stock" pixname="gtk-find"
verb="Toggle Find Mode"/>
<toolitem name="Go to Web Search"
_label="Web Search"
_tip="Search the World Wide Web"
pixtype="stock" pixname="gtk-find"
verb="Go to Web Search"/>
<separator/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment