summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Soriano <csoriano@gnome.org>2016-04-04 10:50:29 +0200
committerCarlos Soriano <csoriano@gnome.org>2016-04-06 10:58:22 +0200
commit1918ccb28a1fa20097c8a3bdf4ca4dec897fd970 (patch)
tree2c4b4a6c09f6422448c71efe2fa6f74701590078
parent01ddff684d277d73377c3df12f807f23dd5f78ab (diff)
downloadnautilus-1918ccb28a1fa20097c8a3bdf4ca4dec897fd970.tar.gz
properties-window: use app info for "Open With" visibility
We were special casing desktop icon files to not show the Open With tab in the properties window. However, this is just equal to what we need to do to display Open With in the context menus, where we check if the app has a possible application handling it or not. Do the same here so we can remove another desktop dependency.
-rw-r--r--src/nautilus-properties-window.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index 85903e4ae..7ed2ef21d 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -4448,7 +4448,6 @@ static gboolean
is_a_special_file (NautilusFile *file)
{
if (file == NULL ||
- NAUTILUS_IS_DESKTOP_ICON_FILE (file) ||
nautilus_file_is_nautilus_link (file) ||
is_merged_trash_directory (file) ||
is_computer_directory (file)) {
@@ -4464,6 +4463,7 @@ should_show_open_with (NautilusPropertiesWindow *window)
char *mime_type;
char *extension;
gboolean hide;
+ g_autoptr (GAppInfo) app_info = NULL;
/* Don't show open with tab for desktop special icons (trash, etc)
* or desktop files. We don't get the open-with menu for these anyway.
@@ -4482,7 +4482,8 @@ should_show_open_with (NautilusPropertiesWindow *window)
for (l = window->details->target_files; l; l = l->next) {
file = NAUTILUS_FILE (l->data);
- if (nautilus_file_is_directory (file) || is_a_special_file (file)) {
+ app_info = nautilus_mime_get_default_application_for_file (file);
+ if (nautilus_file_is_directory (file) || !app_info || is_a_special_file (file)) {
return FALSE;
}
}
@@ -4493,7 +4494,8 @@ should_show_open_with (NautilusPropertiesWindow *window)
} else {
file = get_target_file (window);
- if (nautilus_file_is_directory (file) || is_a_special_file (file)) {
+ app_info = nautilus_mime_get_default_application_for_file (file);
+ if (nautilus_file_is_directory (file) || !app_info || is_a_special_file (file)) {
return FALSE;
}
}