[evolution/gnome-3-18] Bug 757342 - Menu key doesn't open context menu in Contacts view



commit bcb0e7fbd3ccebf3cffdbfbf308cd70e20b85abd
Author: Milan Crha <mcrha redhat com>
Date:   Tue Nov 3 11:52:49 2015 +0100

    Bug 757342 - Menu key doesn't open context menu in Contacts view

 addressbook/gui/widgets/e-addressbook-view.c |   33 ++++++++++++++++++++++++++
 addressbook/gui/widgets/e-minicard-view.c    |    4 +-
 2 files changed, 35 insertions(+), 2 deletions(-)
---
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c
index 7fe052c..463e49f 100644
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ b/addressbook/gui/widgets/e-addressbook-view.c
@@ -211,6 +211,15 @@ table_right_click (ETable *table,
        return TRUE;
 }
 
+static gboolean
+addressbook_view_popup_menu_cb (GtkWidget *widget,
+                               EAddressbookView *view)
+{
+       addressbook_view_emit_popup_event (view, NULL);
+
+       return TRUE;
+}
+
 static gint
 table_white_space_event (ETable *table,
                          GdkEvent *event,
@@ -329,6 +338,9 @@ addressbook_view_create_table_view (EAddressbookView *view,
                widget, "right_click",
                G_CALLBACK (table_right_click), view);
        g_signal_connect (
+               widget, "popup-menu",
+               G_CALLBACK (addressbook_view_popup_menu_cb), view);
+       g_signal_connect (
                widget, "white_space_event",
                G_CALLBACK (table_white_space_event), view);
        g_signal_connect_swapped (
@@ -380,6 +392,10 @@ addressbook_view_create_minicard_view (EAddressbookView *view,
                minicard_view, "right_click",
                G_CALLBACK (addressbook_view_emit_popup_event), view);
 
+       g_signal_connect (
+               minicard_view, "popup-menu",
+               G_CALLBACK (addressbook_view_popup_menu_cb), view);
+
        view->priv->object = G_OBJECT (minicard_view);
 
        gtk_container_add (GTK_CONTAINER (view), minicard_view);
@@ -416,6 +432,21 @@ addressbook_view_display_view_cb (GalViewInstance *view_instance,
        command_state_change (view);
 }
 
+static gboolean
+address_book_view_focus_in_cb (EAddressbookView *view,
+                              GdkEvent *event)
+{
+       GtkWidget *child;
+
+       g_return_val_if_fail (E_IS_ADDRESSBOOK_VIEW (view), FALSE);
+
+       child = gtk_bin_get_child (GTK_BIN (view));
+       if (child)
+               gtk_widget_grab_focus (child);
+
+       return child != NULL;
+}
+
 static void
 addressbook_view_set_shell_view (EAddressbookView *view,
                                  EShellView *shell_view)
@@ -608,6 +639,8 @@ addressbook_view_constructed (GObject *object)
 
        /* Chain up to parent's constructed() method. */
        G_OBJECT_CLASS (e_addressbook_view_parent_class)->constructed (object);
+
+       g_signal_connect (object, "focus-in-event", G_CALLBACK (address_book_view_focus_in_cb), NULL);
 }
 
 static void
diff --git a/addressbook/gui/widgets/e-minicard-view.c b/addressbook/gui/widgets/e-minicard-view.c
index 7f2160f..a7b1f61 100644
--- a/addressbook/gui/widgets/e-minicard-view.c
+++ b/addressbook/gui/widgets/e-minicard-view.c
@@ -424,8 +424,8 @@ e_minicard_view_event (GnomeCanvasItem *item,
                        e_minicard_view_right_click (view, event);
                break;
        case GDK_KEY_PRESS:
-               if (event->key.keyval & GDK_SHIFT_MASK &&
-                       event->key.keyval == GDK_KEY_F10) {
+               if (((event->key.state & GDK_SHIFT_MASK) != 0 && event->key.keyval == GDK_KEY_F10) ||
+                   ((event->key.state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK)) == 0 && 
event->key.keyval == GDK_KEY_Menu)) {
                        e_minicard_view_right_click (view, event);
                }
                break;


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