File libfm-1.2.3-Fix-dropping-files-onto-applications.patch of Package libfm
From 819cdf17be19097a7276f15ed8eeebdf3f7a5188 Mon Sep 17 00:00:00 2001
From: Andriy Grytsenko <andrej@rep.kiev.ua>
Date: Thu, 14 May 2015 21:33:45 +0300
Subject: [PATCH] Fix dropping files onto applications shortcuts on the
desktop.
Those should be not "inode/x-shortcut" but "application/x-desktop" instead
and therefore handled as any other applications, i.e. allow drop.
---
diff --git a/src/base/fm-file-info.c b/src/base/fm-file-info.c
index fc3ca28..39b417e 100644
--- a/src/base/fm-file-info.c
+++ b/src/base/fm-file-info.c
@@ -3,7 +3,7 @@
*
* Copyright 2009 - 2012 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
* Copyright 2009 Juergen Hoetzel <juergen@archlinux.org>
- * Copyright 2012-2014 Andriy Grytsenko (LStranger) <andrej@rep.kiev.ua>
+ * Copyright 2012-2015 Andriy Grytsenko (LStranger) <andrej@rep.kiev.ua>
*
* This file is a part of the Libfm library.
*
@@ -289,12 +289,14 @@ gboolean _fm_file_info_set_from_native_file(FmFileInfo* fi, const char* path,
FmMimeType *new_mime_type = fm_mime_type_from_file_name(uri);
/* g_debug("got type %s for URL %s", fm_mime_type_get_type(new_mime_type), uri); */
- if (new_mime_type == _fm_mime_type_get_application_x_desktop() ||
- strcmp(fm_mime_type_get_type(new_mime_type),
+ if (strcmp(fm_mime_type_get_type(new_mime_type),
"application/octet-stream") == 0)
{
- /* either link to desktop entry or failed
- to determine, set to inode/x-shortcut */
+ /* NOTE: earlier we classified all links to
+ desktop entry as inode/x-shortcut too but
+ that would require a lot of special support
+ therefore we set to inode/x-shortcut only
+ those shortcuts that we fail to determine */
fm_mime_type_unref(new_mime_type);
new_mime_type = fm_mime_type_ref(_fm_mime_type_get_inode_x_shortcut());
}
diff --git a/src/gtk/fm-gtk-file-launcher.c b/src/gtk/fm-gtk-file-launcher.c
index d683895..5e7cde9 100644
--- a/src/gtk/fm-gtk-file-launcher.c
+++ b/src/gtk/fm-gtk-file-launcher.c
@@ -3,7 +3,7 @@
*
* Copyright 2010-2012 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
* Copyright 2010 Shae Smittle <starfall87@gmail.com>
- * Copyright 2012-2014 Andriy Grytsenko (LStranger) <andrej@rep.kiev.ua>
+ * Copyright 2012-2015 Andriy Grytsenko (LStranger) <andrej@rep.kiev.ua>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -346,7 +346,11 @@ gboolean fm_launch_desktop_entry_simple(GtkWindow* parent, GAppLaunchContext* ct
}
if(files) for(l = fm_path_list_peek_head_link(files); l; l = l->next)
uris = g_list_append(uris, fm_path_to_uri(FM_PATH(l->data)));
- entry_path = fm_path_to_str(path);
+ /* special handling for shortcuts */
+ if (fm_file_info_is_shortcut(entry))
+ entry_path = g_strdup(fm_file_info_get_target(entry));
+ else
+ entry_path = fm_path_to_str(path);
ret = fm_launch_desktop_entry(ctx, entry_path, uris, &launcher, &data);
g_list_foreach(uris, (GFunc)g_free, NULL);
g_list_free(uris);
--
2.1.4