Mercurial > pidgin.yaz
annotate src/gtkconv.h @ 4849:adf9ca39578f
[gaim-migrate @ 5174]
Christian, I got the following backtrace after opening and closing some
convos:
#4 <signal handler called>
#5 0x08066e47 in gaim_window_get_active_conversation (win=0x82b44d8)
at conversation.c:775
#6 0x08085599 in update_send_as_selection (win=0x82b44d8) at gtkconv.c:1964
#7 0x4067fa4c in g_timeout_dispatch () from /usr/lib/libglib-2.0.so.0
So although I couldn't reproduce it, I guess it's still possible for
Gaim to crash there. This fixes that by making sure that win still
exists before it tries to update the send as menu for it. The other
way to fix this would be to keep track of the g_timer thingy and then
remove it when destroying win. I don't know which was is better.
Probably the other way.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 21 Mar 2003 20:59:31 +0000 |
parents | 0c85078fd371 |
children | 4691c5936c01 |
rev | line source |
---|---|
4359 | 1 /** |
2 * @file gtkconv.h GTK+ Conversation API | |
3 * | |
4 * gaim | |
5 * | |
6 * Copyright (C) 2002-2003, Christian Hammond <chipx86@gnupdate.org> | |
7 * | |
8 * This program is free software; you can redistribute it and/or modify | |
9 * it under the terms of the GNU General Public License as published by | |
10 * the Free Software Foundation; either version 2 of the License, or | |
11 * (at your option) any later version. | |
12 * | |
13 * This program is distributed in the hope that it will be useful, | |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 * GNU General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU General Public License | |
19 * along with this program; if not, write to the Free Software | |
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
21 * | |
22 */ | |
23 | |
24 #ifndef _GAIM_GTK_CONVERSATION_H_ | |
25 #define _GAIM_GTK_CONVERSATION_H_ | |
26 | |
27 /************************************************************************** | |
28 * @name Structures | |
29 **************************************************************************/ | |
30 | |
31 struct gaim_gtk_window; | |
32 struct gaim_gtk_conversation; | |
33 struct gaim_gtk_im_pane; | |
34 struct gaim_gtk_chat_pane; | |
35 | |
36 /** | |
37 * A GTK+ representation of a graphical window containing one or more | |
38 * conversations. | |
39 */ | |
40 struct gaim_gtk_window | |
41 { | |
42 GtkWidget *window; /**< The window. */ | |
43 GtkWidget *notebook; /**< The notebook of conversations. */ | |
44 | |
45 struct | |
46 { | |
47 GtkWidget *menubar; | |
48 | |
49 GtkWidget *view_history; | |
50 GtkWidget *insert_link; | |
51 GtkWidget *insert_image; | |
52 GtkWidget *logging; | |
53 GtkWidget *sounds; | |
54 GtkWidget *send_as; | |
4736 | 55 GtkWidget *typing_icon; |
4359 | 56 |
4630 | 57 GtkItemFactory *item_factory; |
58 | |
4359 | 59 } menu; |
60 | |
61 /* Tab dragging stuff. */ | |
62 gboolean in_drag; | |
63 gboolean in_predrag; | |
64 | |
65 gint drag_min_x, drag_max_x, drag_min_y, drag_max_y; | |
66 | |
67 gint drag_motion_signal; | |
68 gint drag_leave_signal; | |
69 }; | |
70 | |
71 /** | |
72 * GTK+ Instant Message panes. | |
73 */ | |
74 struct gaim_gtk_im_pane | |
75 { | |
76 GtkWidget *warn; | |
77 GtkWidget *block; | |
78 GtkWidget *add; | |
79 GtkWidget *sep1; | |
80 GtkWidget *sep2; | |
81 GtkWidget *check; | |
82 GtkWidget *progress; | |
83 | |
84 gboolean a_virgin; | |
85 | |
86 /* Buddy icon stuff */ | |
87 GtkWidget *icon; | |
88 GdkPixbufAnimation *anim; | |
89 GdkPixbufAnimationIter *iter; | |
90 guint32 icon_timer; | |
91 GtkWidget *save_icon; | |
92 }; | |
93 | |
94 /** | |
95 * GTK+ Chat panes. | |
96 */ | |
97 struct gaim_gtk_chat_pane | |
98 { | |
99 GtkWidget *count; | |
100 GtkWidget *list; | |
101 GtkWidget *whisper; | |
102 GtkWidget *invite; | |
103 GtkWidget *topic_text; | |
104 }; | |
105 | |
106 /** | |
107 * A GTK+ conversation pane. | |
108 */ | |
109 struct gaim_gtk_conversation | |
110 { | |
111 gboolean make_sound; | |
112 gboolean has_font; | |
113 char fontface[128]; | |
114 GdkColor fg_color; | |
115 GdkColor bg_color; | |
116 | |
117 GtkTooltips *tooltips; | |
118 | |
119 GtkWidget *tab_cont; | |
120 GtkWidget *tabby; | |
121 | |
122 GtkWidget *imhtml; | |
123 GtkTextBuffer *entry_buffer; | |
124 GtkWidget *entry; | |
125 | |
126 GtkWidget *send; | |
127 GtkWidget *info; | |
128 GtkWidget *close; | |
129 GtkWidget *tab_label; | |
130 GtkSizeGroup *sg; | |
131 | |
132 GtkWidget *bbox; | |
133 GtkWidget *sw; | |
134 | |
135 struct | |
136 { | |
137 GtkWidget *toolbar; | |
4685 | 138 |
4359 | 139 GtkWidget *bold; |
140 GtkWidget *italic; | |
141 GtkWidget *underline; | |
142 | |
143 GtkWidget *normal_size; | |
144 | |
4685 | 145 GtkWidget *font; |
4359 | 146 GtkWidget *fgcolor; |
147 GtkWidget *bgcolor; | |
148 | |
149 GtkWidget *image; | |
150 GtkWidget *link; | |
151 GtkWidget *smiley; | |
152 GtkWidget *log; | |
4685 | 153 |
4359 | 154 } toolbar; |
155 | |
156 struct | |
157 { | |
158 GtkWidget *fg_color; | |
159 GtkWidget *bg_color; | |
160 GtkWidget *font; | |
161 GtkWidget *smiley; | |
162 GtkWidget *link; | |
163 GtkWidget *log; | |
164 | |
165 } dialogs; | |
166 | |
167 union | |
168 { | |
169 struct gaim_gtk_im_pane *im; | |
170 struct gaim_gtk_chat_pane *chat; | |
171 | |
172 } u; | |
173 }; | |
174 | |
175 #define GAIM_GTK_WINDOW(win) \ | |
176 ((struct gaim_gtk_window *)(win)->ui_data) | |
177 | |
178 #define GAIM_GTK_CONVERSATION(conv) \ | |
179 ((struct gaim_gtk_conversation *)(conv)->ui_data) | |
180 | |
4384
8f633419c837
[gaim-migrate @ 4650]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
181 #define GAIM_IS_GTK_WINDOW(win) \ |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4445
diff
changeset
|
182 (gaim_window_get_ui_ops(win) == gaim_get_gtk_window_ui_ops()) |
4384
8f633419c837
[gaim-migrate @ 4650]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
183 |
8f633419c837
[gaim-migrate @ 4650]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
184 #define GAIM_IS_GTK_CONVERSATION(conv) \ |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4445
diff
changeset
|
185 (gaim_conversation_get_ui_ops(conv) == gaim_get_gtk_conversation_ui_ops()) |
4359 | 186 |
187 /************************************************************************** | |
188 * @name GTK+ Conversation API | |
189 **************************************************************************/ | |
190 /** | |
191 * Returns the UI operations structure for GTK windows. | |
192 * | |
193 * @return The GTK window operations structure. | |
194 */ | |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4445
diff
changeset
|
195 struct gaim_window_ui_ops *gaim_get_gtk_window_ui_ops(void); |
4359 | 196 |
197 /** | |
198 * Returns the UI operations structure for GTK conversations. | |
199 * | |
200 * @return The GTK conversation operations structure. | |
201 */ | |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4445
diff
changeset
|
202 struct gaim_conversation_ui_ops *gaim_get_gtk_conversation_ui_ops(void); |
4359 | 203 |
204 /** | |
205 * Toggles the display of smileys. | |
206 */ | |
207 void gaim_gtkconv_toggle_smileys(void); | |
208 | |
209 /** | |
210 * Toggles the display of timestamps. | |
211 */ | |
212 void gaim_gtkconv_toggle_timestamps(void); | |
213 | |
214 /** | |
215 * Toggles spell checking. | |
216 */ | |
217 void gaim_gtkconv_toggle_spellchk(void); | |
218 | |
219 /** | |
4445 | 220 * Toggles the presence of close buttons on tabs |
221 */ | |
222 void gaim_gtkconv_toggle_close_buttons(void); | |
223 | |
224 /** | |
4359 | 225 * Updates the buddy icon on a conversation. |
226 * | |
227 * @param conv The conversation. | |
228 */ | |
229 void gaim_gtkconv_update_buddy_icon(struct gaim_conversation *conv); | |
230 | |
231 /** | |
232 * Hides buddy icons on all conversations. | |
233 */ | |
234 void gaim_gtkconv_hide_buddy_icons(void); | |
235 | |
236 /** | |
237 * Enables or disables animation on all conversations, based off | |
238 * preferences. | |
239 */ | |
240 void gaim_gtkconv_set_anim(void); | |
241 | |
242 /** | |
243 * Updates the font buttons on all conversations to reflect any changed | |
244 * preferences. | |
245 */ | |
246 void gaim_gtkconv_update_font_buttons(void); | |
247 | |
248 /** | |
4421 | 249 * Updates the font colors of each conversation to the new colors |
250 * chosen in the prefs dialog. | |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
251 * |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
252 * @param conv The conversation to update. |
4421 | 253 */ |
254 void gaim_gtkconv_update_font_colors(struct gaim_conversation *conv); | |
255 | |
256 /** | |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
257 * Updates the font faces of each conversation to the new font |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
258 * face chosen in the prefs dialog. |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
259 * |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
260 * @param conv The conversation to update. |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
261 */ |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
262 void gaim_gtkconv_update_font_face(struct gaim_conversation *conv); |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
263 |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
264 /** |
4359 | 265 * Updates the tab positions on all conversation windows to reflect any |
266 * changed preferences. | |
267 */ | |
268 void gaim_gtkconv_update_tabs(void); | |
269 | |
270 /** | |
271 * Updates the button style on chat windows to reflect any | |
272 * changed preferences. | |
273 */ | |
274 void gaim_gtkconv_update_chat_button_style(); | |
275 | |
276 /** | |
277 * Updates the button style on IM windows to reflect any | |
278 * changed preferences. | |
279 */ | |
280 void gaim_gtkconv_update_im_button_style(); | |
281 | |
282 /** | |
283 * Updates conversation buttons by protocol. | |
284 * | |
285 * @param conv The conversation. | |
286 */ | |
287 void gaim_gtkconv_update_buttons_by_protocol(struct gaim_conversation *conv); | |
288 | |
289 /** | |
290 * Returns the window at the specified X, Y location. | |
291 * | |
292 * If the window is not a GTK+ window, @c NULL is returned. | |
293 * | |
294 * @param x The X coordinate. | |
295 * @param y The Y coordinate. | |
296 * | |
297 * @return The GTK+ window at the location, if it exists, or @c NULL otherwise. | |
298 */ | |
299 struct gaim_window *gaim_gtkwin_get_at_xy(int x, int y); | |
300 | |
301 /** | |
302 * Returns the index of the tab at the specified X, Y location in a notebook. | |
303 * | |
304 * @param win The GTK+ window containing the notebook. | |
305 * @param x The X coordinate. | |
306 * @param y The Y coordinate. | |
307 * | |
308 * @return The index of the tab at the location. | |
309 */ | |
310 int gaim_gtkconv_get_tab_at_xy(struct gaim_window *win, int x, int y); | |
311 | |
312 /** | |
313 * Returns the index of the destination tab at the | |
314 * specified X, Y location in a notebook. | |
315 * | |
316 * This is used for drag-and-drop functions when the tab at the index | |
317 * is a destination tab. | |
318 * | |
319 * @param win The GTK+ window containing the notebook. | |
320 * @param x The X coordinate. | |
321 * @param y The Y coordinate. | |
322 * | |
323 * @return The index of the tab at the location. | |
324 */ | |
325 int gaim_gtkconv_get_dest_tab_at_xy(struct gaim_window *win, int x, int y); | |
326 | |
327 #endif /* _GAIM_GTK_CONVERSATION_H_ */ |