TnyFolderMonitor

TnyFolderMonitor — A folder observer that updates lists

Synopsis




                    TnyFolderMonitor;
TnyFolderObserver*  tny_folder_monitor_new              (TnyFolder *folder);
void                tny_folder_monitor_poke_status      (TnyFolderMonitor *self);
void                tny_folder_monitor_add_list         (TnyFolderMonitor *self,
                                                         TnyList *list);
void                tny_folder_monitor_remove_list      (TnyFolderMonitor *self,
                                                         TnyList *list);
void                tny_folder_monitor_stop             (TnyFolderMonitor *self);
void                tny_folder_monitor_start            (TnyFolderMonitor *self);

Object Hierarchy


  GObject
   +----TnyFolderMonitor

Implemented Interfaces

TnyFolderMonitor implements TnyFolderObserver.

Description

A TnyFolderObserver implementation that updates TnyList implementations by adding and removing TnyHeader instances

Details

TnyFolderMonitor

typedef struct _TnyFolderMonitor TnyFolderMonitor;


tny_folder_monitor_new ()

TnyFolderObserver*  tny_folder_monitor_new              (TnyFolder *folder);

Creates a folder monitor for folder

folder : a TnyFolder instance
Returns : a new TnyFolderMonitor instance

tny_folder_monitor_poke_status ()

void                tny_folder_monitor_poke_status      (TnyFolderMonitor *self);

Trigger the poke method on the folder instance being monitored. Also take a look at tny_folder_poke_status in TnyFolder.

self : a TnyFolderMonitor instance

tny_folder_monitor_add_list ()

void                tny_folder_monitor_add_list         (TnyFolderMonitor *self,
                                                         TnyList *list);

Add list to the registered lists that are interested in changes. list will remain referenced until it's unregisterd using tny_folder_monitor_remove_list or until self is finalized.

self : a TnyFolderChange instance
list : a TnyList instance

tny_folder_monitor_remove_list ()

void                tny_folder_monitor_remove_list      (TnyFolderMonitor *self,
                                                         TnyList *list);

Remove list from the lists that are interested in changes. This will remove the reference that got added when you ussed the tny_folder_monitor_add_list.

self : a TnyFolderChange instance
list : a TnyList instance

tny_folder_monitor_stop ()

void                tny_folder_monitor_stop             (TnyFolderMonitor *self);

Stop monitoring the folder. At some point in time you must perform method after you used tny_folder_monitor_start (for example before unreferencing self).

The reason for that is that unless you stop self, it would still have a reference being held by the TnyFolder instance being monitored. By stopping this monitor, you explicitly ask that folder instance to unregister self as an observer. And by that loosing that reference too.

self : a TnyFolderMonitor instance

tny_folder_monitor_start ()

void                tny_folder_monitor_start            (TnyFolderMonitor *self);

Start monitoring the folder. The starting of a monitor implies that self will become an observer of the folder instance. This adds a reference to self that at some point in time must be removed using tny_folder_monitor_stop.

This means that if you start the monitor, you must also at some point stop it.

Keep this in mind: monitoring means that registered lists are kept alive. A list that is alive means that it's consuming memory!

self : a TnyFolderMonitor instance