2 Handle any events in application.
5 Copyright (C) 2011-2016
6 Free Software Foundation, Inc.
9 Slava Zanko <slavazanko@gmail.com>, 2011.
11 This file is part of the Midnight Commander.
13 The Midnight Commander is free software: you can redistribute it
14 and/or modify it under the terms of the GNU General Public License as
15 published by the Free Software Foundation, either version 3 of the License,
16 or (at your option) any later version.
18 The Midnight Commander is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
23 You should have received a copy of the GNU General Public License
24 along with this program. If not, see <http://www.gnu.org/licenses/>.
29 #include "lib/global.h"
30 #include "lib/event.h"
34 /*** global variables ****************************************************************************/
36 /*** file scope macro definitions ****************************************************************/
38 /*** file scope type declarations ****************************************************************/
40 /*** file scope variables ************************************************************************/
42 /*** file scope functions ************************************************************************/
44 /* --------------------------------------------------------------------------------------------- */
45 /*** public functions ****************************************************************************/
46 /* --------------------------------------------------------------------------------------------- */
49 mc_event_raise (const gchar
* event_group_name
, const gchar
* event_name
, gpointer event_data
)
55 if (mc_event_grouplist
== NULL
|| event_group_name
== NULL
|| event_name
== NULL
)
58 event_group
= mc_event_get_event_group_by_name (event_group_name
, FALSE
, NULL
);
59 if (event_group
== NULL
)
62 callbacks
= mc_event_get_event_by_name (event_group
, event_name
, FALSE
, NULL
);
63 if (callbacks
== NULL
)
66 for (array_index
= callbacks
->len
; array_index
> 0; array_index
--)
68 mc_event_callback_t
*cb
= g_ptr_array_index (callbacks
, array_index
- 1);
69 if (!(*cb
->callback
) (event_group_name
, event_name
, cb
->init_data
, event_data
))
75 /* --------------------------------------------------------------------------------------------- */