Re: Camel - auto-check-timeout?

Jules Colding <[email protected]>
Newsgroups gmane.comp.gnome.evolution.devel
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.