diff options
author | Carlos Soriano <csoriano@gnome.org> | 2016-04-04 10:50:29 +0200 |
---|---|---|
committer | Carlos Soriano <csoriano@gnome.org> | 2016-04-05 15:13:52 +0200 |
commit | 084f36571d8e543407064d61ce5fa4acc1b8c8db (patch) | |
tree | a615b59722ba9f48c65fded73354f7aa73e413e3 | |
parent | 0db14903ce5951de6e1f96c67be5a02e1308bffd (diff) | |
download | nautilus-084f36571d8e543407064d61ce5fa4acc1b8c8db.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.c | 8 |
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; } } |