* added fixes from the trunk for 85454 and 83128
authorVivek Sekar <viveksekar@gmail.com>
Fri, 16 May 2008 13:39:40 +0000 (13:39 +0000)
committerVivek Sekar <viveksekar@gmail.com>
Fri, 16 May 2008 13:39:40 +0000 (13:39 +0000)
pmo-diablo-r4540

src/maemo/modest-msg-edit-window.c
src/widgets/modest-header-view.c

index dc93da1..2cba7b2 100644 (file)
@@ -1219,9 +1219,17 @@ set_msg (ModestMsgEditWindow *self, TnyMsg *msg, gboolean preserve_is_rich)
 
        if (preserve_is_rich && !is_html) {
                wp_text_buffer_enable_rich_text (WP_TEXT_BUFFER (priv->text_buffer), FALSE);
+               /* We must do this here in order to reset the undo
+                  list, because otherwise this action could be
+                  reverted */
+               wp_text_buffer_reset_buffer (WP_TEXT_BUFFER (priv->text_buffer), FALSE);
        /* Get the default format required from configuration */
        } else if (!modest_conf_get_bool (modest_runtime_get_conf (), MODEST_CONF_PREFER_FORMATTED_TEXT, NULL)) {
                wp_text_buffer_enable_rich_text (WP_TEXT_BUFFER (priv->text_buffer), FALSE);
+               /* We must do this here in order to reset the undo
+                  list, because otherwise this action could be
+                  reverted */
+               wp_text_buffer_reset_buffer (WP_TEXT_BUFFER (priv->text_buffer), FALSE);
        }
 
        /* Set the default focus depending on having already a To: field or not */
index 895ec95..2df0fd7 100644 (file)
@@ -1782,22 +1782,40 @@ on_button_press_event(GtkWidget * self, GdkEventButton * event, gpointer userdat
        GtkTreeSelection *selection = NULL;
        GtkTreePath *path = NULL;
        gboolean already_selected = FALSE;
+       ModestTnySendQueueStatus status = MODEST_TNY_SEND_QUEUE_UNKNOWN;
 
        if (gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(self), event->x, event->y, &path, NULL, NULL, NULL)) {
+               GtkTreeIter iter;
+               GtkTreeModel *model;
+
                selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(self));
                already_selected = gtk_tree_selection_path_is_selected (selection, path);
+
+               /* Get header from model */
+               model = gtk_tree_view_get_model (GTK_TREE_VIEW (self));
+               if (gtk_tree_model_get_iter (model, &iter, path)) {
+                       GValue value = {0,};
+                       TnyHeader *header;
+
+                       gtk_tree_model_get_value (model, &iter, 
+                                                 TNY_GTK_HEADER_LIST_MODEL_INSTANCE_COLUMN, 
+                                                 &value);
+                       header = (TnyHeader *) g_value_get_object (&value);
+                       if (TNY_IS_HEADER (header))
+                               status = modest_tny_all_send_queues_get_msg_status (header);
+                       g_value_unset (&value);
+               }
        }
 
        /* Enable drag and drop onlly if the user clicks on a row that
           it's already selected. If not, let him select items using
-          the pointer */
-       if (!already_selected) {
+          the pointer. If the message is in an outbos and in sending
+          status disable drag and drop as well */
+       if (!already_selected || status == MODEST_TNY_SEND_QUEUE_SENDING)
                disable_drag_and_drop(self);
-       }
 
-       if (path != NULL) {
+       if (path != NULL)
                gtk_tree_path_free(path);
-       }
 
        return FALSE;
 }