* src/maemo/modest-msg-edit-window.c:
[modest] / src / maemo / modest-msg-edit-window.c
index 6ea1354..026a676 100644 (file)
@@ -1729,7 +1729,7 @@ text_buffer_refresh_attributes (WPTextBuffer *buffer, ModestMsgEditWindow *windo
 
 }
 
-
+#ifdef MODEST_HILDON_VERSION_0
 void
 modest_msg_edit_window_select_color (ModestMsgEditWindow *window)
 {
@@ -1738,43 +1738,69 @@ modest_msg_edit_window_select_color (ModestMsgEditWindow *window)
        ModestMsgEditWindowPrivate *priv;
        GtkWidget *dialog = NULL;
        gint response;
-       const GdkColor *new_color = NULL;
-       
+       GdkColor *new_color = NULL;
+
        priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (window);
        wp_text_buffer_get_attributes (WP_TEXT_BUFFER (priv->text_buffer), buffer_format, FALSE);
        
-#ifdef MODEST_HILDON_VERSION_0 
        dialog = hildon_color_selector_new (GTK_WINDOW (window));
        hildon_color_selector_set_color (HILDON_COLOR_SELECTOR (dialog), &(buffer_format->color));
-#else
+       g_free (buffer_format);
+
+       response = gtk_dialog_run (GTK_DIALOG (dialog));
+       switch (response) {
+       case GTK_RESPONSE_OK: {
+               new_color = hildon_color_selector_get_color (HILDON_COLOR_SELECTOR (dialog));
+       }
+               break;
+       default:
+               break;
+       }
+       gtk_widget_destroy (dialog);
+       
+       if (new_color != NULL) {
+               wp_text_buffer_set_attribute (WP_TEXT_BUFFER (priv->text_buffer), WPT_FORECOLOR, (gpointer) new_color);
+               /* FIXME: free new_color here? */
+       }
+}
+#else 
+void
+modest_msg_edit_window_select_color (ModestMsgEditWindow *window)
+{
+       
+       WPTextBufferFormat *buffer_format = g_new0 (WPTextBufferFormat, 1);
+       ModestMsgEditWindowPrivate *priv;
+       GtkWidget *dialog = NULL;
+       gint response;
+       const GdkColor *new_color = NULL;
+       GdkColor col;
+
+       priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (window);
+       wp_text_buffer_get_attributes (WP_TEXT_BUFFER (priv->text_buffer), buffer_format, FALSE);
+               
        dialog = hildon_color_chooser_new ();
        hildon_color_chooser_set_color (HILDON_COLOR_CHOOSER (dialog), &(buffer_format->color));
-#endif /*MODEST_HILDON_VERSION_0*/             
        g_free (buffer_format);
 
        response = gtk_dialog_run (GTK_DIALOG (dialog));
        switch (response) {
        case GTK_RESPONSE_OK: {
-#ifdef MODEST_HILDON_VERSION_0
-               new_color = hildon_color_selector_get_color (HILDON_COLOR_SELECTOR (dialog));
-#else
-               GdkColor col;
                hildon_color_chooser_get_color (HILDON_COLOR_CHOOSER(dialog), &col);
                new_color = &col;
-#endif /*MODEST_HILDON_VERSION_0*/
        }
-
-       break;
+               
+               break;
        default:
                break;
        }
        gtk_widget_destroy (dialog);
-
        if (new_color != NULL)
-               wp_text_buffer_set_attribute (WP_TEXT_BUFFER (priv->text_buffer), WPT_FORECOLOR, (gpointer) new_color);
-
+               wp_text_buffer_set_attribute (WP_TEXT_BUFFER (priv->text_buffer), WPT_FORECOLOR,
+                                             (gpointer) new_color);
 }
 
+#endif /*!MODEST_HILDON_VERSION_0*/
+
 void
 modest_msg_edit_window_select_background_color (ModestMsgEditWindow *window)
 {
@@ -2046,15 +2072,27 @@ modest_msg_edit_window_remove_attachments (ModestMsgEditWindow *window,
                gboolean dialog_response;
                GList *node;
                gchar *message = NULL;
-               const gchar *filename = NULL;
+               gchar *filename = NULL;
 
                if (att_list->next == NULL) {
-                       filename = tny_mime_part_get_filename (TNY_MIME_PART (att_list->data));
+                       if (TNY_IS_MSG (att_list->data)) {
+                               TnyHeader *header = tny_msg_get_header (TNY_MSG (att_list->data));
+                               if (header) {
+                                       filename = g_strdup (tny_header_get_subject (header));
+                                       g_object_unref (header);
+                               }
+                               if (filename == NULL) {
+                                       filename = g_strdup (_("mail_va_no_subject"));
+                               }
+                       } else {
+                               filename = g_strdup (tny_mime_part_get_filename (TNY_MIME_PART (att_list->data)));
+                       }
                } else {
-                       filename = "";
+                       filename = g_strdup ("");
                }
                message = g_strdup_printf (ngettext("emev_nc_delete_attachment", "emev_nc_delete_attachments",
                                                    att_list->next == NULL), filename);
+               g_free (filename);
                confirmation_dialog = hildon_note_new_confirmation (GTK_WINDOW (window), message);
                g_free (message);
                dialog_response = (gtk_dialog_run (GTK_DIALOG (confirmation_dialog))==GTK_RESPONSE_OK);