! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Replace hash table for application actions with a list
Status:
RESOLVED: FIXED
Severity:
enhancement

Comments

Description Stephan Haller editbugs 2017-10-26 09:37:21 CEST
Created attachment 7387 
Replace GHashTable with GList for application actions

Currently GarconMenuItem uses a hash table to manage the list of application actions. An application has to call garcon_menu_item_get_actions() to get a list of action name and then call garcon_menu_item_get_action() to get information about the action. The problem with garcon_menu_item_get_actions() to get the list of action names is that the order of action names is unpredictable and not the order as specified in the desktop file as g_hash_table_get_keys() is used to create this list. This is a problem when creating a menu for these application action as the order could not make sense.

To keep the order of action names the hash table was replace with a doubly-linked list (GList) and all application action related function were modified to maintain the GList.

To keep API stable the function modified will behave as before, e.g. the actions names are not duplicated (g_strdup) but their pointers are copied as-is to the list in garcon_menu_item_get_actions(). The callee still has to free the list with g_list_free() but keep the data in the list untouched, i.e. not calling g_list_free_full(list, g_free). Also the data in the list are modified in-place - see garcon_menu_item_set_action().

A patch is applied for review at this bug.
Comment 1 Eric Koegel editbugs 2017-12-05 08:35:30 CET
Thanks for the patch, pushed to master in:
https://git.xfce.org/xfce/garcon/commit/?id=8c14f977c06b531954b902ba9d593d22e1d77605

Bug #13951

Reported by:
Stephan Haller
Reported on: 2017-10-26
Last modified on: 2017-12-05

People

Assignee:
Jannis Pohlmann
CC List:
1 user

Version

Attachments

Additional information