[gtk/wip/otte/shortcut] gtk: Remove accel paths



commit 78fa90102fa0407d45164532d128023b0ccce373
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                        | 136 ------------------------------
 gtk/gtkmenu.h                        |   5 --
 gtk/gtkmenuitem.c                    | 159 -----------------------------------
 gtk/gtkmenuitem.h                    |   5 --
 gtk/gtkmenuitemprivate.h             |   6 --
 gtk/gtkmenuprivate.h                 |   1 -
 gtk/gtkshortcut.h                    |   5 ++
 gtk/gtkwidget.c                      | 100 +---------------------
 gtk/gtkwidget.h                      |   4 -
 gtk/gtkwidgetprivate.h               |   2 -
 testsuite/gtk/notify.c               |   7 +-
 testsuite/gtk/object.c               |   2 -
 14 files changed, 8 insertions(+), 431 deletions(-)
---
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index 0893a6f2e4..3142a60084 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -1721,8 +1721,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
@@ -1818,8 +1816,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
@@ -4272,7 +4268,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 cc5ba875fb..a51f8eb7b7 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -177,7 +177,6 @@ enum {
   PROP_0,
   PROP_ACTIVE,
   PROP_ACCEL_GROUP,
-  PROP_ACCEL_PATH,
   PROP_ATTACH_WIDGET,
   PROP_TEAROFF_STATE,
   PROP_TEAROFF_TITLE,
@@ -222,7 +221,6 @@ static void     gtk_menu_unrealize         (GtkWidget        *widget);
 static void     gtk_menu_size_allocate     (GtkWidget           *widget,
                                             const GtkAllocation *allocation,
                                             int                  baseline);
-static void     gtk_menu_show              (GtkWidget        *widget);
 static void     gtk_menu_snapshot          (GtkWidget        *widget,
                                             GtkSnapshot      *snapshot);
 static void     gtk_menu_motion            (GtkEventController *controller,
@@ -292,8 +290,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,
@@ -514,7 +510,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->snapshot = gtk_menu_snapshot;
   widget_class->focus = gtk_menu_focus;
   widget_class->can_activate_accel = gtk_menu_real_can_activate_accel;
@@ -622,19 +617,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:
    *
@@ -906,9 +888,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;
@@ -978,9 +957,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;
@@ -2175,7 +2151,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);
     }
 }
 
@@ -2214,107 +2189,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
@@ -2613,16 +2487,6 @@ gtk_menu_snapshot (GtkWidget   *widget,
   gtk_snapshot_pop (snapshot);
 }
 
-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,
                               int             for_size,
diff --git a/gtk/gtkmenu.h b/gtk/gtkmenu.h
index c9a639c0a8..25421b9223 100644
--- a/gtk/gtkmenu.h
+++ b/gtk/gtkmenu.h
@@ -143,11 +143,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);
 
 /* A reference count is kept for a widget when it is attached to
  * a particular widget. This is typically a menu item; it may also
diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c
index 6fdddbdeee..e086ac7c8f 100644
--- a/gtk/gtkmenuitem.c
+++ b/gtk/gtkmenuitem.c
@@ -118,7 +118,6 @@ enum {
 enum {
   PROP_0,
   PROP_SUBMENU,
-  PROP_ACCEL_PATH,
   PROP_LABEL,
   PROP_USE_UNDERLINE,
 
@@ -609,20 +608,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:
    *
@@ -769,9 +754,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;
@@ -804,9 +786,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;
@@ -1632,17 +1611,6 @@ gtk_menu_item_parent_cb (GObject    *object,
                          gpointer    user_data)
 {
   GtkMenuItem *menu_item = GTK_MENU_ITEM (object);
-  GtkMenu *menu;
-  GtkWidget *parent;
-
-  parent = gtk_widget_get_parent (GTK_WIDGET (object));
-  menu = GTK_IS_MENU (parent) ? GTK_MENU (parent) : 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);
 }
@@ -1658,133 +1626,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 *parent;
-  GtkWidget *widget;
-
-  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 */
-  parent = gtk_widget_get_parent (widget);
-  if (GTK_IS_MENU (parent))
-    {
-      GtkMenu *menu = GTK_MENU (parent);
-
-      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 b1c9684aab..dd903f011b 100644
--- a/gtk/gtkmenuitem.h
+++ b/gtk/gtkmenuitem.h
@@ -133,11 +133,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 0008c1f187..517987392c 100644
--- a/gtk/gtkmenuitemprivate.h
+++ b/gtk/gtkmenuitemprivate.h
@@ -34,8 +34,6 @@ struct _GtkMenuItemPrivate
 
   guint timer;
 
-  const char *accel_path;
-
   GtkActionHelper *action_helper;
 
   GtkWidget *arrow_widget;
@@ -48,10 +46,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 5a24b4a465..220522c693 100644
--- a/gtk/gtkmenuprivate.h
+++ b/gtk/gtkmenuprivate.h
@@ -45,7 +45,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 35ec7f8ec4..10b708e9fb 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -693,7 +693,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_parent_surface = 0;
 static GQuark          quark_input_shape_info = 0;
@@ -901,7 +900,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_parent_surface = g_quark_from_static_string ("gtk-parent-surface");
   quark_input_shape_info = g_quark_from_static_string ("gtk-input-shape-info");
@@ -5040,9 +5038,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,
@@ -5169,99 +5165,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
@@ -8718,7 +8621,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 dde2aee3d2..9e52fb0391 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -461,10 +461,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/gtk/gtkwidgetprivate.h b/gtk/gtkwidgetprivate.h
index f08d2c7ac6..2623fe6d38 100644
--- a/gtk/gtkwidgetprivate.h
+++ b/gtk/gtkwidgetprivate.h
@@ -210,8 +210,6 @@ void _gtk_widget_get_preferred_size_and_baseline(GtkWidget        *widget,
                                                 gint              *minimum_baseline,
                                                 gint              *natural_baseline);
 
-const gchar*      _gtk_widget_get_accel_path               (GtkWidget *widget,
-                                                            gboolean  *locked);
 const GSList *    gtk_widget_class_get_shortcuts           (GtkWidgetClass *widget_class);
 
 AtkObject *       _gtk_widget_peek_accessible              (GtkWidget *widget);
diff --git a/testsuite/gtk/notify.c b/testsuite/gtk/notify.c
index 13d5954fb5..ff79a4eeb7 100644
--- a/testsuite/gtk/notify.c
+++ b/testsuite/gtk/notify.c
@@ -484,13 +484,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 128b974714..166b525e47 100644
--- a/testsuite/gtk/object.c
+++ b/testsuite/gtk/object.c
@@ -74,8 +74,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]