Re: [Evolution-hackers] Camel - auto-check-timeout?



On Thu, 2006-06-01 at 09:52 +0200, Jules Colding wrote:
> Hi,
> 
> Is there an easy way to get the auto-check-timeout value for an account
> from within the Camel provider?

Well, something like this does actually work:

static const EAccount*
brutus_find_account(EAccountList *accounts, const char *url)
{
	EIterator *it;
	const EAccount *account = NULL;

	if (!url)
		return NULL;
	
	for (it = e_list_get_iterator ((EList *)accounts); e_iterator_is_valid (it); e_iterator_next (it)) {
		account = (const EAccount *)e_iterator_get(it);

		if (!strcmp(url, account->source->url))
			return account;
	}
	g_object_unref(it);

	return NULL;
}

static int
brutus_get_auto_check_timeout(const char *url)
{
	int retv = -1;
	const EAccount *account;
	EAccountList *account_list = NULL;
	GConfClient *gconf_client = NULL;

	gconf_client = gconf_client_get_default();
	if (!gconf_client)
		return -1;

	account_list = e_account_list_new(gconf_client);
	if (!account_list)
		goto out;

	account = brutus_find_account(account_list, url);
	if (account)
		retv = account->source->auto_check_time;

out:
	if (account_list)
		g_object_unref(account_list);

	if (gconf_client)
		g_object_unref(gconf_client);

	return retv;
}

-- 
  jules






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