[nautilus] files-view: don't allow compress if no selection



commit 858dee7b7b0d13c727498e6da9506c4cded0bc56
Author: Carlos Soriano <csoriano gnome org>
Date:   Thu Sep 15 13:49:46 2016 +0200

    files-view: don't allow compress if no selection
    
    We weren't checking if there is some file selected to enable/disable
    the compress action, which was causing the context menu item be always
    displayed if we clicked an element that is not a file.
    As odd as it sounds, this happens when allow to expand folders in list
    view, since the "empty" element is selectable but not a file.
    To fix that, check whether we have a file selected or not.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=771469

 src/nautilus-files-view.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index d00c5ee..1d49845 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -7006,6 +7006,7 @@ real_update_actions_state (NautilusFilesView *view)
     gboolean can_link_from_copied_files;
     gboolean can_paste_files_into;
     gboolean can_extract_files;
+    gboolean can_compress_files;
     gboolean can_extract_here;
     gboolean item_opens_in_view;
     gboolean is_read_only;
@@ -7057,6 +7058,7 @@ real_update_actions_state (NautilusFilesView *view)
                             can_paste_into_file (NAUTILUS_FILE (selection->data)));
     can_extract_files = selection_count != 0 &&
                         can_extract_all (selection);
+    can_compress_files = selection_count != 0 && !can_extract_files;
     can_extract_here = nautilus_files_view_supports_extract_here (view);
     settings_show_delete_permanently = g_settings_get_boolean (nautilus_preferences,
                                                                NAUTILUS_PREFERENCES_SHOW_DELETE_PERMANENTLY);
@@ -7115,7 +7117,7 @@ real_update_actions_state (NautilusFilesView *view)
     action = g_action_map_lookup_action (G_ACTION_MAP (view_action_group),
                                          "compress");
     g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
-                                 !can_extract_files && can_create_files);
+                                 can_compress_files && can_create_files);
 
     action = g_action_map_lookup_action (G_ACTION_MAP (view_action_group),
                                          "open-item-location");


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