summaryrefslogtreecommitdiff
path: root/libnautilus-extensions
diff options
context:
space:
mode:
authorDarin Adler <darin@src.gnome.org>2001-04-23 20:38:45 +0000
committerDarin Adler <darin@src.gnome.org>2001-04-23 20:38:45 +0000
commit03e13fee9bc5fe18f0068842651a78d56913c52d (patch)
treed19017a588f72444988c4aa9f1555e4b54fb3d23 /libnautilus-extensions
parentb17ed65276869ccc00418749a916d8dd5d8f34b1 (diff)
downloadnautilus-03e13fee9bc5fe18f0068842651a78d56913c52d.tar.gz
Prep for xalf feature. Add name of program to all code that
uses the launch_application_from_command function. * libnautilus-extensions/nautilus-program-chooser.c: (launch_mime_capplet): Pass the file name of the files and programs capplet when starting it up. (Is there a better name to use for this case?) * src/file-manager/fm-desktop-icon-view.c: (change_background_callback): Pass "Background" as the name when starting the Background capplet. * src/file-manager/fm-directory-view.c: (run_script_callback): Pass the file name of the script as the name when starting a script. (activate_callback): Pass the file name of an executable file when starting an executable file by opening it. * libnautilus-extensions/nautilus-program-choosing.h: * libnautilus-extensions/nautilus-program-choosing.c: (nautilus_launch_application): Pass the application name from the gnome-vfs MIME database when starting an application. (get_xalf_prefix): Placeholder for code to figure out the right set of parameters to pass to xalf. (nautilus_launch_application_from_command): Change to take a name for the application. It's ignored when xalf is not used, but used as the title when xalf is used.
Diffstat (limited to 'libnautilus-extensions')
-rw-r--r--libnautilus-extensions/nautilus-program-chooser.c4
-rw-r--r--libnautilus-extensions/nautilus-program-choosing.c30
-rw-r--r--libnautilus-extensions/nautilus-program-choosing.h3
3 files changed, 23 insertions, 14 deletions
diff --git a/libnautilus-extensions/nautilus-program-chooser.c b/libnautilus-extensions/nautilus-program-chooser.c
index ad514aa89..3323571e5 100644
--- a/libnautilus-extensions/nautilus-program-chooser.c
+++ b/libnautilus-extensions/nautilus-program-chooser.c
@@ -3,7 +3,7 @@
/* nautilus-program-chooser.c - implementation for window that lets user choose
a program from a list
- Copyright (C) 2000 Eazel, Inc.
+ Copyright (C) 2000, 2001 Eazel, Inc.
The Gnome Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
@@ -926,7 +926,7 @@ launch_mime_capplet (GtkWidget *button, gpointer callback_data)
command = g_strdup_printf ("%s %s", FILE_TYPES_CAPPLET_NAME, (char *)callback_data);
- nautilus_launch_application_from_command (command, NULL, FALSE);
+ nautilus_launch_application_from_command (FILE_TYPES_CAPPLET_NAME, command, NULL, FALSE);
g_free (command);
}
diff --git a/libnautilus-extensions/nautilus-program-choosing.c b/libnautilus-extensions/nautilus-program-choosing.c
index 43c9cf0ea..428c512de 100644
--- a/libnautilus-extensions/nautilus-program-choosing.c
+++ b/libnautilus-extensions/nautilus-program-choosing.c
@@ -584,13 +584,21 @@ nautilus_launch_application (GnomeVFSMimeApplication *application,
}
g_free (uri_scheme);
- nautilus_launch_application_from_command (application->command,
+ nautilus_launch_application_from_command (application->name,
+ application->command,
parameter,
application->requires_terminal);
g_free (parameter);
}
+static char *
+get_xalf_prefix (const char *name)
+{
+ /* FIXME bugzilla.eazel.com 7830: Add xalf support. */
+ return g_strdup ("");
+}
+
/**
* nautilus_launch_application_from_command:
*
@@ -602,20 +610,16 @@ nautilus_launch_application (GnomeVFSMimeApplication *application,
* @parameter: Passed as a parameter to the application as is.
*/
void
-nautilus_launch_application_from_command (const char *command_string,
+nautilus_launch_application_from_command (const char *name,
+ const char *command_string,
const char *parameter,
- gboolean use_terminal)
+ gboolean use_terminal)
{
char *full_command;
char *quoted_parameter;
char *quoted_full_command;
char *final_command;
-
- /* FIXME bugzilla.eazel.com 7830: This needs to support things
- * like the "xalf" hack. Perhaps the best way to do that is
- * to use gnome_desktop_entry_launch_with_args instead of
- * calling system or eel_gnome_open_terminal.
- */
+ char *xalf_prefix;
if (parameter != NULL) {
quoted_parameter = eel_shell_quote (parameter);
@@ -625,16 +629,20 @@ nautilus_launch_application_from_command (const char *command_string,
full_command = g_strdup (command_string);
}
+ xalf_prefix = get_xalf_prefix (name);
+
if (use_terminal) {
quoted_full_command = eel_shell_quote (full_command);
- final_command = g_strconcat ("/bin/sh -c ", quoted_full_command, NULL);
+ final_command = g_strconcat (xalf_prefix, "/bin/sh -c ",
+ quoted_full_command, NULL);
eel_gnome_open_terminal (final_command);
g_free (quoted_full_command);
} else {
- final_command = g_strconcat (full_command, " &", NULL);
+ final_command = g_strconcat (xalf_prefix, full_command, " &", NULL);
system (final_command);
}
g_free (final_command);
g_free (full_command);
+ g_free (xalf_prefix);
}
diff --git a/libnautilus-extensions/nautilus-program-choosing.h b/libnautilus-extensions/nautilus-program-choosing.h
index 8d7c07904..e3c374fc2 100644
--- a/libnautilus-extensions/nautilus-program-choosing.h
+++ b/libnautilus-extensions/nautilus-program-choosing.h
@@ -53,7 +53,8 @@ void nautilus_cancel_choose_component_for_file (NautilusFile
void nautilus_launch_application (GnomeVFSMimeApplication *application,
NautilusFile *file,
GtkWindow *parent_window);
-void nautilus_launch_application_from_command (const char *command_string,
+void nautilus_launch_application_from_command (const char *name,
+ const char *command_string,
const char *parameter,
gboolean use_terminal);