aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-subscription-editor.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-10-30 07:54:45 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-10-30 07:54:45 +0800
commit43814fe77518e97c6b9c9ecb1d499dc3eb323296 (patch)
treea3353a6405accaa23473ce3893359d180c7a6880 /mail/em-subscription-editor.c
parent83627486d54d307e7bf80885757247880eab1d26 (diff)
downloadgsoc2013-evolution-43814fe77518e97c6b9c9ecb1d499dc3eb323296.tar.gz
gsoc2013-evolution-43814fe77518e97c6b9c9ecb1d499dc3eb323296.tar.zst
gsoc2013-evolution-43814fe77518e97c6b9c9ecb1d499dc3eb323296.zip
Bug 633172 - Folder->Subscriptions is always enabled
Diffstat (limited to 'mail/em-subscription-editor.c')
-rw-r--r--mail/em-subscription-editor.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/mail/em-subscription-editor.c b/mail/em-subscription-editor.c
index e34a9248c7..c040daf48e 100644
--- a/mail/em-subscription-editor.c
+++ b/mail/em-subscription-editor.c
@@ -1044,32 +1044,30 @@ static void
subscription_editor_realize (GtkWidget *widget)
{
EMSubscriptionEditor *editor;
- EAccountList *account_list;
- EIterator *account_iter;
GtkComboBox *combo_box;
+ CamelSession *session;
+ GList *list, *iter;
gint initial_index = 0;
editor = EM_SUBSCRIPTION_EDITOR (widget);
+ session = em_subscription_editor_get_session (editor);
/* Chain up to parent's realize() method. */
GTK_WIDGET_CLASS (em_subscription_editor_parent_class)->realize (widget);
/* Find accounts to display, and watch for the default account. */
- account_list = e_get_account_list ();
- account_iter = e_list_get_iterator (E_LIST (account_list));
- while (e_iterator_is_valid (account_iter)) {
- EAccount *account;
-
- /* XXX EIterator misuses const. */
- account = (EAccount *) e_iterator_get (account_iter);
- if (subscription_editor_test_account (editor, account)) {
- if (account == editor->priv->initial_account)
- initial_index = editor->priv->stores->len;
- subscription_editor_add_account (editor, account);
- }
- e_iterator_next (account_iter);
+ list = e_get_subscribable_accounts (session);
+ for (iter = list; iter != NULL; iter = g_list_next (iter)) {
+ EAccount *account = E_ACCOUNT (iter->data);
+ if (account == editor->priv->initial_account)
+ initial_index = editor->priv->stores->len;
+ subscription_editor_add_account (editor, account);
}
- g_object_unref (account_iter);
+ g_list_free (list);
+
+ /* The subscription editor should only be accessible if
+ * at least one enabled account supports subscriptions. */
+ g_return_if_fail (editor->priv->stores->len > 0);
combo_box = GTK_COMBO_BOX (editor->priv->combo_box);
gtk_combo_box_set_active (combo_box, initial_index);