The Final Piece

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.

Current Implementation:

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 :-

  1. Difficult UI modifications
  2. Only usage of NautilusMimeApplicationChooser is 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 :-

  1. Code Economy
  2. 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 nautilus-mime-application-chooser.c to nautilus-properties-window.c

Commit 1d60b2dd removes nautilus-mime-application-chooser.c, and 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 !

5 thoughts on “The Final Piece

  1. Pingback: Links 17/8/2020: Linux 5.9 RC1, Parrot 4.10 Release | Techrights

  2. Congratulations, but what porting project? I saw your blog post at planet Gnome, a consistent 1-sentence summary to give context would help.

    “based on it’s MIME type… it’s convenient and modular nature can be leveraged” : neither is a contraction of it is or it has, so no apostrophe. ‘Its” is already the possessive pronoun, just as you don’t write “I like hi’s code.” It’s very confusing 😉

    Like

  3. Pingback: Celebration is in Order – cocoon

  4. Pingback: GSoC final project report – cocoon

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s