mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Change gnc_forall_gui_components() to pass the registered user_data to
the callback routine, and to return a count of the callback functions called. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@6808 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
d3306106c4
commit
6e28432b23
@ -890,16 +890,17 @@ find_component_ids_by_class (const char *component_class)
|
||||
return list;
|
||||
}
|
||||
|
||||
void
|
||||
gint
|
||||
gnc_forall_gui_components (const char *component_class,
|
||||
GNCComponentHandler handler,
|
||||
gpointer iter_data)
|
||||
{
|
||||
GList *list;
|
||||
GList *node;
|
||||
gint count = 0;
|
||||
|
||||
if (!handler)
|
||||
return;
|
||||
return(0);
|
||||
|
||||
/* so components can be destroyed during the forall */
|
||||
list = find_component_ids_by_class (component_class);
|
||||
@ -911,8 +912,10 @@ gnc_forall_gui_components (const char *component_class,
|
||||
if (!ci)
|
||||
continue;
|
||||
|
||||
handler (ci->component_class, ci->component_id, iter_data);
|
||||
handler (ci->component_class, ci->component_id, ci->user_data, iter_data);
|
||||
count++;
|
||||
}
|
||||
|
||||
g_list_free (list);
|
||||
return(count);
|
||||
}
|
||||
|
@ -97,6 +97,7 @@ typedef gboolean (*GNCComponentFindHandler) (gpointer find_data,
|
||||
*/
|
||||
typedef void (*GNCComponentHandler) (const char *class,
|
||||
gint component_id,
|
||||
gpointer user_data,
|
||||
gpointer iter_data);
|
||||
|
||||
/* gnc_component_manager_init
|
||||
@ -333,7 +334,7 @@ gpointer gnc_find_first_gui_component (const char *component_class,
|
||||
* Notes on forall: components may be unregistered by the handler,
|
||||
* but no components should be registered.
|
||||
*/
|
||||
void gnc_forall_gui_components (const char *component_class,
|
||||
gint gnc_forall_gui_components (const char *component_class,
|
||||
GNCComponentHandler handler,
|
||||
gpointer iter_data);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user