[gtk/shortcuts-rebased-again: 81/145] gtk: Remove accel paths



commit 57715265e9a87c05f166f885130a0a773e6f2733
Author: Benjamin Otte <otte redhat com>
Date:   Fri Aug 17 05:07:32 2018 +0200

    gtk: Remove accel paths
    
    It's an outdated technology now that everybody is using GActionGroups.
    
    If somebody wanted to support changeable shortcuts, they'd need to
    reintroduce it in another way.

 docs/reference/gtk/gtk4-sections.txt |   5 -
 gtk/gtkaccelmap.c                    |   2 +-
 gtk/gtkmenu.c                        | 137 --------------------------
 gtk/gtkmenu.h                        |   5 -
 gtk/gtkmenuitem.c                    | 180 -----------------------------------
 gtk/gtkmenuitem.h                    |   5 -
 gtk/gtkmenuitemprivate.h             |   6 --
 gtk/gtkmenuprivate.h                 |   1 -
 gtk/gtkshortcut.h                    |   5 +
 gtk/gtkwidget.c                      | 100 +------------------
 gtk/gtkwidget.h                      |   4 -
 testsuite/gtk/notify.c               |   7 +-
 testsuite/gtk/object.c               |   2 -
 13 files changed, 8 insertions(+), 451 deletions(-)
---
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index c6a0af5d02..9279d715ff 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -1792,8 +1792,6 @@ gtk_menu_popup_at_widget
 gtk_menu_popup_at_pointer
 gtk_menu_set_accel_group
 gtk_menu_get_accel_group
-gtk_menu_set_accel_path
-gtk_menu_get_accel_path
 gtk_menu_set_monitor
 gtk_menu_get_monitor
 gtk_menu_place_on_monitor
@@ -1891,8 +1889,6 @@ gtk_menu_item_get_use_underline
 gtk_menu_item_set_use_underline
 gtk_menu_item_set_submenu
 gtk_menu_item_get_submenu
-gtk_menu_item_set_accel_path
-gtk_menu_item_get_accel_path
 gtk_menu_item_select
 gtk_menu_item_deselect
 gtk_menu_item_activate
@@ -4446,7 +4442,6 @@ gtk_widget_class_add_binding
 gtk_widget_class_add_binding_signal
 gtk_widget_add_accelerator
 gtk_widget_remove_accelerator
-gtk_widget_set_accel_path
 gtk_widget_list_accel_closures
 gtk_widget_can_activate_accel
 gtk_widget_event
diff --git a/gtk/gtkaccelmap.c b/gtk/gtkaccelmap.c
index bbb2dd2bc8..8c6b7995e4 100644
--- a/gtk/gtkaccelmap.c
+++ b/gtk/gtkaccelmap.c
@@ -41,7 +41,7 @@
  * SECTION:gtkaccelmap
  * @Short_description: Loadable keyboard accelerator specifications
  * @Title: Accelerator Maps
- * @See_also: #GtkAccelGroup, #GtkAccelKey, gtk_widget_set_accel_path(), gtk_menu_item_set_accel_path()
+ * @See_also: #GtkAccelGroup, #GtkAccelKey
  *
  * Accelerator maps are used to define runtime configurable accelerators.
  * Functions for manipulating them are are usually used by higher level
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index 924ec56a1b..49bcd6f894 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -105,7 +105,6 @@
 #include "gtkscrollbar.h"
 #include "gtksettings.h"
 #include "gtkshortcutmanager.h"
-#include "gtksnapshot.h"
 #include "gtkstylecontextprivate.h"
 #include "gtktypebuiltins.h"
 #include "gtkwidgetpath.h"
