aboutsummaryrefslogtreecommitdiffstats
path: root/e-util
diff options
context:
space:
mode:
Diffstat (limited to 'e-util')
-rw-r--r--e-util/e-account-utils.c42
-rw-r--r--e-util/e-account-utils.h1
2 files changed, 43 insertions, 0 deletions
diff --git a/e-util/e-account-utils.c b/e-util/e-account-utils.c
index 4395542f7c..66242408ac 100644
--- a/e-util/e-account-utils.c
+++ b/e-util/e-account-utils.c
@@ -137,3 +137,45 @@ e_get_account_by_uid (const gchar *uid)
/* XXX EAccountList misuses const. */
return (EAccount *) account;
}
+
+/**
+ * e_get_any_enabled_account:
+ *
+ * Returns the default mail account if it's enabled, otherwise the first
+ * enabled mail account in the global #EAccountList, or finally %NULL if
+ * all mail accounts are disabled or none exist.
+ *
+ * Returns: an enabled #EAccount, or %NULL if there are none
+ **/
+EAccount *
+e_get_any_enabled_account (void)
+{
+ EAccount *account;
+ EAccountList *account_list;
+ EIterator *iter;
+
+ account = e_get_default_account ();
+ if (account != NULL && account->enabled)
+ return account;
+
+ account = NULL;
+
+ account_list = e_get_account_list ();
+ iter = e_list_get_iterator (E_LIST (account_list));
+
+ while (e_iterator_is_valid (iter) && account == NULL) {
+ EAccount *candidate;
+
+ /* XXX EIterator misuses const. */
+ candidate = (EAccount *) e_iterator_get (iter);
+
+ if (candidate->enabled)
+ account = candidate;
+ else
+ e_iterator_next (iter);
+ }
+
+ g_object_unref (iter);
+
+ return account;
+}
diff --git a/e-util/e-account-utils.h b/e-util/e-account-utils.h
index f2ae8fc5dc..f8c5c968a4 100644
--- a/e-util/e-account-utils.h
+++ b/e-util/e-account-utils.h
@@ -29,6 +29,7 @@ EAccount * e_get_default_account (void);
void e_set_default_account (EAccount *account);
EAccount * e_get_account_by_name (const gchar *name);
EAccount * e_get_account_by_uid (const gchar *uid);
+EAccount * e_get_any_enabled_account (void);
G_END_DECLS
ne2016-05-101-1/+0 * Remove expired port:rene2016-04-241-1/+0 * Remove expired ports:rene2016-04-231-2/+0 * Remove expired ports:rene2016-01-021-1/+0 * biology/consed: undeprecate, it presumably builds fine but it is restricted.rene2015-12-261-0/+1 * Remove expired ports:rene2015-11-021-1/+0 * Remove an entry about a removed portbapt2015-10-161-1/+0 * Update LICENSE and add RESTRICTEDcs2015-09-121-0/+1 * Remove expired ports:rene2015-09-021-5/+0 * Add LEGAL information for binary distribution of audio/shoutcast tosbruno2015-08-061-0/+1 * - Belatedly update to version 2.8.16danfe2015-04-031-1/+0 * Fix build errors with PortAudio and/or ALSAriggs2015-03-301-0/+1 * Remove expired ports:rene2015-03-281-1/+0 * net/malo-firmware-kmod: NEW PORT - Marvell Libertas 88W8335 firmwarerobak2014-11-281-0/+1 * Update games/jfsw to 20131019martymac2014-11-251-1/+1 * Make LEGAL and RESTRICTED in Makefile for games/linux-ut match.scf2014-11-041-1/+1 * Welcome unifi4 to the ports tree.feld2014-10-311-0/+1 * Remove www/squid32 and 4 ports dependent on www/squid (v2.7)marino2014-09-161-1/+0 * 2014-08-31 databases/kinterbasdb: Not staged. See http://lists.freebsd.org/pi...antoine2014-09-071-3/+0 * Remove non staged ports without pending PR from wwwbapt2014-09-021-1/+0 * Remove non staged ports without pending PR from s*bapt2014-09-021-6/+0 * - Re-add archivers/bzip entryak2014-09-021-1/+1 * Add the current SUSv4/Open Group Base Specifications Issue 7.mandree2014-09-021-0/+1 * Remove non staged ports without pending PR from ma*bapt2014-09-021-2/+0 * - Update the homepage to the community website as the official one isscf2014-09-021-0/+1 * Remove non staged ports without pending PR from l*bapt2014-09-021-2/+0 * Remove non staged ports without pending PR from j*bapt2014-09-021-2/+0 * Remove non staged ports without pending PR from g*bapt2014-09-021-5/+0 * Remove non staged ports without pending PR from d*bapt2014-09-011-2/+0 * Remove non staged ports without pending PR from d*bapt2014-09-011-1/+0 * Remove non staged ports without pending PR from c*bapt2014-09-011-2/+0 * Remove LEGAL entry about biology/blastbapt2014-09-011-1/+0 * sysutils/arcconf: Updatepi2014-08-201-1/+1 * 2014-08-20 deskutils/horde3-hermes: EOL in April 2012antoine2014-08-201-2/+0 * Remove net/rsmb, MOVED entry was already added on 2014-08-13antoine2014-08-201-1/+0 * New port: sysutils/sas2ircupi2014-08-191-0/+1 * LEGAL: add entry for databases/linux-oracle-instantclient-sqlplusrene2014-07-231-0/+1 * LEGAL: add entry for databases/linux-oracle-instantclient-basicrene2014-07-231-0/+1 * - Update to latest upstream release 1.7.1riggs2014-07-171-1/+0 * Add LEGAL entry for net-p2p/btsynclwhsu2014-06-301-0/+1 * - Correct gmsh-occ entry.stephen2014-06-221-1/+1 * - Add cad/gmsh and cad/gmsh-occ ports.stephen2014-06-221-0/+2 * - Update LEGAL for some perforce portsantoine2014-06-141-0/+5 * LEGAL: Add stardict-longmaneadler2014-06-121-0/+1 * Use the wordings of RESTRICTED.jkim2014-06-121-3/+3 * Belatedly add LEGAL entries for java/jdk*-doc.jkim2014-06-121-0/+3 * - Update to 8.07.14 (and make fetchable again)antoine2014-06-011-1/+1 * Fix LEGAL/LICENSE* for multimedia/vtkmpeg2encode.riggs2014-06-011-1/+0 * LEGAL: fix multiple portseadler2014-05-261-1/+1 * Very minor update to /usr/ports/LEGAL to resolve discrepancy with make -VLEGAL.cs2014-05-191-1/+1 * LEGAL: update for stuffiteadler2014-05-171-1/+1 * LEGAL: fix multiple portseadler2014-05-171-2/+2 * LEGAL: fix multiple portseadler2014-05-171-5/+5 * Sync text of LEGAL and RESTRICTED for x11-fonts/sharefonts.olgeni2014-05-111-1/+1 * Remove expired ports:rene2014-05-111-2/+0 * Sync text of LEGAL and RESTRICTED for x11-fonts/freefonts.olgeni2014-05-111-1/+1 * Remove entry for sysutils/condor, it is no longer requires registration/manua...ak2014-05-071-1/+0 * Remove expired ports:rene2014-05-041-1/+0 * Remove expired ports:rene2014-04-111-2/+0 * Removed Long ago EOLed portbapt2014-04-101-1/+0 * Add Elasticsearch Marvel management plugin.tj2014-04-041-0/+1 * - Remove RESTRICTED.bdrewery2014-04-031-2/+2 * Remove expired ports:rene2014-04-021-4/+0 * The Oracle Java 8 JDK/JRE for Linux.jkim2014-04-011-0/+2 * Drop maintainership and fix LEGAL.ale2014-03-311-1/+1