summaryrefslogtreecommitdiff
path: root/libnautilus-private/nautilus-link.c
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2008-02-13 12:22:39 +0000
committerAlexander Larsson <alexl@src.gnome.org>2008-02-13 12:22:39 +0000
commit454b224ec78d740ae46673869f22ce1a7294c7db (patch)
tree7b229c9e8a2da61cf424de7b27d5c080b421ddd5 /libnautilus-private/nautilus-link.c
parent13b72557feb3128f8efdcec8cc9abc82479a0928 (diff)
downloadnautilus-454b224ec78d740ae46673869f22ce1a7294c7db.tar.gz
Add nautilus_file_is_launcher()
2008-02-13 Alexander Larsson <alexl@redhat.com> * libnautilus-private/nautilus-file.[ch]: * libnautilus-private/nautilus-file-private.h: Add nautilus_file_is_launcher() * libnautilus-private/nautilus-directory-async.c: * libnautilus-private/nautilus-dnd.c: * libnautilus-private/nautilus-link.[ch] * libnautilus-private/nautilus-mime-actions.c: * libnautilus-private/nautilus-program-choosing.[ch]: * src/file-manager/fm-directory-view.c: * src/file-manager/fm-tree-view.c: Remove weird desktop-file: and command: hacks, and replace with usage and implementation of nautilus_file_is_launcher(). This fixes some problems where the old desktop-file uri was interpreted as an actual file. svn path=/trunk/; revision=13734
Diffstat (limited to 'libnautilus-private/nautilus-link.c')
-rw-r--r--libnautilus-private/nautilus-link.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/libnautilus-private/nautilus-link.c b/libnautilus-private/nautilus-link.c
index 698dcba37..80db80b2b 100644
--- a/libnautilus-private/nautilus-link.c
+++ b/libnautilus-private/nautilus-link.c
@@ -298,7 +298,6 @@ nautilus_link_local_get_additional_text (const char *path)
static char *
nautilus_link_get_link_uri_from_desktop (GnomeDesktopItem *desktop_file)
{
- const char *launch_string;
const char *type;
char *retval;
@@ -309,15 +308,7 @@ nautilus_link_get_link_uri_from_desktop (GnomeDesktopItem *desktop_file)
return NULL;
}
- if (strcmp (type, "Application") == 0) {
- launch_string = gnome_desktop_item_get_string (desktop_file, "Exec");
- if (launch_string == NULL) {
- return NULL;
- }
-
- launch_string = gnome_desktop_item_get_location (desktop_file);
- retval = g_strconcat (NAUTILUS_DESKTOP_COMMAND_SPECIFIER, launch_string, NULL);
- } else if (strcmp (type, "URL") == 0) {
+ if (strcmp (type, "URL") == 0) {
/* Some old broken desktop files use this nonstandard feature, we need handle it though */
retval = g_strdup (gnome_desktop_item_get_string (desktop_file, "Exec"));
} else if ((strcmp (type, NAUTILUS_LINK_GENERIC_TAG) == 0) ||
@@ -405,9 +396,11 @@ nautilus_link_get_link_info_given_file_contents (const char *file_contents,
int link_file_size,
char **uri,
char **name,
- char **icon)
+ char **icon,
+ gboolean *is_launcher)
{
GnomeDesktopItem *desktop_file;
+ const char *type;
if (!is_link_data (file_contents, link_file_size)) {
return;
@@ -422,6 +415,14 @@ nautilus_link_get_link_info_given_file_contents (const char *file_contents,
*name = nautilus_link_get_link_name_from_desktop (desktop_file);
*icon = nautilus_link_get_link_icon_from_desktop (desktop_file);
+ *is_launcher = FALSE;
+ type = gnome_desktop_item_get_string (desktop_file, "Type");
+ if (type != NULL &&
+ strcmp (type, "Application") == 0 &&
+ gnome_desktop_item_get_string (desktop_file, "Exec") != NULL) {
+ *is_launcher = TRUE;
+ }
+
gnome_desktop_item_unref (desktop_file);
}