diff options
author | Xan Lopez <xlopez@igalia.com> | 2011-06-01 04:47:13 +0800 |
---|---|---|
committer | Xan Lopez <xlopez@igalia.com> | 2011-06-09 06:52:17 +0800 |
commit | a0f0e5368807f17685ec8836be24eef43541e329 (patch) | |
tree | 553fb56ace3379dcd2a67d7dd8427dacab0abf38 /src/popup-commands.c | |
parent | 490f0b5228d4972ba16ce375cf3a6989a20ae113 (diff) | |
download | gsoc2013-epiphany-a0f0e5368807f17685ec8836be24eef43541e329.tar.gz gsoc2013-epiphany-a0f0e5368807f17685ec8836be24eef43541e329.tar.zst gsoc2013-epiphany-a0f0e5368807f17685ec8836be24eef43541e329.zip |
Add suggestions to correct misspellings to the context menu
When the user right-clicks on a misspelled word a number of possible
corrections will be offered by Epiphany. Selecting one of them will
replace the misspelled word by the suggestion.
Diffstat (limited to 'src/popup-commands.c')
-rw-r--r-- | src/popup-commands.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/popup-commands.c b/src/popup-commands.c index e7064f16d..14867c411 100644 --- a/src/popup-commands.c +++ b/src/popup-commands.c @@ -479,6 +479,33 @@ save_temp_source (const char *address) } void +popup_replace_spelling (GtkAction *action, + EphyWindow *window) +{ + EphyEmbed *embed; + WebKitWebView *view; + WebKitWebFrame *frame; + WebKitDOMDOMSelection *selection; + WebKitDOMDocument *document; + WebKitDOMDOMWindow *default_view; + + embed = ephy_embed_container_get_active_child + (EPHY_EMBED_CONTAINER (window)); + g_return_if_fail (embed != NULL); + + view = WEBKIT_WEB_VIEW (ephy_embed_get_web_view (embed)); + g_return_if_fail (view != NULL); + + document = webkit_web_view_get_dom_document (view); + default_view = webkit_dom_document_get_default_view (document); + selection = webkit_dom_dom_window_get_selection (default_view); + webkit_dom_dom_selection_modify (selection, "move", "backward", "word"); + webkit_dom_dom_selection_modify (selection, "extend", "forward", "word"); + frame = webkit_web_view_get_focused_frame (view); + webkit_web_frame_replace_selection (frame, gtk_action_get_label (action)); +} + +void popup_cmd_open_image (GtkAction *action, EphyWindow *window) { |