+
+
+/**
+ * gtk_accel_map_lock_path:
+ * @accel_path: a valid accelerator path
+ *
+ * Locks the given accelerator path. If the accelerator map doesn't yet contain
+ * an entry for @accel_path, a new one is created.
+ *
+ * Locking an accelerator path prevents its accelerator from being changed
+ * during runtime. A locked accelerator path can be unlocked by
+ * gtk_accel_map_unlock_path(). Refer to gtk_accel_map_change_entry()
+ * for information about runtime accelerator changes.
+ *
+ * If called more than once, @accel_path remains locked until
+ * gtk_accel_map_unlock_path() has been called an equivalent number
+ * of times.
+ *
+ * Note that locking of individual accelerator paths is independent from
+ * locking the #GtkAccelGroup containing them. For runtime accelerator
+ * changes to be possible, both the accelerator path and its #GtkAccelGroup
+ * have to be unlocked.
+ *
+ * Since: 2.4
+ **/
+void
+gtk_accel_map_lock_path (const gchar *accel_path)
+{
+ AccelEntry *entry;
+
+ g_return_if_fail (_gtk_accel_path_is_valid (accel_path));
+
+ entry = accel_path_lookup (accel_path);
+
+ if (!entry)
+ {
+ gtk_accel_map_add_entry (accel_path, 0, 0);
+ entry = accel_path_lookup (accel_path);
+ }
+
+ entry->lock_count += 1;
+}
+
+/**
+ * gtk_accel_map_unlock_path:
+ * @accel_path: a valid accelerator path
+ *
+ * Undoes the last call to gtk_accel_map_lock_path() on this @accel_path.
+ * Refer to gtk_accel_map_lock_path() for information about accelerator path locking.
+ *
+ * Since: 2.4
+ **/
+void
+gtk_accel_map_unlock_path (const gchar *accel_path)
+{
+ AccelEntry *entry;
+
+ g_return_if_fail (_gtk_accel_path_is_valid (accel_path));
+
+ entry = accel_path_lookup (accel_path);
+
+ g_return_if_fail (entry != NULL && entry->lock_count > 0);
+
+ entry->lock_count -= 1;
+}
+
+G_DEFINE_TYPE (GtkAccelMap, gtk_accel_map, G_TYPE_OBJECT)
+
+static void
+gtk_accel_map_class_init (GtkAccelMapClass *accel_map_class)
+{
+ /**
+ * GtkAccelMap::changed:
+ * @object: the global accel map object
+ * @accel_path: the path of the accelerator that changed
+ * @accel_key: the key value for the new accelerator
+ * @accel_mods: the modifier mask for the new accelerator
+ *
+ * Notifies of a change in the global accelerator map.
+ * The path is also used as the detail for the signal,
+ * so it is possible to connect to
+ * changed::<replaceable>accel_path</replaceable>.
+ *
+ * Since: 2.4
+ */
+ accel_map_signals[CHANGED] = g_signal_new (I_("changed"),
+ G_TYPE_FROM_CLASS (accel_map_class),
+ G_SIGNAL_DETAILED|G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ _gtk_marshal_VOID__STRING_UINT_FLAGS,
+ G_TYPE_NONE, 3,
+ G_TYPE_STRING, G_TYPE_UINT, GDK_TYPE_MODIFIER_TYPE);
+}
+
+static void
+gtk_accel_map_init (GtkAccelMap *accel_map)
+{
+}
+
+/**
+ * gtk_accel_map_get:
+ *
+ * Gets the singleton global #GtkAccelMap object. This object
+ * is useful only for notification of changes to the accelerator
+ * map via the ::changed signal; it isn't a parameter to the
+ * other accelerator map functions.
+ *
+ * Return value: (transfer none): the global #GtkAccelMap object
+ *
+ * Since: 2.4
+ **/
+GtkAccelMap *
+gtk_accel_map_get (void)
+{
+ if (!accel_map)
+ accel_map = g_object_new (GTK_TYPE_ACCEL_MAP, NULL);
+
+ return accel_map;
+}
+
+static void
+do_accel_map_changed (AccelEntry *entry)
+{
+ if (accel_map)
+ g_signal_emit (accel_map,
+ accel_map_signals[CHANGED],
+ g_quark_from_string (entry->accel_path),
+ entry->accel_path,
+ entry->accel_key,
+ entry->accel_mods);
+}
+
+gchar *
+_gtk_accel_path_for_action (const gchar *action_name,
+ GVariant *parameter)
+{
+ GString *s;
+
+ s = g_string_new ("<GAction>/");
+ g_string_append (s, action_name);
+ if (parameter)
+ {
+ g_string_append_c (s, '/');
+ g_variant_print_string (parameter, s, FALSE);
+ }
+ return g_string_free (s, FALSE);
+}
+