* src/maemo/modest-msg-edit-window.c:
authorJose Dapena Paz <jdapena@igalia.com>
Wed, 9 May 2007 23:18:03 +0000 (23:18 +0000)
committerJose Dapena Paz <jdapena@igalia.com>
Wed, 9 May 2007 23:18:03 +0000 (23:18 +0000)
        * The color toolbar item is not focusable
* src/maemo/modest-msg-view-window.c:
        * Fixed an issue with clipboard management that prevented asynchronous
          message retrieving from working.
        * If we select an attachment with nested attahcments, it cannot be saved.
        * Dim delete and move to... actions if the message we're viewing is
          attached to a mail.
        * Dim copy and cut when there's no selection, or when focus is in attachments
          view.
* src/widgets/modest-attachment-view.c:
        * Fixed a warning, as we were passing homogeneous and spacing to the constructor
          and it's not a box now.

pmo-trunk-r1815

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

index 3ba9106..29f088a 100644 (file)
@@ -678,6 +678,7 @@ modest_msg_edit_window_setup_toolbar (ModestMsgEditWindow *window)
        /* font color */
        tool_item = GTK_WIDGET (gtk_tool_item_new ());
        priv->font_color_button = hildon_color_button_new ();
+       GTK_WIDGET_UNSET_FLAGS (tool_item, GTK_CAN_FOCUS);
        gtk_container_add (GTK_CONTAINER (tool_item), priv->font_color_button);
        gtk_tool_item_set_expand (GTK_TOOL_ITEM (tool_item), TRUE);
        gtk_tool_item_set_homogeneous (GTK_TOOL_ITEM (tool_item), TRUE);
@@ -1407,7 +1408,6 @@ modest_msg_edit_window_attach_file (ModestMsgEditWindow *window)
                        gchar *basename;
                        gchar *content_id;
                        
-                       /* TODO: get mime type */
                        mime_type = gnome_vfs_get_file_mime_type_fast (filename, NULL);
                        mime_part = tny_platform_factory_new_mime_part
                                (modest_runtime_get_platform_factory ());
index 9b28c0f..a0ffaad 100644 (file)
@@ -36,6 +36,7 @@
 #include <modest-maemo-utils.h>
 #include <modest-tny-msg.h>
 #include <modest-msg-view-window.h>
+#include <modest-attachments-view.h>
 #include <modest-main-window-ui.h>
 #include <modest-widget-memory.h>
 #include <modest-runtime.h>
@@ -382,10 +383,10 @@ init_window (ModestMsgViewWindow *obj, TnyMsg *msg)
        
        /* TODO: I dont knonw why, but when get_msg_async is used, */
        /* this code makes application doest not work (jfernandez) */
-       if (FALSE) {
+/*     if (FALSE) { */
                priv->clipboard_change_handler = g_signal_connect (G_OBJECT (gtk_clipboard_get (GDK_SELECTION_PRIMARY)), "owner-change", G_CALLBACK (modest_msg_view_window_clipboard_owner_change), obj);
-               modest_msg_view_window_clipboard_owner_change (gtk_clipboard_get (GDK_SELECTION_PRIMARY), NULL, obj);
-       }
+/*             modest_msg_view_window_clipboard_owner_change (gtk_clipboard_get (GDK_SELECTION_PRIMARY), NULL, obj); */
+/*     } */
        gtk_widget_show_all (GTK_WIDGET(main_vbox));
        gtk_box_pack_end (GTK_BOX (main_vbox), priv->find_toolbar, FALSE, FALSE, 0);
 }      
@@ -1007,6 +1008,7 @@ modest_msg_view_window_update_dimmed (ModestMsgViewWindow *window)
        GList *attachments, *node;
        gint n_selected;
        gboolean selected_messages = FALSE;
+       gboolean nested_attachments = FALSE;
 
        parent_priv = MODEST_WINDOW_GET_PRIVATE (window);
        priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (window);
@@ -1035,21 +1037,35 @@ modest_msg_view_window_update_dimmed (ModestMsgViewWindow *window)
        widget = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/MessageMenu/MessageForwardMenu");
        gtk_action_set_sensitive (widget, !is_not_sent);
 
+       /* Attachment actions dimming */
        attachments = modest_msg_view_get_selected_attachments (MODEST_MSG_VIEW (priv->msg_view));
        n_selected = g_list_length (attachments);
        for (node = attachments; node != NULL; node = g_list_next (node)) {
-               if (!tny_mime_part_is_attachment (TNY_MIME_PART (node->data))) {
+               TnyMimePart *mime_part = TNY_MIME_PART (node->data);
+               TnyList *nested_list = tny_simple_list_new ();
+               if (!tny_mime_part_is_attachment (mime_part)) {
                        selected_messages = TRUE;
                        break;
                }
+               tny_mime_part_get_parts (mime_part, nested_list);
+               if (tny_list_get_length (nested_list) > 0)
+                       nested_attachments = TRUE;
+               g_object_unref (nested_list);
        }
        g_list_free (attachments);
 
        widget = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/AttachmentsMenu/ViewAttachmentMenu");
        gtk_action_set_sensitive (widget, n_selected == 1);
        widget = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/AttachmentsMenu/SaveAttachmentMenu");
-       gtk_action_set_sensitive (widget, (n_selected > 0) && (!selected_messages));
-               
+       gtk_action_set_sensitive (widget, (n_selected > 0) && (!selected_messages) &&  (!nested_attachments));
+
+       /* Dimming depending of message being an attachment or not. It's not an attachment if
+        * we opened it outside a folder view */
+       widget = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/MessageMenu/MessageDeleteMenu");
+       gtk_action_set_sensitive (widget, priv->header_model != NULL);
+       widget = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/EditMenu/EditMoveToMenu");
+       gtk_action_set_sensitive (widget, priv->header_model != NULL);
+
 }
 
 static void
@@ -1204,6 +1220,7 @@ modest_msg_view_window_clipboard_owner_change (GtkClipboard *clipboard,
        GtkAction *action;
        gboolean is_address;
        gchar *selection;
+       GtkWidget *focused;
 
        parent_priv = MODEST_WINDOW_GET_PRIVATE (window);
        selection = gtk_clipboard_wait_for_text (clipboard);
@@ -1214,6 +1231,14 @@ modest_msg_view_window_clipboard_owner_change (GtkClipboard *clipboard,
        action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/ToolsMenu/ToolsAddToContactsMenu");
        gtk_action_set_sensitive (action, is_address);
 
+       focused = gtk_window_get_focus (GTK_WINDOW (window));
+
+       action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/EditMenu/EditCopyMenu");
+       gtk_action_set_sensitive (action, (selection != NULL) && (!MODEST_IS_ATTACHMENTS_VIEW (focused)));
+
+       action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/EditMenu/EditCutMenu");
+       gtk_action_set_sensitive (action, (selection != NULL) && (!MODEST_IS_ATTACHMENTS_VIEW (focused)));
+
        modest_msg_view_window_update_dimmed (window);
        
 }
index ad94f8b..ec3c2ca 100644 (file)
@@ -283,8 +283,6 @@ GtkWidget*
 modest_attachment_view_new (TnyMimePart *mime_part)
 {
        ModestAttachmentView *self = g_object_new (MODEST_TYPE_ATTACHMENT_VIEW, 
-                                                  "homogeneous", FALSE,
-                                                  "spacing", 0,
                                                   NULL);
 
        modest_attachment_view_set_part (TNY_MIME_PART_VIEW (self), mime_part);