[evolution] I#289 - 'Search web' context menu option for selection in EWebView ][



commit c6cc50c652c1f6f308f296bb7f628ddf56059be0
Author: Milan Crha <mcrha redhat com>
Date:   Thu Feb 21 10:55:26 2019 +0100

    I#289 - 'Search web' context menu option for selection in EWebView ][
    
    Fix an issue in the EMailBrowser.
    
    Related to https://gitlab.gnome.org/GNOME/evolution/issues/289

 src/mail/e-mail-browser.c | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)
---
diff --git a/src/mail/e-mail-browser.c b/src/mail/e-mail-browser.c
index 4dca830bdb..113b2dec97 100644
--- a/src/mail/e-mail-browser.c
+++ b/src/mail/e-mail-browser.c
@@ -124,6 +124,19 @@ action_close_cb (GtkAction *action,
        e_mail_browser_close (browser);
 }
 
+static void
+action_search_web_cb (GtkAction *action,
+                     EMailReader *reader)
+{
+       EMailDisplay *display;
+       GtkAction *wv_action;
+
+       display = e_mail_reader_get_mail_display (reader);
+       wv_action = e_web_view_get_action (E_WEB_VIEW (display), "search-web");
+
+       gtk_action_activate (wv_action);
+}
+
 static GtkActionEntry mail_browser_entries[] = {
 
        { "close",
@@ -161,6 +174,13 @@ static GtkActionEntry mail_browser_entries[] = {
          N_("Select all text"),
          NULL },  /* Handled by EFocusTracker */
 
+       { "search-web",
+         NULL,
+         N_("Search _Web…"),
+         NULL,
+         N_("Search the Web with the selected text"),
+         G_CALLBACK (action_search_web_cb) },
+
        /*** Menus ***/
 
        { "file-menu",
@@ -668,7 +688,7 @@ mail_browser_constructed (GObject *object)
        EAttachmentStore *attachment_store;
        GtkAccelGroup *accel_group;
        GtkActionGroup *action_group;
-       GtkAction *action;
+       GtkAction *action, *mail_action;
        GtkUIManager *ui_manager;
        GtkWidget *container;
        GtkWidget *display;
@@ -738,6 +758,14 @@ mail_browser_constructed (GObject *object)
                G_N_ELEMENTS (mail_browser_popup_entries));
        gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
 
+       mail_action = e_web_view_get_action (E_WEB_VIEW (display), "search-web");
+       action = gtk_action_group_get_action (action_group, "search-web");
+
+       e_binding_bind_property (
+               mail_action, "sensitive",
+               action, "sensitive",
+               G_BINDING_SYNC_CREATE);
+
        /* For easy access.  Takes ownership of the reference. */
        g_object_set_data_full (
                object, ACTION_GROUP_STANDARD,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]