Hello community, here is the log from the commit of package cinnamon-menus for openSUSE:Factory checked in at 2017-11-10 14:55:46 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/cinnamon-menus (Old) and /work/SRC/openSUSE:Factory/.cinnamon-menus.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "cinnamon-menus" Fri Nov 10 14:55:46 2017 rev:7 rq:538167 version:3.6.0 Changes: -------- --- /work/SRC/openSUSE:Factory/cinnamon-menus/cinnamon-menus.changes 2017-05-27 13:13:01.448809789 +0200 +++ /work/SRC/openSUSE:Factory/.cinnamon-menus.new/cinnamon-menus.changes 2017-11-10 14:55:51.639413156 +0100 @@ -1,0 +2,12 @@ +Sat Oct 28 19:57:36 UTC 2017 - [email protected] + +- Update to version 3.6.0: + * Memory leak fixes. + * entry-directories: Fix unref. + * entry-directories: Don't modify a list while iterating it. + * entry-directories: Protect event handling for directories. + * libmenu: Remove support for legacy-dirs. + * entry-directories: Only log about invalidations if it was + handled. + +------------------------------------------------------------------- Old: ---- cinnamon-menus-3.4.0.tar.gz New: ---- cinnamon-menus-3.6.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ cinnamon-menus.spec ++++++ --- /var/tmp/diff_new_pack.1Ek0N7/_old 2017-11-10 14:55:52.655376410 +0100 +++ /var/tmp/diff_new_pack.1Ek0N7/_new 2017-11-10 14:55:52.659376266 +0100 @@ -20,7 +20,7 @@ %define soname libcinnamon-menu-3 %define sover 0 Name: cinnamon-menus -Version: 3.4.0 +Version: 3.6.0 Release: 0 Summary: A menu system for the Cinnamon Desktop License: LGPL-2.1+ @@ -103,19 +103,16 @@ %postun -n %{soname}-%{sover} -p /sbin/ldconfig %files -n %{soname}-%{sover} -%defattr(-,root,root) %doc AUTHORS COPYING* README debian/changelog %{_libdir}/%{soname}.so.%{sover}* %files -n %{soname}-devel -%defattr(-,root,root) %{_includedir}/%{name}-3.0/ %{_libdir}/%{soname}.so %{_libdir}/pkgconfig/libcinnamon-menu-3.0.pc %{_datadir}/gir-1.0/CMenu-3.0.gir %files -n %{typelib} -%defattr(-,root,root) %{_libdir}/girepository-1.0/CMenu-3.0.typelib %changelog ++++++ cinnamon-menus-3.4.0.tar.gz -> cinnamon-menus-3.6.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cinnamon-menus-3.4.0/.pc/03_kde-legacydirs.patch/layout/gnome-applications.menu new/cinnamon-menus-3.6.0/.pc/03_kde-legacydirs.patch/layout/gnome-applications.menu --- old/cinnamon-menus-3.4.0/.pc/03_kde-legacydirs.patch/layout/gnome-applications.menu 2017-05-03 12:46:40.000000000 +0200 +++ new/cinnamon-menus-3.6.0/.pc/03_kde-legacydirs.patch/layout/gnome-applications.menu 2017-10-23 14:21:06.000000000 +0200 @@ -6,11 +6,6 @@ <Name>Applications</Name> <Directory>X-GNOME-Menu-Applications.directory</Directory> - <!-- Scan legacy dirs first, as later items take priority --> - <KDELegacyDirs/> - <LegacyDir>/etc/X11/applnk</LegacyDir> - <LegacyDir>/usr/share/gnome/apps</LegacyDir> - <!-- Read standard .directory and .desktop file locations --> <DefaultAppDirs/> <DefaultDirectoryDirs/> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cinnamon-menus-3.4.0/configure.ac new/cinnamon-menus-3.6.0/configure.ac --- old/cinnamon-menus-3.4.0/configure.ac 2017-05-03 12:46:40.000000000 +0200 +++ new/cinnamon-menus-3.6.0/configure.ac 2017-10-23 14:21:06.000000000 +0200 @@ -1,6 +1,6 @@ AC_PREREQ(2.62) -AC_INIT([cinnamon-menus], [3.4.0]) +AC_INIT([cinnamon-menus], [3.6.0]) AC_CONFIG_SRCDIR(libmenu/gmenu-tree.h) m4_ifdef([AX_IS_RELEASE], [AX_IS_RELEASE([always])]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cinnamon-menus-3.4.0/debian/changelog new/cinnamon-menus-3.6.0/debian/changelog --- old/cinnamon-menus-3.4.0/debian/changelog 2017-05-03 12:46:40.000000000 +0200 +++ new/cinnamon-menus-3.6.0/debian/changelog 2017-10-23 14:21:06.000000000 +0200 @@ -1,3 +1,22 @@ +cinnamon-menus (3.6.0) sylvia; urgency=medium + + [ Jasper St. Pierre ] + * Revert "Memory leak fixes" + * Memory leak fixes + * entry-directories: Fix unref + + [ Giovanni Campagna ] + * entry-directories: don't modify a list while iterating it + * entry-directories: protect event handling for directories + + [ Florian Müllner ] + * libmenu: Remove support for legacy-dirs + + [ Jasper St. Pierre ] + * entry-directories: Only log about invalidations if it was handled + + -- Clement Lefebvre <[email protected]> Mon, 23 Oct 2017 13:20:27 +0100 + cinnamon-menus (3.4.0) sonya; urgency=medium [ leigh123linux ] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cinnamon-menus-3.4.0/libmenu/desktop-entries.c new/cinnamon-menus-3.6.0/libmenu/desktop-entries.c --- old/cinnamon-menus-3.4.0/libmenu/desktop-entries.c 2017-05-03 12:46:40.000000000 +0200 +++ new/cinnamon-menus-3.6.0/libmenu/desktop-entries.c 2017-10-23 14:21:06.000000000 +0200 @@ -446,7 +446,7 @@ g_return_val_if_fail (entry != NULL, NULL); g_return_val_if_fail (entry->refcount > 0, NULL); - g_atomic_int_inc (&entry->refcount); + entry->refcount += 1; return entry; } @@ -680,43 +680,6 @@ return FALSE; } -void -desktop_entry_add_legacy_category (DesktopEntry *entry) -{ - GQuark *categories; - int i; - DesktopEntryDesktop *desktop_entry; - - g_return_if_fail (entry->type == DESKTOP_ENTRY_DESKTOP); - - desktop_entry = (DesktopEntryDesktop*) entry; - - menu_verbose ("Adding Legacy category to \"%s\"\n", - entry->basename); - - if (desktop_entry->categories != NULL) - { - i = 0; - for (; desktop_entry->categories[i]; i++); - - categories = g_new0 (GQuark, i + 2); - - i = 0; - for (; desktop_entry->categories[i]; i++) - categories[i] = desktop_entry->categories[i]; - } - else - { - categories = g_new0 (GQuark, 2); - i = 0; - } - - categories[i] = g_quark_from_string ("Legacy"); - - g_free (desktop_entry->categories); - desktop_entry->categories = categories; -} - /* * Entry sets */ @@ -740,7 +703,7 @@ g_return_val_if_fail (set != NULL, NULL); g_return_val_if_fail (set->refcount > 0, NULL); - g_atomic_int_inc (&set->refcount); + set->refcount += 1; return set; } @@ -748,13 +711,11 @@ void desktop_entry_set_unref (DesktopEntrySet *set) { - gboolean is_zero; - g_return_if_fail (set != NULL); g_return_if_fail (set->refcount > 0); - is_zero = g_atomic_int_dec_and_test (&set->refcount); - if (is_zero) + set->refcount -= 1; + if (set->refcount == 0) { menu_verbose (" Deleting entry set %p\n", set); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cinnamon-menus-3.4.0/libmenu/desktop-entries.h new/cinnamon-menus-3.6.0/libmenu/desktop-entries.h --- old/cinnamon-menus-3.4.0/libmenu/desktop-entries.h 2017-05-03 12:46:40.000000000 +0200 +++ new/cinnamon-menus-3.6.0/libmenu/desktop-entries.h 2017-10-23 14:21:06.000000000 +0200 @@ -65,8 +65,6 @@ gboolean desktop_entry_has_category (DesktopEntry *entry, const char *category); -void desktop_entry_add_legacy_category (DesktopEntry *src); - typedef struct DesktopEntrySet DesktopEntrySet; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cinnamon-menus-3.4.0/libmenu/entry-directories.c new/cinnamon-menus-3.6.0/libmenu/entry-directories.c --- old/cinnamon-menus-3.4.0/libmenu/entry-directories.c 2017-05-03 12:46:40.000000000 +0200 +++ new/cinnamon-menus-3.6.0/libmenu/entry-directories.c 2017-10-23 14:21:06.000000000 +0200 @@ -36,16 +36,14 @@ struct EntryDirectory { CachedDir *dir; - char *legacy_prefix; guint entry_type : 2; - guint is_legacy : 1; - volatile gint refcount; + guint refcount : 24; }; struct EntryDirectoryList { - volatile int refcount; + int refcount; int length; GList *dirs; }; @@ -65,10 +63,10 @@ guint have_read_entries : 1; guint deleted : 1; + guint references; + GFunc notify; gpointer notify_data; - - volatile gint references; }; struct CachedDirMonitor @@ -84,6 +82,7 @@ static gboolean cached_dir_load_entries_recursive (CachedDir *dir, const char *dirname); static void cached_dir_unref (CachedDir *dir); +static void cached_dir_unref_noparent (CachedDir *dir); static CachedDir * cached_dir_add_subdir (CachedDir *dir, const char *basename, const char *path); @@ -157,7 +156,7 @@ dir->entries = NULL; g_slist_foreach (dir->subdirs, - (GFunc) cached_dir_unref, + (GFunc) cached_dir_unref_noparent, NULL); g_slist_free (dir->subdirs); dir->subdirs = NULL; @@ -172,18 +171,14 @@ static CachedDir * cached_dir_ref (CachedDir *dir) { - g_atomic_int_inc (&dir->references); - + dir->references++; return dir; } static void cached_dir_unref (CachedDir *dir) { - gboolean is_zero; - - is_zero = g_atomic_int_dec_and_test (&dir->references); - if (is_zero) + if (--dir->references == 0) { CachedDir *parent; @@ -199,6 +194,18 @@ } } +static void +cached_dir_unref_noparent (CachedDir *dir) +{ + if (--dir->references == 0) + { + if (dir->notify) + dir->notify (dir, dir->notify_data); + + cached_dir_free (dir); + } +} + static inline CachedDir * find_subdir (CachedDir *dir, const char *subdir) @@ -228,13 +235,8 @@ tmp = dir->entries; while (tmp != NULL) { - const char *entry_basename; - - entry_basename = desktop_entry_get_basename (tmp->data); - if (strcmp (entry_basename, basename) == 0) - { - return tmp->data; - } + if (strcmp (desktop_entry_get_basename (tmp->data), basename) == 0) + return tmp->data; tmp = tmp->next; } @@ -348,9 +350,7 @@ tmp = dir->entries; while (tmp != NULL) { - const char *entry_basename; - entry_basename = desktop_entry_get_basename (tmp->data); - if (strcmp (entry_basename, basename) == 0) + if (strcmp (desktop_entry_get_basename (tmp->data), basename) == 0) { if (!desktop_entry_reload (tmp->data)) { @@ -375,10 +375,7 @@ tmp = dir->entries; while (tmp != NULL) { - const char *entry_basename; - entry_basename = desktop_entry_get_basename (tmp->data); - - if (strcmp (entry_basename, basename) == 0) + if (strcmp (desktop_entry_get_basename (tmp->data), basename) == 0) { desktop_entry_unref (tmp->data); dir->entries = g_slist_delete_link (dir->entries, tmp); @@ -434,11 +431,8 @@ { subdir->deleted = TRUE; - if (subdir->references == 0) - { - cached_dir_unref (subdir); - dir->subdirs = g_slist_remove (dir->subdirs, subdir); - } + cached_dir_unref (subdir); + dir->subdirs = g_slist_remove (dir->subdirs, subdir); return TRUE; } @@ -544,16 +538,11 @@ char *basename; char *dirname; - menu_verbose ("'%s' notified of '%s' %s - invalidating cache\n", - dir->name, - path, - event == MENU_MONITOR_EVENT_CREATED ? ("created") : - event == MENU_MONITOR_EVENT_DELETED ? ("deleted") : ("changed")); - dirname = g_path_get_dirname (path); basename = g_path_get_basename (path); dir = cached_dir_lookup (dirname); + cached_dir_add_reference (dir); if (g_str_has_suffix (basename, ".desktop") || g_str_has_suffix (basename, ".directory")) @@ -652,6 +641,12 @@ if (handled) { + menu_verbose ("'%s' notified of '%s' %s - invalidating cache\n", + dir->name, + path, + event == MENU_MONITOR_EVENT_CREATED ? ("created") : + event == MENU_MONITOR_EVENT_DELETED ? ("deleted") : ("changed")); + /* CHANGED events don't change the set of desktop entries, unless it's the mimeinfo.cache file changing */ if (retry_changes || (event == MENU_MONITOR_EVENT_CREATED || event == MENU_MONITOR_EVENT_DELETED)) { @@ -660,6 +655,8 @@ cached_dir_queue_monitor_event (dir); } + + cached_dir_remove_reference (dir); } static void @@ -830,18 +827,14 @@ * Entry directories */ -static EntryDirectory * -entry_directory_new_full (DesktopEntryType entry_type, - const char *path, - gboolean is_legacy, - const char *legacy_prefix) +EntryDirectory * +entry_directory_new (DesktopEntryType entry_type, + const char *path) { EntryDirectory *ed; char *canonical; - menu_verbose ("Loading entry directory \"%s\" (legacy %s)\n", - path, - is_legacy ? "<yes>" : "<no>"); + menu_verbose ("Loading entry directory \"%s\"\n", path); canonical = menu_canonicalize_file_name (path, FALSE); if (canonical == NULL) @@ -859,9 +852,7 @@ cached_dir_add_reference (ed->dir); cached_dir_load_entries_recursive (ed->dir, canonical); - ed->legacy_prefix = g_strdup (legacy_prefix); ed->entry_type = entry_type; - ed->is_legacy = is_legacy != FALSE; ed->refcount = 1; g_free (canonical); @@ -870,27 +861,12 @@ } EntryDirectory * -entry_directory_new (DesktopEntryType entry_type, - const char *path) -{ - return entry_directory_new_full (entry_type, path, FALSE, NULL); -} - -EntryDirectory * -entry_directory_new_legacy (DesktopEntryType entry_type, - const char *path, - const char *legacy_prefix) -{ - return entry_directory_new_full (entry_type, path, TRUE, legacy_prefix); -} - -EntryDirectory * entry_directory_ref (EntryDirectory *ed) { g_return_val_if_fail (ed != NULL, NULL); g_return_val_if_fail (ed->refcount > 0, NULL); - g_atomic_int_inc (&ed->refcount); + ed->refcount++; return ed; } @@ -898,22 +874,15 @@ void entry_directory_unref (EntryDirectory *ed) { - gboolean is_zero; - g_return_if_fail (ed != NULL); g_return_if_fail (ed->refcount > 0); - is_zero = g_atomic_int_dec_and_test (&ed->refcount); - if (is_zero) + if (--ed->refcount == 0) { cached_dir_remove_reference (ed->dir); ed->dir = NULL; ed->entry_type = DESKTOP_ENTRY_INVALID; - ed->is_legacy = FALSE; - - g_free (ed->legacy_prefix); - ed->legacy_prefix = NULL; g_free (ed); } @@ -962,26 +931,7 @@ if (entry_type == DESKTOP_ENTRY_DESKTOP) { - if (!ed->is_legacy) - { - retval = g_strdelimit (g_strdup (relative_path), "/", '-'); - } - else - { - char *basename; - - basename = g_path_get_basename (relative_path); - - if (ed->legacy_prefix) - { - retval = g_strjoin ("-", ed->legacy_prefix, basename, NULL); - g_free (basename); - } - else - { - retval = basename; - } - } + retval = g_strdelimit (g_strdup (relative_path), "/", '-'); } else { @@ -1020,12 +970,11 @@ if (desktop_entry_get_type (entry) == ed->entry_type) { - gboolean ret; - char *file_id; - const char *basename; + gboolean ret; + char *file_id; - basename = desktop_entry_get_basename (entry); - g_string_append (relative_path, basename); + g_string_append (relative_path, + desktop_entry_get_basename (entry)); file_id = get_desktop_file_id_from_path (ed, ed->entry_type, @@ -1105,7 +1054,7 @@ DesktopEntry *entry = tmp->data; const char *basename; - basename = desktop_entry_get_path (entry); + basename = desktop_entry_get_basename (entry); if (desktop_entries && desktop_entry_get_type (entry) == DESKTOP_ENTRY_DESKTOP) @@ -1178,7 +1127,7 @@ g_return_val_if_fail (list != NULL, NULL); g_return_val_if_fail (list->refcount > 0, NULL); - g_atomic_int_inc (&list->refcount); + list->refcount += 1; return list; } @@ -1186,13 +1135,11 @@ void entry_directory_list_unref (EntryDirectoryList *list) { - gboolean is_zero; - g_return_if_fail (list != NULL); g_return_if_fail (list->refcount > 0); - is_zero = g_atomic_int_dec_and_test (&list->refcount); - if (is_zero) + list->refcount -= 1; + if (list->refcount == 0) { g_list_foreach (list->dirs, (GFunc) entry_directory_unref, NULL); g_list_free (list->dirs); @@ -1292,15 +1239,7 @@ DesktopEntrySet *set, gpointer user_data) { - if (ed->is_legacy && !desktop_entry_has_categories (entry)) - { - entry = desktop_entry_copy (entry); - desktop_entry_add_legacy_category (entry); - } - else - { - entry = desktop_entry_ref (entry); - } + entry = desktop_entry_ref (entry); desktop_entry_set_add_entry (set, entry, file_id); desktop_entry_unref (entry); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cinnamon-menus-3.4.0/libmenu/entry-directories.h new/cinnamon-menus-3.6.0/libmenu/entry-directories.h --- old/cinnamon-menus-3.4.0/libmenu/entry-directories.h 2017-05-03 12:46:40.000000000 +0200 +++ new/cinnamon-menus-3.6.0/libmenu/entry-directories.h 2017-10-23 14:21:06.000000000 +0200 @@ -32,9 +32,6 @@ EntryDirectory *entry_directory_new (DesktopEntryType entry_type, const char *path); -EntryDirectory *entry_directory_new_legacy (DesktopEntryType entry_type, - const char *path, - const char *legacy_prefix); EntryDirectory *entry_directory_ref (EntryDirectory *ed); void entry_directory_unref (EntryDirectory *ed); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cinnamon-menus-3.4.0/libmenu/gmenu-tree.c new/cinnamon-menus-3.6.0/libmenu/gmenu-tree.c --- old/cinnamon-menus-3.4.0/libmenu/gmenu-tree.c 2017-05-03 12:46:40.000000000 +0200 +++ new/cinnamon-menus-3.6.0/libmenu/gmenu-tree.c 2017-10-23 14:21:06.000000000 +0200 @@ -1255,12 +1255,8 @@ append_directory_path (directory, path); if (entry != NULL) - { - const char *basename; - - basename = desktop_entry_get_basename (entry->desktop_entry); - g_string_append (path, basename); - } + g_string_append (path, + desktop_entry_get_basename (entry->desktop_entry)); return g_string_free (path, FALSE); } @@ -1290,7 +1286,7 @@ const char * gmenu_tree_entry_get_desktop_file_id (GMenuTreeEntry *entry) { - g_return_val_if_fail (entry != NULL, FALSE); + g_return_val_if_fail (entry != NULL, NULL); return entry->desktop_file_id; } @@ -2360,250 +2356,6 @@ } static void -add_filename_include (const char *desktop_file_id, - DesktopEntry *entry, - MenuLayoutNode *include) -{ - if (!desktop_entry_has_categories (entry)) - { - MenuLayoutNode *node; - - node = menu_layout_node_new (MENU_LAYOUT_NODE_FILENAME); - menu_layout_node_set_content (node, desktop_file_id); - - menu_layout_node_append_child (include, node); - menu_layout_node_unref (node); - } -} - -static void -is_dot_directory (const char *basename, - DesktopEntry *entry, - gboolean *has_dot_directory) -{ - if (!strcmp (basename, ".directory")) - *has_dot_directory = TRUE; -} - -static gboolean -add_menu_for_legacy_dir (MenuLayoutNode *parent, - const char *legacy_dir, - const char *relative_path, - const char *legacy_prefix, - const char *menu_name) -{ - EntryDirectory *ed; - DesktopEntrySet *desktop_entries; - DesktopEntrySet *directory_entries; - GSList *subdirs; - gboolean menu_added; - gboolean has_dot_directory; - - ed = entry_directory_new_legacy (DESKTOP_ENTRY_INVALID, legacy_dir, legacy_prefix); - if (!ed) - return FALSE; - - subdirs = NULL; - desktop_entries = desktop_entry_set_new (); - directory_entries = desktop_entry_set_new (); - - entry_directory_get_flat_contents (ed, - desktop_entries, - directory_entries, - &subdirs); - entry_directory_unref (ed); - - has_dot_directory = FALSE; - desktop_entry_set_foreach (directory_entries, - (DesktopEntrySetForeachFunc) is_dot_directory, - &has_dot_directory); - desktop_entry_set_unref (directory_entries); - - menu_added = FALSE; - if (desktop_entry_set_get_count (desktop_entries) > 0 || subdirs) - { - MenuLayoutNode *menu; - MenuLayoutNode *node; - GString *subdir_path; - GString *subdir_relative; - GSList *tmp; - int legacy_dir_len; - int relative_path_len; - - menu = menu_layout_node_new (MENU_LAYOUT_NODE_MENU); - menu_layout_node_append_child (parent, menu); - - menu_added = TRUE; - - g_assert (menu_name != NULL); - - node = menu_layout_node_new (MENU_LAYOUT_NODE_NAME); - menu_layout_node_set_content (node, menu_name); - menu_layout_node_append_child (menu, node); - menu_layout_node_unref (node); - - if (has_dot_directory) - { - node = menu_layout_node_new (MENU_LAYOUT_NODE_DIRECTORY); - if (relative_path != NULL) - { - char *directory_entry_path; - - directory_entry_path = g_strdup_printf ("%s/.directory", relative_path); - menu_layout_node_set_content (node, directory_entry_path); - g_free (directory_entry_path); - } - else - { - menu_layout_node_set_content (node, ".directory"); - } - menu_layout_node_append_child (menu, node); - menu_layout_node_unref (node); - } - - if (desktop_entry_set_get_count (desktop_entries) > 0) - { - MenuLayoutNode *include; - - include = menu_layout_node_new (MENU_LAYOUT_NODE_INCLUDE); - menu_layout_node_append_child (menu, include); - - desktop_entry_set_foreach (desktop_entries, - (DesktopEntrySetForeachFunc) add_filename_include, - include); - - menu_layout_node_unref (include); - } - - subdir_path = g_string_new (legacy_dir); - legacy_dir_len = strlen (legacy_dir); - - subdir_relative = g_string_new (relative_path); - relative_path_len = relative_path ? strlen (relative_path) : 0; - - tmp = subdirs; - while (tmp != NULL) - { - const char *subdir = tmp->data; - - g_string_append_c (subdir_path, G_DIR_SEPARATOR); - g_string_append (subdir_path, subdir); - - if (relative_path_len) - { - g_string_append_c (subdir_relative, G_DIR_SEPARATOR); - } - g_string_append (subdir_relative, subdir); - - add_menu_for_legacy_dir (menu, - subdir_path->str, - subdir_relative->str, - legacy_prefix, - subdir); - - g_string_truncate (subdir_relative, relative_path_len); - g_string_truncate (subdir_path, legacy_dir_len); - - tmp = tmp->next; - } - - g_string_free (subdir_path, TRUE); - g_string_free (subdir_relative, TRUE); - - menu_layout_node_unref (menu); - } - - desktop_entry_set_unref (desktop_entries); - - g_slist_foreach (subdirs, (GFunc) g_free, NULL); - g_slist_free (subdirs); - - return menu_added; -} - -static void -resolve_legacy_dir (GMenuTree *tree, - GHashTable *loaded_menu_files, - MenuLayoutNode *legacy) -{ - MenuLayoutNode *to_merge; - MenuLayoutNode *menu; - - to_merge = menu_layout_node_new (MENU_LAYOUT_NODE_ROOT); - - menu = menu_layout_node_get_parent (legacy); - g_assert (menu_layout_node_get_type (menu) == MENU_LAYOUT_NODE_MENU); - - if (add_menu_for_legacy_dir (to_merge, - menu_layout_node_get_content (legacy), - NULL, - menu_layout_node_legacy_dir_get_prefix (legacy), - menu_layout_node_menu_get_name (menu))) - { - merge_resolved_children (tree, loaded_menu_files, legacy, to_merge); - } - - menu_layout_node_unref (to_merge); -} - -static MenuLayoutNode * -add_legacy_dir (GMenuTree *tree, - GHashTable *loaded_menu_files, - MenuLayoutNode *before, - const char *data_dir) -{ - MenuLayoutNode *legacy; - char *dirname; - - dirname = g_build_filename (data_dir, "applnk", NULL); - - legacy = menu_layout_node_new (MENU_LAYOUT_NODE_LEGACY_DIR); - menu_layout_node_set_content (legacy, dirname); - menu_layout_node_legacy_dir_set_prefix (legacy, "kde"); - menu_layout_node_insert_before (before, legacy); - menu_layout_node_unref (before); - - menu_verbose ("Adding <LegacyDir>%s</LegacyDir> in <KDELegacyDirs/>\n", - dirname); - - resolve_legacy_dir (tree, loaded_menu_files, legacy); - - g_free (dirname); - - return legacy; -} - -static void -resolve_kde_legacy_dirs (GMenuTree *tree, - GHashTable *loaded_menu_files, - MenuLayoutNode *layout) -{ - MenuLayoutNode *before; - const char * const *system_data_dirs; - int i; - - system_data_dirs = g_get_system_data_dirs (); - - before = add_legacy_dir (tree, - loaded_menu_files, - menu_layout_node_ref (layout), - g_get_user_data_dir ()); - - i = 0; - while (system_data_dirs[i] != NULL) - { - before = add_legacy_dir (tree, loaded_menu_files, before, system_data_dirs[i]); - - ++i; - } - - menu_layout_node_unref (before); - - /* remove the now-replaced node */ - menu_layout_node_unlink (layout); -} - -static void gmenu_tree_resolve_files (GMenuTree *tree, GHashTable *loaded_menu_files, MenuLayoutNode *layout) @@ -2636,11 +2388,11 @@ break; case MENU_LAYOUT_NODE_LEGACY_DIR: - resolve_legacy_dir (tree, loaded_menu_files, layout); + menu_verbose ("Ignoring obsolete legacy dir"); break; case MENU_LAYOUT_NODE_KDE_LEGACY_DIRS: - resolve_kde_legacy_dirs (tree, loaded_menu_files, layout); + menu_verbose ("Ignoring obsolete KDE legacy dirs"); break; case MENU_LAYOUT_NODE_PASSTHROUGH: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cinnamon-menus-3.4.0/libmenu/menu-layout.c new/cinnamon-menus-3.6.0/libmenu/menu-layout.c --- old/cinnamon-menus-3.4.0/libmenu/menu-layout.c 2017-05-03 12:46:40.000000000 +0200 +++ new/cinnamon-menus-3.6.0/libmenu/menu-layout.c 2017-10-23 14:21:06.000000000 +0200 @@ -732,40 +732,6 @@ g_free (path); } - if (iter->type == MENU_LAYOUT_NODE_LEGACY_DIR) - { - MenuLayoutNodeLegacyDir *legacy = (MenuLayoutNodeLegacyDir *) iter; - char *path; - - path = menu_layout_node_get_content_as_path (iter); - - if (app_dirs != NULL) /* we're loading app dirs */ - { - ed = entry_directory_new_legacy (DESKTOP_ENTRY_DESKTOP, - path, - legacy->prefix); - if (ed != NULL) - { - entry_directory_list_prepend (app_dirs, ed); - entry_directory_unref (ed); - } - } - - if (dir_dirs != NULL) /* we're loading dir dirs */ - { - ed = entry_directory_new_legacy (DESKTOP_ENTRY_DIRECTORY, - path, - legacy->prefix); - if (ed != NULL) - { - entry_directory_list_prepend (dir_dirs, ed); - entry_directory_unref (ed); - } - } - - g_free (path); - } - iter = node_next (iter); }
