[gtk+] Allow removing all closures with gtk_accel_group_disconnect



commit f4d5ed539706c3ec97d4a0c7ae71510b7bd2858a
Author: Christian Dywan <christian twotoasts de>
Date:   Tue Oct 27 21:25:56 2009 +0100

    Allow removing all closures with gtk_accel_group_disconnect
    
    https://bugzilla.gnome.org/show_bug.cgi?id=599403

 gtk/gtkaccelgroup.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkaccelgroup.c b/gtk/gtkaccelgroup.c
index 03ade12..29e34eb 100644
--- a/gtk/gtkaccelgroup.c
+++ b/gtk/gtkaccelgroup.c
@@ -690,11 +690,14 @@ gtk_accel_group_connect_by_path (GtkAccelGroup	*accel_group,
 /**
  * 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,
@@ -705,7 +708,7 @@ 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);



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