@@ -151,7 +150,6 @@ enum {
   PROP_0,
   PROP_ACTIVE,
   PROP_ACCEL_GROUP,
-  PROP_ACCEL_PATH,
   PROP_ATTACH_WIDGET,
   PROP_TEAROFF_STATE,
   PROP_TEAROFF_TITLE,
@@ -180,7 +178,6 @@ static void     gtk_menu_size_allocate     (GtkWidget        *widget,
                                             int               widget_width,
                                             int               widget_height,
                                             int               baseline);
-static void     gtk_menu_show              (GtkWidget        *widget);
 static void     gtk_menu_motion            (GtkEventController *controller,
                                             double              x,
                                             double              y,
@@ -214,8 +211,6 @@ static GdkSurface *menu_grab_transfer_surface_get    (GtkMenu *menu);
 
 static gboolean gtk_menu_real_can_activate_accel (GtkWidget *widget,
                                                   guint      signal_id);
-static void _gtk_menu_refresh_accel_paths (GtkMenu *menu,
-                                           gboolean group_changed);
 static void gtk_menu_measure (GtkWidget      *widget,
                               GtkOrientation  orientation,
                               int             for_size,
@@ -319,7 +314,6 @@ gtk_menu_class_init (GtkMenuClass *class)
   widget_class->realize = gtk_menu_realize;
   widget_class->unrealize = gtk_menu_unrealize;
   widget_class->size_allocate = gtk_menu_size_allocate;
-  widget_class->show = gtk_menu_show;
   widget_class->focus = gtk_menu_focus;
   widget_class->can_activate_accel = gtk_menu_real_can_activate_accel;
   widget_class->grab_notify = gtk_menu_grab_notify;
@@ -427,19 +421,6 @@ gtk_menu_class_init (GtkMenuClass *class)
                                                         GTK_TYPE_ACCEL_GROUP,
                                                         GTK_PARAM_READWRITE));
 
-  /**
-   * GtkMenu:accel-path:
-   *
-   * An accel path used to conveniently construct accel paths of child items.
-   **/
-  g_object_class_install_property (gobject_class,
-                                   PROP_ACCEL_PATH,
-                                   g_param_spec_string ("accel-path",
-                                                        P_("Accel Path"),
-                                                        P_("An accel path used to conveniently construct 
accel paths of child items"),
-                                                        NULL,
-                                                        GTK_PARAM_READWRITE));
-
   /**
    * GtkMenu:attach-widget:
    *
@@ -679,9 +660,6 @@ gtk_menu_set_property (GObject      *object,
     case PROP_ACCEL_GROUP:
       gtk_menu_set_accel_group (menu, g_value_get_object (value));
       break;
-    case PROP_ACCEL_PATH:
-      gtk_menu_set_accel_path (menu, g_value_get_string (value));
-      break;
     case PROP_ATTACH_WIDGET:
       {
         GtkWidget *widget;
@@ -755,9 +733,6 @@ gtk_menu_get_property (GObject     *object,
     case PROP_ACCEL_GROUP:
       g_value_set_object (value, gtk_menu_get_accel_group (menu));
       break;
-    case PROP_ACCEL_PATH:
-      g_value_set_string (value, gtk_menu_get_accel_path (menu));
-      break;
     case PROP_ATTACH_WIDGET:
       g_value_set_object (value, gtk_menu_get_attach_widget (menu));
       break;
@@ -1853,7 +1828,6 @@ gtk_menu_set_accel_group (GtkMenu       *menu,
       priv->accel_group = accel_group;
       if (priv->accel_group)
         g_object_ref (priv->accel_group);
-      _gtk_menu_refresh_accel_paths (menu, TRUE);
     }
 }
 
@@ -1892,107 +1866,6 @@ gtk_menu_real_can_activate_accel (GtkWidget *widget,
     return gtk_widget_is_sensitive (widget);
 }
 
-/**
- * gtk_menu_set_accel_path:
- * @menu:       a valid #GtkMenu
- * @accel_path: (nullable): a valid accelerator path, or %NULL to unset the path
- *
- * Sets an accelerator path for this menu from which accelerator paths
- * for its immediate children, its menu items, can be constructed.
- * The main purpose of this function is to spare the programmer the
- * inconvenience of having to call gtk_menu_item_set_accel_path() on
- * each menu item that should support runtime user changable accelerators.
- * Instead, by just calling gtk_menu_set_accel_path() on their parent,
- * each menu item of this menu, that contains a label describing its
- * purpose, automatically gets an accel path assigned.
- *
- * For example, a menu containing menu items “New” and “Exit”, will, after
- * `gtk_menu_set_accel_path (menu, "<Gnumeric-Sheet>/File");` has been
- * called, assign its items the accel paths: `"<Gnumeric-Sheet>/File/New"`
- * and `"<Gnumeric-Sheet>/File/Exit"`.
- *
- * Assigning accel paths to menu items then enables the user to change
- * their accelerators at runtime. More details about accelerator paths
- * and their default setups can be found at gtk_accel_map_add_entry().
- *
- * Note that @accel_path string will be stored in a #GQuark. Therefore,
- * if you pass a static string, you can save some memory by interning
- * it first with g_intern_static_string().
- */
-void
-gtk_menu_set_accel_path (GtkMenu     *menu,
-                         const gchar *accel_path)
-{
-  GtkMenuPrivate *priv;
-
-  g_return_if_fail (GTK_IS_MENU (menu));
-
-  priv = menu->priv;
-
-  if (accel_path)
-    g_return_if_fail (accel_path[0] == '<' && strchr (accel_path, '/')); /* simplistic check */
-
-  priv->accel_path = g_intern_string (accel_path);
-  if (priv->accel_path)
-    _gtk_menu_refresh_accel_paths (menu, FALSE);
-}
-
-/**
- * gtk_menu_get_accel_path:
- * @menu: a valid #GtkMenu
- *
- * Retrieves the accelerator path set on the menu.
- *
- * Returns: the accelerator path set on the menu.
- */
-const gchar*
-gtk_menu_get_accel_path (GtkMenu *menu)
-{
-  g_return_val_if_fail (GTK_IS_MENU (menu), NULL);
-
-  return menu->priv->accel_path;
-}
-
-typedef struct {
-  GtkMenu *menu;
-  gboolean group_changed;
-} AccelPropagation;
-
-static void
-refresh_accel_paths_foreach (GtkWidget *widget,
-                             gpointer   data)
-{
-  GtkMenuPrivate *priv;
-  AccelPropagation *prop = data;
-
-  if (GTK_IS_MENU_ITEM (widget))  /* should always be true */
-    {
-      priv = prop->menu->priv;
-      _gtk_menu_item_refresh_accel_path (GTK_MENU_ITEM (widget),
-                                         priv->accel_path,
-                                         priv->accel_group,
-                                         prop->group_changed);
-    }
-}
-
-static void
-_gtk_menu_refresh_accel_paths (GtkMenu  *menu,
-                               gboolean  group_changed)
-{
-  GtkMenuPrivate *priv = menu->priv;
-
-  if (priv->accel_path && priv->accel_group)
-    {
-      AccelPropagation prop;
-
-      prop.menu = menu;
-      prop.group_changed = group_changed;
-      gtk_container_foreach (GTK_CONTAINER (menu),
-                             refresh_accel_paths_foreach,
-                             &prop);
-    }
-}
-
 /**
  * gtk_menu_reposition:
  * @menu: a #GtkMenu
@@ -2129,16 +2002,6 @@ gtk_menu_size_allocate (GtkWidget *widget,
                             baseline);
 }
 
-static void
-gtk_menu_show (GtkWidget *widget)
-{
-  GtkMenu *menu = GTK_MENU (widget);
-
-  _gtk_menu_refresh_accel_paths (menu, FALSE);
-
-  GTK_WIDGET_CLASS (gtk_menu_parent_class)->show (widget);
-}
-
 static void
 gtk_menu_measure (GtkWidget      *widget,
                   GtkOrientation  orientation,
diff --git a/gtk/gtkmenu.h b/gtk/gtkmenu.h
index c4217516db..6b3ceeac20 100644
--- a/gtk/gtkmenu.h
+++ b/gtk/gtkmenu.h
@@ -93,11 +93,6 @@ 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_set_accel_path    (GtkMenu             *menu,
-                                          const gchar         *accel_path);
-GDK_AVAILABLE_IN_ALL
-const gchar*   gtk_menu_get_accel_path    (GtkMenu             *menu);
 
 GDK_AVAILABLE_IN_ALL
 void      gtk_menu_attach_to_widget      (GtkMenu             *menu,
diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c
index 549c9b479c..578802a731 100644
--- a/gtk/gtkmenuitem.c
+++ b/gtk/gtkmenuitem.c
@@ -125,7 +125,6 @@ enum {
 enum {
   PROP_0,
   PROP_SUBMENU,
-  PROP_ACCEL_PATH,
   PROP_LABEL,
   PROP_USE_UNDERLINE,
 
@@ -607,20 +606,6 @@ gtk_menu_item_class_init (GtkMenuItemClass *klass)
                            GTK_TYPE_MENU,
                            GTK_PARAM_READWRITE);
 
-  /**
-   * GtkMenuItem:accel-path:
-   *
-   * Sets the accelerator path of the menu item, through which runtime
-   * changes of the menu item's accelerator caused by the user can be
-   * identified and saved to persistant storage.
-   */
-  menu_item_props[PROP_ACCEL_PATH] =
-      g_param_spec_string ("accel-path",
-                           P_("Accel Path"),
-                           P_("Sets the accelerator path of the menu item"),
-                           NULL,
-                           GTK_PARAM_READWRITE);
-
   /**
    * GtkMenuItem:label:
    *
@@ -760,9 +745,6 @@ gtk_menu_item_set_property (GObject      *object,
     case PROP_SUBMENU:
       gtk_menu_item_set_submenu (menu_item, g_value_get_object (value));
       break;
-    case PROP_ACCEL_PATH:
-      gtk_menu_item_set_accel_path (menu_item, g_value_get_string (value));
-      break;
     case PROP_LABEL:
       gtk_menu_item_set_label (menu_item, g_value_get_string (value));
       break;
@@ -795,9 +777,6 @@ gtk_menu_item_get_property (GObject    *object,
     case PROP_SUBMENU:
       g_value_set_object (value, gtk_menu_item_get_submenu (menu_item));
       break;
-    case PROP_ACCEL_PATH:
-      g_value_set_string (value, gtk_menu_item_get_accel_path (menu_item));
-      break;
     case PROP_LABEL:
       g_value_set_string (value, gtk_menu_item_get_label (menu_item));
       break;
@@ -1600,44 +1579,12 @@ gtk_menu_item_can_activate_accel (GtkWidget *widget,
           menu_shell && gtk_widget_can_activate_accel (GTK_WIDGET (menu_shell), signal_id));
 }
 
-static void
-gtk_menu_item_accel_name_foreach (GtkWidget *widget,
-                                  gpointer   data)
-{
-  const gchar **path_p = data;
-
-  if (!*path_p)
-    {
-      if (GTK_IS_LABEL (widget))
-        {
-          *path_p = gtk_label_get_text (GTK_LABEL (widget));
-          if (*path_p && (*path_p)[0] == 0)
-            *path_p = NULL;
-        }
-      else if (GTK_IS_CONTAINER (widget))
-        gtk_container_foreach (GTK_CONTAINER (widget),
-                               gtk_menu_item_accel_name_foreach,
-                               data);
-    }
-}
-
 static void
 gtk_menu_item_parent_cb (GObject    *object,
                          GParamSpec *pspec,
                          gpointer    user_data)
 {
   GtkMenuItem *menu_item = GTK_MENU_ITEM (object);
-  GtkMenu *menu;
-  GtkMenuShell *menu_shell;
-
-  menu_shell = gtk_menu_item_get_menu_shell (menu_item);
-  menu = GTK_IS_MENU (menu_shell) ? GTK_MENU (menu_shell) : NULL;
-
-  if (menu)
-    _gtk_menu_item_refresh_accel_path (menu_item,
-                                       menu->priv->accel_path,
-                                       menu->priv->accel_group,
-                                       TRUE);
 
   update_arrow_widget (menu_item);
 }
@@ -1653,133 +1600,6 @@ gtk_menu_item_direction_changed (GtkWidget        *widget,
   GTK_WIDGET_CLASS (gtk_menu_item_parent_class)->direction_changed (widget, previous_dir);
 }
 
-void
-_gtk_menu_item_refresh_accel_path (GtkMenuItem   *menu_item,
-                                   const gchar   *prefix,
-                                   GtkAccelGroup *accel_group,
-                                   gboolean       group_changed)
-{
-  GtkMenuItemPrivate *priv = menu_item->priv;
-  const gchar *path;
-  GtkWidget *widget;
-
-  g_return_if_fail (GTK_IS_MENU_ITEM (menu_item));
-  g_return_if_fail (!accel_group || GTK_IS_ACCEL_GROUP (accel_group));
-
-  widget = GTK_WIDGET (menu_item);
-
-  if (!accel_group)
-    {
-      gtk_widget_set_accel_path (widget, NULL, NULL);
-      return;
-    }
-
-  path = _gtk_widget_get_accel_path (widget, NULL);
-  if (!path)  /* no active accel_path yet */
-    {
-      path = priv->accel_path;
-      if (!path && prefix)
-        {
-          const gchar *postfix = NULL;
-          gchar *new_path;
-
-          /* try to construct one from label text */
-          gtk_container_foreach (GTK_CONTAINER (menu_item),
-                                 gtk_menu_item_accel_name_foreach,
-                                 &postfix);
-          if (postfix)
-            {
-              new_path = g_strconcat (prefix, "/", postfix, NULL);
-              path = priv->accel_path = g_intern_string (new_path);
-              g_free (new_path);
-            }
-        }
-      if (path)
-        gtk_widget_set_accel_path (widget, path, accel_group);
-    }
-  else if (group_changed)    /* reinstall accelerators */
-    gtk_widget_set_accel_path (widget, path, accel_group);
-}
-
-/**
- * gtk_menu_item_set_accel_path:
- * @menu_item:  a valid #GtkMenuItem
- * @accel_path: (allow-none): accelerator path, corresponding to this menu
- *     item’s functionality, or %NULL to unset the current path.
- *
- * Set the accelerator path on @menu_item, through which runtime
- * changes of the menu item’s accelerator caused by the user can be
- * identified and saved to persistent storage (see gtk_accel_map_save()
- * on this). To set up a default accelerator for this menu item, call
- * gtk_accel_map_add_entry() with the same @accel_path. See also
- * gtk_accel_map_add_entry() on the specifics of accelerator paths,
- * and gtk_menu_set_accel_path() for a more convenient variant of
- * this function.
- *
- * This function is basically a convenience wrapper that handles
- * calling gtk_widget_set_accel_path() with the appropriate accelerator
- * group for the menu item.
- *
- * Note that you do need to set an accelerator on the parent menu with
- * gtk_menu_set_accel_group() for this to work.
- *
- * Note that @accel_path string will be stored in a #GQuark.
- * Therefore, if you pass a static string, you can save some memory
- * by interning it first with g_intern_static_string().
- */
-void
-gtk_menu_item_set_accel_path (GtkMenuItem *menu_item,
-                              const gchar *accel_path)
-{
-  GtkMenuItemPrivate *priv = menu_item->priv;
-  GtkWidget *widget;
-  GtkMenuShell *menu_shell;
-
-  g_return_if_fail (GTK_IS_MENU_ITEM (menu_item));
-  g_return_if_fail (accel_path == NULL ||
-                    (accel_path[0] == '<' && strchr (accel_path, '/')));
-
-  widget = GTK_WIDGET (menu_item);
-
-  /* store new path */
-  priv->accel_path = g_intern_string (accel_path);
-
-  /* forget accelerators associated with old path */
-  gtk_widget_set_accel_path (widget, NULL, NULL);
-
-  /* install accelerators associated with new path */
-  menu_shell = gtk_menu_item_get_menu_shell (menu_item);
-  if (GTK_IS_MENU (menu_shell))
-    {
-      GtkMenu *menu = GTK_MENU (menu_shell);
-
-      if (menu->priv->accel_group)
-        _gtk_menu_item_refresh_accel_path (GTK_MENU_ITEM (widget),
-                                           NULL,
-                                           menu->priv->accel_group,
-                                           FALSE);
-    }
-}
-
-/**
- * gtk_menu_item_get_accel_path:
- * @menu_item:  a valid #GtkMenuItem
- *
- * Retrieve the accelerator path that was previously set on @menu_item.
- *
- * See gtk_menu_item_set_accel_path() for details.
- *
- * Returns: (nullable) (transfer none): the accelerator path corresponding to
- *     this menu item’s functionality, or %NULL if not set
- */
-const gchar *
-gtk_menu_item_get_accel_path (GtkMenuItem *menu_item)
-{
-  g_return_val_if_fail (GTK_IS_MENU_ITEM (menu_item), NULL);
-
-  return menu_item->priv->accel_path;
-}
-
 static void
 gtk_menu_item_forall (GtkContainer *container,
                       GtkCallback   callback,
diff --git a/gtk/gtkmenuitem.h b/gtk/gtkmenuitem.h
index 422706a2af..36216236b5 100644
--- a/gtk/gtkmenuitem.h
+++ b/gtk/gtkmenuitem.h
@@ -129,11 +129,6 @@ void       gtk_menu_item_toggle_size_request  (GtkMenuItem         *menu_item,
 GDK_AVAILABLE_IN_ALL
 void       gtk_menu_item_toggle_size_allocate (GtkMenuItem         *menu_item,
                                                gint                 allocation);
-GDK_AVAILABLE_IN_ALL
-void          gtk_menu_item_set_accel_path    (GtkMenuItem         *menu_item,
-                                               const gchar         *accel_path);
-GDK_AVAILABLE_IN_ALL
-const gchar * gtk_menu_item_get_accel_path    (GtkMenuItem    *menu_item);
 
 GDK_AVAILABLE_IN_ALL
 void          gtk_menu_item_set_label         (GtkMenuItem         *menu_item,
diff --git a/gtk/gtkmenuitemprivate.h b/gtk/gtkmenuitemprivate.h
index 7b461f100e..53fbc51669 100644
--- a/gtk/gtkmenuitemprivate.h
+++ b/gtk/gtkmenuitemprivate.h
@@ -35,8 +35,6 @@ struct _GtkMenuItemPrivate
 
   guint timer;
 
-  const char *accel_path;
-
   GtkActionHelper *action_helper;
 
   GtkWidget *arrow_widget;
@@ -49,10 +47,6 @@ struct _GtkMenuItemPrivate
   guint reserve_indicator      : 1;
 };
 
-void     _gtk_menu_item_refresh_accel_path   (GtkMenuItem   *menu_item,
-                                              const gchar   *prefix,
-                                              GtkAccelGroup *accel_group,
-                                              gboolean       group_changed);
 gboolean _gtk_menu_item_is_selectable        (GtkWidget     *menu_item);
 void     _gtk_menu_item_popup_submenu        (GtkWidget     *menu_item,
                                               gboolean       with_delay);
diff --git a/gtk/gtkmenuprivate.h b/gtk/gtkmenuprivate.h
index 3e6e41b566..3658fea742 100644
--- a/gtk/gtkmenuprivate.h
+++ b/gtk/gtkmenuprivate.h
@@ -52,7 +52,6 @@ struct _GtkMenuPrivate
   GtkWidget *old_active_menu_item;
 
   GtkAccelGroup *accel_group;
-  const char    *accel_path;
 
   gint                position_x;
   gint                position_y;
diff --git a/gtk/gtkshortcut.h b/gtk/gtkshortcut.h
index 09e8a82cef..8a5e42e69f 100644
--- a/gtk/gtkshortcut.h
+++ b/gtk/gtkshortcut.h
@@ -69,6 +69,11 @@ gboolean        gtk_shortcut_get_mnemonic_activate              (GtkShortcut
 GDK_AVAILABLE_IN_ALL
 void            gtk_shortcut_set_mnemonic_activate              (GtkShortcut            *self,
                                                                  gboolean                mnemonic_activate);
+GDK_AVAILABLE_IN_ALL
+gboolean        gtk_shortcut_get_activate                       (GtkShortcut            *self);
+GDK_AVAILABLE_IN_ALL
+void            gtk_shortcut_set_activate                       (GtkShortcut            *self,
+                                                                 gboolean                activate);
 
 G_END_DECLS
 
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 6ca39470b0..b1042d994e 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -724,7 +724,6 @@ static gpointer         gtk_widget_parent_class = NULL;
 static guint            widget_signals[LAST_SIGNAL] = { 0 };
 GtkTextDirection gtk_default_direction = GTK_TEXT_DIR_LTR;
 
-static GQuark          quark_accel_path = 0;
 static GQuark          quark_accel_closures = 0;
 static GQuark          quark_input_shape_info = 0;
 static GQuark          quark_pango_context = 0;
@@ -891,7 +890,6 @@ gtk_widget_class_init (GtkWidgetClass *klass)
   g_type_class_adjust_private_offset (klass, &GtkWidget_private_offset);
   gtk_widget_parent_class = g_type_class_peek_parent (klass);
 
-  quark_accel_path = g_quark_from_static_string ("gtk-accel-path");
   quark_accel_closures = g_quark_from_static_string ("gtk-accel-closures");
   quark_input_shape_info = g_quark_from_static_string ("gtk-input-shape-info");
   quark_pango_context = g_quark_from_static_string ("gtk-pango-context");
@@ -5049,9 +5047,7 @@ widget_new_accel_closure (GtkWidget *widget,
  * The @accel_group needs to be added to the widget’s toplevel via
  * gtk_window_add_accel_group(), and the signal must be of type %G_SIGNAL_ACTION.
  * Accelerators added through this function are not user changeable during
- * runtime. If you want to support accelerators that can be changed by the
- * user, use gtk_accel_map_add_entry() and gtk_widget_set_accel_path() or
- * gtk_menu_item_set_accel_path() instead.
+ * runtime.
  */
 void
 gtk_widget_add_accelerator (GtkWidget      *widget,
@@ -5178,99 +5174,6 @@ gtk_widget_list_accel_closures (GtkWidget *widget)
   return clist;
 }
 
-typedef struct {
-  GQuark         path_quark;
-  GtkAccelGroup *accel_group;
-  GClosure      *closure;
-} AccelPath;
-
-static void
-destroy_accel_path (gpointer data)
-{
-  AccelPath *apath = data;
-
-  gtk_accel_group_disconnect (apath->accel_group, apath->closure);
-
-  /* closures_destroy takes care of unrefing the closure */
-  g_object_unref (apath->accel_group);
-
-  g_slice_free (AccelPath, apath);
-}
-
-
-/**
- * gtk_widget_set_accel_path:
- * @widget: a #GtkWidget
- * @accel_path: (allow-none): path used to look up the accelerator
- * @accel_group: (allow-none): a #GtkAccelGroup.
- *
- * Given an accelerator group, @accel_group, and an accelerator path,
- * @accel_path, sets up an accelerator in @accel_group so whenever the
- * key binding that is defined for @accel_path is pressed, @widget
- * will be activated.  This removes any accelerators (for any
- * accelerator group) installed by previous calls to
- * gtk_widget_set_accel_path(). Associating accelerators with
- * paths allows them to be modified by the user and the modifications
- * to be saved for future use. (See gtk_accel_map_save().)
- *
- * This function is a low level function that would most likely
- * be used by a menu creation system.
- *
- * If you only want to
- * set up accelerators on menu items gtk_menu_item_set_accel_path()
- * provides a somewhat more convenient interface.
- *
- * Note that @accel_path string will be stored in a #GQuark. Therefore, if you
- * pass a static string, you can save some memory by interning it first with
- * g_intern_static_string().
- **/
-void
-gtk_widget_set_accel_path (GtkWidget     *widget,
-                          const gchar   *accel_path,
-                          GtkAccelGroup *accel_group)
-{
-  AccelPath *apath;
-
-  g_return_if_fail (GTK_IS_WIDGET (widget));
-  g_return_if_fail (GTK_WIDGET_GET_CLASS (widget)->activate_signal != 0);
-
-  if (accel_path)
-    {
-      g_return_if_fail (GTK_IS_ACCEL_GROUP (accel_group));
-      g_return_if_fail (_gtk_accel_path_is_valid (accel_path));
-
-      gtk_accel_map_add_entry (accel_path, 0, 0);
-      apath = g_slice_new (AccelPath);
-      apath->accel_group = g_object_ref (accel_group);
-      apath->path_quark = g_quark_from_string (accel_path);
-      apath->closure = widget_new_accel_closure (widget, GTK_WIDGET_GET_CLASS (widget)->activate_signal);
-    }
-  else
-    apath = NULL;
-
-  /* also removes possible old settings */
-  g_object_set_qdata_full (G_OBJECT (widget), quark_accel_path, apath, destroy_accel_path);
-
-  if (apath)
-    gtk_accel_group_connect_by_path (apath->accel_group, g_quark_to_string (apath->path_quark), 
apath->closure);
-
-  g_signal_emit (widget, widget_signals[ACCEL_CLOSURES_CHANGED], 0);
-}
-
-const gchar*
-_gtk_widget_get_accel_path (GtkWidget *widget,
-                           gboolean  *locked)
-{
-  AccelPath *apath;
-
-  g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
-
-  apath = g_object_get_qdata (G_OBJECT (widget), quark_accel_path);
-  if (locked)
-    *locked = apath ? gtk_accel_group_get_is_locked (apath->accel_group) : TRUE;
-  return apath ? g_quark_to_string (apath->path_quark) : NULL;
-}
-
 /**
  * gtk_widget_mnemonic_activate:
  * @widget: a #GtkWidget
@@ -8233,7 +8136,6 @@ gtk_widget_real_destroy (GtkWidget *object)
     }
 
   /* wipe accelerator closures (keep order) */
-  g_object_set_qdata (G_OBJECT (widget), quark_accel_path, NULL);
   g_object_set_qdata (G_OBJECT (widget), quark_accel_closures, NULL);
 
   /* Callers of add_mnemonic_label() should disconnect on ::destroy */
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index e5b3e804ac..4af9f89eb2 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -454,10 +454,6 @@ gboolean   gtk_widget_remove_accelerator  (GtkWidget           *widget,
                                            guint                accel_key,
                                            GdkModifierType      accel_mods);
 GDK_AVAILABLE_IN_ALL
-void       gtk_widget_set_accel_path      (GtkWidget           *widget,
-                                           const gchar         *accel_path,
-                                           GtkAccelGroup       *accel_group);
-GDK_AVAILABLE_IN_ALL
 GList*     gtk_widget_list_accel_closures (GtkWidget           *widget);
 GDK_AVAILABLE_IN_ALL
 gboolean   gtk_widget_can_activate_accel  (GtkWidget           *widget,
diff --git a/testsuite/gtk/notify.c b/testsuite/gtk/notify.c
index 99b8f82ae8..15561d5721 100644
--- a/testsuite/gtk/notify.c
+++ b/testsuite/gtk/notify.c
@@ -493,13 +493,8 @@ test_type (gconstpointer data)
           g_str_equal (pspec->name, "text-column"))
         continue;
 
-      if (g_type_is_a (pspec->owner_type, GTK_TYPE_MENU_ITEM) &&
-         g_str_equal (pspec->name, "accel-path"))
-        continue;
-
       if (g_type_is_a (pspec->owner_type, GTK_TYPE_MENU) &&
-         (g_str_equal (pspec->name, "accel-path") ||
-          g_str_equal (pspec->name, "active")))
+         g_str_equal (pspec->name, "active"))
         continue;
 
       if (g_type_is_a (pspec->owner_type, GTK_TYPE_CHECK_MENU_ITEM) &&
diff --git a/testsuite/gtk/object.c b/testsuite/gtk/object.c
index 7b48446cbc..ccaae1fae0 100644
--- a/testsuite/gtk/object.c
+++ b/testsuite/gtk/object.c
@@ -72,8 +72,6 @@ list_ignore_properties (gboolean buglist)
     { "GtkFileChooserButton",   "action",               (void*) GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER },
     { "GtkFileChooserWidget",   "select-multiple",      (void*) 0x1 },                  /* property 
conflicts */
     { "GtkFileChooserDialog",   "select-multiple",      (void*) MATCH_ANY_VALUE },      /* property disabled 
*/
-    { "GtkMenu",                "accel-path",           (void*) MATCH_ANY_VALUE },      /* has odd 
restrictions in the setter */
-    { "GtkMenuItem",            "accel-path",           (void*) MATCH_ANY_VALUE },      /* has odd 
restrictions in the setter */
     { "GtkTextView",            "overwrite",            (void*) MATCH_ANY_VALUE },      /* needs text buffer 
*/
     { "GtkTreeView",            "expander-column",      (void*) MATCH_ANY_VALUE },      /* assertion list != 
NULL */
     { "GtkWindow",              "display",              (void*) MATCH_ANY_VALUE },


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