Sending PHONE_EVENT_ONLINE only once all configured plug-ins have initialized

This commit is contained in:
Pierre Pronchery 2010-09-14 22:47:42 +00:00
parent 6d8c7fd101
commit 3ad04fff22

View File

@ -110,6 +110,8 @@ PhonePlugin plugin =
/* private */ /* private */
/* functions */ /* functions */
/* profiles_init */ /* profiles_init */
static gboolean _init_idle(gpointer data);
static int _profiles_init(PhonePlugin * plugin) static int _profiles_init(PhonePlugin * plugin)
{ {
Profiles * profiles; Profiles * profiles;
@ -146,11 +148,21 @@ static int _profiles_init(PhonePlugin * plugin)
} }
pa_context_connect(profiles->pac, NULL, 0, NULL); pa_context_connect(profiles->pac, NULL, 0, NULL);
pa_threaded_mainloop_start(profiles->pam); pa_threaded_mainloop_start(profiles->pam);
/* XXX may already be online, may not be desired */ profiles->source = g_idle_add(_init_idle, plugin);
plugin->helper->event(plugin->helper->phone, PHONE_EVENT_ONLINE);
return 0; return 0;
} }
static gboolean _init_idle(gpointer data)
{
PhonePlugin * plugin = data;
Profiles * profiles = plugin->priv;
/* FIXME may already be online, may not be desired */
plugin->helper->event(plugin->helper->phone, PHONE_EVENT_ONLINE);
profiles->source = 0;
return FALSE;
}
/* profiles_destroy */ /* profiles_destroy */
static int _profiles_destroy(PhonePlugin * plugin) static int _profiles_destroy(PhonePlugin * plugin)