diff options
author | Frank Worsley <fworsley@shaw.ca> | 2002-08-01 06:41:25 +0000 |
---|---|---|
committer | Frank Worsley <fworsley@src.gnome.org> | 2002-08-01 06:41:25 +0000 |
commit | 313f3b73c39309b7b342efeeb6cc79a29432cfed (patch) | |
tree | a2e927a111cb539f567926a8ea109637d283bc5a | |
parent | 389ce003e1581832c16aa23cb276acfdc2b81c34 (diff) | |
download | nautilus-313f3b73c39309b7b342efeeb6cc79a29432cfed.tar.gz |
be smarter about appending local paths or uris to command
2002-07-31 Frank Worsley <fworsley@shaw.ca>
* libnautilus-private/nautilus-program-choosing.c:
(nautilus_launch_desktop_file):
be smarter about appending local paths or uris to command
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | libnautilus-private/nautilus-program-choosing.c | 32 |
2 files changed, 26 insertions, 12 deletions
@@ -1,3 +1,9 @@ +2002-07-31 Frank Worsley <fworsley@shaw.ca> + + * libnautilus-private/nautilus-program-choosing.c: + (nautilus_launch_desktop_file): + be smarter about appending local paths or uris to command + 2002-07-31 Dave Camp <dave@ximian.com> * libnautilus-private/nautilus-icon-container.c: diff --git a/libnautilus-private/nautilus-program-choosing.c b/libnautilus-private/nautilus-program-choosing.c index 4267db394..d43ef76ea 100644 --- a/libnautilus-private/nautilus-program-choosing.c +++ b/libnautilus-private/nautilus-program-choosing.c @@ -639,6 +639,7 @@ nautilus_launch_desktop_file (const char *desktop_file_uri, { GError *error; GnomeDesktopItem *ditem; + GnomeDesktopItemLaunchFlags flags; const char *command_string; char *local_path, *message; const GList *p; @@ -681,23 +682,23 @@ nautilus_launch_desktop_file (const char *desktop_file_uri, return; } + /* count the number of uris with local paths */ + count = 0; + total = g_list_length ((GList *) parameter_uris); + for (p = parameter_uris; p != NULL; p = p->next) { + local_path = gnome_vfs_get_local_path_from_uri ((const char *) p->data); + if (local_path != NULL) { + g_free (local_path); + count++; + } + } + /* check if this app only supports local files */ command_string = gnome_desktop_item_get_string (ditem, GNOME_DESKTOP_ITEM_EXEC); if ((strstr (command_string, "%F") || strstr (command_string, "%f")) && !(strstr (command_string, "%U") || strstr (command_string, "%u")) && parameter_uris != NULL) { - /* count the number of uris with local paths */ - count = 0; - total = g_list_length ((GList *) parameter_uris); - for (p = parameter_uris; p != NULL; p = p->next) { - local_path = gnome_vfs_get_local_path_from_uri ((const char *) p->data); - if (local_path != NULL) { - g_free (local_path); - count++; - } - } - if (count == 0) { /* all files are non-local */ eel_show_error_dialog @@ -721,9 +722,16 @@ nautilus_launch_desktop_file (const char *desktop_file_uri, } } + /* we append local paths only if all parameters are local */ + if (count == total) { + flags = GNOME_DESKTOP_ITEM_LAUNCH_APPEND_PATHS; + } else { + flags = GNOME_DESKTOP_ITEM_LAUNCH_APPEND_URIS; + } + error = NULL; gnome_desktop_item_launch (ditem, (GList *) parameter_uris, - GNOME_DESKTOP_ITEM_LAUNCH_APPEND_URIS, + flags, &error); if (error != NULL) { |