Remove 'Open in terminal' from context menu on a non-local folder on the desktop.
authorAndriy Grytsenko <andrej@rep.kiev.ua>
Sat, 3 Dec 2016 00:20:02 +0000 (02:20 +0200)
committerAndriy Grytsenko <andrej@rep.kiev.ua>
Sat, 3 Dec 2016 00:20:02 +0000 (02:20 +0200)
NEWS
src/desktop.c

diff --git a/NEWS b/NEWS
index 957527b..d23deab 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,9 @@
     drive on the desktop, user might accidentally recursively remove its
     contents.
 
+* Removed 'Open in terminal' from context menu on folder on the desktop
+    that cannot be opened in terminal.
+
 
 Changes on 1.2.4 since 1.2.3:
 
index 5fc0e9b..9c0beeb 100644 (file)
@@ -2702,6 +2702,7 @@ static void fm_desktop_update_item_popup(FmFolderView* fv, GtkWindow* window,
     GList* sel_items, *l;
     GtkAction* act;
     gboolean all_fixed = TRUE, has_fixed = FALSE;
+    gboolean all_native = TRUE;
 #if FM_CHECK_VERSION(1, 2, 0)
     gboolean has_extra = FALSE, has_mount = FALSE;
 #endif
@@ -2714,6 +2715,8 @@ static void fm_desktop_update_item_popup(FmFolderView* fv, GtkWindow* window,
             has_fixed = TRUE;
         else
             all_fixed = FALSE;
+        if (!pcmanfm_can_open_path_in_terminal(fm_file_info_get_path(item->fi)))
+            all_native = FALSE;
 #if FM_CHECK_VERSION(1, 2, 0)
         if (item->is_special)
             has_extra = TRUE;
@@ -2751,6 +2754,10 @@ static void fm_desktop_update_item_popup(FmFolderView* fv, GtkWindow* window,
     }
 #endif
 
+    /* disable terminal for non-native folders */
+    if (!all_native)
+        gtk_action_set_visible(gtk_action_group_get_action(act_grp, "Term"), FALSE);
+
     /* merge desktop icon specific items */
     gtk_action_group_add_actions(act_grp, desktop_icon_actions,
                                  G_N_ELEMENTS(desktop_icon_actions), fv);