[nautilus/wip/antoniof/gtk4-preparation-step-event-controllers: 111/122] files-view: Stop handling ::event




commit 16b04f84a3dbdfec286ae6017eaa0ae8292e6904
Author: António Fernandes <antoniof gnome org>
Date:   Sun Aug 8 20:09:04 2021 +0100

    files-view: Stop handling ::event
    
    The signal is gone in GTK4.
    
    Here, it's used to trigger the zoom actions when the zoom media keys
    are pressed.
    
    However, the zoom media keys are also already set as accelerators,
    since commit 593008d00d3777c44f3f41247ce0303aee447631
    
    Therefore, we can just drop this redundant code.

 src/nautilus-files-view.c | 55 -----------------------------------------------
 1 file changed, 55 deletions(-)
---
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index f63cb4b88..39e46536d 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -371,17 +371,6 @@ G_DEFINE_TYPE_WITH_CODE (NautilusFilesView,
                          G_IMPLEMENT_INTERFACE (NAUTILUS_TYPE_VIEW, nautilus_files_view_iface_init)
                          G_ADD_PRIVATE (NautilusFilesView));
 
-static const struct
-{
-    unsigned int keyval;
-    const char *action;
-} extra_view_keybindings [] =
-{
-    /* View actions */
-    { GDK_KEY_ZoomIn, "zoom-in" },
-    { GDK_KEY_ZoomOut, "zoom-out" },
-};
-
 /*
  * Floating Bar code
  */
@@ -9503,49 +9492,6 @@ nautilus_files_view_parent_set (GtkWidget *widget,
     }
 }
 
-static gboolean
-nautilus_files_view_event (GtkWidget *widget,
-                           GdkEvent  *event)
-{
-    NautilusFilesView *view;
-    NautilusFilesViewPrivate *priv;
-    guint keyval;
-
-    if (gdk_event_get_event_type (event) != GDK_KEY_PRESS)
-    {
-        return GDK_EVENT_PROPAGATE;
-    }
-
-    view = NAUTILUS_FILES_VIEW (widget);
-    priv = nautilus_files_view_get_instance_private (view);
-
-    if (G_UNLIKELY (!gdk_event_get_keyval (event, &keyval)))
-    {
-        g_return_val_if_reached (GDK_EVENT_PROPAGATE);
-    }
-
-    for (gint i = 0; i < G_N_ELEMENTS (extra_view_keybindings); i++)
-    {
-        if (extra_view_keybindings[i].keyval == keyval)
-        {
-            GAction *action;
-
-            action = g_action_map_lookup_action (G_ACTION_MAP (priv->view_action_group),
-                                                 extra_view_keybindings[i].action);
-
-            if (g_action_get_enabled (action))
-            {
-                g_action_activate (action, NULL);
-                return GDK_EVENT_STOP;
-            }
-
-            break;
-        }
-    }
-
-    return GDK_EVENT_PROPAGATE;
-}
-
 static NautilusQuery *
 nautilus_files_view_get_search_query (NautilusView *view)
 {
@@ -9700,7 +9646,6 @@ nautilus_files_view_class_init (NautilusFilesViewClass *klass)
     oclass->set_property = nautilus_files_view_set_property;
 
     widget_class->destroy = nautilus_files_view_destroy;
-    widget_class->event = nautilus_files_view_event;
     widget_class->parent_set = nautilus_files_view_parent_set;
     widget_class->grab_focus = nautilus_files_view_grab_focus;
 


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