[evolution] I#312 - Allow change of magic-spacebar accelerators ][



commit 891755e0aea64fc89ef498a8ba6f9f13f308a95c
Author: Milan Crha <mcrha redhat com>
Date:   Wed Feb 5 16:20:26 2020 +0100

    I#312 - Allow change of magic-spacebar accelerators ][
    
    Missed the EMailBrowser bits.
    
    Related to https://gitlab.gnome.org/GNOME/evolution/issues/312

 data/ui/evolution-mail-reader.ui |  3 +++
 data/ui/evolution-mail.ui        |  3 ---
 src/mail/e-mail-browser.c        | 51 +++++++++++++++++++++++++++++++++++++---
 3 files changed, 51 insertions(+), 6 deletions(-)
---
diff --git a/data/ui/evolution-mail-reader.ui b/data/ui/evolution-mail-reader.ui
index ea90e50bb7..063f934335 100644
--- a/data/ui/evolution-mail-reader.ui
+++ b/data/ui/evolution-mail-reader.ui
@@ -1,4 +1,7 @@
 <ui evolution-ui-version="1.0">
+  <accelerator action='mail-smart-backward'/>
+  <accelerator action='mail-smart-forward'/>
+
   <menubar name='main-menu'>
     <menu action='file-menu'>
       <placeholder name='file-actions'>
diff --git a/data/ui/evolution-mail.ui b/data/ui/evolution-mail.ui
index 9148161742..1b2c1b3b68 100644
--- a/data/ui/evolution-mail.ui
+++ b/data/ui/evolution-mail.ui
@@ -1,7 +1,4 @@
 <ui evolution-ui-version="1.0">
-  <accelerator action='mail-smart-backward'/>
-  <accelerator action='mail-smart-forward'/>
-
   <menubar name='main-menu'>
     <menu action='file-menu'>
       <placeholder name='mail-send-receiver'>
diff --git a/src/mail/e-mail-browser.c b/src/mail/e-mail-browser.c
index c6e6096120..c51830c88a 100644
--- a/src/mail/e-mail-browser.c
+++ b/src/mail/e-mail-browser.c
@@ -137,6 +137,28 @@ action_search_web_cb (GtkAction *action,
        gtk_action_activate (wv_action);
 }
 
+static void
+action_mail_smart_backward_cb (GtkAction *action,
+                              EMailReader *reader)
+{
+       EMailDisplay *mail_display;
+
+       mail_display = e_mail_reader_get_mail_display (reader);
+
+       e_mail_display_process_magic_spacebar (mail_display, FALSE);
+}
+
+static void
+action_mail_smart_forward_cb (GtkAction *action,
+                             EMailReader *reader)
+{
+       EMailDisplay *mail_display;
+
+       mail_display = e_mail_reader_get_mail_display (reader);
+
+       e_mail_display_process_magic_spacebar (mail_display, TRUE);
+}
+
 static GtkActionEntry mail_browser_entries[] = {
 
        { "close",
@@ -205,6 +227,23 @@ static GtkActionEntry mail_browser_entries[] = {
          NULL }
 };
 
+static GtkActionEntry mail_entries[] = {
+
+       { "mail-smart-backward",
+         NULL,
+         NULL,
+         NULL,
+         NULL,
+         G_CALLBACK (action_mail_smart_backward_cb) },
+
+       { "mail-smart-forward",
+         NULL,
+         NULL,
+         NULL,
+         NULL,
+         G_CALLBACK (action_mail_smart_forward_cb) },
+};
+
 static EPopupActionEntry mail_browser_popup_entries[] = {
 
        { "popup-copy-clipboard",
@@ -423,8 +462,7 @@ mail_browser_key_press_event_cb (GtkWindow *mail_browser,
        GtkWidget *focused;
        EMailDisplay *mail_display;
 
-       if (!event || (event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK | GDK_MOD1_MASK)) != 0 ||
-           (event->keyval != GDK_KEY_space && event->keyval != GDK_KEY_BackSpace))
+       if (!event || (event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK | GDK_MOD1_MASK)) != 0)
                return FALSE;
 
        focused = gtk_window_get_focus (mail_browser);
@@ -441,7 +479,7 @@ mail_browser_key_press_event_cb (GtkWindow *mail_browser,
                return TRUE;
        }
 
-       return e_mail_display_process_magic_spacebar (mail_display, event->keyval == GDK_KEY_space);
+       return FALSE;
 }
 
 static void
@@ -748,6 +786,13 @@ mail_browser_constructed (GObject *object)
        browser->priv->preview_pane = g_object_ref (widget);
        gtk_widget_show (widget);
 
+       action_group = gtk_action_group_new ("mail");
+       gtk_action_group_set_translation_domain (action_group, domain);
+       gtk_action_group_add_actions (
+               action_group, mail_entries,
+               G_N_ELEMENTS (mail_entries), object);
+       gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
+
        action_group = gtk_action_group_new (ACTION_GROUP_STANDARD);
        gtk_action_group_set_translation_domain (action_group, domain);
        gtk_action_group_add_actions (


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