#include <tny-folder.h>
#include <tny-camel-folder.h>
#include <tny-simple-list.h>
+#include <tny-camel-account.h>
#include <modest-tny-account.h>
#include <modest-tny-folder.h>
#include <modest-tny-local-folders-account.h>
ModestFolderViewPrivate *priv;
GObject *rendobj;
gchar *fname = NULL;
- gint unread = 0;
- gint all = 0;
TnyFolderType type = TNY_FOLDER_TYPE_UNKNOWN;
GObject *instance = NULL;
gtk_tree_model_get (tree_model, iter,
TNY_GTK_FOLDER_STORE_TREE_MODEL_NAME_COLUMN, &fname,
- TNY_GTK_FOLDER_STORE_TREE_MODEL_ALL_COLUMN, &all,
- TNY_GTK_FOLDER_STORE_TREE_MODEL_UNREAD_COLUMN, &unread,
TNY_GTK_FOLDER_STORE_TREE_MODEL_TYPE_COLUMN, &type,
TNY_GTK_FOLDER_STORE_TREE_MODEL_INSTANCE_COLUMN, &instance,
-1);
}
}
- /* Select the number to show: the unread or unsent messages */
- if ((type == TNY_FOLDER_TYPE_DRAFTS) || (type == TNY_FOLDER_TYPE_OUTBOX))
- number = all;
+ /* note: we cannot reliably get the counts from the tree model, we need
+ * to use explicit calls on tny_folder for some reason.
+ */
+ /* Select the number to show: the unread or unsent messages. in case of outbox/drafts, show all */
+ if ((type == TNY_FOLDER_TYPE_DRAFTS) ||
+ (type == TNY_FOLDER_TYPE_OUTBOX) ||
+ (type == TNY_FOLDER_TYPE_MERGE)) /* _OUTBOX actually returns _MERGE... */
+ number = tny_folder_get_all_count (TNY_FOLDER(instance));
else
- number = unread;
-
+ number = tny_folder_get_unread_count (TNY_FOLDER(instance));
+
/* Use bold font style if there are unread or unset messages */
if (number > 0) {
item_name = g_strdup_printf ("%s (%d)", fname, number);
/* Get the inner model */
filter_model = gtk_tree_view_get_model (GTK_TREE_VIEW (user_data));
sort_model = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (filter_model));
-
+
/* Remove the account from the model */
tny_list_remove (TNY_LIST (gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT (sort_model))),
G_OBJECT (tny_account));
MODEST_CONF_DEVICE_NAME, NULL);
/* Force a redraw */
-#if GTK_CHECK_VERSION(2, 8, 0) /* gtk_tree_view_column_queue_resize is only available in GTK+ 2.8 */
- GtkTreeViewColumn * tree_column = gtk_tree_view_get_column (GTK_TREE_VIEW (self),
- TNY_GTK_FOLDER_STORE_TREE_MODEL_NAME_COLUMN);
+#if GTK_CHECK_VERSION(2, 8, 0)
+ GtkTreeViewColumn * tree_column;
+
+ tree_column = gtk_tree_view_get_column (GTK_TREE_VIEW (self),
+ TNY_GTK_FOLDER_STORE_TREE_MODEL_NAME_COLUMN);
gtk_tree_view_column_queue_resize (tree_column);
+#else
+ gtk_widget_queue_draw (GTK_WIDGET (self));
#endif
}
}