~ubuntu-branches/debian/experimental/gtk+2.0/experimental

« back to all changes in this revision

Viewing changes to docs/faq/html/x571.html

  • Committer: Bazaar Package Importer
  • Author(s): Emilio Pozuelo Monfort
  • Date: 2010-12-23 03:09:40 UTC
  • mfrom: (1.13.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20101223030940-ctsv8mereipe1e2p
Tags: 2.23.3-1
* New upstream release.
  + debian/control.in:
    - Bump the libglib2.0-dev build requirement.
  + debian/patches/070_mandatory-relibtoolize.patch:
    - Refreshed.
  + debian/libgtk2.0-0.symbols:
    - Updated for the new symbols.
  + debian/rules:
    - Bump the shver.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/loose.dtd">
 
2
<HTML
 
3
><HEAD
 
4
><TITLE
 
5
>I need to add a new signal to a GTK+ widget. Any
 
6
idea?</TITLE
 
7
><META
 
8
NAME="GENERATOR"
 
9
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
 
10
REL="HOME"
 
11
TITLE="GTK+ FAQ"
 
12
HREF="book1.html"><LINK
 
13
REL="UP"
 
14
TITLE="Development with GTK+: general questions"
 
15
HREF="c466.html"><LINK
 
16
REL="PREVIOUS"
 
17
TITLE="I have my signal connected to the the (whatever) event,
 
18
but it seems I don't catch it. What's wrong?"
 
19
HREF="x563.html"><LINK
 
20
REL="NEXT"
 
21
TITLE="Is it possible to get some text displayed which is
 
22
truncated to fit inside its allocation?"
 
23
HREF="x581.html"></HEAD
 
24
><BODY
 
25
CLASS="SECT1"
 
26
BGCOLOR="#FFFFFF"
 
27
TEXT="#000000"
 
28
LINK="#0000FF"
 
29
VLINK="#840084"
 
30
ALINK="#0000FF"
 
31
><DIV
 
32
CLASS="NAVHEADER"
 
33
><TABLE
 
34
SUMMARY="Header navigation table"
 
35
WIDTH="100%"
 
36
BORDER="0"
 
37
CELLPADDING="0"
 
38
CELLSPACING="0"
 
39
><TR
 
40
><TH
 
41
COLSPAN="3"
 
42
ALIGN="center"
 
43
>GTK+ FAQ</TH
 
44
></TR
 
45
><TR
 
46
><TD
 
47
WIDTH="10%"
 
48
ALIGN="left"
 
49
VALIGN="bottom"
 
50
><A
 
51
HREF="x563.html"
 
52
ACCESSKEY="P"
 
53
>&#60;&#60;&#60; Previous</A
 
54
></TD
 
55
><TD
 
56
WIDTH="80%"
 
57
ALIGN="center"
 
58
VALIGN="bottom"
 
59
>Development with GTK+: general questions</TD
 
60
><TD
 
61
WIDTH="10%"
 
62
ALIGN="right"
 
63
VALIGN="bottom"
 
64
><A
 
65
HREF="x581.html"
 
66
ACCESSKEY="N"
 
67
>Next &#62;&#62;&#62;</A
 
68
></TD
 
69
></TR
 
70
></TABLE
 
71
><HR
 
72
ALIGN="LEFT"
 
73
WIDTH="100%"></DIV
 
74
><DIV
 
75
CLASS="SECT1"
 
76
><H1
 
77
CLASS="SECT1"
 
78
><A
 
79
NAME="AEN571"
 
80
>I need to add a new signal to a GTK+ widget. Any
 
81
idea?</A
 
82
></H1
 
83
><P
 
84
>If the signal you want to add may be beneficial for
 
85
other GTK+ users, you may want to submit a patch that
 
86
presents your changes. Check the tutorial for more
 
87
information about adding signals to a widget class.</P
 
88
><P
 
89
>If you don't think it is the case or if your patch is
 
90
not applied you'll have to use the
 
91
<TT
 
92
CLASS="LITERAL"
 
93
>gtk_object_class_user_signal_new</TT
 
94
>
 
95
function. <TT
 
96
CLASS="LITERAL"
 
97
>gtk_object_class_user_signal_new</TT
 
98
> allows you
 
99
to add a new signal to a predefined GTK+ widget without any
 
100
modification of the GTK+ source code. The new signal can be
 
101
emited with <TT
 
102
CLASS="LITERAL"
 
103
>gtk_signal_emit</TT
 
104
> and can be
 
105
handled in the same way as other signals.</P
 
106
><P
 
107
>Tim Janik posted this code snippet:</P
 
108
><TABLE
 
109
BORDER="0"
 
110
BGCOLOR="#E0E0E0"
 
111
WIDTH="100%"
 
112
><TR
 
113
><TD
 
114
><PRE
 
115
CLASS="PROGRAMLISTING"
 
116
>static guint signal_user_action = 0;
 
117
 
 
118
signal_user_action =
 
119
  gtk_object_class_user_signal_new (gtk_type_class (GTK_TYPE_WIDGET),
 
120
                    "user_action",
 
121
                    GTK_RUN_LAST | GTK_RUN_ACTION,
 
122
                    gtk_marshal_NONE__POINTER,
 
123
                    GTK_TYPE_NONE, 1,
 
124
                    GTK_TYPE_POINTER);
 
125
 
 
126
void
 
127
gtk_widget_user_action (GtkWidget *widget,
 
128
                        gpointer   act_data)
 
129
{
 
130
  g_return_if_fail (GTK_IS_WIDGET (widget));
 
131
 
 
132
  gtk_signal_emit (GTK_OBJECT (widget), signal_user_action, act_data);
 
133
}</PRE
 
134
></TD
 
135
></TR
 
136
></TABLE
 
137
><P
 
138
>If you want your new signal to have more than the
 
139
classical gpointer parameter, you'll have to play with GTK+
 
140
marshallers.</P
 
141
></DIV
 
142
><DIV
 
143
CLASS="NAVFOOTER"
 
144
><HR
 
145
ALIGN="LEFT"
 
146
WIDTH="100%"><TABLE
 
147
SUMMARY="Footer navigation table"
 
148
WIDTH="100%"
 
149
BORDER="0"
 
150
CELLPADDING="0"
 
151
CELLSPACING="0"
 
152
><TR
 
153
><TD
 
154
WIDTH="33%"
 
155
ALIGN="left"
 
156
VALIGN="top"
 
157
><A
 
158
HREF="x563.html"
 
159
ACCESSKEY="P"
 
160
>&#60;&#60;&#60; Previous</A
 
161
></TD
 
162
><TD
 
163
WIDTH="34%"
 
164
ALIGN="center"
 
165
VALIGN="top"
 
166
><A
 
167
HREF="book1.html"
 
168
ACCESSKEY="H"
 
169
>Home</A
 
170
></TD
 
171
><TD
 
172
WIDTH="33%"
 
173
ALIGN="right"
 
174
VALIGN="top"
 
175
><A
 
176
HREF="x581.html"
 
177
ACCESSKEY="N"
 
178
>Next &#62;&#62;&#62;</A
 
179
></TD
 
180
></TR
 
181
><TR
 
182
><TD
 
183
WIDTH="33%"
 
184
ALIGN="left"
 
185
VALIGN="top"
 
186
>I have my signal connected to the the (whatever) event,
 
187
but it seems I don't catch it. What's wrong?</TD
 
188
><TD
 
189
WIDTH="34%"
 
190
ALIGN="center"
 
191
VALIGN="top"
 
192
><A
 
193
HREF="c466.html"
 
194
ACCESSKEY="U"
 
195
>Up</A
 
196
></TD
 
197
><TD
 
198
WIDTH="33%"
 
199
ALIGN="right"
 
200
VALIGN="top"
 
201
>Is it possible to get some text displayed which is
 
202
truncated to fit inside its allocation?</TD
 
203
></TR
 
204
></TABLE
 
205
></DIV
 
206
></BODY
 
207
></HTML
 
208
>
 
 
b'\\ No newline at end of file'