Skip to content

thunar-179: split uca.xml into separate files

Chigozirim Chukwu requested to merge smac89/thunar:thunar-179 into master

Brief overview

The purpose of this PR is to allow us to be able to split out the monolithic uca.xml file (See #179). This is going to be part of possibly 2 more PR's whose aim is to provide a better structure to the way we handle user custom actions for thunar.

The next goal is #245 which will allow thunar to come out of the box bundled with a number of user custom actions, which the user should be able to toggle on or off as they see fit

Summary of changes:

  • There are now 5 locations where custom actions can be placed. The inspiration mostly came from this post:

    • /usr/share/Thunar/uca.d/*.xml: reserved for package managers distributing UCA's
    • /etc/xdg/Thunar/uca.xml: Kept for backwards compatibility
    • /etc/xdg/Thunar/uca.d/*.xml: Admin users
    • ~/.config/Thunar/uca.xml: Used to override any of the above by the user
    • ~/.config/Thunar/uca.d/*.xml: Any other user custom actions which can also be used to override any of the above

    The order is important because it also represents the order by which an existing custom action can be overridden (or eventually switched off completely: see #245)

  • In order to override an existing custom action, we use the name of the actions. Previously the way it was done was to copy all custom actions to ~/.config/Thunar/uca.xml and assign a unique id to each one. Since the goal is now to allow any amount of files containing custom actions, this approach won't work very well, so I opted for using the names.

  • The thunar-uca-model.c file has had some of its functionality split off into two more files:

    • thunar-uca-model-item.c: Takes care of anything to do with managing a single custom action. From updating the contents of the action to writing the action to a provided file.
    • thunar-uca-parser.c: This is where everything to do with reading a custom action file now lives
    • thunar-uca-model.c: This is the original file that contained all the above, but now it just serves as a driver, calling off to the others for doing most of its work.
  • Worthy mention: The uca editor and chooser also got a little improvement by means of providing a way of detecting if an action was actually modified or not so that they only save the action to the thunar-uca-model if a change actually occurred.

What user sees when adding a new action with an existing name

Edited by Chigozirim Chukwu

Merge request reports