From 9800f731e09e28defb46994ae11674d2553f0cc0 Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Tue, 20 Nov 2001 23:43:03 +0000 Subject: applied patch from owen to get rid of accel map notifiers. changed things Tue Nov 20 21:25:08 2001 Tim Janik * applied patch from owen to get rid of accel map notifiers. changed things to fix reentrancy and API as discussed on gtk-devel. * gtk/gtkaccelgroup.[hc]: (gtk_accel_group_finalize): unregister this accel group from all accel map paths. (accel_closure_invalidate): handle invalidation of closures by disconnecting their accelerators. (quick_accel_add): move closure connection and changed notification into this function to reduce code duplication. don't emit change notification on closurers without accelerators. (quick_accel_remove): rewrite, do the exact opposite of quick_accel_add for a GtkAccelGroupEntry. (gtk_accel_group_connect): get rid of the accel_path_quark argument. (gtk_accel_group_connect_by_path): new function to add accelerators with an accel path. (gtk_accel_group_disconnect_closure): new function, disconnect a closure from of an accel group. (gtk_accel_group_disconnect): loop over all closure for a accel_ley, accel_mods pair and remove them. (_gtk_accel_group_reconnect): new function that basically does gtk_accel_group_disconnect_closure() and gtk_accel_group_connect_by_path() once an accel path changed. (gtk_accel_groups_disconnect_closure): remove this, there's gtk_accel_group_disconnect_closure(). * gtk/gtkaccelmap.[hc]: keep list of accel groups per entry now, nuke notifiers. (_gtk_accel_path_is_valid): make this non-static for gtkwidget.c and gtkaccelgroup.c assertions. (gtk_accel_map_add_notifer): removed this function. (gtk_accel_map_remove_notifer): same. (_gtk_accel_map_add_group): (_gtk_accel_map_remove_group): (un-)register accel groups, with accel paths for correct propagation. (gtk_accel_map_add_entry): return void. (gtk_accel_map_lookup): return gboolean instead of GQuark. * gtk/gtkitemfactory.c (gtk_item_factory_add_foreign): always set accel_path on widgets. * gtk/gtkwidget.[hc]: (accel_path_changed): got rid of this, changes are handled by accel maps internally now. (_gtk_widget_set_accel_path): get things to work without notifiers. (gtk_widget_list_accel_closures): list accel closures of a widget. * gtk/gtkwindow.[hc]: rename ::accels_changed, to ::keys_changed. --- gtk/gtkaccelgroup.h | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) (limited to 'gtk/gtkaccelgroup.h') diff --git a/gtk/gtkaccelgroup.h b/gtk/gtkaccelgroup.h index 5fca1a33b3..cfb207f8a7 100644 --- a/gtk/gtkaccelgroup.h +++ b/gtk/gtkaccelgroup.h @@ -88,20 +88,23 @@ struct _GtkAccelKey /* -- Accelerator Groups --- */ -GType gtk_accel_group_get_type (void); -GtkAccelGroup* gtk_accel_group_new (void); -void gtk_accel_group_lock (GtkAccelGroup *accel_group); -void gtk_accel_group_unlock (GtkAccelGroup *accel_group); -void gtk_accel_group_connect (GtkAccelGroup *accel_group, - guint accel_key, - GdkModifierType accel_mods, - GtkAccelFlags accel_flags, - GClosure *closure, - GQuark accel_path_quark); -gboolean gtk_accel_group_disconnect (GtkAccelGroup *accel_group, - guint accel_key, - GdkModifierType accel_mods); -gboolean gtk_accel_groups_disconnect_closure (GClosure *closure); +GType gtk_accel_group_get_type (void); +GtkAccelGroup* gtk_accel_group_new (void); +void gtk_accel_group_lock (GtkAccelGroup *accel_group); +void gtk_accel_group_unlock (GtkAccelGroup *accel_group); +void gtk_accel_group_connect (GtkAccelGroup *accel_group, + guint accel_key, + GdkModifierType accel_mods, + GtkAccelFlags accel_flags, + GClosure *closure); +void gtk_accel_group_connect_by_path (GtkAccelGroup *accel_group, + const gchar *accel_path, + GClosure *closure); +gboolean gtk_accel_group_disconnect (GtkAccelGroup *accel_group, + GClosure *closure); +gboolean gtk_accel_group_disconnect_key (GtkAccelGroup *accel_group, + guint accel_key, + GdkModifierType accel_mods); /* --- GtkActivatable glue --- */ @@ -138,6 +141,10 @@ GtkAccelGroupEntry* gtk_accel_group_query (GtkAccelGroup *accel_group, guint accel_key, GdkModifierType accel_mods, guint *n_entries); + +void _gtk_accel_group_reconnect (GtkAccelGroup *accel_group, + GQuark accel_path_quark); + struct _GtkAccelGroupEntry { GtkAccelKey key; -- cgit v1.2.1