[gtk/shortcuts-rebased-again: 95/129] accels: Remove GtkAccelGroup



commit db6f6c35416ff20c0c416342aae71214bc76fd1a
Author: Benjamin Otte <otte redhat com>
Date:   Fri Aug 24 08:46:54 2018 +0200

    accels: Remove GtkAccelGroup

 demos/gtk-demo/main.c                |   1 -
 demos/gtk-demo/menus.c               |   4 -
 docs/reference/gtk/gtk4-docs.xml     |   1 -
 docs/reference/gtk/gtk4-sections.txt |  37 --
 docs/reference/gtk/gtk4.types.in     |   1 -
 gtk/a11y/gtkmenuitemaccessible.c     |  40 +--
 gtk/gtkaccelgroup.c                  | 647 -----------------------------------
 gtk/gtkaccelgroup.h                  | 158 ---------
 gtk/gtkaccelgroupprivate.h           |   9 -
 gtk/gtkaccellabel.c                  | 243 +------------
 gtk/gtkaccellabel.h                  |   8 -
 gtk/gtkmain.c                        |   9 +-
 gtk/gtkmenu.c                        |  72 ----
 gtk/gtkmenu.h                        |   6 -
 gtk/gtkmenuitem.c                    |   2 -
 gtk/gtkmenuprivate.h                 |   2 -
 gtk/gtkwindow.c                      | 311 +----------------
 gtk/gtkwindow.h                      |   6 -
 gtk/gtkwindowprivate.h               |   3 -
 19 files changed, 12 insertions(+), 1548 deletions(-)
---
diff --git a/demos/gtk-demo/main.c b/demos/gtk-demo/main.c
index 6b997f5810..37ff17303b 100644
--- a/demos/gtk-demo/main.c
+++ b/demos/gtk-demo/main.c
@@ -310,7 +310,6 @@ static gchar *types[] =
   "GtkIconView ",
   "GtkCellRendererText ",
   "GtkContainer ",
-  "GtkAccelGroup ",
   "GtkPaned ",
   "GtkPrintOperation ",
   "GtkPrintContext ",
diff --git a/demos/gtk-demo/menus.c b/demos/gtk-demo/menus.c
index 83aef5d069..1d943fd887 100644
--- a/demos/gtk-demo/menus.c
+++ b/demos/gtk-demo/menus.c
@@ -87,7 +87,6 @@ do_menus (GtkWidget *do_widget)
       GtkWidget *menubar;
       GtkWidget *menu;
       GtkWidget *menuitem;
