[nautilus/wip/csoriano/destktop-split2] properties-window: use app info for "Open With" visibility



commit d269dd01e0b4730cfbd18ed3854d02a2365c148d
Author: Carlos Soriano <csoriano gnome org>
Date:   Mon Apr 4 10:50:29 2016 +0200

    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.

 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 5f60c1a..5b0a33a 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -4449,7 +4449,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)) {
@@ -4465,6 +4464,7 @@ should_show_open_with (NautilusPropertiesWindow *window)
        char *mime_type;
        char *extension;
        gboolean hide;
+       g_autoptr (GAppInfo) app_info;
 
        /* 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.
@@ -4483,7 +4483,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;
                        }
                }
@@ -4494,7 +4495,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;
                }
        }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]