[Xfce4-commits] <xfdesktop:master> Use get_folder_actions for clicks on the desktop itself

Eric Koegel noreply at xfce.org
Sun Jan 5 19:50:01 CET 2014


Updating branch refs/heads/master
         to c4782e358f100f33c665e67d47425f77c9655ec4 (commit)
       from 1028f607551254cca5db4951e9e52d4bb4d09c6d (commit)

commit c4782e358f100f33c665e67d47425f77c9655ec4
Author: Eric Koegel <eric.koegel at gmail.com>
Date:   Sun Jan 5 21:47:39 2014 +0300

    Use get_folder_actions for clicks on the desktop itself
    
    Call thunarx_menu_provider_get_folder_actions when the menu is
    popped up and no icons are selected. This prevents showing some
    thunar actions that make little sense in that context.

 src/xfdesktop-file-icon-manager.c |   27 +++++++++++++++++++--------
 1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/src/xfdesktop-file-icon-manager.c b/src/xfdesktop-file-icon-manager.c
index 1b424d9..857329a 100644
--- a/src/xfdesktop-file-icon-manager.c
+++ b/src/xfdesktop-file-icon-manager.c
@@ -1620,14 +1620,25 @@ xfdesktop_file_icon_manager_populate_context_menu(XfceDesktop *desktop,
             GList *menu_actions = NULL;
             ThunarxMenuProvider *provider;
 
-            /* thunar file specific actions (allows them to operate on folders
-             * as well) */
-            for(l = fmanager->priv->thunarx_menu_providers; l; l = l->next) {
-                provider = THUNARX_MENU_PROVIDER(l->data);
-                menu_actions = g_list_concat(menu_actions,
-                                             thunarx_menu_provider_get_file_actions(provider,
-                                                                                    toplevel,
-                                                                                    selected));
+            if(selected->data == fmanager->priv->desktop_icon) {
+                /* click on the desktop itself, only show folder actions */
+                for(l = fmanager->priv->thunarx_menu_providers; l; l = l->next) {
+                    provider = THUNARX_MENU_PROVIDER(l->data);
+                    menu_actions = g_list_concat(menu_actions,
+                                                 thunarx_menu_provider_get_folder_actions(provider,
+                                                                                          toplevel,
+                                                                                          THUNARX_FILE_INFO(file_icon)));
+                }
+            } else {
+                /* thunar file specific actions (allows them to operate on folders
+                 * that are on the desktop as well) */
+                for(l = fmanager->priv->thunarx_menu_providers; l; l = l->next) {
+                    provider = THUNARX_MENU_PROVIDER(l->data);
+                    menu_actions = g_list_concat(menu_actions,
+                                                 thunarx_menu_provider_get_file_actions(provider,
+                                                                                        toplevel,
+                                                                                        selected));
+                }
             }
 
             if(menu_actions) {


More information about the Xfce4-commits mailing list