Created attachment 2718 Emblem Patch file This is my first attempt at writing a patch for Thunar, and I'm also somewhat new to C, so please excuse any mistakes I may have made. I've written a patch that adds emblem support to thunarx master. Basically I started by adding a set_emblem method to the ThunarxFileInfoIface struct and then working from there. I also used some code from thunar-emblem-chooser.c to get it working right. The patch file is attached, as is a modified thunar-wallpaper extension that I've added Set/Remove menu items to for testing purposes. I'd appreciate any feedback on my work, and hopefully this will get accepted into the thunar master branch. Thanks, Adam Plumb
Created attachment 2719 Extension for testing emblem support To install, replace the thunar-wallpaper plugin folder with this one in the /plugins folder.
Did you test this with more than on emblem? It looks like thunar_file_info_set_emblem() overwrites existing emblems and replaces them with a single string.
(In reply to comment #2) > Did you test this with more than on emblem? It looks like > thunar_file_info_set_emblem() overwrites existing emblems and replaces them > with a single string. I figured it would be simpler for the extension writer to only have to deal with the one "set_emblem" method. But I can see the reasoning behind allowing one to work with multiple emblems and having more granularity, and also keeping an existing set of assigned emblems intact. I'll work on the patch to add this. BTW, is using the reserved[0-9] spaces in thunarx-file-info.h the correct way to add new methods to the ThunarxFileInfoIface interface? Also, Benedikt responded to my thunar mailing list email with a suggestion to have the following functions: thunarx_file_info_add_emblem(file_info, emblem_name) thunarx_file_info_remove_emblem(file_info, emblem_name) thunarx_file_info_remove_emblems(file_info) This seems reasonable to me. What do you think?
(In reply to comment #3) > BTW, is using the reserved[0-9] spaces in thunarx-file-info.h the correct way > to add new methods to the ThunarxFileInfoIface interface? Yeah, it is. The reserved members in interface structs exist for this purpose in particular. > Also, Benedikt responded to my thunar mailing list email with a suggestion > to have the following functions: > > thunarx_file_info_add_emblem(file_info, emblem_name) > thunarx_file_info_remove_emblem(file_info, emblem_name) > thunarx_file_info_remove_emblems(file_info) > > This seems reasonable to me. What do you think? Yeah, sounds good indeed.
Created attachment 2720 Patch file I've updated the patch as follows: - Changed the set_emblem function name to add_emblem - Added the remove_emblem and remove_emblems functions - Modified the add_emblem function so that it will not add a duplicate emblem How does this look? I will upload a new test extension as well that exercises the new functionality.
Created attachment 2721 Extension for testing emblem support Updated the extension to use the new add_emblem method as well as the remove_emblem and remove_emblems methods.
Can you give me some feedback on this when you get a chance? Is there anything holding it back from getting integrated into thunar? Let me know if there is anything I can do. Adam
(In reply to comment #7) > Can you give me some feedback on this when you get a chance? Is there anything > holding it back from getting integrated into thunar? Yes: the lack of free time. I'll get back to you as soon as I find the time to take a closer look. The patch is incredible helpful in getting this feature merged into master, thanks!
Any updates?
We use metadata::emblems in GFileInfo now, so everybody can set those.