Package list cinnamon-menus / 43dd740
Fix loading of desktop files in subdirectories This fixes loading of files in directories like '/usr/share/applications/kde4' in cases where the same desktop file appears in the non-sub directory specified in the menu layout Lars Mueller authored 9 months ago Michael Webster committed 9 months ago
2 changed file(s) with 14 addition(s) and 10 deletion(s). Raw diff Collapse all Expand all
766766 DesktopEntry *entry,
767767 const char *file_id)
768768 {
769 const char *file_id_to_use;
770769 menu_verbose (" Adding to set %p entry %s\n", set, file_id);
771770
772771 if (set->hash == NULL)
777776 (GDestroyNotify) desktop_entry_unref);
778777 }
779778
780 if (desktop_entry_get_type (entry) == DESKTOP_ENTRY_DESKTOP) {
781 file_id_to_use = desktop_entry_get_id (entry);
782 }
783 else {
784 file_id_to_use = file_id;
785 }
786779 g_hash_table_replace (set->hash,
787 g_strdup (file_id_to_use),
780 g_strdup (file_id),
788781 desktop_entry_ref (entry));
789782 }
790783
922922 static char *
923923 get_desktop_file_id_from_path (EntryDirectory *ed,
924924 DesktopEntryType entry_type,
925 const char *relative_path)
925 const char *relative_path,
926 DesktopEntry *entry)
926927 {
927928 char *retval;
928929
930931
931932 if (entry_type == DESKTOP_ENTRY_DESKTOP)
932933 {
934 GMenuDesktopAppInfo *appinfo;
935 appinfo = desktop_entry_get_app_info (entry);
933936 retval = g_strdelimit (g_strdup (relative_path), "/", '-');
937 if (gmenu_desktopappinfo_get_is_flatpak (appinfo))
938 {
939 char* tmp;
940 tmp = retval;
941 retval = g_strconcat (retval, GMENU_DESKTOPAPPINFO_FLATPAK_SUFFIX, NULL);
942 g_free (tmp);
943 }
934944 }
935945 else
936946 {
977987
978988 file_id = get_desktop_file_id_from_path (ed,
979989 ed->entry_type,
980 relative_path->str);
990 relative_path->str,
991 entry);
981992
982993 ret = func (ed, entry, file_id, set, user_data);
983994