-      GtkAccelGroup *accel_group;
 
       window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
       gtk_window_set_display (GTK_WINDOW (window),
@@ -96,9 +95,6 @@ do_menus (GtkWidget *do_widget)
       g_signal_connect (window, "destroy",
                         G_CALLBACK(gtk_widget_destroyed), &window);
 
-      accel_group = gtk_accel_group_new ();
-      gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
-
       box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
       gtk_container_add (GTK_CONTAINER (window), box);
 
diff --git a/docs/reference/gtk/gtk4-docs.xml b/docs/reference/gtk/gtk4-docs.xml
index 682f9b151a..9554d968b5 100644
--- a/docs/reference/gtk/gtk4-docs.xml
+++ b/docs/reference/gtk/gtk4-docs.xml
@@ -355,7 +355,6 @@
     <title>GTK Core Reference</title>
     <xi:include href="xml/gtkmain.xml" />
     <xi:include href="xml/gtkfeatures.xml" />
-    <xi:include href="xml/gtkaccelgroup.xml" />
     <xi:include href="xml/gtkdnd.xml" />
     <xi:include href="xml/gtksettings.xml" />
     <xi:include href="xml/gtkenums.xml" />
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index 9a612085b8..65bc29c3a5 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -53,21 +53,6 @@ gtk_about_dialog_get_type
 <SECTION>
 <FILE>gtkaccelgroup</FILE>
 <TITLE>Keyboard Accelerators</TITLE>
-GtkAccelGroup
-GtkAccelGroupClass
-gtk_accel_group_new
-GtkAccelFlags
-gtk_accel_group_connect
-GtkAccelGroupActivate
-GtkAccelGroupFindFunc
-gtk_accel_group_disconnect
-gtk_accel_group_disconnect_key
-gtk_accel_group_activate
-gtk_accel_group_from_accel_closure
-gtk_accel_groups_activate
-gtk_accel_groups_from_object
-gtk_accel_group_find
-GtkAccelKey
 gtk_accelerator_valid
 gtk_accelerator_parse
 gtk_accelerator_name
@@ -77,21 +62,6 @@ gtk_accelerator_name_with_keycode
 gtk_accelerator_get_label_with_keycode
 gtk_accelerator_set_default_mod_mask
 gtk_accelerator_get_default_mod_mask
-
-<SUBSECTION Standard>
-GTK_TYPE_ACCEL_GROUP
-GTK_ACCEL_GROUP
-GTK_IS_ACCEL_GROUP
-GTK_ACCEL_GROUP_CLASS
-GTK_IS_ACCEL_GROUP_CLASS
-GTK_ACCEL_GROUP_GET_CLASS
-
-<SUBSECTION Private>
-GTK_ACCEL_GROUP_GET_PRIVATE
-GtkAccelGroupPrivate
-GtkAccelGroupEntry
-gtk_accel_group_query
-gtk_accel_group_get_type
 </SECTION>
 
 <SECTION>
@@ -99,9 +69,6 @@ gtk_accel_group_get_type
 <TITLE>GtkAccelLabel</TITLE>
 GtkAccelLabel
 gtk_accel_label_new
-gtk_accel_label_set_accel_closure
-gtk_accel_label_get_accel_widget
-gtk_accel_label_set_accel_widget
 gtk_accel_label_get_accel_width
 gtk_accel_label_set_accel
 gtk_accel_label_get_accel
@@ -1754,8 +1721,6 @@ gtk_menu_reorder_child
 gtk_menu_popup_at_rect
 gtk_menu_popup_at_widget
 gtk_menu_popup_at_pointer
-gtk_menu_set_accel_group
-gtk_menu_get_accel_group
 gtk_menu_set_monitor
 gtk_menu_get_monitor
 gtk_menu_place_on_monitor
@@ -4622,8 +4587,6 @@ gtk_window_new
 gtk_window_set_title
 gtk_window_set_resizable
 gtk_window_get_resizable
-gtk_window_add_accel_group
-gtk_window_remove_accel_group
 gtk_window_set_modal
 gtk_window_set_default_size
 gtk_window_set_hide_on_close
diff --git a/docs/reference/gtk/gtk4.types.in b/docs/reference/gtk/gtk4.types.in
index c51c8bf48d..c26895cbae 100644
--- a/docs/reference/gtk/gtk4.types.in
+++ b/docs/reference/gtk/gtk4.types.in
@@ -1,5 +1,4 @@
 gtk_about_dialog_get_type
-gtk_accel_group_get_type
 gtk_accel_label_get_type
 gtk_accessible_get_type
 gtk_actionable_get_type
diff --git a/gtk/a11y/gtkmenuitemaccessible.c b/gtk/a11y/gtkmenuitemaccessible.c
index 62e1a14497..94eb5845e4 100644
--- a/gtk/a11y/gtkmenuitemaccessible.c
+++ b/gtk/a11y/gtkmenuitemaccessible.c
@@ -446,25 +446,6 @@ gtk_menu_item_accessible_action_get_description (AtkAction *action,
   return NULL;
 }
 
-static gboolean
-find_accel_by_widget (GtkAccelKey *key,
-                      GClosure    *closure,
-                      gpointer     data)
-{
-  /* We assume that closure->data points to the widget
-   * pending gtk_widget_get_accel_closures being made public
-   */
-  return data == (gpointer) closure->data;
-}
-
-static gboolean
-find_accel_by_closure (GtkAccelKey *key,
-                       GClosure    *closure,
-                       gpointer     data)
-{
-  return data == (gpointer) closure;
-}
-
 static GtkWidget *
 find_item_label (GtkWidget *item)
 {
@@ -593,30 +574,19 @@ gtk_menu_item_accessible_get_keybinding (AtkAction *action,
         
       if (!accelerator)
         {
-          GtkAccelGroup *group;
-          GtkAccelKey *key = NULL;
+          guint key = 0;
+          GdkModifierType modifiers = 0;
 
-          group = gtk_menu_get_accel_group (GTK_MENU (parent));
-          if (group)
-            key = gtk_accel_group_find (group, find_accel_by_widget, item);
-          else if (GTK_IS_ACCEL_LABEL (child))
+          if (GTK_IS_ACCEL_LABEL (child))
             {
               GtkAccelLabel *accel_label;
-              GClosure      *accel_closure;
 
               accel_label = GTK_ACCEL_LABEL (child);
-              g_object_get (accel_label, "accel-closure", &accel_closure, NULL);
-              if (accel_closure)
-                {
-                  key = gtk_accel_group_find (gtk_accel_group_from_accel_closure (accel_closure),
-                                              find_accel_by_closure,
-                                              accel_closure);
-                  g_closure_unref (accel_closure);
-                }
+              gtk_accel_label_get_accel (accel_label, &key, &modifiers);
             }
 
          if (key)
-           accelerator = gtk_accelerator_name (key->accel_key, key->accel_mods);
+           accelerator = gtk_accelerator_name (key, modifiers);
         }
    }
 
diff --git a/gtk/gtkaccelgroup.c b/gtk/gtkaccelgroup.c
index 1d13d0fca3..9b013be570 100644
--- a/gtk/gtkaccelgroup.c
+++ b/gtk/gtkaccelgroup.c
@@ -55,658 +55,11 @@
  * and mnemonics, of course.
  */
 
-/* --- prototypes --- */
-static void gtk_accel_group_finalize     (GObject    *object);
-static void accel_closure_invalidate     (gpointer    data,
-                                          GClosure   *closure);
-
-
 /* --- variables --- */
-static guint  signal_accel_activate      = 0;
-static guint  signal_accel_changed       = 0;
-static guint  quark_acceleratable_groups = 0;
 static guint  default_accel_mod_mask     = 0;
 
-G_DEFINE_TYPE_WITH_PRIVATE (GtkAccelGroup, gtk_accel_group, G_TYPE_OBJECT)
-
 
 /* --- functions --- */
-static void
-gtk_accel_group_class_init (GtkAccelGroupClass *class)
-{
-  GObjectClass *object_class = G_OBJECT_CLASS (class);
-
-  quark_acceleratable_groups = g_quark_from_static_string ("gtk-acceleratable-accel-groups");
-
-  object_class->finalize = gtk_accel_group_finalize;
-
-  class->accel_changed = NULL;
-
-  /**
-   * GtkAccelGroup::accel-activate:
-   * @accel_group: the #GtkAccelGroup which received the signal
-   * @acceleratable: the object on which the accelerator was activated
-   * @keyval: the accelerator keyval
-   * @modifier: the modifier combination of the accelerator
-   *
-   * The accel-activate signal is an implementation detail of
-   * #GtkAccelGroup and not meant to be used by applications.
-   *
-   * Returns: %TRUE if the accelerator was activated
-   */
-  signal_accel_activate =
-    g_signal_new (I_("accel-activate"),
-                  G_OBJECT_CLASS_TYPE (class),
-                  G_SIGNAL_DETAILED,
-                  0,
-                  _gtk_boolean_handled_accumulator, NULL,
-                  _gtk_marshal_BOOLEAN__OBJECT_UINT_FLAGS,
-                  G_TYPE_BOOLEAN, 3,
-                  G_TYPE_OBJECT,
-                  G_TYPE_UINT,
-                  GDK_TYPE_MODIFIER_TYPE);
-  /**
-   * GtkAccelGroup::accel-changed:
-   * @accel_group: the #GtkAccelGroup which received the signal
-   * @keyval: the accelerator keyval
-   * @modifier: the modifier combination of the accelerator
-   * @accel_closure: the #GClosure of the accelerator
-   *
-   * The accel-changed signal is emitted when an entry
-   * is added to or removed from the accel group.
-   *
-   * Widgets like #GtkAccelLabel which display an associated
-   * accelerator should connect to this signal, and rebuild
-   * their visual representation if the @accel_closure is theirs.
-   */
-  signal_accel_changed =
-    g_signal_new (I_("accel-changed"),
-                  G_OBJECT_CLASS_TYPE (class),
-                  G_SIGNAL_RUN_FIRST | G_SIGNAL_DETAILED,
-                  G_STRUCT_OFFSET (GtkAccelGroupClass, accel_changed),
-                  NULL, NULL,
-                  _gtk_marshal_VOID__UINT_FLAGS_BOXED,
-                  G_TYPE_NONE, 3,
-                  G_TYPE_UINT,
-                  GDK_TYPE_MODIFIER_TYPE,
-                  G_TYPE_CLOSURE);
-}
-
-static void
-gtk_accel_group_finalize (GObject *object)
-{
-  GtkAccelGroup *accel_group = GTK_ACCEL_GROUP (object);
-  guint i;
-
-  for (i = 0; i < accel_group->priv->n_accels; i++)
-    {
-      GtkAccelGroupEntry *entry = &accel_group->priv->priv_accels[i];
-
-      g_closure_remove_invalidate_notifier (entry->closure, accel_group, accel_closure_invalidate);
-
-      /* remove quick_accel_add() refcount */
-      g_closure_unref (entry->closure);
-    }
-
-  g_free (accel_group->priv->priv_accels);
-
-  G_OBJECT_CLASS (gtk_accel_group_parent_class)->finalize (object);
-}
-
-static void
-gtk_accel_group_init (GtkAccelGroup *accel_group)
-{
-  GtkAccelGroupPrivate *priv;
-
-  accel_group->priv = gtk_accel_group_get_instance_private (accel_group);
-  priv = accel_group->priv;
-
-  priv->acceleratables = NULL;
-  priv->n_accels = 0;
-  priv->priv_accels = NULL;
-}
-
-/**
- * gtk_accel_group_new:
- *
- * Creates a new #GtkAccelGroup.
- *
- * Returns: a new #GtkAccelGroup object
- */
-GtkAccelGroup*
-gtk_accel_group_new (void)
-{
-  return g_object_new (GTK_TYPE_ACCEL_GROUP, NULL);
-}
-
-static void
-accel_group_weak_ref_detach (GSList  *free_list,
-                             GObject *stale_object)
-{
-  GSList *slist;
-
-  for (slist = free_list; slist; slist = slist->next)
-    {
-      GtkAccelGroup *accel_group;
-
-      accel_group = slist->data;
-      accel_group->priv->acceleratables = g_slist_remove (accel_group->priv->acceleratables, stale_object);
-      g_object_unref (accel_group);
-    }
-  g_slist_free (free_list);
-  g_object_set_qdata (stale_object, quark_acceleratable_groups, NULL);
-}
-
-void
-_gtk_accel_group_attach (GtkAccelGroup *accel_group,
-                         GObject       *object)
-{
-  GSList *slist;
-
-  g_return_if_fail (GTK_IS_ACCEL_GROUP (accel_group));
-  g_return_if_fail (G_IS_OBJECT (object));
-  g_return_if_fail (g_slist_find (accel_group->priv->acceleratables, object) == NULL);
-
-  g_object_ref (accel_group);
-  accel_group->priv->acceleratables = g_slist_prepend (accel_group->priv->acceleratables, object);
-  slist = g_object_get_qdata (object, quark_acceleratable_groups);
-  if (slist)
-    g_object_weak_unref (object,
-                         (GWeakNotify) accel_group_weak_ref_detach,
-                         slist);
-  slist = g_slist_prepend (slist, accel_group);
-  g_object_set_qdata (object, quark_acceleratable_groups, slist);
-  g_object_weak_ref (object,
-                     (GWeakNotify) accel_group_weak_ref_detach,
-                     slist);
-}
-
-void
-_gtk_accel_group_detach (GtkAccelGroup *accel_group,
-                         GObject       *object)
-{
-  GSList *slist;
-
-  g_return_if_fail (GTK_IS_ACCEL_GROUP (accel_group));
-  g_return_if_fail (G_IS_OBJECT (object));
-  g_return_if_fail (g_slist_find (accel_group->priv->acceleratables, object) != NULL);
-
-  accel_group->priv->acceleratables = g_slist_remove (accel_group->priv->acceleratables, object);
-  slist = g_object_get_qdata (object, quark_acceleratable_groups);
-  g_object_weak_unref (object,
-                       (GWeakNotify) accel_group_weak_ref_detach,
-                       slist);
-  slist = g_slist_remove (slist, accel_group);
-  g_object_set_qdata (object, quark_acceleratable_groups, slist);
-  if (slist)
-    g_object_weak_ref (object,
-                       (GWeakNotify) accel_group_weak_ref_detach,
-                       slist);
-  g_object_unref (accel_group);
-}
-
-/**
- * gtk_accel_groups_from_object:
- * @object: a #GObject, usually a #GtkWindow
- *
- * Gets a list of all accel groups which are attached to @object.
- *
- * Returns: (element-type GtkAccelGroup) (transfer none): a list of
- *     all accel groups which are attached to @object
- */
-GSList*
-gtk_accel_groups_from_object (GObject *object)
-{
-  g_return_val_if_fail (G_IS_OBJECT (object), NULL);
-
-  return g_object_get_qdata (object, quark_acceleratable_groups);
-}
-
-/**
- * gtk_accel_group_find:
- * @accel_group: a #GtkAccelGroup
- * @find_func: (scope call): a function to filter the entries
- *    of @accel_group with
- * @data: data to pass to @find_func
- *
- * Finds the first entry in an accelerator group for which
- * @find_func returns %TRUE and returns its #GtkAccelKey.
- *
- * Returns: (transfer none): the key of the first entry passing
- *    @find_func. The key is owned by GTK+ and must not be freed.
- */
-GtkAccelKey*
-gtk_accel_group_find (GtkAccelGroup         *accel_group,
-                      GtkAccelGroupFindFunc  find_func,
-                      gpointer               data)
-{
-  GtkAccelKey *key = NULL;
-  guint i;
-
-  g_return_val_if_fail (GTK_IS_ACCEL_GROUP (accel_group), NULL);
-  g_return_val_if_fail (find_func != NULL, NULL);
-
-  g_object_ref (accel_group);
-  for (i = 0; i < accel_group->priv->n_accels; i++)
-    if (find_func (&accel_group->priv->priv_accels[i].key,
-                   accel_group->priv->priv_accels[i].closure,
-                   data))
-      {
-        key = &accel_group->priv->priv_accels[i].key;
-        break;
-      }
-  g_object_unref (accel_group);
-
-  return key;
-}
-
-static void
-accel_closure_invalidate (gpointer  data,
-                          GClosure *closure)
-{
-  GtkAccelGroup *accel_group = GTK_ACCEL_GROUP (data);
-
-  gtk_accel_group_disconnect (accel_group, closure);
-}
-
-static int
-bsearch_compare_accels (const void *d1,
-                        const void *d2)
-{
-  const GtkAccelGroupEntry *entry1 = d1;
-  const GtkAccelGroupEntry *entry2 = d2;
-
-  if (entry1->key.accel_key == entry2->key.accel_key)
-    return entry1->key.accel_mods < entry2->key.accel_mods ? -1 : entry1->key.accel_mods > 
entry2->key.accel_mods;
-  else
-    return entry1->key.accel_key < entry2->key.accel_key ? -1 : 1;
-}
-
-static void
-quick_accel_add (GtkAccelGroup   *accel_group,
-                 guint            accel_key,
-                 GdkModifierType  accel_mods,
-                 GtkAccelFlags    accel_flags,
-                 GClosure        *closure)
-{
-  guint pos, i = accel_group->priv->n_accels++;
-  GtkAccelGroupEntry key;
-
-  /* find position */
-  key.key.accel_key = accel_key;
-  key.key.accel_mods = accel_mods;
-  for (pos = 0; pos < i; pos++)
-    if (bsearch_compare_accels (&key, accel_group->priv->priv_accels + pos) < 0)
-      break;
-
-  /* insert at position, ref closure */
-  accel_group->priv->priv_accels = g_renew (GtkAccelGroupEntry, accel_group->priv->priv_accels, 
accel_group->priv->n_accels);
-  memmove (accel_group->priv->priv_accels + pos + 1, accel_group->priv->priv_accels + pos,
-           (i - pos) * sizeof (accel_group->priv->priv_accels[0]));
-  accel_group->priv->priv_accels[pos].key.accel_key = accel_key;
-  accel_group->priv->priv_accels[pos].key.accel_mods = accel_mods;
-  accel_group->priv->priv_accels[pos].key.accel_flags = accel_flags;
-  accel_group->priv->priv_accels[pos].closure = g_closure_ref (closure);
-  g_closure_sink (closure);
-
-  /* handle closure invalidation and reverse lookups */
-  g_closure_add_invalidate_notifier (closure, accel_group, accel_closure_invalidate);
-
-  /* connect and notify changed */
-  if (accel_key)
-    {
-      gchar *accel_name = gtk_accelerator_name (accel_key, accel_mods);
-      GQuark accel_quark = g_quark_from_string (accel_name);
-
-      g_free (accel_name);
-
-      /* setup handler */
-      g_signal_connect_closure_by_id (accel_group, signal_accel_activate, accel_quark, closure, FALSE);
-
-      /* and notify */
-      g_signal_emit (accel_group, signal_accel_changed, accel_quark, accel_key, accel_mods, closure);
-    }
-}
-
-static void
-quick_accel_remove (GtkAccelGroup *accel_group,
-                    guint          pos)
-{
-  GQuark accel_quark = 0;
-  GtkAccelGroupEntry *entry = accel_group->priv->priv_accels + pos;
-  guint accel_key = entry->key.accel_key;
-  GdkModifierType accel_mods = entry->key.accel_mods;
-  GClosure *closure = entry->closure;
-
-  /* quark for notification */
-  if (accel_key)
-    {
-      gchar *accel_name = gtk_accelerator_name (accel_key, accel_mods);
-
-      accel_quark = g_quark_from_string (accel_name);
-      g_free (accel_name);
-    }
-
-  /* clean up closure invalidate notification and disconnect */
-  g_closure_remove_invalidate_notifier (entry->closure, accel_group, accel_closure_invalidate);
-  if (accel_quark)
-    g_signal_handlers_disconnect_matched (accel_group,
-                                          G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DETAIL | G_SIGNAL_MATCH_CLOSURE,
-                                          signal_accel_activate, accel_quark,
-                                          closure, NULL, NULL);
-
-  /* physically remove */
-  accel_group->priv->n_accels -= 1;
-  memmove (entry, entry + 1,
-           (accel_group->priv->n_accels - pos) * sizeof (accel_group->priv->priv_accels[0]));
-
-  /* and notify */
-  if (accel_quark)
-    g_signal_emit (accel_group, signal_accel_changed, accel_quark, accel_key, accel_mods, closure);
-
-  /* remove quick_accel_add() refcount */
-  g_closure_unref (closure);
-}
-
-static GtkAccelGroupEntry*
-quick_accel_find (GtkAccelGroup   *accel_group,
-                  guint            accel_key,
-                  GdkModifierType  accel_mods,
-                  guint           *count_p)
-{
-  GtkAccelGroupEntry *entry;
-  GtkAccelGroupEntry key;
-
-  *count_p = 0;
-
-  if (!accel_group->priv->n_accels)
-    return NULL;
-
-  key.key.accel_key = accel_key;
-  key.key.accel_mods = accel_mods;
-  entry = bsearch (&key, accel_group->priv->priv_accels, accel_group->priv->n_accels,
-                   sizeof (accel_group->priv->priv_accels[0]), bsearch_compare_accels);
-
-  if (!entry)
-    return NULL;
-
-  /* step back to the first member */
-  for (; entry > accel_group->priv->priv_accels; entry--)
-    if (entry[-1].key.accel_key != accel_key ||
-        entry[-1].key.accel_mods != accel_mods)
-      break;
-  /* count equal members */
-  for (; entry + *count_p < accel_group->priv->priv_accels + accel_group->priv->n_accels; (*count_p)++)
-    if (entry[*count_p].key.accel_key != accel_key ||
-        entry[*count_p].key.accel_mods != accel_mods)
-      break;
-  return entry;
-}
-
-/**
- * gtk_accel_group_connect:
- * @accel_group: the accelerator group to install an accelerator in
- * @accel_key: key value of the accelerator
- * @accel_mods: modifier combination of the accelerator
- * @accel_flags: a flag mask to configure this accelerator
- * @closure: closure to be executed upon accelerator activation
- *
- * Installs an accelerator in this group. When @accel_group is being
- * activated in response to a call to gtk_accel_groups_activate(),
- * @closure will be invoked if the @accel_key and @accel_mods from
- * gtk_accel_groups_activate() match those of this connection.
- *
- * The signature used for the @closure is that of #GtkAccelGroupActivate.
- *
- * Note that, due to implementation details, a single closure can
- * only be connected to one accelerator group.
- */
-void
-gtk_accel_group_connect (GtkAccelGroup   *accel_group,
-                         guint            accel_key,
-                         GdkModifierType  accel_mods,
-                         GtkAccelFlags    accel_flags,
-                         GClosure        *closure)
-{
-  g_return_if_fail (GTK_IS_ACCEL_GROUP (accel_group));
-  g_return_if_fail (closure != NULL);
-  g_return_if_fail (accel_key > 0);
-  g_return_if_fail (gtk_accel_group_from_accel_closure (closure) == NULL);
-
-  g_object_ref (accel_group);
-  if (!closure->is_invalid)
-    quick_accel_add (accel_group,
-                     gdk_keyval_to_lower (accel_key),
-                     accel_mods, accel_flags, closure);
-  g_object_unref (accel_group);
-}
-
-/**
- * gtk_accel_group_disconnect:
- * @accel_group: the accelerator group to remove an accelerator from
- * @closure: (allow-none): the closure to remove from this accelerator
- *     group, or %NULL to remove all closures
- *
- * Removes an accelerator previously installed through
- * gtk_accel_group_connect().
- *
- * Returns: %TRUE if the closure was found and got disconnected
- */
-gboolean
-gtk_accel_group_disconnect (GtkAccelGroup *accel_group,
-                            GClosure      *closure)
-{
-  guint i;
-
-  g_return_val_if_fail (GTK_IS_ACCEL_GROUP (accel_group), FALSE);
-
-  for (i = 0; i < accel_group->priv->n_accels; i++)
-    if (accel_group->priv->priv_accels[i].closure == closure)
-      {
-        g_object_ref (accel_group);
-        quick_accel_remove (accel_group, i);
-        g_object_unref (accel_group);
-        return TRUE;
-      }
-  return FALSE;
-}
-
-/**
- * gtk_accel_group_disconnect_key:
- * @accel_group: the accelerator group to install an accelerator in
- * @accel_key: key value of the accelerator
- * @accel_mods: modifier combination of the accelerator
- *
- * Removes an accelerator previously installed through
- * gtk_accel_group_connect().
- *
- * Returns: %TRUE if there was an accelerator which could be
- *     removed, %FALSE otherwise
- */
-gboolean
-gtk_accel_group_disconnect_key (GtkAccelGroup   *accel_group,
-                                guint            accel_key,
-                                GdkModifierType  accel_mods)
-{
-  GtkAccelGroupEntry *entries;
-  GSList *slist, *clist = NULL;
-  gboolean removed_one = FALSE;
-  guint n;
-
-  g_return_val_if_fail (GTK_IS_ACCEL_GROUP (accel_group), FALSE);
-
-  g_object_ref (accel_group);
-
-  accel_key = gdk_keyval_to_lower (accel_key);
-  entries = quick_accel_find (accel_group, accel_key, accel_mods, &n);
-  while (n--)
-    {
-      GClosure *closure = g_closure_ref (entries[n].closure);
-
-      clist = g_slist_prepend (clist, closure);
-    }
-
-  for (slist = clist; slist; slist = slist->next)
-    {
-      GClosure *closure = slist->data;
-
-      removed_one |= gtk_accel_group_disconnect (accel_group, closure);
-      g_closure_unref (closure);
-    }
-  g_slist_free (clist);
-
-  g_object_unref (accel_group);
-
-  return removed_one;
-}
-
-GSList*
-_gtk_accel_group_get_accelerables (GtkAccelGroup *accel_group)
-{
-    g_return_val_if_fail (GTK_IS_ACCEL_GROUP (accel_group), NULL);
-
-    return accel_group->priv->acceleratables;
-}
-
-/**
- * gtk_accel_group_query:
- * @accel_group: the accelerator group to query
- * @accel_key: key value of the accelerator
- * @accel_mods: modifier combination of the accelerator
- * @n_entries: (out) (optional): location to return the number
- *     of entries found, or %NULL
- *
- * Queries an accelerator group for all entries matching @accel_key
- * and @accel_mods.
- *
- * Returns: (nullable) (transfer none) (array length=n_entries): an array of
- *     @n_entries #GtkAccelGroupEntry elements, or %NULL. The array
- *     is owned by GTK+ and must not be freed.
- */
-GtkAccelGroupEntry*
-gtk_accel_group_query (GtkAccelGroup   *accel_group,
-                       guint            accel_key,
-                       GdkModifierType  accel_mods,
-                       guint           *n_entries)
-{
-  GtkAccelGroupEntry *entries;
-  guint n;
-
-  g_return_val_if_fail (GTK_IS_ACCEL_GROUP (accel_group), NULL);
-
-  entries = quick_accel_find (accel_group, gdk_keyval_to_lower (accel_key), accel_mods, &n);
-
-  if (n_entries)
-    *n_entries = entries ? n : 0;
-
-  return entries;
-}
-
-/**
- * gtk_accel_group_from_accel_closure:
- * @closure: a #GClosure
- *
- * Finds the #GtkAccelGroup to which @closure is connected;
- * see gtk_accel_group_connect().
- *
- * Returns: (nullable) (transfer none): the #GtkAccelGroup to which @closure
- *     is connected, or %NULL
- */
-GtkAccelGroup*
-gtk_accel_group_from_accel_closure (GClosure *closure)
-{
-  guint i;
-
-  g_return_val_if_fail (closure != NULL, NULL);
-
-  /* A few remarks on what we do here. in general, we need a way to
-   * reverse lookup accel_groups from closures that are being used in
-   * accel groups. this could be done e.g via a hashtable. it is however
-   * cheaper (memory wise) to just use the invalidation notifier on the
-   * closure itself (which we need to install anyway), that contains the
-   * accel group as data which, besides needing to peek a bit at closure
-   * internals, works just as good.
-   */
-  for (i = 0; i < G_CLOSURE_N_NOTIFIERS (closure); i++)
-    if (closure->notifiers[i].notify == accel_closure_invalidate)
-      return closure->notifiers[i].data;
-
-  return NULL;
-}
-
-/**
- * gtk_accel_group_activate:
- * @accel_group: a #GtkAccelGroup
- * @accel_quark: the quark for the accelerator name
- * @acceleratable: the #GObject, usually a #GtkWindow, on which
- *    to activate the accelerator
- * @accel_key: accelerator keyval from a key event
- * @accel_mods: keyboard state mask from a key event
- *
- * Finds the first accelerator in @accel_group that matches
- * @accel_key and @accel_mods, and activates it.
- *
- * Returns: %TRUE if an accelerator was activated and handled
- *     this keypress
- */
-gboolean
-gtk_accel_group_activate (GtkAccelGroup   *accel_group,
-                          GQuark           accel_quark,
-                          GObject         *acceleratable,
-                          guint            accel_key,
-                          GdkModifierType  accel_mods)
-{
-  gboolean was_handled;
-
-  g_return_val_if_fail (GTK_IS_ACCEL_GROUP (accel_group), FALSE);
-  g_return_val_if_fail (G_IS_OBJECT (acceleratable), FALSE);
-
-  was_handled = FALSE;
-  g_signal_emit (accel_group, signal_accel_activate, accel_quark,
-                 acceleratable, accel_key, accel_mods, &was_handled);
-
-  return was_handled;
-}
-
-/**
- * gtk_accel_groups_activate:
- * @object: the #GObject, usually a #GtkWindow, on which
- *     to activate the accelerator
- * @accel_key: accelerator keyval from a key event
- * @accel_mods: keyboard state mask from a key event
- *
- * Finds the first accelerator in any #GtkAccelGroup attached
- * to @object that matches @accel_key and @accel_mods, and
- * activates that accelerator.
- *
- * Returns: %TRUE if an accelerator was activated and handled
- *     this keypress
- */
-gboolean
-gtk_accel_groups_activate (GObject         *object,
-                           guint            accel_key,
-                           GdkModifierType  accel_mods)
-{
-  g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
-
-  if (gtk_accelerator_valid (accel_key, accel_mods))
-    {
-      gchar *accel_name;
-      GQuark accel_quark;
-      GSList *slist;
-
-      accel_name = gtk_accelerator_name (accel_key, (accel_mods & gtk_accelerator_get_default_mod_mask ()));
-      accel_quark = g_quark_from_string (accel_name);
-      g_free (accel_name);
-
-      for (slist = gtk_accel_groups_from_object (object); slist; slist = slist->next)
-        if (gtk_accel_group_activate (slist->data, accel_quark, object, accel_key, accel_mods))
-          return TRUE;
-    }
-
-  return FALSE;
-}
-
 /**
  * gtk_accelerator_valid:
  * @keyval: a GDK keyval
diff --git a/gtk/gtkaccelgroup.h b/gtk/gtkaccelgroup.h
index 2efa868899..69d0a3f227 100644
--- a/gtk/gtkaccelgroup.h
+++ b/gtk/gtkaccelgroup.h
@@ -36,149 +36,6 @@
 G_BEGIN_DECLS
 
 
-/* --- type macros --- */
-#define GTK_TYPE_ACCEL_GROUP              (gtk_accel_group_get_type ())
-#define GTK_ACCEL_GROUP(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GTK_TYPE_ACCEL_GROUP, 
GtkAccelGroup))
-#define GTK_ACCEL_GROUP_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ACCEL_GROUP, 
GtkAccelGroupClass))
-#define GTK_IS_ACCEL_GROUP(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GTK_TYPE_ACCEL_GROUP))
-#define GTK_IS_ACCEL_GROUP_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ACCEL_GROUP))
-#define GTK_ACCEL_GROUP_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ACCEL_GROUP, 
GtkAccelGroupClass))
-
-
-/* --- accel flags --- */
-/**
- * GtkAccelFlags:
- * @GTK_ACCEL_VISIBLE: Accelerator is visible
- * @GTK_ACCEL_LOCKED: Accelerator not removable
- * @GTK_ACCEL_MASK: Mask
- *
- * Accelerator flags used with gtk_accel_group_connect().
- */
-typedef enum
-{
-  GTK_ACCEL_VISIBLE        = 1 << 0,
-  GTK_ACCEL_LOCKED         = 1 << 1,
-  GTK_ACCEL_MASK           = 0x07
-} GtkAccelFlags;
-
-
-/* --- typedefs & structures --- */
-typedef struct _GtkAccelGroup            GtkAccelGroup;
-typedef struct _GtkAccelGroupClass        GtkAccelGroupClass;
-typedef struct _GtkAccelGroupPrivate      GtkAccelGroupPrivate;
-typedef struct _GtkAccelKey               GtkAccelKey;
-typedef struct _GtkAccelGroupEntry        GtkAccelGroupEntry;
-typedef gboolean (*GtkAccelGroupActivate) (GtkAccelGroup  *accel_group,
-                                          GObject        *acceleratable,
-                                          guint           keyval,
-                                          GdkModifierType modifier);
-
-/**
- * GtkAccelGroupFindFunc:
- * @key: 
- * @closure: 
- * @data: (closure):
- */
-typedef gboolean (*GtkAccelGroupFindFunc) (GtkAccelKey    *key,
-                                          GClosure       *closure,
-                                          gpointer        data);
-
-/**
- * GtkAccelGroup:
- * 
- * An object representing and maintaining a group of accelerators.
- */
-struct _GtkAccelGroup
-{
-  GObject               parent;
-  GtkAccelGroupPrivate *priv;
-};
-
-/**
- * GtkAccelGroupClass:
- * @parent_class: The parent class.
- * @accel_changed: Signal emitted when an entry is added to or removed
- *    from the accel group.
- */
-struct _GtkAccelGroupClass
-{
-  GObjectClass parent_class;
-
-  /*< public >*/
-
-  void (*accel_changed)        (GtkAccelGroup  *accel_group,
-                                guint           keyval,
-                                GdkModifierType modifier,
-                                GClosure       *accel_closure);
-
-  /*< private >*/
-
-  /* Padding for future expansion */
-  void (*_gtk_reserved1) (void);
-  void (*_gtk_reserved2) (void);
-  void (*_gtk_reserved3) (void);
-  void (*_gtk_reserved4) (void);
-};
-
-/**
- * GtkAccelKey:
- * @accel_key: The accelerator keyval
- * @accel_mods:The accelerator modifiers
- * @accel_flags: The accelerator flags
- */
-struct _GtkAccelKey
-{
-  guint           accel_key;
-  GdkModifierType accel_mods;
-  guint           accel_flags : 16;
-};
-
-
-/* -- Accelerator Groups --- */
-GDK_AVAILABLE_IN_ALL
-GType          gtk_accel_group_get_type           (void) G_GNUC_CONST;
-GDK_AVAILABLE_IN_ALL
-GtkAccelGroup* gtk_accel_group_new               (void);
-GDK_AVAILABLE_IN_ALL
-void          gtk_accel_group_connect            (GtkAccelGroup  *accel_group,
-                                                  guint           accel_key,
-                                                  GdkModifierType accel_mods,
-                                                  GtkAccelFlags   accel_flags,
-                                                  GClosure       *closure);
-GDK_AVAILABLE_IN_ALL
-gboolean       gtk_accel_group_disconnect        (GtkAccelGroup  *accel_group,
-                                                  GClosure       *closure);
-GDK_AVAILABLE_IN_ALL
-gboolean       gtk_accel_group_disconnect_key    (GtkAccelGroup  *accel_group,
-                                                  guint           accel_key,
-                                                  GdkModifierType accel_mods);
-GDK_AVAILABLE_IN_ALL
-gboolean       gtk_accel_group_activate           (GtkAccelGroup   *accel_group,
-                                                   GQuark         accel_quark,
-                                                   GObject       *acceleratable,
-                                                   guint          accel_key,
-                                                   GdkModifierType accel_mods);
-
-
-/* --- GtkActivatable glue --- */
-void           _gtk_accel_group_attach         (GtkAccelGroup  *accel_group,
-                                                GObject        *object);
-void           _gtk_accel_group_detach         (GtkAccelGroup  *accel_group,
-                                                GObject        *object);
-GDK_AVAILABLE_IN_ALL
-gboolean        gtk_accel_groups_activate              (GObject        *object,
-                                                guint           accel_key,
-                                                GdkModifierType accel_mods);
-GDK_AVAILABLE_IN_ALL
-GSList*                gtk_accel_groups_from_object    (GObject        *object);
-GDK_AVAILABLE_IN_ALL
-GtkAccelKey*   gtk_accel_group_find            (GtkAccelGroup        *accel_group,
-                                                GtkAccelGroupFindFunc find_func,
-                                                gpointer              data);
-GDK_AVAILABLE_IN_ALL
-GtkAccelGroup* gtk_accel_group_from_accel_closure (GClosure    *closure);
-
-
 /* --- Accelerators--- */
 GDK_AVAILABLE_IN_ALL
 gboolean gtk_accelerator_valid               (guint            keyval,
@@ -215,21 +72,6 @@ GDK_AVAILABLE_IN_ALL
 GdkModifierType
         gtk_accelerator_get_default_mod_mask (void);
 
-GDK_AVAILABLE_IN_ALL
-GtkAccelGroupEntry*    gtk_accel_group_query   (GtkAccelGroup  *accel_group,
-                                                guint           accel_key,
-                                                GdkModifierType accel_mods,
-                                                guint          *n_entries);
-
-struct _GtkAccelGroupEntry
-{
-  GtkAccelKey  key;
-  GClosure    *closure;
-  GQuark       accel_path_quark;
-};
-
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkAccelGroup, g_object_unref)
-
 G_END_DECLS
 
 #endif /* __GTK_ACCEL_GROUP_H__ */
