modest_folder_view_dispose (GObject *obj)
{
ModestFolderViewPrivate *priv;
+ GtkTreeModel *model = NULL;
priv = MODEST_FOLDER_VIEW_GET_PRIVATE (obj);
+ get_inner_models (MODEST_FOLDER_VIEW (obj),
+ NULL, NULL, &model);
+
#ifdef MODEST_TOOLKIT_HILDON2
if (priv->signal_handlers) {
modest_signal_mgr_disconnect_all_and_destroy (priv->signal_handlers);
g_object_unref (account);
}
- /* Get the accounts: */
- tny_account_store_get_accounts (TNY_ACCOUNT_STORE(account_store),
- TNY_LIST (model),
- TNY_ACCOUNT_STORE_STORE_ACCOUNTS);
+ if (priv->style == MODEST_FOLDER_VIEW_STYLE_SHOW_ALL) {
+ /* Get the accounts */
+ tny_account_store_get_accounts (TNY_ACCOUNT_STORE(account_store),
+ TNY_LIST (model),
+ TNY_ACCOUNT_STORE_STORE_ACCOUNTS);
+ } else {
+ if (priv->visible_account_id) {
+ TnyAccount *account;
+
+ /* Add local folders account */
+ account = modest_tny_account_store_get_local_folders_account ((ModestTnyAccountStore *) account_store);
+
+ if (account) {
+ tny_list_append (TNY_LIST (model), (GObject *) account);
+ g_object_unref (account);
+ }
+
+ account = modest_tny_account_store_get_mmc_folders_account ((ModestTnyAccountStore *) account_store);
+
+ if (account) {
+ tny_list_append (TNY_LIST (model), (GObject *) account);
+ g_object_unref (account);
+ }
+
+ /* Add visible account */
+ account = modest_tny_account_store_get_tny_account_by ((ModestTnyAccountStore *) account_store,
+ MODEST_TNY_ACCOUNT_STORE_QUERY_ID,
+ priv->visible_account_id);
+ if (account) {
+ tny_list_append (TNY_LIST (model), (GObject *) account);
+ g_object_unref (account);
+ } else {
+ g_warning ("You need to set an account first");
+ g_object_unref (model);
+ return FALSE;
+ }
+ } else {
+ g_warning ("You need to set an account first");
+ g_object_unref (model);
+ return FALSE;
+ }
+ }
sortable = gtk_tree_model_sort_new_with_model (model);
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE(sortable),
model = gtk_tree_view_get_model (GTK_TREE_VIEW (self));
if (GTK_IS_TREE_MODEL_FILTER (model))
gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (model));
+ else
+ modest_folder_view_update_model(self,
+ (TnyAccountStore *) modest_runtime_get_account_store());
/* Save settings to gconf */
modest_widget_memory_save (modest_runtime_get_conf (), G_OBJECT(self),
activity);
}
#endif
+
+TnyList *
+modest_folder_view_get_model_tny_list (ModestFolderView *self)
+{
+ GtkTreeModel *model;
+ TnyList *ret_value;
+
+ ret_value = NULL;
+ model = NULL;
+
+ if (get_inner_models (MODEST_FOLDER_VIEW (self), NULL, NULL, (GtkTreeModel **) &model)) {
+ ret_value = TNY_LIST (model);
+ g_object_ref (ret_value);
+ }
+
+ return ret_value;
+
+}