static void remove_attachment_insensitive_press (GtkWidget *widget, ModestMsgEditWindow *editor);
static void zoom_insensitive_press (GtkWidget *widget, ModestMsgEditWindow *editor);
static void paste_insensitive_press (GtkWidget *widget, ModestMsgEditWindow *editor);
+static void copy_insensitive_press (GtkWidget *widget, ModestMsgEditWindow *editor);
static void setup_insensitive_handlers (ModestMsgEditWindow *editor);
static void reset_modified (ModestMsgEditWindow *editor);
static void text_buffer_refresh_attributes (WPTextBuffer *buffer, ModestMsgEditWindow *window);
static void text_buffer_delete_range (GtkTextBuffer *buffer, GtkTextIter *start, GtkTextIter *end, gpointer userdata);
static void text_buffer_can_undo (GtkTextBuffer *buffer, gboolean can_undo, ModestMsgEditWindow *window);
+static void text_buffer_can_redo (GtkTextBuffer *buffer, gboolean can_redo, ModestMsgEditWindow *window);
static void text_buffer_delete_images_by_id (GtkTextBuffer *buffer, const gchar * image_id);
static void subject_field_changed (GtkEditable *editable, ModestMsgEditWindow *window);
static void modest_msg_edit_window_color_button_change (ModestMsgEditWindow *window,
G_CALLBACK (text_buffer_delete_range), obj);
g_signal_connect (G_OBJECT (priv->text_buffer), "can-undo",
G_CALLBACK (text_buffer_can_undo), obj);
+ g_signal_connect (G_OBJECT (priv->text_buffer), "can-redo",
+ G_CALLBACK (text_buffer_can_redo), obj);
g_signal_connect (G_OBJECT (obj), "window-state-event",
G_CALLBACK (modest_msg_edit_window_window_state_event),
NULL);
update_dimmed (self);
text_buffer_can_undo (priv->text_buffer, FALSE, self);
+ text_buffer_can_redo (priv->text_buffer, FALSE, self);
priv->draft_msg = g_object_ref(msg);
}
else
data->html_body = NULL;
- data->attachments = priv->attachments; /* TODO: copy and free ? */
+ /* deep-copy the data */
+ GList *cursor = priv->attachments;
+ data->attachments = NULL;
+ while (cursor) {
+ if (!(TNY_IS_MIME_PART(cursor->data))) {
+ g_warning ("strange data in attachment list");
+ continue;
+ }
+ data->attachments = g_list_append (data->attachments,
+ g_object_ref (cursor->data));
+ cursor = g_list_next (cursor);
+ }
+
data->priority_flags = priv->priority_flags;
return data;
}
-/* TODO: We must duplicate this implementation for GNOME and Maemo, but that is unwise. */
+
+static void
+unref_gobject (GObject *obj, gpointer data)
+{
+ if (!G_IS_OBJECT(obj))
+ return;
+ g_object_unref (obj);
+}
+
void
modest_msg_edit_window_free_msg_data (ModestMsgEditWindow *edit_window,
MsgData *data)
g_object_unref (data->draft_msg);
data->draft_msg = NULL;
}
-
- g_list_foreach (data->attachments, (GFunc)g_free, NULL);
+
+ g_list_foreach (data->attachments, (GFunc)unref_gobject, NULL);
g_list_free (data->attachments);
- /* TODO: Free data->attachments? */
-
g_slice_free (MsgData, data);
}
gint file_format)
{
ModestMsgEditWindowPrivate *priv;
+ ModestWindowPrivate *parent_priv;
gint current_format;
g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window));
+ parent_priv = MODEST_WINDOW_GET_PRIVATE (window);
priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (window);
current_format = wp_text_buffer_is_rich_text (WP_TEXT_BUFFER (priv->text_buffer))
dialog = hildon_note_new_confirmation (NULL, _("emev_nc_formatting_lost"));
response = gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
- if (response == GTK_RESPONSE_OK)
+ if (response == GTK_RESPONSE_OK) {
wp_text_buffer_enable_rich_text (WP_TEXT_BUFFER (priv->text_buffer), FALSE);
+ } else {
+ GtkToggleAction *action = GTK_TOGGLE_ACTION (gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/FormatMenu/FileFormatMenu/FileFormatFormattedTextMenu"));
+ toggle_action_set_active_block_notify (action, TRUE);
+ }
}
break;
}
}
+void
+modest_msg_edit_window_redo (ModestMsgEditWindow *window)
+{
+ ModestMsgEditWindowPrivate *priv;
+
+ g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window));
+ priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (window);
+
+ wp_text_buffer_redo (WP_TEXT_BUFFER (priv->text_buffer));
+
+ update_dimmed (window);
+
+}
+
static void
update_dimmed (ModestMsgEditWindow *window)
{
widget = gtk_ui_manager_get_widget (parent_priv->ui_manager, "/MenuBar/EditMenu/PasteMenu");
g_signal_connect (G_OBJECT (widget), "insensitive-press", G_CALLBACK (paste_insensitive_press), window);
+ widget = gtk_ui_manager_get_widget (parent_priv->ui_manager, "/MenuBar/EditMenu/CopyMenu");
+ g_signal_connect (G_OBJECT (widget), "insensitive-press", G_CALLBACK (copy_insensitive_press), window);
}
static void
gtk_action_set_sensitive (action, can_undo);
}
+static void
+text_buffer_can_redo (GtkTextBuffer *buffer, gboolean can_redo, ModestMsgEditWindow *window)
+{
+ ModestWindowPrivate *parent_priv = MODEST_WINDOW_GET_PRIVATE (window);
+ GtkAction *action;
+
+ action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/EditMenu/RedoMenu");
+ gtk_action_set_sensitive (action, can_redo);
+}
+
static void
text_buffer_delete_images_by_id (GtkTextBuffer *buffer, const gchar * image_id)
{
}
+static void
+copy_insensitive_press (GtkWidget *widget, ModestMsgEditWindow *editor)
+{
+ hildon_banner_show_information (NULL, NULL, dgettext("hildon-common-strings", "ckct_ib_unable_to_copy"));
+
+}
+
static void
modest_msg_edit_window_system_clipboard_owner_change (GtkClipboard *clipboard,