diff --git a/gtk/gtkaccelgroupprivate.h b/gtk/gtkaccelgroupprivate.h
index d3f6004e05..c5b4daef55 100644
--- a/gtk/gtkaccelgroupprivate.h
+++ b/gtk/gtkaccelgroupprivate.h
@@ -25,15 +25,6 @@
 
 G_BEGIN_DECLS
 
-struct _GtkAccelGroupPrivate
-{
-  GSList             *acceleratables;
-  guint               n_accels;
-  GtkAccelGroupEntry *priv_accels;
-};
-
-GSList* _gtk_accel_group_get_accelerables       (GtkAccelGroup          *accel_group);
-
 void    gtk_accelerator_print_label             (GString                *gstring,
                                                  guint                   accelerator_key,
                                                  GdkModifierType         accelerator_mods);
diff --git a/gtk/gtkaccellabel.c b/gtk/gtkaccellabel.c
index e14f41e537..3abdc4cee0 100644
--- a/gtk/gtkaccellabel.c
+++ b/gtk/gtkaccellabel.c
@@ -78,23 +78,10 @@
  *   GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  *   GtkWidget *menu = gtk_menu_new ();
  *   GtkWidget *save_item;
- *   GtkAccelGroup *accel_group;
- *
- *   // Create a GtkAccelGroup and add it to the window.
- *   accel_group = gtk_accel_group_new ();
- *   gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
  *
  *   // Create the menu item using the convenience function.
  *   save_item = gtk_menu_item_new_with_label ("Save");
  *   gtk_container_add (GTK_CONTAINER (menu), save_item);
