[Xfce4-commits] <thunar:master> Hide NoDisplay applications in the File menu.

Nick Schermer noreply at xfce.org
Wed Sep 26 19:46:01 CEST 2012


Updating branch refs/heads/master
         to 9e73c836f4df979e7fa6bb1ccb6ed92c5ba1b73e (commit)
       from 723b0243e40ae8bcbb2ab832016927ccd8c3728e (commit)

commit 9e73c836f4df979e7fa6bb1ccb6ed92c5ba1b73e
Author: Nick Schermer <nick at xfce.org>
Date:   Wed Sep 26 18:29:13 2012 +0200

    Hide NoDisplay applications in the File menu.

 thunar/thunar-file.c |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c
index eb4406e..469a1b8 100644
--- a/thunar/thunar-file.c
+++ b/thunar/thunar-file.c
@@ -3591,7 +3591,11 @@ thunar_file_list_get_applications (GList *file_list)
         }
 
       /* determine the list of applications that can open this file */
-      list = current_type == NULL ? NULL : g_app_info_get_all_for_type (current_type);
+      if (G_UNLIKELY (current_type != NULL))
+        list = g_app_info_get_all_for_type (current_type);
+      else
+        list = NULL;
+
       if (G_UNLIKELY (applications == NULL))
         {
           /* first file, so just use the applications list */
@@ -3625,6 +3629,22 @@ thunar_file_list_get_applications (GList *file_list)
         break;
     }
 
+  /* remove hidden applications */
+  for (ap = applications; ap != NULL; ap = next)
+    {
+      /* grab a pointer on the next application */
+      next = ap->next;
+
+      if (!g_app_info_should_show (ap->data))
+        {
+          /* drop our reference on the application */
+          g_object_unref (G_OBJECT (ap->data));
+
+          /* drop this application from the list */
+          applications = g_list_delete_link (applications, ap);
+        }
+    }
+
   return applications;
 }
 


More information about the Xfce4-commits mailing list