hildon_banner_... changed to modest_platform_...
[modest] / src / widgets / modest-folder-view.c
index 0353cd8..33ecd49 100644 (file)
@@ -124,6 +124,8 @@ static gboolean     on_drag_motion         (GtkWidget      *widget,
                                            guint           time,
                                            gpointer        user_data);
 
+static void expand_root_items (ModestFolderView *self);
+
 static gint         expand_row_timeout     (gpointer data);
 
 static void         setup_drag_and_drop    (GtkTreeView *self);
@@ -420,8 +422,7 @@ text_cell_data  (GtkTreeViewColumn *column,  GtkCellRenderer *renderer,
                         * added to the model, not when the account is 
                         * changed later, so get the name from the account
                         * instance: */
-                       item_name = g_strdup (tny_account_get_name (
-                               TNY_ACCOUNT (instance)));
+                       item_name = g_strdup (tny_account_get_name (TNY_ACCOUNT (instance)));
                        item_weight = 800;
                } else {
                        item_name = g_strdup (fname);
@@ -833,7 +834,7 @@ static void
 on_account_changed (TnyAccountStore *account_store, TnyAccount *tny_account,
                    gpointer user_data)
 {
-       g_warning ("%s: account_id = %s", __FUNCTION__, tny_account_get_id(tny_account));
+       /* do nothing */
 }
 
 
@@ -926,6 +927,9 @@ modest_folder_view_on_map (ModestFolderView *self,
                               signals[FOLDER_DISPLAY_NAME_CHANGED_SIGNAL], 0,
                               NULL);
        }
+
+       expand_root_items (self); 
+
        return FALSE;
 }
 
@@ -1140,7 +1144,7 @@ modest_folder_view_update_model (ModestFolderView *self,
        g_object_unref (model);
        g_object_unref (filter_model);          
        g_object_unref (sortable);
-
+       
        /* Force a reselection of the INBOX next time the widget is shown */
        priv->reselect = TRUE;
                        
@@ -1480,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
@@ -1496,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));
@@ -1512,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) {
@@ -2132,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));
 }