forked from AuroraMiddleware/gtk
Fix grammar of docs.
Wed Jan 7 21:42:49 2004 Matthias Clasen <maclas@gmx.de> * gtk/gtkaccelmap.c (gtk_accel_map_lock_path): Fix grammar of docs.
This commit is contained in:
parent
77cbf47adf
commit
c22143c9e0
@ -1,3 +1,8 @@
|
||||
Wed Jan 7 21:42:49 2004 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtkaccelmap.c (gtk_accel_map_lock_path): Fix grammar of
|
||||
docs.
|
||||
|
||||
2004-01-07 Jan Arne Petersen <jpetersen@uni-bonn.de>
|
||||
|
||||
* gtk/gtkfilechooserdefault.c: (shortcuts_insert_path),
|
||||
|
@ -1,3 +1,8 @@
|
||||
Wed Jan 7 21:42:49 2004 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtkaccelmap.c (gtk_accel_map_lock_path): Fix grammar of
|
||||
docs.
|
||||
|
||||
2004-01-07 Jan Arne Petersen <jpetersen@uni-bonn.de>
|
||||
|
||||
* gtk/gtkfilechooserdefault.c: (shortcuts_insert_path),
|
||||
|
@ -1,3 +1,8 @@
|
||||
Wed Jan 7 21:42:49 2004 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtkaccelmap.c (gtk_accel_map_lock_path): Fix grammar of
|
||||
docs.
|
||||
|
||||
2004-01-07 Jan Arne Petersen <jpetersen@uni-bonn.de>
|
||||
|
||||
* gtk/gtkfilechooserdefault.c: (shortcuts_insert_path),
|
||||
|
@ -1,3 +1,8 @@
|
||||
Wed Jan 7 21:42:49 2004 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtkaccelmap.c (gtk_accel_map_lock_path): Fix grammar of
|
||||
docs.
|
||||
|
||||
2004-01-07 Jan Arne Petersen <jpetersen@uni-bonn.de>
|
||||
|
||||
* gtk/gtkfilechooserdefault.c: (shortcuts_insert_path),
|
||||
|
@ -1,3 +1,8 @@
|
||||
Wed Jan 7 21:42:49 2004 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtkaccelmap.c (gtk_accel_map_lock_path): Fix grammar of
|
||||
docs.
|
||||
|
||||
2004-01-07 Jan Arne Petersen <jpetersen@uni-bonn.de>
|
||||
|
||||
* gtk/gtkfilechooserdefault.c: (shortcuts_insert_path),
|
||||
|
@ -51,9 +51,11 @@ typedef struct {
|
||||
/* --- variables --- */
|
||||
static GHashTable *accel_entry_ht = NULL; /* accel_path -> AccelEntry */
|
||||
static GSList *accel_filters = NULL;
|
||||
|
||||
static GHookList *change_hooks = NULL;
|
||||
|
||||
/* --- functions --- */
|
||||
static void invoke_change_hooks (AccelEntry *entry);
|
||||
|
||||
static guint
|
||||
accel_entry_hash (gconstpointer key)
|
||||
{
|
||||
@ -163,6 +165,8 @@ gtk_accel_map_add_entry (const gchar *accel_path,
|
||||
entry->changed = FALSE;
|
||||
entry->locked = FALSE;
|
||||
g_hash_table_insert (accel_entry_ht, entry, entry);
|
||||
|
||||
invoke_change_hooks (entry);
|
||||
}
|
||||
}
|
||||
|
||||
@ -243,6 +247,8 @@ internal_change_entry (const gchar *accel_path,
|
||||
entry->accel_mods = accel_mods;
|
||||
entry->changed = TRUE;
|
||||
entry->locked = FALSE;
|
||||
|
||||
invoke_change_hooks (entry);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
@ -266,6 +272,8 @@ internal_change_entry (const gchar *accel_path,
|
||||
entry->accel_key = accel_key;
|
||||
entry->accel_mods = accel_mods;
|
||||
entry->changed = TRUE;
|
||||
|
||||
invoke_change_hooks (entry);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
@ -370,12 +378,15 @@ internal_change_entry (const gchar *accel_path,
|
||||
entry->accel_key = accel_key;
|
||||
entry->accel_mods = accel_mods;
|
||||
entry->changed = TRUE;
|
||||
|
||||
for (slist = group_list; slist; slist = slist->next)
|
||||
_gtk_accel_group_reconnect (slist->data, g_quark_from_string (entry->accel_path));
|
||||
|
||||
/* unref accel groups */
|
||||
for (slist = group_list; slist; slist = slist->next)
|
||||
g_object_unref (slist->data);
|
||||
|
||||
invoke_change_hooks (entry);
|
||||
}
|
||||
g_slist_free (replace_list);
|
||||
g_slist_free (group_list);
|
||||
@ -839,10 +850,10 @@ _gtk_accel_map_remove_group (const gchar *accel_path,
|
||||
*
|
||||
* Locks the given accelerator path.
|
||||
*
|
||||
* Locking an accelerator path prevents its accelerator to be changed
|
||||
* 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()
|
||||
* about runtime accelerator changes.
|
||||
* for information about runtime accelerator changes.
|
||||
*
|
||||
* Note that locking of individual accelerator paths is independent from
|
||||
* locking the #GtkAccelGroup containing them. For runtime accelerator
|
||||
@ -869,7 +880,7 @@ gtk_accel_map_lock_path (const gchar *accel_path)
|
||||
* @accel_path: a valid accelerator path
|
||||
*
|
||||
* Unlocks the given accelerator path. Refer to gtk_accel_map_lock_path()
|
||||
* about accelerator path locking.
|
||||
* for information about accelerator path locking.
|
||||
*
|
||||
* Since: 2.4
|
||||
**/
|
||||
@ -885,3 +896,84 @@ gtk_accel_map_unlock_path (const gchar *accel_path)
|
||||
if (entry)
|
||||
entry->locked = FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_accel_map_add_change_hook:
|
||||
* @hook_func: the function to be called
|
||||
* @hook_data: data to pass as the first argument of @hook_func
|
||||
* @data_destroy: destroy notify to be called if @hook_data is destroyed
|
||||
*
|
||||
* Adds a function to be called whenever an accel map entry is changed.
|
||||
* The @accel_key and @accel_mods arguments passed to @hook_func are the new
|
||||
* values.
|
||||
*
|
||||
* Returns: A numerical id which can be used to remove the change hook
|
||||
* again with gtk_accel_map_remove_change_hook().
|
||||
* Since: 2.4
|
||||
*/
|
||||
gulong
|
||||
gtk_accel_map_add_change_hook (GtkAccelMapForeach hook_func,
|
||||
gpointer hook_data,
|
||||
GDestroyNotify data_destroy)
|
||||
{
|
||||
GHook *hook;
|
||||
|
||||
if (!change_hooks)
|
||||
{
|
||||
change_hooks = g_new (GHookList, 1);
|
||||
g_hook_list_init (change_hooks, sizeof (GHook));
|
||||
}
|
||||
|
||||
hook = g_hook_alloc (change_hooks);
|
||||
hook->func = (gpointer)hook_func;
|
||||
hook->data = hook_data;
|
||||
hook->destroy = data_destroy;
|
||||
|
||||
g_hook_append (change_hooks, hook);
|
||||
|
||||
return hook->hook_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_accel_map_remove_change_hook:
|
||||
* @hook_id: an id returned by gtk_accel_map_add_change_hook()
|
||||
*
|
||||
* Removes a change hook previously added by gtk_accel_map_add_change_hook().
|
||||
*
|
||||
* Since: 2.4
|
||||
*/
|
||||
void
|
||||
gtk_accel_map_remove_change_hook (gulong hook_id)
|
||||
{
|
||||
if (!g_hook_destroy (change_hooks, hook_id))
|
||||
g_warning ("%s: GtkAccelMap had no hook (%lu) to remove", G_STRLOC, hook_id);
|
||||
}
|
||||
|
||||
static void
|
||||
invoke_change_hooks (AccelEntry *entry)
|
||||
{
|
||||
GHook *hook;
|
||||
|
||||
if (!change_hooks || !change_hooks->is_setup)
|
||||
return;
|
||||
|
||||
hook = g_hook_first_valid (change_hooks, FALSE);
|
||||
while (hook)
|
||||
{
|
||||
GtkAccelMapForeach func;
|
||||
gboolean was_in_call;
|
||||
|
||||
func = (GtkAccelMapForeach) hook->func;
|
||||
|
||||
was_in_call = G_HOOK_IN_CALL (hook);
|
||||
hook->flags |= G_HOOK_FLAG_IN_CALL;
|
||||
func (hook->data, entry->accel_path, entry->accel_key,
|
||||
entry->accel_mods, entry->changed);
|
||||
if (!was_in_call)
|
||||
hook->flags &= ~G_HOOK_FLAG_IN_CALL;
|
||||
|
||||
hook = g_hook_next_valid (change_hooks, hook, FALSE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user