aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc/e-account-combo-box.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-05-27 01:09:33 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-05-27 01:09:33 +0800
commitc9ec8c3f4dce2b02c91268529977770364ef87fe (patch)
treed574f2be1b5438407e59e2fead1321766c9bbc83 /widgets/misc/e-account-combo-box.c
parent6fec6bf39467dd32625847be1b021a7e5bc94d76 (diff)
parent96538878911586a9e9ca26b81e1916c04e538980 (diff)
downloadgsoc2013-evolution-c9ec8c3f4dce2b02c91268529977770364ef87fe.tar
gsoc2013-evolution-c9ec8c3f4dce2b02c91268529977770364ef87fe.tar.gz
gsoc2013-evolution-c9ec8c3f4dce2b02c91268529977770364ef87fe.tar.bz2
gsoc2013-evolution-c9ec8c3f4dce2b02c91268529977770364ef87fe.tar.lz
gsoc2013-evolution-c9ec8c3f4dce2b02c91268529977770364ef87fe.tar.xz
gsoc2013-evolution-c9ec8c3f4dce2b02c91268529977770364ef87fe.tar.zst
gsoc2013-evolution-c9ec8c3f4dce2b02c91268529977770364ef87fe.zip
Merge branch 'express2'
Diffstat (limited to 'widgets/misc/e-account-combo-box.c')
-rw-r--r--widgets/misc/e-account-combo-box.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/widgets/misc/e-account-combo-box.c b/widgets/misc/e-account-combo-box.c
index 43c7fb87a9..7d34a29bfe 100644
--- a/widgets/misc/e-account-combo-box.c
+++ b/widgets/misc/e-account-combo-box.c
@@ -40,6 +40,7 @@ enum {
struct _EAccountComboBoxPrivate {
EAccountList *account_list;
GHashTable *index;
+ gint num_displayed_accounts;
};
static gpointer parent_class;
@@ -149,6 +150,8 @@ account_combo_box_refresh_cb (EAccountList *account_list,
GList *list = NULL;
GList *iter;
+ combo_box->priv->num_displayed_accounts = 0;
+
store = gtk_list_store_new (2, G_TYPE_STRING, E_TYPE_ACCOUNT);
model = GTK_TREE_MODEL (store);
index = combo_box->priv->index;
@@ -181,6 +184,7 @@ account_combo_box_refresh_cb (EAccountList *account_list,
gchar *string;
account = iter->data;
+ combo_box->priv->num_displayed_accounts++;
/* Show the account name for duplicate email addresses. */
if (account_combo_box_has_dupes (list, account->id->address))
@@ -513,3 +517,21 @@ e_account_combo_box_set_active_name (EAccountComboBox *combo_box,
return e_account_combo_box_set_active (combo_box, account);
}
+
+/**
+ * e_account_combo_box_count_displayed_accounts:
+ * @combo_box: an #EAccountComboBox
+ *
+ * Counts the number of accounts that are displayed in the @combo_box. This may not
+ * be the actual number of accounts that are configured, as some of those accounts
+ * may be disabled by the user.
+ *
+ * Return value: number of active and valid accounts as shown in the @combo_box.
+ */
+gint
+e_account_combo_box_count_displayed_accounts (EAccountComboBox *combo_box)
+{
+ g_return_val_if_fail (E_IS_ACCOUNT_COMBO_BOX (combo_box), -1);
+
+ return combo_box->priv->num_displayed_accounts;
+}