summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDarin Adler <darin@src.gnome.org>2002-01-28 23:31:40 +0000
committerDarin Adler <darin@src.gnome.org>2002-01-28 23:31:40 +0000
commit39c3dcc03181e4f3b92d026286b9292247de92bf (patch)
tree385a24135dcc95aa68a89a675878784a4ff44ea7 /src
parentaa25134442949eb566d7d926dd9415a2faf6a1b6 (diff)
downloadnautilus-39c3dcc03181e4f3b92d026286b9292247de92bf.tar.gz
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).
Diffstat (limited to 'src')
-rw-r--r--src/file-manager/fm-directory-view.c43
-rw-r--r--src/nautilus-shell-ui.xml27
2 files changed, 37 insertions, 33 deletions
diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c
index cc6d00467..1de9bc99b 100644
--- a/src/file-manager/fm-directory-view.c
+++ b/src/file-manager/fm-directory-view.c
@@ -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;
}
}
diff --git a/src/nautilus-shell-ui.xml b/src/nautilus-shell-ui.xml
index f926bf39d..86c8caee7 100644
--- a/src/nautilus-shell-ui.xml
+++ b/src/nautilus-shell-ui.xml
@@ -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/>