- *
- *   // Now add the accelerator to the GtkMenuItem. Note that since we
- *   // called gtk_menu_item_new_with_label() to create the GtkMenuItem
- *   // the GtkAccelLabel is automatically set up to display the
- *   // GtkMenuItem accelerators. We just need to make sure we use
- *   // GTK_ACCEL_VISIBLE here.
- *   gtk_widget_add_accelerator (save_item, "activate", accel_group,
- *                               GDK_KEY_s, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
  * ]|
  *
  * # CSS nodes
@@ -111,8 +98,6 @@
 
 enum {
   PROP_0,
-  PROP_ACCEL_CLOSURE,
-  PROP_ACCEL_WIDGET,
   PROP_LABEL,
   PROP_USE_UNDERLINE,
   LAST_PROP
@@ -139,10 +124,6 @@ struct _GtkAccelLabelPrivate
   GtkWidget     *text_label;
   GtkWidget     *accel_label;
 
-  GtkWidget     *accel_widget;       /* done */
-  GClosure      *accel_closure;      /* has set function */
-  GtkAccelGroup *accel_group;        /* set by set_accel_closure() */
-
   guint           accel_key;         /* manual accel key specification if != 0 */
   GdkModifierType accel_mods;
 };
@@ -157,7 +138,6 @@ static void         gtk_accel_label_get_property (GObject            *object,
                                                  guint               prop_id,
                                                  GValue             *value,
                                                  GParamSpec         *pspec);
