IdleBehaviour



I'm thinking about making it possible to give a TnyFolder instance a
TnyIdleBehaviour strategy for when it notices that there's idle time
while the folder is open: headers have not all been closed yet.

The idea would be to make it possible to set a behaviour that would on a
certain frequency perform a STATUS command on the IMAP server, and if
new messages have arrived, that it would then append those messages.

* warning, idea dumping *

static void
append_header (TnyIdleBehaviour *self, TnyFolder *folder, TnyHeader
*hdr, gpointer user_data)
{
	tny_list_prepend (user_data, hdr);
}

void
my_mainloop_program ()
{

  TnyIdleBehaviour *ib;

  ib = tny_g_mainloop_idle_behaviour_new ();
  list = tny_folder_get_headers (folder, ...);

  tny_folder_set_idle_behaviour (folder, ib);

  g_signal_connect (G_OBJECT (ib), "message_added",
	append_header, list);
}


static void
tny_g_mainloop_idle_behaviour_message_added (TnyIdleBehaviour *self,
TnyHeader *hdr, ...)
{
	g_signal_emit (..., "message_added", 2, folder, hdr)
}


ps. Maybe the name IdleBehaviour is confusing and wrong.


-- 
Philip Van Hoof, software developer
home: me at pvanhoof dot be 
gnome: pvanhoof at gnome dot org 
http://www.pvanhoof.be/blog







[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]