1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
2 * GObject introspection: Signal implementation
4 * Copyright (C) 2005 Matthias Clasen
5 * Copyright (C) 2008,2009 Red Hat, Inc.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
25 #include <girepository.h>
26 #include "girepository-private.h"
27 #include "gitypelib-internal.h"
30 * SECTION:gisignalinfo
31 * @Short_description: Struct representing a signal
32 * @Title: GISignalInfo
34 * GISignalInfo represents a signal. It's a sub-struct of #GICallableInfo
35 * and contains a set of flags and a class closure.
37 * See #GICallableInfo for information on how to retreive arguments
38 * and other metadata from the signal.
40 * <refsect1 id="gi-gisignalinfo.struct-hierarchy" role="struct_hierarchy">
41 * <title role="struct_hierarchy.title">Struct hierarchy</title>
43 * <link linkend="gi-GIBaseInfo">GIBaseInfo</link>
44 * +----<link linkend="gi-GICallableInfo">GICallableInfo</link>
45 * +----<link linkend="gi-GIFunctionInfo">GIFunctionInfo</link>
47 * +----<link linkend="gi-GIVFuncInfo">GIVFuncInfo</link>
53 * g_signal_info_get_flags:
54 * @info: a #GISignalInfo
56 * Obtain the flags for this signal info. See #GSignalFlags for
57 * more information about possible flag values.
62 g_signal_info_get_flags (GISignalInfo *info)
65 GIRealInfo *rinfo = (GIRealInfo *)info;
68 g_return_val_if_fail (info != NULL, 0);
69 g_return_val_if_fail (GI_IS_SIGNAL_INFO (info), 0);
71 blob = (SignalBlob *)&rinfo->typelib->data[rinfo->offset];
75 flags = flags | G_SIGNAL_RUN_FIRST;
78 flags = flags | G_SIGNAL_RUN_LAST;
80 if (blob->run_cleanup)
81 flags = flags | G_SIGNAL_RUN_CLEANUP;
84 flags = flags | G_SIGNAL_NO_RECURSE;
87 flags = flags | G_SIGNAL_DETAILED;
90 flags = flags | G_SIGNAL_ACTION;
93 flags = flags | G_SIGNAL_NO_HOOKS;
99 * g_signal_info_get_class_closure:
100 * @info: a #GISignalInfo
102 * Obtain the class closure for this signal if one is set. The class
103 * closure is a virtual function on the type that the signal belongs to.
104 * If the signal lacks a closure %NULL will be returned.
106 * Returns: (transfer full): the class closure or %NULL
109 g_signal_info_get_class_closure (GISignalInfo *info)
111 GIRealInfo *rinfo = (GIRealInfo *)info;
114 g_return_val_if_fail (info != NULL, 0);
115 g_return_val_if_fail (GI_IS_SIGNAL_INFO (info), 0);
117 blob = (SignalBlob *)&rinfo->typelib->data[rinfo->offset];
119 if (blob->has_class_closure)
120 return g_interface_info_get_vfunc ((GIInterfaceInfo *)rinfo->container, blob->class_closure);
126 * g_signal_info_true_stops_emit:
127 * @info: a #GISignalInfo
129 * Obtain if the returning true in the signal handler will
130 * stop the emission of the signal.
132 * Returns: %TRUE if returning true stops the signal emission
135 g_signal_info_true_stops_emit (GISignalInfo *info)
137 GIRealInfo *rinfo = (GIRealInfo *)info;
140 g_return_val_if_fail (info != NULL, 0);
141 g_return_val_if_fail (GI_IS_SIGNAL_INFO (info), 0);
143 blob = (SignalBlob *)&rinfo->typelib->data[rinfo->offset];
145 return blob->true_stops_emit;