-static void         gtk_accel_label_destroy      (GtkWidget          *widget);
 static void         gtk_accel_label_finalize     (GObject            *object);
 
 G_DEFINE_TYPE_WITH_PRIVATE (GtkAccelLabel, gtk_accel_label, GTK_TYPE_WIDGET)
@@ -172,24 +152,8 @@ gtk_accel_label_class_init (GtkAccelLabelClass *class)
   gobject_class->set_property = gtk_accel_label_set_property;
   gobject_class->get_property = gtk_accel_label_get_property;
 
-  widget_class->destroy = gtk_accel_label_destroy;
-
   gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_ACCEL_LABEL);
 
-  props[PROP_ACCEL_CLOSURE] =
-    g_param_spec_boxed ("accel-closure",
-                        P_("Accelerator Closure"),
-                        P_("The closure to be monitored for accelerator changes"),
-                        G_TYPE_CLOSURE,
-                        GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
-
-  props[PROP_ACCEL_WIDGET] =
-    g_param_spec_object ("accel-widget",
-                         P_("Accelerator Widget"),
-                         P_("The widget to be monitored for accelerator changes"),
-                         GTK_TYPE_WIDGET,
-                         GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
-
   props[PROP_LABEL] =
     g_param_spec_string ("label",
                          P_("Label"),
@@ -222,12 +186,6 @@ gtk_accel_label_set_property (GObject      *object,
 
   switch (prop_id)
     {
-    case PROP_ACCEL_CLOSURE:
-      gtk_accel_label_set_accel_closure (accel_label, g_value_get_boxed (value));
-      break;
-    case PROP_ACCEL_WIDGET:
-      gtk_accel_label_set_accel_widget (accel_label, g_value_get_object (value));
-      break;
     case PROP_LABEL:
       gtk_accel_label_set_label (accel_label, g_value_get_string (value));
       break;
@@ -247,16 +205,9 @@ gtk_accel_label_get_property (GObject    *object,
                              GParamSpec *pspec)
 {
   GtkAccelLabel  *accel_label = GTK_ACCEL_LABEL (object);
-  GtkAccelLabelPrivate *priv = gtk_accel_label_get_instance_private (accel_label);
 
   switch (prop_id)
     {
-    case PROP_ACCEL_CLOSURE:
-      g_value_set_boxed (value, priv->accel_closure);
-      break;
-    case PROP_ACCEL_WIDGET:
-      g_value_set_object (value, priv->accel_widget);
-      break;
     case PROP_LABEL:
       g_value_set_string (value, gtk_accel_label_get_label (accel_label));
       break;
@@ -274,10 +225,6 @@ gtk_accel_label_init (GtkAccelLabel *accel_label)
 {
   GtkAccelLabelPrivate *priv = gtk_accel_label_get_instance_private (accel_label);
 
-  priv->accel_widget = NULL;
-  priv->accel_closure = NULL;
-  priv->accel_group = NULL;
-
   priv->text_label = gtk_label_new ("");
   gtk_widget_set_hexpand (priv->text_label, TRUE);
   gtk_label_set_xalign (GTK_LABEL (priv->text_label), 0.0f);
@@ -310,17 +257,6 @@ gtk_accel_label_new (const gchar *string)
   return GTK_WIDGET (accel_label);
 }
 
-static void
-gtk_accel_label_destroy (GtkWidget *widget)
-{
-  GtkAccelLabel *accel_label = GTK_ACCEL_LABEL (widget);
-
-  gtk_accel_label_set_accel_widget (accel_label, NULL);
-  gtk_accel_label_set_accel_closure (accel_label, NULL);
-
-  GTK_WIDGET_CLASS (gtk_accel_label_parent_class)->destroy (widget);
-}
-
 static void
 gtk_accel_label_finalize (GObject *object)
 {
@@ -333,25 +269,6 @@ gtk_accel_label_finalize (GObject *object)
   G_OBJECT_CLASS (gtk_accel_label_parent_class)->finalize (object);
 }
 
-/**
- * gtk_accel_label_get_accel_widget:
- * @accel_label: a #GtkAccelLabel
- *
- * Fetches the widget monitored by this accelerator label. See
- * gtk_accel_label_set_accel_widget().
- *
- * Returns: (nullable) (transfer none): the object monitored by the accelerator label, or %NULL.
- **/
-GtkWidget *
-gtk_accel_label_get_accel_widget (GtkAccelLabel *accel_label)
-{
-  GtkAccelLabelPrivate *priv = gtk_accel_label_get_instance_private (accel_label);
-
-  g_return_val_if_fail (GTK_IS_ACCEL_LABEL (accel_label), NULL);
-
-  return priv->accel_widget;
-}
-
 /**
  * gtk_accel_label_get_accel_width:
  * @accel_label: a #GtkAccelLabel.
@@ -376,155 +293,12 @@ gtk_accel_label_get_accel_width (GtkAccelLabel *accel_label)
   return min;
 }
 
-static void
-refetch_widget_accel_closure (GtkAccelLabel *accel_label)
-{
-  GtkAccelLabelPrivate *priv = gtk_accel_label_get_instance_private (accel_label);
-
-  g_return_if_fail (GTK_IS_ACCEL_LABEL (accel_label));
-  g_return_if_fail (GTK_IS_WIDGET (priv->accel_widget));
-
-  gtk_accel_label_set_accel_closure (accel_label, NULL);
-}
-
-static void
-accel_widget_weak_ref_cb (GtkAccelLabel *accel_label,
-                          GtkWidget     *old_accel_widget)
-{
-  GtkAccelLabelPrivate *priv = gtk_accel_label_get_instance_private (accel_label);
-
-  g_return_if_fail (GTK_IS_ACCEL_LABEL (accel_label));
-  g_return_if_fail (GTK_IS_WIDGET (priv->accel_widget));
-
-  g_signal_handlers_disconnect_by_func (priv->accel_widget,
-                                        refetch_widget_accel_closure,
-                                        accel_label);
-  priv->accel_widget = NULL;
-  g_object_notify_by_pspec (G_OBJECT (accel_label), props[PROP_ACCEL_WIDGET]);
-}
-
-/**
- * gtk_accel_label_set_accel_widget:
- * @accel_label: a #GtkAccelLabel
- * @accel_widget: (nullable): the widget to be monitored, or %NULL
- *
- * Sets the widget to be monitored by this accelerator label. Passing %NULL for
- * @accel_widget will dissociate @accel_label from its current widget, if any.
- */
-void
-gtk_accel_label_set_accel_widget (GtkAccelLabel *accel_label,
-                                  GtkWidget     *accel_widget)
-{
-  GtkAccelLabelPrivate *priv = gtk_accel_label_get_instance_private (accel_label);
-
-  g_return_if_fail (GTK_IS_ACCEL_LABEL (accel_label));
-
-  if (accel_widget)
-    g_return_if_fail (GTK_IS_WIDGET (accel_widget));
-
-  if (accel_widget != priv->accel_widget)
-    {
-      if (priv->accel_widget)
-        {
-          gtk_accel_label_set_accel_closure (accel_label, NULL);
-          g_signal_handlers_disconnect_by_func (priv->accel_widget,
-                                                refetch_widget_accel_closure,
-                                                accel_label);
-          g_object_weak_unref (G_OBJECT (priv->accel_widget),
-                               (GWeakNotify) accel_widget_weak_ref_cb, accel_label);
-        }
-
-      priv->accel_widget = accel_widget;
-
-      if (priv->accel_widget)
-        {
-          g_object_weak_ref (G_OBJECT (priv->accel_widget),
-                             (GWeakNotify) accel_widget_weak_ref_cb, accel_label);
-          g_signal_connect_object (priv->accel_widget, "accel-closures-changed",
-                                   G_CALLBACK (refetch_widget_accel_closure),
-                                   accel_label, G_CONNECT_SWAPPED);
-          refetch_widget_accel_closure (accel_label);
-        }
-
-      g_object_notify_by_pspec (G_OBJECT (accel_label), props[PROP_ACCEL_WIDGET]);
-    }
-}
-
 static void
 gtk_accel_label_reset (GtkAccelLabel *accel_label)
 {
   gtk_accel_label_refetch (accel_label);
 }
 
-static void
-check_accel_changed (GtkAccelGroup  *accel_group,
-                    guint           keyval,
-                    GdkModifierType modifier,
-                    GClosure       *accel_closure,
-                    GtkAccelLabel  *accel_label)
-{
-  GtkAccelLabelPrivate *priv = gtk_accel_label_get_instance_private (accel_label);
-
-  if (accel_closure == priv->accel_closure)
-    gtk_accel_label_reset (accel_label);
-}
-
-/**
- * gtk_accel_label_set_accel_closure:
- * @accel_label: a #GtkAccelLabel
- * @accel_closure: (nullable): the closure to monitor for accelerator changes,
- * or %NULL
- *
- * Sets the closure to be monitored by this accelerator label. The closure
- * must be connected to an accelerator group; see gtk_accel_group_connect().
- * Passing %NULL for @accel_closure will dissociate @accel_label from its
- * current closure, if any.
- **/
-void
-gtk_accel_label_set_accel_closure (GtkAccelLabel *accel_label,
-                                   GClosure      *accel_closure)
-{
-  GtkAccelLabelPrivate *priv = gtk_accel_label_get_instance_private (accel_label);
-
-  g_return_if_fail (GTK_IS_ACCEL_LABEL (accel_label));
-
-  if (accel_closure)
-    g_return_if_fail (gtk_accel_group_from_accel_closure (accel_closure) != NULL);
-
-  if (accel_closure != priv->accel_closure)
-    {
-      if (priv->accel_closure)
-        {
-          g_signal_handlers_disconnect_by_func (priv->accel_group,
-                                                check_accel_changed,
-                                                accel_label);
-          priv->accel_group = NULL;
-          g_closure_unref (priv->accel_closure);
-        }
-
-      priv->accel_closure = accel_closure;
-
-      if (priv->accel_closure)
-        {
-          g_closure_ref (priv->accel_closure);
-          priv->accel_group = gtk_accel_group_from_accel_closure (accel_closure);
-          g_signal_connect_object (priv->accel_group, "accel-changed", G_CALLBACK (check_accel_changed),
-                                   accel_label, 0);
-        }
-
-      gtk_accel_label_reset (accel_label);
-      g_object_notify_by_pspec (G_OBJECT (accel_label), props[PROP_ACCEL_CLOSURE]);
-    }
-}
-
-static gboolean
-find_accel (GtkAccelKey *key,
-           GClosure    *closure,
-           gpointer     data)
-{
-  return data == (gpointer) closure;
-}
-
 /**
  * gtk_accel_label_refetch:
  * @accel_label: a #GtkAccelLabel.
@@ -548,7 +322,7 @@ gtk_accel_label_refetch (GtkAccelLabel *accel_label)
                 "gtk-enable-accels", &enable_accels,
                 NULL);
 
-  if (enable_accels && (priv->accel_closure || priv->accel_key))
+  if (enable_accels && priv->accel_key)
     {
       gboolean have_accel = FALSE;
       guint accel_key;
@@ -562,21 +336,6 @@ gtk_accel_label_refetch (GtkAccelLabel *accel_label)
           have_accel = TRUE;
         }
 
-      /* If we don't have a hardcoded value, check the accel group */
-      if (!have_accel)
-        {
-          GtkAccelKey *key;
-
-          key = gtk_accel_group_find (priv->accel_group, find_accel, priv->accel_closure);
-
-          if (key && key->accel_flags & GTK_ACCEL_VISIBLE)
-            {
-              accel_key = key->accel_key;
-              accel_mods = key->accel_mods;
-              have_accel = TRUE;
-            }
-        }
-
       /* If we found a key using either method, set it */
       if (have_accel)
         accel_string = gtk_accelerator_get_label (accel_key, accel_mods);
diff --git a/gtk/gtkaccellabel.h b/gtk/gtkaccellabel.h
index 3c5c67e90f..a1e8d9e8fd 100644
--- a/gtk/gtkaccellabel.h
+++ b/gtk/gtkaccellabel.h
@@ -46,16 +46,8 @@ GType           gtk_accel_label_get_type          (void) G_GNUC_CONST;
 GDK_AVAILABLE_IN_ALL
 GtkWidget* gtk_accel_label_new              (const gchar   *string);
 GDK_AVAILABLE_IN_ALL
-GtkWidget* gtk_accel_label_get_accel_widget  (GtkAccelLabel *accel_label);
-GDK_AVAILABLE_IN_ALL
 guint     gtk_accel_label_get_accel_width   (GtkAccelLabel *accel_label);
 GDK_AVAILABLE_IN_ALL
-void      gtk_accel_label_set_accel_widget  (GtkAccelLabel *accel_label,
-                                             GtkWidget     *accel_widget);
-GDK_AVAILABLE_IN_ALL
-void      gtk_accel_label_set_accel_closure (GtkAccelLabel *accel_label,
-                                             GClosure      *accel_closure);
-GDK_AVAILABLE_IN_ALL
 gboolean   gtk_accel_label_refetch           (GtkAccelLabel *accel_label);
 GDK_AVAILABLE_IN_ALL
 void       gtk_accel_label_set_accel         (GtkAccelLabel   *accel_label,
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index 79c76e2dd1..be25fec4f3 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -1890,14 +1890,7 @@ gtk_main_do_event (GdkEvent *event)
   if (is_pointing_event (event))
     target_widget = handle_pointing_event (event);
   else if (is_key_event (event))
-    {
-      if (event->any.type == GDK_KEY_PRESS &&
-          GTK_IS_WINDOW (target_widget) &&
-          gtk_window_activate_key (GTK_WINDOW (target_widget), (GdkEventKey *) event))
-        goto cleanup;
-
-      target_widget = handle_key_event (event);
-    }
+    target_widget = handle_key_event (event);
   else if (is_focus_event (event))
     {
       if (!GTK_IS_WINDOW (target_widget))
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index f5d2986080..4b970c6c0d 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -148,7 +148,6 @@ enum {
 enum {
   PROP_0,
   PROP_ACTIVE,
-  PROP_ACCEL_GROUP,
   PROP_ATTACH_WIDGET,
   PROP_TEAROFF_STATE,
   PROP_TEAROFF_TITLE,
@@ -407,19 +406,6 @@ gtk_menu_class_init (GtkMenuClass *class)
                                                      -1, G_MAXINT, -1,
                                                      GTK_PARAM_READWRITE));
 
-  /**
-   * GtkMenu:accel-group:
-   *
-   * The accel group holding accelerators for the menu.
-   **/
-  g_object_class_install_property (gobject_class,
-                                   PROP_ACCEL_GROUP,
-                                   g_param_spec_object ("accel-group",
-                                                        P_("Accel Group"),
-                                                        P_("The accel group holding accelerators for the 
menu"),
-                                                        GTK_TYPE_ACCEL_GROUP,
-                                                        GTK_PARAM_READWRITE));
-
   /**
    * GtkMenu:attach-widget:
    *
@@ -656,9 +642,6 @@ gtk_menu_set_property (GObject      *object,
     case PROP_ACTIVE:
       gtk_menu_set_active (menu, g_value_get_int (value));
       break;
-    case PROP_ACCEL_GROUP:
-      gtk_menu_set_accel_group (menu, g_value_get_object (value));
-      break;
     case PROP_ATTACH_WIDGET:
       {
         GtkWidget *widget;
@@ -729,9 +712,6 @@ gtk_menu_get_property (GObject     *object,
         g_list_free (children);
       }
       break;
-    case PROP_ACCEL_GROUP:
-      g_value_set_object (value, gtk_menu_get_accel_group (menu));
-      break;
     case PROP_ATTACH_WIDGET:
       g_value_set_object (value, gtk_menu_get_attach_widget (menu));
       break;
@@ -866,8 +846,6 @@ gtk_menu_destroy (GtkWidget *widget)
       g_object_ref (widget);
     }
 
-  g_clear_object (&priv->accel_group);
-
   if (priv->toplevel)
     {
       g_signal_handlers_disconnect_by_func (priv->toplevel, moved_to_rect_cb, menu);
@@ -1797,56 +1775,6 @@ gtk_menu_set_active (GtkMenu *menu,
   g_list_free (children);
 }
 
-/**
- * gtk_menu_set_accel_group:
- * @menu: a #GtkMenu
- * @accel_group: (allow-none): the #GtkAccelGroup to be associated
- *               with the menu.
- *
- * Set the #GtkAccelGroup which holds global accelerators for the
- * menu.  This accelerator group needs to also be added to all windows
- * that this menu is being used in with gtk_window_add_accel_group(),
- * in order for those windows to support all the accelerators
- * contained in this group.
- */
-void
-gtk_menu_set_accel_group (GtkMenu       *menu,
-                          GtkAccelGroup *accel_group)
-{
-  GtkMenuPrivate *priv;
-
-  g_return_if_fail (GTK_IS_MENU (menu));
-  g_return_if_fail (GTK_IS_ACCEL_GROUP (accel_group));
-
-  priv = menu->priv;
-
-  if (priv->accel_group != accel_group)
-    {
-      if (priv->accel_group)
-        g_object_unref (priv->accel_group);
-      priv->accel_group = accel_group;
-      if (priv->accel_group)
-        g_object_ref (priv->accel_group);
-    }
-}
-
-/**
- * gtk_menu_get_accel_group:
- * @menu: a #GtkMenu
- *
- * Gets the #GtkAccelGroup which holds global accelerators for the
- * menu. See gtk_menu_set_accel_group().
- *
- * Returns: (transfer none): the #GtkAccelGroup associated with the menu
- */
-GtkAccelGroup*
-gtk_menu_get_accel_group (GtkMenu *menu)
-{
-  g_return_val_if_fail (GTK_IS_MENU (menu), NULL);
-
-  return menu->priv->accel_group;
-}
-
 static gboolean
 gtk_menu_real_can_activate_accel (GtkWidget *widget,
                                   guint      signal_id)
diff --git a/gtk/gtkmenu.h b/gtk/gtkmenu.h
index 6b3ceeac20..c6bceeaaa7 100644
--- a/gtk/gtkmenu.h
+++ b/gtk/gtkmenu.h
@@ -88,12 +88,6 @@ GDK_AVAILABLE_IN_ALL
 void      gtk_menu_set_active            (GtkMenu             *menu,
                                           guint                index);
 
-GDK_AVAILABLE_IN_ALL
-void          gtk_menu_set_accel_group   (GtkMenu             *menu,
-                                          GtkAccelGroup       *accel_group);
-GDK_AVAILABLE_IN_ALL
-GtkAccelGroup* gtk_menu_get_accel_group          (GtkMenu             *menu);
-
 GDK_AVAILABLE_IN_ALL
 void      gtk_menu_attach_to_widget      (GtkMenu             *menu,
                                           GtkWidget           *attach_widget,
diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c
index 707b8756b0..7ffa64c90a 100644
--- a/gtk/gtkmenuitem.c
+++ b/gtk/gtkmenuitem.c
@@ -1594,8 +1594,6 @@ gtk_menu_item_ensure_label (GtkMenuItem *menu_item)
       gtk_widget_set_valign (accel_label, GTK_ALIGN_CENTER);
 
       gtk_container_add (GTK_CONTAINER (menu_item), accel_label);
-      gtk_accel_label_set_accel_widget (GTK_ACCEL_LABEL (accel_label),
-                                        GTK_WIDGET (menu_item));
     }
 }
 
diff --git a/gtk/gtkmenuprivate.h b/gtk/gtkmenuprivate.h
index 3658fea742..05c1f1503c 100644
--- a/gtk/gtkmenuprivate.h
+++ b/gtk/gtkmenuprivate.h
@@ -51,8 +51,6 @@ struct _GtkMenuPrivate
   GtkWidget *parent_menu_item;
   GtkWidget *old_active_menu_item;
 
-  GtkAccelGroup *accel_group;
-
   gint                position_x;
   gint                position_y;
 
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 6384f10907..957521522b 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -522,7 +522,6 @@ static gboolean     disable_startup_notification = FALSE;
 
 static GQuark       quark_gtk_window_key_hash = 0;
 static GQuark       quark_gtk_window_icon_info = 0;
-static GQuark       quark_gtk_buildable_accels = 0;
 
 static GtkBuildableIface *parent_buildable_iface;
 
@@ -545,8 +544,6 @@ static void gtk_window_buildable_set_buildable_property (GtkBuildable        *bu
                                                         GtkBuilder          *builder,
                                                         const gchar         *name,
                                                         const GValue        *value);
-static void gtk_window_buildable_parser_finished (GtkBuildable     *buildable,
-                                                 GtkBuilder       *builder);
 static gboolean gtk_window_buildable_custom_tag_start (GtkBuildable  *buildable,
                                                       GtkBuilder    *builder,
                                                       GObject       *child,
@@ -787,15 +784,11 @@ static void
 gtk_window_class_init (GtkWindowClass *klass)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-  GtkWidgetClass *widget_class;
-  GtkContainerClass *container_class;
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+  GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
 
-  widget_class = (GtkWidgetClass*) klass;
-  container_class = (GtkContainerClass*) klass;
-  
   quark_gtk_window_key_hash = g_quark_from_static_string ("gtk-window-key-hash");
   quark_gtk_window_icon_info = g_quark_from_static_string ("gtk-window-icon-info");
-  quark_gtk_buildable_accels = g_quark_from_static_string ("gtk-window-buildable-accels");
 
   if (toplevel_list == NULL)
     toplevel_list = g_list_store_new (GTK_TYPE_WIDGET);
@@ -2146,7 +2139,6 @@ gtk_window_buildable_interface_init (GtkBuildableIface *iface)
 {
   parent_buildable_iface = g_type_interface_peek_parent (iface);
   iface->set_buildable_property = gtk_window_buildable_set_buildable_property;
-  iface->parser_finished = gtk_window_buildable_parser_finished;
   iface->custom_tag_start = gtk_window_buildable_custom_tag_start;
   iface->custom_finished = gtk_window_buildable_custom_finished;
   iface->add_child = gtk_window_buildable_add_child;
@@ -2181,117 +2173,12 @@ gtk_window_buildable_set_buildable_property (GtkBuildable *buildable,
     g_object_set_property (G_OBJECT (buildable), name, value);
 }
 
-typedef struct {
-  gchar *name;
-  gint line;
-  gint col;
-} ItemData;
-
-static void
-item_data_free (gpointer data)
-{
-  ItemData *item_data = data;
-
-  g_free (item_data->name);
-  g_free (item_data);
-}
-
-static void
-item_list_free (gpointer data)
-{
-  GSList *list = data;
-
-  g_slist_free_full (list, item_data_free);
-}
-
-static void
-gtk_window_buildable_parser_finished (GtkBuildable *buildable,
-                                     GtkBuilder   *builder)
-{
-  GtkWindow *window = GTK_WINDOW (buildable);
-  GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
-  GObject *object;
-  GSList *accels, *l;
-
-  if (priv->builder_visible)
-    gtk_widget_show (GTK_WIDGET (buildable));
-
-  accels = g_object_get_qdata (G_OBJECT (buildable), quark_gtk_buildable_accels);
-  for (l = accels; l; l = l->next)
-    {
-      ItemData *data = l->data;
-
-      object = _gtk_builder_lookup_object (builder, data->name, data->line, data->col);
-      if (!object)
-       continue;
-      gtk_window_add_accel_group (GTK_WINDOW (buildable), GTK_ACCEL_GROUP (object));
-    }
-
-  g_object_set_qdata (G_OBJECT (buildable), quark_gtk_buildable_accels, NULL);
-
-  parent_buildable_iface->parser_finished (buildable, builder);
-}
-
 typedef struct {
   GObject *object;
   GtkBuilder *builder;
   GSList *items;
 } GSListSubParserData;
 
-static void
-window_start_element (GMarkupParseContext  *context,
-                      const gchar          *element_name,
-                      const gchar         **names,
-                      const gchar         **values,
-                      gpointer              user_data,
-                      GError              **error)
-{
-  GSListSubParserData *data = (GSListSubParserData*)user_data;
-
-  if (strcmp (element_name, "group") == 0)
-    {
-      const gchar *name;
-      ItemData *item_data;
-
-      if (!_gtk_builder_check_parent (data->builder, context, "accel-groups", error))
-        return;
-
-      if (!g_markup_collect_attributes (element_name, names, values, error,
-                                        G_MARKUP_COLLECT_STRING, "name", &name,
-                                        G_MARKUP_COLLECT_INVALID))
-        {
-          _gtk_builder_prefix_error (data->builder, context, error);
-          return;
-        }
-
-      item_data = g_new (ItemData, 1);
-      item_data->name = g_strdup (name);
-      g_markup_parse_context_get_position (context, &item_data->line, &item_data->col);
-      data->items = g_slist_prepend (data->items, item_data);
-    }
-  else if (strcmp (element_name, "accel-groups") == 0)
-    {
-      if (!_gtk_builder_check_parent (data->builder, context, "object", error))
-        return;
-
-      if (!g_markup_collect_attributes (element_name, names, values, error,
-                                        G_MARKUP_COLLECT_INVALID, NULL, NULL,
-                                        G_MARKUP_COLLECT_INVALID))
-        _gtk_builder_prefix_error (data->builder, context, error);
-    }
-  else
-    {
-      _gtk_builder_error_unhandled_tag (data->builder, context,
-                                        "GtkWindow", element_name,
-                                        error);
-    }
-}
-
-static const GMarkupParser window_parser =
-  {
-    window_start_element
-  };
-
 static gboolean
 gtk_window_buildable_custom_tag_start (GtkBuildable  *buildable,
                                        GtkBuilder    *builder,
@@ -2300,26 +2187,8 @@ gtk_window_buildable_custom_tag_start (GtkBuildable  *buildable,
                                        GMarkupParser *parser,
                                        gpointer      *parser_data)
 {
-  if (parent_buildable_iface->custom_tag_start (buildable, builder, child,
-                                               tagname, parser, parser_data))
-    return TRUE;
-
-  if (strcmp (tagname, "accel-groups") == 0)
-    {
-      GSListSubParserData *data;
-
-      data = g_slice_new0 (GSListSubParserData);
-      data->items = NULL;
-      data->object = G_OBJECT (buildable);
-      data->builder = builder;
-
-      *parser = window_parser;
-      *parser_data = data;
-
-      return TRUE;
-    }
-
-  return FALSE;
+  return parent_buildable_iface->custom_tag_start (buildable, builder, child,
+                                                   tagname, parser, parser_data);
 }
 
 static void
@@ -2330,17 +2199,7 @@ gtk_window_buildable_custom_finished (GtkBuildable  *buildable,
                                       gpointer       user_data)
 {
   parent_buildable_iface->custom_finished (buildable, builder, child,
-                                          tagname, user_data);
-
-  if (strcmp (tagname, "accel-groups") == 0)
-    {
-      GSListSubParserData *data = (GSListSubParserData*)user_data;
-
-      g_object_set_qdata_full (G_OBJECT (buildable), quark_gtk_buildable_accels,
-                               data->items, (GDestroyNotify) item_list_free);
-
-      g_slice_free (GSListSubParserData, data);
-    }
+                                           tagname, user_data);
 }
 
 static void
@@ -2686,50 +2545,6 @@ _gtk_window_notify_keys_changed (GtkWindow *window)
     }
 }
 
-/**
- * gtk_window_add_accel_group:
- * @window: window to attach accelerator group to
- * @accel_group: a #GtkAccelGroup
- *
- * Associate @accel_group with @window, such that calling
- * gtk_accel_groups_activate() on @window will activate accelerators
- * in @accel_group.
- **/
-void
-gtk_window_add_accel_group (GtkWindow     *window,
-                           GtkAccelGroup *accel_group)
-{
-  g_return_if_fail (GTK_IS_WINDOW (window));
-  g_return_if_fail (GTK_IS_ACCEL_GROUP (accel_group));
-
-  _gtk_accel_group_attach (accel_group, G_OBJECT (window));
-  g_signal_connect_object (accel_group, "accel-changed",
-                          G_CALLBACK (_gtk_window_notify_keys_changed),
-                          window, G_CONNECT_SWAPPED);
-  _gtk_window_notify_keys_changed (window);
-}
-
-/**
- * gtk_window_remove_accel_group:
- * @window: a #GtkWindow
- * @accel_group: a #GtkAccelGroup
- *
- * Reverses the effects of gtk_window_add_accel_group().
- **/
-void
-gtk_window_remove_accel_group (GtkWindow     *window,
-                              GtkAccelGroup *accel_group)
-{
-  g_return_if_fail (GTK_IS_WINDOW (window));
-  g_return_if_fail (GTK_IS_ACCEL_GROUP (accel_group));
-
-  g_signal_handlers_disconnect_by_func (accel_group,
-                                       _gtk_window_notify_keys_changed,
-                                       window);
-  _gtk_accel_group_detach (accel_group, G_OBJECT (window));
-  _gtk_window_notify_keys_changed (window);
-}
-
 /**
  * gtk_window_get_focus:
  * @window: a #GtkWindow
@@ -8075,31 +7890,6 @@ gtk_window_activate_menubar (GtkWidget *widget,
   return TRUE;
 }
 
-static void
-_gtk_window_keys_foreach (GtkWindow                *window,
-                         GtkWindowKeysForeachFunc func,
-                         gpointer                 func_data)
-{
-  GSList *groups;
-
-  groups = gtk_accel_groups_from_object (G_OBJECT (window));
-  while (groups)
-    {
-      GtkAccelGroup *group = groups->data;
-      gint i;
-
-      for (i = 0; i < group->priv->n_accels; i++)
-       {
-         GtkAccelKey *key = &group->priv->priv_accels[i].key;
-         
-         if (key->accel_key)
-           (*func) (window, key->accel_key, key->accel_mods, func_data);
-       }
-      
-      groups = groups->next;
-    }
-}
-
 static void
 gtk_window_keys_changed (GtkWindow *window)
 {
@@ -8121,33 +7911,6 @@ window_key_entry_destroy (gpointer data)
   g_slice_free (GtkWindowKeyEntry, data);
 }
 
-static void
-add_to_key_hash (GtkWindow      *window,
-                guint           keyval,
-                GdkModifierType modifiers,
-                gpointer        data)
-{
-  GtkKeyHash *key_hash = data;
-
-  GtkWindowKeyEntry *entry = g_slice_new (GtkWindowKeyEntry);
-
-  entry->keyval = keyval;
-  entry->modifiers = modifiers;
-
-  /* GtkAccelGroup stores lowercased accelerators. To deal
-   * with this, if <Shift> was specified, uppercase.
-   */
-  if (modifiers & GDK_SHIFT_MASK)
-    {
-      if (keyval == GDK_KEY_Tab)
-       keyval = GDK_KEY_ISO_Left_Tab;
-      else
-       keyval = gdk_keyval_to_upper (keyval);
-    }
-  
-  _gtk_key_hash_add_entry (key_hash, keyval, entry->modifiers, entry);
-}
-
 static GtkKeyHash *
 gtk_window_get_key_hash (GtkWindow *window)
 {
@@ -8159,7 +7922,6 @@ gtk_window_get_key_hash (GtkWindow *window)
   
   key_hash = _gtk_key_hash_new (gdk_display_get_keymap (priv->display),
                                (GDestroyNotify)window_key_entry_destroy);
-  _gtk_window_keys_foreach (window, add_to_key_hash, key_hash);
   g_object_set_qdata (G_OBJECT (window), quark_gtk_window_key_hash, key_hash);
 
   return key_hash;
@@ -8177,69 +7939,6 @@ gtk_window_free_key_hash (GtkWindow *window)
 }
 
 /**
- * gtk_window_activate_key:
- * @window:  a #GtkWindow
- * @event:   a #GdkEventKey
- *
- * Activates mnemonics and accelerators for this #GtkWindow. This is normally
- * called by the default ::key_press_event handler for toplevel windows,
- * however in some cases it may be useful to call this directly when
- * overriding the standard key handling for a toplevel window.
- *
- * Returns: %TRUE if a mnemonic or accelerator was found and activated.
- */
-gboolean
-gtk_window_activate_key (GtkWindow   *window,
-                        GdkEventKey *event)
-{
-  GtkKeyHash *key_hash;
-  GtkWindowKeyEntry *found_entry = NULL;
-  gboolean enable_accels;
-
-  g_return_val_if_fail (GTK_IS_WINDOW (window), FALSE);
-  g_return_val_if_fail (event != NULL, FALSE);
-
-  key_hash = gtk_window_get_key_hash (window);
-
-  if (key_hash)
-    {
-      GSList *tmp_list;
-      GSList *entries = _gtk_key_hash_lookup (key_hash,
-                                             event->hardware_keycode,
-                                             event->state,
-                                             gtk_accelerator_get_default_mod_mask (),
-                                             event->group);
-
-      g_object_get (gtk_widget_get_settings (GTK_WIDGET (window)),
-                    "gtk-enable-accels", &enable_accels,
-                    NULL);
-
-      for (tmp_list = entries; tmp_list; tmp_list = tmp_list->next)
-       {
-         GtkWindowKeyEntry *entry = tmp_list->data;
-          if (enable_accels && !found_entry)
-            {
-              found_entry = entry;
-              break;
-            }
-       }
-
-      g_slist_free (entries);
-    }
-
-  if (found_entry)
-    {
-      if (enable_accels)
-        {
-          if (gtk_accel_groups_activate (G_OBJECT (window), found_entry->keyval, found_entry->modifiers))
-            return TRUE;
-        }
-    }
-
-  return FALSE;
-}
-
-/*
  * _gtk_window_set_is_active:
  * @window: a #GtkWindow
  * @is_active: %TRUE if the window is in the currently active toplevel
diff --git a/gtk/gtkwindow.h b/gtk/gtkwindow.h
index 356ca5bf40..4ea87e2e21 100644
--- a/gtk/gtkwindow.h
+++ b/gtk/gtkwindow.h
@@ -122,12 +122,6 @@ GDK_AVAILABLE_IN_ALL
 void       gtk_window_set_startup_id           (GtkWindow           *window,
                                                 const gchar         *startup_id);
 GDK_AVAILABLE_IN_ALL
-void       gtk_window_add_accel_group          (GtkWindow           *window,
-                                               GtkAccelGroup       *accel_group);
-GDK_AVAILABLE_IN_ALL
-void       gtk_window_remove_accel_group       (GtkWindow           *window,
-                                               GtkAccelGroup       *accel_group);
-GDK_AVAILABLE_IN_ALL
 void       gtk_window_set_focus                (GtkWindow           *window,
                                                GtkWidget           *focus);
 GDK_AVAILABLE_IN_ALL
diff --git a/gtk/gtkwindowprivate.h b/gtk/gtkwindowprivate.h
index 4b7f04bee0..0be0784300 100644
--- a/gtk/gtkwindowprivate.h
+++ b/gtk/gtkwindowprivate.h
@@ -68,9 +68,6 @@ gboolean        _gtk_window_query_nonaccels     (GtkWindow      *window,
                                                  guint           accel_key,
                                                  GdkModifierType accel_mods);
 
-gboolean         gtk_window_activate_key (GtkWindow   *window,
-                                          GdkEventKey *event);
-
 void            _gtk_window_schedule_mnemonics_visible (GtkWindow *window);
 
 void            _gtk_window_notify_keys_changed (GtkWindow *window);


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