Mercurial > pidgin.yaz
annotate src/gtkconv.c @ 10097:158950e7996d
[gaim-migrate @ 11119]
I wrote this code with the assumption that iconv would fail if Gaim
attempted to convert utf8 to an encoding that could not represent
all the characters.
This assumption is not true for all version of iconv
(NetBSD 2.0, in this case).
Pope not Calle of Flaxborough (notcalle) pointed this out and
provided a fix.
Thanks!
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Thu, 14 Oct 2004 03:44:42 +0000 |
parents | 9fdbfe832fac |
children | c49cc5b818cf |
rev | line source |
---|---|
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
1 /** |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
2 * @file gtkconv.h GTK+ Conversation API |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
3 * @ingroup gtkui |
4359 | 4 * |
8046 | 5 * Gaim is the legal property of its developers, whose names are too numerous |
6 * to list here. Please refer to the COPYRIGHT file distributed with this | |
7 * source distribution. | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
8 * |
4359 | 9 * This program is free software; you can redistribute it and/or modify |
10 * it under the terms of the GNU General Public License as published by | |
11 * the Free Software Foundation; either version 2 of the License, or | |
12 * (at your option) any later version. | |
13 * | |
14 * This program is distributed in the hope that it will be useful, | |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 * GNU General Public License for more details. | |
18 * | |
19 * You should have received a copy of the GNU General Public License | |
20 * along with this program; if not, write to the Free Software | |
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
22 * | |
23 */ | |
9791 | 24 #include "internal.h" |
25 #include "gtkgaim.h" | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
26 |
4359 | 27 #ifndef _WIN32 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
28 # include <X11/Xlib.h> |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
29 #endif |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
30 |
4359 | 31 #ifdef USE_GTKSPELL |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
32 # include <gtkspell/gtkspell.h> |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
33 # ifdef _WIN32 |
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
34 # include "wspell.h" |
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
35 # endif |
4359 | 36 #endif |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
37 |
4359 | 38 #include <gdk/gdkkeysyms.h> |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
39 |
9699 | 40 #include "account.h" |
9130 | 41 #include "cmds.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
42 #include "debug.h" |
6982 | 43 #include "imgstore.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
44 #include "log.h" |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5402
diff
changeset
|
45 #include "notify.h" |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
46 #include "prefs.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
47 #include "prpl.h" |
6038 | 48 #include "request.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
49 #include "sound.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
50 #include "util.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
51 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
52 #include "dnd-hints.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
53 #include "gtkblist.h" |
5717 | 54 #include "gtkconv.h" |
9709 | 55 #include "gtkdialogs.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
56 #include "gtkimhtml.h" |
8317 | 57 #include "gtkimhtmltoolbar.h" |
7431 | 58 #include "gtklog.h" |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
59 #include "gtkpounce.h" |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
60 #include "gtkprivacy.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
61 #include "gtkutils.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
62 #include "stock.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
63 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
64 /* XXX */ |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
65 #include "gaim.h" |
4359 | 66 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
67 #define AUTO_RESPONSE "<AUTO-REPLY> : " |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
68 |
10084 | 69 #define SEND_COLOR "#0d005d" |
70 #define RECV_COLOR "#fd4100" | |
7854 | 71 |
4359 | 72 static char nick_colors[][8] = { |
73 "#ba55d3", /* Medium Orchid */ | |
74 "#ee82ee", /* Violet */ | |
75 "#c715b4", /* Medium Violet Red */ | |
76 "#ff69b4", /* Hot Pink */ | |
77 "#ff6347", /* Tomato */ | |
78 "#fa8c00", /* Dark Orange */ | |
79 "#fa8072", /* Salmon */ | |
80 "#b22222", /* Fire Brick */ | |
81 "#f4a460", /* Sandy Brown */ | |
82 "#cd5c5c", /* Indian Red */ | |
83 "#bc8f8f", /* Rosy Brown */ | |
84 "#f0e68c", /* Khaki */ | |
85 "#bdb76b", /* Dark Khaki */ | |
86 "#228b22", /* Forest Green */ | |
87 "#9acd32", /* Yellow Green */ | |
88 "#32cd32", /* Lime Green */ | |
7755 | 89 "#3cb371", /* Medium Sea Green (Medium Sea Green?! What are we women?!) */ |
4359 | 90 "#2e8b57", /* Sea Green */ |
91 "#8fbc8f", /* Dark Sea Green */ | |
92 "#66cdaa", /* Medium Aquamarine */ | |
93 "#5f9ea0", /* Cadet Blue */ | |
94 "#48d1cc", /* Medium Turquoise */ | |
95 "#00ced1", /* Dark Turquoise */ | |
96 "#4682b4", /* Stell Blue */ | |
97 "#00bfff", /* Deep Sky Blue */ | |
98 "#1690ff", /* Dodger Blue */ | |
99 "#4169ff", /* Royal Blue */ | |
100 "#6a5acd", /* Slate Blue */ | |
101 "#6495ed", /* Cornflower Blue */ | |
102 "#708090", /* Slate gray */ | |
7995
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
103 "#2f4f4f", /* Dark Slate Gray */ |
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
104 "#ff8c00", /* Dark Orange */ |
8535 | 105 "#006400", /* DarkGreen */ |
106 "#8b4513", /* SaddleBrown */ | |
107 "#8b8989", /* snow4 */ | |
108 "#7d26cd", /* purple3 */ | |
4359 | 109 }; |
6291 | 110 |
4359 | 111 #define NUM_NICK_COLORS (sizeof(nick_colors) / sizeof(*nick_colors)) |
112 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
113 typedef struct |
4359 | 114 { |
115 GtkWidget *window; | |
116 | |
117 GtkWidget *entry; | |
118 GtkWidget *message; | |
119 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
120 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
121 |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
122 } InviteBuddyInfo; |
4359 | 123 |
124 static GtkWidget *invite_dialog = NULL; | |
125 | |
126 /* Prototypes. <-- because Paco-Paco hates this comment. */ | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
127 static void got_typing_keypress(GaimConversation *conv, gboolean first); |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
128 static GList *generate_invite_user_names(GaimConnection *gc); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
129 static void add_chat_buddy_common(GaimConversation *conv, |
9554 | 130 const char *name); |
9605 | 131 static gboolean tab_complete(GaimConversation *conv); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
132 static void update_typing_icon(GaimConversation *conv); |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
133 static gboolean update_send_as_selection(GaimConvWindow *win); |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
134 static char *item_factory_translate_func (const char *path, gpointer func_data); |
4359 | 135 |
136 /************************************************************************** | |
137 * Callbacks | |
138 **************************************************************************/ | |
139 static gint | |
140 close_win_cb(GtkWidget *w, GdkEventAny *e, gpointer d) | |
141 { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
142 GaimConvWindow *win = (GaimConvWindow *)d; |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
143 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
144 gaim_conv_window_destroy(win); |
4361
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
145 |
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
146 return TRUE; |
4359 | 147 } |
148 | |
149 static gint | |
150 close_conv_cb(GtkWidget *w, gpointer d) | |
151 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
152 GaimConversation *conv = (GaimConversation *)d; |
4359 | 153 |
154 gaim_conversation_destroy(conv); | |
4361
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
155 |
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
156 return TRUE; |
4359 | 157 } |
158 | |
8914 | 159 static gboolean |
160 size_allocate_cb(GtkWidget *w, GtkAllocation *allocation, GaimConversation *conv) | |
161 { | |
162 GaimGtkConversation *gtkconv; | |
9048 | 163 GaimConvWindow *win = gaim_conversation_get_window(conv); |
9459 | 164 gboolean saveheight; |
8914 | 165 |
166 if (!GTK_WIDGET_VISIBLE(w)) | |
167 return FALSE; | |
168 | |
169 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
170 return FALSE; | |
171 | |
172 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
173 | |
9459 | 174 /* we only save the new height if the formatting toolbar visibility matches the pref */ |
175 saveheight = (gtkconv->show_formatting_toolbar == gaim_prefs_get_bool("/gaim/gtk/conversations/show_formatting_toolbar")); | |
176 | |
9048 | 177 /* I find that I resize the window when it has a bunch of conversations in it, mostly so that the tab bar |
178 * will fit, but then I don't want new windows taking up the entire screen. I check to see if there is only one | |
179 * conversation in the window. This way we'll be setting new windows to the size of the last resized new window. */ | |
180 | |
8914 | 181 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
182 { | |
9048 | 183 if (w == gtkconv->sw && (gaim_conv_window_get_conversation_count(win) == 1)) |
8914 | 184 { |
185 gaim_prefs_set_int("/gaim/gtk/conversations/im/default_width", allocation->width); | |
9459 | 186 if (saveheight) |
187 gaim_prefs_set_int("/gaim/gtk/conversations/im/default_height", allocation->height); | |
8914 | 188 } |
189 if (w == gtkconv->entry) | |
190 gaim_prefs_set_int("/gaim/gtk/conversations/im/entry_height", allocation->height); | |
191 } | |
192 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
193 { | |
9048 | 194 if (w == gtkconv->sw && (gaim_conv_window_get_conversation_count(win) == 1)) |
8914 | 195 { |
196 gaim_prefs_set_int("/gaim/gtk/conversations/chat/default_width", allocation->width); | |
9459 | 197 if (saveheight) |
198 gaim_prefs_set_int("/gaim/gtk/conversations/chat/default_height", allocation->height); | |
8914 | 199 } |
200 if (w == gtkconv->entry) | |
201 gaim_prefs_set_int("/gaim/gtk/conversations/chat/entry_height", allocation->height); | |
202 } | |
203 | |
204 return FALSE; | |
205 } | |
206 | |
7446
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
207 /* Courtesy of Galeon! */ |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
208 static void |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
209 tab_close_button_state_changed_cb(GtkWidget *widget, GtkStateType prev_state) |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
210 { |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
211 if (GTK_WIDGET_STATE(widget) == GTK_STATE_ACTIVE) |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
212 gtk_widget_set_state(widget, GTK_STATE_NORMAL); |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
213 } |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
214 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
215 static void |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
216 default_formatize(GaimConversation *conv) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
217 { |
8061 | 218 GaimGtkConversation *c = GAIM_GTK_CONVERSATION(conv); |
219 GaimConnection *gc = gaim_conversation_get_gc(conv); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
220 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
221 if (gc && gc->flags & GAIM_CONNECTION_HTML) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
222 { |
9025 | 223 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_formatting")) |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
224 { |
9025 | 225 char *color; |
226 GdkColor fg_color, bg_color; | |
227 | |
228 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold")) | |
229 gtk_imhtml_toggle_bold(GTK_IMHTML(c->entry)); | |
230 | |
231 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic")) | |
232 gtk_imhtml_toggle_italic(GTK_IMHTML(c->entry)); | |
233 | |
234 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline")) | |
235 gtk_imhtml_toggle_underline(GTK_IMHTML(c->entry)); | |
236 | |
237 gtk_imhtml_toggle_fontface(GTK_IMHTML(c->entry), | |
238 gaim_prefs_get_string("/gaim/gtk/conversations/font_face")); | |
239 | |
240 if (!(gc->flags & GAIM_CONNECTION_NO_FONTSIZE)) | |
241 gtk_imhtml_font_set_size(GTK_IMHTML(c->entry), | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
242 gaim_prefs_get_int("/gaim/gtk/conversations/font_size")); |
9025 | 243 |
244 if(strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"), "") != 0) | |
245 { | |
246 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"), | |
247 &fg_color); | |
248 color = g_strdup_printf("#%02x%02x%02x", | |
249 fg_color.red / 256, | |
250 fg_color.green / 256, | |
251 fg_color.blue / 256); | |
252 } | |
253 else | |
254 color = g_strdup(""); | |
255 | |
8061 | 256 gtk_imhtml_toggle_forecolor(GTK_IMHTML(c->entry), color); |
257 g_free(color); | |
9025 | 258 |
259 if(!(gc->flags & GAIM_CONNECTION_NO_BGCOLOR) && | |
260 strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), "") != 0) | |
261 { | |
262 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), | |
263 &bg_color); | |
264 color = g_strdup_printf("#%02x%02x%02x", | |
265 bg_color.red / 256, | |
266 bg_color.green / 256, | |
267 bg_color.blue / 256); | |
268 } | |
269 else | |
270 color = g_strdup(""); | |
271 | |
8061 | 272 gtk_imhtml_toggle_backcolor(GTK_IMHTML(c->entry), color); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
273 g_free(color); |
8061 | 274 } |
8677 | 275 |
9025 | 276 |
8677 | 277 if (gc->flags & GAIM_CONNECTION_FORMATTING_WBFO) |
278 gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(c->entry), TRUE); | |
279 else | |
280 gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(c->entry), FALSE); | |
8061 | 281 } |
282 } | |
9130 | 283 |
284 static const char * | |
285 gaim_gtk_get_cmd_prefix(void) | |
286 { | |
287 return "/"; | |
288 } | |
289 | |
9167 | 290 static GaimCmdRet |
9829 | 291 say_command_cb(GaimConversation *conv, |
292 const char *cmd, char **args, char **error, void *data) | |
293 { | |
294 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) | |
295 gaim_conv_im_send(GAIM_CONV_IM(conv), args[0]); | |
296 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
297 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), args[0]); | |
298 | |
299 return GAIM_CMD_RET_OK; | |
300 } | |
301 | |
302 static GaimCmdRet | |
9167 | 303 me_command_cb(GaimConversation *conv, |
9597 | 304 const char *cmd, char **args, char **error, void *data) |
9167 | 305 { |
306 char *tmp; | |
307 | |
308 tmp = g_strdup_printf("/me %s", args[0]); | |
9175 | 309 |
9167 | 310 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
311 gaim_conv_im_send(GAIM_CONV_IM(conv), tmp); | |
312 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
313 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), tmp); | |
314 | |
315 g_free(tmp); | |
316 return GAIM_CMD_RET_OK; | |
317 } | |
318 | |
9212 | 319 static GaimCmdRet |
320 debug_command_cb(GaimConversation *conv, | |
9597 | 321 const char *cmd, char **args, char **error, void *data) |
9212 | 322 { |
323 char *tmp, *markup; | |
324 GaimCmdStatus status; | |
325 | |
326 if (!g_ascii_strcasecmp(args[0], "version")) { | |
327 tmp = g_strdup_printf(_("me is using Gaim v%s."), VERSION); | |
328 markup = gaim_escape_html(tmp); | |
329 | |
330 status = gaim_cmd_do_command(conv, tmp, markup, error); | |
331 | |
332 g_free(tmp); | |
333 g_free(markup); | |
334 return status; | |
335 } else { | |
336 gaim_conversation_write(conv, NULL, _("Supported debug options are: version"), | |
337 GAIM_MESSAGE_NO_LOG|GAIM_MESSAGE_ERROR, time(NULL)); | |
338 return GAIM_CMD_STATUS_OK; | |
339 } | |
340 } | |
341 | |
9213 | 342 static GaimCmdRet |
343 help_command_cb(GaimConversation *conv, | |
9597 | 344 const char *cmd, char **args, char **error, void *data) |
9213 | 345 { |
9597 | 346 GList *l, *text; |
9213 | 347 GString *s; |
9597 | 348 |
349 if (args[0] != NULL) { | |
350 s = g_string_new(""); | |
351 text = gaim_cmd_help(conv, args[0]); | |
352 | |
353 if (text) { | |
354 for (l = text; l; l = l->next) | |
355 if (l->next) | |
9816 | 356 g_string_append_printf(s, "%s\n", (char *)l->data); |
9597 | 357 else |
9816 | 358 g_string_append_printf(s, "%s", (char *)l->data); |
9597 | 359 } else { |
360 g_string_append(s, _("No such command (in this context).")); | |
361 } | |
362 } else { | |
363 s = g_string_new(_("Use \"/help <command>\" for help on a specific command.\n" | |
364 "The following commands are available in this context:\n")); | |
365 | |
366 text = gaim_cmd_list(conv); | |
367 for (l = text; l; l = l->next) | |
9213 | 368 if (l->next) |
9597 | 369 g_string_append_printf(s, "%s, ", (char *)l->data); |
9213 | 370 else |
9597 | 371 g_string_append_printf(s, "%s.", (char *)l->data); |
9213 | 372 } |
373 | |
374 gaim_conversation_write(conv, NULL, s->str, GAIM_MESSAGE_NO_LOG, time(NULL)); | |
375 g_string_free(s, TRUE); | |
376 | |
377 return GAIM_CMD_STATUS_OK; | |
378 } | |
379 | |
4359 | 380 static void |
9374 | 381 send_history_add(GaimConversation *conv, const char *message) |
382 { | |
383 GList *first; | |
384 | |
385 first = g_list_first(conv->send_history); | |
386 | |
387 if (first->data) | |
388 g_free(first->data); | |
389 | |
390 first->data = g_strdup(message); | |
391 | |
392 conv->send_history = g_list_prepend(first, NULL); | |
393 } | |
394 | |
9832 | 395 static gboolean |
396 check_for_and_do_command(GaimConversation *conv) | |
397 { | |
398 GaimGtkConversation *gtkconv; | |
399 char *cmd; | |
400 const char *prefix; | |
401 GaimAccount *account; | |
402 GtkTextIter start; | |
403 | |
404 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
405 account = gaim_conversation_get_account(conv); | |
406 prefix = gaim_gtk_get_cmd_prefix(); | |
407 | |
408 cmd = gtk_imhtml_get_text(GTK_IMHTML(gtkconv->entry), NULL, NULL); | |
409 gtk_text_buffer_get_start_iter(GTK_IMHTML(gtkconv->entry)->text_buffer, &start); | |
410 | |
411 if (cmd && (strncmp(cmd, prefix, strlen(prefix)) == 0) | |
412 && !gtk_text_iter_get_child_anchor(&start)) { | |
413 GaimCmdStatus status; | |
414 char *error, *cmdline, *markup, *send_history; | |
415 GtkTextIter end; | |
416 | |
417 send_history = gtk_imhtml_get_markup(GTK_IMHTML(gtkconv->entry)); | |
418 send_history_add(conv, send_history); | |
419 g_free(send_history); | |
420 | |
421 cmdline = cmd + strlen(prefix); | |
422 | |
423 gtk_text_iter_forward_chars(&start, g_utf8_strlen(prefix, -1)); | |
424 gtk_text_buffer_get_end_iter(GTK_IMHTML(gtkconv->entry)->text_buffer, &end); | |
425 markup = gtk_imhtml_get_markup_range(GTK_IMHTML(gtkconv->entry), &start, &end); | |
426 status = gaim_cmd_do_command(conv, cmdline, markup, &error); | |
427 g_free(cmd); | |
428 g_free(markup); | |
429 | |
430 switch (status) { | |
431 case GAIM_CMD_STATUS_OK: | |
432 return TRUE; | |
433 case GAIM_CMD_STATUS_NOT_FOUND: | |
434 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/passthrough_unknown_commands")) { | |
435 gaim_conversation_write(conv, "", _("No such command."), | |
436 GAIM_MESSAGE_NO_LOG, time(NULL)); | |
437 | |
438 return TRUE; | |
439 } | |
440 return FALSE; | |
441 case GAIM_CMD_STATUS_WRONG_ARGS: | |
442 gaim_conversation_write(conv, "", _("Syntax Error: You typed the wrong number of arguments " | |
443 "to that command."), | |
444 GAIM_MESSAGE_NO_LOG, time(NULL)); | |
445 return TRUE; | |
446 case GAIM_CMD_STATUS_FAILED: | |
447 gaim_conversation_write(conv, "", error ? error : _("Your command failed for an unknown reason."), | |
448 GAIM_MESSAGE_NO_LOG, time(NULL)); | |
449 if(error) | |
450 g_free(error); | |
451 return TRUE; | |
452 case GAIM_CMD_STATUS_WRONG_TYPE: | |
453 if(gaim_conversation_get_type(conv) == GAIM_CONV_IM) | |
454 gaim_conversation_write(conv, "", _("That command only works in Chats, not IMs."), | |
455 GAIM_MESSAGE_NO_LOG, time(NULL)); | |
456 else | |
457 gaim_conversation_write(conv, "", _("That command only works in IMs, not Chats."), | |
458 GAIM_MESSAGE_NO_LOG, time(NULL)); | |
459 return TRUE; | |
460 case GAIM_CMD_STATUS_WRONG_PRPL: | |
461 gaim_conversation_write(conv, "", _("That command doesn't work on this protocol."), | |
462 GAIM_MESSAGE_NO_LOG, time(NULL)); | |
463 return TRUE; | |
464 } | |
465 } | |
466 | |
467 g_free(cmd); | |
468 return FALSE; | |
469 } | |
470 | |
9374 | 471 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
472 send_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 473 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
474 GaimGtkConversation *gtkconv; |
8655 | 475 GaimAccount *account; |
8677 | 476 GaimConnection *gc; |
8448 | 477 char *buf, *clean; |
4359 | 478 |
479 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
8655 | 480 account = gaim_conversation_get_account(conv); |
9130 | 481 |
9471 | 482 if (!gaim_account_is_connected(account)) |
483 return; | |
484 | |
9474 | 485 if ((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) && |
486 gaim_conv_chat_has_left(GAIM_CONV_CHAT(conv))) | |
9471 | 487 return; |
488 | |
9832 | 489 if (check_for_and_do_command(conv)) { |
490 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); | |
491 default_formatize(conv); | |
492 return; | |
9130 | 493 } |
494 | |
8442 | 495 buf = gtk_imhtml_get_markup(GTK_IMHTML(gtkconv->entry)); |
8962 | 496 clean = gtk_imhtml_get_text(GTK_IMHTML(gtkconv->entry), NULL, NULL); |
8448 | 497 |
4359 | 498 gtk_widget_grab_focus(gtkconv->entry); |
499 | |
8448 | 500 if (strlen(clean) == 0) { |
501 g_free(clean); | |
4359 | 502 return; |
503 } | |
504 | |
8677 | 505 gc = gaim_account_get_connection(account); |
506 if (gc && (gc->flags & GAIM_CONNECTION_NO_NEWLINES)) { | |
507 char **bufs; | |
508 int i; | |
509 | |
510 bufs = gtk_imhtml_get_markup_lines(GTK_IMHTML(gtkconv->entry)); | |
511 for (i = 0; bufs[i]; i++) { | |
9374 | 512 send_history_add(conv, bufs[i]); |
8677 | 513 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
514 gaim_conv_im_send(GAIM_CONV_IM(conv), bufs[i]); | |
515 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
516 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), bufs[i]); | |
517 } | |
518 | |
519 g_strfreev(bufs); | |
520 | |
521 } else { | |
9374 | 522 send_history_add(conv, buf); |
8677 | 523 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
524 gaim_conv_im_send(GAIM_CONV_IM(conv), buf); | |
525 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
526 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), buf); | |
527 } | |
4359 | 528 |
8677 | 529 g_free(clean); |
4359 | 530 g_free(buf); |
531 | |
8061 | 532 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); |
533 default_formatize(conv); | |
4359 | 534 } |
535 | |
536 static void | |
7928 | 537 add_remove_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 538 { |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
539 GaimAccount *account; |
4359 | 540 const char *name; |
541 | |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
542 account = gaim_conversation_get_account(conv); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
543 name = gaim_conversation_get_name(conv); |
7879 | 544 |
545 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
7859 | 546 GaimBuddy *b; |
547 | |
548 b = gaim_find_buddy(account, name); | |
549 if (b != NULL) | |
9730 | 550 gaim_gtkdialogs_remove_buddy(b); |
7859 | 551 else if (account != NULL && gaim_account_is_connected(account)) |
552 gaim_blist_request_add_buddy(account, (char *)name, NULL, NULL); | |
7879 | 553 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
7859 | 554 GaimChat *c; |
555 | |
556 c = gaim_blist_find_chat(account, name); | |
557 if (c != NULL) | |
9730 | 558 gaim_gtkdialogs_remove_chat(c); |
7859 | 559 else if (account != NULL && gaim_account_is_connected(account)) |
9754 | 560 gaim_blist_request_add_chat(account, NULL, NULL, name); |
7859 | 561 } |
4359 | 562 |
563 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
564 } | |
565 | |
7975 | 566 static void chat_do_info(GaimConversation *conv, const char *who) |
567 { | |
568 GaimPluginProtocolInfo *prpl_info = NULL; | |
569 GaimConnection *gc; | |
570 | |
571 if ((gc = gaim_conversation_get_gc(conv))) { | |
572 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | |
573 | |
574 /* | |
575 * If there are special needs for getting info on users in | |
576 * buddy chat "rooms"... | |
577 */ | |
578 if (prpl_info->get_cb_info != NULL) | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
579 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
580 prpl_info->get_cb_info(gc, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
581 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
582 } |
7975 | 583 else |
584 prpl_info->get_info(gc, who); | |
585 } | |
586 } | |
587 | |
588 | |
4359 | 589 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
590 info_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 591 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
592 GaimGtkConversation *gtkconv; |
4359 | 593 |
594 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
595 | |
7879 | 596 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
597 serv_get_info(gaim_conversation_get_gc(conv), | |
598 gaim_conversation_get_name(conv)); | |
599 | |
600 gtk_widget_grab_focus(gtkconv->entry); | |
601 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
602 /* Get info of the person currently selected in the GtkTreeView */ | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
603 GaimGtkChatPane *gtkchat; |
4359 | 604 GtkTreeIter iter; |
605 GtkTreeModel *model; | |
606 GtkTreeSelection *sel; | |
9554 | 607 char *name; |
4359 | 608 |
609 gtkchat = gtkconv->u.chat; | |
610 | |
611 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | |
612 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); | |
613 | |
614 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) | |
9498 | 615 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &name, -1); |
4359 | 616 else |
617 return; | |
618 | |
7975 | 619 chat_do_info(conv, name); |
9554 | 620 g_free(name); |
4359 | 621 } |
622 } | |
623 | |
624 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
625 block_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 626 { |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
627 GaimAccount *account; |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
628 |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
629 account = gaim_conversation_get_account(conv); |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
630 |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
631 if (account != NULL && gaim_account_is_connected(account)) |
6399
d726a36628e8
[gaim-migrate @ 6904]
Christian Hammond <chipx86@chipx86.com>
parents:
6398
diff
changeset
|
632 gaim_gtk_request_add_block(account, gaim_conversation_get_name(conv)); |
4359 | 633 |
634 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
635 } | |
636 | |
637 static void | |
9468 | 638 send_file_cb(GtkWidget *widget, GaimConversation *conv) |
639 { | |
640 serv_send_file(gaim_conversation_get_gc(conv), gaim_conversation_get_name(conv), NULL); | |
641 } | |
642 | |
643 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
644 do_invite(GtkWidget *w, int resp, InviteBuddyInfo *info) |
4359 | 645 { |
646 const char *buddy, *message; | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
647 GaimGtkConversation *gtkconv; |
4359 | 648 |
649 gtkconv = GAIM_GTK_CONVERSATION(info->conv); | |
650 | |
651 if (resp == GTK_RESPONSE_OK) { | |
652 buddy = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(info->entry)->entry)); | |
653 message = gtk_entry_get_text(GTK_ENTRY(info->message)); | |
654 | |
4793 | 655 if (!g_ascii_strcasecmp(buddy, "")) { |
4359 | 656 g_free(info); |
657 | |
658 return; | |
659 } | |
660 | |
661 serv_chat_invite(gaim_conversation_get_gc(info->conv), | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
662 gaim_conv_chat_get_id(GAIM_CONV_CHAT(info->conv)), |
4359 | 663 message, buddy); |
664 } | |
665 | |
666 gtk_widget_destroy(invite_dialog); | |
667 invite_dialog = NULL; | |
668 | |
669 g_free(info); | |
670 } | |
671 | |
672 static void | |
9909 | 673 invite_dnd_recv(GtkWidget *widget, GdkDragContext *dc, gint x, gint y, |
674 GtkSelectionData *sd, guint inf, guint t, gpointer data) | |
675 { | |
676 InviteBuddyInfo *info = (InviteBuddyInfo *)data; | |
677 const char *convprotocol; | |
678 | |
679 convprotocol = gaim_account_get_protocol_id(gaim_conversation_get_account(info->conv)); | |
680 | |
681 if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE)) | |
682 { | |
683 GaimBlistNode *node = NULL; | |
684 GaimBuddy *buddy; | |
685 | |
686 memcpy(&node, sd->data, sizeof(node)); | |
687 | |
688 if (GAIM_BLIST_NODE_IS_CONTACT(node)) | |
689 buddy = gaim_contact_get_priority_buddy((GaimContact *)node); | |
690 else if (GAIM_BLIST_NODE_IS_BUDDY(node)) | |
691 buddy = (GaimBuddy *)node; | |
692 else | |
693 return; | |
694 | |
695 if (strcmp(convprotocol, gaim_account_get_protocol_id(buddy->account))) | |
696 { | |
697 gaim_notify_error(NULL, NULL, | |
698 _("That buddy is not on the same protocol as this " | |
699 "chat"), NULL); | |
700 } | |
701 else | |
702 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(info->entry)->entry), buddy->name); | |
703 | |
704 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); | |
705 } | |
706 else if (sd->target == gdk_atom_intern("application/x-im-contact", FALSE)) | |
707 { | |
708 char *protocol = NULL; | |
709 char *username = NULL; | |
710 GaimAccount *account; | |
711 | |
712 if (gaim_gtk_parse_x_im_contact(sd->data, FALSE, &account, | |
713 &protocol, &username, NULL)) | |
714 { | |
715 if (account == NULL) | |
716 { | |
717 gaim_notify_error(NULL, NULL, | |
718 _("You are not currently signed on with an account that " | |
719 "can invite that buddy."), NULL); | |
720 } | |
721 else if (strcmp(convprotocol, gaim_account_get_protocol_id(account))) | |
722 { | |
723 gaim_notify_error(NULL, NULL, | |
724 _("That buddy is not on the same protocol as this " | |
725 "chat"), NULL); | |
726 } | |
727 else | |
728 { | |
729 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(info->entry)->entry), username); | |
730 } | |
731 } | |
732 | |
733 if (username != NULL) g_free(username); | |
734 if (protocol != NULL) g_free(protocol); | |
735 | |
736 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); | |
737 } | |
738 } | |
739 | |
740 static const GtkTargetEntry dnd_targets[] = | |
741 { | |
742 {"GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, 0}, | |
743 {"application/x-im-contact", 0, 1} | |
744 }; | |
745 | |
746 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
747 invite_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 748 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
749 InviteBuddyInfo *info = NULL; |
4359 | 750 |
751 if (invite_dialog == NULL) { | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
752 GaimConnection *gc; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
753 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
754 GaimGtkWindow *gtkwin; |
4359 | 755 GtkWidget *label; |
756 GtkWidget *vbox, *hbox; | |
757 GtkWidget *table; | |
758 GtkWidget *img; | |
759 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
760 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
761 GTK_ICON_SIZE_DIALOG); |
4359 | 762 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
763 info = g_new0(InviteBuddyInfo, 1); |
4359 | 764 info->conv = conv; |
765 | |
766 gc = gaim_conversation_get_gc(conv); | |
767 win = gaim_conversation_get_window(conv); | |
768 gtkwin = GAIM_GTK_WINDOW(win); | |
769 | |
770 /* Create the new dialog. */ | |
771 invite_dialog = gtk_dialog_new_with_buttons( | |
7859 | 772 _("Invite Buddy Into Chat Room"), |
7879 | 773 GTK_WINDOW(gtkwin->window), 0, |
774 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, | |
9443
3584cdab1d0b
[gaim-migrate @ 10264]
Christian Hammond <chipx86@chipx86.com>
parents:
9374
diff
changeset
|
775 GAIM_STOCK_INVITE, GTK_RESPONSE_OK, NULL); |
4359 | 776 |
777 gtk_dialog_set_default_response(GTK_DIALOG(invite_dialog), | |
778 GTK_RESPONSE_OK); | |
779 gtk_container_set_border_width(GTK_CONTAINER(invite_dialog), 6); | |
780 gtk_window_set_resizable(GTK_WINDOW(invite_dialog), FALSE); | |
781 gtk_dialog_set_has_separator(GTK_DIALOG(invite_dialog), FALSE); | |
782 | |
9909 | 783 info->window = GTK_WIDGET(invite_dialog); |
784 | |
4359 | 785 /* Setup the outside spacing. */ |
786 vbox = GTK_DIALOG(invite_dialog)->vbox; | |
787 | |
788 gtk_box_set_spacing(GTK_BOX(vbox), 12); | |
789 gtk_container_set_border_width(GTK_CONTAINER(vbox), 6); | |
790 | |
791 /* Setup the inner hbox and put the dialog's icon in it. */ | |
792 hbox = gtk_hbox_new(FALSE, 12); | |
793 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
794 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
795 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
796 | |
797 /* Setup the right vbox. */ | |
798 vbox = gtk_vbox_new(FALSE, 0); | |
799 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
800 | |
801 /* Put our happy label in it. */ | |
802 label = gtk_label_new(_("Please enter the name of the user you wish " | |
803 "to invite, along with an optional invite " | |
804 "message.")); | |
805 gtk_widget_set_size_request(label, 350, -1); | |
806 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
807 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
808 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
809 | |
810 /* hbox for the table, and to give it some spacing on the left. */ | |
811 hbox = gtk_hbox_new(FALSE, 6); | |
812 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
813 | |
814 /* Setup the table we're going to use to lay stuff out. */ | |
815 table = gtk_table_new(2, 2, FALSE); | |
816 gtk_table_set_row_spacings(GTK_TABLE(table), 6); | |
817 gtk_table_set_col_spacings(GTK_TABLE(table), 6); | |
818 gtk_container_set_border_width(GTK_CONTAINER(table), 12); | |
819 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); | |
820 | |
821 /* Now the Buddy label */ | |
822 label = gtk_label_new(NULL); | |
823 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Buddy:")); | |
824 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
825 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); | |
826 | |
827 /* Now the Buddy drop-down entry field. */ | |
828 info->entry = gtk_combo_new(); | |
829 gtk_combo_set_case_sensitive(GTK_COMBO(info->entry), FALSE); | |
830 gtk_entry_set_activates_default( | |
831 GTK_ENTRY(GTK_COMBO(info->entry)->entry), TRUE); | |
832 | |
833 gtk_table_attach_defaults(GTK_TABLE(table), info->entry, 1, 2, 0, 1); | |
834 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->entry); | |
835 | |
836 /* Fill in the names. */ | |
837 gtk_combo_set_popdown_strings(GTK_COMBO(info->entry), | |
838 generate_invite_user_names(gc)); | |
839 | |
840 | |
841 /* Now the label for "Message" */ | |
842 label = gtk_label_new(NULL); | |
843 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Message:")); | |
844 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
845 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); | |
846 | |
847 | |
848 /* And finally, the Message entry field. */ | |
849 info->message = gtk_entry_new(); | |
850 gtk_entry_set_activates_default(GTK_ENTRY(info->message), TRUE); | |
851 | |
852 gtk_table_attach_defaults(GTK_TABLE(table), info->message, 1, 2, 1, 2); | |
853 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->message); | |
854 | |
855 /* Connect the signals. */ | |
856 g_signal_connect(G_OBJECT(invite_dialog), "response", | |
857 G_CALLBACK(do_invite), info); | |
9909 | 858 /* Setup drag-and-drop */ |
859 gtk_drag_dest_set(info->window, | |
860 GTK_DEST_DEFAULT_MOTION | | |
861 GTK_DEST_DEFAULT_DROP, | |
862 dnd_targets, | |
863 sizeof(dnd_targets) / sizeof(GtkTargetEntry), | |
864 GDK_ACTION_COPY); | |
865 gtk_drag_dest_set(info->entry, | |
866 GTK_DEST_DEFAULT_MOTION | | |
867 GTK_DEST_DEFAULT_DROP, | |
868 dnd_targets, | |
869 sizeof(dnd_targets) / sizeof(GtkTargetEntry), | |
870 GDK_ACTION_COPY); | |
871 | |
872 g_signal_connect(G_OBJECT(info->window), "drag_data_received", | |
873 G_CALLBACK(invite_dnd_recv), info); | |
874 g_signal_connect(G_OBJECT(info->entry), "drag_data_received", | |
875 G_CALLBACK(invite_dnd_recv), info); | |
876 | |
4359 | 877 } |
878 | |
879 gtk_widget_show_all(invite_dialog); | |
880 | |
881 if (info != NULL) | |
882 gtk_widget_grab_focus(GTK_COMBO(info->entry)->entry); | |
883 } | |
884 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
885 static void |
7748 | 886 menu_new_conv_cb(gpointer data, guint action, GtkWidget *widget) |
887 { | |
9714 | 888 gaim_gtkdialogs_im(); |
7748 | 889 } |
890 | |
891 static void | |
9504 | 892 savelog_writefile_cb(void *user_data, const char *filename) |
9489 | 893 { |
9504 | 894 GaimConversation *conv = (GaimConversation *)user_data; |
9489 | 895 FILE *fp; |
896 const char *name; | |
897 | |
898 if ((fp = fopen(filename, "w+")) == NULL) { | |
9504 | 899 gaim_notify_error(conv, NULL, _("Unable to open file."), NULL); |
9489 | 900 return; |
901 } | |
902 | |
903 name = gaim_conversation_get_name(conv); | |
904 fprintf(fp, _("<h1>Conversation with %s</h1>\n"), name); | |
905 fprintf(fp, "%s", conv->history->str); | |
906 fclose(fp); | |
907 } | |
908 | |
909 static void | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
910 menu_save_as_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
911 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
912 GaimConvWindow *win = (GaimConvWindow *)data; |
9489 | 913 GaimConversation *conv = gaim_conv_window_get_active_conversation(win); |
914 gchar *buf; | |
915 | |
916 buf = g_strdup_printf("%s.html", gaim_normalize(conv->account, conv->name)); | |
9504 | 917 |
918 gaim_request_file(conv, _("Save Conversation"), buf, TRUE, | |
919 G_CALLBACK(savelog_writefile_cb), NULL, conv); | |
9489 | 920 |
921 g_free(buf); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
922 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
923 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
924 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
925 menu_view_log_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
926 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
927 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
928 GaimConversation *conv; |
9917 | 929 GaimLogType type; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
930 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
931 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
932 |
9917 | 933 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
934 type = GAIM_LOG_IM; | |
935 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
936 type = GAIM_LOG_CHAT; | |
937 else | |
938 return; | |
939 | |
940 gaim_gtk_log_show(type, gaim_conversation_get_name(conv), | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
941 gaim_conversation_get_account(conv)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
942 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
943 |
8974 | 944 static void |
945 menu_clear_cb(gpointer data, guint action, GtkWidget *widget) | |
946 { | |
947 GaimConvWindow *win = (GaimConvWindow *)data; | |
948 GaimConversation *conv; | |
949 GaimGtkConversation *gtkconv; | |
950 | |
951 conv = gaim_conv_window_get_active_conversation(win); | |
952 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
953 | |
954 gtk_imhtml_clear(GTK_IMHTML(gtkconv->imhtml)); | |
955 g_string_free(conv->history, TRUE); | |
956 conv->history = g_string_new(""); | |
957 } | |
958 | |
7295 | 959 struct _search { |
960 GaimGtkConversation *gtkconv; | |
961 GtkWidget *entry; | |
962 }; | |
963 | |
7929 | 964 static void do_search_cb(GtkWidget *widget, gint resp, struct _search *s) |
7295 | 965 { |
7929 | 966 switch (resp) { |
967 case GTK_RESPONSE_OK: | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
968 gtk_imhtml_search_find(GTK_IMHTML(s->gtkconv->imhtml), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
969 gtk_entry_get_text(GTK_ENTRY(s->entry))); |
7929 | 970 break; |
971 | |
972 case GTK_RESPONSE_DELETE_EVENT: | |
973 case GTK_RESPONSE_CLOSE: | |
974 gtk_imhtml_search_clear(GTK_IMHTML(s->gtkconv->imhtml)); | |
975 gtk_widget_destroy(s->gtkconv->dialogs.search); | |
976 s->gtkconv->dialogs.search = NULL; | |
977 g_free(s); | |
978 break; | |
979 } | |
7295 | 980 } |
981 | |
982 static void | |
7751 | 983 menu_find_cb(gpointer data, guint action, GtkWidget *widget) |
7295 | 984 { |
985 GaimConvWindow *win = (GaimConvWindow *)data; | |
986 GaimConversation *conv = gaim_conv_window_get_active_conversation(win); | |
987 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); | |
988 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7929 | 989 GtkWidget *hbox; |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
990 GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
991 GTK_ICON_SIZE_DIALOG); |
7929 | 992 GtkWidget *label; |
7295 | 993 struct _search *s; |
994 | |
7798 | 995 if (gtkconv->dialogs.search) { |
996 gtk_window_present(GTK_WINDOW(gtkconv->dialogs.search)); | |
7295 | 997 return; |
7798 | 998 } |
7300
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
999 |
7295 | 1000 s = g_malloc(sizeof(struct _search)); |
1001 s->gtkconv = gtkconv; | |
7929 | 1002 |
1003 gtkconv->dialogs.search = gtk_dialog_new_with_buttons(_("Find"), | |
1004 GTK_WINDOW(gtkwin->window), GTK_DIALOG_DESTROY_WITH_PARENT, | |
1005 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, | |
1006 GTK_STOCK_FIND, GTK_RESPONSE_OK, NULL); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1007 gtk_dialog_set_default_response(GTK_DIALOG(gtkconv->dialogs.search), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1008 GTK_RESPONSE_OK); |
7929 | 1009 g_signal_connect(G_OBJECT(gtkconv->dialogs.search), "response", |
1010 G_CALLBACK(do_search_cb), s); | |
1011 | |
1012 gtk_container_set_border_width(GTK_CONTAINER(gtkconv->dialogs.search), 6); | |
1013 gtk_window_set_resizable(GTK_WINDOW(gtkconv->dialogs.search), FALSE); | |
1014 gtk_dialog_set_has_separator(GTK_DIALOG(gtkconv->dialogs.search), FALSE); | |
1015 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(gtkconv->dialogs.search)->vbox), 12); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1016 gtk_container_set_border_width( |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1017 GTK_CONTAINER(GTK_DIALOG(gtkconv->dialogs.search)->vbox), 6); |
7929 | 1018 |
1019 hbox = gtk_hbox_new(FALSE, 12); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1020 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(gtkconv->dialogs.search)->vbox), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1021 hbox); |
7929 | 1022 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); |
1023 | |
1024 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1025 gtk_dialog_set_response_sensitive(GTK_DIALOG(gtkconv->dialogs.search), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1026 GTK_RESPONSE_OK, FALSE); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1027 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1028 label = gtk_label_new(NULL); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1029 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Search for:")); |
7929 | 1030 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
1031 | |
1032 s->entry = gtk_entry_new(); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1033 gtk_entry_set_activates_default(GTK_ENTRY(s->entry), TRUE); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1034 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(s->entry)); |
7929 | 1035 g_signal_connect(G_OBJECT(s->entry), "changed", |
1036 G_CALLBACK(gaim_gtk_set_sensitive_if_input), | |
1037 gtkconv->dialogs.search); | |
1038 gtk_box_pack_start(GTK_BOX(hbox), s->entry, FALSE, FALSE, 0); | |
7300
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
1039 |
7295 | 1040 gtk_widget_show_all(gtkconv->dialogs.search); |
7929 | 1041 gtk_widget_grab_focus(s->entry); |
7295 | 1042 } |
1043 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1044 static void |
9468 | 1045 menu_send_file_cb(gpointer data, guint action, GtkWidget *widget) |
1046 { | |
1047 GaimConvWindow *win = (GaimConvWindow *)data; | |
1048 GaimConversation *conv = gaim_conv_window_get_active_conversation(win); | |
1049 | |
1050 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
1051 serv_send_file(gaim_conversation_get_gc(conv), gaim_conversation_get_name(conv), NULL); | |
1052 } | |
1053 | |
1054 } | |
1055 | |
1056 static void | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1057 menu_add_pounce_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1058 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1059 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1060 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1061 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1062 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1063 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1064 gaim_gtkpounce_dialog_show(gaim_conversation_get_account(conv), |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1065 gaim_conversation_get_name(conv), NULL); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1066 } |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1067 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1068 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1069 menu_insert_link_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1070 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1071 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1072 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1073 GaimGtkConversation *gtkconv; |
8756 | 1074 GtkIMHtmlToolbar *toolbar; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1075 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1076 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1077 gtkconv = GAIM_GTK_CONVERSATION(conv); |
8756 | 1078 toolbar = GTK_IMHTMLTOOLBAR(gtkconv->toolbar); |
1079 | |
1080 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->link), | |
1081 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->link))); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1082 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1083 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1084 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1085 menu_insert_image_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1086 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1087 GaimConvWindow *win = (GaimConvWindow *)data; |
8756 | 1088 GaimConversation *conv; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1089 GaimGtkConversation *gtkconv; |
8756 | 1090 GtkIMHtmlToolbar *toolbar; |
1091 | |
1092 conv = gaim_conv_window_get_active_conversation(win); | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1093 gtkconv = GAIM_GTK_CONVERSATION(gaim_conv_window_get_active_conversation(win)); |
8756 | 1094 toolbar = GTK_IMHTMLTOOLBAR(gtkconv->toolbar); |
1095 | |
1096 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->image), | |
1097 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->image))); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1098 } |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1099 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1100 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1101 menu_alias_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1102 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1103 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1104 GaimConversation *conv; |
7879 | 1105 GaimAccount *account; |
1106 const char *name; | |
1107 | |
1108 conv = gaim_conv_window_get_active_conversation(win); | |
1109 account = gaim_conversation_get_account(conv); | |
1110 name = gaim_conversation_get_name(conv); | |
1111 | |
1112 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
1113 GaimBuddy *b; | |
1114 | |
1115 b = gaim_find_buddy(account, name); | |
1116 if (b != NULL) | |
9730 | 1117 gaim_gtkdialogs_alias_buddy(b); |
7879 | 1118 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
1119 GaimChat *c; | |
1120 | |
1121 c = gaim_blist_find_chat(account, name); | |
1122 if (c != NULL) | |
9730 | 1123 gaim_gtkdialogs_alias_chat(c); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1124 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1125 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1126 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1127 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1128 menu_get_info_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1129 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1130 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1131 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1132 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1133 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1134 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1135 info_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1136 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1137 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1138 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1139 menu_invite_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1140 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1141 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1142 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1143 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1144 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1145 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1146 invite_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1147 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1148 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1149 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1150 menu_warn_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1151 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1152 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1153 GaimConversation *conv; |
10025 | 1154 GaimConnection *gc; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1155 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1156 conv = gaim_conv_window_get_active_conversation(win); |
10025 | 1157 gc = gaim_conversation_get_gc(conv); |
1158 | |
1159 gaim_gtkdialogs_warn(gc, gaim_conversation_get_name(conv)); | |
1160 | |
1161 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1162 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1163 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1164 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1165 menu_block_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1166 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1167 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1168 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1169 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1170 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1171 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1172 block_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1173 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1174 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1175 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1176 menu_add_remove_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1177 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1178 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1179 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1180 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1181 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1182 |
7928 | 1183 add_remove_cb(NULL, conv); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1184 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1185 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1186 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1187 menu_close_conv_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1188 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1189 GaimConvWindow *win = (GaimConvWindow *)data; |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1190 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1191 close_conv_cb(NULL, gaim_conv_window_get_active_conversation(win)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1192 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1193 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1194 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1195 menu_logging_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1196 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1197 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1198 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1199 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1200 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1201 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1202 if (conv == NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1203 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1204 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1205 gaim_conversation_set_logging(conv, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1206 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1207 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1208 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1209 static void |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1210 menu_toolbar_cb(gpointer data, guint action, GtkWidget *widget) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1211 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1212 GaimConvWindow *win = (GaimConvWindow *)data; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1213 GaimConversation *conv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1214 GaimGtkConversation *gtkconv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1215 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1216 conv = gaim_conv_window_get_active_conversation(win); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1217 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1218 if (conv == NULL) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1219 return; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1220 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1221 gtkconv = GAIM_GTK_CONVERSATION(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1222 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1223 gtkconv->show_formatting_toolbar = |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1224 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1225 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1226 if (gtkconv->show_formatting_toolbar) |
8317 | 1227 gtk_widget_show(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1228 else |
8317 | 1229 gtk_widget_hide(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1230 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1231 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1232 static void |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1233 menu_sounds_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1234 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1235 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1236 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1237 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1238 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1239 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1240 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1241 if (!conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1242 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1243 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1244 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1245 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1246 gtkconv->make_sound = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1247 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1248 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1249 |
7961 | 1250 static void |
9188 | 1251 menu_timestamps_cb(gpointer data, guint action, GtkWidget *widget) |
1252 { | |
1253 GaimConvWindow *win = (GaimConvWindow *)data; | |
1254 GaimConversation *conv; | |
1255 GaimGtkConversation *gtkconv; | |
1256 | |
1257 conv = gaim_conv_window_get_active_conversation(win); | |
1258 | |
1259 if (!conv) | |
1260 return; | |
1261 | |
1262 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1263 | |
1264 gtkconv->show_timestamps = | |
1265 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); | |
1266 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
1267 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))); | |
1268 } | |
1269 | |
1270 static void | |
7961 | 1271 chat_do_im(GaimConversation *conv, const char *who) |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1272 { |
7961 | 1273 GaimPluginProtocolInfo *prpl_info = NULL; |
1274 char *real_who; | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1275 GaimConversation *conv2; |
7961 | 1276 GaimAccount *account; |
1277 | |
1278 account = gaim_conversation_get_account(conv); | |
1279 | |
1280 if(account && account->gc) | |
1281 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl); | |
1282 | |
1283 if(prpl_info && prpl_info->get_cb_real_name) | |
1284 real_who = prpl_info->get_cb_real_name(account->gc, | |
1285 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); | |
1286 else | |
1287 real_who = g_strdup(who); | |
1288 | |
1289 if(!real_who) | |
1290 return; | |
1291 | |
1292 conv2 = gaim_find_conversation_with_account(real_who, account); | |
1293 | |
1294 if (conv2 != NULL) | |
1295 gaim_conv_window_show(gaim_conversation_get_window(conv2)); | |
1296 else | |
1297 conv2 = gaim_conversation_new(GAIM_CONV_IM, account, real_who); | |
1298 | |
1299 g_free(real_who); | |
1300 } | |
1301 | |
1302 | |
1303 static void | |
1304 chat_im_button_cb(GtkWidget *widget, GaimConversation *conv) | |
1305 { | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1306 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1307 GaimGtkChatPane *gtkchat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1308 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1309 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1310 GtkTreeSelection *sel; |
9554 | 1311 char *name; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1312 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1313 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1314 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1315 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1316 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1317 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1318 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1319 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) |
9498 | 1320 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &name, -1); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1321 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1322 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1323 |
7961 | 1324 chat_do_im(conv, name); |
9554 | 1325 g_free(name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1326 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1327 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1328 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1329 ignore_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1330 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1331 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1332 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1333 GaimConvChat *chat; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1334 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1335 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1336 GtkTreeSelection *sel; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1337 const char *name; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1338 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1339 chat = GAIM_CONV_CHAT(conv); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1340 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1341 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1342 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1343 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1344 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1345 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1346 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) { |
9498 | 1347 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &name, -1); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1348 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1349 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1350 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1351 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1352 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1353 if (gaim_conv_chat_is_user_ignored(chat, name)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1354 gaim_conv_chat_unignore(chat, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1355 else |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1356 gaim_conv_chat_ignore(chat, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1357 |
9554 | 1358 add_chat_buddy_common(conv, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1359 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1360 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1361 static void |
7398 | 1362 menu_chat_im_cb(GtkWidget *w, GaimConversation *conv) |
1363 { | |
1364 const char *who = g_object_get_data(G_OBJECT(w), "user_data"); | |
1365 | |
1366 chat_do_im(conv, who); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1367 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1368 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1369 static void |
9468 | 1370 menu_chat_send_file_cb(GtkWidget *w, GaimConversation *conv) |
1371 { | |
1372 const char *who = g_object_get_data(G_OBJECT(w), "user_data"); | |
1373 GaimConnection *gc = gaim_conversation_get_gc(conv); | |
1374 | |
1375 serv_send_file(gc, who, NULL); | |
1376 } | |
1377 | |
1378 static void | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1379 menu_chat_info_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1380 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1381 char *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1382 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1383 who = g_object_get_data(G_OBJECT(w), "user_data"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1384 |
7975 | 1385 chat_do_info(conv, who); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1386 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1387 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1388 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1389 menu_chat_get_away_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1390 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1391 GaimPluginProtocolInfo *prpl_info = NULL; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1392 GaimConnection *gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1393 char *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1394 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1395 gc = gaim_conversation_get_gc(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1396 who = g_object_get_data(G_OBJECT(w), "user_data"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1397 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1398 if (gc != NULL) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1399 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1400 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1401 /* |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1402 * May want to expand this to work similarly to menu_info_cb? |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1403 */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1404 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1405 if (prpl_info->get_cb_away != NULL) |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1406 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1407 prpl_info->get_cb_away(gc, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1408 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1409 } |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1410 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1411 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1412 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1413 static void |
7928 | 1414 menu_chat_add_remove_cb(GtkWidget *w, GaimConversation *conv) |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1415 { |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1416 GaimAccount *account; |
6695 | 1417 GaimBuddy *b; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1418 char *name; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1419 |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1420 account = gaim_conversation_get_account(conv); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1421 name = g_object_get_data(G_OBJECT(w), "user_data"); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1422 b = gaim_find_buddy(account, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1423 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1424 if (b != NULL) |
9730 | 1425 gaim_gtkdialogs_remove_buddy(b); |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1426 else if (account != NULL && gaim_account_is_connected(account)) |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1427 gaim_blist_request_add_buddy(account, name, NULL, NULL); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1428 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1429 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1430 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1431 |
8143 | 1432 static GtkWidget * |
1433 create_chat_menu(GaimConversation *conv, gchar *who, | |
1434 GaimPluginProtocolInfo *prpl_info, GaimConnection *gc) | |
1435 { | |
1436 static GtkWidget *menu = NULL; | |
1437 GtkWidget *button; | |
1438 | |
1439 /* | |
1440 * If a menu already exists, destroy it before creating a new one, | |
1441 * thus freeing-up the memory it occupied. | |
1442 */ | |
1443 if (menu) | |
1444 gtk_widget_destroy(menu); | |
1445 | |
1446 menu = gtk_menu_new(); | |
1447 | |
1448 button = gtk_menu_item_new_with_label(_("IM")); | |
1449 g_signal_connect(G_OBJECT(button), "activate", | |
1450 G_CALLBACK(menu_chat_im_cb), conv); | |
1451 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1452 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1453 gtk_widget_show(button); | |
1454 | |
9468 | 1455 if (gc && prpl_info && prpl_info->send_file |
1456 && (!prpl_info->can_receive_file || prpl_info->can_receive_file(gc, who))) { | |
1457 button = gtk_menu_item_new_with_label(_("Send File")); | |
1458 g_signal_connect(G_OBJECT(button), "activate", | |
1459 G_CALLBACK(menu_chat_send_file_cb), conv); | |
1460 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1461 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1462 gtk_widget_show(button); | |
1463 } | |
9498 | 1464 |
8143 | 1465 if (gaim_conv_chat_is_user_ignored(GAIM_CONV_CHAT(conv), who)) |
1466 button = gtk_menu_item_new_with_label(_("Un-Ignore")); | |
1467 else | |
1468 button = gtk_menu_item_new_with_label(_("Ignore")); | |
1469 | |
1470 g_signal_connect(G_OBJECT(button), "activate", | |
1471 G_CALLBACK(ignore_cb), conv); | |
1472 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1473 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1474 gtk_widget_show(button); | |
1475 | |
8170 | 1476 if (gc && (prpl_info->get_info || prpl_info->get_cb_info)) { |
8143 | 1477 button = gtk_menu_item_new_with_label(_("Info")); |
1478 g_signal_connect(G_OBJECT(button), "activate", | |
1479 G_CALLBACK(menu_chat_info_cb), conv); | |
1480 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1481 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1482 gtk_widget_show(button); | |
1483 } | |
1484 | |
1485 if (gc && prpl_info->get_cb_away) { | |
1486 button = gtk_menu_item_new_with_label(_("Get Away Msg")); | |
1487 g_signal_connect(G_OBJECT(button), "activate", | |
1488 G_CALLBACK(menu_chat_get_away_cb), conv); | |
1489 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1490 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1491 gtk_widget_show(button); | |
1492 } | |
1493 | |
8170 | 1494 /* XXX: jabber can only add buddies from here in certain circumstances */ |
8143 | 1495 /* Added by Jonas <jonas@birme.se> */ |
1496 if (gc) { | |
1497 if (gaim_find_buddy(gc->account, who)) | |
1498 button = gtk_menu_item_new_with_label(_("Remove")); | |
1499 else | |
1500 button = gtk_menu_item_new_with_label(_("Add")); | |
1501 | |
1502 g_signal_connect(G_OBJECT(button), "activate", | |
1503 G_CALLBACK(menu_chat_add_remove_cb), conv); | |
1504 | |
1505 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1506 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1507 gtk_widget_show(button); | |
1508 } | |
1509 /* End Jonas */ | |
1510 | |
1511 return menu; | |
1512 } | |
1513 | |
1514 | |
1515 static gint | |
1516 gtkconv_chat_popup_menu_cb(GtkWidget *widget, GaimConversation *conv) | |
1517 { | |
1518 GaimGtkConversation *gtkconv; | |
1519 GaimPluginProtocolInfo *prpl_info = NULL; | |
1520 GaimGtkChatPane *gtkchat; | |
1521 GaimConnection *gc; | |
1522 GaimAccount *account; | |
1523 GtkTreeSelection *sel; | |
1524 GtkTreeIter iter; | |
1525 GtkTreeModel *model; | |
1526 GtkWidget *menu; | |
1527 gchar *who; | |
1528 | |
1529 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1530 gtkchat = gtkconv->u.chat; | |
1531 account = gaim_conversation_get_account(conv); | |
1532 gc = account->gc; | |
1533 | |
1534 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | |
1535 | |
1536 if (gc != NULL) | |
1537 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | |
1538 | |
1539 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); | |
1540 if(!gtk_tree_selection_get_selected(sel, NULL, &iter)) | |
1541 return FALSE; | |
1542 | |
9498 | 1543 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &who, -1); |
8143 | 1544 menu = create_chat_menu (conv, who, prpl_info, gc); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1545 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1546 gaim_gtk_treeview_popup_menu_position_func, widget, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1547 0, GDK_CURRENT_TIME); |
8143 | 1548 |
1549 return TRUE; | |
1550 } | |
1551 | |
1552 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1553 static gint |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1554 right_click_chat_cb(GtkWidget *widget, GdkEventButton *event, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1555 GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1556 { |
8143 | 1557 GaimGtkConversation *gtkconv; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1558 GaimPluginProtocolInfo *prpl_info = NULL; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1559 GaimGtkChatPane *gtkchat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1560 GaimConnection *gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1561 GaimAccount *account; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1562 GtkTreePath *path; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1563 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1564 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1565 GtkTreeViewColumn *column; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1566 gchar *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1567 int x, y; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1568 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1569 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1570 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1571 account = gaim_conversation_get_account(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1572 gc = account->gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1573 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1574 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1575 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1576 gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(gtkchat->list), |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1577 event->x, event->y, &path, &column, &x, &y); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1578 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1579 if (path == NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1580 return FALSE; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1581 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1582 if (gc != NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1583 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1584 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1585 gtk_tree_selection_select_path(GTK_TREE_SELECTION( |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1586 gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list))), path); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1587 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1588 gtk_tree_model_get_iter(GTK_TREE_MODEL(model), &iter, path); |
9498 | 1589 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &who, -1); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1590 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1591 if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) { |
7398 | 1592 chat_do_im(conv, who); |
9554 | 1593 g_free(who); |
7398 | 1594 } else if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { |
8143 | 1595 GtkWidget *menu = create_chat_menu (conv, who, prpl_info, gc); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1596 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1597 event->button, event->time); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1598 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1599 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1600 return TRUE; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1601 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1602 |
8133 | 1603 static void |
1604 move_to_next_unread_tab(GaimConversation *conv) | |
1605 { | |
1606 GaimConversation *next_conv = NULL; | |
1607 GaimConvWindow *win; | |
1608 GList *l; | |
1609 int index, i; | |
1610 | |
1611 win = gaim_conversation_get_window(conv); | |
1612 index = gaim_conversation_get_index(conv); | |
1613 | |
1614 /* First check the tabs after this position. */ | |
1615 for (l = g_list_nth(gaim_conv_window_get_conversations(win), index); | |
1616 l != NULL; | |
1617 l = l->next) { | |
1618 | |
1619 next_conv = (GaimConversation *)l->data; | |
1620 | |
1621 if (gaim_conversation_get_unseen(next_conv) > 0) | |
1622 break; | |
1623 | |
1624 next_conv = NULL; | |
1625 } | |
1626 | |
1627 if (next_conv == NULL) { | |
1628 | |
1629 /* Now check before this position. */ | |
1630 for (l = gaim_conv_window_get_conversations(win), i = 0; | |
1631 l != NULL && i < index; | |
1632 l = l->next) { | |
1633 | |
1634 next_conv = (GaimConversation *)l->data; | |
1635 | |
1636 if (gaim_conversation_get_unseen(next_conv) > 0) | |
1637 break; | |
1638 | |
1639 next_conv = NULL; | |
1640 } | |
1641 | |
1642 if (next_conv == NULL) { | |
1643 /* Okay, just grab the next conversation tab. */ | |
1644 if (index == gaim_conv_window_get_conversation_count(win) - 1) | |
1645 next_conv = gaim_conv_window_get_conversation_at(win, 0); | |
1646 else | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1647 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1648 next_conv = gaim_conv_window_get_conversation_at(win, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1649 index + 1); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1650 } |
8133 | 1651 } |
1652 } | |
1653 | |
1654 if (next_conv != NULL && next_conv != conv) { | |
1655 gaim_conv_window_switch_conversation(win, | |
1656 gaim_conversation_get_index(next_conv)); | |
1657 } | |
1658 } | |
1659 | |
4359 | 1660 static gboolean |
8105 | 1661 entry_key_press_cb(GtkWidget *entry, GdkEventKey *event, gpointer data) |
4359 | 1662 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1663 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1664 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1665 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1666 GaimGtkWindow *gtkwin; |
8105 | 1667 int numconvs; |
1668 int curconv; | |
1669 | |
1670 conv = (GaimConversation *)data; | |
1671 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1672 win = gaim_conversation_get_window(conv); | |
1673 gtkwin = GAIM_GTK_WINDOW(win); | |
1674 numconvs = gaim_conv_window_get_conversation_count(win); | |
1675 curconv = gaim_conversation_get_index(conv); | |
1676 | |
1677 /* If CTRL was held down... */ | |
1678 if (event->state & GDK_CONTROL_MASK) { | |
4359 | 1679 switch (event->keyval) { |
8105 | 1680 case GDK_Return: |
1681 case GDK_KP_Enter: | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1682 if (gaim_prefs_get_bool( |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1683 "/gaim/gtk/conversations/ctrl_enter_sends")) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1684 { |
8105 | 1685 send_cb(NULL, conv); |
1686 | |
1687 return TRUE; | |
1688 } | |
1689 break; | |
1690 | |
4359 | 1691 case GDK_Up: |
1692 if (!conv->send_history) | |
1693 break; | |
1694 | |
1695 if (!conv->send_history->prev) { | |
1696 GtkTextIter start, end; | |
1697 | |
1698 if (conv->send_history->data) | |
1699 g_free(conv->send_history->data); | |
1700 | |
1701 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, | |
1702 &start); | |
1703 gtk_text_buffer_get_end_iter(gtkconv->entry_buffer, &end); | |
1704 | |
1705 conv->send_history->data = | |
8506 | 1706 gtk_imhtml_get_markup(GTK_IMHTML(gtkconv->entry)); |
4359 | 1707 } |
8677 | 1708 |
4359 | 1709 if (conv->send_history->next && |
1710 conv->send_history->next->data) { | |
8677 | 1711 GtkTextIter iter; |
1712 GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); | |
4359 | 1713 |
1714 conv->send_history = conv->send_history->next; | |
8061 | 1715 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1716 gtk_imhtml_append_text_with_images( |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1717 GTK_IMHTML(gtkconv->entry), conv->send_history->data, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1718 0, NULL); |
8677 | 1719 /* this is mainly just a hack so the formatting at the |
1720 * cursor gets picked up. */ | |
1721 gtk_text_buffer_get_end_iter(buffer, &iter); | |
1722 gtk_text_buffer_move_mark_by_name(buffer, "insert", &iter); | |
4359 | 1723 } |
1724 | |
8105 | 1725 return TRUE; |
4359 | 1726 break; |
1727 | |
1728 case GDK_Down: | |
1729 if (!conv->send_history) | |
1730 break; | |
1731 | |
8105 | 1732 if (conv->send_history->prev && |
1733 conv->send_history->prev->data) { | |
8677 | 1734 GtkTextIter iter; |
1735 GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); | |
8105 | 1736 |
4359 | 1737 conv->send_history = conv->send_history->prev; |
8105 | 1738 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1739 gtk_imhtml_append_text_with_images( |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1740 GTK_IMHTML(gtkconv->entry), conv->send_history->data, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1741 0, NULL); |
8677 | 1742 /* this is mainly just a hack so the formatting at the |
1743 * cursor gets picked up. */ | |
1744 gtk_text_buffer_get_end_iter(buffer, &iter); | |
1745 gtk_text_buffer_move_mark_by_name(buffer, "insert", &iter); | |
4359 | 1746 } |
1747 | |
8105 | 1748 return TRUE; |
4359 | 1749 break; |
8105 | 1750 |
8108 | 1751 case GDK_Page_Down: |
8143 | 1752 case ']': |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1753 gaim_conv_window_switch_conversation(win, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1754 (curconv + 1) % numconvs); |
8105 | 1755 |
1756 return TRUE; | |
1757 break; | |
1758 | |
8108 | 1759 case GDK_Page_Up: |
8143 | 1760 case '[': |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1761 gaim_conv_window_switch_conversation(win, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1762 (curconv + numconvs - 1) % numconvs); |
8133 | 1763 |
1764 return TRUE; | |
1765 break; | |
1766 | |
8108 | 1767 case GDK_Tab: |
8133 | 1768 move_to_next_unread_tab(conv); |
8108 | 1769 |
1770 return TRUE; | |
1771 break; | |
1772 | |
1773 case 'z': | |
1774 gtk_window_iconify(GTK_WINDOW(gtkwin->window)); | |
8105 | 1775 |
1776 return TRUE; | |
1777 break; | |
1778 | |
1779 } /* End of switch */ | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1780 } |
8758 | 1781 |
8105 | 1782 /* If ALT (or whatever) was held down... */ |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1783 else if (event->state & GDK_MOD1_MASK) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1784 { |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8730
diff
changeset
|
1785 /* XXX - Make sure the conv exists before switching to it */ |
8105 | 1786 if (event->keyval > '0' && event->keyval <= '9') { |
1787 int switchto = event->keyval - '1'; | |
1788 if (switchto < numconvs) | |
1789 gaim_conv_window_switch_conversation(win, switchto); | |
4359 | 1790 |
1791 return TRUE; | |
1792 } | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1793 } |
8758 | 1794 |
8105 | 1795 /* If neither CTRL nor ALT were held down... */ |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1796 else |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1797 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1798 switch (event->keyval) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1799 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1800 case GDK_Return: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1801 case GDK_KP_Enter: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1802 if (!(event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK)) && |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1803 gaim_prefs_get_bool("/gaim/gtk/conversations/enter_sends")) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1804 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1805 send_cb(NULL, conv); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1806 return TRUE; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1807 } |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1808 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1809 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1810 case GDK_Tab: |
9605 | 1811 return tab_complete(conv); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1812 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1813 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1814 case GDK_Page_Up: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1815 gtk_imhtml_page_up(GTK_IMHTML(gtkconv->imhtml)); |
8105 | 1816 return TRUE; |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1817 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1818 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1819 case GDK_Page_Down: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1820 gtk_imhtml_page_down(GTK_IMHTML(gtkconv->imhtml)); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1821 return TRUE; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1822 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1823 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1824 } |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1825 } |
4359 | 1826 |
1827 return FALSE; | |
1828 } | |
1829 | |
1830 /* | |
1831 * NOTE: | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1832 * This guy just kills a single right click from being propagated any |
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1833 * further. I have no idea *why* we need this, but we do ... It |
4359 | 1834 * prevents right clicks on the GtkTextView in a convo dialog from |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1835 * going all the way down to the notebook. I suspect a bug in |
4359 | 1836 * GtkTextView, but I'm not ready to point any fingers yet. |
1837 */ | |
1838 static gboolean | |
1839 entry_stop_rclick_cb(GtkWidget *widget, GdkEventButton *event, gpointer data) | |
1840 { | |
1841 if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { | |
1842 /* Right single click */ | |
1843 g_signal_stop_emission_by_name(G_OBJECT(widget), "button_press_event"); | |
1844 | |
1845 return TRUE; | |
1846 } | |
1847 | |
1848 return FALSE; | |
1849 } | |
1850 | |
8173 | 1851 /* |
1852 * If someone tries to type into the conversation backlog of a | |
1853 * conversation window then we yank focus from the conversation backlog | |
1854 * and give it to the text entry box so that people can type | |
1855 * all the live long day and it will get entered into the entry box. | |
1856 */ | |
6057 | 1857 static gboolean |
8105 | 1858 refocus_entry_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) |
6057 | 1859 { |
1860 GaimGtkConversation *gtkconv = data; | |
1861 | |
8237 | 1862 /* If we have a valid key for the conversation display, then exit */ |
8224 | 1863 if ((event->state & GDK_CONTROL_MASK) || |
8237 | 1864 (event->keyval == GDK_F10) || |
1865 (event->keyval == GDK_Shift_L) || | |
1866 (event->keyval == GDK_Shift_R) || | |
1867 (event->keyval == GDK_Escape) || | |
8177 | 1868 (event->keyval == GDK_Up) || |
1869 (event->keyval == GDK_Down) || | |
1870 (event->keyval == GDK_Left) || | |
8191 | 1871 (event->keyval == GDK_Right) || |
1872 (event->keyval == GDK_Home) || | |
9297 | 1873 (event->keyval == GDK_End) || |
1874 (event->keyval == GDK_Tab) || | |
1875 (event->keyval == GDK_ISO_Left_Tab)) | |
8177 | 1876 return FALSE; |
1877 | |
1878 if (event->type == GDK_KEY_RELEASE) | |
1879 gtk_widget_grab_focus(gtkconv->entry); | |
1880 | |
1881 gtk_widget_event(gtkconv->entry, (GdkEvent *)event); | |
1882 | |
1883 return TRUE; | |
6057 | 1884 } |
1885 | |
4359 | 1886 static void |
4673 | 1887 menu_conv_sel_send_cb(GObject *m, gpointer data) |
4359 | 1888 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1889 GaimConvWindow *win = g_object_get_data(m, "user_data"); |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
1890 GaimAccount *account = g_object_get_data(m, "gaim_account"); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1891 GaimConversation *conv; |
8456 | 1892 GaimGtkConversation *gtkconv; |
4359 | 1893 |
10059
79fafe47d919
[gaim-migrate @ 11027]
Luke Schierer <lschiere@pidgin.im>
parents:
10053
diff
changeset
|
1894 if (gtk_check_menu_item_get_active((GtkCheckMenuItem*) m) == FALSE) |
79fafe47d919
[gaim-migrate @ 11027]
Luke Schierer <lschiere@pidgin.im>
parents:
10053
diff
changeset
|
1895 return; |
79fafe47d919
[gaim-migrate @ 11027]
Luke Schierer <lschiere@pidgin.im>
parents:
10053
diff
changeset
|
1896 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1897 conv = gaim_conv_window_get_active_conversation(win); |
4359 | 1898 |
4491 | 1899 gaim_conversation_set_account(conv, account); |
8456 | 1900 |
1901 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1902 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), | |
9699 | 1903 gaim_account_get_protocol_name(conv->account)); |
4359 | 1904 } |
1905 | |
1906 static void | |
1907 insert_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *position, | |
1908 gchar *new_text, gint new_text_length, gpointer user_data) | |
1909 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1910 GaimConversation *conv = (GaimConversation *)user_data; |
4359 | 1911 |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1912 g_return_if_fail(conv != NULL); |
4359 | 1913 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1914 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) |
4359 | 1915 return; |
1916 | |
1917 got_typing_keypress(conv, (gtk_text_iter_is_start(position) && | |
1918 gtk_text_iter_is_end(position))); | |
1919 } | |
1920 | |
1921 static void | |
1922 delete_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *start_pos, | |
1923 GtkTextIter *end_pos, gpointer user_data) | |
1924 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1925 GaimConversation *conv = (GaimConversation *)user_data; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1926 GaimConvIm *im; |
4359 | 1927 |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1928 g_return_if_fail(conv != NULL); |
4359 | 1929 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1930 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) |
4359 | 1931 return; |
1932 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1933 im = GAIM_CONV_IM(conv); |
4359 | 1934 |
1935 if (gtk_text_iter_is_start(start_pos) && gtk_text_iter_is_end(end_pos)) { | |
1936 | |
1937 /* We deleted all the text, so turn off typing. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1938 if (gaim_conv_im_get_type_again_timeout(im)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1939 gaim_conv_im_stop_type_again_timeout(im); |
4359 | 1940 |
1941 serv_send_typing(gaim_conversation_get_gc(conv), | |
6695 | 1942 gaim_conversation_get_name(conv), |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
1943 GAIM_NOT_TYPING); |
4359 | 1944 } |
1945 else { | |
1946 /* We're deleting, but not all of it, so it counts as typing. */ | |
1947 got_typing_keypress(conv, FALSE); | |
1948 } | |
1949 } | |
1950 | |
1951 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1952 notebook_init_grab(GaimGtkWindow *gtkwin, GtkWidget *widget) |
4359 | 1953 { |
1954 static GdkCursor *cursor = NULL; | |
1955 | |
1956 gtkwin->in_drag = TRUE; | |
1957 | |
1958 if (gtkwin->drag_leave_signal) { | |
1959 g_signal_handler_disconnect(G_OBJECT(widget), | |
1960 gtkwin->drag_leave_signal); | |
1961 | |
1962 gtkwin->drag_leave_signal = 0; | |
1963 } | |
1964 | |
1965 if (cursor == NULL) | |
1966 cursor = gdk_cursor_new(GDK_FLEUR); | |
1967 | |
1968 /* Grab the pointer */ | |
1969 gtk_grab_add(gtkwin->notebook); | |
5114
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1970 #ifndef _WIN32 |
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1971 /* Currently for win32 GTK+ (as of 2.2.1), gdk_pointer_is_grabbed will |
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1972 always be true after a button press. */ |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1973 if (!gdk_pointer_is_grabbed()) |
5114
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1974 #endif |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1975 gdk_pointer_grab(gtkwin->notebook->window, FALSE, |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1976 GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1977 NULL, cursor, GDK_CURRENT_TIME); |
4359 | 1978 } |
1979 | |
1980 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1981 notebook_motion_cb(GtkWidget *widget, GdkEventButton *e, GaimConvWindow *win) |
4359 | 1982 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1983 GaimGtkWindow *gtkwin; |
4359 | 1984 |
1985 gtkwin = GAIM_GTK_WINDOW(win); | |
1986 | |
1987 /* | |
1988 * Make sure the user moved the mouse far enough for the | |
1989 * drag to be initiated. | |
1990 */ | |
1991 if (gtkwin->in_predrag) { | |
1992 if (e->x_root < gtkwin->drag_min_x || | |
1993 e->x_root >= gtkwin->drag_max_x || | |
1994 e->y_root < gtkwin->drag_min_y || | |
1995 e->y_root >= gtkwin->drag_max_y) { | |
1996 | |
1997 gtkwin->in_predrag = FALSE; | |
1998 notebook_init_grab(gtkwin, widget); | |
1999 } | |
2000 } | |
2001 else { /* Otherwise, draw the arrows. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2002 GaimConvWindow *dest_win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2003 GaimGtkWindow *dest_gtkwin; |
4359 | 2004 GtkNotebook *dest_notebook; |
2005 GtkWidget *tab, *last_vis_tab = NULL; | |
2006 gint nb_x, nb_y, page_num, i, last_vis_tab_loc = -1; | |
2007 gint arrow1_x, arrow1_y, arrow2_x, arrow2_y; | |
2008 gboolean horiz_tabs = FALSE, tab_found = FALSE; | |
2009 GList *l; | |
2010 | |
2011 /* Get the window that the cursor is over. */ | |
2012 dest_win = gaim_gtkwin_get_at_xy(e->x_root, e->y_root); | |
2013 | |
2014 if (dest_win == NULL) { | |
2015 dnd_hints_hide_all(); | |
2016 | |
2017 return TRUE; | |
2018 } | |
2019 | |
2020 dest_gtkwin = GAIM_GTK_WINDOW(dest_win); | |
2021 | |
2022 dest_notebook = GTK_NOTEBOOK(dest_gtkwin->notebook); | |
2023 | |
2024 gdk_window_get_origin(GTK_WIDGET(dest_notebook)->window, &nb_x, &nb_y); | |
2025 | |
2026 arrow1_x = arrow2_x = nb_x; | |
2027 arrow1_y = arrow2_y = nb_y; | |
2028 | |
2029 page_num = gaim_gtkconv_get_dest_tab_at_xy(dest_win, | |
2030 e->x_root, e->y_root); | |
2031 | |
2032 if (gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_TOP || | |
2033 gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_BOTTOM) { | |
2034 | |
2035 horiz_tabs = TRUE; | |
2036 } | |
2037 | |
2038 /* Find out where to put the arrows. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2039 for (l = gaim_conv_window_get_conversations(dest_win), i = 0; |
4359 | 2040 l != NULL; |
2041 l = l->next, i++) { | |
2042 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2043 GaimConversation *conv = l->data; |
4359 | 2044 |
2045 tab = GAIM_GTK_CONVERSATION(conv)->tabby; | |
2046 | |
2047 /* | |
2048 * If this is the correct tab, record the positions | |
2049 * for the arrows. | |
2050 */ | |
2051 if (i == page_num) { | |
2052 if (horiz_tabs) { | |
2053 arrow1_x = arrow2_x = nb_x + tab->allocation.x; | |
2054 arrow1_y = nb_y + tab->allocation.y; | |
2055 arrow2_y = nb_y + tab->allocation.y + | |
2056 tab->allocation.height; | |
2057 } | |
2058 else { | |
2059 arrow1_x = nb_x + tab->allocation.x; | |
2060 arrow2_x = nb_x + tab->allocation.x + | |
2061 tab->allocation.width; | |
2062 arrow1_y = arrow2_y = nb_y + tab->allocation.y; | |
2063 } | |
2064 | |
2065 tab_found = TRUE; | |
2066 break; | |
2067 } | |
2068 else { /* Keep track of the right-most tab that we see. */ | |
2069 if (horiz_tabs && tab->allocation.x > last_vis_tab_loc) { | |
2070 last_vis_tab = tab; | |
2071 last_vis_tab_loc = tab->allocation.x; | |
2072 } | |
2073 else if (!horiz_tabs && tab->allocation.y > last_vis_tab_loc) { | |
2074 last_vis_tab = tab; | |
2075 last_vis_tab_loc = tab->allocation.y; | |
2076 } | |
2077 } | |
2078 } | |
2079 | |
2080 /* | |
2081 * If we didn't find the tab, then we'll just place the | |
2082 * arrows to the right/bottom of the last visible tab. | |
2083 */ | |
2084 if (!tab_found && last_vis_tab) { | |
2085 if (horiz_tabs) { | |
2086 arrow1_x = arrow2_x = nb_x + last_vis_tab->allocation.x + | |
2087 last_vis_tab->allocation.width; | |
2088 arrow1_y = nb_y + last_vis_tab->allocation.y; | |
2089 arrow2_y = nb_y + last_vis_tab->allocation.y + | |
2090 last_vis_tab->allocation.height; | |
2091 } | |
2092 else { | |
2093 arrow1_x = nb_x + last_vis_tab->allocation.x; | |
2094 arrow2_x = nb_x + last_vis_tab->allocation.x + | |
2095 last_vis_tab->allocation.width; | |
2096 arrow1_y = arrow2_y = nb_y + last_vis_tab->allocation.y + | |
2097 last_vis_tab->allocation.height; | |
2098 } | |
2099 } | |
2100 | |
2101 if (horiz_tabs) { | |
2102 dnd_hints_show(HINT_ARROW_DOWN, arrow1_x, arrow1_y); | |
2103 dnd_hints_show(HINT_ARROW_UP, arrow2_x, arrow2_y); | |
2104 } | |
2105 else { | |
2106 dnd_hints_show(HINT_ARROW_RIGHT, arrow1_x, arrow1_y); | |
2107 dnd_hints_show(HINT_ARROW_LEFT, arrow2_x, arrow2_y); | |
2108 } | |
2109 } | |
2110 | |
2111 return TRUE; | |
2112 } | |
2113 | |
2114 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2115 notebook_leave_cb(GtkWidget *widget, GdkEventCrossing *e, GaimConvWindow *win) |
4359 | 2116 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2117 GaimGtkWindow *gtkwin; |
4359 | 2118 |
2119 gtkwin = GAIM_GTK_WINDOW(win); | |
2120 | |
2121 if (gtkwin->in_drag) | |
2122 return FALSE; | |
2123 | |
2124 if (e->x_root < gtkwin->drag_min_x || | |
2125 e->x_root >= gtkwin->drag_max_x || | |
2126 e->y_root < gtkwin->drag_min_y || | |
2127 e->y_root >= gtkwin->drag_max_y) { | |
2128 | |
2129 gtkwin->in_predrag = FALSE; | |
2130 notebook_init_grab(gtkwin, widget); | |
2131 } | |
2132 | |
2133 return TRUE; | |
2134 } | |
2135 | |
2136 /* | |
2137 * THANK YOU GALEON! | |
2138 */ | |
2139 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2140 notebook_press_cb(GtkWidget *widget, GdkEventButton *e, GaimConvWindow *win) |
4359 | 2141 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2142 GaimGtkWindow *gtkwin; |
4359 | 2143 gint nb_x, nb_y, x_rel, y_rel; |
2144 GList *l; | |
2145 int tab_clicked; | |
2146 | |
2147 if (e->button != 1 || e->type != GDK_BUTTON_PRESS) | |
2148 return FALSE; | |
2149 | |
2150 gtkwin = GAIM_GTK_WINDOW(win); | |
2151 | |
2152 if (gtkwin->in_drag) { | |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
2153 gaim_debug(GAIM_DEBUG_WARNING, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
2154 "Already in the middle of a window drag at tab_press_cb\n"); |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
2155 return TRUE; |
4359 | 2156 } |
2157 | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2158 /* |
4359 | 2159 * Make sure a tab was actually clicked. The arrow buttons |
2160 * mess things up. | |
2161 */ | |
2162 tab_clicked = gaim_gtkconv_get_tab_at_xy(win, e->x_root, e->y_root); | |
2163 | |
2164 if (tab_clicked == -1) | |
2165 return FALSE; | |
2166 | |
2167 /* | |
2168 * Get the relative position of the press event, with regards to | |
2169 * the position of the notebook. | |
2170 */ | |
2171 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
2172 | |
2173 x_rel = e->x_root - nb_x; | |
2174 y_rel = e->y_root - nb_y; | |
2175 | |
2176 /* Reset the min/max x/y */ | |
2177 gtkwin->drag_min_x = 0; | |
2178 gtkwin->drag_min_y = 0; | |
2179 gtkwin->drag_max_x = 0; | |
2180 gtkwin->drag_max_y = 0; | |
2181 | |
2182 /* Find out which tab was dragged. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2183 for (l = gaim_conv_window_get_conversations(win); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2184 GaimConversation *conv = l->data; |
4359 | 2185 GtkWidget *tab = GAIM_GTK_CONVERSATION(conv)->tabby; |
2186 | |
2187 if (!GTK_WIDGET_VISIBLE(tab)) | |
2188 continue; | |
2189 | |
2190 if (tab->allocation.x > x_rel || tab->allocation.y > y_rel) | |
2191 break; | |
2192 | |
2193 /* Save the borders of the tab. */ | |
2194 gtkwin->drag_min_x = tab->allocation.x + nb_x; | |
2195 gtkwin->drag_min_y = tab->allocation.y + nb_y; | |
2196 gtkwin->drag_max_x = tab->allocation.width + gtkwin->drag_min_x; | |
2197 gtkwin->drag_max_y = tab->allocation.height + gtkwin->drag_min_y; | |
2198 } | |
2199 | |
2200 /* Make sure the click occurred in the tab. */ | |
2201 if (e->x_root < gtkwin->drag_min_x || | |
2202 e->x_root >= gtkwin->drag_max_x || | |
2203 e->y_root < gtkwin->drag_min_y || | |
2204 e->y_root >= gtkwin->drag_max_y) { | |
2205 | |
2206 return FALSE; | |
2207 } | |
2208 | |
2209 gtkwin->in_predrag = TRUE; | |
2210 | |
2211 /* Connect the new motion signals. */ | |
2212 gtkwin->drag_motion_signal = | |
2213 g_signal_connect(G_OBJECT(widget), "motion_notify_event", | |
2214 G_CALLBACK(notebook_motion_cb), win); | |
2215 | |
2216 gtkwin->drag_leave_signal = | |
2217 g_signal_connect(G_OBJECT(widget), "leave_notify_event", | |
2218 G_CALLBACK(notebook_leave_cb), win); | |
2219 | |
2220 return FALSE; | |
2221 } | |
2222 | |
2223 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2224 notebook_release_cb(GtkWidget *widget, GdkEventButton *e, GaimConvWindow *win) |
4359 | 2225 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2226 GaimConvWindow *dest_win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2227 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2228 GaimGtkWindow *dest_gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2229 GaimConversation *conv; |
4359 | 2230 GtkNotebook *dest_notebook; |
2231 gint dest_page_num; | |
2232 | |
2233 /* | |
2234 * Don't check to make sure that the event's window matches the | |
2235 * widget's, because we may be getting an event passed on from the | |
2236 * close button. | |
2237 */ | |
2238 if (e->button != 1 && e->type != GDK_BUTTON_RELEASE) | |
2239 return FALSE; | |
2240 | |
2241 if (gdk_pointer_is_grabbed()) { | |
2242 gdk_pointer_ungrab(GDK_CURRENT_TIME); | |
2243 gtk_grab_remove(widget); | |
2244 } | |
2245 | |
2246 gtkwin = GAIM_GTK_WINDOW(win); | |
2247 | |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
2248 if (!gtkwin->in_predrag && !gtkwin->in_drag) |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
2249 return FALSE; |
4359 | 2250 |
2251 /* Disconnect the motion signal. */ | |
2252 if (gtkwin->drag_motion_signal) { | |
2253 g_signal_handler_disconnect(G_OBJECT(widget), | |
2254 gtkwin->drag_motion_signal); | |
2255 | |
2256 gtkwin->drag_motion_signal = 0; | |
2257 } | |
2258 | |
2259 /* | |
2260 * If we're in a pre-drag, we'll also need to disconnect the leave | |
2261 * signal. | |
2262 */ | |
2263 if (gtkwin->in_predrag) { | |
2264 gtkwin->in_predrag = FALSE; | |
2265 | |
2266 if (gtkwin->drag_leave_signal) { | |
2267 g_signal_handler_disconnect(G_OBJECT(widget), | |
2268 gtkwin->drag_leave_signal); | |
2269 | |
2270 gtkwin->drag_leave_signal = 0; | |
2271 } | |
2272 } | |
2273 | |
2274 /* If we're not in drag... */ | |
2275 /* We're perfectly normal people! */ | |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
2276 if (!gtkwin->in_drag) |
4359 | 2277 return FALSE; |
2278 | |
2279 gtkwin->in_drag = FALSE; | |
2280 | |
2281 dnd_hints_hide_all(); | |
2282 | |
4369
7e1fb422e5fd
[gaim-migrate @ 4635]
Christian Hammond <chipx86@chipx86.com>
parents:
4368
diff
changeset
|
2283 dest_win = gaim_gtkwin_get_at_xy(e->x_root, e->y_root); |
4359 | 2284 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2285 conv = gaim_conv_window_get_active_conversation(win); |
4359 | 2286 |
2287 if (dest_win == NULL) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2288 if (gaim_conv_window_get_conversation_count(win) < 2) |
4359 | 2289 return FALSE; |
2290 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2291 if (gaim_conv_window_get_conversation_count(win) > 1) { |
4359 | 2292 /* Make a new window to stick this to. */ |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2293 GaimGtkConversation *gtkconv; |
4748
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2294 gint win_width, win_height; |
5121 | 2295 |
2296 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4359 | 2297 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2298 dest_win = gaim_conv_window_new(); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2299 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2300 gaim_conv_window_add_conversation(dest_win, |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2301 gaim_conv_window_remove_conversation(win, |
5139
d0182ae31ab8
[gaim-migrate @ 5503]
Christian Hammond <chipx86@chipx86.com>
parents:
5133
diff
changeset
|
2302 gaim_conversation_get_index(conv))); |
5121 | 2303 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2304 dest_gtkwin = GAIM_GTK_WINDOW(dest_win); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2305 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2306 gtk_window_get_size(GTK_WINDOW(dest_gtkwin->window), |
4748
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2307 &win_width, &win_height); |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2308 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2309 gtk_window_move(GTK_WINDOW(dest_gtkwin->window), |
4748
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2310 e->x_root - (win_width / 2), |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2311 e->y_root - (win_height / 2)); |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2312 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2313 gaim_conv_window_show(dest_win); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2314 } |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2315 } else { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2316 dest_gtkwin = GAIM_GTK_WINDOW(dest_win); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2317 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2318 /* Get the destination notebook. */ |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2319 dest_notebook = GTK_NOTEBOOK(gtkwin->notebook); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2320 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2321 /* Get the destination page number. */ |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2322 dest_page_num = gaim_gtkconv_get_dest_tab_at_xy(dest_win, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2323 e->x_root, e->y_root); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2324 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2325 if (win == dest_win) { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2326 gaim_conv_window_move_conversation(win, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2327 gaim_conversation_get_index(conv), dest_page_num); |
4359 | 2328 } |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2329 else { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2330 size_t pos; |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2331 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2332 gaim_conv_window_remove_conversation(win, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2333 gaim_conversation_get_index(conv)); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2334 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2335 pos = gaim_conv_window_add_conversation(dest_win, conv); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2336 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2337 if (pos != dest_page_num) |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2338 gaim_conv_window_move_conversation(dest_win, pos, dest_page_num); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2339 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2340 gaim_conv_window_switch_conversation(dest_win, dest_page_num); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2341 } |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2342 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2343 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); |
4359 | 2344 } |
2345 | |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2346 gaim_signal_emit(gaim_gtk_conversations_get_handle(), "conversation-drag-ended", |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2347 win, dest_win); |
4359 | 2348 |
2349 return TRUE; | |
2350 } | |
2351 | |
8189 | 2352 /************************************************************************** |
2353 * A bunch of buddy icon functions | |
2354 **************************************************************************/ | |
2355 static GdkPixbuf * | |
8755
d0364feabf96
[gaim-migrate @ 9510]
Christian Hammond <chipx86@chipx86.com>
parents:
8748
diff
changeset
|
2356 get_tab_icon(GaimConversation *conv, gboolean small_icon) |
7143 | 2357 { |
2358 GaimAccount *account = gaim_conversation_get_account(conv); | |
2359 const char *name = gaim_conversation_get_name(conv); | |
2360 GdkPixbuf *status = NULL; | |
2361 | |
2362 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
2363 GaimBuddy *b = gaim_find_buddy(account, name); | |
2364 if (b != NULL) { | |
2365 status = gaim_gtk_blist_get_status_icon((GaimBlistNode*)b, | |
8755
d0364feabf96
[gaim-migrate @ 9510]
Christian Hammond <chipx86@chipx86.com>
parents:
8748
diff
changeset
|
2366 (small_icon ? GAIM_STATUS_ICON_SMALL : GAIM_STATUS_ICON_LARGE)); |
7143 | 2367 } |
2368 } | |
2369 | |
2370 if (!status) { | |
2371 GdkPixbuf *pixbuf; | |
2372 pixbuf = create_prpl_icon(account); | |
2373 | |
8755
d0364feabf96
[gaim-migrate @ 9510]
Christian Hammond <chipx86@chipx86.com>
parents:
8748
diff
changeset
|
2374 if (small_icon && pixbuf != NULL) |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2375 { |
7143 | 2376 status = gdk_pixbuf_scale_simple(pixbuf, 15, 15, |
2377 GDK_INTERP_BILINEAR); | |
2378 g_object_unref(pixbuf); | |
2379 } | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2380 else |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2381 status = pixbuf; |
7143 | 2382 } |
2383 return status; | |
2384 } | |
2385 | |
8189 | 2386 static void |
2387 update_tab_icon(GaimConversation *conv) | |
2388 { | |
2389 GaimGtkConversation *gtkconv; | |
2390 GaimConvWindow *win = gaim_conversation_get_window(conv); | |
2391 GaimAccount *account; | |
2392 const char *name; | |
2393 GdkPixbuf *status = NULL; | |
2394 | |
2395 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2396 name = gaim_conversation_get_name(conv); | |
2397 account = gaim_conversation_get_account(conv); | |
2398 | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2399 status = get_tab_icon(conv, TRUE); |
8189 | 2400 |
2401 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->icon), status); | |
2402 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->menu_icon), status); | |
2403 | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2404 if (status != NULL) |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2405 g_object_unref(status); |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2406 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2407 if (gaim_conv_window_get_active_conversation(win) == conv && |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2408 gtkconv->u.im->anim == NULL) |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2409 { |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2410 status = get_tab_icon(conv, FALSE); |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2411 |
8189 | 2412 gtk_window_set_icon(GTK_WINDOW(GAIM_GTK_WINDOW(win)->window), status); |
2413 | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2414 if (status != NULL) |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2415 g_object_unref(status); |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2416 } |
8189 | 2417 } |
2418 | |
9318 | 2419 static void |
2420 get_icon_scale_size(GdkPixbufAnimation *icon, GaimBuddyIconSpec *spec, int *width, int *height) | |
2421 { | |
2422 *width = gdk_pixbuf_animation_get_width(icon); | |
2423 *height = gdk_pixbuf_animation_get_height(icon); | |
2424 | |
2425 /* this should eventually get smarter about preserving the aspect | |
2426 * ratio when scaling, but gimmie a break, I just woke up */ | |
2427 if(spec && spec->scale_rules & GAIM_ICON_SCALE_DISPLAY) { | |
2428 if(*width < spec->min_width) | |
2429 *width = spec->min_width; | |
2430 else if(*width > spec->max_width) | |
2431 *width = spec->max_width; | |
2432 | |
2433 if(*height < spec->min_height) | |
2434 *height = spec->min_height; | |
9319 | 2435 else if(*height > spec->max_height) |
9318 | 2436 *height = spec->max_height; |
2437 } | |
2438 | |
2439 /* and now for some arbitrary sanity checks */ | |
2440 if(*width > 100) | |
2441 *width = 100; | |
2442 if(*height > 100) | |
2443 *height = 100; | |
2444 } | |
2445 | |
8189 | 2446 static gboolean |
2447 redraw_icon(gpointer data) | |
2448 { | |
2449 GaimConversation *conv = (GaimConversation *)data; | |
2450 GaimGtkConversation *gtkconv; | |
9318 | 2451 GaimAccount *account; |
2452 GaimPluginProtocolInfo *prpl_info = NULL; | |
8189 | 2453 |
2454 GdkPixbuf *buf; | |
2455 GdkPixbuf *scale; | |
2456 GdkPixmap *pm; | |
2457 GdkBitmap *bm; | |
2458 gint delay; | |
9318 | 2459 int scale_width, scale_height; |
8189 | 2460 |
2461 if (!g_list_find(gaim_get_ims(), conv)) { | |
2462 gaim_debug(GAIM_DEBUG_WARNING, "gtkconv", | |
2463 "Conversation not found in redraw_icon. I think this " | |
2464 "is a bug.\n"); | |
2465 return FALSE; | |
2466 } | |
2467 | |
2468 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
9318 | 2469 account = gaim_conversation_get_account(conv); |
2470 if(account && account->gc) | |
2471 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl); | |
8189 | 2472 |
2473 gdk_pixbuf_animation_iter_advance(gtkconv->u.im->iter, NULL); | |
2474 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); | |
2475 | |
9318 | 2476 get_icon_scale_size(gtkconv->u.im->anim, prpl_info ? &prpl_info->icon_spec : |
2477 NULL, &scale_width, &scale_height); | |
2478 | |
2479 /* this code is ugly, and scares me */ | |
8189 | 2480 scale = gdk_pixbuf_scale_simple(buf, |
9318 | 2481 MAX(gdk_pixbuf_get_width(buf) * scale_width / |
8189 | 2482 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), |
9318 | 2483 MAX(gdk_pixbuf_get_height(buf) * scale_height / |
8189 | 2484 gdk_pixbuf_animation_get_height(gtkconv->u.im->anim), 1), |
2485 GDK_INTERP_NEAREST); | |
2486 | |
2487 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); | |
2488 g_object_unref(G_OBJECT(scale)); | |
2489 gtk_image_set_from_pixmap(GTK_IMAGE(gtkconv->u.im->icon), pm, bm); | |
2490 g_object_unref(G_OBJECT(pm)); | |
2491 gtk_widget_queue_draw(gtkconv->u.im->icon); | |
2492 | |
2493 if (bm) | |
2494 g_object_unref(G_OBJECT(bm)); | |
2495 | |
9131 | 2496 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter); |
2497 if (delay <= 0) | |
2498 delay = 100; | |
2499 | |
2500 gtkconv->u.im->icon_timer = g_timeout_add(delay, redraw_icon, conv); | |
8189 | 2501 |
2502 return FALSE; | |
2503 } | |
2504 | |
2505 static void | |
2506 start_anim(GtkObject *obj, GaimConversation *conv) | |
2507 { | |
2508 GaimGtkConversation *gtkconv; | |
2509 int delay; | |
2510 | |
2511 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
2512 return; | |
2513 | |
2514 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2515 | |
8228 | 2516 if (gtkconv->u.im->anim == NULL) |
2517 return; | |
2518 | |
8202 | 2519 if (gtkconv->u.im->icon_timer != 0) |
2520 return; | |
2521 | |
8189 | 2522 if (gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim)) |
2523 return; | |
2524 | |
2525 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter) / 10; | |
2526 | |
8758 | 2527 gtkconv->u.im->icon_timer = g_timeout_add(delay * 10, redraw_icon, conv); |
8189 | 2528 } |
2529 | |
2530 static void | |
2531 stop_anim(GtkObject *obj, GaimConversation *conv) | |
2532 { | |
2533 GaimGtkConversation *gtkconv; | |
2534 | |
2535 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
2536 return; | |
2537 | |
2538 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2539 | |
2540 if (gtkconv->u.im->icon_timer != 0) | |
2541 g_source_remove(gtkconv->u.im->icon_timer); | |
2542 | |
2543 gtkconv->u.im->icon_timer = 0; | |
2544 } | |
2545 | |
2546 static void | |
2547 toggle_icon_animate_cb(GtkWidget *w, GaimConversation *conv) | |
2548 { | |
2549 GaimGtkConversation *gtkconv; | |
2550 | |
2551 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
2552 return; | |
2553 | |
2554 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2555 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2556 gtkconv->u.im->animate = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2557 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w)); |
8189 | 2558 |
2559 if (gtkconv->u.im->animate) | |
2560 start_anim(NULL, conv); | |
2561 else | |
2562 stop_anim(NULL, conv); | |
2563 } | |
9845 | 2564 |
8189 | 2565 static void |
2566 remove_icon(GaimGtkConversation *gtkconv) | |
2567 { | |
2568 g_return_if_fail(gtkconv != NULL); | |
2569 | |
9887 | 2570 if (gtkconv->u.im->icon_container != NULL) |
2571 gtk_widget_destroy(gtkconv->u.im->icon_container); | |
8189 | 2572 |
2573 if (gtkconv->u.im->anim != NULL) | |
2574 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); | |
2575 | |
2576 if (gtkconv->u.im->icon_timer != 0) | |
2577 g_source_remove(gtkconv->u.im->icon_timer); | |
2578 | |
2579 if (gtkconv->u.im->iter != NULL) | |
2580 g_object_unref(G_OBJECT(gtkconv->u.im->iter)); | |
2581 | |
2582 gtkconv->u.im->icon_timer = 0; | |
2583 gtkconv->u.im->icon = NULL; | |
2584 gtkconv->u.im->anim = NULL; | |
2585 gtkconv->u.im->iter = NULL; | |
9687 | 2586 gtkconv->u.im->show_icon = FALSE; |
8189 | 2587 } |
2588 | |
9497 | 2589 static void |
9504 | 2590 saveicon_writefile_cb(void *user_data, const char *filename) |
9497 | 2591 { |
9504 | 2592 GaimConversation *conv = (GaimConversation *)user_data; |
9497 | 2593 FILE *fp; |
2594 GaimBuddyIcon *icon; | |
2595 const void *data; | |
2596 size_t len; | |
2597 | |
2598 if ((fp = fopen(filename, "wb")) == NULL) { | |
9504 | 2599 gaim_notify_error(conv, NULL, _("Unable to open file."), NULL); |
9497 | 2600 return; |
2601 } | |
2602 | |
2603 icon = gaim_conv_im_get_icon(GAIM_CONV_IM(conv)); | |
2604 data = gaim_buddy_icon_get_data(icon, &len); | |
2605 | |
2606 if ((len <= 0) || (data == NULL)) { | |
9504 | 2607 gaim_notify_error(conv, NULL, _("Unable to save icon file to disk."), NULL); |
9497 | 2608 return; |
2609 } | |
2610 | |
2611 fwrite(data, 1, len, fp); | |
2612 fclose(fp); | |
2613 } | |
2614 | |
2615 static void | |
2616 icon_menu_save_cb(GtkWidget *widget, GaimConversation *conv) | |
2617 { | |
2618 gchar *buf; | |
2619 | |
2620 g_return_if_fail(conv != NULL); | |
9504 | 2621 |
9706 | 2622 /* |
2623 * XXX - The file extension needs to be set to something that doesn't suck... | |
2624 * Maybe do what gtkimhtml.c does when saving an image? | |
2625 */ | |
9497 | 2626 buf = g_strdup_printf("%s.icon", gaim_normalize(conv->account, conv->name)); |
9504 | 2627 |
2628 gaim_request_file(conv, _("Save Icon"), buf, TRUE, | |
2629 G_CALLBACK(saveicon_writefile_cb), NULL, conv); | |
9497 | 2630 |
2631 g_free(buf); | |
2632 } | |
2633 | |
8189 | 2634 static gboolean |
2635 icon_menu(GtkObject *obj, GdkEventButton *e, GaimConversation *conv) | |
2636 { | |
2637 GaimGtkConversation *gtkconv; | |
2638 static GtkWidget *menu = NULL; | |
2639 GtkWidget *button; | |
2640 | |
2641 if (e->button != 3 || e->type != GDK_BUTTON_PRESS) | |
2642 return FALSE; | |
2643 | |
2644 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2645 | |
2646 /* | |
2647 * If a menu already exists, destroy it before creating a new one, | |
2648 * thus freeing-up the memory it occupied. | |
2649 */ | |
2650 if (menu != NULL) | |
2651 gtk_widget_destroy(menu); | |
2652 | |
2653 menu = gtk_menu_new(); | |
2654 | |
2655 if (gtkconv->u.im->anim && | |
2656 !(gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim))) | |
2657 { | |
2658 gaim_new_check_item(menu, _("Animate"), | |
2659 G_CALLBACK(toggle_icon_animate_cb), conv, | |
2660 gtkconv->u.im->icon_timer); | |
2661 } | |
2662 | |
2663 button = gtk_menu_item_new_with_label(_("Hide Icon")); | |
2664 g_signal_connect_swapped(G_OBJECT(button), "activate", | |
2665 G_CALLBACK(remove_icon), gtkconv); | |
2666 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
2667 gtk_widget_show(button); | |
2668 | |
2669 gaim_new_item_from_stock(menu, _("Save Icon As..."), GTK_STOCK_SAVE_AS, | |
9497 | 2670 G_CALLBACK(icon_menu_save_cb), conv, |
8189 | 2671 0, 0, NULL); |
2672 | |
2673 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, e->button, e->time); | |
2674 | |
2675 return TRUE; | |
2676 } | |
2677 /************************************************************************** | |
2678 * End of the bunch of buddy icon functions | |
2679 **************************************************************************/ | |
2680 | |
7887 | 2681 /* |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2682 * Makes sure all the menu items and all the buttons are hidden/shown and |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8730
diff
changeset
|
2683 * sensitive/insensitive. This is called after changing tabs and when an |
7887 | 2684 * account signs on or off. |
2685 */ | |
4359 | 2686 static void |
7887 | 2687 gray_stuff_out(GaimConversation *conv) |
4359 | 2688 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2689 GaimConvWindow *win; |
7887 | 2690 GaimGtkWindow *gtkwin; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2691 GaimGtkConversation *gtkconv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2692 GaimConnection *gc; |
7887 | 2693 GaimPluginProtocolInfo *prpl_info = NULL; |
7222 | 2694 GdkPixbuf *window_icon = NULL; |
8439 | 2695 GtkIMHtmlButtons buttons; |
9812 | 2696 GaimAccount *account; |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2697 |
7887 | 2698 win = gaim_conversation_get_window(conv); |
4359 | 2699 gtkwin = GAIM_GTK_WINDOW(win); |
2700 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7887 | 2701 gc = gaim_conversation_get_gc(conv); |
9909 | 2702 account = gaim_conversation_get_account(conv); |
8439 | 2703 |
7879 | 2704 if (gc != NULL) |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
2705 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2706 |
7887 | 2707 if (gtkwin->menu.send_as != NULL) |
2708 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); | |
2709 | |
2710 /* | |
2711 * Handle hiding and showing stuff based on what type of conv this is. | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2712 * Stuff that Gaim IMs support in general should be shown for IM |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8730
diff
changeset
|
2713 * conversations. Stuff that Gaim chats support in general should be |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2714 * shown for chat conversations. It doesn't matter whether the PRPL |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2715 * supports it or not--that only affects if the button or menu item |
7929 | 2716 * is sensitive or not. |
7887 | 2717 */ |
4359 | 2718 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
7887 | 2719 /* Show stuff that applies to IMs, hide stuff that applies to chats */ |
2720 | |
2721 /* Deal with buttons */ | |
2722 gtk_widget_show(gtkconv->info); | |
2723 gtk_widget_show(gtkconv->send); | |
2724 gtk_widget_show(gtkconv->u.im->block); | |
9468 | 2725 gtk_widget_show(gtkconv->u.im->send_file); |
7887 | 2726 |
2727 /* Deal with menu items */ | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2728 gtk_widget_show(gtkwin->menu.view_log); |
9468 | 2729 gtk_widget_show(gtkwin->menu.send_file); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2730 gtk_widget_show(gtkwin->menu.add_pounce); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2731 gtk_widget_show(gtkwin->menu.get_info); |
7887 | 2732 gtk_widget_show(gtkwin->menu.warn); |
7859 | 2733 gtk_widget_hide(gtkwin->menu.invite); |
7887 | 2734 gtk_widget_show(gtkwin->menu.alias); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2735 gtk_widget_show(gtkwin->menu.block); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2736 |
9812 | 2737 if (gaim_find_buddy(account, gaim_conversation_get_name(conv)) == NULL) { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2738 gtk_widget_show(gtkwin->menu.add); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2739 gtk_widget_hide(gtkwin->menu.remove); |
7929 | 2740 gtk_widget_show(gtkconv->add); |
2741 gtk_widget_hide(gtkconv->remove); | |
7859 | 2742 } else { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2743 gtk_widget_show(gtkwin->menu.remove); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2744 gtk_widget_hide(gtkwin->menu.add); |
7929 | 2745 gtk_widget_hide(gtkconv->add); |
2746 gtk_widget_show(gtkconv->remove); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2747 } |
7887 | 2748 |
2749 gtk_widget_show(gtkwin->menu.insert_link); | |
9287 | 2750 gtk_widget_show(gtkwin->menu.insert_image); |
7887 | 2751 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
9470 | 2752 /* Show stuff that applies to Chats, hide stuff that applies to IMs */ |
7887 | 2753 |
2754 /* Deal with buttons */ | |
7952 | 2755 gtk_widget_show(gtkconv->info); |
7887 | 2756 gtk_widget_show(gtkconv->send); |
2757 gtk_widget_show(gtkconv->u.chat->invite); | |
2758 | |
2759 /* Deal with menu items */ | |
9917 | 2760 gtk_widget_show(gtkwin->menu.view_log); |
9468 | 2761 gtk_widget_hide(gtkwin->menu.send_file); |
7859 | 2762 gtk_widget_hide(gtkwin->menu.add_pounce); |
2763 gtk_widget_hide(gtkwin->menu.get_info); | |
7887 | 2764 gtk_widget_hide(gtkwin->menu.warn); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2765 gtk_widget_show(gtkwin->menu.invite); |
7887 | 2766 gtk_widget_show(gtkwin->menu.alias); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2767 gtk_widget_hide(gtkwin->menu.block); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2768 |
9812 | 2769 if (gaim_blist_find_chat(account, gaim_conversation_get_name(conv)) == NULL) { |
2770 /* If the chat is NOT in the buddy list */ | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2771 gtk_widget_show(gtkwin->menu.add); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2772 gtk_widget_hide(gtkwin->menu.remove); |
7929 | 2773 gtk_widget_show(gtkconv->add); |
2774 gtk_widget_hide(gtkconv->remove); | |
7859 | 2775 } else { |
9812 | 2776 /* If the chat IS in the buddy list */ |
2777 gtk_widget_hide(gtkwin->menu.add); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2778 gtk_widget_show(gtkwin->menu.remove); |
7929 | 2779 gtk_widget_hide(gtkconv->add); |
2780 gtk_widget_show(gtkconv->remove); | |
7887 | 2781 } |
2782 | |
2783 gtk_widget_show(gtkwin->menu.insert_link); | |
2784 gtk_widget_hide(gtkwin->menu.insert_image); | |
2785 } | |
2786 | |
2787 /* | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2788 * Handle graying stuff out based on whether an account is connected |
7887 | 2789 * and what features that account supports. |
2790 */ | |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
2791 if ((gc != NULL) && |
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
2792 ( (gaim_conversation_get_type(conv) != GAIM_CONV_CHAT) || |
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
2793 !gaim_conv_chat_has_left(GAIM_CONV_CHAT(conv)) )) { |
7887 | 2794 /* Account is online */ |
2795 | |
2796 /* Deal with buttons */ | |
2797 gtk_widget_set_sensitive(gtkconv->info, (prpl_info->get_info != NULL)); | |
7929 | 2798 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2799 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2800 { |
9812 | 2801 gtk_widget_set_sensitive(gtkconv->add, (prpl_info->add_buddy != NULL)); |
2802 gtk_widget_set_sensitive(gtkconv->remove, (prpl_info->remove_buddy != NULL)); | |
2803 gtk_widget_set_sensitive(gtkconv->send, (prpl_info->send_im != NULL)); | |
2804 gtk_widget_set_sensitive(gtkconv->u.im->block, (prpl_info->add_deny != NULL)); | |
9468 | 2805 gtk_widget_set_sensitive(gtkconv->u.im->send_file, |
9812 | 2806 (prpl_info->send_file && (!prpl_info->can_receive_file || |
2807 prpl_info->can_receive_file(gc, gaim_conversation_get_name(conv))))); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2808 } |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2809 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2810 { |
9812 | 2811 /* Only allow adding/removing if this is a chat and not a conference */ |
2812 gtk_widget_set_sensitive(gtkconv->add, (prpl_info->join_chat != NULL)); | |
2813 gtk_widget_set_sensitive(gtkconv->remove, (prpl_info->join_chat != NULL)); | |
2814 gtk_widget_set_sensitive(gtkconv->send, (prpl_info->chat_send != NULL)); | |
2815 gtk_widget_set_sensitive(gtkconv->u.chat->invite, (prpl_info->chat_invite != NULL)); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2816 } |
7887 | 2817 |
2818 /* Deal with the toolbar */ | |
8420 | 2819 if (gc->flags & GAIM_CONNECTION_HTML) { |
8677 | 2820 buttons = GTK_IMHTML_ALL; /* Everything on */ |
8420 | 2821 if (!(prpl_info->options & OPT_PROTO_IM_IMAGE)) |
8422 | 2822 buttons &= ~GTK_IMHTML_IMAGE; |
8420 | 2823 if (gc->flags & GAIM_CONNECTION_NO_BGCOLOR) |
8422 | 2824 buttons &= ~GTK_IMHTML_BACKCOLOR; |
8691
0eb5161ef333
[gaim-migrate @ 9444]
Christian Hammond <chipx86@chipx86.com>
parents:
8690
diff
changeset
|
2825 if (gc->flags & GAIM_CONNECTION_NO_FONTSIZE) { |
0eb5161ef333
[gaim-migrate @ 9444]
Christian Hammond <chipx86@chipx86.com>
parents:
8690
diff
changeset
|
2826 buttons &= ~GTK_IMHTML_GROW; |
0eb5161ef333
[gaim-migrate @ 9444]
Christian Hammond <chipx86@chipx86.com>
parents:
8690
diff
changeset
|
2827 buttons &= ~GTK_IMHTML_SHRINK; |
0eb5161ef333
[gaim-migrate @ 9444]
Christian Hammond <chipx86@chipx86.com>
parents:
8690
diff
changeset
|
2828 } |
9041 | 2829 if (gc->flags & GAIM_CONNECTION_NO_URLDESC) |
2830 buttons &= ~GTK_IMHTML_LINKDESC; | |
8420 | 2831 } else { |
8422 | 2832 buttons = GTK_IMHTML_SMILEY; |
8420 | 2833 } |
2834 gtk_imhtml_set_format_functions(GTK_IMHTML(gtkconv->entry), buttons); | |
9812 | 2835 gtk_imhtmltoolbar_associate_smileys(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), gaim_account_get_protocol_id(account)); |
8422 | 2836 |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
2837 /* Deal with menu items */ |
7887 | 2838 gtk_widget_set_sensitive(gtkwin->menu.view_log, TRUE); |
2839 gtk_widget_set_sensitive(gtkwin->menu.add_pounce, TRUE); | |
2840 gtk_widget_set_sensitive(gtkwin->menu.get_info, (prpl_info->get_info != NULL)); | |
2841 gtk_widget_set_sensitive(gtkwin->menu.warn, (prpl_info->warn != NULL)); | |
9812 | 2842 gtk_widget_set_sensitive(gtkwin->menu.invite, (prpl_info->chat_invite != NULL)); |
2843 gtk_widget_set_sensitive(gtkwin->menu.block, (prpl_info->add_deny != NULL)); | |
2844 gtk_widget_set_sensitive(gtkwin->menu.insert_link, (gc->flags & GAIM_CONNECTION_HTML)); | |
2845 gtk_widget_set_sensitive(gtkwin->menu.insert_image, (prpl_info->options & OPT_PROTO_IM_IMAGE)); | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
2846 |
7887 | 2847 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
9812 | 2848 gtk_widget_set_sensitive(gtkwin->menu.add, (prpl_info->add_buddy != NULL)); |
2849 gtk_widget_set_sensitive(gtkwin->menu.remove, (prpl_info->remove_buddy != NULL)); | |
9468 | 2850 gtk_widget_set_sensitive(gtkwin->menu.send_file, |
9812 | 2851 (prpl_info->send_file != NULL && (!prpl_info->can_receive_file || |
2852 prpl_info->can_receive_file(gc, gaim_conversation_get_name(conv))))); | |
2853 gtk_widget_set_sensitive(gtkwin->menu.alias, | |
2854 (gaim_find_buddy(account, gaim_conversation_get_name(conv)) != NULL)); | |
7887 | 2855 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
9812 | 2856 gtk_widget_set_sensitive(gtkwin->menu.add, (prpl_info->join_chat != NULL)); |
2857 gtk_widget_set_sensitive(gtkwin->menu.remove, (prpl_info->join_chat != NULL)); | |
2858 gtk_widget_set_sensitive(gtkwin->menu.alias, | |
2859 (gaim_blist_find_chat(account, gaim_conversation_get_name(conv)) != NULL)); | |
7887 | 2860 } |
2861 } else { | |
2862 /* Account is offline */ | |
9812 | 2863 /* Or it's a chat that we've left. */ |
7887 | 2864 |
2865 /* Deal with buttons */ | |
7929 | 2866 gtk_widget_set_sensitive(gtkconv->add, FALSE); |
2867 gtk_widget_set_sensitive(gtkconv->remove, FALSE); | |
7887 | 2868 gtk_widget_set_sensitive(gtkconv->info, FALSE); |
2869 gtk_widget_set_sensitive(gtkconv->send, FALSE); | |
2870 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
2871 gtk_widget_set_sensitive(gtkconv->u.im->block, FALSE); | |
9468 | 2872 gtk_widget_set_sensitive(gtkconv->u.im->send_file, FALSE); |
7887 | 2873 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
2874 gtk_widget_set_sensitive(gtkconv->u.chat->invite, FALSE); | |
2875 } | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2876 |
7887 | 2877 /* Then deal with menu items */ |
2878 gtk_widget_set_sensitive(gtkwin->menu.view_log, TRUE); | |
9468 | 2879 gtk_widget_set_sensitive(gtkwin->menu.send_file, FALSE); |
7887 | 2880 gtk_widget_set_sensitive(gtkwin->menu.add_pounce, TRUE); |
2881 gtk_widget_set_sensitive(gtkwin->menu.get_info, FALSE); | |
2882 gtk_widget_set_sensitive(gtkwin->menu.warn, FALSE); | |
2883 gtk_widget_set_sensitive(gtkwin->menu.invite, FALSE); | |
2884 gtk_widget_set_sensitive(gtkwin->menu.alias, FALSE); | |
2885 gtk_widget_set_sensitive(gtkwin->menu.block, FALSE); | |
2886 gtk_widget_set_sensitive(gtkwin->menu.add, FALSE); | |
2887 gtk_widget_set_sensitive(gtkwin->menu.remove, FALSE); | |
7929 | 2888 gtk_widget_set_sensitive(gtkwin->menu.insert_link, TRUE); |
7887 | 2889 gtk_widget_set_sensitive(gtkwin->menu.insert_image, FALSE); |
2890 } | |
2891 | |
2892 /* | |
2893 * Update the window's icon | |
2894 */ | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2895 if ((gaim_conversation_get_type(conv) == GAIM_CONV_IM) && |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2896 (gtkconv->u.im->anim)) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2897 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2898 window_icon = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2899 gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); |
7887 | 2900 g_object_ref(window_icon); |
2901 } else { | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2902 window_icon = get_tab_icon(conv, FALSE); |
4359 | 2903 } |
7887 | 2904 gtk_window_set_icon(GTK_WINDOW(gtkwin->window), window_icon); |
2905 g_object_unref(G_OBJECT(window_icon)); | |
2906 } | |
2907 | |
2908 static void | |
8189 | 2909 before_switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, |
2910 gpointer user_data) | |
2911 { | |
2912 GaimConvWindow *win; | |
2913 GaimConversation *conv; | |
2914 GaimGtkConversation *gtkconv; | |
2915 | |
2916 win = (GaimConvWindow *)user_data; | |
2917 conv = gaim_conv_window_get_active_conversation(win); | |
2918 | |
2919 g_return_if_fail(conv != NULL); | |
2920 | |
8192 | 2921 if (gaim_conversation_get_type(conv) != GAIM_CONV_IM) |
2922 return; | |
2923 | |
8189 | 2924 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2925 | |
2926 stop_anim(NULL, conv); | |
2927 } | |
2928 | |
2929 static void | |
7887 | 2930 switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, |
2931 gpointer user_data) | |
2932 { | |
2933 GaimConvWindow *win; | |
2934 GaimConversation *conv; | |
2935 GaimGtkConversation *gtkconv; | |
2936 GaimGtkWindow *gtkwin; | |
2937 | |
2938 win = (GaimConvWindow *)user_data; | |
2939 conv = gaim_conv_window_get_conversation_at(win, page_num); | |
2940 | |
2941 g_return_if_fail(conv != NULL); | |
2942 | |
2943 gtkwin = GAIM_GTK_WINDOW(win); | |
2944 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2945 | |
2946 gaim_conversation_set_unseen(conv, GAIM_UNSEEN_NONE); | |
2947 | |
2948 /* Update the menubar */ | |
2949 gray_stuff_out(conv); | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2950 |
4736 | 2951 update_typing_icon(conv); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2952 |
4359 | 2953 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.logging), |
7143 | 2954 gaim_conversation_is_logging(conv)); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2955 |
4359 | 2956 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.sounds), |
7143 | 2957 gtkconv->make_sound); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2958 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2959 gtk_check_menu_item_set_active( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2960 GTK_CHECK_MENU_ITEM(gtkwin->menu.show_formatting_toolbar), |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2961 gtkconv->show_formatting_toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2962 |
9188 | 2963 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.show_timestamps), |
2964 gtkconv->show_timestamps); | |
2965 | |
8189 | 2966 /* |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2967 * We pause icons when they are not visible. If this icon should |
9297 | 2968 * be animated then start it back up again. |
8189 | 2969 */ |
8192 | 2970 if ((gaim_conversation_get_type(conv) == GAIM_CONV_IM) && |
2971 (gtkconv->u.im->animate)) | |
8189 | 2972 start_anim(NULL, conv); |
2973 | |
4965 | 2974 gtk_window_set_title(GTK_WINDOW(gtkwin->window), |
7143 | 2975 gtk_label_get_text(GTK_LABEL(gtkconv->tab_label))); |
4359 | 2976 } |
2977 | |
2978 /************************************************************************** | |
2979 * Utility functions | |
2980 **************************************************************************/ | |
2981 | |
2982 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2983 got_typing_keypress(GaimConversation *conv, gboolean first) |
4359 | 2984 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2985 GaimConvIm *im; |
4685 | 2986 |
4359 | 2987 /* |
2988 * We know we got something, so we at least have to make sure we don't | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
2989 * send GAIM_TYPED any time soon. |
4359 | 2990 */ |
2991 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2992 im = GAIM_CONV_IM(conv); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2993 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2994 if (gaim_conv_im_get_type_again_timeout(im)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2995 gaim_conv_im_stop_type_again_timeout(im); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2996 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2997 gaim_conv_im_start_type_again_timeout(im); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2998 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2999 if (first || (gaim_conv_im_get_type_again(im) != 0 && |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3000 time(NULL) > gaim_conv_im_get_type_again(im))) { |
4359 | 3001 |
3002 int timeout = serv_send_typing(gaim_conversation_get_gc(conv), | |
3003 (char *)gaim_conversation_get_name(conv), | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
3004 GAIM_TYPING); |
4359 | 3005 |
3006 if (timeout) | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3007 gaim_conv_im_set_type_again(im, time(NULL) + timeout); |
4359 | 3008 else |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3009 gaim_conv_im_set_type_again(im, 0); |
4359 | 3010 } |
3011 } | |
3012 | |
4736 | 3013 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3014 update_typing_icon(GaimConversation *conv) |
4736 | 3015 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3016 GaimGtkWindow *gtkwin; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3017 GaimConvIm *im = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3018 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); |
4736 | 3019 |
3020 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); | |
3021 | |
3022 if(gaim_conversation_get_type(conv) == GAIM_CONV_IM) | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3023 im = GAIM_CONV_IM(conv); |
4736 | 3024 |
3025 if(gtkwin->menu.typing_icon) { | |
3026 gtk_widget_destroy(gtkwin->menu.typing_icon); | |
3027 gtkwin->menu.typing_icon = NULL; | |
3028 } | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3029 if(im && gaim_conv_im_get_typing_state(im) == GAIM_TYPING) { |
4736 | 3030 gtkwin->menu.typing_icon = gtk_image_menu_item_new(); |
3031 gtk_image_menu_item_set_image( | |
3032 GTK_IMAGE_MENU_ITEM(gtkwin->menu.typing_icon), | |
3033 gtk_image_new_from_stock(GAIM_STOCK_TYPING, | |
3034 GTK_ICON_SIZE_MENU)); | |
4757 | 3035 gtk_tooltips_set_tip(gtkconv->tooltips, gtkwin->menu.typing_icon, |
4736 | 3036 _("User is typing..."), NULL); |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3037 } else if(im && gaim_conv_im_get_typing_state(im) == GAIM_TYPED) { |
4736 | 3038 gtkwin->menu.typing_icon = gtk_image_menu_item_new(); |
3039 gtk_image_menu_item_set_image( | |
3040 GTK_IMAGE_MENU_ITEM(gtkwin->menu.typing_icon), | |
3041 gtk_image_new_from_stock(GAIM_STOCK_TYPED, | |
3042 GTK_ICON_SIZE_MENU)); | |
4757 | 3043 gtk_tooltips_set_tip(gtkconv->tooltips, gtkwin->menu.typing_icon, |
4736 | 3044 _("User has typed something and paused"), NULL); |
3045 } | |
3046 | |
3047 if(gtkwin->menu.typing_icon) { | |
3048 gtk_menu_item_set_right_justified( | |
3049 GTK_MENU_ITEM(gtkwin->menu.typing_icon), TRUE); | |
3050 gtk_widget_show_all(gtkwin->menu.typing_icon); | |
3051 gtk_menu_shell_append(GTK_MENU_SHELL(gtkwin->menu.menubar), | |
3052 gtkwin->menu.typing_icon); | |
3053 } | |
3054 } | |
3055 | |
4685 | 3056 static gboolean |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3057 update_send_as_selection(GaimConvWindow *win) |
4359 | 3058 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3059 GaimAccount *account; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3060 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3061 GaimGtkWindow *gtkwin; |
4359 | 3062 GtkWidget *menu; |
3063 GList *child; | |
3064 | |
7090
04f9f7440bc3
[gaim-migrate @ 7655]
Christian Hammond <chipx86@chipx86.com>
parents:
7089
diff
changeset
|
3065 if (g_list_find(gaim_get_windows(), win) == NULL) |
04f9f7440bc3
[gaim-migrate @ 7655]
Christian Hammond <chipx86@chipx86.com>
parents:
7089
diff
changeset
|
3066 return FALSE; |
4849 | 3067 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3068 conv = gaim_conv_window_get_active_conversation(win); |
4359 | 3069 |
5860
52d5fad43950
[gaim-migrate @ 6291]
Christian Hammond <chipx86@chipx86.com>
parents:
5858
diff
changeset
|
3070 if (conv == NULL) |
52d5fad43950
[gaim-migrate @ 6291]
Christian Hammond <chipx86@chipx86.com>
parents:
5858
diff
changeset
|
3071 return FALSE; |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
3072 |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
3073 account = gaim_conversation_get_account(conv); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
3074 gtkwin = GAIM_GTK_WINDOW(win); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
3075 |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
3076 if (gtkwin->menu.send_as == NULL) |
4685 | 3077 return FALSE; |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
3078 |
4359 | 3079 gtk_widget_show(gtkwin->menu.send_as); |
3080 | |
3081 menu = gtk_menu_item_get_submenu( | |
3082 GTK_MENU_ITEM(gtkwin->menu.send_as)); | |
3083 | |
3084 for (child = gtk_container_get_children(GTK_CONTAINER(menu)); | |
3085 child != NULL; | |
3086 child = child->next) { | |
3087 | |
3088 GtkWidget *item = child->data; | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3089 GaimAccount *item_account = g_object_get_data(G_OBJECT(item), |
4673 | 3090 "gaim_account"); |
3091 | |
3092 if (account == item_account) { | |
4359 | 3093 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE); |
3094 break; | |
3095 } | |
3096 } | |
6030
54c37db13279
[gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents:
6016
diff
changeset
|
3097 |
4685 | 3098 return FALSE; |
4359 | 3099 } |
3100 | |
3101 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3102 generate_send_as_items(GaimConvWindow *win, GaimConversation *deleted_conv) |
4359 | 3103 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3104 GaimGtkWindow *gtkwin; |
4359 | 3105 GtkWidget *menu; |
3106 GtkWidget *menuitem; | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3107 GList *gcs; |
4359 | 3108 GList *convs; |
3109 GSList *group = NULL; | |
3110 gboolean first_offline = TRUE; | |
3111 gboolean found_online = FALSE; | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3112 GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
4359 | 3113 |
3114 gtkwin = GAIM_GTK_WINDOW(win); | |
3115 | |
3116 if (gtkwin->menu.send_as != NULL) | |
3117 gtk_widget_destroy(gtkwin->menu.send_as); | |
3118 | |
3119 /* See if we have > 1 connection active. */ | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3120 if (g_list_length(gaim_connections_get_all()) < 2) { |
4359 | 3121 /* Now make sure we don't have any Offline entries. */ |
3122 gboolean found_offline = FALSE; | |
3123 | |
3124 for (convs = gaim_get_conversations(); | |
3125 convs != NULL; | |
3126 convs = convs->next) { | |
3127 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3128 GaimConversation *conv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3129 GaimAccount *account; |
4491 | 3130 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3131 conv = (GaimConversation *)convs->data; |
4491 | 3132 account = gaim_conversation_get_account(conv); |
3133 | |
6495
8ce66049ce68
[gaim-migrate @ 7010]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
3134 if (account != NULL && account->gc == NULL) { |
4359 | 3135 found_offline = TRUE; |
3136 break; | |
3137 } | |
3138 } | |
3139 | |
3140 if (!found_offline) { | |
3141 gtkwin->menu.send_as = NULL; | |
3142 return; | |
3143 } | |
3144 } | |
3145 | |
3146 /* Build the Send As menu */ | |
3147 gtkwin->menu.send_as = gtk_menu_item_new_with_mnemonic(_("_Send As")); | |
3148 gtk_widget_show(gtkwin->menu.send_as); | |
3149 | |
3150 menu = gtk_menu_new(); | |
7857
43f63ff8a6d8
[gaim-migrate @ 8511]
Christian Hammond <chipx86@chipx86.com>
parents:
7855
diff
changeset
|
3151 gtk_menu_shell_insert(GTK_MENU_SHELL(gtkwin->menu.menubar), |
43f63ff8a6d8
[gaim-migrate @ 8511]
Christian Hammond <chipx86@chipx86.com>
parents:
7855
diff
changeset
|
3152 gtkwin->menu.send_as, 2); |
4359 | 3153 gtk_menu_item_set_submenu(GTK_MENU_ITEM(gtkwin->menu.send_as), menu); |
3154 | |
3155 gtk_widget_show(menu); | |
3156 | |
3157 /* Fill it with entries. */ | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3158 for (gcs = gaim_connections_get_all(); gcs != NULL; gcs = gcs->next) { |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3159 |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3160 GaimConnection *gc; |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3161 GaimAccount *account; |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3162 GtkWidget *box; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3163 GtkWidget *label; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3164 GtkWidget *image; |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3165 GdkPixbuf *pixbuf, *scale; |
4359 | 3166 |
3167 found_online = TRUE; | |
3168 | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3169 gc = (GaimConnection *)gcs->data; |
4359 | 3170 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3171 /* Create a pixmap for the protocol icon. */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3172 pixbuf = create_prpl_icon(gc->account); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3173 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, GDK_INTERP_BILINEAR); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3174 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3175 /* Now convert it to GtkImage */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3176 if (pixbuf == NULL) |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3177 image = gtk_image_new(); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3178 else |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3179 image = gtk_image_new_from_pixbuf(scale); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3180 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3181 gtk_size_group_add_widget(sg, image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3182 |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3183 g_object_unref(G_OBJECT(scale)); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3184 g_object_unref(G_OBJECT(pixbuf)); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3185 |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3186 account = gaim_connection_get_account(gc); |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3187 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3188 /* Make our menu item */ |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3189 menuitem = gtk_radio_menu_item_new_with_label(group, |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3190 gaim_account_get_username(account)); |
4793 | 3191 group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem)); |
4359 | 3192 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3193 /* Do some evil, see some evil, speak some evil. */ |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3194 box = gtk_hbox_new(FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3195 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3196 label = gtk_bin_get_child(GTK_BIN(menuitem)); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3197 g_object_ref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3198 gtk_container_remove(GTK_CONTAINER(menuitem), label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3199 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3200 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3201 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 4); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3202 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3203 g_object_unref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3204 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3205 gtk_container_add(GTK_CONTAINER(menuitem), box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3206 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3207 gtk_widget_show(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3208 gtk_widget_show(image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3209 gtk_widget_show(box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3210 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3211 /* Set our data and callbacks. */ |
4359 | 3212 g_object_set_data(G_OBJECT(menuitem), "user_data", win); |
4673 | 3213 g_object_set_data(G_OBJECT(menuitem), "gaim_account", gc->account); |
4359 | 3214 |
4786 | 3215 g_signal_connect(G_OBJECT(menuitem), "activate", |
4673 | 3216 G_CALLBACK(menu_conv_sel_send_cb), NULL); |
4359 | 3217 |
3218 gtk_widget_show(menuitem); | |
3219 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
3220 } | |
3221 | |
3222 /* | |
3223 * Fill it with any accounts that still has an open (yet disabled) window | |
3224 * (signed off accounts with a window open). | |
3225 */ | |
3226 for (convs = gaim_get_conversations(); | |
3227 convs != NULL; | |
3228 convs = convs->next) { | |
3229 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3230 GaimConversation *conv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3231 GaimAccount *account; |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3232 GtkWidget *box; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3233 GtkWidget *label; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3234 GtkWidget *image; |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3235 GdkPixbuf *pixbuf, *scale; |
4359 | 3236 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3237 conv = (GaimConversation *)convs->data; |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3238 |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3239 if (conv == deleted_conv) |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3240 continue; |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3241 |
4491 | 3242 account = gaim_conversation_get_account(conv); |
3243 | |
6495
8ce66049ce68
[gaim-migrate @ 7010]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
3244 if (account != NULL && account->gc == NULL) { |
4359 | 3245 if (first_offline && found_online) { |
3246 menuitem = gtk_separator_menu_item_new(); | |
3247 gtk_widget_show(menuitem); | |
3248 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
3249 | |
3250 first_offline = FALSE; | |
3251 } | |
3252 | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3253 /* Create a pixmap for the protocol icon. */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3254 pixbuf = create_prpl_icon(account); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3255 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3256 GDK_INTERP_BILINEAR); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3257 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3258 /* Now convert it to GtkImage */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3259 if (pixbuf == NULL) |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3260 image = gtk_image_new(); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3261 else |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3262 image = gtk_image_new_from_pixbuf(scale); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3263 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3264 gtk_size_group_add_widget(sg, image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3265 |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3266 if (scale != NULL) g_object_unref(scale); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3267 if (pixbuf != NULL) g_object_unref(pixbuf); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3268 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3269 /* Make our menu item */ |
4359 | 3270 menuitem = gtk_radio_menu_item_new_with_label(group, |
4491 | 3271 account->username); |
4793 | 3272 group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem)); |
4359 | 3273 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3274 /* Do some evil, see some evil, speak some evil. */ |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3275 box = gtk_hbox_new(FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3276 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3277 label = gtk_bin_get_child(GTK_BIN(menuitem)); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3278 g_object_ref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3279 gtk_container_remove(GTK_CONTAINER(menuitem), label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3280 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3281 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3282 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 4); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3283 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3284 g_object_unref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3285 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3286 gtk_container_add(GTK_CONTAINER(menuitem), box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3287 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3288 gtk_widget_show(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3289 gtk_widget_show(image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3290 gtk_widget_show(box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3291 |
4359 | 3292 gtk_widget_set_sensitive(menuitem, FALSE); |
4786 | 3293 g_object_set_data(G_OBJECT(menuitem), "user_data", win); |
4674 | 3294 g_object_set_data(G_OBJECT(menuitem), "gaim_account", account); |
4359 | 3295 |
4786 | 3296 g_signal_connect(G_OBJECT(menuitem), "activate", |
5902
6889b89cab90
[gaim-migrate @ 6334]
Christian Hammond <chipx86@chipx86.com>
parents:
5901
diff
changeset
|
3297 G_CALLBACK(menu_conv_sel_send_cb), NULL); |
4786 | 3298 |
4359 | 3299 gtk_widget_show(menuitem); |
3300 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
3301 } | |
3302 } | |
3303 | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3304 g_object_unref(sg); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3305 |
4359 | 3306 gtk_widget_show(gtkwin->menu.send_as); |
3307 update_send_as_selection(win); | |
3308 } | |
3309 | |
3310 static GList * | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3311 generate_invite_user_names(GaimConnection *gc) |
4359 | 3312 { |
6695 | 3313 GaimBlistNode *gnode,*cnode,*bnode; |
4359 | 3314 static GList *tmp = NULL; |
3315 | |
3316 if (tmp) | |
3317 g_list_free(tmp); | |
3318 | |
3319 tmp = g_list_append(NULL, ""); | |
3320 | |
3321 if (gc != NULL) { | |
4785 | 3322 for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { |
3323 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) | |
3324 continue; | |
6695 | 3325 for(cnode = gnode->child; cnode; cnode = cnode->next) { |
3326 if(!GAIM_BLIST_NODE_IS_CONTACT(cnode)) | |
4785 | 3327 continue; |
6695 | 3328 for(bnode = cnode->child; bnode; bnode = bnode->next) { |
3329 GaimBuddy *buddy; | |
3330 | |
3331 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) | |
3332 continue; | |
3333 | |
3334 buddy = (GaimBuddy *)bnode; | |
3335 | |
3336 if (buddy->account == gc->account && | |
3337 GAIM_BUDDY_IS_ONLINE(buddy)) | |
3338 tmp = g_list_append(tmp, buddy->name); | |
3339 } | |
4359 | 3340 } |
3341 } | |
3342 } | |
3343 | |
3344 return tmp; | |
3345 } | |
3346 | |
9498 | 3347 static GdkPixbuf * |
9554 | 3348 get_chat_buddy_status_icon(GaimConvChat *chat, const char *name, GaimConvChatBuddyFlags flags) |
9498 | 3349 { |
9554 | 3350 GdkPixbuf *pixbuf, *scale, *scale2; |
9498 | 3351 char *filename; |
9554 | 3352 char *image = NULL; |
3353 | |
3354 if (flags & GAIM_CBFLAGS_FOUNDER) { | |
9588 | 3355 image = g_strdup("founder.png"); |
9554 | 3356 } else if (flags & GAIM_CBFLAGS_OP) { |
9588 | 3357 image = g_strdup("op.png"); |
9554 | 3358 } else if (flags & GAIM_CBFLAGS_HALFOP) { |
9588 | 3359 image = g_strdup("halfop.png"); |
9554 | 3360 } else if (flags & GAIM_CBFLAGS_VOICE) { |
9588 | 3361 image = g_strdup("voice.png"); |
9554 | 3362 } else if ((!flags) && gaim_conv_chat_is_user_ignored(chat, name)) { |
9588 | 3363 image = g_strdup("ignored.png"); |
9554 | 3364 } |
3365 if (image) { | |
3366 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL); | |
3367 g_free(image); | |
9498 | 3368 pixbuf = gdk_pixbuf_new_from_file(filename, NULL); |
3369 g_free(filename); | |
3370 if (!pixbuf) | |
3371 return NULL; | |
3372 scale = gdk_pixbuf_scale_simple(pixbuf, 15, 15, GDK_INTERP_BILINEAR); | |
3373 g_object_unref(pixbuf); | |
9554 | 3374 if (flags && gaim_conv_chat_is_user_ignored(chat, name)) { |
9588 | 3375 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", "ignored.png", NULL); |
9554 | 3376 pixbuf = gdk_pixbuf_new_from_file(filename, NULL); |
3377 g_free(filename); | |
3378 scale2 = gdk_pixbuf_scale_simple(pixbuf, 15, 15, GDK_INTERP_BILINEAR); | |
3379 g_object_unref(pixbuf); | |
3380 gdk_pixbuf_composite(scale2, scale, 0, 0, 15, 15, 0, 0, 1, 1, GDK_INTERP_BILINEAR, 192); | |
3381 g_object_unref(scale2); | |
3382 } | |
9498 | 3383 return scale; |
3384 } | |
3385 | |
3386 return NULL; | |
3387 } | |
3388 | |
4359 | 3389 static void |
9554 | 3390 add_chat_buddy_common(GaimConversation *conv, const char *name) |
4359 | 3391 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3392 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3393 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3394 GaimConvChat *chat; |
9554 | 3395 GaimConvChatBuddyFlags flags; |
4359 | 3396 GtkTreeIter iter; |
3397 GtkListStore *ls; | |
9498 | 3398 GdkPixbuf *pixbuf; |
4359 | 3399 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3400 chat = GAIM_CONV_CHAT(conv); |
4359 | 3401 gtkconv = GAIM_GTK_CONVERSATION(conv); |
3402 gtkchat = gtkconv->u.chat; | |
3403 | |
3404 ls = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list))); | |
3405 | |
9554 | 3406 flags = gaim_conv_chat_user_get_flags(chat, name); |
3407 pixbuf = get_chat_buddy_status_icon(chat, name, flags); | |
9498 | 3408 |
4359 | 3409 gtk_list_store_append(ls, &iter); |
9498 | 3410 gtk_list_store_set(ls, &iter, CHAT_USERS_ICON_COLUMN, pixbuf, |
9554 | 3411 CHAT_USERS_NAME_COLUMN, name, CHAT_USERS_FLAGS_COLUMN, flags, -1); |
9498 | 3412 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), CHAT_USERS_NAME_COLUMN, |
4359 | 3413 GTK_SORT_ASCENDING); |
9554 | 3414 if (pixbuf) |
3415 g_object_unref(pixbuf); | |
4359 | 3416 } |
3417 | |
9605 | 3418 static gboolean |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3419 tab_complete(GaimConversation *conv) |
4359 | 3420 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3421 GaimGtkConversation *gtkconv; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3422 GaimConvChat *chat; |
4359 | 3423 GtkTextIter cursor, word_start, start_buffer; |
3424 int start; | |
3425 int most_matched = -1; | |
3426 char *entered, *partial = NULL; | |
3427 char *text; | |
8021 | 3428 char *nick_partial; |
9605 | 3429 const char *prefix; |
4359 | 3430 GList *matches = NULL; |
9605 | 3431 GList *list = NULL; |
3432 GList *l = NULL; | |
3433 gboolean command = FALSE; | |
4359 | 3434 |
3435 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3436 | |
3437 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_buffer); | |
3438 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, | |
3439 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
3440 | |
3441 word_start = cursor; | |
3442 | |
3443 /* if there's nothing there just return */ | |
3444 if (!gtk_text_iter_compare(&cursor, &start_buffer)) | |
9605 | 3445 return (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) ? TRUE : FALSE; |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
3446 |
4359 | 3447 text = gtk_text_buffer_get_text(gtkconv->entry_buffer, &start_buffer, |
3448 &cursor, FALSE); | |
3449 | |
3450 /* if we're at the end of ": " we need to move back 2 spaces */ | |
3451 start = strlen(text) - 1; | |
3452 | |
8021 | 3453 if (strlen(text) >= 2 && !strncmp(&text[start-1], ": ", 2)) { |
4359 | 3454 gtk_text_iter_backward_chars(&word_start, 2); |
8021 | 3455 start-=2; |
3456 } | |
4359 | 3457 |
3458 /* find the start of the word that we're tabbing */ | |
3459 while (start >= 0 && text[start] != ' ') { | |
3460 gtk_text_iter_backward_char(&word_start); | |
3461 start--; | |
3462 } | |
3463 | |
9605 | 3464 prefix = gaim_gtk_get_cmd_prefix(); |
3465 if (start == -1 && (strlen(text) >= strlen(prefix)) && !strncmp(text, prefix, strlen(prefix))) { | |
3466 command = TRUE; | |
3467 gtk_text_iter_forward_chars(&word_start, strlen(prefix)); | |
3468 } | |
3469 | |
4359 | 3470 g_free(text); |
3471 | |
3472 entered = gtk_text_buffer_get_text(gtkconv->entry_buffer, &word_start, | |
3473 &cursor, FALSE); | |
3474 | |
8021 | 3475 if (!g_utf8_strlen(entered, -1)) { |
4359 | 3476 g_free(entered); |
9605 | 3477 return (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) ? TRUE : FALSE; |
4359 | 3478 } |
3479 | |
8021 | 3480 nick_partial = g_malloc(strlen(entered)+1); |
3481 | |
9605 | 3482 if (command) { |
3483 list = gaim_cmd_list(conv); | |
3484 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
3485 chat = GAIM_CONV_CHAT(conv); | |
3486 list = gaim_conv_chat_get_users(chat); | |
3487 } else { | |
3488 g_free(nick_partial); | |
3489 g_free(entered); | |
3490 return FALSE; | |
3491 } | |
3492 | |
3493 for (l = list; l; l = l->next) { | |
3494 char *name; | |
3495 | |
3496 if (command) | |
3497 name = l->data; | |
3498 else { | |
3499 GaimConvChatBuddy *cb = l->data; | |
3500 name = cb->name; | |
3501 } | |
3502 | |
3503 strncpy(nick_partial, name, strlen(entered)); | |
8172 | 3504 nick_partial[strlen(entered)] = '\0'; |
8021 | 3505 if(gaim_utf8_strcasecmp(nick_partial, entered)) |
3506 continue; | |
4359 | 3507 |
3508 /* if we're here, it's a possible completion */ | |
3509 | |
3510 if (most_matched == -1) { | |
3511 /* | |
3512 * this will only get called once, since from now | |
3513 * on most_matched is >= 0 | |
3514 */ | |
9605 | 3515 most_matched = strlen(name); |
3516 partial = g_strdup(name); | |
4359 | 3517 } |
3518 else if (most_matched) { | |
9605 | 3519 char *tmp = g_strdup(name); |
8021 | 3520 |
3521 while (gaim_utf8_strcasecmp(tmp, partial)) { | |
3522 partial[most_matched] = '\0'; | |
3523 if(most_matched < strlen(tmp)) | |
3524 tmp[most_matched] = '\0'; | |
4359 | 3525 most_matched--; |
8021 | 3526 } |
8079 | 3527 most_matched++; |
8021 | 3528 |
3529 g_free(tmp); | |
4359 | 3530 } |
3531 | |
9605 | 3532 matches = g_list_append(matches, name); |
4359 | 3533 } |
3534 | |
8021 | 3535 g_free(nick_partial); |
3536 | |
4359 | 3537 /* we're only here if we're doing new style */ |
3538 | |
3539 /* if there weren't any matches, return */ | |
3540 if (!matches) { | |
3541 /* if matches isn't set partials won't be either */ | |
3542 g_free(entered); | |
9605 | 3543 if (command) |
3544 g_list_free(list); | |
3545 return (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) ? TRUE : FALSE; | |
4359 | 3546 } |
3547 | |
3548 gtk_text_buffer_delete(gtkconv->entry_buffer, &word_start, &cursor); | |
3549 | |
3550 if (!matches->next) { | |
3551 /* there was only one match. fill it in. */ | |
3552 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_buffer); | |
3553 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, | |
3554 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
3555 | |
3556 if (!gtk_text_iter_compare(&cursor, &start_buffer)) { | |
3557 char *tmp = g_strdup_printf("%s: ", (char *)matches->data); | |
3558 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, tmp, -1); | |
3559 g_free(tmp); | |
3560 } | |
3561 else | |
3562 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, | |
3563 matches->data, -1); | |
3564 | |
3565 matches = g_list_remove(matches, matches->data); | |
3566 } | |
3567 else { | |
3568 /* | |
3569 * there were lots of matches, fill in as much as possible | |
3570 * and display all of them | |
3571 */ | |
3572 char *addthis = g_malloc0(1); | |
3573 | |
3574 while (matches) { | |
3575 char *tmp = addthis; | |
3576 addthis = g_strconcat(tmp, matches->data, " ", NULL); | |
3577 g_free(tmp); | |
3578 matches = g_list_remove(matches, matches->data); | |
3579 } | |
3580 | |
6982 | 3581 gaim_conversation_write(conv, NULL, addthis, GAIM_MESSAGE_NO_LOG, |
4359 | 3582 time(NULL)); |
3583 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, partial, -1); | |
3584 g_free(addthis); | |
3585 } | |
3586 | |
9605 | 3587 if (command) |
3588 g_list_free(list); | |
4359 | 3589 g_free(entered); |
3590 g_free(partial); | |
9605 | 3591 |
3592 return TRUE; | |
4359 | 3593 } |
3594 | |
3595 static GtkItemFactoryEntry menu_items[] = | |
3596 { | |
3597 /* Conversation menu */ | |
4596 | 3598 { N_("/_Conversation"), NULL, NULL, 0, "<Branch>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3599 |
7887 | 3600 { N_("/Conversation/New Instant _Message..."), "<CTL>M", menu_new_conv_cb, |
7859 | 3601 0, "<StockItem>", GAIM_STOCK_IM }, |
3602 | |
3603 { "/Conversation/sep0", NULL, NULL, 0, "<Separator>" }, | |
3604 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3605 { N_("/Conversation/_Find..."), NULL, menu_find_cb, 0, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3606 "<StockItem>", GTK_STOCK_FIND }, |
7859 | 3607 { N_("/Conversation/View _Log"), NULL, menu_view_log_cb, 0, NULL }, |
4596 | 3608 { N_("/Conversation/_Save As..."), NULL, menu_save_as_cb, 0, |
4359 | 3609 "<StockItem>", GTK_STOCK_SAVE_AS }, |
8974 | 3610 { N_("/Conversation/Clear"), "<CTL>L", menu_clear_cb, 0, "<StockItem>", GTK_STOCK_CLEAR }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3611 |
4359 | 3612 { "/Conversation/sep1", NULL, NULL, 0, "<Separator>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3613 |
9468 | 3614 { N_("/Conversation/Se_nd File..."), NULL, menu_send_file_cb, 0, "<StockItem>", GAIM_STOCK_FILE_TRANSFER }, |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
3615 { N_("/Conversation/Add Buddy _Pounce..."), NULL, menu_add_pounce_cb, |
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
3616 0, NULL }, |
7859 | 3617 { N_("/Conversation/_Get Info"), NULL, menu_get_info_cb, 0, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3618 "<StockItem>", GAIM_STOCK_INFO }, |
7859 | 3619 { N_("/Conversation/_Warn..."), NULL, menu_warn_cb, 0, |
3620 "<StockItem>", GAIM_STOCK_WARN }, | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3621 { N_("/Conversation/In_vite..."), NULL, menu_invite_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3622 "<StockItem>", GAIM_STOCK_INVITE }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3623 |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
3624 { "/Conversation/sep2", NULL, NULL, 0, "<Separator>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3625 |
7859 | 3626 { N_("/Conversation/A_lias..."), NULL, menu_alias_cb, 0, |
3627 "<StockItem>", GAIM_STOCK_EDIT }, | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3628 { N_("/Conversation/_Block..."), NULL, menu_block_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3629 "<StockItem>", GAIM_STOCK_BLOCK }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3630 { N_("/Conversation/_Add..."), NULL, menu_add_remove_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3631 "<StockItem>", GTK_STOCK_ADD }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3632 { N_("/Conversation/_Remove..."), NULL, menu_add_remove_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3633 "<StockItem>", GTK_STOCK_REMOVE }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3634 |
7859 | 3635 { "/Conversation/sep3", NULL, NULL, 0, "<Separator>" }, |
3636 | |
8756 | 3637 { N_("/Conversation/Insert Lin_k..."), NULL, menu_insert_link_cb, 0, |
7859 | 3638 "<StockItem>", GAIM_STOCK_LINK }, |
9287 | 3639 { N_("/Conversation/Insert Imag_e..."), NULL, menu_insert_image_cb, 0, |
7859 | 3640 "<StockItem>", GAIM_STOCK_IMAGE }, |
3641 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3642 { "/Conversation/sep4", NULL, NULL, 0, "<Separator>" }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3643 |
4596 | 3644 { N_("/Conversation/_Close"), NULL, menu_close_conv_cb, 0, |
4359 | 3645 "<StockItem>", GTK_STOCK_CLOSE }, |
3646 | |
3647 /* Options */ | |
4596 | 3648 { N_("/_Options"), NULL, NULL, 0, "<Branch>" }, |
3649 { N_("/Options/Enable _Logging"), NULL, menu_logging_cb, 0, "<CheckItem>" }, | |
3650 { N_("/Options/Enable _Sounds"), NULL, menu_sounds_cb, 0, "<CheckItem>" }, | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3651 { N_("/Options/Show Formatting _Toolbar"), NULL, menu_toolbar_cb, 0, "<CheckItem>" }, |
9188 | 3652 { N_("/Options/Show T_imestamps"), "F2", menu_timestamps_cb, 0, "<CheckItem>" }, |
4359 | 3653 }; |
3654 | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
3655 static const int menu_item_count = |
4359 | 3656 sizeof(menu_items) / sizeof(*menu_items); |
3657 | |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3658 static char * |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3659 item_factory_translate_func (const char *path, gpointer func_data) |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3660 { |
7386 | 3661 return _((char *)path); |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3662 } |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3663 |
4359 | 3664 static GtkWidget * |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3665 setup_menubar(GaimConvWindow *win) |
4359 | 3666 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3667 GaimGtkWindow *gtkwin; |
5116 | 3668 GtkAccelGroup *accel_group; |
4359 | 3669 gtkwin = GAIM_GTK_WINDOW(win); |
3670 | |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
3671 accel_group = gtk_accel_group_new (); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
3672 gtk_window_add_accel_group (GTK_WINDOW (gtkwin->window), accel_group); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
3673 g_object_unref (accel_group); |
5116 | 3674 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3675 gtkwin->menu.item_factory = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3676 gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<main>", accel_group); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3677 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3678 gtk_item_factory_set_translate_func(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3679 item_factory_translate_func, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3680 NULL, NULL); |
4630 | 3681 |
3682 gtk_item_factory_create_items(gtkwin->menu.item_factory, menu_item_count, | |
4359 | 3683 menu_items, win); |
7420 | 3684 g_signal_connect(G_OBJECT(accel_group), "accel-changed", |
3685 G_CALLBACK(gaim_gtk_save_accels_cb), NULL); | |
4359 | 3686 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3687 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3688 gtkwin->menu.menubar = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3689 gtk_item_factory_get_widget(gtkwin->menu.item_factory, "<main>"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3690 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3691 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3692 gtkwin->menu.view_log = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3693 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
7295 | 3694 N_("/Conversation/View Log")); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3695 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3696 |
9468 | 3697 gtkwin->menu.send_file = |
3698 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3699 N_("/Conversation/Send File...")); | |
9498 | 3700 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3701 gtkwin->menu.add_pounce = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3702 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3703 N_("/Conversation/Add Buddy Pounce...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3704 |
7879 | 3705 /* --- */ |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3706 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3707 gtkwin->menu.get_info = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3708 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
7859 | 3709 N_("/Conversation/Get Info")); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3710 |
7879 | 3711 gtkwin->menu.warn = |
3712 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3713 N_("/Conversation/Warn...")); | |
3714 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3715 gtkwin->menu.invite = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3716 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3717 N_("/Conversation/Invite...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3718 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3719 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3720 |
7879 | 3721 gtkwin->menu.alias = |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3722 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
7879 | 3723 N_("/Conversation/Alias...")); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3724 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3725 gtkwin->menu.block = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3726 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3727 N_("/Conversation/Block...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3728 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3729 gtkwin->menu.add = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3730 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3731 N_("/Conversation/Add...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3732 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3733 gtkwin->menu.remove = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3734 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3735 N_("/Conversation/Remove...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3736 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3737 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3738 |
7879 | 3739 gtkwin->menu.insert_link = |
3740 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3741 N_("/Conversation/Insert Link...")); | |
3742 | |
3743 gtkwin->menu.insert_image = | |
3744 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3745 N_("/Conversation/Insert Image...")); | |
3746 | |
3747 /* --- */ | |
3748 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3749 gtkwin->menu.logging = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3750 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3751 N_("/Options/Enable Logging")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3752 gtkwin->menu.sounds = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3753 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3754 N_("/Options/Enable Sounds")); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3755 gtkwin->menu.show_formatting_toolbar = |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3756 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3757 N_("/Options/Show Formatting Toolbar")); |
9188 | 3758 gtkwin->menu.show_timestamps = |
3759 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3760 N_("/Options/Show Timestamps")); | |
4359 | 3761 |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3762 generate_send_as_items(win, NULL); |
4359 | 3763 |
3764 gtk_widget_show(gtkwin->menu.menubar); | |
4931 | 3765 |
3766 return gtkwin->menu.menubar; | |
4359 | 3767 } |
3768 | |
9759 | 3769 GtkWidget * |
3770 gaim_gtkconv_button_new(const char *icon, const char *text, const char *tooltip, GtkTooltips *tooltips, void *callback, void *data) | |
9749 | 3771 { |
3772 GtkWidget *button; | |
3773 int buttons; | |
3774 | |
3775 buttons = gaim_prefs_get_int("/gaim/gtk/conversations/button_type"); | |
3776 button = gaim_pixbuf_button_from_stock( | |
3777 (buttons == GAIM_BUTTON_IMAGE ? NULL : text), | |
3778 (buttons == GAIM_BUTTON_TEXT ? NULL : icon), | |
9750 | 3779 GAIM_BUTTON_VERTICAL); |
9766 | 3780 if (tooltip != NULL) |
3781 gtk_tooltips_set_tip(tooltips, button, tooltip, NULL); | |
9749 | 3782 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); |
9766 | 3783 if (callback != NULL) |
3784 g_signal_connect(G_OBJECT(button), "clicked", | |
3785 G_CALLBACK(callback), data); | |
9749 | 3786 |
3787 return button; | |
3788 } | |
3789 | |
4359 | 3790 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3791 setup_im_buttons(GaimConversation *conv, GtkWidget *parent) |
4359 | 3792 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3793 GaimConnection *gc; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3794 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3795 GaimGtkImPane *gtkim; |
8811 | 3796 GaimButtonStyle button_type; |
9749 | 3797 GList *children; |
4359 | 3798 |
3799 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3800 gtkim = gtkconv->u.im; | |
3801 gc = gaim_conversation_get_gc(conv); | |
3802 | |
9749 | 3803 /* Remove anything else in our parent */ |
3804 children = gtk_container_get_children(GTK_CONTAINER(parent)); | |
3805 while (children != NULL) { | |
9885 | 3806 if(children->data != gtkim->icon_container) |
3807 gtk_container_remove(GTK_CONTAINER(parent), children->data); | |
9749 | 3808 children = g_list_remove(children, children->data); |
3809 } | |
3810 | |
9750 | 3811 /* The buttons, from left to right */ |
9749 | 3812 |
3813 /* Block button */ | |
9759 | 3814 gtkim->block = gaim_gtkconv_button_new(GAIM_STOCK_BLOCK, _("Block"), |
9749 | 3815 _("Block the user"), |
3816 gtkconv->tooltips, block_cb, conv); | |
9750 | 3817 gtk_box_pack_start(GTK_BOX(parent), gtkim->block, TRUE, TRUE, 0); |
9749 | 3818 gtk_size_group_add_widget(gtkconv->sg, gtkim->block); |
3819 | |
3820 /* Send File button */ | |
9759 | 3821 gtkim->send_file = gaim_gtkconv_button_new(GAIM_STOCK_FILE_TRANSFER, _("Send File"), |
9749 | 3822 _("Send a file to the user"), |
3823 gtkconv->tooltips, send_file_cb, conv); | |
9750 | 3824 gtk_box_pack_start(GTK_BOX(parent), gtkim->send_file, TRUE, TRUE, 0); |
9749 | 3825 gtk_size_group_add_widget(gtkconv->sg, gtkim->send_file); |
3826 | |
3827 /* Add button */ | |
9759 | 3828 gtkconv->add = gaim_gtkconv_button_new(GTK_STOCK_ADD, _("Add"), |
9749 | 3829 _("Add the user to your buddy list"), |
3830 gtkconv->tooltips, add_remove_cb, conv); | |
9750 | 3831 gtk_box_pack_start(GTK_BOX(parent), gtkconv->add, TRUE, TRUE, 0); |
9749 | 3832 gtk_size_group_add_widget(gtkconv->sg, gtkconv->add); |
3833 | |
3834 /* Remove button */ | |
9759 | 3835 gtkconv->remove = gaim_gtkconv_button_new(GTK_STOCK_REMOVE, _("Remove"), |
9749 | 3836 _("Remove the user from your buddy list"), |
3837 gtkconv->tooltips, add_remove_cb, conv); | |
9750 | 3838 gtk_box_pack_start(GTK_BOX(parent), gtkconv->remove, TRUE, TRUE, 0); |
9749 | 3839 gtk_size_group_add_widget(gtkconv->sg, gtkconv->remove); |
3840 | |
3841 /* Info button */ | |
9759 | 3842 gtkconv->info = gaim_gtkconv_button_new(GAIM_STOCK_INFO, _("Info"), |
9749 | 3843 _("Get the user's information"), |
3844 gtkconv->tooltips, info_cb, conv); | |
9750 | 3845 gtk_box_pack_start(GTK_BOX(parent), gtkconv->info, TRUE, TRUE, 0); |
9749 | 3846 gtk_size_group_add_widget(gtkconv->sg, gtkconv->info); |
4359 | 3847 |
3848 /* Send button */ | |
9759 | 3849 gtkconv->send = gaim_gtkconv_button_new(GAIM_STOCK_SEND, _("Send"), |
9749 | 3850 _("Send message"), |
3851 gtkconv->tooltips, send_cb, conv); | |
4359 | 3852 gtk_box_pack_end(GTK_BOX(parent), gtkconv->send, FALSE, FALSE, 0); |
3853 | |
3854 /* Separator */ | |
3855 gtkim->sep2 = gtk_vseparator_new(); | |
3856 gtk_box_pack_end(GTK_BOX(parent), gtkim->sep2, FALSE, TRUE, 0); | |
3857 gtk_widget_show(gtkim->sep2); | |
3858 | |
3859 gaim_gtkconv_update_buttons_by_protocol(conv); | |
3860 | |
8811 | 3861 /* Check if the buttons should be visible or not */ |
9150 | 3862 button_type = gaim_prefs_get_int("/gaim/gtk/conversations/button_type"); |
8811 | 3863 if (button_type == GAIM_BUTTON_NONE) |
9749 | 3864 gtk_widget_hide(parent); |
8811 | 3865 else |
9749 | 3866 gtk_widget_show(parent); |
4359 | 3867 } |
3868 | |
3869 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3870 setup_chat_buttons(GaimConversation *conv, GtkWidget *parent) |
4359 | 3871 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3872 GaimConnection *gc; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3873 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3874 GaimGtkChatPane *gtkchat; |
8811 | 3875 GaimButtonStyle button_type; |
9750 | 3876 GList *children; |
4359 | 3877 |
3878 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3879 gtkchat = gtkconv->u.chat; | |
3880 gc = gaim_conversation_get_gc(conv); | |
3881 | |
9750 | 3882 /* Remove anything else in our parent */ |
3883 children = gtk_container_get_children(GTK_CONTAINER(parent)); | |
3884 while (children != NULL) { | |
3885 gtk_container_remove(GTK_CONTAINER(parent), children->data); | |
3886 children = g_list_remove(children, children->data); | |
3887 } | |
3888 | |
3889 /* The buttons, from left to right */ | |
3890 | |
3891 /* Invite */ | |
9759 | 3892 gtkchat->invite = gaim_gtkconv_button_new(GAIM_STOCK_INVITE, _("Invite"), |
9817 | 3893 _("Invite a user"), |
9750 | 3894 gtkconv->tooltips, invite_cb, conv); |
3895 gtk_box_pack_start(GTK_BOX(parent), gtkchat->invite, TRUE, TRUE, 0); | |
3896 gtk_size_group_add_widget(gtkconv->sg, gtkchat->invite); | |
3897 | |
3898 /* Add button */ | |
9759 | 3899 gtkconv->add = gaim_gtkconv_button_new(GTK_STOCK_ADD, _("Add"), |
9750 | 3900 _("Add the chat to your buddy list"), |
3901 gtkconv->tooltips, add_remove_cb, conv); | |
3902 gtk_box_pack_start(GTK_BOX(parent), gtkconv->add, TRUE, TRUE, 0); | |
3903 gtk_size_group_add_widget(gtkconv->sg, gtkconv->add); | |
3904 | |
3905 /* Remove button */ | |
9759 | 3906 gtkconv->remove = gaim_gtkconv_button_new(GTK_STOCK_REMOVE, _("Remove"), |
9750 | 3907 _("Remove the chat from your buddy list"), |
3908 gtkconv->tooltips, add_remove_cb, conv); | |
3909 gtk_box_pack_start(GTK_BOX(parent), gtkconv->remove, TRUE, TRUE, 0); | |
3910 gtk_size_group_add_widget(gtkconv->sg, gtkconv->remove); | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3911 |
4359 | 3912 /* Send button */ |
9759 | 3913 gtkconv->send = gaim_gtkconv_button_new(GAIM_STOCK_SEND, _("Send"), |
9750 | 3914 _("Send message"), |
3915 gtkconv->tooltips, send_cb, conv); | |
4359 | 3916 gtk_box_pack_end(GTK_BOX(parent), gtkconv->send, FALSE, FALSE, 0); |
9750 | 3917 gtk_size_group_add_widget(gtkconv->sg, gtkconv->send); |
4359 | 3918 |
3919 /* Separator */ | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3920 gtkchat->sep = gtk_vseparator_new(); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3921 gtk_box_pack_end(GTK_BOX(parent), gtkchat->sep, FALSE, TRUE, 0); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3922 gtk_widget_show(gtkchat->sep); |
4359 | 3923 |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3924 gaim_gtkconv_update_buttons_by_protocol(conv); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3925 |
8811 | 3926 /* Check if the buttons should be visible or not */ |
9150 | 3927 button_type = gaim_prefs_get_int("/gaim/gtk/conversations/button_type"); |
8811 | 3928 if (button_type == GAIM_BUTTON_NONE) |
3929 gtk_widget_hide(gtkconv->bbox); | |
3930 else | |
3931 gtk_widget_show(gtkconv->bbox); | |
4359 | 3932 } |
3933 | |
3934 | |
7971 | 3935 static void topic_callback(GtkWidget *w, GaimConversation *conv) |
3936 { | |
3937 GaimPluginProtocolInfo *prpl_info = NULL; | |
3938 GaimConnection *gc; | |
3939 GaimGtkConversation *gtkconv; | |
3940 GaimGtkChatPane *gtkchat; | |
8858 | 3941 const char *new_topic; |
3942 const char *current_topic; | |
7971 | 3943 |
3944 gc = gaim_conversation_get_gc(conv); | |
3945 | |
3946 if(!gc || !(prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl))) | |
3947 return; | |
3948 | |
3949 if(prpl_info->set_chat_topic == NULL) | |
3950 return; | |
3951 | |
3952 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3953 gtkchat = gtkconv->u.chat; | |
8858 | 3954 new_topic = gtk_entry_get_text(GTK_ENTRY(gtkchat->topic_text)); |
3955 current_topic = gaim_conv_chat_get_topic(GAIM_CONV_CHAT(conv)); | |
3956 | |
3957 if(current_topic && !g_utf8_collate(new_topic, current_topic)) | |
7971 | 3958 return; |
3959 | |
8858 | 3960 prpl_info->set_chat_topic(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), |
3961 new_topic); | |
7971 | 3962 } |
3963 | |
9554 | 3964 static gint |
3965 sort_chat_users(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer userdata) | |
3966 { | |
3967 GaimConvChatBuddyFlags f1 = 0, f2 = 0; | |
3968 char *user1 = NULL, *user2 = NULL; | |
3969 gint ret = 0; | |
3970 | |
3971 gtk_tree_model_get(model, a, CHAT_USERS_NAME_COLUMN, &user1, CHAT_USERS_FLAGS_COLUMN, &f1, -1); | |
3972 gtk_tree_model_get(model, b, CHAT_USERS_NAME_COLUMN, &user2, CHAT_USERS_FLAGS_COLUMN, &f2, -1); | |
3973 | |
3974 if (user1 == NULL || user2 == NULL) { | |
3975 if (!(user1 == NULL && user2 == NULL)) | |
3976 ret = (user1 == NULL) ? -1: 1; | |
3977 } else if (f1 != f2) { | |
3978 /* sort more important users first */ | |
3979 ret = (f1 > f2) ? -1 : 1; | |
3980 } else { | |
3981 ret = g_utf8_collate(user1, user2); | |
3982 } | |
3983 | |
3984 g_free(user1); | |
3985 g_free(user2); | |
3986 | |
3987 return ret; | |
3988 } | |
3989 | |
4359 | 3990 static GtkWidget * |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3991 setup_chat_pane(GaimConversation *conv) |
4359 | 3992 { |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3993 GaimPluginProtocolInfo *prpl_info = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3994 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3995 GaimGtkChatPane *gtkchat; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3996 GaimConnection *gc; |
4359 | 3997 GtkWidget *vpaned, *hpaned; |
10080 | 3998 GtkWidget *vbox, *hbox, *frame, *vbox2, *sep; |
4359 | 3999 GtkWidget *lbox, *bbox; |
4000 GtkWidget *label; | |
4001 GtkWidget *list; | |
4002 GtkWidget *button; | |
7949 | 4003 GtkWidget *sw; |
4359 | 4004 GtkListStore *ls; |
4005 GtkCellRenderer *rend; | |
4006 GtkTreeViewColumn *col; | |
9080 | 4007 GList *focus_chain = NULL; |
4359 | 4008 |
4009 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4010 gtkchat = gtkconv->u.chat; | |
4011 gc = gaim_conversation_get_gc(conv); | |
4012 | |
4013 /* Setup the outer pane. */ | |
4014 vpaned = gtk_vpaned_new(); | |
4015 gtk_widget_show(vpaned); | |
4016 | |
4017 /* Setup the top part of the pane. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4018 vbox = gtk_vbox_new(FALSE, 6); |
8914 | 4019 gtk_paned_pack1(GTK_PANED(vpaned), vbox, TRUE, TRUE); |
4359 | 4020 gtk_widget_show(vbox); |
4021 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4022 if (gc != NULL) |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4023 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4024 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4025 if (prpl_info->options & OPT_PROTO_CHAT_TOPIC) |
4359 | 4026 { |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4027 hbox = gtk_hbox_new(FALSE, 6); |
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4028 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
4359 | 4029 gtk_widget_show(hbox); |
4030 | |
4031 label = gtk_label_new(_("Topic:")); | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4032 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
4359 | 4033 gtk_widget_show(label); |
4034 | |
4035 gtkchat->topic_text = gtk_entry_new(); | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4036 |
7971 | 4037 if(prpl_info->set_chat_topic == NULL) { |
4038 gtk_editable_set_editable(GTK_EDITABLE(gtkchat->topic_text), FALSE); | |
4039 } else { | |
4040 g_signal_connect(GTK_OBJECT(gtkchat->topic_text), "activate", | |
4041 G_CALLBACK(topic_callback), conv); | |
4042 } | |
4043 | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4044 gtk_box_pack_start(GTK_BOX(hbox), gtkchat->topic_text, TRUE, TRUE, 0); |
4359 | 4045 gtk_widget_show(gtkchat->topic_text); |
4046 } | |
4047 | |
4048 /* Setup the horizontal pane. */ | |
4049 hpaned = gtk_hpaned_new(); | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4050 gtk_box_pack_start(GTK_BOX(vbox), hpaned, TRUE, TRUE, 0); |
4359 | 4051 gtk_widget_show(hpaned); |
4052 | |
4053 /* Setup the scrolled window to put gtkimhtml in. */ | |
4054 gtkconv->sw = gtk_scrolled_window_new(NULL, NULL); | |
4055 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
8076 | 4056 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
4359 | 4057 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(gtkconv->sw), |
4058 GTK_SHADOW_IN); | |
4059 gtk_paned_pack1(GTK_PANED(hpaned), gtkconv->sw, TRUE, TRUE); | |
4060 | |
4061 gtk_widget_set_size_request(gtkconv->sw, | |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
4062 gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_width"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
4063 gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_height")); |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
4064 |
8914 | 4065 g_signal_connect(G_OBJECT(gtkconv->sw), "size-allocate", |
4066 G_CALLBACK(size_allocate_cb), conv); | |
4067 | |
4359 | 4068 gtk_widget_show(gtkconv->sw); |
4069 | |
4070 /* Setup gtkihmtml. */ | |
4071 gtkconv->imhtml = gtk_imhtml_new(NULL, NULL); | |
9005 | 4072 gtk_widget_set_name(gtkconv->imhtml, "gaim_gtkconv_imhtml"); |
4359 | 4073 gtk_container_add(GTK_CONTAINER(gtkconv->sw), gtkconv->imhtml); |
4074 | |
4075 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4076 gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); |
4359 | 4077 |
4078 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", | |
4079 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
8105 | 4080 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_press_event", |
6057 | 4081 G_CALLBACK(refocus_entry_cb), gtkconv); |
8109 | 4082 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_release_event", |
4083 G_CALLBACK(refocus_entry_cb), gtkconv); | |
4359 | 4084 |
4085 gaim_setup_imhtml(gtkconv->imhtml); | |
4086 gtk_widget_show(gtkconv->imhtml); | |
4087 | |
4088 /* Build the right pane. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4089 lbox = gtk_vbox_new(FALSE, 6); |
4409
0521eec12c33
[gaim-migrate @ 4682]
Christian Hammond <chipx86@chipx86.com>
parents:
4398
diff
changeset
|
4090 gtk_paned_pack2(GTK_PANED(hpaned), lbox, FALSE, TRUE); |
4359 | 4091 gtk_widget_show(lbox); |
4092 | |
4093 /* Setup the label telling how many people are in the room. */ | |
4094 gtkchat->count = gtk_label_new(_("0 people in room")); | |
4095 gtk_box_pack_start(GTK_BOX(lbox), gtkchat->count, FALSE, FALSE, 0); | |
4096 gtk_widget_show(gtkchat->count); | |
4097 | |
4098 /* Setup the list of users. */ | |
7949 | 4099 sw = gtk_scrolled_window_new(NULL, NULL); |
4100 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
8076 | 4101 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
7949 | 4102 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); |
4103 gtk_box_pack_start(GTK_BOX(lbox), sw, TRUE, TRUE, 0); | |
4104 gtk_widget_show(sw); | |
4359 | 4105 |
9554 | 4106 ls = gtk_list_store_new(CHAT_USERS_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING, |
4107 G_TYPE_INT); | |
4108 gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(ls), CHAT_USERS_NAME_COLUMN, | |
4109 sort_chat_users, NULL, NULL); | |
9498 | 4110 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), CHAT_USERS_NAME_COLUMN, |
4359 | 4111 GTK_SORT_ASCENDING); |
4112 | |
4113 list = gtk_tree_view_new_with_model(GTK_TREE_MODEL(ls)); | |
4114 | |
9498 | 4115 rend = gtk_cell_renderer_pixbuf_new(); |
4116 | |
4359 | 4117 col = gtk_tree_view_column_new_with_attributes(NULL, rend, |
9498 | 4118 "pixbuf", CHAT_USERS_ICON_COLUMN, NULL); |
9554 | 4119 gtk_tree_view_column_set_clickable(GTK_TREE_VIEW_COLUMN(col), TRUE); |
4120 | |
9498 | 4121 gtk_tree_view_append_column(GTK_TREE_VIEW(list), col); |
4359 | 4122 |
4123 g_signal_connect(G_OBJECT(list), "button_press_event", | |
4124 G_CALLBACK(right_click_chat_cb), conv); | |
8143 | 4125 g_signal_connect(G_OBJECT(list), "popup-menu", |
4126 G_CALLBACK(gtkconv_chat_popup_menu_cb), conv); | |
4359 | 4127 |
9498 | 4128 rend = gtk_cell_renderer_text_new(); |
4129 | |
4359 | 4130 col = gtk_tree_view_column_new_with_attributes(NULL, rend, |
9498 | 4131 "text", CHAT_USERS_NAME_COLUMN, NULL); |
4359 | 4132 gtk_tree_view_column_set_clickable(GTK_TREE_VIEW_COLUMN(col), TRUE); |
4133 | |
4134 gtk_tree_view_append_column(GTK_TREE_VIEW(list), col); | |
4135 | |
4136 gtk_widget_set_size_request(list, 150, -1); | |
4137 | |
4138 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(list), FALSE); | |
4139 gtk_widget_show(list); | |
4140 | |
4141 gtkchat->list = list; | |
4142 | |
7949 | 4143 gtk_container_add(GTK_CONTAINER(sw), list); |
4359 | 4144 |
4145 /* Setup the user list toolbar. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4146 bbox = gtk_hbox_new(TRUE, 6); |
4359 | 4147 gtk_box_pack_start(GTK_BOX(lbox), bbox, FALSE, FALSE, 0); |
4148 gtk_widget_show(bbox); | |
4149 | |
4150 /* IM */ | |
4151 button = gaim_pixbuf_button_from_stock(NULL, GTK_STOCK_REDO, | |
4152 GAIM_BUTTON_VERTICAL); | |
4153 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
4154 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
4155 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("IM the user"), NULL); |
4359 | 4156 g_signal_connect(G_OBJECT(button), "clicked", |
7961 | 4157 G_CALLBACK(chat_im_button_cb), conv); |
4359 | 4158 |
4159 gtk_widget_show(button); | |
4160 | |
4161 /* Ignore */ | |
4162 button = gaim_pixbuf_button_from_stock(NULL, GAIM_STOCK_IGNORE, | |
4163 GAIM_BUTTON_VERTICAL); | |
4164 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
4165 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
4166 gtk_tooltips_set_tip(gtkconv->tooltips, button, |
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
4167 _("Ignore the user"), NULL); |
4359 | 4168 g_signal_connect(G_OBJECT(button), "clicked", |
4169 G_CALLBACK(ignore_cb), conv); | |
4170 gtk_widget_show(button); | |
4171 | |
4172 /* Info */ | |
4173 button = gaim_pixbuf_button_from_stock(NULL, GAIM_STOCK_INFO, | |
4174 GAIM_BUTTON_VERTICAL); | |
4175 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
4176 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
4177 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
4178 _("Get the user's information"), NULL); |
4359 | 4179 g_signal_connect(G_OBJECT(button), "clicked", |
4180 G_CALLBACK(info_cb), conv); | |
4181 | |
4182 gtk_widget_show(button); | |
4183 | |
4184 gtkconv->info = button; | |
4185 | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4186 /* Build the toolbar. */ |
10080 | 4187 frame = gtk_frame_new(NULL); |
4188 | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4189 vbox = gtk_vbox_new(FALSE, 6); |
8914 | 4190 gtk_paned_pack2(GTK_PANED(vpaned), vbox, FALSE, TRUE); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4191 gtk_widget_show(vbox); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4192 |
9332 | 4193 gtkconv->lower_hbox = gtk_hbox_new(FALSE, 6); |
4194 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->lower_hbox, TRUE, TRUE, 0); | |
4195 gtk_widget_show(gtkconv->lower_hbox); | |
4196 | |
4197 vbox = gtk_vbox_new(FALSE, 6); | |
4198 gtk_box_pack_end(GTK_BOX(gtkconv->lower_hbox), vbox, TRUE, TRUE, 0); | |
4199 gtk_widget_show(vbox); | |
4200 | |
10080 | 4201 frame = gtk_frame_new(NULL); |
4202 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); | |
4203 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN); | |
4204 vbox2 = gtk_vbox_new(FALSE, 0); | |
4205 gtk_container_add(GTK_CONTAINER(frame), vbox2); | |
4206 gtk_widget_show_all(frame); | |
4207 | |
4208 gtkconv->toolbar = gtk_imhtmltoolbar_new(); | |
4209 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->toolbar, FALSE, FALSE, 0); | |
4210 | |
4211 sep = gtk_hseparator_new(); | |
4212 gtk_box_pack_start(GTK_BOX(vbox2), sep, FALSE, FALSE, 0); | |
4213 gtk_widget_show(sep); | |
4214 | |
8123 | 4215 /* Setup the entry widget. |
4216 * We never show the horizontal scrollbar because it was causing weird | |
4217 * lockups when typing text just as you type the character that would | |
4218 * cause both scrollbars to appear. Definitely seems like a gtk bug. | |
4219 */ | |
7949 | 4220 sw = gtk_scrolled_window_new(NULL, NULL); |
4221 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
10080 | 4222 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); |
8061 | 4223 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), |
10080 | 4224 GTK_SHADOW_NONE); |
4225 gtk_box_pack_start(GTK_BOX(vbox2), sw, TRUE, TRUE, 0); | |
7949 | 4226 gtk_widget_show(sw); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4227 |
8061 | 4228 gtkconv->entry = gtk_imhtml_new(NULL, NULL); |
9005 | 4229 gtk_widget_set_name(gtkconv->entry, "gaim_gtkconv_entry"); |
8456 | 4230 gtk_imhtml_smiley_shortcuts(GTK_IMHTML(gtkconv->entry), |
4231 gaim_prefs_get_bool("/gaim/gtk/conversations/smiley_shortcuts")); | |
4232 gtk_imhtml_html_shortcuts(GTK_IMHTML(gtkconv->entry), | |
4233 gaim_prefs_get_bool("/gaim/gtk/conversations/html_shortcuts")); | |
4234 | |
4235 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), | |
9699 | 4236 gaim_account_get_protocol_name(conv->account)); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4237 gtkconv->entry_buffer = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4238 gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); |
8061 | 4239 gaim_setup_imhtml(gtkconv->entry); |
4240 gtk_imhtml_set_editable(GTK_IMHTML(gtkconv->entry), TRUE); | |
4241 default_formatize(conv); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4242 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(gtkconv->entry), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4243 GTK_WRAP_WORD_CHAR); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4244 gtk_widget_set_size_request(gtkconv->entry, -1, |
8106 | 4245 gaim_prefs_get_int("/gaim/gtk/conversations/chat/entry_height")); |
7949 | 4246 g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", conv); |
4247 | |
4248 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", | |
8105 | 4249 G_CALLBACK(entry_key_press_cb), conv); |
4359 | 4250 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", |
4251 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
8914 | 4252 g_signal_connect(G_OBJECT(gtkconv->entry), "size-allocate", |
4253 G_CALLBACK(size_allocate_cb), conv); | |
4359 | 4254 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4255 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
4256 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4257 gtk_imhtmltoolbar_attach(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4258 gtkconv->entry); |
4359 | 4259 |
7949 | 4260 gtk_container_add(GTK_CONTAINER(sw), GTK_WIDGET(gtkconv->entry)); |
4359 | 4261 gtk_widget_show(gtkconv->entry); |
4262 | |
4263 /* Setup the bottom button box. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4264 gtkconv->bbox = gtk_hbox_new(FALSE, 6); |
4359 | 4265 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->bbox, FALSE, FALSE, 0); |
4266 setup_chat_buttons(conv, gtkconv->bbox); | |
4267 | |
9080 | 4268 /* |
4269 * Focus for chat windows should be as follows: | |
4270 * Tab title -> chat topic -> conversation scrollback -> user list -> | |
4271 * user list buttons -> entry -> buttons at bottom | |
4272 */ | |
4273 focus_chain = g_list_prepend(focus_chain, gtkconv->bbox); | |
9332 | 4274 focus_chain = g_list_prepend(focus_chain, gtkconv->entry); |
9080 | 4275 gtk_container_set_focus_chain(GTK_CONTAINER(vbox), focus_chain); |
4276 | |
4359 | 4277 return vpaned; |
4278 } | |
4279 | |
4280 static GtkWidget * | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4281 setup_im_pane(GaimConversation *conv) |
4359 | 4282 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4283 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4284 GaimGtkImPane *gtkim; |
4359 | 4285 GtkWidget *paned; |
10080 | 4286 GtkWidget *vbox, *sep; |
4287 GtkWidget *vbox2, *vbox3, *frame; | |
7949 | 4288 GtkWidget *sw; |
9080 | 4289 GList *focus_chain = NULL; |
4359 | 4290 |
4291 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4292 gtkim = gtkconv->u.im; | |
4293 | |
4294 /* Setup the outer pane. */ | |
4295 paned = gtk_vpaned_new(); | |
4296 gtk_widget_show(paned); | |
4297 | |
4298 /* Setup the top part of the pane. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4299 vbox = gtk_vbox_new(FALSE, 6); |
4409
0521eec12c33
[gaim-migrate @ 4682]
Christian Hammond <chipx86@chipx86.com>
parents:
4398
diff
changeset
|
4300 gtk_paned_pack1(GTK_PANED(paned), vbox, TRUE, TRUE); |
4359 | 4301 gtk_widget_show(vbox); |
4302 | |
4303 /* Setup the gtkimhtml widget. */ | |
4304 gtkconv->sw = gtk_scrolled_window_new(NULL, NULL); | |
4305 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
8076 | 4306 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
4359 | 4307 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(gtkconv->sw), |
4308 GTK_SHADOW_IN); | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4309 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->sw, TRUE, TRUE, 0); |
4851 | 4310 |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
4311 gtk_widget_set_size_request(gtkconv->sw, |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
4312 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_width"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
4313 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_height")); |
8914 | 4314 g_signal_connect(G_OBJECT(gtkconv->sw), "size-allocate", |
4315 G_CALLBACK(size_allocate_cb), conv); | |
4359 | 4316 gtk_widget_show(gtkconv->sw); |
4317 | |
4318 gtkconv->imhtml = gtk_imhtml_new(NULL, NULL); | |
9005 | 4319 gtk_widget_set_name(gtkconv->imhtml, "gaim_gtkconv_imhtml"); |
4359 | 4320 gtk_container_add(GTK_CONTAINER(gtkconv->sw), gtkconv->imhtml); |
4321 | |
4322 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", | |
4323 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
8105 | 4324 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_press_event", |
6057 | 4325 G_CALLBACK(refocus_entry_cb), gtkconv); |
8109 | 4326 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_release_event", |
4327 G_CALLBACK(refocus_entry_cb), gtkconv); | |
4359 | 4328 |
4329 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4330 gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); |
4359 | 4331 gaim_setup_imhtml(gtkconv->imhtml); |
4332 gtk_widget_show(gtkconv->imhtml); | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4333 vbox2 = gtk_vbox_new(FALSE, 6); |
8914 | 4334 gtk_paned_pack2(GTK_PANED(paned), vbox2, FALSE, TRUE); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4335 gtk_widget_show(vbox2); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4336 |
8123 | 4337 /* Setup the entry widget. |
4338 * We never show the horizontal scrollbar because it was causing weird | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4339 * lockups when typing text just as you type the character that would |
8123 | 4340 * cause both scrollbars to appear. Definitely seems like a gtk bug. |
4341 */ | |
9332 | 4342 gtkconv->lower_hbox = gtk_hbox_new(FALSE, 6); |
4343 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->lower_hbox, TRUE, TRUE, 0); | |
4344 gtk_widget_show(gtkconv->lower_hbox); | |
4345 | |
4346 vbox2 = gtk_vbox_new(FALSE, 6); | |
4347 gtk_box_pack_end(GTK_BOX(gtkconv->lower_hbox), vbox2, TRUE, TRUE, 0); | |
4348 gtk_widget_show(vbox2); | |
8821 | 4349 |
10080 | 4350 frame = gtk_frame_new(NULL); |
4351 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN); | |
4352 gtk_box_pack_start(GTK_BOX(vbox2), frame, TRUE, TRUE, 0); | |
4353 vbox3 = gtk_vbox_new(FALSE, 0); | |
4354 gtk_container_add(GTK_CONTAINER(frame), vbox3); | |
4355 gtk_widget_show_all(frame); | |
4356 | |
4357 /* Build the toolbar. */ | |
4358 gtkconv->toolbar = gtk_imhtmltoolbar_new(); | |
4359 gtk_box_pack_start(GTK_BOX(vbox3), gtkconv->toolbar, FALSE, FALSE, 0); | |
4360 | |
4361 sep = gtk_hseparator_new(); | |
4362 gtk_box_pack_start(GTK_BOX(vbox3), sep, FALSE, FALSE, 0); | |
4363 gtk_widget_show(sep); | |
4364 | |
7949 | 4365 sw = gtk_scrolled_window_new(NULL, NULL); |
4366 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
8112 | 4367 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); |
8061 | 4368 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), |
10080 | 4369 GTK_SHADOW_NONE); |
4370 gtk_box_pack_start(GTK_BOX(vbox3), sw, TRUE, TRUE, 0); | |
7949 | 4371 gtk_widget_show(sw); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4372 |
8061 | 4373 gtkconv->entry = gtk_imhtml_new(NULL, NULL); |
9005 | 4374 gtk_widget_set_name(gtkconv->entry, "gaim_gtkconv_entry"); |
8456 | 4375 |
4376 gtk_imhtml_smiley_shortcuts(GTK_IMHTML(gtkconv->entry), | |
4377 gaim_prefs_get_bool("/gaim/gtk/conversations/smiley_shortcuts")); | |
4378 gtk_imhtml_html_shortcuts(GTK_IMHTML(gtkconv->entry), | |
4379 gaim_prefs_get_bool("/gaim/gtk/conversations/html_shortcuts")); | |
4380 | |
4381 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), | |
9699 | 4382 gaim_account_get_protocol_name(conv->account)); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4383 gtkconv->entry_buffer = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4384 gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); |
8061 | 4385 gaim_setup_imhtml(gtkconv->entry); |
4386 gtk_imhtml_set_editable(GTK_IMHTML(gtkconv->entry), TRUE); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4387 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(gtkconv->entry), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4388 GTK_WRAP_WORD_CHAR); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4389 gtk_widget_set_size_request(gtkconv->entry, -1, |
8106 | 4390 gaim_prefs_get_int("/gaim/gtk/conversations/im/entry_height")); |
7949 | 4391 g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", conv); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4392 |
4359 | 4393 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", |
8105 | 4394 G_CALLBACK(entry_key_press_cb), conv); |
4359 | 4395 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", |
4396 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
8914 | 4397 g_signal_connect(G_OBJECT(gtkconv->entry), "size-allocate", |
4398 G_CALLBACK(size_allocate_cb), conv); | |
4359 | 4399 |
4400 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "insert_text", | |
4401 G_CALLBACK(insert_text_cb), conv); | |
4402 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "delete_range", | |
4403 G_CALLBACK(delete_text_cb), conv); | |
4404 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4405 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
4406 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
4359 | 4407 |
7949 | 4408 gtk_container_add(GTK_CONTAINER(sw), GTK_WIDGET(gtkconv->entry)); |
4359 | 4409 gtk_widget_show(gtkconv->entry); |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
4410 gtk_imhtmltoolbar_attach(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), |
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
4411 gtkconv->entry); |
8481 | 4412 /* had to move this after the imtoolbar is attached so that the |
4413 * signals get fired to toggle the buttons on the toolbar as well. | |
4414 */ | |
4415 default_formatize(conv); | |
4359 | 4416 |
9749 | 4417 /* Setup the bottom button box. */ |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4418 gtkconv->bbox = gtk_hbox_new(FALSE, 6); |
4359 | 4419 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->bbox, FALSE, FALSE, 0); |
4420 setup_im_buttons(conv, gtkconv->bbox); | |
9749 | 4421 |
8758 | 4422 gtkconv->u.im->animate = gaim_prefs_get_bool("/gaim/gtk/conversations/im/animate_buddy_icons"); |
9687 | 4423 gtkconv->u.im->show_icon = TRUE; |
4359 | 4424 |
9080 | 4425 /* |
4426 * Focus for IM windows should be as follows: | |
4427 * Tab title -> conversation scrollback -> entry -> buttons at bottom | |
4428 */ | |
4429 focus_chain = g_list_prepend(focus_chain, gtkconv->bbox); | |
9332 | 4430 focus_chain = g_list_prepend(focus_chain, gtkconv->entry); |
9080 | 4431 gtk_container_set_focus_chain(GTK_CONTAINER(vbox2), focus_chain); |
8143 | 4432 |
4359 | 4433 return paned; |
4434 } | |
4435 | |
4436 static void | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4437 conv_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
4438 GtkSelectionData *sd, guint info, guint t, |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4439 GaimConversation *conv) |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4440 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4441 GaimConvWindow *win = conv->window; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4442 GaimConversation *c; |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4443 if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE)) |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4444 { |
4781 | 4445 GaimBlistNode *n = NULL; |
6695 | 4446 GaimBuddy *b; |
9622 | 4447 unsigned int index; |
4448 | |
4781 | 4449 memcpy(&n, sd->data, sizeof(n)); |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
4450 |
6695 | 4451 if (GAIM_BLIST_NODE_IS_CONTACT(n)) |
4452 b = gaim_contact_get_priority_buddy((GaimContact*)n); | |
4453 else if (GAIM_BLIST_NODE_IS_BUDDY(n)) | |
4454 b = (GaimBuddy*)n; | |
4455 else | |
4781 | 4456 return; |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
4457 |
9622 | 4458 /* |
4459 * If we already have an open conversation with this buddy, then | |
4460 * just move the conv to this window. Otherwise, create a new | |
4461 * conv and add it to this window. | |
4462 */ | |
4463 c = gaim_find_conversation(b->name); | |
4464 if (c != NULL) { | |
4465 GaimConvWindow *oldwin; | |
4466 oldwin = gaim_conversation_get_window(c); | |
4467 index = gaim_conversation_get_index(c); | |
4468 if (oldwin != win) { | |
4469 gaim_conv_window_remove_conversation(oldwin, index); | |
4470 gaim_conv_window_add_conversation(win, c); | |
4471 } | |
4472 } else { | |
4473 c = gaim_conversation_new(GAIM_CONV_IM, b->account, b->name); | |
4474 gaim_conv_window_add_conversation(win, c); | |
4475 } | |
4476 | |
4477 /* Make this conversation the active conversation */ | |
4478 index = gaim_conversation_get_index(c); | |
4479 gaim_conv_window_switch_conversation(win, index); | |
8802
1076cd8579ea
[gaim-migrate @ 9564]
Christian Hammond <chipx86@chipx86.com>
parents:
8758
diff
changeset
|
4480 |
1076cd8579ea
[gaim-migrate @ 9564]
Christian Hammond <chipx86@chipx86.com>
parents:
8758
diff
changeset
|
4481 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); |
4702 | 4482 } |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4483 else if (sd->target == gdk_atom_intern("application/x-im-contact", FALSE)) |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4484 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4485 char *protocol = NULL; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4486 char *username = NULL; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4487 GaimAccount *account; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4488 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4489 if (gaim_gtk_parse_x_im_contact(sd->data, FALSE, &account, |
7718 | 4490 &protocol, &username, NULL)) |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4491 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4492 if (account == NULL) |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4493 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4494 gaim_notify_error(NULL, NULL, |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4495 _("You are not currently signed on with an account that " |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4496 "can add that buddy."), NULL); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4497 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4498 else |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4499 { |
7718 | 4500 c = gaim_conversation_new(GAIM_CONV_IM, account, username); |
4501 gaim_conv_window_add_conversation(win, c); | |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4502 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4503 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4504 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4505 if (username != NULL) g_free(username); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4506 if (protocol != NULL) g_free(protocol); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4507 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4508 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4509 } |
9525 | 4510 else if (sd->target == gdk_atom_intern("text/uri-list", FALSE)) { |
9673 | 4511 GList *tmp; |
4512 GList *files = gaim_uri_list_extract_filenames(sd->data); | |
4513 for(tmp = files; tmp != NULL ; tmp = g_list_next(tmp)) { | |
4514 gchar *filename = tmp->data; | |
4515 /* XXX - Make ft API support creating a transfer with more than one file */ | |
4516 if (g_file_test(filename, G_FILE_TEST_EXISTS) | |
4517 && !g_file_test(filename, G_FILE_TEST_IS_DIR) | |
4518 && gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
4519 serv_send_file(gaim_conversation_get_gc(conv), | |
4520 gaim_conversation_get_name(conv), filename); | |
4521 } | |
4522 g_free(filename); | |
9495 | 4523 } |
9673 | 4524 g_list_free(files); |
4525 /* XXX - Attempt to load this file into gdk_pixbuf, or otherwise determine if it is an image. If it is, offer | |
4526 * the choice of a) sending this file b) inserting this file as an IM image or c) setting this file as a custom | |
4527 * buddy icon for this buddy */ | |
9495 | 4528 } |
4529 gtk_drag_finish(dc, FALSE, FALSE, t); | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4530 } |
4359 | 4531 |
4532 /************************************************************************** | |
4533 * GTK+ window ops | |
4534 **************************************************************************/ | |
4535 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4536 gaim_gtk_new_window(GaimConvWindow *win) |
4359 | 4537 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4538 GaimGtkWindow *gtkwin; |
4359 | 4539 GtkPositionType pos; |
4540 GtkWidget *testidea; | |
4541 GtkWidget *menubar; | |
4542 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4543 gtkwin = g_malloc0(sizeof(GaimGtkWindow)); |
4359 | 4544 |
4545 win->ui_data = gtkwin; | |
4546 | |
4547 /* Create the window. */ | |
4548 gtkwin->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
4549 gtk_window_set_role(GTK_WINDOW(gtkwin->window), "conversation"); | |
9614 | 4550 gtk_window_set_resizable(GTK_WINDOW(gtkwin->window), TRUE); |
4510
4c394222c732
[gaim-migrate @ 4786]
Christian Hammond <chipx86@chipx86.com>
parents:
4505
diff
changeset
|
4551 gtk_container_set_border_width(GTK_CONTAINER(gtkwin->window), 0); |
9614 | 4552 GTK_WINDOW(gtkwin->window)->allow_shrink = TRUE; |
4359 | 4553 |
4554 g_signal_connect(G_OBJECT(gtkwin->window), "delete_event", | |
4555 G_CALLBACK(close_win_cb), win); | |
4556 | |
4557 /* Create the notebook. */ | |
4558 gtkwin->notebook = gtk_notebook_new(); | |
4559 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4560 pos = gaim_prefs_get_int("/gaim/gtk/conversations/tab_side"); |
4359 | 4561 |
4562 #if 0 | |
4563 gtk_notebook_set_tab_hborder(GTK_NOTEBOOK(gtkwin->notebook), 0); | |
4564 gtk_notebook_set_tab_vborder(GTK_NOTEBOOK(gtkwin->notebook), 0); | |
4565 #endif | |
4566 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos); | |
4567 gtk_notebook_set_scrollable(GTK_NOTEBOOK(gtkwin->notebook), TRUE); | |
4568 gtk_notebook_popup_enable(GTK_NOTEBOOK(gtkwin->notebook)); | |
4818 | 4569 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), FALSE); |
4570 | |
4359 | 4571 gtk_widget_show(gtkwin->notebook); |
4572 | |
8189 | 4573 g_signal_connect(G_OBJECT(gtkwin->notebook), "switch_page", |
4574 G_CALLBACK(before_switch_conv_cb), win); | |
4359 | 4575 g_signal_connect_after(G_OBJECT(gtkwin->notebook), "switch_page", |
4576 G_CALLBACK(switch_conv_cb), win); | |
4577 | |
4578 /* Setup the tab drag and drop signals. */ | |
4486 | 4579 gtk_widget_add_events(gtkwin->notebook, |
4580 GDK_BUTTON1_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK); | |
4581 g_signal_connect(G_OBJECT(gtkwin->notebook), "button_press_event", | |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4582 G_CALLBACK(notebook_press_cb), win); |
4486 | 4583 g_signal_connect(G_OBJECT(gtkwin->notebook), "button_release_event", |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4584 G_CALLBACK(notebook_release_cb), win); |
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4585 |
4359 | 4586 testidea = gtk_vbox_new(FALSE, 0); |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4587 |
4359 | 4588 /* Setup the menubar. */ |
4589 menubar = setup_menubar(win); | |
4590 gtk_box_pack_start(GTK_BOX(testidea), menubar, FALSE, TRUE, 0); | |
4591 | |
4592 gtk_box_pack_start(GTK_BOX(testidea), gtkwin->notebook, TRUE, TRUE, 0); | |
4593 | |
4594 gtk_container_add(GTK_CONTAINER(gtkwin->window), testidea); | |
4595 | |
4596 gtk_widget_show(testidea); | |
4597 } | |
4598 | |
4599 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4600 gaim_gtk_destroy_window(GaimConvWindow *win) |
4359 | 4601 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4602 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4603 |
4604 gtk_widget_destroy(gtkwin->window); | |
4605 | |
4630 | 4606 g_object_unref(G_OBJECT(gtkwin->menu.item_factory)); |
4607 | |
4359 | 4608 g_free(gtkwin); |
4609 win->ui_data = NULL; | |
4610 } | |
4611 | |
4612 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4613 gaim_gtk_show(GaimConvWindow *win) |
4359 | 4614 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4615 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4616 |
4617 gtk_widget_show(gtkwin->window); | |
4618 } | |
4619 | |
4620 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4621 gaim_gtk_hide(GaimConvWindow *win) |
4359 | 4622 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4623 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4624 |
4625 gtk_widget_hide(gtkwin->window); | |
4626 } | |
4627 | |
4628 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4629 gaim_gtk_raise(GaimConvWindow *win) |
4359 | 4630 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4631 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4632 |
9728 | 4633 gtk_widget_show(gtkwin->window); |
4634 gtk_window_deiconify(GTK_WINDOW(gtkwin->window)); | |
4635 gdk_window_raise(gtkwin->window->window); | |
4359 | 4636 } |
4637 | |
4638 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4639 gaim_gtk_flash(GaimConvWindow *win) |
4359 | 4640 { |
4641 #ifdef _WIN32 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4642 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4643 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4644 wgaim_conv_im_blink(gtkwin->window); |
4359 | 4645 #endif |
4646 } | |
4647 | |
4648 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4649 gaim_gtk_switch_conversation(GaimConvWindow *win, unsigned int index) |
4359 | 4650 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4651 GaimGtkWindow *gtkwin; |
4359 | 4652 |
4653 gtkwin = GAIM_GTK_WINDOW(win); | |
4654 | |
4655 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), index); | |
4656 } | |
4657 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4658 static const GtkTargetEntry te[] = |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4659 { |
9525 | 4660 {"text/uri-list", 0, 0}, |
4661 {"GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, 1}, | |
4662 {"text/plain", 0, 2}, | |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4663 {"STRING", 0, 3}, |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4664 {"application/x-im-contact", 0, 4} |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4665 }; |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4666 |
4359 | 4667 static void |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4668 gaim_gtk_add_conversation(GaimConvWindow *win, GaimConversation *conv) |
4359 | 4669 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4670 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4671 GaimGtkConversation *gtkconv, *focus_gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4672 GaimConversation *focus_conv; |
4359 | 4673 GtkWidget *pane = NULL; |
4674 GtkWidget *tab_cont; | |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4675 GtkWidget *tabby, *menu_tabby; |
10053
a4ceacb1816d
[gaim-migrate @ 11016]
Luke Schierer <lschiere@pidgin.im>
parents:
10025
diff
changeset
|
4676 GtkWidget *close_image; |
4359 | 4677 gboolean new_ui; |
4383
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4678 GaimConversationType conv_type; |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4679 const char *name; |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4680 |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4681 name = gaim_conversation_get_name(conv); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4682 conv_type = gaim_conversation_get_type(conv); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4683 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4684 |
4685 if (conv->ui_data != NULL) { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4686 gtkconv = (GaimGtkConversation *)conv->ui_data; |
4359 | 4687 |
4688 tab_cont = gtkconv->tab_cont; | |
4689 | |
4690 new_ui = FALSE; | |
4691 } | |
4692 else { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4693 gtkconv = g_malloc0(sizeof(GaimGtkConversation)); |
4359 | 4694 conv->ui_data = gtkconv; |
4695 | |
4696 /* Setup some initial variables. */ | |
9749 | 4697 gtkconv->sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); |
4359 | 4698 gtkconv->tooltips = gtk_tooltips_new(); |
4699 | |
7879 | 4700 if (conv_type == GAIM_CONV_IM) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4701 gtkconv->u.im = g_malloc0(sizeof(GaimGtkImPane)); |
4359 | 4702 gtkconv->u.im->a_virgin = TRUE; |
4703 | |
4704 pane = setup_im_pane(conv); | |
4705 } | |
7879 | 4706 else if (conv_type == GAIM_CONV_CHAT) { |
4707 gtkconv->u.chat = g_malloc0(sizeof(GaimGtkChatPane)); | |
4708 | |
4709 pane = setup_chat_pane(conv); | |
4710 } | |
4359 | 4711 |
4712 if (pane == NULL) { | |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4713 if (conv_type == GAIM_CONV_CHAT) g_free(gtkconv->u.chat); |
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4714 else if (conv_type == GAIM_CONV_IM) g_free(gtkconv->u.im); |
4359 | 4715 |
4716 g_free(gtkconv); | |
4717 conv->ui_data = NULL; | |
4718 | |
4719 return; | |
4720 } | |
4721 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4722 /* Setup drag-and-drop */ |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4723 gtk_drag_dest_set(pane, |
9300 | 4724 GTK_DEST_DEFAULT_MOTION | |
4725 GTK_DEST_DEFAULT_DROP, | |
4726 te, sizeof(te) / sizeof(GtkTargetEntry), | |
4727 GDK_ACTION_COPY); | |
4728 gtk_drag_dest_set(pane, | |
4729 GTK_DEST_DEFAULT_MOTION | | |
4730 GTK_DEST_DEFAULT_DROP, | |
4731 te, sizeof(te) / sizeof(GtkTargetEntry), | |
4732 GDK_ACTION_COPY); | |
4733 gtk_drag_dest_set(gtkconv->imhtml, 0, | |
4734 te, sizeof(te) / sizeof(GtkTargetEntry), | |
4735 GDK_ACTION_COPY); | |
4736 | |
4737 gtk_drag_dest_set(gtkconv->entry, 0, | |
4738 te, sizeof(te) / sizeof(GtkTargetEntry), | |
4739 GDK_ACTION_COPY); | |
4740 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4741 g_signal_connect(G_OBJECT(pane), "drag_data_received", |
9300 | 4742 G_CALLBACK(conv_dnd_recv), conv); |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4743 g_signal_connect(G_OBJECT(gtkconv->imhtml), "drag_data_received", |
9300 | 4744 G_CALLBACK(conv_dnd_recv), conv); |
8105 | 4745 g_signal_connect(G_OBJECT(gtkconv->entry), "drag_data_received", |
9300 | 4746 G_CALLBACK(conv_dnd_recv), conv); |
4747 | |
4359 | 4748 /* Setup the container for the tab. */ |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4749 gtkconv->tab_cont = tab_cont = gtk_vbox_new(FALSE, 6); |
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4750 gtk_container_set_border_width(GTK_CONTAINER(tab_cont), 6); |
4359 | 4751 gtk_container_add(GTK_CONTAINER(tab_cont), pane); |
4752 gtk_widget_show(pane); | |
4753 | |
4754 new_ui = TRUE; | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
4755 |
4359 | 4756 gtkconv->make_sound = TRUE; |
5902
6889b89cab90
[gaim-migrate @ 6334]
Christian Hammond <chipx86@chipx86.com>
parents:
5901
diff
changeset
|
4757 |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4758 gtkconv->show_formatting_toolbar = gaim_prefs_get_bool( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4759 "/gaim/gtk/conversations/show_formatting_toolbar"); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4760 |
8329
9dd7c75ed433
[gaim-migrate @ 9053]
Christian Hammond <chipx86@chipx86.com>
parents:
8319
diff
changeset
|
4761 if (gtkconv->show_formatting_toolbar) |
9dd7c75ed433
[gaim-migrate @ 9053]
Christian Hammond <chipx86@chipx86.com>
parents:
8319
diff
changeset
|
4762 gtk_widget_show(gtkconv->toolbar); |
9dd7c75ed433
[gaim-migrate @ 9053]
Christian Hammond <chipx86@chipx86.com>
parents:
8319
diff
changeset
|
4763 |
9188 | 4764 gtkconv->show_timestamps = gaim_prefs_get_bool( |
4765 "/gaim/gtk/conversations/show_timestamps"); | |
4766 | |
4767 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
4768 gtkconv->show_timestamps); | |
4769 | |
8176 | 4770 g_signal_connect_swapped(G_OBJECT(pane), "focus", |
9080 | 4771 G_CALLBACK(gtk_widget_grab_focus), |
4772 gtkconv->entry); | |
4359 | 4773 } |
4774 | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4775 gtkconv->tabby = tabby = gtk_hbox_new(FALSE, 6); |
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4776 gtkconv->menu_tabby = menu_tabby = gtk_hbox_new(FALSE, 6); |
4359 | 4777 |
4778 /* Close button. */ | |
4779 gtkconv->close = gtk_button_new(); | |
4780 gtk_widget_set_size_request(GTK_WIDGET(gtkconv->close), 16, 16); | |
7446
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4781 gtk_button_set_relief(GTK_BUTTON(gtkconv->close), GTK_RELIEF_NONE); |
10053
a4ceacb1816d
[gaim-migrate @ 11016]
Luke Schierer <lschiere@pidgin.im>
parents:
10025
diff
changeset
|
4782 close_image = gtk_image_new_from_stock(GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU); |
a4ceacb1816d
[gaim-migrate @ 11016]
Luke Schierer <lschiere@pidgin.im>
parents:
10025
diff
changeset
|
4783 gtk_widget_show(close_image); |
a4ceacb1816d
[gaim-migrate @ 11016]
Luke Schierer <lschiere@pidgin.im>
parents:
10025
diff
changeset
|
4784 gtk_container_add(GTK_CONTAINER(gtkconv->close), close_image); |
4359 | 4785 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->close, |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4786 _("Close conversation"), NULL); |
4359 | 4787 |
4788 g_signal_connect(G_OBJECT(gtkconv->close), "clicked", | |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4789 G_CALLBACK(close_conv_cb), conv); |
4359 | 4790 |
7446
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4791 /* |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4792 * I love Galeon. They have a fix for that stupid annoying visible |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4793 * border bug. I love you guys! -- ChipX86 |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4794 */ |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4795 g_signal_connect(G_OBJECT(gtkconv->close), "state_changed", |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4796 G_CALLBACK(tab_close_button_state_changed_cb), NULL); |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4797 |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4798 /* Status icon. */ |
6440 | 4799 gtkconv->icon = gtk_image_new(); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4800 gtkconv->menu_icon = gtk_image_new(); |
6440 | 4801 update_tab_icon(conv); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4802 |
4359 | 4803 /* Tab label. */ |
4804 gtkconv->tab_label = gtk_label_new(gaim_conversation_get_title(conv)); | |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4805 gtkconv->menu_label = gtk_label_new(gaim_conversation_get_title(conv)); |
4359 | 4806 #if 0 |
4807 gtk_misc_set_alignment(GTK_MISC(gtkconv->tab_label), 0.00, 0.5); | |
4808 gtk_misc_set_padding(GTK_MISC(gtkconv->tab_label), 4, 0); | |
4809 #endif | |
4810 | |
4811 /* Pack it all together. */ | |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4812 gtk_box_pack_start(GTK_BOX(tabby), gtkconv->icon, FALSE, FALSE, 0); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4813 gtk_box_pack_start(GTK_BOX(menu_tabby), gtkconv->menu_icon, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4814 FALSE, FALSE, 0); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4815 |
8946 | 4816 gtk_widget_show_all(gtkconv->icon); |
4817 gtk_widget_show_all(gtkconv->menu_icon); | |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4818 |
4359 | 4819 gtk_box_pack_start(GTK_BOX(tabby), gtkconv->tab_label, TRUE, TRUE, 0); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4820 gtk_box_pack_start(GTK_BOX(menu_tabby), gtkconv->menu_label, TRUE, TRUE, 0); |
4445 | 4821 gtk_widget_show(gtkconv->tab_label); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4822 gtk_widget_show(gtkconv->menu_label); |
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4823 gtk_misc_set_alignment(GTK_MISC(gtkconv->menu_label), 0, 0); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4824 |
4445 | 4825 gtk_box_pack_start(GTK_BOX(tabby), gtkconv->close, FALSE, FALSE, 0); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4826 if (gaim_prefs_get_bool("/gaim/gtk/conversations/close_on_tabs")) |
10053
a4ceacb1816d
[gaim-migrate @ 11016]
Luke Schierer <lschiere@pidgin.im>
parents:
10025
diff
changeset
|
4827 gtk_widget_show(gtkconv->close); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4828 |
4445 | 4829 gtk_widget_show(tabby); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4830 gtk_widget_show(menu_tabby); |
4359 | 4831 |
7143 | 4832 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
4833 gaim_gtkconv_update_buddy_icon(conv); | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4834 |
9297 | 4835 /* Add this pane to the conversation's notebook. */ |
9606 | 4836 gtk_notebook_append_page_menu(GTK_NOTEBOOK(gtkwin->notebook), tab_cont, tabby, menu_tabby); |
4359 | 4837 |
4838 gtk_widget_show(tab_cont); | |
4839 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4840 if (gaim_conv_window_get_conversation_count(win) == 1) { |
4818 | 4841 /* Er, bug in notebooks? Switch to the page manually. */ |
4359 | 4842 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), 0); |
4851 | 4843 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4844 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4845 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4846 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4847 else |
4818 | 4848 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), TRUE); |
4359 | 4849 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4850 focus_conv = g_list_nth_data(gaim_conv_window_get_conversations(win), |
5204 | 4851 gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook))); |
4852 focus_gtkconv = GAIM_GTK_CONVERSATION(focus_conv); | |
4853 gtk_widget_grab_focus(focus_gtkconv->entry); | |
4359 | 4854 |
4855 if (!new_ui) | |
4856 g_object_unref(gtkconv->tab_cont); | |
4857 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4858 if (gaim_conv_window_get_conversation_count(win) == 1) |
4685 | 4859 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); |
4359 | 4860 } |
4861 | |
4862 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4863 gaim_gtk_remove_conversation(GaimConvWindow *win, GaimConversation *conv) |
4359 | 4864 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4865 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4866 GaimGtkConversation *gtkconv; |
4359 | 4867 unsigned int index; |
4818 | 4868 GaimConversationType conv_type; |
4869 | |
4870 conv_type = gaim_conversation_get_type(conv); | |
4359 | 4871 index = gaim_conversation_get_index(conv); |
4872 | |
4873 gtkwin = GAIM_GTK_WINDOW(win); | |
4874 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4875 | |
4876 g_object_ref(gtkconv->tab_cont); | |
4877 gtk_object_sink(GTK_OBJECT(gtkconv->tab_cont)); | |
4878 | |
4879 gtk_notebook_remove_page(GTK_NOTEBOOK(gtkwin->notebook), index); | |
4880 | |
4818 | 4881 /* go back to tabless if need be */ |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4882 if (gaim_conv_window_get_conversation_count(win) <= 2) { |
4818 | 4883 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4884 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); |
4818 | 4885 } |
4886 | |
4887 | |
4359 | 4888 /* If this window is setup with an inactive gc, regenerate the menu. */ |
4818 | 4889 if (conv_type == GAIM_CONV_IM && |
4359 | 4890 gaim_conversation_get_gc(conv) == NULL) { |
4891 | |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
4892 generate_send_as_items(win, conv); |
4359 | 4893 } |
4894 } | |
4895 | |
4896 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4897 gaim_gtk_move_conversation(GaimConvWindow *win, GaimConversation *conv, |
4359 | 4898 unsigned int new_index) |
4899 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4900 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4901 GaimGtkConversation *gtkconv; |
4359 | 4902 |
4903 gtkwin = GAIM_GTK_WINDOW(win); | |
4904 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4905 | |
4415
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4906 if (new_index > gaim_conversation_get_index(conv)) |
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4907 new_index--; |
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4908 |
4359 | 4909 gtk_notebook_reorder_child(GTK_NOTEBOOK(gtkwin->notebook), |
4910 gtkconv->tab_cont, new_index); | |
4911 } | |
4912 | |
4913 static int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4914 gaim_gtk_get_active_index(const GaimConvWindow *win) |
4359 | 4915 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4916 GaimGtkWindow *gtkwin; |
5680
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4917 int index; |
4359 | 4918 |
4919 gtkwin = GAIM_GTK_WINDOW(win); | |
4920 | |
5680
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4921 index = gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook)); |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4922 |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4923 /* |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4924 * A fix, because the first conversation may be active, but not |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4925 * appear in the notebook just yet. -- ChipX86 |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4926 */ |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4927 return (index == -1 ? 0 : index); |
4359 | 4928 } |
4929 | |
9260
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4930 static gboolean |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4931 gaim_gtk_has_focus(GaimConvWindow *win) |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4932 { |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4933 GaimGtkWindow *gtkwin; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4934 gboolean has_focus = FALSE; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4935 |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4936 gtkwin = GAIM_GTK_WINDOW(win); |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4937 g_object_get(G_OBJECT(gtkwin->window), "has-toplevel-focus", &has_focus, NULL); |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4938 |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4939 return has_focus; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4940 } |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4941 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4942 static GaimConvWindowUiOps window_ui_ops = |
4359 | 4943 { |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
4944 gaim_gtk_conversations_get_conv_ui_ops, |
4359 | 4945 gaim_gtk_new_window, |
4946 gaim_gtk_destroy_window, | |
4947 gaim_gtk_show, | |
4948 gaim_gtk_hide, | |
4949 gaim_gtk_raise, | |
4950 gaim_gtk_flash, | |
4951 gaim_gtk_switch_conversation, | |
4952 gaim_gtk_add_conversation, | |
4953 gaim_gtk_remove_conversation, | |
4954 gaim_gtk_move_conversation, | |
9260
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4955 gaim_gtk_get_active_index, |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4956 gaim_gtk_has_focus |
4359 | 4957 }; |
4958 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4959 GaimConvWindowUiOps * |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
4960 gaim_gtk_conversations_get_win_ui_ops(void) |
4359 | 4961 { |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4962 return &window_ui_ops; |
4359 | 4963 } |
4964 | |
4965 /************************************************************************** | |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4966 * Conversation UI operations |
4359 | 4967 **************************************************************************/ |
4968 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4969 gaim_gtkconv_destroy(GaimConversation *conv) |
4359 | 4970 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4971 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); |
4359 | 4972 |
9504 | 4973 /* If the "Save Conversation" or "Save Icon" dialogs are open then close them */ |
4974 gaim_request_close_with_handle(conv); | |
4359 | 4975 |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4976 gtk_widget_destroy(gtkconv->tab_cont); |
4892 | 4977 g_object_unref(gtkconv->tab_cont); |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4978 |
4359 | 4979 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
4755 | 4980 if (gtkconv->u.im->icon_timer != 0) |
4981 g_source_remove(gtkconv->u.im->icon_timer); | |
4982 | |
4359 | 4983 if (gtkconv->u.im->anim != NULL) |
4793 | 4984 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); |
4359 | 4985 |
4986 g_free(gtkconv->u.im); | |
4987 } | |
4988 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
4989 g_free(gtkconv->u.chat); | |
4990 } | |
4991 | |
4633 | 4992 gtk_object_sink(GTK_OBJECT(gtkconv->tooltips)); |
4993 | |
4359 | 4994 g_free(gtkconv); |
4995 } | |
4996 | |
4997 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4998 gaim_gtkconv_write_im(GaimConversation *conv, const char *who, |
6982 | 4999 const char *message, GaimMessageFlags flags, |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5000 time_t mtime) |
4359 | 5001 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5002 GaimGtkConversation *gtkconv; |
8630 | 5003 GaimConvWindow *gaimwin; |
5004 GaimGtkWindow *gtkwin; | |
5005 gboolean has_focus; | |
4359 | 5006 |
5007 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
8630 | 5008 gaimwin = gaim_conversation_get_window(conv); |
5009 gtkwin = GAIM_GTK_WINDOW(gaimwin); | |
5010 | |
5011 g_object_get(G_OBJECT(gtkwin->window), "has-toplevel-focus", &has_focus, NULL); | |
4359 | 5012 |
6621 | 5013 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
9301 | 5014 gaim_prefs_get_bool("/gaim/gtk/conversations/im/raise_on_events")) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5015 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5016 gaim_conv_window_raise(gaim_conversation_get_window(conv)); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5017 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5018 |
4382
76223649765b
[gaim-migrate @ 4648]
Christian Hammond <chipx86@chipx86.com>
parents:
4378
diff
changeset
|
5019 /* Play a sound, if specified in prefs. */ |
8630 | 5020 if (gtkconv->make_sound && !((gaim_conv_window_get_active_conversation(gaimwin) == conv) && |
8633 | 5021 !gaim_prefs_get_bool("/gaim/gtk/sound/conv_focus") && has_focus)) { |
6621 | 5022 if (flags & GAIM_MESSAGE_RECV) { |
4359 | 5023 if (gtkconv->u.im->a_virgin && |
5820 | 5024 gaim_prefs_get_bool("/gaim/gtk/sound/enabled/first_im_recv")) { |
4359 | 5025 |
4561 | 5026 gaim_sound_play_event(GAIM_SOUND_FIRST_RECEIVE); |
4359 | 5027 } |
5028 else | |
4561 | 5029 gaim_sound_play_event(GAIM_SOUND_RECEIVE); |
4359 | 5030 } |
5031 else { | |
4561 | 5032 gaim_sound_play_event(GAIM_SOUND_SEND); |
4359 | 5033 } |
5034 } | |
5035 | |
5036 gtkconv->u.im->a_virgin = FALSE; | |
5037 | |
6982 | 5038 gaim_conversation_write(conv, who, message, flags, mtime); |
4359 | 5039 } |
5040 | |
5041 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5042 gaim_gtkconv_write_chat(GaimConversation *conv, const char *who, |
6621 | 5043 const char *message, GaimMessageFlags flags, time_t mtime) |
4359 | 5044 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5045 GaimGtkConversation *gtkconv; |
8630 | 5046 GaimConvWindow *gaimwin; |
5047 GaimGtkWindow *gtkwin; | |
5048 gboolean has_focus; | |
4359 | 5049 |
5050 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
8630 | 5051 gaimwin = gaim_conversation_get_window(conv); |
5052 gtkwin = GAIM_GTK_WINDOW(gaimwin); | |
5053 | |
5054 g_object_get(G_OBJECT(gtkwin->window), "has-toplevel-focus", &has_focus, NULL); | |
4359 | 5055 |
4382
76223649765b
[gaim-migrate @ 4648]
Christian Hammond <chipx86@chipx86.com>
parents:
4378
diff
changeset
|
5056 /* Play a sound, if specified in prefs. */ |
8630 | 5057 if (gtkconv->make_sound && !((gaim_conv_window_get_active_conversation(gaimwin) == conv) && |
9704 | 5058 !gaim_prefs_get_bool("/gaim/gtk/sound/conv_focus") && has_focus) && |
5059 !(flags & GAIM_MESSAGE_DELAYED) && | |
5060 !(flags & GAIM_MESSAGE_SYSTEM)) { | |
5061 | |
6621 | 5062 if (!(flags & GAIM_MESSAGE_WHISPER) && (flags & GAIM_MESSAGE_SEND)) |
4561 | 5063 gaim_sound_play_event(GAIM_SOUND_CHAT_YOU_SAY); |
9704 | 5064 else if (flags & GAIM_MESSAGE_RECV) { |
6621 | 5065 if ((flags & GAIM_MESSAGE_NICK) && |
9584 | 5066 gaim_prefs_get_bool("/gaim/gtk/sound/enabled/nick_said")) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5067 |
4561 | 5068 gaim_sound_play_event(GAIM_SOUND_CHAT_NICK); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5069 } |
4359 | 5070 else |
4561 | 5071 gaim_sound_play_event(GAIM_SOUND_CHAT_SAY); |
4359 | 5072 } |
5073 } | |
5074 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5075 if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/color_nicks")) |
6621 | 5076 flags |= GAIM_MESSAGE_COLORIZE; |
4359 | 5077 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5078 /* Raise the window, if specified in prefs. */ |
6621 | 5079 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
9150 | 5080 /* we may want to change this */ |
9301 | 5081 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5082 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5083 gaim_conv_window_raise(gaim_conversation_get_window(conv)); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5084 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5085 |
6982 | 5086 gaim_conversation_write(conv, who, message, flags, mtime); |
4359 | 5087 } |
5088 | |
5089 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5090 gaim_gtkconv_write_conv(GaimConversation *conv, const char *who, |
6982 | 5091 const char *message, GaimMessageFlags flags, |
4359 | 5092 time_t mtime) |
5093 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5094 GaimGtkConversation *gtkconv; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5095 GaimConvWindow *win; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
5096 GaimConnection *gc; |
4359 | 5097 int gtk_font_options = 0; |
7440 | 5098 char buf[BUF_LONG]; |
4359 | 5099 char buf2[BUF_LONG]; |
5100 char mdate[64]; | |
5101 char color[10]; | |
5102 char *str; | |
5103 char *with_font_tag; | |
4896 | 5104 char *sml_attrib = NULL; |
6982 | 5105 size_t length = strlen(message) + 1; |
4895 | 5106 |
4359 | 5107 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5108 gc = gaim_conversation_get_gc(conv); | |
5109 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5110 win = gaim_conversation_get_window(conv); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5111 |
9301 | 5112 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
5113 ((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT && | |
5114 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) || | |
5115 (gaim_conversation_get_type(conv) == GAIM_CONV_IM && | |
5116 gaim_prefs_get_bool("/gaim/gtk/conversations/im/raise_on_events")))) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5117 gaim_conv_window_show(win); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5118 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5119 |
8677 | 5120 if (gtk_text_buffer_get_char_count(gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)))) |
5121 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", 0); | |
5122 | |
5133 | 5123 if(time(NULL) > mtime + 20*60) /* show date if older than 20 minutes */ |
5124 strftime(mdate, sizeof(mdate), "%Y-%m-%d %H:%M:%S", localtime(&mtime)); | |
5125 else | |
5126 strftime(mdate, sizeof(mdate), "%H:%M:%S", localtime(&mtime)); | |
4359 | 5127 |
4896 | 5128 if(gc) |
9699 | 5129 sml_attrib = g_strdup_printf("sml=\"%s\"", |
5130 gaim_account_get_protocol_name(conv->account)); | |
7440 | 5131 |
4359 | 5132 gtk_font_options ^= GTK_IMHTML_NO_COMMENTS; |
5133 | |
9049 | 5134 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_colors")) |
5135 gtk_font_options ^= GTK_IMHTML_NO_COLOURS; | |
5136 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_fonts")) | |
5137 gtk_font_options ^= GTK_IMHTML_NO_FONTS; | |
5138 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_font_sizes")) | |
5139 gtk_font_options ^= GTK_IMHTML_NO_SIZES; | |
4359 | 5140 |
7956 | 5141 /* this is gonna crash one day, I can feel it. */ |
5142 if (GAIM_PLUGIN_PROTOCOL_INFO(gaim_find_prpl(gaim_account_get_protocol_id(conv->account)))->options & | |
7431 | 5143 OPT_PROTO_USE_POINTSIZE) { |
5367 | 5144 gtk_font_options ^= GTK_IMHTML_USE_POINTSIZE; |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5145 } |
4359 | 5146 |
6621 | 5147 if (flags & GAIM_MESSAGE_SYSTEM) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5148 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) |
8380 | 5149 g_snprintf(buf, BUF_LONG, "<FONT SIZE=\"2\">(%s)</FONT> <B>%s</B>", |
7431 | 5150 mdate, message); |
4359 | 5151 else |
5152 g_snprintf(buf, BUF_LONG, "<B>%s</B>", message); | |
7440 | 5153 |
4359 | 5154 g_snprintf(buf2, sizeof(buf2), |
8690 | 5155 "<FONT %s><FONT SIZE=\"2\"><!--(%s) --></FONT><B>%s</B></FONT>", |
7850 | 5156 sml_attrib, mdate, message); |
7440 | 5157 |
8962 | 5158 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, 0); |
7440 | 5159 |
7583 | 5160 /* Add the message to a conversations scrollback buffer */ |
5161 conv->history = g_string_append(conv->history, buf); | |
5162 conv->history = g_string_append(conv->history, "<BR>\n"); | |
7440 | 5163 |
8722 | 5164 } else if (flags & GAIM_MESSAGE_ERROR) { |
5165 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) | |
9627 | 5166 g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"#ff0000\"><FONT SIZE=\"2\">(%s)</FONT> <B>%s</B></FONT>", |
8722 | 5167 mdate, message); |
5168 else | |
5169 g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"#ff0000\"><B>%s</B></FONT>", message); | |
9554 | 5170 |
8722 | 5171 g_snprintf(buf2, sizeof(buf2), |
9627 | 5172 "<FONT COLOR=\"#ff0000\"><FONT %s><FONT SIZE=\"2\"><!--(%s) --></FONT><B>%s</B></FONT></FONT>", |
8722 | 5173 sml_attrib, mdate, message); |
9554 | 5174 |
8962 | 5175 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, 0); |
5176 | |
8722 | 5177 /* Add the message to a conversations scrollback buffer */ |
5178 conv->history = g_string_append(conv->history, buf); | |
5179 conv->history = g_string_append(conv->history, "<BR>\n"); | |
7431 | 5180 } else if (flags & GAIM_MESSAGE_NO_LOG) { |
4359 | 5181 g_snprintf(buf, BUF_LONG, |
8690 | 5182 "<B><FONT %s COLOR=\"#777777\">%s</FONT></B>", |
7850 | 5183 sml_attrib, message); |
7440 | 5184 |
8962 | 5185 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf, 0); |
4359 | 5186 } |
5187 else { | |
4895 | 5188 char *new_message = g_memdup(message, length); |
9613 | 5189 char *who_escaped = (who ? g_markup_escape_text(who, strlen(who)) : g_strdup("")); |
7440 | 5190 |
6621 | 5191 if (flags & GAIM_MESSAGE_WHISPER) { |
4359 | 5192 str = g_malloc(1024); |
7440 | 5193 |
4359 | 5194 /* If we're whispering, it's not an autoresponse. */ |
7564 | 5195 if (gaim_message_meify(new_message, length)) { |
8908 | 5196 g_snprintf(str, 1024, "***%s", who_escaped); |
4359 | 5197 strcpy(color, "#6C2585"); |
5198 } | |
5199 else { | |
8908 | 5200 g_snprintf(str, 1024, "*%s*:", who_escaped); |
4359 | 5201 strcpy(color, "#00FF00"); |
5202 } | |
7440 | 5203 } |
4359 | 5204 else { |
7564 | 5205 if (gaim_message_meify(new_message, length)) { |
4359 | 5206 str = g_malloc(1024); |
7440 | 5207 |
6621 | 5208 if (flags & GAIM_MESSAGE_AUTO_RESP) |
8908 | 5209 g_snprintf(str, 1024, "%s ***%s", AUTO_RESPONSE, who_escaped); |
4359 | 5210 else |
8908 | 5211 g_snprintf(str, 1024, "***%s", who_escaped); |
7440 | 5212 |
6621 | 5213 if (flags & GAIM_MESSAGE_NICK) |
4359 | 5214 strcpy(color, "#AF7F00"); |
5215 else | |
5216 strcpy(color, "#062585"); | |
5217 } | |
5218 else { | |
5219 str = g_malloc(1024); | |
6621 | 5220 if (flags & GAIM_MESSAGE_AUTO_RESP) |
8908 | 5221 g_snprintf(str, 1024, "%s %s", who_escaped, AUTO_RESPONSE); |
4359 | 5222 else |
8908 | 5223 g_snprintf(str, 1024, "%s:", who_escaped); |
6621 | 5224 if (flags & GAIM_MESSAGE_NICK) |
4359 | 5225 strcpy(color, "#AF7F00"); |
6621 | 5226 else if (flags & GAIM_MESSAGE_RECV) { |
5227 if (flags & GAIM_MESSAGE_COLORIZE) { | |
4359 | 5228 const char *u; |
5229 int m = 0; | |
7440 | 5230 |
4359 | 5231 for (u = who; *u != '\0'; u++) |
5232 m += *u; | |
7440 | 5233 |
4359 | 5234 m = m % NUM_NICK_COLORS; |
7440 | 5235 |
4359 | 5236 strcpy(color, nick_colors[m]); |
5237 } | |
5238 else | |
7854 | 5239 strcpy(color, RECV_COLOR); |
4359 | 5240 } |
6621 | 5241 else if (flags & GAIM_MESSAGE_SEND) |
7854 | 5242 strcpy(color, SEND_COLOR); |
4359 | 5243 } |
8908 | 5244 |
5245 if(who_escaped) | |
5246 g_free(who_escaped); | |
4359 | 5247 } |
7440 | 5248 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5249 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) |
4359 | 5250 g_snprintf(buf, BUF_LONG, |
8380 | 5251 "<FONT COLOR=\"%s\" %s><FONT SIZE=\"2\">(%s)</FONT> " |
7431 | 5252 "<B>%s</B></FONT> ", color, |
5253 sml_attrib ? sml_attrib : "", mdate, str); | |
4359 | 5254 else |
5255 g_snprintf(buf, BUF_LONG, | |
7431 | 5256 "<FONT COLOR=\"%s\" %s><B>%s</B></FONT> ", color, |
5257 sml_attrib ? sml_attrib : "", str); | |
7440 | 5258 |
4359 | 5259 g_snprintf(buf2, BUF_LONG, |
8380 | 5260 "<FONT COLOR=\"%s\" %s><FONT SIZE=\"2\"><!--(%s) --></FONT>" |
7431 | 5261 "<B>%s</B></FONT> ", |
5262 color, sml_attrib ? sml_attrib : "", mdate, str); | |
7440 | 5263 |
4359 | 5264 g_free(str); |
5265 | |
8962 | 5266 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), |
5267 buf2, 0); | |
4359 | 5268 |
4895 | 5269 if(gc){ |
4896 | 5270 char *pre = g_strdup_printf("<font %s>", sml_attrib ? sml_attrib : ""); |
4895 | 5271 char *post = "</font>"; |
5272 int pre_len = strlen(pre); | |
5273 int post_len = strlen(post); | |
7440 | 5274 |
4895 | 5275 with_font_tag = g_malloc(length + pre_len + post_len + 1); |
7440 | 5276 |
4895 | 5277 strcpy(with_font_tag, pre); |
5278 memcpy(with_font_tag + pre_len, new_message, length); | |
5279 strcpy(with_font_tag + pre_len + length, post); | |
7440 | 5280 |
4895 | 5281 length += pre_len + post_len; |
5282 g_free(pre); | |
5283 } | |
4608 | 5284 else |
4895 | 5285 with_font_tag = g_memdup(new_message, length); |
7440 | 5286 |
8962 | 5287 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), |
5288 with_font_tag, gtk_font_options); | |
7440 | 5289 |
8557 | 5290 conv->history = g_string_append(conv->history, buf); |
5291 conv->history = g_string_append(conv->history, new_message); | |
5292 conv->history = g_string_append(conv->history, "<BR>\n"); | |
7440 | 5293 |
5294 g_free(with_font_tag); | |
7447 | 5295 g_free(new_message); |
7440 | 5296 } |
5297 | |
6062 | 5298 |
5012 | 5299 if(sml_attrib) |
5300 g_free(sml_attrib); | |
4359 | 5301 } |
5302 | |
5303 static void | |
9846 | 5304 gaim_gtkconv_chat_add_user(GaimConversation *conv, const char *user, gboolean new_arrival) |
4359 | 5305 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5306 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5307 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5308 GaimGtkChatPane *gtkchat; |
4359 | 5309 char tmp[BUF_LONG]; |
5310 int num_users; | |
5311 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5312 chat = GAIM_CONV_CHAT(conv); |
4359 | 5313 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5314 gtkchat = gtkconv->u.chat; | |
5315 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5316 num_users = g_list_length(gaim_conv_chat_get_users(chat)); |
4359 | 5317 |
5318 g_snprintf(tmp, sizeof(tmp), | |
5319 ngettext("%d person in room", "%d people in room", | |
5320 num_users), | |
5321 num_users); | |
5322 | |
5323 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); | |
5324 | |
9846 | 5325 if (gtkconv->make_sound && new_arrival) |
4561 | 5326 gaim_sound_play_event(GAIM_SOUND_CHAT_JOIN); |
4359 | 5327 |
9554 | 5328 add_chat_buddy_common(conv, user); |
4359 | 5329 } |
5330 | |
5331 static void | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5332 gaim_gtkconv_chat_add_users(GaimConversation *conv, GList *users) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5333 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5334 GaimConvChat *chat; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5335 GaimGtkConversation *gtkconv; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5336 GaimGtkChatPane *gtkchat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5337 GList *l; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5338 char tmp[BUF_LONG]; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5339 int num_users; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5340 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5341 chat = GAIM_CONV_CHAT(conv); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5342 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5343 gtkchat = gtkconv->u.chat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5344 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5345 num_users = g_list_length(gaim_conv_chat_get_users(chat)); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5346 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5347 g_snprintf(tmp, sizeof(tmp), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5348 ngettext("%d person in room", "%d people in room", |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5349 num_users), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5350 num_users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5351 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5352 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5353 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5354 for (l = users; l != NULL; l = l->next) { |
9554 | 5355 add_chat_buddy_common(conv, (char *)l->data); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5356 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5357 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5358 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5359 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5360 gaim_gtkconv_chat_rename_user(GaimConversation *conv, const char *old_name, |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5361 const char *new_name) |
4359 | 5362 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5363 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5364 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5365 GaimGtkChatPane *gtkchat; |
4359 | 5366 GtkTreeIter iter; |
5367 GtkTreeModel *model; | |
5368 int f = 1; | |
5369 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5370 chat = GAIM_CONV_CHAT(conv); |
4359 | 5371 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5372 gtkchat = gtkconv->u.chat; | |
5373 | |
9554 | 5374 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
5375 | |
5376 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
5377 return; | |
5378 | |
5379 while (f != 0) { | |
5380 char *val; | |
5381 | |
5382 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &val, -1); | |
5383 | |
5384 if (!gaim_utf8_strcasecmp(old_name, val)) { | |
5385 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); | |
5386 g_free(val); | |
4359 | 5387 break; |
5388 } | |
9554 | 5389 |
5390 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
5391 | |
5392 g_free(val); | |
4359 | 5393 } |
5394 | |
9554 | 5395 if (!gaim_conv_chat_find_user(chat, old_name)) |
4359 | 5396 return; |
5397 | |
9554 | 5398 add_chat_buddy_common(conv, new_name); |
4359 | 5399 } |
5400 | |
5401 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5402 gaim_gtkconv_chat_remove_user(GaimConversation *conv, const char *user) |
4359 | 5403 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5404 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5405 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5406 GaimGtkChatPane *gtkchat; |
4359 | 5407 GtkTreeIter iter; |
5408 GtkTreeModel *model; | |
5409 char tmp[BUF_LONG]; | |
5410 int num_users; | |
5411 int f = 1; | |
5412 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5413 chat = GAIM_CONV_CHAT(conv); |
4359 | 5414 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5415 gtkchat = gtkconv->u.chat; | |
5416 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5417 num_users = g_list_length(gaim_conv_chat_get_users(chat)) - 1; |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5418 |
9554 | 5419 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
5420 | |
5421 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
5422 return; | |
5423 | |
5424 while (f != 0) { | |
5425 char *val; | |
5426 | |
5427 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &val, -1); | |
5428 | |
5429 if (!gaim_utf8_strcasecmp(user, val)) { | |
5430 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); | |
5431 g_free(val); | |
4359 | 5432 break; |
5433 } | |
9554 | 5434 |
5435 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
5436 | |
5437 g_free(val); | |
4359 | 5438 } |
5439 | |
9554 | 5440 if (!gaim_conv_chat_find_user(chat, user)) |
4359 | 5441 return; |
5442 | |
5443 g_snprintf(tmp, sizeof(tmp), | |
9554 | 5444 ngettext("%d person in room", "%d people in room", |
5445 num_users), num_users); | |
4359 | 5446 |
5447 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); | |
5448 | |
5449 if (gtkconv->make_sound) | |
4561 | 5450 gaim_sound_play_event(GAIM_SOUND_CHAT_LEAVE); |
4359 | 5451 } |
5452 | |
5453 static void | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5454 gaim_gtkconv_chat_remove_users(GaimConversation *conv, GList *users) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5455 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5456 GaimConvChat *chat; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5457 GaimGtkConversation *gtkconv; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5458 GaimGtkChatPane *gtkchat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5459 GtkTreeIter iter; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5460 GtkTreeModel *model; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5461 GList *l; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5462 char tmp[BUF_LONG]; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5463 int num_users; |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
5464 gboolean f; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5465 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5466 chat = GAIM_CONV_CHAT(conv); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5467 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5468 gtkchat = gtkconv->u.chat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5469 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5470 num_users = g_list_length(gaim_conv_chat_get_users(chat)) - |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5471 g_list_length(users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5472 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5473 for (l = users; l != NULL; l = l->next) { |
9554 | 5474 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
5475 | |
5476 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), | |
5477 &iter)) | |
5478 continue; | |
5479 | |
5480 do { | |
5481 char *val; | |
5482 | |
5483 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, | |
5484 CHAT_USERS_NAME_COLUMN, &val, -1); | |
5485 | |
9696 | 5486 if (!gaim_utf8_strcasecmp((char *)l->data, val)) { |
5487 #if GTK_CHECK_VERSION(2,2,0) | |
9554 | 5488 f = gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
9696 | 5489 #else |
5490 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); | |
5491 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
5492 #endif | |
5493 } | |
9554 | 5494 else |
5495 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
5496 | |
5497 g_free(val); | |
5498 } while (f); | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5499 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5500 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5501 g_snprintf(tmp, sizeof(tmp), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5502 ngettext("%d person in room", "%d people in room", |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5503 num_users), num_users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5504 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5505 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5506 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5507 |
9554 | 5508 static void |
5509 gaim_gtkconv_chat_update_user(GaimConversation *conv, const char *user) | |
5510 { | |
5511 GaimConvChat *chat; | |
5512 GaimGtkConversation *gtkconv; | |
5513 GaimGtkChatPane *gtkchat; | |
5514 GtkTreeIter iter; | |
5515 GtkTreeModel *model; | |
5516 int f = 1; | |
5517 | |
5518 chat = GAIM_CONV_CHAT(conv); | |
5519 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5520 gtkchat = gtkconv->u.chat; | |
5521 | |
5522 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | |
5523 | |
5524 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
5525 return; | |
5526 | |
5527 while (f != 0) { | |
5528 char *val; | |
5529 | |
5530 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &val, -1); | |
5531 | |
5532 if (!gaim_utf8_strcasecmp(user, val)) { | |
5533 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); | |
5534 g_free(val); | |
5535 break; | |
5536 } | |
5537 | |
5538 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
5539 | |
5540 g_free(val); | |
5541 } | |
5542 | |
5543 if (!gaim_conv_chat_find_user(chat, user)) | |
5544 return; | |
5545 | |
5546 add_chat_buddy_common(conv, user); | |
5547 } | |
5548 | |
9260
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5549 static gboolean |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5550 gaim_gtkconv_has_focus(GaimConversation *conv) |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5551 { |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5552 GaimConvWindow *win; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5553 GaimGtkWindow *gtkwin; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5554 gboolean has_focus; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5555 |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5556 win = gaim_conversation_get_window(conv); |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5557 gtkwin = GAIM_GTK_WINDOW(win); |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5558 |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5559 g_object_get(G_OBJECT(gtkwin->window), "has-toplevel-focus", &has_focus, NULL); |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5560 |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5561 return has_focus; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5562 } |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5563 |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5564 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5565 gaim_gtkconv_updated(GaimConversation *conv, GaimConvUpdateType type) |
4359 | 5566 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5567 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5568 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5569 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5570 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5571 GaimConvChat *chat; |
4359 | 5572 |
5573 win = gaim_conversation_get_window(conv); | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5574 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 5575 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5576 | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5577 if (type == GAIM_CONV_UPDATE_ACCOUNT) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5578 { |
4359 | 5579 gaim_conversation_autoset_title(conv); |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5580 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5581 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5582 gaim_gtkconv_update_buddy_icon(conv); |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5583 |
4359 | 5584 gaim_gtkconv_update_buttons_by_protocol(conv); |
5585 | |
4685 | 5586 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); |
4359 | 5587 |
5588 smiley_themeize(gtkconv->imhtml); | |
6394 | 5589 |
6395 | 5590 update_tab_icon(conv); |
4359 | 5591 } |
5592 else if (type == GAIM_CONV_UPDATE_TYPING || | |
8155
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5593 type == GAIM_CONV_UPDATE_UNSEEN || |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5594 type == GAIM_CONV_UPDATE_TITLE) |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5595 { |
9472 | 5596 char *title; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5597 GaimConvIm *im = NULL; |
9472 | 5598 GaimConnection *gc = gaim_conversation_get_gc(conv); |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5599 char color[8]; |
4736 | 5600 |
4359 | 5601 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5602 im = GAIM_CONV_IM(conv); |
4359 | 5603 |
9472 | 5604 if (!gc || ((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) |
5605 && gaim_conv_chat_has_left(GAIM_CONV_CHAT(conv)))) | |
5606 title = g_strdup_printf("(%s)", gaim_conversation_get_title(conv)); | |
5607 | |
5608 else | |
5609 title = g_strdup(gaim_conversation_get_title(conv)); | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5610 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5611 *color = '\0'; |
4359 | 5612 |
5613 if (!GTK_WIDGET_REALIZED(gtkconv->tab_label)) | |
5614 gtk_widget_realize(gtkconv->tab_label); | |
5615 | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5616 if (im != NULL && gaim_conv_im_get_typing_state(im) == GAIM_TYPING) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5617 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5618 strcpy(color, "#47A046"); |
4359 | 5619 } |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5620 else if (im != NULL && gaim_conv_im_get_typing_state(im) == GAIM_TYPED) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5621 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5622 strcpy(color, "#D1940C"); |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5623 } |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5624 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_NICK) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5625 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5626 strcpy(color, "#314E6C"); |
4359 | 5627 } |
8252 | 5628 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_TEXT) |
5629 { | |
5630 strcpy(color, "#DF421E"); | |
5631 } | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5632 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_EVENT) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5633 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5634 strcpy(color, "#868272"); |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5635 } |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5636 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5637 if (*color != '\0') |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5638 { |
8536 | 5639 char *html_title,*label; |
5640 | |
5641 html_title = gaim_escape_html(title); | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5642 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5643 label = g_strdup_printf("<span color=\"%s\">%s</span>", |
8536 | 5644 color, html_title); |
5645 g_free(html_title); | |
7995
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
5646 gtk_label_set_markup(GTK_LABEL(gtkconv->tab_label), label); |
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
5647 g_free(label); |
4359 | 5648 } |
7995
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
5649 else |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5650 gtk_label_set_text(GTK_LABEL(gtkconv->tab_label), title); |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5651 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5652 if (conv == gaim_conv_window_get_active_conversation(win)) |
4736 | 5653 update_typing_icon(conv); |
8155
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5654 |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5655 if (type == GAIM_CONV_UPDATE_TITLE) { |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5656 gtk_label_set_text(GTK_LABEL(gtkconv->menu_label), title); |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5657 if (conv == gaim_conv_window_get_active_conversation(win)) |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5658 gtk_window_set_title(GTK_WINDOW(gtkwin->window), title); |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5659 } |
9472 | 5660 |
5661 g_free(title); | |
4359 | 5662 } |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5663 else if (type == GAIM_CONV_UPDATE_TOPIC) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5664 { |
7154 | 5665 const char *topic; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5666 chat = GAIM_CONV_CHAT(conv); |
4359 | 5667 gtkchat = gtkconv->u.chat; |
5668 | |
7154 | 5669 topic = gaim_conv_chat_get_topic(chat); |
5670 | |
9554 | 5671 gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), topic ? topic : ""); |
7154 | 5672 gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->topic_text, |
9554 | 5673 topic ? topic : "", NULL); |
4359 | 5674 } |
5675 else if (type == GAIM_CONV_ACCOUNT_ONLINE || | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5676 type == GAIM_CONV_ACCOUNT_OFFLINE) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5677 { |
7929 | 5678 gray_stuff_out(gaim_conv_window_get_active_conversation(win)); |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
5679 generate_send_as_items(win, NULL); |
8946 | 5680 update_tab_icon(conv); |
9472 | 5681 gaim_conversation_autoset_title(conv); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5682 } |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5683 else if (type == GAIM_CONV_UPDATE_AWAY) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5684 { |
8946 | 5685 update_tab_icon(conv); |
4359 | 5686 } |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
5687 else if (type == GAIM_CONV_UPDATE_ADD || type == GAIM_CONV_UPDATE_REMOVE || |
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
5688 type == GAIM_CONV_UPDATE_CHATLEFT) |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5689 { |
9472 | 5690 gaim_conversation_autoset_title(conv); |
7929 | 5691 gray_stuff_out(conv); |
4397
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
5692 } |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5693 else if (type == GAIM_CONV_UPDATE_ICON) |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5694 { |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5695 gaim_gtkconv_update_buddy_icon(conv); |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5696 } |
4359 | 5697 } |
5698 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5699 static GaimConversationUiOps conversation_ui_ops = |
4359 | 5700 { |
5701 gaim_gtkconv_destroy, /* destroy_conversation */ | |
5702 gaim_gtkconv_write_chat, /* write_chat */ | |
5703 gaim_gtkconv_write_im, /* write_im */ | |
5704 gaim_gtkconv_write_conv, /* write_conv */ | |
5705 gaim_gtkconv_chat_add_user, /* chat_add_user */ | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5706 gaim_gtkconv_chat_add_users, /* chat_add_users */ |
4359 | 5707 gaim_gtkconv_chat_rename_user, /* chat_rename_user */ |
5708 gaim_gtkconv_chat_remove_user, /* chat_remove_user */ | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5709 gaim_gtkconv_chat_remove_users, /* chat_remove_users */ |
9554 | 5710 gaim_gtkconv_chat_update_user, /* chat_update_user */ |
4359 | 5711 NULL, /* update_progress */ |
9260
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5712 gaim_gtkconv_has_focus, /* has_focus */ |
4359 | 5713 gaim_gtkconv_updated /* updated */ |
5714 }; | |
5715 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5716 GaimConversationUiOps * |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
5717 gaim_gtk_conversations_get_conv_ui_ops(void) |
4359 | 5718 { |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
5719 return &conversation_ui_ops; |
4359 | 5720 } |
5721 | |
5722 /************************************************************************** | |
5723 * Public conversation utility functions | |
5724 **************************************************************************/ | |
5725 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5726 gaim_gtkconv_update_buddy_icon(GaimConversation *conv) |
4359 | 5727 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5728 GaimGtkConversation *gtkconv; |
7143 | 5729 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); |
4359 | 5730 |
5731 char filename[256]; | |
5732 FILE *file; | |
5733 GError *err = NULL; | |
5734 | |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5735 const void *data; |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5736 size_t len; |
4359 | 5737 |
5738 GdkPixbuf *buf; | |
5739 | |
5740 GtkWidget *event; | |
5741 GtkWidget *frame; | |
5742 GdkPixbuf *scale; | |
5743 GdkPixmap *pm; | |
5744 GdkBitmap *bm; | |
9318 | 5745 int scale_width, scale_height; |
9332 | 5746 GtkRequisition requisition; |
9318 | 5747 |
5748 GaimAccount *account; | |
5749 GaimPluginProtocolInfo *prpl_info = NULL; | |
4359 | 5750 |
8821 | 5751 GaimButtonStyle button_type; |
5752 | |
9324 | 5753 GaimBuddyIcon *icon; |
5754 | |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5755 g_return_if_fail(conv != NULL); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5756 g_return_if_fail(GAIM_IS_GTK_CONVERSATION(conv)); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5757 g_return_if_fail(gaim_conversation_get_type(conv) == GAIM_CONV_IM); |
4359 | 5758 |
5759 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
9687 | 5760 |
5761 if (!gtkconv->u.im->show_icon) | |
5762 return; | |
5763 | |
9318 | 5764 account = gaim_conversation_get_account(conv); |
5765 if(account && account->gc) | |
5766 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl); | |
4359 | 5767 |
9845 | 5768 /* Remove the current icon stuff */ |
9885 | 5769 if (gtkconv->u.im->icon_container != NULL) |
5770 gtk_widget_destroy(gtkconv->u.im->icon_container); | |
5771 gtkconv->u.im->icon_container = NULL; | |
9845 | 5772 |
5773 if (gtkconv->u.im->anim != NULL) | |
5774 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); | |
5775 | |
9887 | 5776 gtkconv->u.im->anim = NULL; |
5777 | |
9845 | 5778 if (gtkconv->u.im->icon_timer != 0) |
5779 g_source_remove(gtkconv->u.im->icon_timer); | |
5780 | |
5781 gtkconv->u.im->icon_timer = 0; | |
5782 | |
5783 if (gtkconv->u.im->iter != NULL) | |
5784 g_object_unref(G_OBJECT(gtkconv->u.im->iter)); | |
4359 | 5785 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5786 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/im/show_buddy_icons")) |
4359 | 5787 return; |
5788 | |
5789 if (gaim_conversation_get_gc(conv) == NULL) | |
5790 return; | |
5791 | |
9324 | 5792 icon = gaim_conv_im_get_icon(GAIM_CONV_IM(conv)); |
5793 | |
5794 if (icon == NULL) | |
5795 return; | |
5796 | |
5797 data = gaim_buddy_icon_get_data(icon, &len); | |
5798 | |
5799 /* this is such an evil hack, i don't know why i'm even considering it. | |
5800 * we'll do it differently when gdk-pixbuf-loader isn't leaky anymore. */ | |
5801 /* gdk-pixbuf-loader was leaky? is it still? */ | |
5802 g_snprintf(filename, sizeof(filename), | |
5803 "%s" G_DIR_SEPARATOR_S "gaimicon-%s.%d", | |
5804 g_get_tmp_dir(), gaim_conversation_get_name(conv), getpid()); | |
5805 | |
5806 if (!(file = fopen(filename, "wb"))) | |
5807 return; | |
5808 | |
5809 fwrite(data, 1, len, file); | |
5810 fclose(file); | |
5811 | |
5812 gtkconv->u.im->anim = gdk_pixbuf_animation_new_from_file(filename, &err); | |
5813 /* make sure we remove the file as soon as possible */ | |
5814 unlink(filename); | |
5815 | |
4359 | 5816 if (err) { |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5817 gaim_debug(GAIM_DEBUG_ERROR, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5818 "Buddy icon error: %s\n", err->message); |
4359 | 5819 g_error_free(err); |
5820 } | |
5821 | |
5822 if (!gtkconv->u.im->anim) | |
5823 return; | |
5824 | |
5825 if (gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim)) { | |
5826 gtkconv->u.im->iter = NULL; | |
5827 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); | |
5828 } else { | |
5829 gtkconv->u.im->iter = | |
8496 | 5830 gdk_pixbuf_animation_get_iter(gtkconv->u.im->anim, NULL); /* LEAK */ |
4359 | 5831 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); |
8189 | 5832 if (gtkconv->u.im->animate) |
5833 start_anim(NULL, conv); | |
4359 | 5834 } |
5835 | |
9318 | 5836 get_icon_scale_size(gtkconv->u.im->anim, prpl_info ? &prpl_info->icon_spec : |
5837 NULL, &scale_width, &scale_height); | |
4359 | 5838 scale = gdk_pixbuf_scale_simple(buf, |
9318 | 5839 MAX(gdk_pixbuf_get_width(buf) * scale_width / |
4359 | 5840 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), |
9318 | 5841 MAX(gdk_pixbuf_get_height(buf) * scale_height / |
4359 | 5842 gdk_pixbuf_animation_get_height(gtkconv->u.im->anim), 1), |
5843 GDK_INTERP_NEAREST); | |
5844 | |
5845 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); | |
4793 | 5846 g_object_unref(G_OBJECT(scale)); |
4359 | 5847 |
8821 | 5848 |
9885 | 5849 gtkconv->u.im->icon_container = gtk_vbox_new(FALSE, 0); |
8821 | 5850 |
4359 | 5851 frame = gtk_frame_new(NULL); |
5852 gtk_frame_set_shadow_type(GTK_FRAME(frame), | |
5853 (bm ? GTK_SHADOW_NONE : GTK_SHADOW_IN)); | |
9885 | 5854 gtk_box_pack_start(GTK_BOX(gtkconv->u.im->icon_container), frame, |
5855 FALSE, FALSE, 0); | |
8821 | 5856 |
4359 | 5857 event = gtk_event_box_new(); |
5858 gtk_container_add(GTK_CONTAINER(frame), event); | |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
5859 g_signal_connect(G_OBJECT(event), "button-press-event", |
4359 | 5860 G_CALLBACK(icon_menu), conv); |
5861 gtk_widget_show(event); | |
5862 | |
4635 | 5863 gtkconv->u.im->icon = gtk_image_new_from_pixmap(pm, bm); |
9318 | 5864 gtk_widget_set_size_request(gtkconv->u.im->icon, scale_width, scale_height); |
4359 | 5865 gtk_container_add(GTK_CONTAINER(event), gtkconv->u.im->icon); |
5866 gtk_widget_show(gtkconv->u.im->icon); | |
5867 | |
4793 | 5868 g_object_unref(G_OBJECT(pm)); |
4359 | 5869 |
5870 if (bm) | |
4793 | 5871 g_object_unref(G_OBJECT(bm)); |
7143 | 5872 |
9332 | 5873 button_type = gaim_prefs_get_int("/gaim/gtk/conversations/button_type"); |
9876 | 5874 /* the button seems to get its size before the box, so... */ |
5875 gtk_widget_size_request(gtkconv->send, &requisition); | |
9683 | 5876 if (button_type == GAIM_BUTTON_NONE || requisition.height * 1.5 < scale_height) { |
9885 | 5877 gtk_box_pack_start(GTK_BOX(gtkconv->lower_hbox), |
5878 gtkconv->u.im->icon_container, FALSE, FALSE, 0); | |
9332 | 5879 /* gtk_box_reorder_child(GTK_BOX(gtkconv->lower_hbox), vbox, 0); */ |
5880 } else { | |
9885 | 5881 gtk_box_pack_start(GTK_BOX(gtkconv->bbox), |
5882 gtkconv->u.im->icon_container, FALSE, FALSE, 0); | |
5883 gtk_box_reorder_child(GTK_BOX(gtkconv->bbox), | |
5884 gtkconv->u.im->icon_container, 0); | |
9332 | 5885 } |
5886 | |
9885 | 5887 gtk_widget_show(gtkconv->u.im->icon_container); |
9332 | 5888 gtk_widget_show(frame); |
5889 | |
7143 | 5890 /* The buddy icon code needs badly to be fixed. */ |
5891 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); | |
8068 | 5892 if(conv == gaim_conv_window_get_active_conversation(gaim_conversation_get_window(conv))) |
5893 gtk_window_set_icon(GTK_WINDOW(gtkwin->window), buf); | |
4359 | 5894 } |
5895 | |
5896 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5897 gaim_gtkconv_update_buttons_by_protocol(GaimConversation *conv) |
4359 | 5898 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5899 GaimConvWindow *win; |
4359 | 5900 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5901 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
4359 | 5902 return; |
5903 | |
7887 | 5904 win = gaim_conversation_get_window(conv); |
5905 | |
5906 if (win != NULL && gaim_conv_window_get_active_conversation(win) == conv) | |
5907 gray_stuff_out(conv); | |
4359 | 5908 } |
5909 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5910 GaimConvWindow * |
4359 | 5911 gaim_gtkwin_get_at_xy(int x, int y) |
5912 { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5913 GaimConvWindow *win = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5914 GaimGtkWindow *gtkwin; |
4359 | 5915 GdkWindow *gdkwin; |
5916 GList *l; | |
5917 | |
5918 gdkwin = gdk_window_at_pointer(&x, &y); | |
5919 | |
5920 if (gdkwin) | |
5921 gdkwin = gdk_window_get_toplevel(gdkwin); | |
5922 | |
5923 for (l = gaim_get_windows(); l != NULL; l = l->next) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5924 win = (GaimConvWindow *)l->data; |
4359 | 5925 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5926 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5927 continue; |
5928 | |
5929 gtkwin = GAIM_GTK_WINDOW(win); | |
5930 | |
5931 if (gdkwin == gtkwin->window->window) | |
5932 return win; | |
5933 } | |
5934 | |
5935 return NULL; | |
5936 } | |
5937 | |
5938 int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5939 gaim_gtkconv_get_tab_at_xy(GaimConvWindow *win, int x, int y) |
4359 | 5940 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5941 GaimGtkWindow *gtkwin; |
4359 | 5942 GList *l; |
5943 gint nb_x, nb_y, x_rel, y_rel; | |
5944 GtkNotebook *notebook; | |
5945 GtkWidget *tab; | |
5946 gint i, page_num = 0; | |
5947 gboolean first_visible = TRUE; | |
5948 | |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5949 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5950 return -1; |
5951 | |
5952 gtkwin = GAIM_GTK_WINDOW(win); | |
5953 notebook = GTK_NOTEBOOK(gtkwin->notebook); | |
5954 | |
5955 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
5956 x_rel = x - nb_x; | |
5957 y_rel = y - nb_y; | |
5958 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5959 for (l = gaim_conv_window_get_conversations(win), i = 0; |
4359 | 5960 l != NULL; |
5961 l = l->next, i++) { | |
5962 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5963 GaimConversation *conv = l->data; |
4359 | 5964 tab = GAIM_GTK_CONVERSATION(conv)->tab_label; |
5965 | |
5966 if (!GTK_WIDGET_MAPPED(tab)) | |
5967 continue; | |
5968 | |
5969 if (first_visible) { | |
5970 first_visible = FALSE; | |
5971 | |
5972 if (x_rel < tab->allocation.x) x_rel = tab->allocation.x; | |
5973 if (y_rel < tab->allocation.y) y_rel = tab->allocation.y; | |
5974 } | |
5975 | |
5976 if (gtk_notebook_get_tab_pos(notebook) == GTK_POS_TOP || | |
5977 gtk_notebook_get_tab_pos(notebook) == GTK_POS_BOTTOM) { | |
5978 | |
5979 if (tab->allocation.x <= x_rel) { | |
5980 if (tab->allocation.x + tab->allocation.width <= x_rel) | |
5981 page_num = i + 1; | |
5982 else | |
5983 page_num = i; | |
5984 } | |
5985 else | |
5986 break; | |
5987 } | |
5988 else { | |
5989 if (tab->allocation.y <= y_rel) { | |
5990 if (tab->allocation.y + tab->allocation.height <= y_rel) | |
5991 page_num = i + 1; | |
5992 else | |
5993 page_num = i; | |
5994 } | |
5995 else | |
5996 break; | |
5997 } | |
5998 } | |
5999 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
6000 if (i == gaim_conv_window_get_conversation_count(win) + 1) |
4359 | 6001 return -1; |
6002 | |
6003 return page_num; | |
6004 } | |
6005 | |
6006 int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
6007 gaim_gtkconv_get_dest_tab_at_xy(GaimConvWindow *win, int x, int y) |
4359 | 6008 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6009 GaimGtkWindow *gtkwin; |
4359 | 6010 GList *l; |
6011 gint nb_x, nb_y, x_rel, y_rel; | |
6012 GtkNotebook *notebook; | |
6013 GtkWidget *tab; | |
6014 gint i, page_num = 0; | |
6015 | |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
6016 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 6017 return -1; |
6018 | |
6019 gtkwin = GAIM_GTK_WINDOW(win); | |
6020 notebook = GTK_NOTEBOOK(gtkwin->notebook); | |
6021 | |
6022 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
6023 x_rel = x - nb_x; | |
6024 y_rel = y - nb_y; | |
6025 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
6026 for (l = gaim_conv_window_get_conversations(win), i = 0; |
4359 | 6027 l != NULL; |
6028 l = l->next, i++) { | |
6029 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6030 GaimConversation *conv = l->data; |
4359 | 6031 tab = GAIM_GTK_CONVERSATION(conv)->tab_label; |
6032 | |
6033 if (!GTK_WIDGET_MAPPED(tab)) | |
6034 continue; | |
6035 | |
6036 if (gtk_notebook_get_tab_pos(notebook) == GTK_POS_TOP || | |
6037 gtk_notebook_get_tab_pos(notebook) == GTK_POS_BOTTOM) { | |
6038 | |
6039 if (tab->allocation.x <= x_rel) { | |
6040 if (tab->allocation.x + (tab->allocation.width / 2) <= x_rel) | |
6041 page_num = i + 1; | |
6042 else | |
6043 page_num = i; | |
6044 } | |
6045 else | |
6046 break; | |
6047 } | |
6048 else { | |
6049 if (tab->allocation.y <= y_rel) { | |
6050 if (tab->allocation.y + (tab->allocation.height / 2) <= y_rel) | |
6051 page_num = i + 1; | |
6052 else | |
6053 page_num = i; | |
6054 } | |
6055 else | |
6056 break; | |
6057 } | |
6058 } | |
6059 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
6060 if (i == gaim_conv_window_get_conversation_count(win) + 1) |
4359 | 6061 return -1; |
6062 | |
6063 return page_num; | |
6064 } | |
4940
3708545afe42
[gaim-migrate @ 5274]
Christian Hammond <chipx86@chipx86.com>
parents:
4939
diff
changeset
|
6065 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6066 static void |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6067 escape_closes_pref_cb(const char *name, GaimPrefType type, gpointer value, |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6068 gpointer data) |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6069 { |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6070 if (value) |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6071 gtk_accel_map_change_entry(N_("<main>/Conversation/Close"), |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6072 GDK_Escape, 0, TRUE); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6073 else |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6074 gtk_accel_map_change_entry(N_("<main>/Conversation/Close"), |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6075 GDK_W, GDK_CONTROL_MASK, TRUE); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6076 } |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6077 |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6078 static void |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6079 close_on_tabs_pref_cb(const char *name, GaimPrefType type, gpointer value, |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
6080 gpointer data) |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6081 { |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6082 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6083 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6084 GaimGtkConversation *gtkconv; |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6085 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6086 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6087 conv = (GaimConversation *)l->data; |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6088 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6089 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6090 continue; |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6091 |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6092 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6093 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6094 if (value) |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6095 gtk_widget_show(gtkconv->close); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6096 else |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6097 gtk_widget_hide(gtkconv->close); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6098 } |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6099 } |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6100 |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6101 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6102 show_timestamps_pref_cb(const char *name, GaimPrefType type, gpointer value, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6103 gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6104 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6105 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6106 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6107 GaimGtkConversation *gtkconv; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6108 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6109 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6110 conv = (GaimConversation *)l->data; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6111 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6112 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6113 continue; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6114 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6115 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6116 |
7386 | 6117 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), (gboolean)GPOINTER_TO_INT(value)); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6118 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6119 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6120 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6121 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6122 spellcheck_pref_cb(const char *name, GaimPrefType type, gpointer value, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6123 gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6124 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6125 #ifdef USE_GTKSPELL |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6126 GList *cl; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6127 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6128 GaimGtkConversation *gtkconv; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6129 GtkSpell *spell; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6130 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6131 for (cl = gaim_get_conversations(); cl != NULL; cl = cl->next) { |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
6132 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6133 conv = (GaimConversation *)cl->data; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6134 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6135 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6136 continue; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6137 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6138 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6139 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6140 if (value) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
6141 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6142 else { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6143 spell = gtkspell_get_from_text_view(GTK_TEXT_VIEW(gtkconv->entry)); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6144 gtkspell_detach(spell); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6145 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6146 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6147 #endif |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6148 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6149 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6150 static void |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6151 tab_side_pref_cb(const char *name, GaimPrefType type, gpointer value, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6152 gpointer data) |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6153 { |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6154 GList *l; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6155 GtkPositionType pos; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
6156 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6157 GaimGtkWindow *gtkwin; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6158 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6159 pos = GPOINTER_TO_INT(value); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6160 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6161 for (l = gaim_get_windows(); l != NULL; l = l->next) { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
6162 win = (GaimConvWindow *)l->data; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6163 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6164 if (!GAIM_IS_GTK_WINDOW(win)) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6165 continue; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6166 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6167 gtkwin = GAIM_GTK_WINDOW(win); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6168 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6169 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6170 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6171 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6172 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6173 static void |
8456 | 6174 html_shortcuts_pref_cb(const char *name, GaimPrefType type, |
6175 gpointer value, gpointer data) | |
6176 { | |
6177 GList *l; | |
6178 GaimConversation *conv; | |
6179 GaimGtkConversation *gtkconv; | |
9487 | 6180 |
8456 | 6181 for(l = gaim_get_conversations(); l != NULL; l = l->next) { |
6182 conv = (GaimConversation *)l->data; | |
9487 | 6183 |
8456 | 6184 if(!GAIM_IS_GTK_CONVERSATION(conv)) |
6185 continue; | |
9487 | 6186 |
8456 | 6187 gtkconv = GAIM_GTK_CONVERSATION(conv); |
9487 | 6188 |
8456 | 6189 gtk_imhtml_html_shortcuts(GTK_IMHTML(gtkconv->entry), |
6190 (gboolean)GPOINTER_TO_INT(value)); | |
6191 } | |
6192 } | |
6193 | |
6194 static void | |
6195 smiley_shortcuts_pref_cb(const char *name, GaimPrefType type, | |
6196 gpointer value, gpointer data) | |
6197 { | |
6198 GList *l; | |
6199 GaimConversation *conv; | |
6200 GaimGtkConversation *gtkconv; | |
9487 | 6201 |
8456 | 6202 for(l = gaim_get_conversations(); l != NULL; l = l->next) { |
6203 conv = (GaimConversation *)l->data; | |
9487 | 6204 |
8456 | 6205 if(!GAIM_IS_GTK_CONVERSATION(conv)) |
6206 continue; | |
9487 | 6207 |
8456 | 6208 gtkconv = GAIM_GTK_CONVERSATION(conv); |
9487 | 6209 |
6210 gtk_imhtml_smiley_shortcuts(GTK_IMHTML(gtkconv->entry), | |
8456 | 6211 (gboolean)GPOINTER_TO_INT(value)); |
6212 } | |
6213 } | |
6214 | |
6215 static void | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6216 show_formatting_toolbar_pref_cb(const char *name, GaimPrefType type, |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6217 gpointer value, gpointer data) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6218 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6219 GList *l; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6220 GaimConversation *conv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6221 GaimGtkConversation *gtkconv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6222 GaimConvWindow *win; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6223 GaimGtkWindow *gtkwin; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6224 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6225 for (l = gaim_get_conversations(); l != NULL; l = l->next) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6226 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6227 conv = (GaimConversation *)l->data; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6228 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6229 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6230 continue; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6231 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6232 gtkconv = GAIM_GTK_CONVERSATION(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6233 win = gaim_conversation_get_window(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6234 gtkwin = GAIM_GTK_WINDOW(win); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6235 |
7386 | 6236 gtkconv->show_formatting_toolbar = (gboolean)GPOINTER_TO_INT(value); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6237 gtk_check_menu_item_set_active( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6238 GTK_CHECK_MENU_ITEM(gtkwin->menu.show_formatting_toolbar), |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6239 gtkconv->show_formatting_toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6240 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6241 if (gtkconv->show_formatting_toolbar) |
8317 | 6242 gtk_widget_show(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6243 else |
8317 | 6244 gtk_widget_hide(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6245 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6246 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6247 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6248 static void |
9150 | 6249 button_type_pref_cb(const char *name, GaimPrefType type, |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6250 gpointer value, gpointer data) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6251 { |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6252 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6253 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6254 GaimGtkConversation *gtkconv; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6255 |
9150 | 6256 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6257 conv = (GaimConversation *)l->data; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6258 gtkconv = GAIM_GTK_CONVERSATION(conv); |
9150 | 6259 switch (conv->type) { |
6260 case GAIM_CONV_IM: | |
9749 | 6261 setup_im_buttons(conv, gtkconv->bbox); |
9150 | 6262 gaim_gtkconv_update_buddy_icon(conv); |
6263 break; | |
6264 case GAIM_CONV_CHAT: | |
9749 | 6265 setup_chat_buttons(conv, gtkconv->bbox); |
9150 | 6266 break; |
6267 default: | |
6268 break; | |
6269 } | |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6270 } |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6271 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6272 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6273 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6274 animate_buddy_icons_pref_cb(const char *name, GaimPrefType type, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6275 gpointer value, gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6276 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6277 GList *l; |
8189 | 6278 GaimConversation *conv; |
6279 GaimGtkConversation *gtkconv; | |
6280 GaimConvWindow *win; | |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6281 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6282 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/im/show_buddy_icons")) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6283 return; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6284 |
8189 | 6285 /* Set the "animate" flag for each icon based on the new preference */ |
6286 for (l = gaim_get_ims(); l != NULL; l = l->next) { | |
6287 conv = (GaimConversation *)l->data; | |
6288 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
6289 gtkconv->u.im->animate = (gboolean)value; | |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6290 } |
8189 | 6291 |
6292 /* Now either stop or start animation for the active conversation in each window */ | |
6293 for (l = gaim_get_windows(); l != NULL; l = l->next) { | |
6294 win = (GaimConvWindow *)l->data; | |
6295 conv = gaim_conv_window_get_active_conversation(win); | |
6296 gaim_gtkconv_update_buddy_icon(conv); | |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6297 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6298 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6299 |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6300 static void |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6301 show_buddy_icons_pref_cb(const char *name, GaimPrefType type, gpointer value, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6302 gpointer data) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6303 { |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6304 GList *l; |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6305 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6306 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6307 GaimConversation *conv = l->data; |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6308 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6309 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6310 gaim_conversation_foreach(gaim_gtkconv_update_buddy_icon); |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6311 } |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6312 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6313 |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5680
diff
changeset
|
6314 static void |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6315 conv_placement_pref_cb(const char *name, GaimPrefType type, |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6316 gpointer value, gpointer data) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6317 { |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6318 GaimConvPlacementFunc func; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6319 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6320 if (strcmp(name, "/gaim/gtk/conversations/placement")) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6321 return; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6322 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6323 func = gaim_conv_placement_get_fnc(value); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6324 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6325 if (func == NULL) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6326 return; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6327 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6328 gaim_conv_placement_set_current_func(func); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6329 } |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6330 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6331 void * |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6332 gaim_gtk_conversations_get_handle(void) |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6333 { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6334 static int handle; |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6335 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6336 return &handle; |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6337 } |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6338 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6339 void |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
6340 gaim_gtk_conversations_init(void) |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6341 { |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6342 void *handle = gaim_gtk_conversations_get_handle(); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6343 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6344 /* Conversations */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6345 gaim_prefs_add_none("/gaim/gtk/conversations"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6346 gaim_prefs_add_bool("/gaim/gtk/conversations/close_on_tabs", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6347 gaim_prefs_add_bool("/gaim/gtk/conversations/ctrl_enter_sends", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6348 gaim_prefs_add_bool("/gaim/gtk/conversations/enter_sends", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6349 gaim_prefs_add_bool("/gaim/gtk/conversations/escape_closes", FALSE); |
9025 | 6350 gaim_prefs_add_bool("/gaim/gtk/conversations/send_formatting", FALSE); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6351 gaim_prefs_add_bool("/gaim/gtk/conversations/send_bold", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6352 gaim_prefs_add_bool("/gaim/gtk/conversations/send_italic", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6353 gaim_prefs_add_bool("/gaim/gtk/conversations/send_underline", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6354 gaim_prefs_add_bool("/gaim/gtk/conversations/show_timestamps", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6355 gaim_prefs_add_bool("/gaim/gtk/conversations/spellcheck", TRUE); |
9049 | 6356 #if 1 |
6357 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_colors", FALSE); | |
6358 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_fonts", FALSE); | |
6359 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_font_sizes", FALSE); | |
6360 #else | |
8944 | 6361 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_formatting", FALSE); |
9049 | 6362 #endif |
9572 | 6363 gaim_prefs_add_bool("/gaim/gtk/conversations/html_shortcuts", TRUE); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6364 gaim_prefs_add_bool("/gaim/gtk/conversations/smiley_shortcuts", FALSE); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6365 gaim_prefs_add_bool("/gaim/gtk/conversations/show_formatting_toolbar", TRUE); |
9832 | 6366 gaim_prefs_add_bool("/gaim/gtk/conversations/passthrough_unknown_commands", FALSE); |
9130 | 6367 |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6368 gaim_prefs_add_string("/gaim/gtk/conversations/placement", "last"); |
8998 | 6369 gaim_prefs_add_int("/gaim/gtk/conversations/placement_number", 1); |
9025 | 6370 gaim_prefs_add_string("/gaim/gtk/conversations/bgcolor", ""); |
6371 gaim_prefs_add_string("/gaim/gtk/conversations/fgcolor", ""); | |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6372 gaim_prefs_add_string("/gaim/gtk/conversations/font_face", ""); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6373 gaim_prefs_add_int("/gaim/gtk/conversations/font_size", 3); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6374 gaim_prefs_add_bool("/gaim/gtk/conversations/tabs", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6375 gaim_prefs_add_int("/gaim/gtk/conversations/tab_side", GTK_POS_TOP); |
9150 | 6376 gaim_prefs_add_int("/gaim/gtk/conversations/button_type", |
6377 GAIM_BUTTON_TEXT_IMAGE); | |
6378 | |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6379 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6380 /* Conversations -> Chat */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6381 gaim_prefs_add_none("/gaim/gtk/conversations/chat"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6382 gaim_prefs_add_bool("/gaim/gtk/conversations/chat/color_nicks", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6383 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_width", 410); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6384 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_height", 160); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6385 gaim_prefs_add_int("/gaim/gtk/conversations/chat/entry_height", 50); |
9319 | 6386 gaim_prefs_add_bool("/gaim/gtk/conversations/chat/raise_on_events", FALSE); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6387 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6388 /* Conversations -> IM */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6389 gaim_prefs_add_none("/gaim/gtk/conversations/im"); |
9150 | 6390 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6391 gaim_prefs_add_bool("/gaim/gtk/conversations/im/animate_buddy_icons", TRUE); |
9150 | 6392 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6393 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_width", 410); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6394 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_height", 160); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6395 gaim_prefs_add_int("/gaim/gtk/conversations/im/entry_height", 50); |
9319 | 6396 gaim_prefs_add_bool("/gaim/gtk/conversations/im/raise_on_events", FALSE); |
6397 gaim_prefs_add_bool("/gaim/gtk/conversations/im/show_buddy_icons", TRUE); | |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6398 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6399 /* Connect callbacks. */ |
10087 | 6400 gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/escape_closes", |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6401 escape_closes_pref_cb, NULL); |
10087 | 6402 gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/close_on_tabs", |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6403 close_on_tabs_pref_cb, NULL); |
10087 | 6404 gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/show_timestamps", |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6405 show_timestamps_pref_cb, NULL); |
10087 | 6406 gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/html_shortcuts", |
8456 | 6407 html_shortcuts_pref_cb, NULL); |
10087 | 6408 gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/smiley_shortcuts", |
8456 | 6409 smiley_shortcuts_pref_cb, NULL); |
10087 | 6410 gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/show_formatting_toolbar", |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6411 show_formatting_toolbar_pref_cb, NULL); |
10087 | 6412 gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/spellcheck", |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6413 spellcheck_pref_cb, NULL); |
10087 | 6414 gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/tab_side", |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6415 tab_side_pref_cb, NULL); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6416 |
10087 | 6417 gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/placement", |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6418 conv_placement_pref_cb, NULL); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6419 gaim_prefs_trigger_callback("/gaim/gtk/conversations/placement"); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6420 |
10087 | 6421 gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/button_type", |
9150 | 6422 button_type_pref_cb, NULL); |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
6423 |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6424 /* IM callbacks */ |
10087 | 6425 gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/im/animate_buddy_icons", |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6426 animate_buddy_icons_pref_cb, NULL); |
10087 | 6427 gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/im/show_buddy_icons", |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6428 show_buddy_icons_pref_cb, NULL); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6429 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6430 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6431 /********************************************************************** |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6432 * Register signals |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6433 **********************************************************************/ |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6434 gaim_signal_register(handle, "conversation-drag-ended", |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6435 gaim_marshal_VOID__POINTER_POINTER, NULL, 2, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6436 gaim_value_new(GAIM_TYPE_SUBTYPE, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6437 GAIM_SUBTYPE_CONV_WINDOW), |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6438 gaim_value_new(GAIM_TYPE_SUBTYPE, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6439 GAIM_SUBTYPE_CONV_WINDOW)); |
9167 | 6440 |
6441 /********************************************************************** | |
6442 * Register commands | |
6443 **********************************************************************/ | |
9829 | 6444 gaim_cmd_register("say", "S", GAIM_CMD_P_DEFAULT, |
6445 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, | |
6446 say_command_cb, _("say <message>: Send a message normally as if you weren't using a command."), NULL); | |
9213 | 6447 gaim_cmd_register("me", "S", GAIM_CMD_P_DEFAULT, |
6448 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, | |
9597 | 6449 me_command_cb, _("me <action>: Send an IRC style action to a buddy or chat."), NULL); |
9213 | 6450 gaim_cmd_register("debug", "w", GAIM_CMD_P_DEFAULT, |
6451 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, | |
9597 | 6452 debug_command_cb, _("debug <option>: Send various debug information to the current conversation."), NULL); |
9213 | 6453 |
6454 gaim_cmd_register("help", "w", GAIM_CMD_P_DEFAULT, | |
9597 | 6455 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, NULL, |
6456 help_command_cb, _("help <command>: Help on a specific command."), NULL); | |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6457 } |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6458 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6459 void |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6460 gaim_gtk_conversations_uninit(void) |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6461 { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6462 gaim_signals_unregister_by_instance(gaim_gtk_conversations_get_handle()); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6463 } |