#include "gtkmarshalers.h"
#include "gtkalias.h"
+/**
+ * SECTION:gtkaccelgroup
+ * @Short_description: Groups of global keyboard accelerators for an entire GtkWindow
+ * @Title: Accelerator Groups
+ * @See_also:gtk_window_add_accel_group(), gtk_accel_map_change_entry(),
+ * gtk_item_factory_new(), gtk_label_new_with_mnemonic()
+ *
+ * A #GtkAccelGroup represents a group of keyboard accelerators,
+ * typically attached to a toplevel #GtkWindow (with
+ * gtk_window_add_accel_group()). Usually you won't need to create a
+ * #GtkAccelGroup directly; instead, when using #GtkItemFactory, GTK+
+ * automatically sets up the accelerators for your menus in the item
+ * factory's #GtkAccelGroup.
+ *
+ *
+ * Note that <firstterm>accelerators</firstterm> are different from
+ * <firstterm>mnemonics</firstterm>. Accelerators are shortcuts for
+ * activating a menu item; they appear alongside the menu item they're a
+ * shortcut for. For example "Ctrl+Q" might appear alongside the "Quit"
+ * menu item. Mnemonics are shortcuts for GUI elements such as text
+ * entries or buttons; they appear as underlined characters. See
+ * gtk_label_new_with_mnemonic(). Menu items can have both accelerators
+ * and mnemonics, of course.
+ */
+
/* --- prototypes --- */
static void gtk_accel_group_finalize (GObject *object);
_gtk_accel_map_remove_group (accel_path, accel_group);
}
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_accels);
/**
* gtk_accel_groups_from_object:
- * @object: a #GObject, usually a #GtkWindow
- * @returns: a list of all accel groups which are attached to @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)
/**
* gtk_accel_group_disconnect:
* @accel_group: the accelerator group to remove an accelerator from
- * @closure: the closure to remove from this accelerator group
+ * @closure: the closure to remove from this accelerator group, or %NULL
+ * to remove all closures
* @returns: %TRUE if the closure was found and got disconnected
*
* Removes an accelerator previously installed through
* gtk_accel_group_connect().
+ *
+ * Since 2.20 @closure can be %NULL.
*/
gboolean
gtk_accel_group_disconnect (GtkAccelGroup *accel_group,
g_return_val_if_fail (GTK_IS_ACCEL_GROUP (accel_group), FALSE);
for (i = 0; i < accel_group->n_accels; i++)
- if (accel_group->priv_accels[i].closure == closure)
+ if (accel_group->priv_accels[i].closure == closure || !closure)
{
g_object_ref (accel_group);
quick_accel_remove (accel_group, i);