summaryrefslogtreecommitdiff
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
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).
-rw-r--r--ChangeLog21
-rw-r--r--libnautilus-private/nautilus-desktop-file-loader.c10
-rw-r--r--libnautilus-private/nautilus-desktop-file-loader.h1
-rw-r--r--libnautilus-private/nautilus-program-choosing.c10
-rw-r--r--src/file-manager/fm-directory-view.c43
-rw-r--r--src/nautilus-shell-ui.xml27
6 files changed, 69 insertions, 43 deletions
diff --git a/ChangeLog b/ChangeLog
index 3de1cdd51..0d22e1400 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+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:
diff --git a/libnautilus-private/nautilus-desktop-file-loader.c b/libnautilus-private/nautilus-desktop-file-loader.c
index f564d4d5f..2cbdd8538 100644
--- a/libnautilus-private/nautilus-desktop-file-loader.c
+++ b/libnautilus-private/nautilus-desktop-file-loader.c
@@ -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);
}
diff --git a/libnautilus-private/nautilus-desktop-file-loader.h b/libnautilus-private/nautilus-desktop-file-loader.h
index e82303707..897a25eeb 100644
--- a/libnautilus-private/nautilus-desktop-file-loader.h
+++ b/libnautilus-private/nautilus-desktop-file-loader.h
@@ -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);
diff --git a/libnautilus-private/nautilus-program-choosing.c b/libnautilus-private/nautilus-program-choosing.c
index 526d5b6be..78170090c 100644
--- a/libnautilus-private/nautilus-program-choosing.c
+++ b/libnautilus-private/nautilus-program-choosing.c
@@ -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);
}
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/>