#include <modest-platform.h>
#include <modest-account-mgr-helpers.h>
#include <modest-widget-memory.h>
-
+#include <modest-ui-actions.h>
/* 'private'/'protected' functions */
static void modest_folder_view_class_init (ModestFolderViewClass *klass);
gulong changed_signal;
gulong accounts_reloaded_signal;
- GtkTreeSelection *cur_selection;
TnyFolderStoreQuery *query;
guint timer_expander;
if (!strcmp (account_id, MODEST_ACTUAL_LOCAL_FOLDERS_ACCOUNT_ID)) {
item_name = g_strdup (priv->local_account_name);
} else {
- if (!strcmp (account_id, MODEST_MMC_ACCOUNT_ID)) {
- /* TODO: get MMC card name */
- item_name = g_strdup (_("MMC"));
- } else {
- item_name = g_strdup (fname);
- }
+ item_name = g_strdup (fname);
}
item_weight = 800;
{
/* We use ModestTnySimpleFolder store to group the outboxes and
* the other local folders together: */
- item_name = g_strdup (_("Local Folders"));
+ item_name = g_strdup (priv->local_account_name);
item_weight = 400;
}
/* Setup drag and drop */
setup_drag_and_drop (GTK_TREE_VIEW(obj));
- /* Restore conf */
- modest_widget_memory_restore (conf, G_OBJECT (obj), MODEST_CONF_FOLDER_VIEW_KEY);
-
/* Connect signals */
g_signal_connect (G_OBJECT (obj),
"key-press-event",
g_signal_connect (G_OBJECT(account_store), "accounts_reloaded",
G_CALLBACK (on_accounts_reloaded), self);
- if (!update_model (MODEST_FOLDER_VIEW (self),
- MODEST_TNY_ACCOUNT_STORE (priv->account_store)))
- g_printerr ("modest: failed to update model\n");
-
g_object_unref (G_OBJECT (device));
}
on_accounts_reloaded (TnyAccountStore *account_store,
gpointer user_data)
{
+ ModestConf *conf = modest_runtime_get_conf ();
+
+ modest_widget_memory_save (conf, G_OBJECT (user_data), MODEST_CONF_FOLDER_VIEW_KEY);
update_model (MODEST_FOLDER_VIEW (user_data),
MODEST_TNY_ACCOUNT_STORE(account_store));
+ modest_widget_memory_restore (conf, G_OBJECT (user_data), MODEST_CONF_FOLDER_VIEW_KEY);
}
void
TNY_GTK_FOLDER_STORE_TREE_MODEL_INSTANCE_COLUMN, &instance,
-1);
+ /* Do not show if there is no instance, this could indeed
+ happen when the model is being modified while it's being
+ drawn. This could occur for example when moving folders
+ using drag&drop */
+ if (!instance)
+ return FALSE;
+
if (type == TNY_FOLDER_TYPE_ROOT) {
/* TNY_FOLDER_TYPE_ROOT means that the instance is an account instead of a folder. */
if (TNY_IS_ACCOUNT (instance)) {
update_model (ModestFolderView *self, ModestTnyAccountStore *account_store)
{
ModestFolderViewPrivate *priv;
-
GtkTreeModel *model;
g_return_val_if_fail (account_store, FALSE);
g_return_if_fail (user_data);
priv = MODEST_FOLDER_VIEW_GET_PRIVATE(user_data);
- priv->cur_selection = sel;
-
+
/* folder was _un_selected if true */
if (!gtk_tree_selection_get_selected (sel, &model, &iter)) {
if (priv->cur_folder_store)
headers = tny_simple_list_new ();
tny_list_append (headers, G_OBJECT (header));
modest_mail_operation_xfer_msgs (mail_op, headers, folder, helper->delete_source, NULL, NULL);
-
+
/* Frees */
g_object_unref (G_OBJECT (mail_op));
g_object_unref (G_OBJECT (header));
&folder, -1);
/* Do the mail operation */
- mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_TYPE_RECEIVE, NULL);
+ mail_op = modest_mail_operation_new_with_error_handling (MODEST_MAIL_OPERATION_TYPE_RECEIVE,
+ NULL,
+ modest_ui_actions_move_folder_error_handler,
+ NULL);
modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (),
mail_op);
g_signal_connect (G_OBJECT (mail_op), "progress-changed",
const gchar *account_id)
{
ModestFolderViewPrivate *priv;
- ModestConf *conf;
GtkTreeModel *model;
g_return_if_fail (self);
g_free (priv->visible_account_id);
priv->visible_account_id = g_strdup (account_id);
- /* Save preferences */
- conf = modest_runtime_get_conf ();
- modest_widget_memory_save (conf, G_OBJECT (self), MODEST_CONF_FOLDER_VIEW_KEY);
-
/* Refilter */
model = gtk_tree_view_get_model (GTK_TREE_VIEW (self));
if (GTK_IS_TREE_MODEL_FILTER (model))