From: Jose Dapena Paz Date: Wed, 4 Jul 2007 13:13:10 +0000 (+0000) Subject: Added redo in editor (fixes NB#60257). X-Git-Tag: git_migration_finished~2975 X-Git-Url: http://git.maemo.org/git/?p=modest;a=commitdiff_plain;h=100393d4afa2ba078ea7da121f4121a253206b59 Added redo in editor (fixes NB#60257). * src/widget/modest-msg-edit-window.h, src/maemo/modest-msg-edit-window.c: * Added implementation for redo action, using wpeditor backend. * src/widgets/modest-msg-edit-window-ui.h: * Added redo action. * src/modest-ui-actions.[ch]: * Added redo ui action with implementation for editor. * src/maemo/ui/modest-msg-edit-window-ui.xml: * Added redo action. pmo-trunk-r2563 --- diff --git a/src/maemo/modest-msg-edit-window.c b/src/maemo/modest-msg-edit-window.c index fad4470..67f6917 100644 --- a/src/maemo/modest-msg-edit-window.c +++ b/src/maemo/modest-msg-edit-window.c @@ -101,6 +101,7 @@ 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, @@ -449,6 +450,8 @@ init_window (ModestMsgEditWindow *obj) 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); @@ -671,6 +674,7 @@ set_msg (ModestMsgEditWindow *self, TnyMsg *msg) 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); } @@ -2318,6 +2322,20 @@ modest_msg_edit_window_undo (ModestMsgEditWindow *window) } +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) { @@ -2415,6 +2433,16 @@ text_buffer_can_undo (GtkTextBuffer *buffer, gboolean can_undo, ModestMsgEditWin 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) { diff --git a/src/maemo/ui/modest-msg-edit-window-ui.xml b/src/maemo/ui/modest-msg-edit-window-ui.xml index 64c3e7b..7bdf687 100644 --- a/src/maemo/ui/modest-msg-edit-window-ui.xml +++ b/src/maemo/ui/modest-msg-edit-window-ui.xml @@ -44,6 +44,7 @@ + diff --git a/src/modest-ui-actions.c b/src/modest-ui-actions.c index 617dca5..8fa2044 100644 --- a/src/modest-ui-actions.c +++ b/src/modest-ui-actions.c @@ -2403,6 +2403,18 @@ modest_ui_actions_on_undo (GtkAction *action, } } +void +modest_ui_actions_on_redo (GtkAction *action, + ModestWindow *window) +{ + if (MODEST_IS_MSG_EDIT_WINDOW (window)) { + modest_msg_edit_window_redo (MODEST_MSG_EDIT_WINDOW (window)); + } + else { + g_return_if_reached (); + } +} + static void paste_msgs_cb (const GObject *object, gpointer user_data) diff --git a/src/modest-ui-actions.h b/src/modest-ui-actions.h index 868a672..b311969 100644 --- a/src/modest-ui-actions.h +++ b/src/modest-ui-actions.h @@ -243,6 +243,9 @@ void modest_ui_actions_on_password_requested (TnyAccountStore *account_store void modest_ui_actions_on_undo (GtkAction *action, ModestWindow *window); +void modest_ui_actions_on_redo (GtkAction *action, + ModestWindow *window); + void modest_ui_actions_on_cut (GtkAction *action, ModestWindow *window); diff --git a/src/widgets/modest-msg-edit-window-ui.h b/src/widgets/modest-msg-edit-window-ui.h index 5fc77bb..8e2d313 100644 --- a/src/widgets/modest-msg-edit-window-ui.h +++ b/src/widgets/modest-msg-edit-window-ui.h @@ -64,6 +64,7 @@ static const GtkActionEntry modest_msg_edit_action_entries [] = { { "AttachFile", NULL, N_("mcen_me_editor_attachfile"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_attach_file)}, { "RemoveAttachments", NULL, N_("mcen_me_inbox_remove_attachments"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_remove_attachments) }, { "Undo", NULL, N_("mcen_me_inbox_undo"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_undo)}, + { "Redo", NULL, N_("mcen_me_inbox_redo"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_redo)}, { "Cut", NULL, N_("mcen_me_inbox_cut"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_cut)}, { "Copy", NULL, N_("mcen_me_inbox_copy"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_copy)}, { "Paste", NULL, N_("mcen_me_inbox_paste"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_paste)}, diff --git a/src/widgets/modest-msg-edit-window.h b/src/widgets/modest-msg-edit-window.h index ea39433..b1fb3a0 100644 --- a/src/widgets/modest-msg-edit-window.h +++ b/src/widgets/modest-msg-edit-window.h @@ -294,6 +294,14 @@ void modest_msg_edit_window_select_font (ModestMsgEditWindow * void modest_msg_edit_window_undo (ModestMsgEditWindow *window); /** + * modest_msg_edit_window_redo: + * @window: a #ModestMsgEditWindow + * + * Revert last undo + */ +void modest_msg_edit_window_redo (ModestMsgEditWindow *window); + +/** * modest_msg_edit_window_select_contacts: * @window: a #ModestMsgEditWindow *