Porting Nautilus properties dialogue to use GtkBuilder has been going quiet well, this blog post is another progress update about the same.
The final piece in the puzzle still remains. The Open-With page, of the properties dialogue. Open-with page is a rather un-noticed but a very significant part of the properties-dialogue, It allows us to set, change the application which would launch for a particular file based on its MIME type.
The open with page is constructed by using a custom type
_NautilusMimeApplicationChooser which was defined in
nautilus-mime-application-chooser.c. This custom class subclasses a GtkBox and achieves its use case by adding "Reset", "Add", "Set as default" button along side the
GtkAppChooser widget, offered natively by GTK.
With the new implementation of nautilus-properties-dialogue in place, this approach of constructing open-with page has a couple(literally) of disadvantages :-
- Difficult UI modifications
- Only usage of
NautilusMimeApplicationChooseris in properties dialogue, which makes the custom class implementation redundant.
The Better Approach
With the nautilus-properties-window.ui file, in place, its convenient and modular nature can be leveraged to create the GtkAppChooser and surrounding widgets in Glade and than the necessary logical bindings can be performed in nautilus-properties-window.c thus eliminating the need of a seperate class and all the implementation glue-code that comes along with it. Advantages :-
- Code Economy
- Allows the open-with page to be customizable in Glade.
How we did it ?
Commit 81726b08 moves all the functions which deliver the use case of the open-with page from
Commit 1d60b2dd removes
nautilus-mime-application-chooser.h as these files aren’t being used anymore.
PS: the project is now completed and these commits can be found in the GNOME/nautilus -master branch.
This post marks the completion of the porting project, leaving restyling, and making basic changes to appearance, which I will be covering in the next post ..! Stay tuned !