hildon_banner_... changed to modest_platform_...
[modest] / src / widgets / modest-folder-view.c
index 478a892..33ecd49 100644 (file)
@@ -834,18 +834,7 @@ static void
 on_account_changed (TnyAccountStore *account_store, TnyAccount *tny_account,
                    gpointer user_data)
 {
-       ModestFolderView*  self;
-
-       self = MODEST_FOLDER_VIEW (user_data);
-       
-       /* Ignore transport account insertions, we're not showing them
-          in the folder view */
-       if (TNY_IS_TRANSPORT_ACCOUNT (tny_account))
-               return;
-       
-       /* ugly hack to force a redraw */
-       modest_folder_view_update_model (self,
-                                        account_store);
+       /* do nothing */
 }
 
 
@@ -1495,6 +1484,18 @@ tree_path_to_folder (GtkTreeModel *model, GtkTreePath *path)
        return folder;
 }
 
+static void 
+show_banner_move_target_error ()
+{
+       ModestWindow *main_window;
+
+       main_window = modest_window_mgr_get_main_window(
+                       modest_runtime_get_window_mgr());
+                               
+       modest_platform_information_banner(GTK_WIDGET(main_window),
+                       NULL, _("mail_in_ui_folder_move_target_error"));
+}
+
 /*
  * This function is used by drag_data_received_cb to manage drag and
  * drop of a header, i.e, and drag from the header view to the folder
@@ -1511,6 +1512,7 @@ drag_and_drop_from_header_view (GtkTreeModel *source_model,
        TnyFolder *folder = NULL;
        ModestMailOperation *mail_op = NULL;
        GtkTreeIter source_iter;
+       ModestWindowMgr *mgr = NULL;
 
        g_return_if_fail (GTK_IS_TREE_MODEL(source_model));
        g_return_if_fail (GTK_IS_TREE_MODEL(dest_model));
@@ -1527,10 +1529,17 @@ drag_and_drop_from_header_view (GtkTreeModel *source_model,
                goto cleanup;
        }
        
+       /* Check if the selected message is in msg-view. If it is than
+        * do not enable drag&drop on that. */
+       mgr = modest_runtime_get_window_mgr ();
+       if (modest_window_mgr_find_registered_header(mgr, header, NULL))
+               goto cleanup;
+       
        /* Get Folder */
        folder = tree_path_to_folder (dest_model, dest_row);
        if (!TNY_IS_FOLDER(folder)) {
                g_warning ("BUG: %s could not get a valid folder", __FUNCTION__);
+               show_banner_move_target_error();
                goto cleanup;
        }
        if (modest_tny_folder_get_rules(folder) & MODEST_FOLDER_RULES_FOLDER_NON_WRITEABLE) {
@@ -2147,6 +2156,9 @@ modest_folder_view_select_first_inbox_or_local (ModestFolderView *self)
        /* Select the row and free */
        gtk_tree_view_set_cursor (GTK_TREE_VIEW (self), path, NULL, FALSE);
        gtk_tree_path_free (path);
+
+       /* set focus */
+       gtk_widget_grab_focus (GTK_WIDGET(self));
 }