diff options
author | Michael Meeks <michael.meeks@novell.com> | 2010-05-10 22:41:28 +0800 |
---|---|---|
committer | Michael Meeks <michael.meeks@novell.com> | 2010-05-10 22:41:28 +0800 |
commit | 8be2a0df7dfa830f9bfeeecfdf5551f1bbe1bd0a (patch) | |
tree | d1a716b433e5ba893e57eb2be2f8e842e6608e12 /widgets/misc/e-account-combo-box.c | |
parent | 476ad289ef964173b4d8d9c7cbc9b737675a5c4e (diff) | |
parent | 20cb61bd444cc8db3c1188b15af99886c84c140e (diff) | |
download | gsoc2013-evolution-8be2a0df7dfa830f9bfeeecfdf5551f1bbe1bd0a.tar gsoc2013-evolution-8be2a0df7dfa830f9bfeeecfdf5551f1bbe1bd0a.tar.gz gsoc2013-evolution-8be2a0df7dfa830f9bfeeecfdf5551f1bbe1bd0a.tar.bz2 gsoc2013-evolution-8be2a0df7dfa830f9bfeeecfdf5551f1bbe1bd0a.tar.lz gsoc2013-evolution-8be2a0df7dfa830f9bfeeecfdf5551f1bbe1bd0a.tar.xz gsoc2013-evolution-8be2a0df7dfa830f9bfeeecfdf5551f1bbe1bd0a.tar.zst gsoc2013-evolution-8be2a0df7dfa830f9bfeeecfdf5551f1bbe1bd0a.zip |
Merge commit 'origin/express2' into express2
Diffstat (limited to 'widgets/misc/e-account-combo-box.c')
-rw-r--r-- | widgets/misc/e-account-combo-box.c | 22 |
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 0ded393e72..786478a5e3 100644 --- a/widgets/misc/e-account-combo-box.c +++ b/widgets/misc/e-account-combo-box.c @@ -41,6 +41,7 @@ enum { struct _EAccountComboBoxPrivate { EAccountList *account_list; GHashTable *index; + int num_displayed_accounts; }; static gpointer parent_class; @@ -150,6 +151,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; @@ -182,6 +185,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)) @@ -514,3 +518,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. + */ +int +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; +} |