[Xfce4-commits] [xfce/thunar] 01/01: Default application not respected with glib >= 2.41 (Bug #11212)

noreply at xfce.org noreply at xfce.org
Sat Nov 1 19:40:54 CET 2014


This is an automated email from the git hooks/post-receive script.

ochosi pushed a commit to branch master
in repository xfce/thunar.

commit 4b142af9dfe19f90ffe5529e2f099dc55298ecef
Author: Guido Berhoerster <gber at opensuse.org>
Date:   Tue Oct 14 18:20:47 2014 +0300

    Default application not respected with glib >= 2.41 (Bug #11212)
    
    Ensure thunar_file_list_get_applications() has the default
    application as the first element of the returned list.
    
    Signed-off-by: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
---
 thunar/thunar-file.c |   21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c
index c45cf81..0bfe166 100644
--- a/thunar/thunar-file.c
+++ b/thunar/thunar-file.c
@@ -3999,6 +3999,7 @@ thunar_file_list_get_applications (GList *file_list)
   GList       *next;
   GList       *ap;
   GList       *lp;
+  GAppInfo    *default_application;
   const gchar *previous_type = NULL;
   const gchar *current_type;
 
@@ -4017,7 +4018,25 @@ thunar_file_list_get_applications (GList *file_list)
 
       /* determine the list of applications that can open this file */
       if (G_UNLIKELY (current_type != NULL))
-        list = g_app_info_get_all_for_type (current_type);
+        {
+          list = g_app_info_get_all_for_type (current_type);
+
+          /* move any default application in front of the list */
+          default_application = g_app_info_get_default_for_type (current_type, FALSE);
+          if (G_LIKELY (default_application != NULL))
+            {
+              for (ap = list; ap != NULL; ap = ap->next)
+                {
+                  if (g_app_info_equal (ap->data, default_application))
+                    {
+                      g_object_unref (ap->data);
+                      list = g_list_delete_link (list, ap);
+                      break;
+                    }
+                }
+              list = g_list_prepend (list, default_application);
+            }
+        }
       else
         list = NULL;
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list