[nautilus/wip/csoriano/desktop-split: 47/53] properties-window: use app info for "Open With" visibility



commit 1918ccb28a1fa20097c8a3bdf4ca4dec897fd970
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 85903e4..7ed2ef2 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;
                }
        }


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