Summary
In this section we'll talk about:
- ModestSingletons: the object storing all the singletons for the application
- ModestRuntime: accessor for these singletons, but also provides some global status variables.
- ModestInit: code to startup Modest (in particular the singletons).
Where?
- src/modest-singletons.ch?
- src/modest-runtime.ch?
- src/modest-init.ch?
- src/modest-main.ch?
ModestSingletons
This object holds the main singletons of the application, and keeps a reference on each of them. It also destroys them on finishing application.
You shouldn't add any object reference to the singleton instances.
The singleton objects stored are:
- ModestConf: storage of persistent settings
- ModestAccountMgr: storage of account settings
- ModestEmailClipboard: helper for operating full emails in clipboard (deprecated).
- ModestCacheMgr: holds some caches of specific purpose
- ModestPlatformFactory: an implementation specific for Modest of TnyPlatformFactory. An object factory for creating specific platform instances of TnyAccountStore, TnyDevice, TnyMsg, TnyMimePart and TnyMsgView.
- Device: the TnyDevice instance. It controls the network connection status.
- Mail operation queue: a queue for processing mail operations. It's used for knowing if there's an operation in progress, for showing progress feedback, ...
- Window manager: the window manager in Modest is the implementation of the policy windows, dialogs and banners are placed and stacked.
- Protocol registry: an extensible registry of all the mail protocols implemented. Combined with plugin factory it allows registering new mail protocol implementations in Modest.
- Images cache: used for caching the inline images fetched from the internet.
- Plugin factory: the object that loads plugins and properly enables them.
ModestRuntime
You'll usually access the singletons through methods in ModestRuntime.
An example of code:
a = modest_conf_get_bool (modest_runtime_get_conf (), "key", NULL);
There are some methods for handling mail send queues in ModestRuntime:
- modest_runtime_get_send_queue (): allows to get or create a send queue.
- modest_runtime_remove_send_queue (): allows to remove one send queue (i.e. when the transport account is removed).
- modest_runtime_remove_all_send_queues (): removes all send queues, so that they're properly recreated on next network connection.
ModestRuntime also provides access to:
- Debug flags. If you want to make some code happen only if debug flags are set, you could check these flags. See header doc of modest_runtime_get_debug_flags().
- The allow_shutdown variable. Allows to block shutdown process even if there are now windows showing nor mail operations running.
ModestInit
Startup process
The startup process of modest can be seen in ModestMain (where main() method can be found) and ModestInit.
Shutdown process
Shutdown process implements this policy:
- Modest will keep alive if any window or dialog is visible (it checks ModestWindowMgr for windows and banners count).
- Modest will keep alive if any mail operation is running (i.e. sending mail, while it does a send receive, etc).
- Modest will keep alive if allow_shutdown variable is set.
As shutting down the connection is a complex and slow process, what happens if these three conditions are false is:
- First it creates a mail operation called "shutdown". This operation disconnects from all accounts.
- On finishing shutdown operation it checks if there has been any operation running meanwhile, or if any new operation or window is shown. If it is, then it "cancels shutdown" until the conditions are false again.
This is for allowing to process new mail operations if shutdown wasn't finished (i.e. user closes all windows, and, before connections are finished user opens Modest again).
(last edited January 22, 2010) - Read Only
[info]
[diff])
FindPage by browsing or searching
5 best incoming links:
ModestArchitecture (5), RecentChanges (5), ModestMailOperations (4)
5 best outgoing links:
ch (7)
5 most popular nearby:
ModestArchitecture (4037), ModestMailOperations (909), RecentChanges (697), ch (302)
|