Fix for bug NB#81584.
[modest] / src / widgets / modest-folder-view.c
index e22b93e..b547afb 100644 (file)
@@ -360,10 +360,10 @@ on_get_mmc_account_name (TnyStoreAccount* account, gpointer user_data)
 }
 
 static void
-text_cell_data  (GtkTreeViewColumn *column,  
+text_cell_data  (GtkTreeViewColumn *column,
                 GtkCellRenderer *renderer,
-                GtkTreeModel *tree_model,  
-                GtkTreeIter *iter,  
+                GtkTreeModel *tree_model,
+                GtkTreeIter *iter,
                 gpointer data)
 {
        ModestFolderViewPrivate *priv;
@@ -416,10 +416,16 @@ text_cell_data  (GtkTreeViewColumn *column,
                                                                
                /* Use bold font style if there are unread or unset messages */
                if (number > 0) {
-                       item_name = g_strdup_printf ("%s (%d)", fname, number);
+                       if (type == TNY_FOLDER_TYPE_INBOX)
+                               item_name = g_strdup_printf ("%s (%d)", _("mcen_me_folder_inbox"), number);
+                       else
+                               item_name = g_strdup_printf ("%s (%d)", fname, number);
                        item_weight = 800;
                } else {
-                       item_name = g_strdup (fname);
+                       if (type == TNY_FOLDER_TYPE_INBOX)
+                               item_name = g_strdup (_("mcen_me_folder_inbox"));
+                       else
+                               item_name = g_strdup (fname);
                        item_weight = 400;
                }
                
@@ -1070,8 +1076,6 @@ tny_account_store_view_init (gpointer g, gpointer iface_data)
        TnyAccountStoreViewIface *klass = (TnyAccountStoreViewIface *)g;
 
        klass->set_account_store = modest_folder_view_set_account_store;
-
-       return;
 }
 
 static void
@@ -1194,22 +1198,6 @@ modest_folder_view_set_account_store (TnyAccountStoreView *self, TnyAccountStore
 }
 
 static void
-on_connection_status_changed (TnyAccount *self, 
-                             TnyConnectionStatus status, 
-                             gpointer user_data)
-{
-       /* If the account becomes online then refresh it */
-       if (status == TNY_CONNECTION_STATUS_CONNECTED) {
-               const gchar *acc_name;
-               GtkWidget *my_window;
-
-               my_window = gtk_widget_get_ancestor (GTK_WIDGET (user_data), MODEST_TYPE_WINDOW);
-               acc_name = modest_tny_account_get_parent_modest_account_name_for_server_account (self);
-               modest_ui_actions_do_send_receive (acc_name, FALSE, MODEST_WINDOW (my_window));
-       }
-}
-
-static void
 on_account_inserted (TnyAccountStore *account_store, 
                     TnyAccount *account,
                     gpointer user_data)
@@ -1240,12 +1228,6 @@ on_account_inserted (TnyAccountStore *account_store,
        tny_list_append (TNY_LIST (gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT (sort_model))),
                         G_OBJECT (account));
 
-
-       /* When the store account gets online refresh it */
-       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));
 }
@@ -1979,16 +1961,19 @@ xfer_folder_cb (ModestMailOperation *mail_op,
                gpointer user_data)
 {
        DndHelper *helper;
+       GtkWidget *folder_view;
 
        helper = (DndHelper *) user_data;
+       folder_view = g_object_ref (helper->folder_view);
 
        /* Common part */
        xfer_cb (mail_op, user_data);
 
        /* Select the folder */
        if (new_folder)
-               modest_folder_view_select_folder (MODEST_FOLDER_VIEW (helper->folder_view),
+               modest_folder_view_select_folder (MODEST_FOLDER_VIEW (folder_view),
                                                  new_folder, FALSE);
+       g_object_unref (folder_view);
 }
 
 
@@ -2252,8 +2237,8 @@ drag_and_drop_from_folder_view (GtkTreeModel     *source_model,
                        forbidden = rules & MODEST_FOLDER_RULES_FOLDER_NON_WRITEABLE;
                } else if (TNY_IS_FOLDER_STORE(folder)) {
                        /* enable local root as destination for folders */
-                       if (!MODEST_IS_TNY_LOCAL_FOLDERS_ACCOUNT (folder)
-                                       && TNY_IS_ACCOUNT (folder))
+                       if (!MODEST_IS_TNY_LOCAL_FOLDERS_ACCOUNT (folder) && 
+                           !modest_tny_account_is_memory_card_account (TNY_ACCOUNT (folder)))
                                forbidden = TRUE;
                }
                g_object_unref (folder);
@@ -2533,9 +2518,9 @@ on_drag_motion (GtkWidget      *widget,
 
        /* Expand the selected row after 1/2 second */
        if (!gtk_tree_view_row_expanded (GTK_TREE_VIEW (widget), dest_row)) {
-               gtk_tree_view_set_drag_dest_row (GTK_TREE_VIEW (widget), dest_row, pos);
                priv->timer_expander = g_timeout_add (500, expand_row_timeout, widget);
        }
+       gtk_tree_view_set_drag_dest_row (GTK_TREE_VIEW (widget), dest_row, pos);
 
        /* Select the desired action. By default we pick MOVE */
        suggested_action = GDK_ACTION_MOVE;
@@ -2552,8 +2537,9 @@ on_drag_motion (GtkWidget      *widget,
  out:
        if (folder)
                g_object_unref (folder);
-       if (dest_row)
+       if (dest_row) {
                gtk_tree_path_free (dest_row);
+       }
        g_signal_stop_emission_by_name (widget, "drag-motion");
 
        return valid_location;