g_signal_connect (account, "connection_status_changed",
G_CALLBACK (on_connection_status_changed),
MODEST_FOLDER_VIEW (user_data));
+
+ /* Refilter the model */
+ gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (filter_model));
}
/* Insert the account in the model */
tny_list_append (TNY_LIST (gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT (sort_model))),
G_OBJECT (tny_account));
+
+ /* Refilter the model */
+ gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (filter_model));
}
ModestFolderViewPrivate *priv;
GtkTreeModel *sort_model, *filter_model;
GtkTreeSelection *sel = NULL;
- TnyAccount *folder_selected_account;
/* Ignore transport account removals, we're not showing them
in the folder view */
MODEST_CONF_FOLDER_VIEW_KEY);
}
+ /* Refilter the model */
+ gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (filter_model));
+
/* Select the first INBOX if the currently selected folder
belongs to the account that is being deleted */
- folder_selected_account = (TNY_IS_FOLDER (priv->cur_folder_store)) ?
- modest_tny_folder_get_account (TNY_FOLDER (priv->cur_folder_store)) :
- TNY_ACCOUNT (g_object_ref (priv->cur_folder_store));
- if (account == folder_selected_account)
- modest_folder_view_select_first_inbox_or_local (self);
- g_object_unref (folder_selected_account);
+ if (priv->cur_folder_store) {
+ TnyAccount *folder_selected_account;
+
+ folder_selected_account = (TNY_IS_FOLDER (priv->cur_folder_store)) ?
+ modest_tny_folder_get_account (TNY_FOLDER (priv->cur_folder_store)) :
+ TNY_ACCOUNT (g_object_ref (priv->cur_folder_store));
+ if (account == folder_selected_account)
+ modest_folder_view_select_first_inbox_or_local (self);
+ g_object_unref (folder_selected_account);
+ }
}
void
TnyAccountStore *account_store)
{
ModestFolderViewPrivate *priv;
- GtkTreeModel *model /* , *old_model */;
- /* TnyAccount *local_account; */
- TnyList *model_as_list;
+ GtkTreeModel *model /* , *old_model */;
+ GtkTreeModel *filter_model = NULL, *sortable = NULL;
g_return_val_if_fail (MODEST_IS_FOLDER_VIEW (self), FALSE);
g_return_val_if_fail (account_store, FALSE);
}
/* FIXME: the local accounts are not shown when the query
- selects only the subscribed folders. */
-/* model = tny_gtk_folder_store_tree_model_new (TRUE, priv->query); */
+ selects only the subscribed folders */
model = tny_gtk_folder_store_tree_model_new (NULL);
-
- /* Deal with the model via its TnyList Interface,
- * filling the TnyList via a get_accounts() call: */
- model_as_list = TNY_LIST(model);
/* Get the accounts: */
tny_account_store_get_accounts (TNY_ACCOUNT_STORE(account_store),
- model_as_list,
+ TNY_LIST (model),
TNY_ACCOUNT_STORE_STORE_ACCOUNTS);
- g_object_unref (model_as_list);
- model_as_list = NULL;
-
- GtkTreeModel *filter_model = NULL, *sortable = NULL;
sortable = gtk_tree_model_sort_new_with_model (model);
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE(sortable),
/* get the folder for the row the treepath refers to. */
/* folder must be unref'd */
-static TnyFolder*
+static TnyFolderStore *
tree_path_to_folder (GtkTreeModel *model, GtkTreePath *path)
{
GtkTreeIter iter;
- TnyFolder *folder = NULL;
+ TnyFolderStore *folder = NULL;
if (gtk_tree_model_get_iter (model,&iter, path))
gtk_tree_model_get (model, &iter,
&folder, -1);
/* Ask for confirmation to move */
- main_win = modest_window_mgr_get_main_window(mgr);
- response = modest_ui_actions_msgs_move_to_confirmation (GTK_WINDOW(main_win), folder,
+ main_win = modest_window_mgr_get_main_window (mgr);
+ response = modest_ui_actions_msgs_move_to_confirmation (main_win, folder,
TRUE, headers);
if (response == GTK_RESPONSE_CANCEL)
goto cleanup;
/* Transfer messages */
- mail_op = modest_mail_operation_new_with_error_handling (NULL,
+ mail_op = modest_mail_operation_new_with_error_handling ((GObject *) main_win,
modest_ui_actions_move_folder_error_handler,
- NULL);
+ NULL, NULL);
modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (),
mail_op);
ModestMailOperation *mail_op = NULL;
GtkTreeIter dest_iter, iter;
TnyFolderStore *dest_folder = NULL;
- TnyFolder *folder = NULL;
+ TnyFolderStore *folder = NULL;
gboolean forbidden = FALSE;
if (!forbidden) {
folder = tree_path_to_folder (dest_model, dest_row);
if (TNY_IS_FOLDER(folder)) {
ModestTnyFolderRules rules =
- modest_tny_folder_get_rules (folder);
+ modest_tny_folder_get_rules (TNY_FOLDER (folder));
forbidden = rules & MODEST_FOLDER_RULES_FOLDER_NON_WRITEABLE;
} else if (TNY_IS_FOLDER_STORE(folder)) {
/* enable local root as destination for folders */
folder = tree_path_to_folder (source_model, helper->source_row);
if (TNY_IS_FOLDER(folder)) {
ModestTnyFolderRules rules =
- modest_tny_folder_get_rules (folder);
+ modest_tny_folder_get_rules (TNY_FOLDER (folder));
forbidden = rules & MODEST_FOLDER_RULES_FOLDER_NON_MOVEABLE;
} else
forbidden = TRUE;
/* Do the mail operation */
mail_op =
- modest_mail_operation_new_with_error_handling (G_OBJECT (modest_window_mgr_get_main_window (mgr)),
+ modest_mail_operation_new_with_error_handling ((GObject *) modest_window_mgr_get_main_window (mgr),
modest_ui_actions_move_folder_error_handler,
- folder);
+ folder, NULL);
modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (),
mail_op);
modest_mail_operation_xfer_folder (mail_op,
- folder,
+ TNY_FOLDER (folder),
dest_folder,
helper->delete_source,
xfer_cb,
ModestFolderViewPrivate *priv;
GdkDragAction suggested_action;
gboolean valid_location = FALSE;
- TnyFolder *folder;
+ TnyFolderStore *folder;
priv = MODEST_FOLDER_VIEW_GET_PRIVATE (widget);
/* Check that the destination folder is writable */
dest_model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget));
folder = tree_path_to_folder (dest_model, dest_row);
- if (folder) {
- ModestTnyFolderRules rules = modest_tny_folder_get_rules(folder);
+ if (folder && TNY_IS_FOLDER (folder)) {
+ ModestTnyFolderRules rules = modest_tny_folder_get_rules(TNY_FOLDER (folder));
if (rules & MODEST_FOLDER_RULES_FOLDER_NON_WRITEABLE) {
valid_location = FALSE;
goto out;
}
- g_object_unref (folder);
}
+ g_object_unref (folder);
/* Expand the selected row after 1/2 second */
if (!gtk_tree_view_row_expanded (GTK_TREE_VIEW (widget), dest_row)) {