TMut's first screen

About

I know it's a bit silly, a first screen, a menu screen. However, on a mobile device with a small screen you don't really have a lot of choice. You will somehow have to give the user a bunch of tools to travel from that tool-window to what he actually wants. We could put everything that he wants on one big screen, on a desktop that has a huge resolution LCD attached. Of course.

Well the mobile phone user doesn't have this huge LCD screen. He has a small screen, and that's it. Maybe soon he'll have a projector or a holographic display coming out of his device, but that's more future than current reality. I also don't know how userfriendly this holographic display will be. But anyway.

Design

I didn't want to clutter this first screen with a bunch of folders for in case the user has multiple accounts configured. In stead I've put a GtkComboBox? and a GtkTreeView? on it. You select the account in the combo box, and then the folders of that account will appear in the tree view. How do we do that with Tinymail?

Selecting the current account

We handle the "changed" signal of the GtkComboBox? in on_account_changed. Let's start with that! First we get the account that we changed to with gtk_combo_box_get_active_iter followed by gtk_tree_model_get. We simply call tmut_menu_view_set_active_account now. This function makes a TnyFolderStoreQuery that filters away all folders of the account that are not subscribed. We make a new TnyGtkFolderStoreTreeModel, but in stead of using tny_account_store_get_accounts to fill it up like what we did in TMutFolderSelector, we'll manually append just this account to it. Tinymail does the rest for us.

Only thing left for us to do is gtk_tree_view_set_model.

Selecting the current folder

We handle the "row-activated" signal of the GtkTreeView? that got filled up with the current account's folders with on_folder_changed. We get the folder using gtk_tree_selection_get_selected followed by gtk_tree_model_get.

Now we check whether it's not a TNY_FOLDER_TYPE_ROOT. We do this because it's possible that the user double clicked or tapped on the TnyStoreAccount's row. The TnyStoreAccount is also a TnyFolderStore and can therefore be made visible by the GtkTreeView? and GtkTreeModel? (the TnyGtkFolderStoreTreeModel) combination.

If it's not, then our instance is guaranteed to be a TnyFolder. We'll make a TMutFolderView and pass it our folder with tmut_folder_view_set_active_folder.

Implementation