From 5685f3e82e51a310e9fca20bec45fd209f5f4cf9 Mon Sep 17 00:00:00 2001
From: Alexander Schwinn <alexxcons@xfce.org>
Date: Thu, 11 Mar 2021 14:29:31 +0100
Subject: [PATCH] thunar-tree-view: Dont show menu-item "properties" for
 unmounted devices

Showing it results in a wrong properties dialog (last folder)
---
 thunar/thunar-tree-view.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/thunar/thunar-tree-view.c b/thunar/thunar-tree-view.c
index 70f50520e..306c2b73f 100644
--- a/thunar/thunar-tree-view.c
+++ b/thunar/thunar-tree-view.c
@@ -1265,6 +1265,8 @@ thunar_tree_view_context_menu (ThunarTreeView *view,
                                                 | THUNAR_MENU_SECTION_RENAME
                                                 | THUNAR_MENU_SECTION_CUSTOM_ACTIONS);
         }
+      thunar_menu_add_sections (context_menu, THUNAR_MENU_SECTION_MOUNTABLE);
+      thunar_menu_add_sections (context_menu, THUNAR_MENU_SECTION_PROPERTIES);
     }
   else
     {
@@ -1273,11 +1275,11 @@ thunar_tree_view_context_menu (ThunarTreeView *view,
       thunar_launcher_append_menu_item (view->launcher, GTK_MENU_SHELL (context_menu), THUNAR_LAUNCHER_ACTION_OPEN_IN_TAB, TRUE);
       thunar_launcher_append_menu_item (view->launcher, GTK_MENU_SHELL (context_menu), THUNAR_LAUNCHER_ACTION_OPEN_IN_WINDOW, TRUE);
       xfce_gtk_menu_append_seperator (GTK_MENU_SHELL (context_menu));
+      thunar_menu_add_sections (context_menu, THUNAR_MENU_SECTION_MOUNTABLE);
+      if (thunar_device_is_mounted (device))
+        thunar_menu_add_sections (context_menu, THUNAR_MENU_SECTION_PROPERTIES);
     }
 
-  thunar_menu_add_sections (context_menu, THUNAR_MENU_SECTION_MOUNTABLE);
-  thunar_menu_add_sections (context_menu, THUNAR_MENU_SECTION_PROPERTIES);
-
   thunar_menu_hide_accel_labels (context_menu);
   gtk_widget_show_all (GTK_WIDGET (context_menu));
   window = gtk_widget_get_toplevel (GTK_WIDGET (view));
-- 
GitLab