[Xfce4-commits] [xfce/xfdesktop] 02/02: Default application not respected with glib >= 2.41 (Bug #11306)

noreply at xfce.org noreply at xfce.org
Sun Apr 12 18:22:19 CEST 2015


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

eric pushed a commit to branch xfce-4.10
in repository xfce/xfdesktop.

commit 7489683bc369ab382961aff94ff3be0933a92e06
Author: Eric Koegel <eric.koegel at gmail.com>
Date:   Sun Nov 16 16:35:26 2014 +0300

    Default application not respected with glib >= 2.41 (Bug #11306)
    
    Ensure xfdesktop's right click menu has the default
    application as the first element of the returned list. This is
    just a copy of Thunar's patch adapted for xfdesktop. See:
    https://bugzilla.xfce.org/show_bug.cgi?id=11212 and
    http://git.xfce.org/xfce/thunar/commit/?id=4b142af9dfe19f90ffe5529e2f099dc55298ecef
    
    Signed-off-by: Eric Koegel <eric.koegel at gmail.com>
---
 src/xfdesktop-file-icon-manager.c |   21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/src/xfdesktop-file-icon-manager.c b/src/xfdesktop-file-icon-manager.c
index d491d4e..91c7c84 100644
--- a/src/xfdesktop-file-icon-manager.c
+++ b/src/xfdesktop-file-icon-manager.c
@@ -1475,7 +1475,26 @@ xfdesktop_file_icon_manager_populate_context_menu(XfceDesktop *desktop,
                 
                 app_infos = g_app_info_get_all_for_type(g_file_info_get_content_type(info));
                 if(app_infos) {
-                    GAppInfo *app_info = G_APP_INFO(app_infos->data);
+                    GAppInfo *app_info, *default_application;
+                    GList *ap;
+
+                    /* move any default application in front of the list */
+                    default_application = g_app_info_get_default_for_type (g_file_info_get_content_type(info), FALSE);
+                    if (G_LIKELY (default_application != NULL))
+                    {
+                        for (ap = app_infos; ap != NULL; ap = ap->next)
+                        {
+                            if (g_app_info_equal (ap->data, default_application))
+                            {
+                                g_object_unref (ap->data);
+                                app_infos = g_list_delete_link (app_infos, ap);
+                                break;
+                            }
+                        }
+                        app_infos = g_list_prepend (app_infos, default_application);
+                    }
+
+                    app_info = G_APP_INFO(app_infos->data);
                     
                     mi = xfdesktop_menu_item_from_app_info(fmanager, file_icon,
                                                            app_info, TRUE, TRUE);

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


More information about the Xfce4-commits mailing list