Mercurial > pidgin
annotate src/gtkconv.c @ 9829:e98c9a80fb74
[gaim-migrate @ 10700]
This adds the /say command. Someone can improve the help string if they
want.
committer: Tailor Script <tailor@pidgin.im>
author | Tim Ringenbach <marv@pidgin.im> |
---|---|
date | Sun, 22 Aug 2004 20:04:33 +0000 |
parents | 5afa28c94201 |
children | 54e0322c81fb |
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 |
7990 | 69 #define SEND_COLOR "#16569E" |
7855 | 70 #define RECV_COLOR "#A82F2F" |
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 | |
395 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
396 send_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 397 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
398 GaimGtkConversation *gtkconv; |
9130 | 399 char *cmd; |
400 const char *prefix; | |
8655 | 401 GaimAccount *account; |
8677 | 402 GaimConnection *gc; |
8448 | 403 char *buf, *clean; |
4359 | 404 |
405 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
8655 | 406 account = gaim_conversation_get_account(conv); |
9130 | 407 prefix = gaim_gtk_get_cmd_prefix(); |
408 | |
9471 | 409 if (!gaim_account_is_connected(account)) |
410 return; | |
411 | |
9474 | 412 if ((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) && |
413 gaim_conv_chat_has_left(GAIM_CONV_CHAT(conv))) | |
9471 | 414 return; |
415 | |
9130 | 416 if(gaim_prefs_get_bool("/gaim/gtk/conversations/enable_commands")) { |
9602 | 417 GtkTextIter start; |
9130 | 418 cmd = gtk_imhtml_get_text(GTK_IMHTML(gtkconv->entry), NULL, NULL); |
9602 | 419 gtk_text_buffer_get_start_iter(GTK_IMHTML(gtkconv->entry)->text_buffer, &start); |
420 | |
421 if(cmd && (strncmp(cmd, prefix, strlen(prefix)) == 0) | |
422 && !gtk_text_iter_get_child_anchor(&start)) { | |
9130 | 423 GaimCmdStatus status; |
9374 | 424 char *error, *cmdline, *markup, *send_history; |
9602 | 425 GtkTextIter end; |
9130 | 426 |
9374 | 427 send_history = gtk_imhtml_get_markup(GTK_IMHTML(gtkconv->entry)); |
428 send_history_add(conv, send_history); | |
429 g_free(send_history); | |
430 | |
9130 | 431 cmdline = cmd + strlen(prefix); |
9602 | 432 |
9175 | 433 gtk_text_iter_forward_chars(&start, g_utf8_strlen(prefix, -1)); |
434 gtk_text_buffer_get_end_iter(GTK_IMHTML(gtkconv->entry)->text_buffer, &end); | |
435 markup = gtk_imhtml_get_markup_range(GTK_IMHTML(gtkconv->entry), &start, &end); | |
436 status = gaim_cmd_do_command(conv, cmdline, markup, &error); | |
9130 | 437 g_free(cmd); |
9175 | 438 g_free(markup); |
9130 | 439 |
440 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); | |
441 default_formatize(conv); | |
442 | |
443 switch(status) { | |
444 case GAIM_CMD_STATUS_OK: | |
445 return; | |
446 case GAIM_CMD_STATUS_NOT_FOUND: | |
9212 | 447 gaim_conversation_write(conv, "", _("No such command. If you didn't mean " |
448 "to type a command, you can turn " | |
449 "commands off from Tools->" | |
450 "Preferences->Interface->Conversation" | |
451 "->Enable \"slash\" commands."), | |
9213 | 452 GAIM_MESSAGE_NO_LOG, time(NULL)); |
9130 | 453 return; |
454 case GAIM_CMD_STATUS_WRONG_ARGS: | |
9212 | 455 gaim_conversation_write(conv, "", _("Syntax Error: You typed the wrong number of arguments " |
456 "to that command. If you didn't mean to type a command, " | |
457 "you can turn commands off from Tools->Preferences->" | |
458 "Interface->Conversation->Enable \"slash\" commands."), | |
9213 | 459 GAIM_MESSAGE_NO_LOG, time(NULL)); |
9130 | 460 return; |
461 case GAIM_CMD_STATUS_FAILED: | |
9212 | 462 gaim_conversation_write(conv, "", error ? error : _("Your command failed for an unknown reason."), |
9213 | 463 GAIM_MESSAGE_NO_LOG, time(NULL)); |
9130 | 464 if(error) |
465 g_free(error); | |
466 return; | |
467 case GAIM_CMD_STATUS_WRONG_TYPE: | |
468 if(gaim_conversation_get_type(conv) == GAIM_CONV_IM) | |
469 gaim_conversation_write(conv, "", _("That command only works in Chats, not IMs."), | |
9213 | 470 GAIM_MESSAGE_NO_LOG, time(NULL)); |
9130 | 471 else |
472 gaim_conversation_write(conv, "", _("That command only works in IMs, not Chats."), | |
9213 | 473 GAIM_MESSAGE_NO_LOG, time(NULL)); |
9130 | 474 return; |
475 case GAIM_CMD_STATUS_WRONG_PRPL: | |
476 gaim_conversation_write(conv, "", _("That command doesn't work on this protocol."), | |
9213 | 477 GAIM_MESSAGE_NO_LOG, time(NULL)); |
9130 | 478 return; |
479 } | |
480 } | |
481 | |
482 g_free(cmd); | |
483 } | |
484 | |
8655 | 485 |
8442 | 486 buf = gtk_imhtml_get_markup(GTK_IMHTML(gtkconv->entry)); |
8962 | 487 clean = gtk_imhtml_get_text(GTK_IMHTML(gtkconv->entry), NULL, NULL); |
8448 | 488 |
4359 | 489 gtk_widget_grab_focus(gtkconv->entry); |
490 | |
8448 | 491 if (strlen(clean) == 0) { |
492 g_free(clean); | |
4359 | 493 return; |
494 } | |
495 | |
8677 | 496 gc = gaim_account_get_connection(account); |
497 if (gc && (gc->flags & GAIM_CONNECTION_NO_NEWLINES)) { | |
498 char **bufs; | |
499 int i; | |
500 | |
501 bufs = gtk_imhtml_get_markup_lines(GTK_IMHTML(gtkconv->entry)); | |
502 for (i = 0; bufs[i]; i++) { | |
9374 | 503 send_history_add(conv, bufs[i]); |
8677 | 504 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
505 gaim_conv_im_send(GAIM_CONV_IM(conv), bufs[i]); | |
506 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
507 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), bufs[i]); | |
508 } | |
509 | |
510 g_strfreev(bufs); | |
511 | |
512 } else { | |
9374 | 513 send_history_add(conv, buf); |
8677 | 514 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
515 gaim_conv_im_send(GAIM_CONV_IM(conv), buf); | |
516 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
517 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), buf); | |
518 } | |
4359 | 519 |
8677 | 520 g_free(clean); |
4359 | 521 g_free(buf); |
522 | |
8061 | 523 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); |
524 default_formatize(conv); | |
4359 | 525 } |
526 | |
527 static void | |
7928 | 528 add_remove_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 529 { |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
530 GaimAccount *account; |
4359 | 531 const char *name; |
532 | |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
533 account = gaim_conversation_get_account(conv); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
534 name = gaim_conversation_get_name(conv); |
7879 | 535 |
536 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
7859 | 537 GaimBuddy *b; |
538 | |
539 b = gaim_find_buddy(account, name); | |
540 if (b != NULL) | |
9730 | 541 gaim_gtkdialogs_remove_buddy(b); |
7859 | 542 else if (account != NULL && gaim_account_is_connected(account)) |
543 gaim_blist_request_add_buddy(account, (char *)name, NULL, NULL); | |
7879 | 544 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
7859 | 545 GaimChat *c; |
546 | |
547 c = gaim_blist_find_chat(account, name); | |
548 if (c != NULL) | |
9730 | 549 gaim_gtkdialogs_remove_chat(c); |
7859 | 550 else if (account != NULL && gaim_account_is_connected(account)) |
9754 | 551 gaim_blist_request_add_chat(account, NULL, NULL, name); |
7859 | 552 } |
4359 | 553 |
554 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
555 } | |
556 | |
7975 | 557 static void chat_do_info(GaimConversation *conv, const char *who) |
558 { | |
559 GaimPluginProtocolInfo *prpl_info = NULL; | |
560 GaimConnection *gc; | |
561 | |
562 if ((gc = gaim_conversation_get_gc(conv))) { | |
563 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | |
564 | |
565 /* | |
566 * If there are special needs for getting info on users in | |
567 * buddy chat "rooms"... | |
568 */ | |
569 if (prpl_info->get_cb_info != NULL) | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
570 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
571 prpl_info->get_cb_info(gc, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
572 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
573 } |
7975 | 574 else |
575 prpl_info->get_info(gc, who); | |
576 } | |
577 } | |
578 | |
579 | |
4359 | 580 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
581 info_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 582 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
583 GaimGtkConversation *gtkconv; |
4359 | 584 |
585 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
586 | |
7879 | 587 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
588 serv_get_info(gaim_conversation_get_gc(conv), | |
589 gaim_conversation_get_name(conv)); | |
590 | |
591 gtk_widget_grab_focus(gtkconv->entry); | |
592 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
593 /* Get info of the person currently selected in the GtkTreeView */ | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
594 GaimGtkChatPane *gtkchat; |
4359 | 595 GtkTreeIter iter; |
596 GtkTreeModel *model; | |
597 GtkTreeSelection *sel; | |
9554 | 598 char *name; |
4359 | 599 |
600 gtkchat = gtkconv->u.chat; | |
601 | |
602 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | |
603 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); | |
604 | |
605 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) | |
9498 | 606 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &name, -1); |
4359 | 607 else |
608 return; | |
609 | |
7975 | 610 chat_do_info(conv, name); |
9554 | 611 g_free(name); |
4359 | 612 } |
613 } | |
614 | |
615 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
616 warn_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 617 { |
9714 | 618 gaim_gtkdialogs_warn(gaim_conversation_get_gc(conv), |
7879 | 619 gaim_conversation_get_name(conv)); |
4359 | 620 |
621 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
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 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
673 invite_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 674 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
675 InviteBuddyInfo *info = NULL; |
4359 | 676 |
677 if (invite_dialog == NULL) { | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
678 GaimConnection *gc; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
679 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
680 GaimGtkWindow *gtkwin; |
4359 | 681 GtkWidget *label; |
682 GtkWidget *vbox, *hbox; | |
683 GtkWidget *table; | |
684 GtkWidget *img; | |
685 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
686 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
687 GTK_ICON_SIZE_DIALOG); |
4359 | 688 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
689 info = g_new0(InviteBuddyInfo, 1); |
4359 | 690 info->conv = conv; |
691 | |
692 gc = gaim_conversation_get_gc(conv); | |
693 win = gaim_conversation_get_window(conv); | |
694 gtkwin = GAIM_GTK_WINDOW(win); | |
695 | |
696 /* Create the new dialog. */ | |
697 invite_dialog = gtk_dialog_new_with_buttons( | |
7859 | 698 _("Invite Buddy Into Chat Room"), |
7879 | 699 GTK_WINDOW(gtkwin->window), 0, |
700 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, | |
9443
3584cdab1d0b
[gaim-migrate @ 10264]
Christian Hammond <chipx86@chipx86.com>
parents:
9374
diff
changeset
|
701 GAIM_STOCK_INVITE, GTK_RESPONSE_OK, NULL); |
4359 | 702 |
703 gtk_dialog_set_default_response(GTK_DIALOG(invite_dialog), | |
704 GTK_RESPONSE_OK); | |
705 gtk_container_set_border_width(GTK_CONTAINER(invite_dialog), 6); | |
706 gtk_window_set_resizable(GTK_WINDOW(invite_dialog), FALSE); | |
707 gtk_dialog_set_has_separator(GTK_DIALOG(invite_dialog), FALSE); | |
708 | |
709 /* Setup the outside spacing. */ | |
710 vbox = GTK_DIALOG(invite_dialog)->vbox; | |
711 | |
712 gtk_box_set_spacing(GTK_BOX(vbox), 12); | |
713 gtk_container_set_border_width(GTK_CONTAINER(vbox), 6); | |
714 | |
715 /* Setup the inner hbox and put the dialog's icon in it. */ | |
716 hbox = gtk_hbox_new(FALSE, 12); | |
717 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
718 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
719 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
720 | |
721 /* Setup the right vbox. */ | |
722 vbox = gtk_vbox_new(FALSE, 0); | |
723 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
724 | |
725 /* Put our happy label in it. */ | |
726 label = gtk_label_new(_("Please enter the name of the user you wish " | |
727 "to invite, along with an optional invite " | |
728 "message.")); | |
729 gtk_widget_set_size_request(label, 350, -1); | |
730 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
731 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
732 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
733 | |
734 /* hbox for the table, and to give it some spacing on the left. */ | |
735 hbox = gtk_hbox_new(FALSE, 6); | |
736 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
737 | |
738 /* Setup the table we're going to use to lay stuff out. */ | |
739 table = gtk_table_new(2, 2, FALSE); | |
740 gtk_table_set_row_spacings(GTK_TABLE(table), 6); | |
741 gtk_table_set_col_spacings(GTK_TABLE(table), 6); | |
742 gtk_container_set_border_width(GTK_CONTAINER(table), 12); | |
743 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); | |
744 | |
745 /* Now the Buddy label */ | |
746 label = gtk_label_new(NULL); | |
747 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Buddy:")); | |
748 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
749 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); | |
750 | |
751 /* Now the Buddy drop-down entry field. */ | |
752 info->entry = gtk_combo_new(); | |
753 gtk_combo_set_case_sensitive(GTK_COMBO(info->entry), FALSE); | |
754 gtk_entry_set_activates_default( | |
755 GTK_ENTRY(GTK_COMBO(info->entry)->entry), TRUE); | |
756 | |
757 gtk_table_attach_defaults(GTK_TABLE(table), info->entry, 1, 2, 0, 1); | |
758 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->entry); | |
759 | |
760 /* Fill in the names. */ | |
761 gtk_combo_set_popdown_strings(GTK_COMBO(info->entry), | |
762 generate_invite_user_names(gc)); | |
763 | |
764 | |
765 /* Now the label for "Message" */ | |
766 label = gtk_label_new(NULL); | |
767 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Message:")); | |
768 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
769 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); | |
770 | |
771 | |
772 /* And finally, the Message entry field. */ | |
773 info->message = gtk_entry_new(); | |
774 gtk_entry_set_activates_default(GTK_ENTRY(info->message), TRUE); | |
775 | |
776 gtk_table_attach_defaults(GTK_TABLE(table), info->message, 1, 2, 1, 2); | |
777 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->message); | |
778 | |
779 /* Connect the signals. */ | |
780 g_signal_connect(G_OBJECT(invite_dialog), "response", | |
781 G_CALLBACK(do_invite), info); | |
782 } | |
783 | |
784 gtk_widget_show_all(invite_dialog); | |
785 | |
786 if (info != NULL) | |
787 gtk_widget_grab_focus(GTK_COMBO(info->entry)->entry); | |
788 } | |
789 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
790 static void |
7748 | 791 menu_new_conv_cb(gpointer data, guint action, GtkWidget *widget) |
792 { | |
9714 | 793 gaim_gtkdialogs_im(); |
7748 | 794 } |
795 | |
796 static void | |
9504 | 797 savelog_writefile_cb(void *user_data, const char *filename) |
9489 | 798 { |
9504 | 799 GaimConversation *conv = (GaimConversation *)user_data; |
9489 | 800 FILE *fp; |
801 const char *name; | |
802 | |
803 if ((fp = fopen(filename, "w+")) == NULL) { | |
9504 | 804 gaim_notify_error(conv, NULL, _("Unable to open file."), NULL); |
9489 | 805 return; |
806 } | |
807 | |
808 name = gaim_conversation_get_name(conv); | |
809 fprintf(fp, _("<h1>Conversation with %s</h1>\n"), name); | |
810 fprintf(fp, "%s", conv->history->str); | |
811 fclose(fp); | |
812 } | |
813 | |
814 static void | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
815 menu_save_as_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
816 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
817 GaimConvWindow *win = (GaimConvWindow *)data; |
9489 | 818 GaimConversation *conv = gaim_conv_window_get_active_conversation(win); |
819 gchar *buf; | |
820 | |
821 buf = g_strdup_printf("%s.html", gaim_normalize(conv->account, conv->name)); | |
9504 | 822 |
823 gaim_request_file(conv, _("Save Conversation"), buf, TRUE, | |
824 G_CALLBACK(savelog_writefile_cb), NULL, conv); | |
9489 | 825 |
826 g_free(buf); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
827 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
828 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
829 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
830 menu_view_log_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
831 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
832 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
833 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
834 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
835 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
836 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
837 gaim_gtk_log_show((char *)gaim_conversation_get_name(conv), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
838 gaim_conversation_get_account(conv)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
839 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
840 |
8974 | 841 static void |
842 menu_clear_cb(gpointer data, guint action, GtkWidget *widget) | |
843 { | |
844 GaimConvWindow *win = (GaimConvWindow *)data; | |
845 GaimConversation *conv; | |
846 GaimGtkConversation *gtkconv; | |
847 | |
848 conv = gaim_conv_window_get_active_conversation(win); | |
849 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
850 | |
851 gtk_imhtml_clear(GTK_IMHTML(gtkconv->imhtml)); | |
852 g_string_free(conv->history, TRUE); | |
853 conv->history = g_string_new(""); | |
854 } | |
855 | |
7295 | 856 struct _search { |
857 GaimGtkConversation *gtkconv; | |
858 GtkWidget *entry; | |
859 }; | |
860 | |
7929 | 861 static void do_search_cb(GtkWidget *widget, gint resp, struct _search *s) |
7295 | 862 { |
7929 | 863 switch (resp) { |
864 case GTK_RESPONSE_OK: | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
865 gtk_imhtml_search_find(GTK_IMHTML(s->gtkconv->imhtml), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
866 gtk_entry_get_text(GTK_ENTRY(s->entry))); |
7929 | 867 break; |
868 | |
869 case GTK_RESPONSE_DELETE_EVENT: | |
870 case GTK_RESPONSE_CLOSE: | |
871 gtk_imhtml_search_clear(GTK_IMHTML(s->gtkconv->imhtml)); | |
872 gtk_widget_destroy(s->gtkconv->dialogs.search); | |
873 s->gtkconv->dialogs.search = NULL; | |
874 g_free(s); | |
875 break; | |
876 } | |
7295 | 877 } |
878 | |
879 static void | |
7751 | 880 menu_find_cb(gpointer data, guint action, GtkWidget *widget) |
7295 | 881 { |
882 GaimConvWindow *win = (GaimConvWindow *)data; | |
883 GaimConversation *conv = gaim_conv_window_get_active_conversation(win); | |
884 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); | |
885 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7929 | 886 GtkWidget *hbox; |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
887 GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
888 GTK_ICON_SIZE_DIALOG); |
7929 | 889 GtkWidget *label; |
7295 | 890 struct _search *s; |
891 | |
7798 | 892 if (gtkconv->dialogs.search) { |
893 gtk_window_present(GTK_WINDOW(gtkconv->dialogs.search)); | |
7295 | 894 return; |
7798 | 895 } |
7300
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
896 |
7295 | 897 s = g_malloc(sizeof(struct _search)); |
898 s->gtkconv = gtkconv; | |
7929 | 899 |
900 gtkconv->dialogs.search = gtk_dialog_new_with_buttons(_("Find"), | |
901 GTK_WINDOW(gtkwin->window), GTK_DIALOG_DESTROY_WITH_PARENT, | |
902 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, | |
903 GTK_STOCK_FIND, GTK_RESPONSE_OK, NULL); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
904 gtk_dialog_set_default_response(GTK_DIALOG(gtkconv->dialogs.search), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
905 GTK_RESPONSE_OK); |
7929 | 906 g_signal_connect(G_OBJECT(gtkconv->dialogs.search), "response", |
907 G_CALLBACK(do_search_cb), s); | |
908 | |
909 gtk_container_set_border_width(GTK_CONTAINER(gtkconv->dialogs.search), 6); | |
910 gtk_window_set_resizable(GTK_WINDOW(gtkconv->dialogs.search), FALSE); | |
911 gtk_dialog_set_has_separator(GTK_DIALOG(gtkconv->dialogs.search), FALSE); | |
912 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
|
913 gtk_container_set_border_width( |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
914 GTK_CONTAINER(GTK_DIALOG(gtkconv->dialogs.search)->vbox), 6); |
7929 | 915 |
916 hbox = gtk_hbox_new(FALSE, 12); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
917 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(gtkconv->dialogs.search)->vbox), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
918 hbox); |
7929 | 919 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); |
920 | |
921 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
922 gtk_dialog_set_response_sensitive(GTK_DIALOG(gtkconv->dialogs.search), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
923 GTK_RESPONSE_OK, FALSE); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
924 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
925 label = gtk_label_new(NULL); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
926 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Search for:")); |
7929 | 927 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
928 | |
929 s->entry = gtk_entry_new(); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
930 gtk_entry_set_activates_default(GTK_ENTRY(s->entry), TRUE); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
931 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(s->entry)); |
7929 | 932 g_signal_connect(G_OBJECT(s->entry), "changed", |
933 G_CALLBACK(gaim_gtk_set_sensitive_if_input), | |
934 gtkconv->dialogs.search); | |
935 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
|
936 |
7295 | 937 gtk_widget_show_all(gtkconv->dialogs.search); |
7929 | 938 gtk_widget_grab_focus(s->entry); |
7295 | 939 } |
940 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
941 static void |
9468 | 942 menu_send_file_cb(gpointer data, guint action, GtkWidget *widget) |
943 { | |
944 GaimConvWindow *win = (GaimConvWindow *)data; | |
945 GaimConversation *conv = gaim_conv_window_get_active_conversation(win); | |
946 | |
947 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
948 serv_send_file(gaim_conversation_get_gc(conv), gaim_conversation_get_name(conv), NULL); | |
949 } | |
950 | |
951 } | |
952 | |
953 static void | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
954 menu_add_pounce_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
955 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
956 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
957 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
958 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
959 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
960 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
961 gaim_gtkpounce_dialog_show(gaim_conversation_get_account(conv), |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
962 gaim_conversation_get_name(conv), NULL); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
963 } |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
964 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
965 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
966 menu_insert_link_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
967 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
968 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
969 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
970 GaimGtkConversation *gtkconv; |
8756 | 971 GtkIMHtmlToolbar *toolbar; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
972 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
973 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
974 gtkconv = GAIM_GTK_CONVERSATION(conv); |
8756 | 975 toolbar = GTK_IMHTMLTOOLBAR(gtkconv->toolbar); |
976 | |
977 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->link), | |
978 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->link))); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
979 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
980 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
981 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
982 menu_insert_image_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
983 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
984 GaimConvWindow *win = (GaimConvWindow *)data; |
8756 | 985 GaimConversation *conv; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
986 GaimGtkConversation *gtkconv; |
8756 | 987 GtkIMHtmlToolbar *toolbar; |
988 | |
989 conv = gaim_conv_window_get_active_conversation(win); | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
990 gtkconv = GAIM_GTK_CONVERSATION(gaim_conv_window_get_active_conversation(win)); |
8756 | 991 toolbar = GTK_IMHTMLTOOLBAR(gtkconv->toolbar); |
992 | |
993 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->image), | |
994 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->image))); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
995 } |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
996 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
997 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
998 menu_alias_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
999 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1000 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1001 GaimConversation *conv; |
7879 | 1002 GaimAccount *account; |
1003 const char *name; | |
1004 | |
1005 conv = gaim_conv_window_get_active_conversation(win); | |
1006 account = gaim_conversation_get_account(conv); | |
1007 name = gaim_conversation_get_name(conv); | |
1008 | |
1009 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
1010 GaimBuddy *b; | |
1011 | |
1012 b = gaim_find_buddy(account, name); | |
1013 if (b != NULL) | |
9730 | 1014 gaim_gtkdialogs_alias_buddy(b); |
7879 | 1015 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
1016 GaimChat *c; | |
1017 | |
1018 c = gaim_blist_find_chat(account, name); | |
1019 if (c != NULL) | |
9730 | 1020 gaim_gtkdialogs_alias_chat(c); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1021 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1022 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1023 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1024 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1025 menu_get_info_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1026 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1027 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1028 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1029 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1030 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1031 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1032 info_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1033 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1034 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1035 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1036 menu_invite_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1037 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1038 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1039 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1040 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1041 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1042 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1043 invite_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1044 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1045 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1046 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1047 menu_warn_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1048 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1049 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1050 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1051 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1052 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1053 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1054 warn_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1055 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1056 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1057 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1058 menu_block_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1059 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1060 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1061 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1062 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1063 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1064 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1065 block_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1066 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1067 |
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_add_remove_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 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1074 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1075 |
7928 | 1076 add_remove_cb(NULL, conv); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1077 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1078 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1079 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1080 menu_close_conv_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1081 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1082 GaimConvWindow *win = (GaimConvWindow *)data; |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1083 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1084 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
|
1085 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1086 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1087 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1088 menu_logging_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1089 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1090 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1091 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1092 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1093 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1094 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1095 if (conv == NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1096 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1097 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1098 gaim_conversation_set_logging(conv, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1099 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1100 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1101 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1102 static void |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1103 menu_toolbar_cb(gpointer data, guint action, GtkWidget *widget) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1104 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1105 GaimConvWindow *win = (GaimConvWindow *)data; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1106 GaimConversation *conv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1107 GaimGtkConversation *gtkconv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1108 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1109 conv = gaim_conv_window_get_active_conversation(win); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1110 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1111 if (conv == NULL) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1112 return; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1113 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1114 gtkconv = GAIM_GTK_CONVERSATION(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1115 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1116 gtkconv->show_formatting_toolbar = |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1117 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1118 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1119 if (gtkconv->show_formatting_toolbar) |
8317 | 1120 gtk_widget_show(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1121 else |
8317 | 1122 gtk_widget_hide(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1123 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1124 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1125 static void |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1126 menu_sounds_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1127 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1128 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1129 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1130 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1131 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1132 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1133 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1134 if (!conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1135 return; |
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 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1138 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1139 gtkconv->make_sound = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1140 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1141 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1142 |
7961 | 1143 static void |
9188 | 1144 menu_timestamps_cb(gpointer data, guint action, GtkWidget *widget) |
1145 { | |
1146 GaimConvWindow *win = (GaimConvWindow *)data; | |
1147 GaimConversation *conv; | |
1148 GaimGtkConversation *gtkconv; | |
1149 | |
1150 conv = gaim_conv_window_get_active_conversation(win); | |
1151 | |
1152 if (!conv) | |
1153 return; | |
1154 | |
1155 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1156 | |
1157 gtkconv->show_timestamps = | |
1158 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); | |
1159 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
1160 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))); | |
1161 } | |
1162 | |
1163 static void | |
7961 | 1164 chat_do_im(GaimConversation *conv, const char *who) |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1165 { |
7961 | 1166 GaimPluginProtocolInfo *prpl_info = NULL; |
1167 char *real_who; | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1168 GaimConversation *conv2; |
7961 | 1169 GaimAccount *account; |
1170 | |
1171 account = gaim_conversation_get_account(conv); | |
1172 | |
1173 if(account && account->gc) | |
1174 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl); | |
1175 | |
1176 if(prpl_info && prpl_info->get_cb_real_name) | |
1177 real_who = prpl_info->get_cb_real_name(account->gc, | |
1178 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); | |
1179 else | |
1180 real_who = g_strdup(who); | |
1181 | |
1182 if(!real_who) | |
1183 return; | |
1184 | |
1185 conv2 = gaim_find_conversation_with_account(real_who, account); | |
1186 | |
1187 if (conv2 != NULL) | |
1188 gaim_conv_window_show(gaim_conversation_get_window(conv2)); | |
1189 else | |
1190 conv2 = gaim_conversation_new(GAIM_CONV_IM, account, real_who); | |
1191 | |
1192 g_free(real_who); | |
1193 } | |
1194 | |
1195 | |
1196 static void | |
1197 chat_im_button_cb(GtkWidget *widget, GaimConversation *conv) | |
1198 { | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1199 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1200 GaimGtkChatPane *gtkchat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1201 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1202 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1203 GtkTreeSelection *sel; |
9554 | 1204 char *name; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1205 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1206 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1207 gtkchat = gtkconv->u.chat; |
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 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1210 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1211 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1212 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) |
9498 | 1213 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
|
1214 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1215 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1216 |
7961 | 1217 chat_do_im(conv, name); |
9554 | 1218 g_free(name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1219 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1220 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1221 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1222 ignore_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1223 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1224 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1225 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1226 GaimConvChat *chat; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1227 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1228 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1229 GtkTreeSelection *sel; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1230 const char *name; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1231 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1232 chat = GAIM_CONV_CHAT(conv); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1233 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1234 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1235 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1236 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1237 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1238 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1239 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) { |
9498 | 1240 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
|
1241 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1242 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1243 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1244 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1245 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1246 if (gaim_conv_chat_is_user_ignored(chat, name)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1247 gaim_conv_chat_unignore(chat, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1248 else |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1249 gaim_conv_chat_ignore(chat, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1250 |
9554 | 1251 add_chat_buddy_common(conv, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1252 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1253 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1254 static void |
7398 | 1255 menu_chat_im_cb(GtkWidget *w, GaimConversation *conv) |
1256 { | |
1257 const char *who = g_object_get_data(G_OBJECT(w), "user_data"); | |
1258 | |
1259 chat_do_im(conv, who); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1260 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1261 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1262 static void |
9468 | 1263 menu_chat_send_file_cb(GtkWidget *w, GaimConversation *conv) |
1264 { | |
1265 const char *who = g_object_get_data(G_OBJECT(w), "user_data"); | |
1266 GaimConnection *gc = gaim_conversation_get_gc(conv); | |
1267 | |
1268 serv_send_file(gc, who, NULL); | |
1269 } | |
1270 | |
1271 static void | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1272 menu_chat_info_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1273 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1274 char *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1275 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1276 who = g_object_get_data(G_OBJECT(w), "user_data"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1277 |
7975 | 1278 chat_do_info(conv, who); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1279 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1280 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1281 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1282 menu_chat_get_away_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1283 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1284 GaimPluginProtocolInfo *prpl_info = NULL; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1285 GaimConnection *gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1286 char *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1287 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1288 gc = gaim_conversation_get_gc(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1289 who = g_object_get_data(G_OBJECT(w), "user_data"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1290 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1291 if (gc != NULL) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1292 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1293 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1294 /* |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1295 * 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
|
1296 */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1297 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1298 if (prpl_info->get_cb_away != NULL) |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1299 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1300 prpl_info->get_cb_away(gc, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1301 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1302 } |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1303 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1304 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1305 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1306 static void |
7928 | 1307 menu_chat_add_remove_cb(GtkWidget *w, GaimConversation *conv) |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1308 { |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1309 GaimAccount *account; |
6695 | 1310 GaimBuddy *b; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1311 char *name; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1312 |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1313 account = gaim_conversation_get_account(conv); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1314 name = g_object_get_data(G_OBJECT(w), "user_data"); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1315 b = gaim_find_buddy(account, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1316 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1317 if (b != NULL) |
9730 | 1318 gaim_gtkdialogs_remove_buddy(b); |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1319 else if (account != NULL && gaim_account_is_connected(account)) |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1320 gaim_blist_request_add_buddy(account, name, NULL, NULL); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1321 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1322 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1323 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1324 |
8143 | 1325 static GtkWidget * |
1326 create_chat_menu(GaimConversation *conv, gchar *who, | |
1327 GaimPluginProtocolInfo *prpl_info, GaimConnection *gc) | |
1328 { | |
1329 static GtkWidget *menu = NULL; | |
1330 GtkWidget *button; | |
1331 | |
1332 /* | |
1333 * If a menu already exists, destroy it before creating a new one, | |
1334 * thus freeing-up the memory it occupied. | |
1335 */ | |
1336 if (menu) | |
1337 gtk_widget_destroy(menu); | |
1338 | |
1339 menu = gtk_menu_new(); | |
1340 | |
1341 button = gtk_menu_item_new_with_label(_("IM")); | |
1342 g_signal_connect(G_OBJECT(button), "activate", | |
1343 G_CALLBACK(menu_chat_im_cb), conv); | |
1344 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1345 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1346 gtk_widget_show(button); | |
1347 | |
9468 | 1348 if (gc && prpl_info && prpl_info->send_file |
1349 && (!prpl_info->can_receive_file || prpl_info->can_receive_file(gc, who))) { | |
1350 button = gtk_menu_item_new_with_label(_("Send File")); | |
1351 g_signal_connect(G_OBJECT(button), "activate", | |
1352 G_CALLBACK(menu_chat_send_file_cb), conv); | |
1353 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1354 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1355 gtk_widget_show(button); | |
1356 } | |
9498 | 1357 |
8143 | 1358 if (gaim_conv_chat_is_user_ignored(GAIM_CONV_CHAT(conv), who)) |
1359 button = gtk_menu_item_new_with_label(_("Un-Ignore")); | |
1360 else | |
1361 button = gtk_menu_item_new_with_label(_("Ignore")); | |
1362 | |
1363 g_signal_connect(G_OBJECT(button), "activate", | |
1364 G_CALLBACK(ignore_cb), conv); | |
1365 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1366 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1367 gtk_widget_show(button); | |
1368 | |
8170 | 1369 if (gc && (prpl_info->get_info || prpl_info->get_cb_info)) { |
8143 | 1370 button = gtk_menu_item_new_with_label(_("Info")); |
1371 g_signal_connect(G_OBJECT(button), "activate", | |
1372 G_CALLBACK(menu_chat_info_cb), conv); | |
1373 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1374 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1375 gtk_widget_show(button); | |
1376 } | |
1377 | |
1378 if (gc && prpl_info->get_cb_away) { | |
1379 button = gtk_menu_item_new_with_label(_("Get Away Msg")); | |
1380 g_signal_connect(G_OBJECT(button), "activate", | |
1381 G_CALLBACK(menu_chat_get_away_cb), conv); | |
1382 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1383 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1384 gtk_widget_show(button); | |
1385 } | |
1386 | |
8170 | 1387 /* XXX: jabber can only add buddies from here in certain circumstances */ |
8143 | 1388 /* Added by Jonas <jonas@birme.se> */ |
1389 if (gc) { | |
1390 if (gaim_find_buddy(gc->account, who)) | |
1391 button = gtk_menu_item_new_with_label(_("Remove")); | |
1392 else | |
1393 button = gtk_menu_item_new_with_label(_("Add")); | |
1394 | |
1395 g_signal_connect(G_OBJECT(button), "activate", | |
1396 G_CALLBACK(menu_chat_add_remove_cb), conv); | |
1397 | |
1398 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1399 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1400 gtk_widget_show(button); | |
1401 } | |
1402 /* End Jonas */ | |
1403 | |
1404 return menu; | |
1405 } | |
1406 | |
1407 | |
1408 static gint | |
1409 gtkconv_chat_popup_menu_cb(GtkWidget *widget, GaimConversation *conv) | |
1410 { | |
1411 GaimGtkConversation *gtkconv; | |
1412 GaimPluginProtocolInfo *prpl_info = NULL; | |
1413 GaimGtkChatPane *gtkchat; | |
1414 GaimConnection *gc; | |
1415 GaimAccount *account; | |
1416 GtkTreeSelection *sel; | |
1417 GtkTreeIter iter; | |
1418 GtkTreeModel *model; | |
1419 GtkWidget *menu; | |
1420 gchar *who; | |
1421 | |
1422 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1423 gtkchat = gtkconv->u.chat; | |
1424 account = gaim_conversation_get_account(conv); | |
1425 gc = account->gc; | |
1426 | |
1427 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | |
1428 | |
1429 if (gc != NULL) | |
1430 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | |
1431 | |
1432 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); | |
1433 if(!gtk_tree_selection_get_selected(sel, NULL, &iter)) | |
1434 return FALSE; | |
1435 | |
9498 | 1436 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &who, -1); |
8143 | 1437 menu = create_chat_menu (conv, who, prpl_info, gc); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1438 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1439 gaim_gtk_treeview_popup_menu_position_func, widget, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1440 0, GDK_CURRENT_TIME); |
8143 | 1441 |
1442 return TRUE; | |
1443 } | |
1444 | |
1445 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1446 static gint |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1447 right_click_chat_cb(GtkWidget *widget, GdkEventButton *event, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1448 GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1449 { |
8143 | 1450 GaimGtkConversation *gtkconv; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1451 GaimPluginProtocolInfo *prpl_info = NULL; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1452 GaimGtkChatPane *gtkchat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1453 GaimConnection *gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1454 GaimAccount *account; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1455 GtkTreePath *path; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1456 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1457 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1458 GtkTreeViewColumn *column; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1459 gchar *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1460 int x, y; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1461 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1462 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1463 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1464 account = gaim_conversation_get_account(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1465 gc = account->gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1466 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1467 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1468 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1469 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
|
1470 event->x, event->y, &path, &column, &x, &y); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1471 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1472 if (path == NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1473 return FALSE; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1474 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1475 if (gc != NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1476 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1477 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1478 gtk_tree_selection_select_path(GTK_TREE_SELECTION( |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1479 gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list))), path); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1480 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1481 gtk_tree_model_get_iter(GTK_TREE_MODEL(model), &iter, path); |
9498 | 1482 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
|
1483 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1484 if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) { |
7398 | 1485 chat_do_im(conv, who); |
9554 | 1486 g_free(who); |
7398 | 1487 } else if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { |
8143 | 1488 GtkWidget *menu = create_chat_menu (conv, who, prpl_info, gc); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1489 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1490 event->button, event->time); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1491 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1492 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1493 return TRUE; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1494 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1495 |
8133 | 1496 static void |
1497 move_to_next_unread_tab(GaimConversation *conv) | |
1498 { | |
1499 GaimConversation *next_conv = NULL; | |
1500 GaimConvWindow *win; | |
1501 GList *l; | |
1502 int index, i; | |
1503 | |
1504 win = gaim_conversation_get_window(conv); | |
1505 index = gaim_conversation_get_index(conv); | |
1506 | |
1507 /* First check the tabs after this position. */ | |
1508 for (l = g_list_nth(gaim_conv_window_get_conversations(win), index); | |
1509 l != NULL; | |
1510 l = l->next) { | |
1511 | |
1512 next_conv = (GaimConversation *)l->data; | |
1513 | |
1514 if (gaim_conversation_get_unseen(next_conv) > 0) | |
1515 break; | |
1516 | |
1517 next_conv = NULL; | |
1518 } | |
1519 | |
1520 if (next_conv == NULL) { | |
1521 | |
1522 /* Now check before this position. */ | |
1523 for (l = gaim_conv_window_get_conversations(win), i = 0; | |
1524 l != NULL && i < index; | |
1525 l = l->next) { | |
1526 | |
1527 next_conv = (GaimConversation *)l->data; | |
1528 | |
1529 if (gaim_conversation_get_unseen(next_conv) > 0) | |
1530 break; | |
1531 | |
1532 next_conv = NULL; | |
1533 } | |
1534 | |
1535 if (next_conv == NULL) { | |
1536 /* Okay, just grab the next conversation tab. */ | |
1537 if (index == gaim_conv_window_get_conversation_count(win) - 1) | |
1538 next_conv = gaim_conv_window_get_conversation_at(win, 0); | |
1539 else | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1540 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1541 next_conv = gaim_conv_window_get_conversation_at(win, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1542 index + 1); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1543 } |
8133 | 1544 } |
1545 } | |
1546 | |
1547 if (next_conv != NULL && next_conv != conv) { | |
1548 gaim_conv_window_switch_conversation(win, | |
1549 gaim_conversation_get_index(next_conv)); | |
1550 } | |
1551 } | |
1552 | |
4359 | 1553 static gboolean |
8105 | 1554 entry_key_press_cb(GtkWidget *entry, GdkEventKey *event, gpointer data) |
4359 | 1555 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1556 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1557 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1558 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1559 GaimGtkWindow *gtkwin; |
8105 | 1560 int numconvs; |
1561 int curconv; | |
1562 | |
1563 conv = (GaimConversation *)data; | |
1564 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1565 win = gaim_conversation_get_window(conv); | |
1566 gtkwin = GAIM_GTK_WINDOW(win); | |
1567 numconvs = gaim_conv_window_get_conversation_count(win); | |
1568 curconv = gaim_conversation_get_index(conv); | |
1569 | |
1570 /* If CTRL was held down... */ | |
1571 if (event->state & GDK_CONTROL_MASK) { | |
4359 | 1572 switch (event->keyval) { |
8105 | 1573 case GDK_Return: |
1574 case GDK_KP_Enter: | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1575 if (gaim_prefs_get_bool( |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1576 "/gaim/gtk/conversations/ctrl_enter_sends")) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1577 { |
8105 | 1578 send_cb(NULL, conv); |
1579 | |
1580 return TRUE; | |
1581 } | |
1582 break; | |
1583 | |
4359 | 1584 case GDK_Up: |
1585 if (!conv->send_history) | |
1586 break; | |
1587 | |
1588 if (!conv->send_history->prev) { | |
1589 GtkTextIter start, end; | |
1590 | |
1591 if (conv->send_history->data) | |
1592 g_free(conv->send_history->data); | |
1593 | |
1594 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, | |
1595 &start); | |
1596 gtk_text_buffer_get_end_iter(gtkconv->entry_buffer, &end); | |
1597 | |
1598 conv->send_history->data = | |
8506 | 1599 gtk_imhtml_get_markup(GTK_IMHTML(gtkconv->entry)); |
4359 | 1600 } |
8677 | 1601 |
4359 | 1602 if (conv->send_history->next && |
1603 conv->send_history->next->data) { | |
8677 | 1604 GtkTextIter iter; |
1605 GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); | |
4359 | 1606 |
1607 conv->send_history = conv->send_history->next; | |
8061 | 1608 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1609 gtk_imhtml_append_text_with_images( |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1610 GTK_IMHTML(gtkconv->entry), conv->send_history->data, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1611 0, NULL); |
8677 | 1612 /* this is mainly just a hack so the formatting at the |
1613 * cursor gets picked up. */ | |
1614 gtk_text_buffer_get_end_iter(buffer, &iter); | |
1615 gtk_text_buffer_move_mark_by_name(buffer, "insert", &iter); | |
4359 | 1616 } |
1617 | |
8105 | 1618 return TRUE; |
4359 | 1619 break; |
1620 | |
1621 case GDK_Down: | |
1622 if (!conv->send_history) | |
1623 break; | |
1624 | |
8105 | 1625 if (conv->send_history->prev && |
1626 conv->send_history->prev->data) { | |
8677 | 1627 GtkTextIter iter; |
1628 GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); | |
8105 | 1629 |
4359 | 1630 conv->send_history = conv->send_history->prev; |
8105 | 1631 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1632 gtk_imhtml_append_text_with_images( |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1633 GTK_IMHTML(gtkconv->entry), conv->send_history->data, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1634 0, NULL); |
8677 | 1635 /* this is mainly just a hack so the formatting at the |
1636 * cursor gets picked up. */ | |
1637 gtk_text_buffer_get_end_iter(buffer, &iter); | |
1638 gtk_text_buffer_move_mark_by_name(buffer, "insert", &iter); | |
4359 | 1639 } |
1640 | |
8105 | 1641 return TRUE; |
4359 | 1642 break; |
8105 | 1643 |
8108 | 1644 case GDK_Page_Down: |
8143 | 1645 case ']': |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1646 gaim_conv_window_switch_conversation(win, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1647 (curconv + 1) % numconvs); |
8105 | 1648 |
1649 return TRUE; | |
1650 break; | |
1651 | |
8108 | 1652 case GDK_Page_Up: |
8143 | 1653 case '[': |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1654 gaim_conv_window_switch_conversation(win, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1655 (curconv + numconvs - 1) % numconvs); |
8133 | 1656 |
1657 return TRUE; | |
1658 break; | |
1659 | |
8108 | 1660 case GDK_Tab: |
8133 | 1661 move_to_next_unread_tab(conv); |
8108 | 1662 |
1663 return TRUE; | |
1664 break; | |
1665 | |
1666 case 'z': | |
1667 gtk_window_iconify(GTK_WINDOW(gtkwin->window)); | |
8105 | 1668 |
1669 return TRUE; | |
1670 break; | |
1671 | |
1672 } /* End of switch */ | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1673 } |
8758 | 1674 |
8105 | 1675 /* If ALT (or whatever) was held down... */ |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1676 else if (event->state & GDK_MOD1_MASK) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1677 { |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8730
diff
changeset
|
1678 /* XXX - Make sure the conv exists before switching to it */ |
8105 | 1679 if (event->keyval > '0' && event->keyval <= '9') { |
1680 int switchto = event->keyval - '1'; | |
1681 if (switchto < numconvs) | |
1682 gaim_conv_window_switch_conversation(win, switchto); | |
4359 | 1683 |
1684 return TRUE; | |
1685 } | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1686 } |
8758 | 1687 |
8105 | 1688 /* If neither CTRL nor ALT were held down... */ |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1689 else |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1690 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1691 switch (event->keyval) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1692 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1693 case GDK_Return: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1694 case GDK_KP_Enter: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1695 if (!(event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK)) && |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1696 gaim_prefs_get_bool("/gaim/gtk/conversations/enter_sends")) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1697 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1698 send_cb(NULL, conv); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1699 return TRUE; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1700 } |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1701 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1702 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1703 case GDK_Tab: |
9605 | 1704 return tab_complete(conv); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1705 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1706 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1707 case GDK_Page_Up: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1708 gtk_imhtml_page_up(GTK_IMHTML(gtkconv->imhtml)); |
8105 | 1709 return TRUE; |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1710 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1711 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1712 case GDK_Page_Down: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1713 gtk_imhtml_page_down(GTK_IMHTML(gtkconv->imhtml)); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1714 return TRUE; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1715 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1716 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1717 } |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1718 } |
4359 | 1719 |
1720 return FALSE; | |
1721 } | |
1722 | |
1723 /* | |
1724 * NOTE: | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1725 * 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
|
1726 * further. I have no idea *why* we need this, but we do ... It |
4359 | 1727 * 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
|
1728 * going all the way down to the notebook. I suspect a bug in |
4359 | 1729 * GtkTextView, but I'm not ready to point any fingers yet. |
1730 */ | |
1731 static gboolean | |
1732 entry_stop_rclick_cb(GtkWidget *widget, GdkEventButton *event, gpointer data) | |
1733 { | |
1734 if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { | |
1735 /* Right single click */ | |
1736 g_signal_stop_emission_by_name(G_OBJECT(widget), "button_press_event"); | |
1737 | |
1738 return TRUE; | |
1739 } | |
1740 | |
1741 return FALSE; | |
1742 } | |
1743 | |
8173 | 1744 /* |
1745 * If someone tries to type into the conversation backlog of a | |
1746 * conversation window then we yank focus from the conversation backlog | |
1747 * and give it to the text entry box so that people can type | |
1748 * all the live long day and it will get entered into the entry box. | |
1749 */ | |
6057 | 1750 static gboolean |
8105 | 1751 refocus_entry_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) |
6057 | 1752 { |
1753 GaimGtkConversation *gtkconv = data; | |
1754 | |
8237 | 1755 /* If we have a valid key for the conversation display, then exit */ |
8224 | 1756 if ((event->state & GDK_CONTROL_MASK) || |
8237 | 1757 (event->keyval == GDK_F10) || |
1758 (event->keyval == GDK_Shift_L) || | |
1759 (event->keyval == GDK_Shift_R) || | |
1760 (event->keyval == GDK_Escape) || | |
8177 | 1761 (event->keyval == GDK_Up) || |
1762 (event->keyval == GDK_Down) || | |
1763 (event->keyval == GDK_Left) || | |
8191 | 1764 (event->keyval == GDK_Right) || |
1765 (event->keyval == GDK_Home) || | |
9297 | 1766 (event->keyval == GDK_End) || |
1767 (event->keyval == GDK_Tab) || | |
1768 (event->keyval == GDK_ISO_Left_Tab)) | |
8177 | 1769 return FALSE; |
1770 | |
1771 if (event->type == GDK_KEY_RELEASE) | |
1772 gtk_widget_grab_focus(gtkconv->entry); | |
1773 | |
1774 gtk_widget_event(gtkconv->entry, (GdkEvent *)event); | |
1775 | |
1776 return TRUE; | |
6057 | 1777 } |
1778 | |
4359 | 1779 static void |
4673 | 1780 menu_conv_sel_send_cb(GObject *m, gpointer data) |
4359 | 1781 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1782 GaimConvWindow *win = g_object_get_data(m, "user_data"); |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
1783 GaimAccount *account = g_object_get_data(m, "gaim_account"); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1784 GaimConversation *conv; |
8456 | 1785 GaimGtkConversation *gtkconv; |
4359 | 1786 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1787 conv = gaim_conv_window_get_active_conversation(win); |
4359 | 1788 |
4491 | 1789 gaim_conversation_set_account(conv, account); |
8456 | 1790 |
1791 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1792 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), | |
9699 | 1793 gaim_account_get_protocol_name(conv->account)); |
4359 | 1794 } |
1795 | |
1796 static void | |
1797 insert_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *position, | |
1798 gchar *new_text, gint new_text_length, gpointer user_data) | |
1799 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1800 GaimConversation *conv = (GaimConversation *)user_data; |
4359 | 1801 |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1802 g_return_if_fail(conv != NULL); |
4359 | 1803 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1804 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) |
4359 | 1805 return; |
1806 | |
1807 got_typing_keypress(conv, (gtk_text_iter_is_start(position) && | |
1808 gtk_text_iter_is_end(position))); | |
1809 } | |
1810 | |
1811 static void | |
1812 delete_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *start_pos, | |
1813 GtkTextIter *end_pos, gpointer user_data) | |
1814 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1815 GaimConversation *conv = (GaimConversation *)user_data; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1816 GaimConvIm *im; |
4359 | 1817 |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1818 g_return_if_fail(conv != NULL); |
4359 | 1819 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1820 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) |
4359 | 1821 return; |
1822 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1823 im = GAIM_CONV_IM(conv); |
4359 | 1824 |
1825 if (gtk_text_iter_is_start(start_pos) && gtk_text_iter_is_end(end_pos)) { | |
1826 | |
1827 /* We deleted all the text, so turn off typing. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1828 if (gaim_conv_im_get_type_again_timeout(im)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1829 gaim_conv_im_stop_type_again_timeout(im); |
4359 | 1830 |
1831 serv_send_typing(gaim_conversation_get_gc(conv), | |
6695 | 1832 gaim_conversation_get_name(conv), |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
1833 GAIM_NOT_TYPING); |
4359 | 1834 } |
1835 else { | |
1836 /* We're deleting, but not all of it, so it counts as typing. */ | |
1837 got_typing_keypress(conv, FALSE); | |
1838 } | |
1839 } | |
1840 | |
1841 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1842 notebook_init_grab(GaimGtkWindow *gtkwin, GtkWidget *widget) |
4359 | 1843 { |
1844 static GdkCursor *cursor = NULL; | |
1845 | |
1846 gtkwin->in_drag = TRUE; | |
1847 | |
1848 if (gtkwin->drag_leave_signal) { | |
1849 g_signal_handler_disconnect(G_OBJECT(widget), | |
1850 gtkwin->drag_leave_signal); | |
1851 | |
1852 gtkwin->drag_leave_signal = 0; | |
1853 } | |
1854 | |
1855 if (cursor == NULL) | |
1856 cursor = gdk_cursor_new(GDK_FLEUR); | |
1857 | |
1858 /* Grab the pointer */ | |
1859 gtk_grab_add(gtkwin->notebook); | |
5114
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1860 #ifndef _WIN32 |
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1861 /* 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
|
1862 always be true after a button press. */ |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1863 if (!gdk_pointer_is_grabbed()) |
5114
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1864 #endif |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1865 gdk_pointer_grab(gtkwin->notebook->window, FALSE, |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1866 GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1867 NULL, cursor, GDK_CURRENT_TIME); |
4359 | 1868 } |
1869 | |
1870 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1871 notebook_motion_cb(GtkWidget *widget, GdkEventButton *e, GaimConvWindow *win) |
4359 | 1872 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1873 GaimGtkWindow *gtkwin; |
4359 | 1874 |
1875 gtkwin = GAIM_GTK_WINDOW(win); | |
1876 | |
1877 /* | |
1878 * Make sure the user moved the mouse far enough for the | |
1879 * drag to be initiated. | |
1880 */ | |
1881 if (gtkwin->in_predrag) { | |
1882 if (e->x_root < gtkwin->drag_min_x || | |
1883 e->x_root >= gtkwin->drag_max_x || | |
1884 e->y_root < gtkwin->drag_min_y || | |
1885 e->y_root >= gtkwin->drag_max_y) { | |
1886 | |
1887 gtkwin->in_predrag = FALSE; | |
1888 notebook_init_grab(gtkwin, widget); | |
1889 } | |
1890 } | |
1891 else { /* Otherwise, draw the arrows. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1892 GaimConvWindow *dest_win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1893 GaimGtkWindow *dest_gtkwin; |
4359 | 1894 GtkNotebook *dest_notebook; |
1895 GtkWidget *tab, *last_vis_tab = NULL; | |
1896 gint nb_x, nb_y, page_num, i, last_vis_tab_loc = -1; | |
1897 gint arrow1_x, arrow1_y, arrow2_x, arrow2_y; | |
1898 gboolean horiz_tabs = FALSE, tab_found = FALSE; | |
1899 GList *l; | |
1900 | |
1901 /* Get the window that the cursor is over. */ | |
1902 dest_win = gaim_gtkwin_get_at_xy(e->x_root, e->y_root); | |
1903 | |
1904 if (dest_win == NULL) { | |
1905 dnd_hints_hide_all(); | |
1906 | |
1907 return TRUE; | |
1908 } | |
1909 | |
1910 dest_gtkwin = GAIM_GTK_WINDOW(dest_win); | |
1911 | |
1912 dest_notebook = GTK_NOTEBOOK(dest_gtkwin->notebook); | |
1913 | |
1914 gdk_window_get_origin(GTK_WIDGET(dest_notebook)->window, &nb_x, &nb_y); | |
1915 | |
1916 arrow1_x = arrow2_x = nb_x; | |
1917 arrow1_y = arrow2_y = nb_y; | |
1918 | |
1919 page_num = gaim_gtkconv_get_dest_tab_at_xy(dest_win, | |
1920 e->x_root, e->y_root); | |
1921 | |
1922 if (gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_TOP || | |
1923 gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_BOTTOM) { | |
1924 | |
1925 horiz_tabs = TRUE; | |
1926 } | |
1927 | |
1928 /* Find out where to put the arrows. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1929 for (l = gaim_conv_window_get_conversations(dest_win), i = 0; |
4359 | 1930 l != NULL; |
1931 l = l->next, i++) { | |
1932 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1933 GaimConversation *conv = l->data; |
4359 | 1934 |
1935 tab = GAIM_GTK_CONVERSATION(conv)->tabby; | |
1936 | |
1937 /* | |
1938 * If this is the correct tab, record the positions | |
1939 * for the arrows. | |
1940 */ | |
1941 if (i == page_num) { | |
1942 if (horiz_tabs) { | |
1943 arrow1_x = arrow2_x = nb_x + tab->allocation.x; | |
1944 arrow1_y = nb_y + tab->allocation.y; | |
1945 arrow2_y = nb_y + tab->allocation.y + | |
1946 tab->allocation.height; | |
1947 } | |
1948 else { | |
1949 arrow1_x = nb_x + tab->allocation.x; | |
1950 arrow2_x = nb_x + tab->allocation.x + | |
1951 tab->allocation.width; | |
1952 arrow1_y = arrow2_y = nb_y + tab->allocation.y; | |
1953 } | |
1954 | |
1955 tab_found = TRUE; | |
1956 break; | |
1957 } | |
1958 else { /* Keep track of the right-most tab that we see. */ | |
1959 if (horiz_tabs && tab->allocation.x > last_vis_tab_loc) { | |
1960 last_vis_tab = tab; | |
1961 last_vis_tab_loc = tab->allocation.x; | |
1962 } | |
1963 else if (!horiz_tabs && tab->allocation.y > last_vis_tab_loc) { | |
1964 last_vis_tab = tab; | |
1965 last_vis_tab_loc = tab->allocation.y; | |
1966 } | |
1967 } | |
1968 } | |
1969 | |
1970 /* | |
1971 * If we didn't find the tab, then we'll just place the | |
1972 * arrows to the right/bottom of the last visible tab. | |
1973 */ | |
1974 if (!tab_found && last_vis_tab) { | |
1975 if (horiz_tabs) { | |
1976 arrow1_x = arrow2_x = nb_x + last_vis_tab->allocation.x + | |
1977 last_vis_tab->allocation.width; | |
1978 arrow1_y = nb_y + last_vis_tab->allocation.y; | |
1979 arrow2_y = nb_y + last_vis_tab->allocation.y + | |
1980 last_vis_tab->allocation.height; | |
1981 } | |
1982 else { | |
1983 arrow1_x = nb_x + last_vis_tab->allocation.x; | |
1984 arrow2_x = nb_x + last_vis_tab->allocation.x + | |
1985 last_vis_tab->allocation.width; | |
1986 arrow1_y = arrow2_y = nb_y + last_vis_tab->allocation.y + | |
1987 last_vis_tab->allocation.height; | |
1988 } | |
1989 } | |
1990 | |
1991 if (horiz_tabs) { | |
1992 dnd_hints_show(HINT_ARROW_DOWN, arrow1_x, arrow1_y); | |
1993 dnd_hints_show(HINT_ARROW_UP, arrow2_x, arrow2_y); | |
1994 } | |
1995 else { | |
1996 dnd_hints_show(HINT_ARROW_RIGHT, arrow1_x, arrow1_y); | |
1997 dnd_hints_show(HINT_ARROW_LEFT, arrow2_x, arrow2_y); | |
1998 } | |
1999 } | |
2000 | |
2001 return TRUE; | |
2002 } | |
2003 | |
2004 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2005 notebook_leave_cb(GtkWidget *widget, GdkEventCrossing *e, GaimConvWindow *win) |
4359 | 2006 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2007 GaimGtkWindow *gtkwin; |
4359 | 2008 |
2009 gtkwin = GAIM_GTK_WINDOW(win); | |
2010 | |
2011 if (gtkwin->in_drag) | |
2012 return FALSE; | |
2013 | |
2014 if (e->x_root < gtkwin->drag_min_x || | |
2015 e->x_root >= gtkwin->drag_max_x || | |
2016 e->y_root < gtkwin->drag_min_y || | |
2017 e->y_root >= gtkwin->drag_max_y) { | |
2018 | |
2019 gtkwin->in_predrag = FALSE; | |
2020 notebook_init_grab(gtkwin, widget); | |
2021 } | |
2022 | |
2023 return TRUE; | |
2024 } | |
2025 | |
2026 /* | |
2027 * THANK YOU GALEON! | |
2028 */ | |
2029 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2030 notebook_press_cb(GtkWidget *widget, GdkEventButton *e, GaimConvWindow *win) |
4359 | 2031 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2032 GaimGtkWindow *gtkwin; |
4359 | 2033 gint nb_x, nb_y, x_rel, y_rel; |
2034 GList *l; | |
2035 int tab_clicked; | |
2036 | |
2037 if (e->button != 1 || e->type != GDK_BUTTON_PRESS) | |
2038 return FALSE; | |
2039 | |
2040 gtkwin = GAIM_GTK_WINDOW(win); | |
2041 | |
2042 if (gtkwin->in_drag) { | |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
2043 gaim_debug(GAIM_DEBUG_WARNING, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
2044 "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
|
2045 return TRUE; |
4359 | 2046 } |
2047 | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2048 /* |
4359 | 2049 * Make sure a tab was actually clicked. The arrow buttons |
2050 * mess things up. | |
2051 */ | |
2052 tab_clicked = gaim_gtkconv_get_tab_at_xy(win, e->x_root, e->y_root); | |
2053 | |
2054 if (tab_clicked == -1) | |
2055 return FALSE; | |
2056 | |
2057 /* | |
2058 * Get the relative position of the press event, with regards to | |
2059 * the position of the notebook. | |
2060 */ | |
2061 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
2062 | |
2063 x_rel = e->x_root - nb_x; | |
2064 y_rel = e->y_root - nb_y; | |
2065 | |
2066 /* Reset the min/max x/y */ | |
2067 gtkwin->drag_min_x = 0; | |
2068 gtkwin->drag_min_y = 0; | |
2069 gtkwin->drag_max_x = 0; | |
2070 gtkwin->drag_max_y = 0; | |
2071 | |
2072 /* Find out which tab was dragged. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2073 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
|
2074 GaimConversation *conv = l->data; |
4359 | 2075 GtkWidget *tab = GAIM_GTK_CONVERSATION(conv)->tabby; |
2076 | |
2077 if (!GTK_WIDGET_VISIBLE(tab)) | |
2078 continue; | |
2079 | |
2080 if (tab->allocation.x > x_rel || tab->allocation.y > y_rel) | |
2081 break; | |
2082 | |
2083 /* Save the borders of the tab. */ | |
2084 gtkwin->drag_min_x = tab->allocation.x + nb_x; | |
2085 gtkwin->drag_min_y = tab->allocation.y + nb_y; | |
2086 gtkwin->drag_max_x = tab->allocation.width + gtkwin->drag_min_x; | |
2087 gtkwin->drag_max_y = tab->allocation.height + gtkwin->drag_min_y; | |
2088 } | |
2089 | |
2090 /* Make sure the click occurred in the tab. */ | |
2091 if (e->x_root < gtkwin->drag_min_x || | |
2092 e->x_root >= gtkwin->drag_max_x || | |
2093 e->y_root < gtkwin->drag_min_y || | |
2094 e->y_root >= gtkwin->drag_max_y) { | |
2095 | |
2096 return FALSE; | |
2097 } | |
2098 | |
2099 gtkwin->in_predrag = TRUE; | |
2100 | |
2101 /* Connect the new motion signals. */ | |
2102 gtkwin->drag_motion_signal = | |
2103 g_signal_connect(G_OBJECT(widget), "motion_notify_event", | |
2104 G_CALLBACK(notebook_motion_cb), win); | |
2105 | |
2106 gtkwin->drag_leave_signal = | |
2107 g_signal_connect(G_OBJECT(widget), "leave_notify_event", | |
2108 G_CALLBACK(notebook_leave_cb), win); | |
2109 | |
2110 return FALSE; | |
2111 } | |
2112 | |
2113 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2114 notebook_release_cb(GtkWidget *widget, GdkEventButton *e, GaimConvWindow *win) |
4359 | 2115 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2116 GaimConvWindow *dest_win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2117 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2118 GaimGtkWindow *dest_gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2119 GaimConversation *conv; |
4359 | 2120 GtkNotebook *dest_notebook; |
2121 gint dest_page_num; | |
2122 | |
2123 /* | |
2124 * Don't check to make sure that the event's window matches the | |
2125 * widget's, because we may be getting an event passed on from the | |
2126 * close button. | |
2127 */ | |
2128 if (e->button != 1 && e->type != GDK_BUTTON_RELEASE) | |
2129 return FALSE; | |
2130 | |
2131 if (gdk_pointer_is_grabbed()) { | |
2132 gdk_pointer_ungrab(GDK_CURRENT_TIME); | |
2133 gtk_grab_remove(widget); | |
2134 } | |
2135 | |
2136 gtkwin = GAIM_GTK_WINDOW(win); | |
2137 | |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
2138 if (!gtkwin->in_predrag && !gtkwin->in_drag) |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
2139 return FALSE; |
4359 | 2140 |
2141 /* Disconnect the motion signal. */ | |
2142 if (gtkwin->drag_motion_signal) { | |
2143 g_signal_handler_disconnect(G_OBJECT(widget), | |
2144 gtkwin->drag_motion_signal); | |
2145 | |
2146 gtkwin->drag_motion_signal = 0; | |
2147 } | |
2148 | |
2149 /* | |
2150 * If we're in a pre-drag, we'll also need to disconnect the leave | |
2151 * signal. | |
2152 */ | |
2153 if (gtkwin->in_predrag) { | |
2154 gtkwin->in_predrag = FALSE; | |
2155 | |
2156 if (gtkwin->drag_leave_signal) { | |
2157 g_signal_handler_disconnect(G_OBJECT(widget), | |
2158 gtkwin->drag_leave_signal); | |
2159 | |
2160 gtkwin->drag_leave_signal = 0; | |
2161 } | |
2162 } | |
2163 | |
2164 /* If we're not in drag... */ | |
2165 /* We're perfectly normal people! */ | |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
2166 if (!gtkwin->in_drag) |
4359 | 2167 return FALSE; |
2168 | |
2169 gtkwin->in_drag = FALSE; | |
2170 | |
2171 dnd_hints_hide_all(); | |
2172 | |
4369
7e1fb422e5fd
[gaim-migrate @ 4635]
Christian Hammond <chipx86@chipx86.com>
parents:
4368
diff
changeset
|
2173 dest_win = gaim_gtkwin_get_at_xy(e->x_root, e->y_root); |
4359 | 2174 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2175 conv = gaim_conv_window_get_active_conversation(win); |
4359 | 2176 |
2177 if (dest_win == NULL) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2178 if (gaim_conv_window_get_conversation_count(win) < 2) |
4359 | 2179 return FALSE; |
2180 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2181 if (gaim_conv_window_get_conversation_count(win) > 1) { |
4359 | 2182 /* Make a new window to stick this to. */ |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2183 GaimGtkConversation *gtkconv; |
4748
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2184 gint win_width, win_height; |
5121 | 2185 |
2186 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4359 | 2187 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2188 dest_win = gaim_conv_window_new(); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2189 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2190 gaim_conv_window_add_conversation(dest_win, |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2191 gaim_conv_window_remove_conversation(win, |
5139
d0182ae31ab8
[gaim-migrate @ 5503]
Christian Hammond <chipx86@chipx86.com>
parents:
5133
diff
changeset
|
2192 gaim_conversation_get_index(conv))); |
5121 | 2193 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2194 dest_gtkwin = GAIM_GTK_WINDOW(dest_win); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2195 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2196 gtk_window_get_size(GTK_WINDOW(dest_gtkwin->window), |
4748
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2197 &win_width, &win_height); |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2198 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2199 gtk_window_move(GTK_WINDOW(dest_gtkwin->window), |
4748
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2200 e->x_root - (win_width / 2), |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2201 e->y_root - (win_height / 2)); |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2202 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2203 gaim_conv_window_show(dest_win); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2204 } |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2205 } else { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2206 dest_gtkwin = GAIM_GTK_WINDOW(dest_win); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2207 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2208 /* Get the destination notebook. */ |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2209 dest_notebook = GTK_NOTEBOOK(gtkwin->notebook); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2210 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2211 /* Get the destination page number. */ |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2212 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
|
2213 e->x_root, e->y_root); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2214 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2215 if (win == dest_win) { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2216 gaim_conv_window_move_conversation(win, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2217 gaim_conversation_get_index(conv), dest_page_num); |
4359 | 2218 } |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2219 else { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2220 size_t pos; |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2221 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2222 gaim_conv_window_remove_conversation(win, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2223 gaim_conversation_get_index(conv)); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2224 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2225 pos = gaim_conv_window_add_conversation(dest_win, conv); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2226 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2227 if (pos != dest_page_num) |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2228 gaim_conv_window_move_conversation(dest_win, pos, dest_page_num); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2229 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2230 gaim_conv_window_switch_conversation(dest_win, dest_page_num); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2231 } |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2232 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2233 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); |
4359 | 2234 } |
2235 | |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2236 gaim_signal_emit(gaim_gtk_conversations_get_handle(), "conversation-drag-ended", |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2237 win, dest_win); |
4359 | 2238 |
2239 return TRUE; | |
2240 } | |
2241 | |
8189 | 2242 /************************************************************************** |
2243 * A bunch of buddy icon functions | |
2244 **************************************************************************/ | |
2245 static GdkPixbuf * | |
8755
d0364feabf96
[gaim-migrate @ 9510]
Christian Hammond <chipx86@chipx86.com>
parents:
8748
diff
changeset
|
2246 get_tab_icon(GaimConversation *conv, gboolean small_icon) |
7143 | 2247 { |
2248 GaimAccount *account = gaim_conversation_get_account(conv); | |
2249 const char *name = gaim_conversation_get_name(conv); | |
2250 GdkPixbuf *status = NULL; | |
2251 | |
2252 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
2253 GaimBuddy *b = gaim_find_buddy(account, name); | |
2254 if (b != NULL) { | |
2255 status = gaim_gtk_blist_get_status_icon((GaimBlistNode*)b, | |
8755
d0364feabf96
[gaim-migrate @ 9510]
Christian Hammond <chipx86@chipx86.com>
parents:
8748
diff
changeset
|
2256 (small_icon ? GAIM_STATUS_ICON_SMALL : GAIM_STATUS_ICON_LARGE)); |
7143 | 2257 } |
2258 } | |
2259 | |
2260 if (!status) { | |
2261 GdkPixbuf *pixbuf; | |
2262 pixbuf = create_prpl_icon(account); | |
2263 | |
8755
d0364feabf96
[gaim-migrate @ 9510]
Christian Hammond <chipx86@chipx86.com>
parents:
8748
diff
changeset
|
2264 if (small_icon && pixbuf != NULL) |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2265 { |
7143 | 2266 status = gdk_pixbuf_scale_simple(pixbuf, 15, 15, |
2267 GDK_INTERP_BILINEAR); | |
2268 g_object_unref(pixbuf); | |
2269 } | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2270 else |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2271 status = pixbuf; |
7143 | 2272 } |
2273 return status; | |
2274 } | |
2275 | |
8189 | 2276 static void |
2277 update_tab_icon(GaimConversation *conv) | |
2278 { | |
2279 GaimGtkConversation *gtkconv; | |
2280 GaimConvWindow *win = gaim_conversation_get_window(conv); | |
2281 GaimAccount *account; | |
2282 const char *name; | |
2283 GdkPixbuf *status = NULL; | |
2284 | |
2285 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2286 name = gaim_conversation_get_name(conv); | |
2287 account = gaim_conversation_get_account(conv); | |
2288 | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2289 status = get_tab_icon(conv, TRUE); |
8189 | 2290 |
2291 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->icon), status); | |
2292 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->menu_icon), status); | |
2293 | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2294 if (status != NULL) |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2295 g_object_unref(status); |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2296 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2297 if (gaim_conv_window_get_active_conversation(win) == conv && |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2298 gtkconv->u.im->anim == NULL) |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2299 { |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2300 status = get_tab_icon(conv, FALSE); |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2301 |
8189 | 2302 gtk_window_set_icon(GTK_WINDOW(GAIM_GTK_WINDOW(win)->window), status); |
2303 | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2304 if (status != NULL) |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2305 g_object_unref(status); |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2306 } |
8189 | 2307 } |
2308 | |
9318 | 2309 static void |
2310 get_icon_scale_size(GdkPixbufAnimation *icon, GaimBuddyIconSpec *spec, int *width, int *height) | |
2311 { | |
2312 *width = gdk_pixbuf_animation_get_width(icon); | |
2313 *height = gdk_pixbuf_animation_get_height(icon); | |
2314 | |
2315 /* this should eventually get smarter about preserving the aspect | |
2316 * ratio when scaling, but gimmie a break, I just woke up */ | |
2317 if(spec && spec->scale_rules & GAIM_ICON_SCALE_DISPLAY) { | |
2318 if(*width < spec->min_width) | |
2319 *width = spec->min_width; | |
2320 else if(*width > spec->max_width) | |
2321 *width = spec->max_width; | |
2322 | |
2323 if(*height < spec->min_height) | |
2324 *height = spec->min_height; | |
9319 | 2325 else if(*height > spec->max_height) |
9318 | 2326 *height = spec->max_height; |
2327 } | |
2328 | |
2329 /* and now for some arbitrary sanity checks */ | |
2330 if(*width > 100) | |
2331 *width = 100; | |
2332 if(*height > 100) | |
2333 *height = 100; | |
2334 } | |
2335 | |
8189 | 2336 static gboolean |
2337 redraw_icon(gpointer data) | |
2338 { | |
2339 GaimConversation *conv = (GaimConversation *)data; | |
2340 GaimGtkConversation *gtkconv; | |
9318 | 2341 GaimAccount *account; |
2342 GaimPluginProtocolInfo *prpl_info = NULL; | |
8189 | 2343 |
2344 GdkPixbuf *buf; | |
2345 GdkPixbuf *scale; | |
2346 GdkPixmap *pm; | |
2347 GdkBitmap *bm; | |
2348 gint delay; | |
9318 | 2349 int scale_width, scale_height; |
8189 | 2350 |
2351 if (!g_list_find(gaim_get_ims(), conv)) { | |
2352 gaim_debug(GAIM_DEBUG_WARNING, "gtkconv", | |
2353 "Conversation not found in redraw_icon. I think this " | |
2354 "is a bug.\n"); | |
2355 return FALSE; | |
2356 } | |
2357 | |
2358 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
9318 | 2359 account = gaim_conversation_get_account(conv); |
2360 if(account && account->gc) | |
2361 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl); | |
8189 | 2362 |
2363 gdk_pixbuf_animation_iter_advance(gtkconv->u.im->iter, NULL); | |
2364 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); | |
2365 | |
9318 | 2366 get_icon_scale_size(gtkconv->u.im->anim, prpl_info ? &prpl_info->icon_spec : |
2367 NULL, &scale_width, &scale_height); | |
2368 | |
2369 /* this code is ugly, and scares me */ | |
8189 | 2370 scale = gdk_pixbuf_scale_simple(buf, |
9318 | 2371 MAX(gdk_pixbuf_get_width(buf) * scale_width / |
8189 | 2372 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), |
9318 | 2373 MAX(gdk_pixbuf_get_height(buf) * scale_height / |
8189 | 2374 gdk_pixbuf_animation_get_height(gtkconv->u.im->anim), 1), |
2375 GDK_INTERP_NEAREST); | |
2376 | |
2377 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); | |
2378 g_object_unref(G_OBJECT(scale)); | |
2379 gtk_image_set_from_pixmap(GTK_IMAGE(gtkconv->u.im->icon), pm, bm); | |
2380 g_object_unref(G_OBJECT(pm)); | |
2381 gtk_widget_queue_draw(gtkconv->u.im->icon); | |
2382 | |
2383 if (bm) | |
2384 g_object_unref(G_OBJECT(bm)); | |
2385 | |
9131 | 2386 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter); |
2387 if (delay <= 0) | |
2388 delay = 100; | |
2389 | |
2390 gtkconv->u.im->icon_timer = g_timeout_add(delay, redraw_icon, conv); | |
8189 | 2391 |
2392 return FALSE; | |
2393 } | |
2394 | |
2395 static void | |
2396 start_anim(GtkObject *obj, GaimConversation *conv) | |
2397 { | |
2398 GaimGtkConversation *gtkconv; | |
2399 int delay; | |
2400 | |
2401 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
2402 return; | |
2403 | |
2404 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2405 | |
8228 | 2406 if (gtkconv->u.im->anim == NULL) |
2407 return; | |
2408 | |
8202 | 2409 if (gtkconv->u.im->icon_timer != 0) |
2410 return; | |
2411 | |
8189 | 2412 if (gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim)) |
2413 return; | |
2414 | |
2415 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter) / 10; | |
2416 | |
8758 | 2417 gtkconv->u.im->icon_timer = g_timeout_add(delay * 10, redraw_icon, conv); |
8189 | 2418 } |
2419 | |
2420 static void | |
2421 stop_anim(GtkObject *obj, GaimConversation *conv) | |
2422 { | |
2423 GaimGtkConversation *gtkconv; | |
2424 | |
2425 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
2426 return; | |
2427 | |
2428 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2429 | |
2430 if (gtkconv->u.im->icon_timer != 0) | |
2431 g_source_remove(gtkconv->u.im->icon_timer); | |
2432 | |
2433 gtkconv->u.im->icon_timer = 0; | |
2434 } | |
2435 | |
2436 static void | |
2437 toggle_icon_animate_cb(GtkWidget *w, GaimConversation *conv) | |
2438 { | |
2439 GaimGtkConversation *gtkconv; | |
2440 | |
2441 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
2442 return; | |
2443 | |
2444 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2445 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2446 gtkconv->u.im->animate = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2447 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w)); |
8189 | 2448 |
2449 if (gtkconv->u.im->animate) | |
2450 start_anim(NULL, conv); | |
2451 else | |
2452 stop_anim(NULL, conv); | |
2453 } | |
2454 static void | |
2455 remove_icon(GaimGtkConversation *gtkconv) | |
2456 { | |
2457 g_return_if_fail(gtkconv != NULL); | |
2458 | |
2459 if (gtkconv->u.im->icon != NULL) | |
8821 | 2460 gtk_widget_destroy(gtkconv->u.im->icon->parent->parent->parent); |
8189 | 2461 |
2462 if (gtkconv->u.im->anim != NULL) | |
2463 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); | |
2464 | |
2465 if (gtkconv->u.im->icon_timer != 0) | |
2466 g_source_remove(gtkconv->u.im->icon_timer); | |
2467 | |
2468 if (gtkconv->u.im->iter != NULL) | |
2469 g_object_unref(G_OBJECT(gtkconv->u.im->iter)); | |
2470 | |
2471 gtkconv->u.im->icon_timer = 0; | |
2472 gtkconv->u.im->icon = NULL; | |
2473 gtkconv->u.im->anim = NULL; | |
2474 gtkconv->u.im->iter = NULL; | |
9687 | 2475 gtkconv->u.im->show_icon = FALSE; |
8189 | 2476 } |
2477 | |
9497 | 2478 static void |
9504 | 2479 saveicon_writefile_cb(void *user_data, const char *filename) |
9497 | 2480 { |
9504 | 2481 GaimConversation *conv = (GaimConversation *)user_data; |
9497 | 2482 FILE *fp; |
2483 GaimBuddyIcon *icon; | |
2484 const void *data; | |
2485 size_t len; | |
2486 | |
2487 if ((fp = fopen(filename, "wb")) == NULL) { | |
9504 | 2488 gaim_notify_error(conv, NULL, _("Unable to open file."), NULL); |
9497 | 2489 return; |
2490 } | |
2491 | |
2492 icon = gaim_conv_im_get_icon(GAIM_CONV_IM(conv)); | |
2493 data = gaim_buddy_icon_get_data(icon, &len); | |
2494 | |
2495 if ((len <= 0) || (data == NULL)) { | |
9504 | 2496 gaim_notify_error(conv, NULL, _("Unable to save icon file to disk."), NULL); |
9497 | 2497 return; |
2498 } | |
2499 | |
2500 fwrite(data, 1, len, fp); | |
2501 fclose(fp); | |
2502 } | |
2503 | |
2504 static void | |
2505 icon_menu_save_cb(GtkWidget *widget, GaimConversation *conv) | |
2506 { | |
2507 gchar *buf; | |
2508 | |
2509 g_return_if_fail(conv != NULL); | |
9504 | 2510 |
9706 | 2511 /* |
2512 * XXX - The file extension needs to be set to something that doesn't suck... | |
2513 * Maybe do what gtkimhtml.c does when saving an image? | |
2514 */ | |
9497 | 2515 buf = g_strdup_printf("%s.icon", gaim_normalize(conv->account, conv->name)); |
9504 | 2516 |
2517 gaim_request_file(conv, _("Save Icon"), buf, TRUE, | |
2518 G_CALLBACK(saveicon_writefile_cb), NULL, conv); | |
9497 | 2519 |
2520 g_free(buf); | |
2521 } | |
2522 | |
8189 | 2523 static gboolean |
2524 icon_menu(GtkObject *obj, GdkEventButton *e, GaimConversation *conv) | |
2525 { | |
2526 GaimGtkConversation *gtkconv; | |
2527 static GtkWidget *menu = NULL; | |
2528 GtkWidget *button; | |
2529 | |
2530 if (e->button != 3 || e->type != GDK_BUTTON_PRESS) | |
2531 return FALSE; | |
2532 | |
2533 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2534 | |
2535 /* | |
2536 * If a menu already exists, destroy it before creating a new one, | |
2537 * thus freeing-up the memory it occupied. | |
2538 */ | |
2539 if (menu != NULL) | |
2540 gtk_widget_destroy(menu); | |
2541 | |
2542 menu = gtk_menu_new(); | |
2543 | |
2544 if (gtkconv->u.im->anim && | |
2545 !(gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim))) | |
2546 { | |
2547 gaim_new_check_item(menu, _("Animate"), | |
2548 G_CALLBACK(toggle_icon_animate_cb), conv, | |
2549 gtkconv->u.im->icon_timer); | |
2550 } | |
2551 | |
2552 button = gtk_menu_item_new_with_label(_("Hide Icon")); | |
2553 g_signal_connect_swapped(G_OBJECT(button), "activate", | |
2554 G_CALLBACK(remove_icon), gtkconv); | |
2555 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
2556 gtk_widget_show(button); | |
2557 | |
2558 gaim_new_item_from_stock(menu, _("Save Icon As..."), GTK_STOCK_SAVE_AS, | |
9497 | 2559 G_CALLBACK(icon_menu_save_cb), conv, |
8189 | 2560 0, 0, NULL); |
2561 | |
2562 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, e->button, e->time); | |
2563 | |
2564 return TRUE; | |
2565 } | |
2566 /************************************************************************** | |
2567 * End of the bunch of buddy icon functions | |
2568 **************************************************************************/ | |
2569 | |
7887 | 2570 /* |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2571 * 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
|
2572 * sensitive/insensitive. This is called after changing tabs and when an |
7887 | 2573 * account signs on or off. |
2574 */ | |
4359 | 2575 static void |
7887 | 2576 gray_stuff_out(GaimConversation *conv) |
4359 | 2577 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2578 GaimConvWindow *win; |
7887 | 2579 GaimGtkWindow *gtkwin; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2580 GaimGtkConversation *gtkconv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2581 GaimConnection *gc; |
7887 | 2582 GaimPluginProtocolInfo *prpl_info = NULL; |
7222 | 2583 GdkPixbuf *window_icon = NULL; |
8439 | 2584 GtkIMHtmlButtons buttons; |
9812 | 2585 GaimAccount *account; |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2586 |
7887 | 2587 win = gaim_conversation_get_window(conv); |
4359 | 2588 gtkwin = GAIM_GTK_WINDOW(win); |
2589 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7887 | 2590 gc = gaim_conversation_get_gc(conv); |
9812 | 2591 account = gaim_connection_get_account(gc); |
8439 | 2592 |
7879 | 2593 if (gc != NULL) |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
2594 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2595 |
7887 | 2596 if (gtkwin->menu.send_as != NULL) |
2597 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); | |
2598 | |
2599 /* | |
2600 * 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
|
2601 * 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
|
2602 * conversations. Stuff that Gaim chats support in general should be |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2603 * shown for chat conversations. It doesn't matter whether the PRPL |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2604 * supports it or not--that only affects if the button or menu item |
7929 | 2605 * is sensitive or not. |
7887 | 2606 */ |
4359 | 2607 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
7887 | 2608 /* Show stuff that applies to IMs, hide stuff that applies to chats */ |
2609 | |
2610 /* Deal with buttons */ | |
2611 gtk_widget_show(gtkconv->info); | |
2612 gtk_widget_show(gtkconv->send); | |
2613 gtk_widget_show(gtkconv->u.im->warn); | |
2614 gtk_widget_show(gtkconv->u.im->block); | |
9468 | 2615 gtk_widget_show(gtkconv->u.im->send_file); |
7887 | 2616 |
2617 /* Deal with menu items */ | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2618 gtk_widget_show(gtkwin->menu.view_log); |
9468 | 2619 gtk_widget_show(gtkwin->menu.send_file); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2620 gtk_widget_show(gtkwin->menu.add_pounce); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2621 gtk_widget_show(gtkwin->menu.get_info); |
7887 | 2622 gtk_widget_show(gtkwin->menu.warn); |
7859 | 2623 gtk_widget_hide(gtkwin->menu.invite); |
7887 | 2624 gtk_widget_show(gtkwin->menu.alias); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2625 gtk_widget_show(gtkwin->menu.block); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2626 |
9812 | 2627 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
|
2628 gtk_widget_show(gtkwin->menu.add); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2629 gtk_widget_hide(gtkwin->menu.remove); |
7929 | 2630 gtk_widget_show(gtkconv->add); |
2631 gtk_widget_hide(gtkconv->remove); | |
7859 | 2632 } else { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2633 gtk_widget_show(gtkwin->menu.remove); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2634 gtk_widget_hide(gtkwin->menu.add); |
7929 | 2635 gtk_widget_hide(gtkconv->add); |
2636 gtk_widget_show(gtkconv->remove); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2637 } |
7887 | 2638 |
2639 gtk_widget_show(gtkwin->menu.insert_link); | |
9287 | 2640 gtk_widget_show(gtkwin->menu.insert_image); |
7887 | 2641 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
9470 | 2642 /* Show stuff that applies to Chats, hide stuff that applies to IMs */ |
7887 | 2643 |
2644 /* Deal with buttons */ | |
7952 | 2645 gtk_widget_show(gtkconv->info); |
7887 | 2646 gtk_widget_show(gtkconv->send); |
2647 gtk_widget_show(gtkconv->u.chat->invite); | |
2648 | |
2649 /* Deal with menu items */ | |
7859 | 2650 gtk_widget_hide(gtkwin->menu.view_log); |
9468 | 2651 gtk_widget_hide(gtkwin->menu.send_file); |
7859 | 2652 gtk_widget_hide(gtkwin->menu.add_pounce); |
2653 gtk_widget_hide(gtkwin->menu.get_info); | |
7887 | 2654 gtk_widget_hide(gtkwin->menu.warn); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2655 gtk_widget_show(gtkwin->menu.invite); |
7887 | 2656 gtk_widget_show(gtkwin->menu.alias); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2657 gtk_widget_hide(gtkwin->menu.block); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2658 |
9812 | 2659 if (gaim_blist_find_chat(account, gaim_conversation_get_name(conv)) == NULL) { |
2660 /* If the chat is NOT in the buddy list */ | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2661 gtk_widget_show(gtkwin->menu.add); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2662 gtk_widget_hide(gtkwin->menu.remove); |
7929 | 2663 gtk_widget_show(gtkconv->add); |
2664 gtk_widget_hide(gtkconv->remove); | |
7859 | 2665 } else { |
9812 | 2666 /* If the chat IS in the buddy list */ |
2667 gtk_widget_hide(gtkwin->menu.add); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2668 gtk_widget_show(gtkwin->menu.remove); |
7929 | 2669 gtk_widget_hide(gtkconv->add); |
2670 gtk_widget_show(gtkconv->remove); | |
7887 | 2671 } |
2672 | |
2673 gtk_widget_show(gtkwin->menu.insert_link); | |
2674 gtk_widget_hide(gtkwin->menu.insert_image); | |
2675 } | |
2676 | |
2677 /* | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2678 * Handle graying stuff out based on whether an account is connected |
7887 | 2679 * and what features that account supports. |
2680 */ | |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
2681 if ((gc != NULL) && |
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
2682 ( (gaim_conversation_get_type(conv) != GAIM_CONV_CHAT) || |
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
2683 !gaim_conv_chat_has_left(GAIM_CONV_CHAT(conv)) )) { |
7887 | 2684 /* Account is online */ |
2685 | |
2686 /* Deal with buttons */ | |
2687 gtk_widget_set_sensitive(gtkconv->info, (prpl_info->get_info != NULL)); | |
7929 | 2688 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2689 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2690 { |
9812 | 2691 gtk_widget_set_sensitive(gtkconv->add, (prpl_info->add_buddy != NULL)); |
2692 gtk_widget_set_sensitive(gtkconv->remove, (prpl_info->remove_buddy != NULL)); | |
2693 gtk_widget_set_sensitive(gtkconv->send, (prpl_info->send_im != NULL)); | |
2694 gtk_widget_set_sensitive(gtkconv->u.im->warn, (prpl_info->warn != NULL)); | |
2695 gtk_widget_set_sensitive(gtkconv->u.im->block, (prpl_info->add_deny != NULL)); | |
9468 | 2696 gtk_widget_set_sensitive(gtkconv->u.im->send_file, |
9812 | 2697 (prpl_info->send_file && (!prpl_info->can_receive_file || |
2698 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
|
2699 } |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2700 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2701 { |
9812 | 2702 /* Only allow adding/removing if this is a chat and not a conference */ |
2703 gtk_widget_set_sensitive(gtkconv->add, (prpl_info->join_chat != NULL)); | |
2704 gtk_widget_set_sensitive(gtkconv->remove, (prpl_info->join_chat != NULL)); | |
2705 gtk_widget_set_sensitive(gtkconv->send, (prpl_info->chat_send != NULL)); | |
2706 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
|
2707 } |
7887 | 2708 |
2709 /* Deal with the toolbar */ | |
8420 | 2710 if (gc->flags & GAIM_CONNECTION_HTML) { |
8677 | 2711 buttons = GTK_IMHTML_ALL; /* Everything on */ |
8420 | 2712 if (!(prpl_info->options & OPT_PROTO_IM_IMAGE)) |
8422 | 2713 buttons &= ~GTK_IMHTML_IMAGE; |
8420 | 2714 if (gc->flags & GAIM_CONNECTION_NO_BGCOLOR) |
8422 | 2715 buttons &= ~GTK_IMHTML_BACKCOLOR; |
8691
0eb5161ef333
[gaim-migrate @ 9444]
Christian Hammond <chipx86@chipx86.com>
parents:
8690
diff
changeset
|
2716 if (gc->flags & GAIM_CONNECTION_NO_FONTSIZE) { |
0eb5161ef333
[gaim-migrate @ 9444]
Christian Hammond <chipx86@chipx86.com>
parents:
8690
diff
changeset
|
2717 buttons &= ~GTK_IMHTML_GROW; |
0eb5161ef333
[gaim-migrate @ 9444]
Christian Hammond <chipx86@chipx86.com>
parents:
8690
diff
changeset
|
2718 buttons &= ~GTK_IMHTML_SHRINK; |
0eb5161ef333
[gaim-migrate @ 9444]
Christian Hammond <chipx86@chipx86.com>
parents:
8690
diff
changeset
|
2719 } |
9041 | 2720 if (gc->flags & GAIM_CONNECTION_NO_URLDESC) |
2721 buttons &= ~GTK_IMHTML_LINKDESC; | |
8420 | 2722 } else { |
8422 | 2723 buttons = GTK_IMHTML_SMILEY; |
8420 | 2724 } |
2725 gtk_imhtml_set_format_functions(GTK_IMHTML(gtkconv->entry), buttons); | |
9812 | 2726 gtk_imhtmltoolbar_associate_smileys(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), gaim_account_get_protocol_id(account)); |
8422 | 2727 |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
2728 /* Deal with menu items */ |
7887 | 2729 gtk_widget_set_sensitive(gtkwin->menu.view_log, TRUE); |
2730 gtk_widget_set_sensitive(gtkwin->menu.add_pounce, TRUE); | |
2731 gtk_widget_set_sensitive(gtkwin->menu.get_info, (prpl_info->get_info != NULL)); | |
2732 gtk_widget_set_sensitive(gtkwin->menu.warn, (prpl_info->warn != NULL)); | |
9812 | 2733 gtk_widget_set_sensitive(gtkwin->menu.invite, (prpl_info->chat_invite != NULL)); |
2734 gtk_widget_set_sensitive(gtkwin->menu.block, (prpl_info->add_deny != NULL)); | |
2735 gtk_widget_set_sensitive(gtkwin->menu.insert_link, (gc->flags & GAIM_CONNECTION_HTML)); | |
2736 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
|
2737 |
7887 | 2738 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
9812 | 2739 gtk_widget_set_sensitive(gtkwin->menu.add, (prpl_info->add_buddy != NULL)); |
2740 gtk_widget_set_sensitive(gtkwin->menu.remove, (prpl_info->remove_buddy != NULL)); | |
9468 | 2741 gtk_widget_set_sensitive(gtkwin->menu.send_file, |
9812 | 2742 (prpl_info->send_file != NULL && (!prpl_info->can_receive_file || |
2743 prpl_info->can_receive_file(gc, gaim_conversation_get_name(conv))))); | |
2744 gtk_widget_set_sensitive(gtkwin->menu.alias, | |
2745 (gaim_find_buddy(account, gaim_conversation_get_name(conv)) != NULL)); | |
7887 | 2746 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
9812 | 2747 gtk_widget_set_sensitive(gtkwin->menu.add, (prpl_info->join_chat != NULL)); |
2748 gtk_widget_set_sensitive(gtkwin->menu.remove, (prpl_info->join_chat != NULL)); | |
2749 gtk_widget_set_sensitive(gtkwin->menu.alias, | |
2750 (gaim_blist_find_chat(account, gaim_conversation_get_name(conv)) != NULL)); | |
7887 | 2751 } |
2752 } else { | |
2753 /* Account is offline */ | |
9812 | 2754 /* Or it's a chat that we've left. */ |
7887 | 2755 |
2756 /* Deal with buttons */ | |
7929 | 2757 gtk_widget_set_sensitive(gtkconv->add, FALSE); |
2758 gtk_widget_set_sensitive(gtkconv->remove, FALSE); | |
7887 | 2759 gtk_widget_set_sensitive(gtkconv->info, FALSE); |
2760 gtk_widget_set_sensitive(gtkconv->send, FALSE); | |
2761 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
2762 gtk_widget_set_sensitive(gtkconv->u.im->warn, FALSE); | |
2763 gtk_widget_set_sensitive(gtkconv->u.im->block, FALSE); | |
9468 | 2764 gtk_widget_set_sensitive(gtkconv->u.im->send_file, FALSE); |
7887 | 2765 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
2766 gtk_widget_set_sensitive(gtkconv->u.chat->invite, FALSE); | |
2767 } | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2768 |
7887 | 2769 /* Then deal with menu items */ |
2770 gtk_widget_set_sensitive(gtkwin->menu.view_log, TRUE); | |
9468 | 2771 gtk_widget_set_sensitive(gtkwin->menu.send_file, FALSE); |
7887 | 2772 gtk_widget_set_sensitive(gtkwin->menu.add_pounce, TRUE); |
2773 gtk_widget_set_sensitive(gtkwin->menu.get_info, FALSE); | |
2774 gtk_widget_set_sensitive(gtkwin->menu.warn, FALSE); | |
2775 gtk_widget_set_sensitive(gtkwin->menu.invite, FALSE); | |
2776 gtk_widget_set_sensitive(gtkwin->menu.alias, FALSE); | |
2777 gtk_widget_set_sensitive(gtkwin->menu.block, FALSE); | |
2778 gtk_widget_set_sensitive(gtkwin->menu.add, FALSE); | |
2779 gtk_widget_set_sensitive(gtkwin->menu.remove, FALSE); | |
7929 | 2780 gtk_widget_set_sensitive(gtkwin->menu.insert_link, TRUE); |
7887 | 2781 gtk_widget_set_sensitive(gtkwin->menu.insert_image, FALSE); |
2782 } | |
2783 | |
2784 /* | |
2785 * Update the window's icon | |
2786 */ | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2787 if ((gaim_conversation_get_type(conv) == GAIM_CONV_IM) && |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2788 (gtkconv->u.im->anim)) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2789 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2790 window_icon = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2791 gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); |
7887 | 2792 g_object_ref(window_icon); |
2793 } else { | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2794 window_icon = get_tab_icon(conv, FALSE); |
4359 | 2795 } |
7887 | 2796 gtk_window_set_icon(GTK_WINDOW(gtkwin->window), window_icon); |
2797 g_object_unref(G_OBJECT(window_icon)); | |
2798 } | |
2799 | |
2800 static void | |
8189 | 2801 before_switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, |
2802 gpointer user_data) | |
2803 { | |
2804 GaimConvWindow *win; | |
2805 GaimConversation *conv; | |
2806 GaimGtkConversation *gtkconv; | |
2807 | |
2808 win = (GaimConvWindow *)user_data; | |
2809 conv = gaim_conv_window_get_active_conversation(win); | |
2810 | |
2811 g_return_if_fail(conv != NULL); | |
2812 | |
8192 | 2813 if (gaim_conversation_get_type(conv) != GAIM_CONV_IM) |
2814 return; | |
2815 | |
8189 | 2816 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2817 | |
2818 stop_anim(NULL, conv); | |
2819 } | |
2820 | |
2821 static void | |
7887 | 2822 switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, |
2823 gpointer user_data) | |
2824 { | |
2825 GaimConvWindow *win; | |
2826 GaimConversation *conv; | |
2827 GaimGtkConversation *gtkconv; | |
2828 GaimGtkWindow *gtkwin; | |
2829 | |
2830 win = (GaimConvWindow *)user_data; | |
2831 conv = gaim_conv_window_get_conversation_at(win, page_num); | |
2832 | |
2833 g_return_if_fail(conv != NULL); | |
2834 | |
2835 gtkwin = GAIM_GTK_WINDOW(win); | |
2836 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2837 | |
2838 gaim_conversation_set_unseen(conv, GAIM_UNSEEN_NONE); | |
2839 | |
2840 /* Update the menubar */ | |
2841 gray_stuff_out(conv); | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2842 |
4736 | 2843 update_typing_icon(conv); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2844 |
4359 | 2845 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.logging), |
7143 | 2846 gaim_conversation_is_logging(conv)); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2847 |
4359 | 2848 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.sounds), |
7143 | 2849 gtkconv->make_sound); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2850 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2851 gtk_check_menu_item_set_active( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2852 GTK_CHECK_MENU_ITEM(gtkwin->menu.show_formatting_toolbar), |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2853 gtkconv->show_formatting_toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2854 |
9188 | 2855 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.show_timestamps), |
2856 gtkconv->show_timestamps); | |
2857 | |
8189 | 2858 /* |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2859 * We pause icons when they are not visible. If this icon should |
9297 | 2860 * be animated then start it back up again. |
8189 | 2861 */ |
8192 | 2862 if ((gaim_conversation_get_type(conv) == GAIM_CONV_IM) && |
2863 (gtkconv->u.im->animate)) | |
8189 | 2864 start_anim(NULL, conv); |
2865 | |
4965 | 2866 gtk_window_set_title(GTK_WINDOW(gtkwin->window), |
7143 | 2867 gtk_label_get_text(GTK_LABEL(gtkconv->tab_label))); |
4359 | 2868 } |
2869 | |
2870 /************************************************************************** | |
2871 * Utility functions | |
2872 **************************************************************************/ | |
2873 | |
2874 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2875 got_typing_keypress(GaimConversation *conv, gboolean first) |
4359 | 2876 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2877 GaimConvIm *im; |
4685 | 2878 |
4359 | 2879 /* |
2880 * 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
|
2881 * send GAIM_TYPED any time soon. |
4359 | 2882 */ |
2883 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2884 im = GAIM_CONV_IM(conv); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2885 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2886 if (gaim_conv_im_get_type_again_timeout(im)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2887 gaim_conv_im_stop_type_again_timeout(im); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2888 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2889 gaim_conv_im_start_type_again_timeout(im); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2890 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2891 if (first || (gaim_conv_im_get_type_again(im) != 0 && |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2892 time(NULL) > gaim_conv_im_get_type_again(im))) { |
4359 | 2893 |
2894 int timeout = serv_send_typing(gaim_conversation_get_gc(conv), | |
2895 (char *)gaim_conversation_get_name(conv), | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
2896 GAIM_TYPING); |
4359 | 2897 |
2898 if (timeout) | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2899 gaim_conv_im_set_type_again(im, time(NULL) + timeout); |
4359 | 2900 else |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2901 gaim_conv_im_set_type_again(im, 0); |
4359 | 2902 } |
2903 } | |
2904 | |
4736 | 2905 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2906 update_typing_icon(GaimConversation *conv) |
4736 | 2907 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2908 GaimGtkWindow *gtkwin; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2909 GaimConvIm *im = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2910 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); |
4736 | 2911 |
2912 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); | |
2913 | |
2914 if(gaim_conversation_get_type(conv) == GAIM_CONV_IM) | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2915 im = GAIM_CONV_IM(conv); |
4736 | 2916 |
2917 if(gtkwin->menu.typing_icon) { | |
2918 gtk_widget_destroy(gtkwin->menu.typing_icon); | |
2919 gtkwin->menu.typing_icon = NULL; | |
2920 } | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2921 if(im && gaim_conv_im_get_typing_state(im) == GAIM_TYPING) { |
4736 | 2922 gtkwin->menu.typing_icon = gtk_image_menu_item_new(); |
2923 gtk_image_menu_item_set_image( | |
2924 GTK_IMAGE_MENU_ITEM(gtkwin->menu.typing_icon), | |
2925 gtk_image_new_from_stock(GAIM_STOCK_TYPING, | |
2926 GTK_ICON_SIZE_MENU)); | |
4757 | 2927 gtk_tooltips_set_tip(gtkconv->tooltips, gtkwin->menu.typing_icon, |
4736 | 2928 _("User is typing..."), NULL); |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2929 } else if(im && gaim_conv_im_get_typing_state(im) == GAIM_TYPED) { |
4736 | 2930 gtkwin->menu.typing_icon = gtk_image_menu_item_new(); |
2931 gtk_image_menu_item_set_image( | |
2932 GTK_IMAGE_MENU_ITEM(gtkwin->menu.typing_icon), | |
2933 gtk_image_new_from_stock(GAIM_STOCK_TYPED, | |
2934 GTK_ICON_SIZE_MENU)); | |
4757 | 2935 gtk_tooltips_set_tip(gtkconv->tooltips, gtkwin->menu.typing_icon, |
4736 | 2936 _("User has typed something and paused"), NULL); |
2937 } | |
2938 | |
2939 if(gtkwin->menu.typing_icon) { | |
2940 gtk_menu_item_set_right_justified( | |
2941 GTK_MENU_ITEM(gtkwin->menu.typing_icon), TRUE); | |
2942 gtk_widget_show_all(gtkwin->menu.typing_icon); | |
2943 gtk_menu_shell_append(GTK_MENU_SHELL(gtkwin->menu.menubar), | |
2944 gtkwin->menu.typing_icon); | |
2945 } | |
2946 } | |
2947 | |
4685 | 2948 static gboolean |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2949 update_send_as_selection(GaimConvWindow *win) |
4359 | 2950 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2951 GaimAccount *account; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2952 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2953 GaimGtkWindow *gtkwin; |
4359 | 2954 GtkWidget *menu; |
2955 GList *child; | |
2956 | |
7090
04f9f7440bc3
[gaim-migrate @ 7655]
Christian Hammond <chipx86@chipx86.com>
parents:
7089
diff
changeset
|
2957 if (g_list_find(gaim_get_windows(), win) == NULL) |
04f9f7440bc3
[gaim-migrate @ 7655]
Christian Hammond <chipx86@chipx86.com>
parents:
7089
diff
changeset
|
2958 return FALSE; |
4849 | 2959 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2960 conv = gaim_conv_window_get_active_conversation(win); |
4359 | 2961 |
5860
52d5fad43950
[gaim-migrate @ 6291]
Christian Hammond <chipx86@chipx86.com>
parents:
5858
diff
changeset
|
2962 if (conv == NULL) |
52d5fad43950
[gaim-migrate @ 6291]
Christian Hammond <chipx86@chipx86.com>
parents:
5858
diff
changeset
|
2963 return FALSE; |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2964 |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2965 account = gaim_conversation_get_account(conv); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2966 gtkwin = GAIM_GTK_WINDOW(win); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2967 |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2968 if (gtkwin->menu.send_as == NULL) |
4685 | 2969 return FALSE; |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2970 |
4359 | 2971 gtk_widget_show(gtkwin->menu.send_as); |
2972 | |
2973 menu = gtk_menu_item_get_submenu( | |
2974 GTK_MENU_ITEM(gtkwin->menu.send_as)); | |
2975 | |
2976 for (child = gtk_container_get_children(GTK_CONTAINER(menu)); | |
2977 child != NULL; | |
2978 child = child->next) { | |
2979 | |
2980 GtkWidget *item = child->data; | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2981 GaimAccount *item_account = g_object_get_data(G_OBJECT(item), |
4673 | 2982 "gaim_account"); |
2983 | |
2984 if (account == item_account) { | |
4359 | 2985 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE); |
2986 break; | |
2987 } | |
2988 } | |
6030
54c37db13279
[gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents:
6016
diff
changeset
|
2989 |
4685 | 2990 return FALSE; |
4359 | 2991 } |
2992 | |
2993 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2994 generate_send_as_items(GaimConvWindow *win, GaimConversation *deleted_conv) |
4359 | 2995 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2996 GaimGtkWindow *gtkwin; |
4359 | 2997 GtkWidget *menu; |
2998 GtkWidget *menuitem; | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2999 GList *gcs; |
4359 | 3000 GList *convs; |
3001 GSList *group = NULL; | |
3002 gboolean first_offline = TRUE; | |
3003 gboolean found_online = FALSE; | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3004 GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
4359 | 3005 |
3006 gtkwin = GAIM_GTK_WINDOW(win); | |
3007 | |
3008 if (gtkwin->menu.send_as != NULL) | |
3009 gtk_widget_destroy(gtkwin->menu.send_as); | |
3010 | |
3011 /* See if we have > 1 connection active. */ | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3012 if (g_list_length(gaim_connections_get_all()) < 2) { |
4359 | 3013 /* Now make sure we don't have any Offline entries. */ |
3014 gboolean found_offline = FALSE; | |
3015 | |
3016 for (convs = gaim_get_conversations(); | |
3017 convs != NULL; | |
3018 convs = convs->next) { | |
3019 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3020 GaimConversation *conv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3021 GaimAccount *account; |
4491 | 3022 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3023 conv = (GaimConversation *)convs->data; |
4491 | 3024 account = gaim_conversation_get_account(conv); |
3025 | |
6495
8ce66049ce68
[gaim-migrate @ 7010]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
3026 if (account != NULL && account->gc == NULL) { |
4359 | 3027 found_offline = TRUE; |
3028 break; | |
3029 } | |
3030 } | |
3031 | |
3032 if (!found_offline) { | |
3033 gtkwin->menu.send_as = NULL; | |
3034 return; | |
3035 } | |
3036 } | |
3037 | |
3038 /* Build the Send As menu */ | |
3039 gtkwin->menu.send_as = gtk_menu_item_new_with_mnemonic(_("_Send As")); | |
3040 gtk_widget_show(gtkwin->menu.send_as); | |
3041 | |
3042 menu = gtk_menu_new(); | |
7857
43f63ff8a6d8
[gaim-migrate @ 8511]
Christian Hammond <chipx86@chipx86.com>
parents:
7855
diff
changeset
|
3043 gtk_menu_shell_insert(GTK_MENU_SHELL(gtkwin->menu.menubar), |
43f63ff8a6d8
[gaim-migrate @ 8511]
Christian Hammond <chipx86@chipx86.com>
parents:
7855
diff
changeset
|
3044 gtkwin->menu.send_as, 2); |
4359 | 3045 gtk_menu_item_set_submenu(GTK_MENU_ITEM(gtkwin->menu.send_as), menu); |
3046 | |
3047 gtk_widget_show(menu); | |
3048 | |
3049 /* Fill it with entries. */ | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3050 for (gcs = gaim_connections_get_all(); gcs != NULL; gcs = gcs->next) { |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3051 |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3052 GaimConnection *gc; |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3053 GaimAccount *account; |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3054 GtkWidget *box; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3055 GtkWidget *label; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3056 GtkWidget *image; |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3057 GdkPixbuf *pixbuf, *scale; |
4359 | 3058 |
3059 found_online = TRUE; | |
3060 | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3061 gc = (GaimConnection *)gcs->data; |
4359 | 3062 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3063 /* Create a pixmap for the protocol icon. */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3064 pixbuf = create_prpl_icon(gc->account); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3065 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
|
3066 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3067 /* Now convert it to GtkImage */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3068 if (pixbuf == NULL) |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3069 image = gtk_image_new(); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3070 else |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3071 image = gtk_image_new_from_pixbuf(scale); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3072 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3073 gtk_size_group_add_widget(sg, image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3074 |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3075 g_object_unref(G_OBJECT(scale)); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3076 g_object_unref(G_OBJECT(pixbuf)); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3077 |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3078 account = gaim_connection_get_account(gc); |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3079 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3080 /* Make our menu item */ |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3081 menuitem = gtk_radio_menu_item_new_with_label(group, |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3082 gaim_account_get_username(account)); |
4793 | 3083 group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem)); |
4359 | 3084 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3085 /* Do some evil, see some evil, speak some evil. */ |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3086 box = gtk_hbox_new(FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3087 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3088 label = gtk_bin_get_child(GTK_BIN(menuitem)); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3089 g_object_ref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3090 gtk_container_remove(GTK_CONTAINER(menuitem), label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3091 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3092 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3093 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 4); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3094 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3095 g_object_unref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3096 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3097 gtk_container_add(GTK_CONTAINER(menuitem), box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3098 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3099 gtk_widget_show(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3100 gtk_widget_show(image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3101 gtk_widget_show(box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3102 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3103 /* Set our data and callbacks. */ |
4359 | 3104 g_object_set_data(G_OBJECT(menuitem), "user_data", win); |
4673 | 3105 g_object_set_data(G_OBJECT(menuitem), "gaim_account", gc->account); |
4359 | 3106 |
4786 | 3107 g_signal_connect(G_OBJECT(menuitem), "activate", |
4673 | 3108 G_CALLBACK(menu_conv_sel_send_cb), NULL); |
4359 | 3109 |
3110 gtk_widget_show(menuitem); | |
3111 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
3112 } | |
3113 | |
3114 /* | |
3115 * Fill it with any accounts that still has an open (yet disabled) window | |
3116 * (signed off accounts with a window open). | |
3117 */ | |
3118 for (convs = gaim_get_conversations(); | |
3119 convs != NULL; | |
3120 convs = convs->next) { | |
3121 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3122 GaimConversation *conv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3123 GaimAccount *account; |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3124 GtkWidget *box; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3125 GtkWidget *label; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3126 GtkWidget *image; |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3127 GdkPixbuf *pixbuf, *scale; |
4359 | 3128 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3129 conv = (GaimConversation *)convs->data; |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3130 |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3131 if (conv == deleted_conv) |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3132 continue; |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3133 |
4491 | 3134 account = gaim_conversation_get_account(conv); |
3135 | |
6495
8ce66049ce68
[gaim-migrate @ 7010]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
3136 if (account != NULL && account->gc == NULL) { |
4359 | 3137 if (first_offline && found_online) { |
3138 menuitem = gtk_separator_menu_item_new(); | |
3139 gtk_widget_show(menuitem); | |
3140 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
3141 | |
3142 first_offline = FALSE; | |
3143 } | |
3144 | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3145 /* Create a pixmap for the protocol icon. */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3146 pixbuf = create_prpl_icon(account); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3147 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3148 GDK_INTERP_BILINEAR); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3149 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3150 /* Now convert it to GtkImage */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3151 if (pixbuf == NULL) |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3152 image = gtk_image_new(); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3153 else |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3154 image = gtk_image_new_from_pixbuf(scale); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3155 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3156 gtk_size_group_add_widget(sg, image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3157 |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3158 if (scale != NULL) g_object_unref(scale); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3159 if (pixbuf != NULL) g_object_unref(pixbuf); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3160 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3161 /* Make our menu item */ |
4359 | 3162 menuitem = gtk_radio_menu_item_new_with_label(group, |
4491 | 3163 account->username); |
4793 | 3164 group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem)); |
4359 | 3165 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3166 /* Do some evil, see some evil, speak some evil. */ |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3167 box = gtk_hbox_new(FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3168 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3169 label = gtk_bin_get_child(GTK_BIN(menuitem)); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3170 g_object_ref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3171 gtk_container_remove(GTK_CONTAINER(menuitem), label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3172 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3173 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3174 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 4); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3175 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3176 g_object_unref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3177 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3178 gtk_container_add(GTK_CONTAINER(menuitem), box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3179 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3180 gtk_widget_show(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3181 gtk_widget_show(image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3182 gtk_widget_show(box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3183 |
4359 | 3184 gtk_widget_set_sensitive(menuitem, FALSE); |
4786 | 3185 g_object_set_data(G_OBJECT(menuitem), "user_data", win); |
4674 | 3186 g_object_set_data(G_OBJECT(menuitem), "gaim_account", account); |
4359 | 3187 |
4786 | 3188 g_signal_connect(G_OBJECT(menuitem), "activate", |
5902
6889b89cab90
[gaim-migrate @ 6334]
Christian Hammond <chipx86@chipx86.com>
parents:
5901
diff
changeset
|
3189 G_CALLBACK(menu_conv_sel_send_cb), NULL); |
4786 | 3190 |
4359 | 3191 gtk_widget_show(menuitem); |
3192 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
3193 } | |
3194 } | |
3195 | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3196 g_object_unref(sg); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3197 |
4359 | 3198 gtk_widget_show(gtkwin->menu.send_as); |
3199 update_send_as_selection(win); | |
3200 } | |
3201 | |
3202 static GList * | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3203 generate_invite_user_names(GaimConnection *gc) |
4359 | 3204 { |
6695 | 3205 GaimBlistNode *gnode,*cnode,*bnode; |
4359 | 3206 static GList *tmp = NULL; |
3207 | |
3208 if (tmp) | |
3209 g_list_free(tmp); | |
3210 | |
3211 tmp = g_list_append(NULL, ""); | |
3212 | |
3213 if (gc != NULL) { | |
4785 | 3214 for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { |
3215 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) | |
3216 continue; | |
6695 | 3217 for(cnode = gnode->child; cnode; cnode = cnode->next) { |
3218 if(!GAIM_BLIST_NODE_IS_CONTACT(cnode)) | |
4785 | 3219 continue; |
6695 | 3220 for(bnode = cnode->child; bnode; bnode = bnode->next) { |
3221 GaimBuddy *buddy; | |
3222 | |
3223 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) | |
3224 continue; | |
3225 | |
3226 buddy = (GaimBuddy *)bnode; | |
3227 | |
3228 if (buddy->account == gc->account && | |
3229 GAIM_BUDDY_IS_ONLINE(buddy)) | |
3230 tmp = g_list_append(tmp, buddy->name); | |
3231 } | |
4359 | 3232 } |
3233 } | |
3234 } | |
3235 | |
3236 return tmp; | |
3237 } | |
3238 | |
9498 | 3239 static GdkPixbuf * |
9554 | 3240 get_chat_buddy_status_icon(GaimConvChat *chat, const char *name, GaimConvChatBuddyFlags flags) |
9498 | 3241 { |
9554 | 3242 GdkPixbuf *pixbuf, *scale, *scale2; |
9498 | 3243 char *filename; |
9554 | 3244 char *image = NULL; |
3245 | |
3246 if (flags & GAIM_CBFLAGS_FOUNDER) { | |
9588 | 3247 image = g_strdup("founder.png"); |
9554 | 3248 } else if (flags & GAIM_CBFLAGS_OP) { |
9588 | 3249 image = g_strdup("op.png"); |
9554 | 3250 } else if (flags & GAIM_CBFLAGS_HALFOP) { |
9588 | 3251 image = g_strdup("halfop.png"); |
9554 | 3252 } else if (flags & GAIM_CBFLAGS_VOICE) { |
9588 | 3253 image = g_strdup("voice.png"); |
9554 | 3254 } else if ((!flags) && gaim_conv_chat_is_user_ignored(chat, name)) { |
9588 | 3255 image = g_strdup("ignored.png"); |
9554 | 3256 } |
3257 if (image) { | |
3258 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL); | |
3259 g_free(image); | |
9498 | 3260 pixbuf = gdk_pixbuf_new_from_file(filename, NULL); |
3261 g_free(filename); | |
3262 if (!pixbuf) | |
3263 return NULL; | |
3264 scale = gdk_pixbuf_scale_simple(pixbuf, 15, 15, GDK_INTERP_BILINEAR); | |
3265 g_object_unref(pixbuf); | |
9554 | 3266 if (flags && gaim_conv_chat_is_user_ignored(chat, name)) { |
9588 | 3267 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", "ignored.png", NULL); |
9554 | 3268 pixbuf = gdk_pixbuf_new_from_file(filename, NULL); |
3269 g_free(filename); | |
3270 scale2 = gdk_pixbuf_scale_simple(pixbuf, 15, 15, GDK_INTERP_BILINEAR); | |
3271 g_object_unref(pixbuf); | |
3272 gdk_pixbuf_composite(scale2, scale, 0, 0, 15, 15, 0, 0, 1, 1, GDK_INTERP_BILINEAR, 192); | |
3273 g_object_unref(scale2); | |
3274 } | |
9498 | 3275 return scale; |
3276 } | |
3277 | |
3278 return NULL; | |
3279 } | |
3280 | |
4359 | 3281 static void |
9554 | 3282 add_chat_buddy_common(GaimConversation *conv, const char *name) |
4359 | 3283 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3284 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3285 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3286 GaimConvChat *chat; |
9554 | 3287 GaimConvChatBuddyFlags flags; |
4359 | 3288 GtkTreeIter iter; |
3289 GtkListStore *ls; | |
9498 | 3290 GdkPixbuf *pixbuf; |
4359 | 3291 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3292 chat = GAIM_CONV_CHAT(conv); |
4359 | 3293 gtkconv = GAIM_GTK_CONVERSATION(conv); |
3294 gtkchat = gtkconv->u.chat; | |
3295 | |
3296 ls = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list))); | |
3297 | |
9554 | 3298 flags = gaim_conv_chat_user_get_flags(chat, name); |
3299 pixbuf = get_chat_buddy_status_icon(chat, name, flags); | |
9498 | 3300 |
4359 | 3301 gtk_list_store_append(ls, &iter); |
9498 | 3302 gtk_list_store_set(ls, &iter, CHAT_USERS_ICON_COLUMN, pixbuf, |
9554 | 3303 CHAT_USERS_NAME_COLUMN, name, CHAT_USERS_FLAGS_COLUMN, flags, -1); |
9498 | 3304 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), CHAT_USERS_NAME_COLUMN, |
4359 | 3305 GTK_SORT_ASCENDING); |
9554 | 3306 if (pixbuf) |
3307 g_object_unref(pixbuf); | |
4359 | 3308 } |
3309 | |
9605 | 3310 static gboolean |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3311 tab_complete(GaimConversation *conv) |
4359 | 3312 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3313 GaimGtkConversation *gtkconv; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3314 GaimConvChat *chat; |
4359 | 3315 GtkTextIter cursor, word_start, start_buffer; |
3316 int start; | |
3317 int most_matched = -1; | |
3318 char *entered, *partial = NULL; | |
3319 char *text; | |
8021 | 3320 char *nick_partial; |
9605 | 3321 const char *prefix; |
4359 | 3322 GList *matches = NULL; |
9605 | 3323 GList *list = NULL; |
3324 GList *l = NULL; | |
3325 gboolean command = FALSE; | |
4359 | 3326 |
3327 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3328 | |
3329 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_buffer); | |
3330 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, | |
3331 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
3332 | |
3333 word_start = cursor; | |
3334 | |
3335 /* if there's nothing there just return */ | |
3336 if (!gtk_text_iter_compare(&cursor, &start_buffer)) | |
9605 | 3337 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
|
3338 |
4359 | 3339 text = gtk_text_buffer_get_text(gtkconv->entry_buffer, &start_buffer, |
3340 &cursor, FALSE); | |
3341 | |
3342 /* if we're at the end of ": " we need to move back 2 spaces */ | |
3343 start = strlen(text) - 1; | |
3344 | |
8021 | 3345 if (strlen(text) >= 2 && !strncmp(&text[start-1], ": ", 2)) { |
4359 | 3346 gtk_text_iter_backward_chars(&word_start, 2); |
8021 | 3347 start-=2; |
3348 } | |
4359 | 3349 |
3350 /* find the start of the word that we're tabbing */ | |
3351 while (start >= 0 && text[start] != ' ') { | |
3352 gtk_text_iter_backward_char(&word_start); | |
3353 start--; | |
3354 } | |
3355 | |
9605 | 3356 prefix = gaim_gtk_get_cmd_prefix(); |
3357 if (start == -1 && (strlen(text) >= strlen(prefix)) && !strncmp(text, prefix, strlen(prefix))) { | |
3358 command = TRUE; | |
3359 gtk_text_iter_forward_chars(&word_start, strlen(prefix)); | |
3360 } | |
3361 | |
4359 | 3362 g_free(text); |
3363 | |
3364 entered = gtk_text_buffer_get_text(gtkconv->entry_buffer, &word_start, | |
3365 &cursor, FALSE); | |
3366 | |
8021 | 3367 if (!g_utf8_strlen(entered, -1)) { |
4359 | 3368 g_free(entered); |
9605 | 3369 return (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) ? TRUE : FALSE; |
4359 | 3370 } |
3371 | |
8021 | 3372 nick_partial = g_malloc(strlen(entered)+1); |
3373 | |
9605 | 3374 if (command) { |
3375 list = gaim_cmd_list(conv); | |
3376 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
3377 chat = GAIM_CONV_CHAT(conv); | |
3378 list = gaim_conv_chat_get_users(chat); | |
3379 } else { | |
3380 g_free(nick_partial); | |
3381 g_free(entered); | |
3382 return FALSE; | |
3383 } | |
3384 | |
3385 for (l = list; l; l = l->next) { | |
3386 char *name; | |
3387 | |
3388 if (command) | |
3389 name = l->data; | |
3390 else { | |
3391 GaimConvChatBuddy *cb = l->data; | |
3392 name = cb->name; | |
3393 } | |
3394 | |
3395 strncpy(nick_partial, name, strlen(entered)); | |
8172 | 3396 nick_partial[strlen(entered)] = '\0'; |
8021 | 3397 if(gaim_utf8_strcasecmp(nick_partial, entered)) |
3398 continue; | |
4359 | 3399 |
3400 /* if we're here, it's a possible completion */ | |
3401 | |
3402 if (most_matched == -1) { | |
3403 /* | |
3404 * this will only get called once, since from now | |
3405 * on most_matched is >= 0 | |
3406 */ | |
9605 | 3407 most_matched = strlen(name); |
3408 partial = g_strdup(name); | |
4359 | 3409 } |
3410 else if (most_matched) { | |
9605 | 3411 char *tmp = g_strdup(name); |
8021 | 3412 |
3413 while (gaim_utf8_strcasecmp(tmp, partial)) { | |
3414 partial[most_matched] = '\0'; | |
3415 if(most_matched < strlen(tmp)) | |
3416 tmp[most_matched] = '\0'; | |
4359 | 3417 most_matched--; |
8021 | 3418 } |
8079 | 3419 most_matched++; |
8021 | 3420 |
3421 g_free(tmp); | |
4359 | 3422 } |
3423 | |
9605 | 3424 matches = g_list_append(matches, name); |
4359 | 3425 } |
3426 | |
8021 | 3427 g_free(nick_partial); |
3428 | |
4359 | 3429 /* we're only here if we're doing new style */ |
3430 | |
3431 /* if there weren't any matches, return */ | |
3432 if (!matches) { | |
3433 /* if matches isn't set partials won't be either */ | |
3434 g_free(entered); | |
9605 | 3435 if (command) |
3436 g_list_free(list); | |
3437 return (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) ? TRUE : FALSE; | |
4359 | 3438 } |
3439 | |
3440 gtk_text_buffer_delete(gtkconv->entry_buffer, &word_start, &cursor); | |
3441 | |
3442 if (!matches->next) { | |
3443 /* there was only one match. fill it in. */ | |
3444 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_buffer); | |
3445 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, | |
3446 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
3447 | |
3448 if (!gtk_text_iter_compare(&cursor, &start_buffer)) { | |
3449 char *tmp = g_strdup_printf("%s: ", (char *)matches->data); | |
3450 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, tmp, -1); | |
3451 g_free(tmp); | |
3452 } | |
3453 else | |
3454 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, | |
3455 matches->data, -1); | |
3456 | |
3457 matches = g_list_remove(matches, matches->data); | |
3458 } | |
3459 else { | |
3460 /* | |
3461 * there were lots of matches, fill in as much as possible | |
3462 * and display all of them | |
3463 */ | |
3464 char *addthis = g_malloc0(1); | |
3465 | |
3466 while (matches) { | |
3467 char *tmp = addthis; | |
3468 addthis = g_strconcat(tmp, matches->data, " ", NULL); | |
3469 g_free(tmp); | |
3470 matches = g_list_remove(matches, matches->data); | |
3471 } | |
3472 | |
6982 | 3473 gaim_conversation_write(conv, NULL, addthis, GAIM_MESSAGE_NO_LOG, |
4359 | 3474 time(NULL)); |
3475 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, partial, -1); | |
3476 g_free(addthis); | |
3477 } | |
3478 | |
9605 | 3479 if (command) |
3480 g_list_free(list); | |
4359 | 3481 g_free(entered); |
3482 g_free(partial); | |
9605 | 3483 |
3484 return TRUE; | |
4359 | 3485 } |
3486 | |
3487 static GtkItemFactoryEntry menu_items[] = | |
3488 { | |
3489 /* Conversation menu */ | |
4596 | 3490 { N_("/_Conversation"), NULL, NULL, 0, "<Branch>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3491 |
7887 | 3492 { N_("/Conversation/New Instant _Message..."), "<CTL>M", menu_new_conv_cb, |
7859 | 3493 0, "<StockItem>", GAIM_STOCK_IM }, |
3494 | |
3495 { "/Conversation/sep0", NULL, NULL, 0, "<Separator>" }, | |
3496 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3497 { N_("/Conversation/_Find..."), NULL, menu_find_cb, 0, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3498 "<StockItem>", GTK_STOCK_FIND }, |
7859 | 3499 { N_("/Conversation/View _Log"), NULL, menu_view_log_cb, 0, NULL }, |
4596 | 3500 { N_("/Conversation/_Save As..."), NULL, menu_save_as_cb, 0, |
4359 | 3501 "<StockItem>", GTK_STOCK_SAVE_AS }, |
8974 | 3502 { 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
|
3503 |
4359 | 3504 { "/Conversation/sep1", NULL, NULL, 0, "<Separator>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3505 |
9468 | 3506 { 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
|
3507 { N_("/Conversation/Add Buddy _Pounce..."), NULL, menu_add_pounce_cb, |
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
3508 0, NULL }, |
7859 | 3509 { N_("/Conversation/_Get Info"), NULL, menu_get_info_cb, 0, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3510 "<StockItem>", GAIM_STOCK_INFO }, |
7859 | 3511 { N_("/Conversation/_Warn..."), NULL, menu_warn_cb, 0, |
3512 "<StockItem>", GAIM_STOCK_WARN }, | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3513 { N_("/Conversation/In_vite..."), NULL, menu_invite_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3514 "<StockItem>", GAIM_STOCK_INVITE }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3515 |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
3516 { "/Conversation/sep2", NULL, NULL, 0, "<Separator>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3517 |
7859 | 3518 { N_("/Conversation/A_lias..."), NULL, menu_alias_cb, 0, |
3519 "<StockItem>", GAIM_STOCK_EDIT }, | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3520 { N_("/Conversation/_Block..."), NULL, menu_block_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3521 "<StockItem>", GAIM_STOCK_BLOCK }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3522 { N_("/Conversation/_Add..."), NULL, menu_add_remove_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3523 "<StockItem>", GTK_STOCK_ADD }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3524 { N_("/Conversation/_Remove..."), NULL, menu_add_remove_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3525 "<StockItem>", GTK_STOCK_REMOVE }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3526 |
7859 | 3527 { "/Conversation/sep3", NULL, NULL, 0, "<Separator>" }, |
3528 | |
8756 | 3529 { N_("/Conversation/Insert Lin_k..."), NULL, menu_insert_link_cb, 0, |
7859 | 3530 "<StockItem>", GAIM_STOCK_LINK }, |
9287 | 3531 { N_("/Conversation/Insert Imag_e..."), NULL, menu_insert_image_cb, 0, |
7859 | 3532 "<StockItem>", GAIM_STOCK_IMAGE }, |
3533 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3534 { "/Conversation/sep4", NULL, NULL, 0, "<Separator>" }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3535 |
4596 | 3536 { N_("/Conversation/_Close"), NULL, menu_close_conv_cb, 0, |
4359 | 3537 "<StockItem>", GTK_STOCK_CLOSE }, |
3538 | |
3539 /* Options */ | |
4596 | 3540 { N_("/_Options"), NULL, NULL, 0, "<Branch>" }, |
3541 { N_("/Options/Enable _Logging"), NULL, menu_logging_cb, 0, "<CheckItem>" }, | |
3542 { N_("/Options/Enable _Sounds"), NULL, menu_sounds_cb, 0, "<CheckItem>" }, | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3543 { N_("/Options/Show Formatting _Toolbar"), NULL, menu_toolbar_cb, 0, "<CheckItem>" }, |
9188 | 3544 { N_("/Options/Show T_imestamps"), "F2", menu_timestamps_cb, 0, "<CheckItem>" }, |
4359 | 3545 }; |
3546 | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
3547 static const int menu_item_count = |
4359 | 3548 sizeof(menu_items) / sizeof(*menu_items); |
3549 | |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3550 static char * |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3551 item_factory_translate_func (const char *path, gpointer func_data) |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3552 { |
7386 | 3553 return _((char *)path); |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3554 } |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3555 |
4359 | 3556 static GtkWidget * |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3557 setup_menubar(GaimConvWindow *win) |
4359 | 3558 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3559 GaimGtkWindow *gtkwin; |
5116 | 3560 GtkAccelGroup *accel_group; |
4359 | 3561 gtkwin = GAIM_GTK_WINDOW(win); |
3562 | |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
3563 accel_group = gtk_accel_group_new (); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
3564 gtk_window_add_accel_group (GTK_WINDOW (gtkwin->window), accel_group); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
3565 g_object_unref (accel_group); |
5116 | 3566 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3567 gtkwin->menu.item_factory = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3568 gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<main>", accel_group); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3569 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3570 gtk_item_factory_set_translate_func(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3571 item_factory_translate_func, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3572 NULL, NULL); |
4630 | 3573 |
3574 gtk_item_factory_create_items(gtkwin->menu.item_factory, menu_item_count, | |
4359 | 3575 menu_items, win); |
7420 | 3576 g_signal_connect(G_OBJECT(accel_group), "accel-changed", |
3577 G_CALLBACK(gaim_gtk_save_accels_cb), NULL); | |
4359 | 3578 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3579 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3580 gtkwin->menu.menubar = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3581 gtk_item_factory_get_widget(gtkwin->menu.item_factory, "<main>"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3582 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3583 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3584 gtkwin->menu.view_log = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3585 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
7295 | 3586 N_("/Conversation/View Log")); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3587 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3588 |
9468 | 3589 gtkwin->menu.send_file = |
3590 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3591 N_("/Conversation/Send File...")); | |
9498 | 3592 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3593 gtkwin->menu.add_pounce = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3594 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3595 N_("/Conversation/Add Buddy Pounce...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3596 |
7879 | 3597 /* --- */ |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3598 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3599 gtkwin->menu.get_info = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3600 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
7859 | 3601 N_("/Conversation/Get Info")); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3602 |
7879 | 3603 gtkwin->menu.warn = |
3604 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3605 N_("/Conversation/Warn...")); | |
3606 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3607 gtkwin->menu.invite = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3608 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3609 N_("/Conversation/Invite...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3610 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3611 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3612 |
7879 | 3613 gtkwin->menu.alias = |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3614 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
7879 | 3615 N_("/Conversation/Alias...")); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3616 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3617 gtkwin->menu.block = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3618 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3619 N_("/Conversation/Block...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3620 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3621 gtkwin->menu.add = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3622 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3623 N_("/Conversation/Add...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3624 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3625 gtkwin->menu.remove = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3626 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3627 N_("/Conversation/Remove...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3628 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3629 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3630 |
7879 | 3631 gtkwin->menu.insert_link = |
3632 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3633 N_("/Conversation/Insert Link...")); | |
3634 | |
3635 gtkwin->menu.insert_image = | |
3636 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3637 N_("/Conversation/Insert Image...")); | |
3638 | |
3639 /* --- */ | |
3640 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3641 gtkwin->menu.logging = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3642 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3643 N_("/Options/Enable Logging")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3644 gtkwin->menu.sounds = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3645 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3646 N_("/Options/Enable Sounds")); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3647 gtkwin->menu.show_formatting_toolbar = |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3648 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3649 N_("/Options/Show Formatting Toolbar")); |
9188 | 3650 gtkwin->menu.show_timestamps = |
3651 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3652 N_("/Options/Show Timestamps")); | |
4359 | 3653 |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3654 generate_send_as_items(win, NULL); |
4359 | 3655 |
3656 gtk_widget_show(gtkwin->menu.menubar); | |
4931 | 3657 |
3658 return gtkwin->menu.menubar; | |
4359 | 3659 } |
3660 | |
9759 | 3661 GtkWidget * |
3662 gaim_gtkconv_button_new(const char *icon, const char *text, const char *tooltip, GtkTooltips *tooltips, void *callback, void *data) | |
9749 | 3663 { |
3664 GtkWidget *button; | |
3665 int buttons; | |
3666 | |
3667 buttons = gaim_prefs_get_int("/gaim/gtk/conversations/button_type"); | |
3668 button = gaim_pixbuf_button_from_stock( | |
3669 (buttons == GAIM_BUTTON_IMAGE ? NULL : text), | |
3670 (buttons == GAIM_BUTTON_TEXT ? NULL : icon), | |
9750 | 3671 GAIM_BUTTON_VERTICAL); |
9766 | 3672 if (tooltip != NULL) |
3673 gtk_tooltips_set_tip(tooltips, button, tooltip, NULL); | |
9749 | 3674 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); |
9766 | 3675 if (callback != NULL) |
3676 g_signal_connect(G_OBJECT(button), "clicked", | |
3677 G_CALLBACK(callback), data); | |
9749 | 3678 |
3679 return button; | |
3680 } | |
3681 | |
4359 | 3682 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3683 setup_im_buttons(GaimConversation *conv, GtkWidget *parent) |
4359 | 3684 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3685 GaimConnection *gc; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3686 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3687 GaimGtkImPane *gtkim; |
8811 | 3688 GaimButtonStyle button_type; |
9749 | 3689 GList *children; |
4359 | 3690 |
3691 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3692 gtkim = gtkconv->u.im; | |
3693 gc = gaim_conversation_get_gc(conv); | |
3694 | |
9749 | 3695 /* Remove anything else in our parent */ |
3696 children = gtk_container_get_children(GTK_CONTAINER(parent)); | |
3697 while (children != NULL) { | |
3698 gtk_container_remove(GTK_CONTAINER(parent), children->data); | |
3699 children = g_list_remove(children, children->data); | |
3700 } | |
3701 | |
9750 | 3702 /* The buttons, from left to right */ |
9749 | 3703 |
3704 /* Warn button */ | |
9759 | 3705 gtkim->warn = gaim_gtkconv_button_new(GAIM_STOCK_WARN, _("Warn"), |
9749 | 3706 _("Warn the user"), |
3707 gtkconv->tooltips, warn_cb, conv); | |
9750 | 3708 gtk_box_pack_start(GTK_BOX(parent), gtkim->warn, TRUE, TRUE, 0); |
9749 | 3709 gtk_size_group_add_widget(gtkconv->sg, gtkim->warn); |
3710 | |
3711 /* Block button */ | |
9759 | 3712 gtkim->block = gaim_gtkconv_button_new(GAIM_STOCK_BLOCK, _("Block"), |
9749 | 3713 _("Block the user"), |
3714 gtkconv->tooltips, block_cb, conv); | |
9750 | 3715 gtk_box_pack_start(GTK_BOX(parent), gtkim->block, TRUE, TRUE, 0); |
9749 | 3716 gtk_size_group_add_widget(gtkconv->sg, gtkim->block); |
3717 | |
3718 /* Send File button */ | |
9759 | 3719 gtkim->send_file = gaim_gtkconv_button_new(GAIM_STOCK_FILE_TRANSFER, _("Send File"), |
9749 | 3720 _("Send a file to the user"), |
3721 gtkconv->tooltips, send_file_cb, conv); | |
9750 | 3722 gtk_box_pack_start(GTK_BOX(parent), gtkim->send_file, TRUE, TRUE, 0); |
9749 | 3723 gtk_size_group_add_widget(gtkconv->sg, gtkim->send_file); |
3724 | |
3725 /* Add button */ | |
9759 | 3726 gtkconv->add = gaim_gtkconv_button_new(GTK_STOCK_ADD, _("Add"), |
9749 | 3727 _("Add the user to your buddy list"), |
3728 gtkconv->tooltips, add_remove_cb, conv); | |
9750 | 3729 gtk_box_pack_start(GTK_BOX(parent), gtkconv->add, TRUE, TRUE, 0); |
9749 | 3730 gtk_size_group_add_widget(gtkconv->sg, gtkconv->add); |
3731 | |
3732 /* Remove button */ | |
9759 | 3733 gtkconv->remove = gaim_gtkconv_button_new(GTK_STOCK_REMOVE, _("Remove"), |
9749 | 3734 _("Remove the user from your buddy list"), |
3735 gtkconv->tooltips, add_remove_cb, conv); | |
9750 | 3736 gtk_box_pack_start(GTK_BOX(parent), gtkconv->remove, TRUE, TRUE, 0); |
9749 | 3737 gtk_size_group_add_widget(gtkconv->sg, gtkconv->remove); |
3738 | |
3739 /* Info button */ | |
9759 | 3740 gtkconv->info = gaim_gtkconv_button_new(GAIM_STOCK_INFO, _("Info"), |
9749 | 3741 _("Get the user's information"), |
3742 gtkconv->tooltips, info_cb, conv); | |
9750 | 3743 gtk_box_pack_start(GTK_BOX(parent), gtkconv->info, TRUE, TRUE, 0); |
9749 | 3744 gtk_size_group_add_widget(gtkconv->sg, gtkconv->info); |
4359 | 3745 |
3746 /* Send button */ | |
9759 | 3747 gtkconv->send = gaim_gtkconv_button_new(GAIM_STOCK_SEND, _("Send"), |
9749 | 3748 _("Send message"), |
3749 gtkconv->tooltips, send_cb, conv); | |
4359 | 3750 gtk_box_pack_end(GTK_BOX(parent), gtkconv->send, FALSE, FALSE, 0); |
3751 | |
3752 /* Separator */ | |
3753 gtkim->sep2 = gtk_vseparator_new(); | |
3754 gtk_box_pack_end(GTK_BOX(parent), gtkim->sep2, FALSE, TRUE, 0); | |
3755 gtk_widget_show(gtkim->sep2); | |
3756 | |
3757 gaim_gtkconv_update_buttons_by_protocol(conv); | |
3758 | |
8811 | 3759 /* Check if the buttons should be visible or not */ |
9150 | 3760 button_type = gaim_prefs_get_int("/gaim/gtk/conversations/button_type"); |
8811 | 3761 if (button_type == GAIM_BUTTON_NONE) |
9749 | 3762 gtk_widget_hide(parent); |
8811 | 3763 else |
9749 | 3764 gtk_widget_show(parent); |
4359 | 3765 } |
3766 | |
3767 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3768 setup_chat_buttons(GaimConversation *conv, GtkWidget *parent) |
4359 | 3769 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3770 GaimConnection *gc; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3771 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3772 GaimGtkChatPane *gtkchat; |
8811 | 3773 GaimButtonStyle button_type; |
9750 | 3774 GList *children; |
4359 | 3775 |
3776 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3777 gtkchat = gtkconv->u.chat; | |
3778 gc = gaim_conversation_get_gc(conv); | |
3779 | |
9750 | 3780 /* Remove anything else in our parent */ |
3781 children = gtk_container_get_children(GTK_CONTAINER(parent)); | |
3782 while (children != NULL) { | |
3783 gtk_container_remove(GTK_CONTAINER(parent), children->data); | |
3784 children = g_list_remove(children, children->data); | |
3785 } | |
3786 | |
3787 /* The buttons, from left to right */ | |
3788 | |
3789 /* Invite */ | |
9759 | 3790 gtkchat->invite = gaim_gtkconv_button_new(GAIM_STOCK_INVITE, _("Invite"), |
9817 | 3791 _("Invite a user"), |
9750 | 3792 gtkconv->tooltips, invite_cb, conv); |
3793 gtk_box_pack_start(GTK_BOX(parent), gtkchat->invite, TRUE, TRUE, 0); | |
3794 gtk_size_group_add_widget(gtkconv->sg, gtkchat->invite); | |
3795 | |
3796 /* Add button */ | |
9759 | 3797 gtkconv->add = gaim_gtkconv_button_new(GTK_STOCK_ADD, _("Add"), |
9750 | 3798 _("Add the chat to your buddy list"), |
3799 gtkconv->tooltips, add_remove_cb, conv); | |
3800 gtk_box_pack_start(GTK_BOX(parent), gtkconv->add, TRUE, TRUE, 0); | |
3801 gtk_size_group_add_widget(gtkconv->sg, gtkconv->add); | |
3802 | |
3803 /* Remove button */ | |
9759 | 3804 gtkconv->remove = gaim_gtkconv_button_new(GTK_STOCK_REMOVE, _("Remove"), |
9750 | 3805 _("Remove the chat from your buddy list"), |
3806 gtkconv->tooltips, add_remove_cb, conv); | |
3807 gtk_box_pack_start(GTK_BOX(parent), gtkconv->remove, TRUE, TRUE, 0); | |
3808 gtk_size_group_add_widget(gtkconv->sg, gtkconv->remove); | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3809 |
4359 | 3810 /* Send button */ |
9759 | 3811 gtkconv->send = gaim_gtkconv_button_new(GAIM_STOCK_SEND, _("Send"), |
9750 | 3812 _("Send message"), |
3813 gtkconv->tooltips, send_cb, conv); | |
4359 | 3814 gtk_box_pack_end(GTK_BOX(parent), gtkconv->send, FALSE, FALSE, 0); |
9750 | 3815 gtk_size_group_add_widget(gtkconv->sg, gtkconv->send); |
4359 | 3816 |
3817 /* Separator */ | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3818 gtkchat->sep = gtk_vseparator_new(); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3819 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
|
3820 gtk_widget_show(gtkchat->sep); |
4359 | 3821 |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3822 gaim_gtkconv_update_buttons_by_protocol(conv); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3823 |
8811 | 3824 /* Check if the buttons should be visible or not */ |
9150 | 3825 button_type = gaim_prefs_get_int("/gaim/gtk/conversations/button_type"); |
8811 | 3826 if (button_type == GAIM_BUTTON_NONE) |
3827 gtk_widget_hide(gtkconv->bbox); | |
3828 else | |
3829 gtk_widget_show(gtkconv->bbox); | |
4359 | 3830 } |
3831 | |
3832 | |
7971 | 3833 static void topic_callback(GtkWidget *w, GaimConversation *conv) |
3834 { | |
3835 GaimPluginProtocolInfo *prpl_info = NULL; | |
3836 GaimConnection *gc; | |
3837 GaimGtkConversation *gtkconv; | |
3838 GaimGtkChatPane *gtkchat; | |
8858 | 3839 const char *new_topic; |
3840 const char *current_topic; | |
7971 | 3841 |
3842 gc = gaim_conversation_get_gc(conv); | |
3843 | |
3844 if(!gc || !(prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl))) | |
3845 return; | |
3846 | |
3847 if(prpl_info->set_chat_topic == NULL) | |
3848 return; | |
3849 | |
3850 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3851 gtkchat = gtkconv->u.chat; | |
8858 | 3852 new_topic = gtk_entry_get_text(GTK_ENTRY(gtkchat->topic_text)); |
3853 current_topic = gaim_conv_chat_get_topic(GAIM_CONV_CHAT(conv)); | |
3854 | |
3855 if(current_topic && !g_utf8_collate(new_topic, current_topic)) | |
7971 | 3856 return; |
3857 | |
8858 | 3858 prpl_info->set_chat_topic(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), |
3859 new_topic); | |
7971 | 3860 } |
3861 | |
9554 | 3862 static gint |
3863 sort_chat_users(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer userdata) | |
3864 { | |
3865 GaimConvChatBuddyFlags f1 = 0, f2 = 0; | |
3866 char *user1 = NULL, *user2 = NULL; | |
3867 gint ret = 0; | |
3868 | |
3869 gtk_tree_model_get(model, a, CHAT_USERS_NAME_COLUMN, &user1, CHAT_USERS_FLAGS_COLUMN, &f1, -1); | |
3870 gtk_tree_model_get(model, b, CHAT_USERS_NAME_COLUMN, &user2, CHAT_USERS_FLAGS_COLUMN, &f2, -1); | |
3871 | |
3872 if (user1 == NULL || user2 == NULL) { | |
3873 if (!(user1 == NULL && user2 == NULL)) | |
3874 ret = (user1 == NULL) ? -1: 1; | |
3875 } else if (f1 != f2) { | |
3876 /* sort more important users first */ | |
3877 ret = (f1 > f2) ? -1 : 1; | |
3878 } else { | |
3879 ret = g_utf8_collate(user1, user2); | |
3880 } | |
3881 | |
3882 g_free(user1); | |
3883 g_free(user2); | |
3884 | |
3885 return ret; | |
3886 } | |
3887 | |
4359 | 3888 static GtkWidget * |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3889 setup_chat_pane(GaimConversation *conv) |
4359 | 3890 { |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3891 GaimPluginProtocolInfo *prpl_info = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3892 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3893 GaimGtkChatPane *gtkchat; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3894 GaimConnection *gc; |
4359 | 3895 GtkWidget *vpaned, *hpaned; |
3896 GtkWidget *vbox, *hbox; | |
3897 GtkWidget *lbox, *bbox; | |
3898 GtkWidget *label; | |
3899 GtkWidget *list; | |
3900 GtkWidget *button; | |
7949 | 3901 GtkWidget *sw; |
4359 | 3902 GtkListStore *ls; |
3903 GtkCellRenderer *rend; | |
3904 GtkTreeViewColumn *col; | |
9080 | 3905 GList *focus_chain = NULL; |
4359 | 3906 |
3907 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3908 gtkchat = gtkconv->u.chat; | |
3909 gc = gaim_conversation_get_gc(conv); | |
3910 | |
3911 /* Setup the outer pane. */ | |
3912 vpaned = gtk_vpaned_new(); | |
3913 gtk_widget_show(vpaned); | |
3914 | |
3915 /* Setup the top part of the pane. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3916 vbox = gtk_vbox_new(FALSE, 6); |
8914 | 3917 gtk_paned_pack1(GTK_PANED(vpaned), vbox, TRUE, TRUE); |
4359 | 3918 gtk_widget_show(vbox); |
3919 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3920 if (gc != NULL) |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3921 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3922 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3923 if (prpl_info->options & OPT_PROTO_CHAT_TOPIC) |
4359 | 3924 { |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3925 hbox = gtk_hbox_new(FALSE, 6); |
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3926 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
4359 | 3927 gtk_widget_show(hbox); |
3928 | |
3929 label = gtk_label_new(_("Topic:")); | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3930 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
4359 | 3931 gtk_widget_show(label); |
3932 | |
3933 gtkchat->topic_text = gtk_entry_new(); | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3934 |
7971 | 3935 if(prpl_info->set_chat_topic == NULL) { |
3936 gtk_editable_set_editable(GTK_EDITABLE(gtkchat->topic_text), FALSE); | |
3937 } else { | |
3938 g_signal_connect(GTK_OBJECT(gtkchat->topic_text), "activate", | |
3939 G_CALLBACK(topic_callback), conv); | |
3940 } | |
3941 | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3942 gtk_box_pack_start(GTK_BOX(hbox), gtkchat->topic_text, TRUE, TRUE, 0); |
4359 | 3943 gtk_widget_show(gtkchat->topic_text); |
3944 } | |
3945 | |
3946 /* Setup the horizontal pane. */ | |
3947 hpaned = gtk_hpaned_new(); | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3948 gtk_box_pack_start(GTK_BOX(vbox), hpaned, TRUE, TRUE, 0); |
4359 | 3949 gtk_widget_show(hpaned); |
3950 | |
3951 /* Setup the scrolled window to put gtkimhtml in. */ | |
3952 gtkconv->sw = gtk_scrolled_window_new(NULL, NULL); | |
3953 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
8076 | 3954 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
4359 | 3955 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(gtkconv->sw), |
3956 GTK_SHADOW_IN); | |
3957 gtk_paned_pack1(GTK_PANED(hpaned), gtkconv->sw, TRUE, TRUE); | |
3958 | |
3959 gtk_widget_set_size_request(gtkconv->sw, | |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3960 gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_width"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3961 gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_height")); |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3962 |
8914 | 3963 g_signal_connect(G_OBJECT(gtkconv->sw), "size-allocate", |
3964 G_CALLBACK(size_allocate_cb), conv); | |
3965 | |
4359 | 3966 gtk_widget_show(gtkconv->sw); |
3967 | |
3968 /* Setup gtkihmtml. */ | |
3969 gtkconv->imhtml = gtk_imhtml_new(NULL, NULL); | |
9005 | 3970 gtk_widget_set_name(gtkconv->imhtml, "gaim_gtkconv_imhtml"); |
4359 | 3971 gtk_container_add(GTK_CONTAINER(gtkconv->sw), gtkconv->imhtml); |
3972 | |
3973 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3974 gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); |
4359 | 3975 |
3976 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", | |
3977 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
8105 | 3978 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_press_event", |
6057 | 3979 G_CALLBACK(refocus_entry_cb), gtkconv); |
8109 | 3980 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_release_event", |
3981 G_CALLBACK(refocus_entry_cb), gtkconv); | |
4359 | 3982 |
3983 gaim_setup_imhtml(gtkconv->imhtml); | |
3984 gtk_widget_show(gtkconv->imhtml); | |
3985 | |
3986 /* Build the right pane. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3987 lbox = gtk_vbox_new(FALSE, 6); |
4409
0521eec12c33
[gaim-migrate @ 4682]
Christian Hammond <chipx86@chipx86.com>
parents:
4398
diff
changeset
|
3988 gtk_paned_pack2(GTK_PANED(hpaned), lbox, FALSE, TRUE); |
4359 | 3989 gtk_widget_show(lbox); |
3990 | |
3991 /* Setup the label telling how many people are in the room. */ | |
3992 gtkchat->count = gtk_label_new(_("0 people in room")); | |
3993 gtk_box_pack_start(GTK_BOX(lbox), gtkchat->count, FALSE, FALSE, 0); | |
3994 gtk_widget_show(gtkchat->count); | |
3995 | |
3996 /* Setup the list of users. */ | |
7949 | 3997 sw = gtk_scrolled_window_new(NULL, NULL); |
3998 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
8076 | 3999 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
7949 | 4000 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); |
4001 gtk_box_pack_start(GTK_BOX(lbox), sw, TRUE, TRUE, 0); | |
4002 gtk_widget_show(sw); | |
4359 | 4003 |
9554 | 4004 ls = gtk_list_store_new(CHAT_USERS_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING, |
4005 G_TYPE_INT); | |
4006 gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(ls), CHAT_USERS_NAME_COLUMN, | |
4007 sort_chat_users, NULL, NULL); | |
9498 | 4008 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), CHAT_USERS_NAME_COLUMN, |
4359 | 4009 GTK_SORT_ASCENDING); |
4010 | |
4011 list = gtk_tree_view_new_with_model(GTK_TREE_MODEL(ls)); | |
4012 | |
9498 | 4013 rend = gtk_cell_renderer_pixbuf_new(); |
4014 | |
4359 | 4015 col = gtk_tree_view_column_new_with_attributes(NULL, rend, |
9498 | 4016 "pixbuf", CHAT_USERS_ICON_COLUMN, NULL); |
9554 | 4017 gtk_tree_view_column_set_clickable(GTK_TREE_VIEW_COLUMN(col), TRUE); |
4018 | |
9498 | 4019 gtk_tree_view_append_column(GTK_TREE_VIEW(list), col); |
4359 | 4020 |
4021 g_signal_connect(G_OBJECT(list), "button_press_event", | |
4022 G_CALLBACK(right_click_chat_cb), conv); | |
8143 | 4023 g_signal_connect(G_OBJECT(list), "popup-menu", |
4024 G_CALLBACK(gtkconv_chat_popup_menu_cb), conv); | |
4359 | 4025 |
9498 | 4026 rend = gtk_cell_renderer_text_new(); |
4027 | |
4359 | 4028 col = gtk_tree_view_column_new_with_attributes(NULL, rend, |
9498 | 4029 "text", CHAT_USERS_NAME_COLUMN, NULL); |
4359 | 4030 gtk_tree_view_column_set_clickable(GTK_TREE_VIEW_COLUMN(col), TRUE); |
4031 | |
4032 gtk_tree_view_append_column(GTK_TREE_VIEW(list), col); | |
4033 | |
4034 gtk_widget_set_size_request(list, 150, -1); | |
4035 | |
4036 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(list), FALSE); | |
4037 gtk_widget_show(list); | |
4038 | |
4039 gtkchat->list = list; | |
4040 | |
7949 | 4041 gtk_container_add(GTK_CONTAINER(sw), list); |
4359 | 4042 |
4043 /* Setup the user list toolbar. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4044 bbox = gtk_hbox_new(TRUE, 6); |
4359 | 4045 gtk_box_pack_start(GTK_BOX(lbox), bbox, FALSE, FALSE, 0); |
4046 gtk_widget_show(bbox); | |
4047 | |
4048 /* IM */ | |
4049 button = gaim_pixbuf_button_from_stock(NULL, GTK_STOCK_REDO, | |
4050 GAIM_BUTTON_VERTICAL); | |
4051 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
4052 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
|
4053 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("IM the user"), NULL); |
4359 | 4054 g_signal_connect(G_OBJECT(button), "clicked", |
7961 | 4055 G_CALLBACK(chat_im_button_cb), conv); |
4359 | 4056 |
4057 gtk_widget_show(button); | |
4058 | |
4059 /* Ignore */ | |
4060 button = gaim_pixbuf_button_from_stock(NULL, GAIM_STOCK_IGNORE, | |
4061 GAIM_BUTTON_VERTICAL); | |
4062 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
4063 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
|
4064 gtk_tooltips_set_tip(gtkconv->tooltips, button, |
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
4065 _("Ignore the user"), NULL); |
4359 | 4066 g_signal_connect(G_OBJECT(button), "clicked", |
4067 G_CALLBACK(ignore_cb), conv); | |
4068 gtk_widget_show(button); | |
4069 | |
4070 /* Info */ | |
4071 button = gaim_pixbuf_button_from_stock(NULL, GAIM_STOCK_INFO, | |
4072 GAIM_BUTTON_VERTICAL); | |
4073 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
4074 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
4075 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
4076 _("Get the user's information"), NULL); |
4359 | 4077 g_signal_connect(G_OBJECT(button), "clicked", |
4078 G_CALLBACK(info_cb), conv); | |
4079 | |
4080 gtk_widget_show(button); | |
4081 | |
4082 gtkconv->info = button; | |
4083 | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4084 /* Build the toolbar. */ |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4085 vbox = gtk_vbox_new(FALSE, 6); |
8914 | 4086 gtk_paned_pack2(GTK_PANED(vpaned), vbox, FALSE, TRUE); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4087 gtk_widget_show(vbox); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4088 |
8317 | 4089 gtkconv->toolbar = gtk_imhtmltoolbar_new(); |
4090 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->toolbar, FALSE, FALSE, 0); | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4091 |
9332 | 4092 gtkconv->lower_hbox = gtk_hbox_new(FALSE, 6); |
4093 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->lower_hbox, TRUE, TRUE, 0); | |
4094 gtk_widget_show(gtkconv->lower_hbox); | |
4095 | |
4096 vbox = gtk_vbox_new(FALSE, 6); | |
4097 gtk_box_pack_end(GTK_BOX(gtkconv->lower_hbox), vbox, TRUE, TRUE, 0); | |
4098 gtk_widget_show(vbox); | |
4099 | |
8123 | 4100 /* Setup the entry widget. |
4101 * We never show the horizontal scrollbar because it was causing weird | |
4102 * lockups when typing text just as you type the character that would | |
4103 * cause both scrollbars to appear. Definitely seems like a gtk bug. | |
4104 */ | |
7949 | 4105 sw = gtk_scrolled_window_new(NULL, NULL); |
4106 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
8112 | 4107 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); |
8061 | 4108 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), |
4109 GTK_SHADOW_IN); | |
9332 | 4110 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); |
7949 | 4111 gtk_widget_show(sw); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4112 |
8061 | 4113 gtkconv->entry = gtk_imhtml_new(NULL, NULL); |
9005 | 4114 gtk_widget_set_name(gtkconv->entry, "gaim_gtkconv_entry"); |
8456 | 4115 gtk_imhtml_smiley_shortcuts(GTK_IMHTML(gtkconv->entry), |
4116 gaim_prefs_get_bool("/gaim/gtk/conversations/smiley_shortcuts")); | |
4117 gtk_imhtml_html_shortcuts(GTK_IMHTML(gtkconv->entry), | |
4118 gaim_prefs_get_bool("/gaim/gtk/conversations/html_shortcuts")); | |
4119 | |
4120 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), | |
9699 | 4121 gaim_account_get_protocol_name(conv->account)); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4122 gtkconv->entry_buffer = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4123 gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); |
8061 | 4124 gaim_setup_imhtml(gtkconv->entry); |
4125 gtk_imhtml_set_editable(GTK_IMHTML(gtkconv->entry), TRUE); | |
4126 default_formatize(conv); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4127 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(gtkconv->entry), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4128 GTK_WRAP_WORD_CHAR); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4129 gtk_widget_set_size_request(gtkconv->entry, -1, |
8106 | 4130 gaim_prefs_get_int("/gaim/gtk/conversations/chat/entry_height")); |
7949 | 4131 g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", conv); |
4132 | |
4133 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", | |
8105 | 4134 G_CALLBACK(entry_key_press_cb), conv); |
4359 | 4135 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", |
4136 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
8914 | 4137 g_signal_connect(G_OBJECT(gtkconv->entry), "size-allocate", |
4138 G_CALLBACK(size_allocate_cb), conv); | |
4359 | 4139 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4140 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
4141 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4142 gtk_imhtmltoolbar_attach(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4143 gtkconv->entry); |
4359 | 4144 |
7949 | 4145 gtk_container_add(GTK_CONTAINER(sw), GTK_WIDGET(gtkconv->entry)); |
4359 | 4146 gtk_widget_show(gtkconv->entry); |
4147 | |
4148 /* Setup the bottom button box. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4149 gtkconv->bbox = gtk_hbox_new(FALSE, 6); |
4359 | 4150 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->bbox, FALSE, FALSE, 0); |
4151 setup_chat_buttons(conv, gtkconv->bbox); | |
4152 | |
9080 | 4153 /* |
4154 * Focus for chat windows should be as follows: | |
4155 * Tab title -> chat topic -> conversation scrollback -> user list -> | |
4156 * user list buttons -> entry -> buttons at bottom | |
4157 */ | |
4158 focus_chain = g_list_prepend(focus_chain, gtkconv->bbox); | |
9332 | 4159 focus_chain = g_list_prepend(focus_chain, gtkconv->entry); |
9080 | 4160 gtk_container_set_focus_chain(GTK_CONTAINER(vbox), focus_chain); |
4161 | |
4359 | 4162 return vpaned; |
4163 } | |
4164 | |
4165 static GtkWidget * | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4166 setup_im_pane(GaimConversation *conv) |
4359 | 4167 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4168 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4169 GaimGtkImPane *gtkim; |
4359 | 4170 GtkWidget *paned; |
4171 GtkWidget *vbox; | |
4172 GtkWidget *vbox2; | |
7949 | 4173 GtkWidget *sw; |
9080 | 4174 GList *focus_chain = NULL; |
4359 | 4175 |
4176 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4177 gtkim = gtkconv->u.im; | |
4178 | |
4179 /* Setup the outer pane. */ | |
4180 paned = gtk_vpaned_new(); | |
4181 gtk_widget_show(paned); | |
4182 | |
4183 /* Setup the top part of the pane. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4184 vbox = gtk_vbox_new(FALSE, 6); |
4409
0521eec12c33
[gaim-migrate @ 4682]
Christian Hammond <chipx86@chipx86.com>
parents:
4398
diff
changeset
|
4185 gtk_paned_pack1(GTK_PANED(paned), vbox, TRUE, TRUE); |
4359 | 4186 gtk_widget_show(vbox); |
4187 | |
4188 /* Setup the gtkimhtml widget. */ | |
4189 gtkconv->sw = gtk_scrolled_window_new(NULL, NULL); | |
4190 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
8076 | 4191 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
4359 | 4192 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(gtkconv->sw), |
4193 GTK_SHADOW_IN); | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4194 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->sw, TRUE, TRUE, 0); |
4851 | 4195 |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
4196 gtk_widget_set_size_request(gtkconv->sw, |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
4197 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_width"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
4198 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_height")); |
8914 | 4199 g_signal_connect(G_OBJECT(gtkconv->sw), "size-allocate", |
4200 G_CALLBACK(size_allocate_cb), conv); | |
4359 | 4201 gtk_widget_show(gtkconv->sw); |
4202 | |
4203 gtkconv->imhtml = gtk_imhtml_new(NULL, NULL); | |
9005 | 4204 gtk_widget_set_name(gtkconv->imhtml, "gaim_gtkconv_imhtml"); |
4359 | 4205 gtk_container_add(GTK_CONTAINER(gtkconv->sw), gtkconv->imhtml); |
4206 | |
4207 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", | |
4208 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
8105 | 4209 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_press_event", |
6057 | 4210 G_CALLBACK(refocus_entry_cb), gtkconv); |
8109 | 4211 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_release_event", |
4212 G_CALLBACK(refocus_entry_cb), gtkconv); | |
4359 | 4213 |
4214 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4215 gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); |
4359 | 4216 gaim_setup_imhtml(gtkconv->imhtml); |
4217 gtk_widget_show(gtkconv->imhtml); | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4218 vbox2 = gtk_vbox_new(FALSE, 6); |
8914 | 4219 gtk_paned_pack2(GTK_PANED(paned), vbox2, FALSE, TRUE); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4220 gtk_widget_show(vbox2); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4221 |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4222 /* Build the toolbar. */ |
8317 | 4223 gtkconv->toolbar = gtk_imhtmltoolbar_new(); |
4224 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->toolbar, FALSE, FALSE, 0); | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4225 |
8123 | 4226 /* Setup the entry widget. |
4227 * 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
|
4228 * lockups when typing text just as you type the character that would |
8123 | 4229 * cause both scrollbars to appear. Definitely seems like a gtk bug. |
4230 */ | |
9332 | 4231 gtkconv->lower_hbox = gtk_hbox_new(FALSE, 6); |
4232 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->lower_hbox, TRUE, TRUE, 0); | |
4233 gtk_widget_show(gtkconv->lower_hbox); | |
4234 | |
4235 vbox2 = gtk_vbox_new(FALSE, 6); | |
4236 gtk_box_pack_end(GTK_BOX(gtkconv->lower_hbox), vbox2, TRUE, TRUE, 0); | |
4237 gtk_widget_show(vbox2); | |
8821 | 4238 |
7949 | 4239 sw = gtk_scrolled_window_new(NULL, NULL); |
4240 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
8112 | 4241 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); |
8061 | 4242 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), |
4243 GTK_SHADOW_IN); | |
9332 | 4244 gtk_box_pack_start(GTK_BOX(vbox2), sw, TRUE, TRUE, 0); |
7949 | 4245 gtk_widget_show(sw); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4246 |
8061 | 4247 gtkconv->entry = gtk_imhtml_new(NULL, NULL); |
9005 | 4248 gtk_widget_set_name(gtkconv->entry, "gaim_gtkconv_entry"); |
8456 | 4249 |
4250 gtk_imhtml_smiley_shortcuts(GTK_IMHTML(gtkconv->entry), | |
4251 gaim_prefs_get_bool("/gaim/gtk/conversations/smiley_shortcuts")); | |
4252 gtk_imhtml_html_shortcuts(GTK_IMHTML(gtkconv->entry), | |
4253 gaim_prefs_get_bool("/gaim/gtk/conversations/html_shortcuts")); | |
4254 | |
4255 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), | |
9699 | 4256 gaim_account_get_protocol_name(conv->account)); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4257 gtkconv->entry_buffer = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4258 gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); |
8061 | 4259 gaim_setup_imhtml(gtkconv->entry); |
4260 gtk_imhtml_set_editable(GTK_IMHTML(gtkconv->entry), TRUE); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4261 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(gtkconv->entry), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4262 GTK_WRAP_WORD_CHAR); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4263 gtk_widget_set_size_request(gtkconv->entry, -1, |
8106 | 4264 gaim_prefs_get_int("/gaim/gtk/conversations/im/entry_height")); |
7949 | 4265 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
|
4266 |
4359 | 4267 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", |
8105 | 4268 G_CALLBACK(entry_key_press_cb), conv); |
4359 | 4269 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", |
4270 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
8914 | 4271 g_signal_connect(G_OBJECT(gtkconv->entry), "size-allocate", |
4272 G_CALLBACK(size_allocate_cb), conv); | |
4359 | 4273 |
4274 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "insert_text", | |
4275 G_CALLBACK(insert_text_cb), conv); | |
4276 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "delete_range", | |
4277 G_CALLBACK(delete_text_cb), conv); | |
4278 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4279 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
4280 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
4359 | 4281 |
7949 | 4282 gtk_container_add(GTK_CONTAINER(sw), GTK_WIDGET(gtkconv->entry)); |
4359 | 4283 gtk_widget_show(gtkconv->entry); |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
4284 gtk_imhtmltoolbar_attach(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), |
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
4285 gtkconv->entry); |
8481 | 4286 /* had to move this after the imtoolbar is attached so that the |
4287 * signals get fired to toggle the buttons on the toolbar as well. | |
4288 */ | |
4289 default_formatize(conv); | |
4359 | 4290 |
9749 | 4291 /* Setup the bottom button box. */ |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4292 gtkconv->bbox = gtk_hbox_new(FALSE, 6); |
4359 | 4293 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->bbox, FALSE, FALSE, 0); |
4294 setup_im_buttons(conv, gtkconv->bbox); | |
9749 | 4295 |
8758 | 4296 gtkconv->u.im->animate = gaim_prefs_get_bool("/gaim/gtk/conversations/im/animate_buddy_icons"); |
9687 | 4297 gtkconv->u.im->show_icon = TRUE; |
4359 | 4298 |
9080 | 4299 /* |
4300 * Focus for IM windows should be as follows: | |
4301 * Tab title -> conversation scrollback -> entry -> buttons at bottom | |
4302 */ | |
4303 focus_chain = g_list_prepend(focus_chain, gtkconv->bbox); | |
9332 | 4304 focus_chain = g_list_prepend(focus_chain, gtkconv->entry); |
9080 | 4305 gtk_container_set_focus_chain(GTK_CONTAINER(vbox2), focus_chain); |
8143 | 4306 |
4359 | 4307 return paned; |
4308 } | |
4309 | |
4310 static void | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4311 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
|
4312 GtkSelectionData *sd, guint info, guint t, |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4313 GaimConversation *conv) |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4314 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4315 GaimConvWindow *win = conv->window; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4316 GaimConversation *c; |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4317 if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE)) |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4318 { |
4781 | 4319 GaimBlistNode *n = NULL; |
6695 | 4320 GaimBuddy *b; |
9622 | 4321 unsigned int index; |
4322 | |
4781 | 4323 memcpy(&n, sd->data, sizeof(n)); |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
4324 |
6695 | 4325 if (GAIM_BLIST_NODE_IS_CONTACT(n)) |
4326 b = gaim_contact_get_priority_buddy((GaimContact*)n); | |
4327 else if (GAIM_BLIST_NODE_IS_BUDDY(n)) | |
4328 b = (GaimBuddy*)n; | |
4329 else | |
4781 | 4330 return; |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
4331 |
9622 | 4332 /* |
4333 * If we already have an open conversation with this buddy, then | |
4334 * just move the conv to this window. Otherwise, create a new | |
4335 * conv and add it to this window. | |
4336 */ | |
4337 c = gaim_find_conversation(b->name); | |
4338 if (c != NULL) { | |
4339 GaimConvWindow *oldwin; | |
4340 oldwin = gaim_conversation_get_window(c); | |
4341 index = gaim_conversation_get_index(c); | |
4342 if (oldwin != win) { | |
4343 gaim_conv_window_remove_conversation(oldwin, index); | |
4344 gaim_conv_window_add_conversation(win, c); | |
4345 } | |
4346 } else { | |
4347 c = gaim_conversation_new(GAIM_CONV_IM, b->account, b->name); | |
4348 gaim_conv_window_add_conversation(win, c); | |
4349 } | |
4350 | |
4351 /* Make this conversation the active conversation */ | |
4352 index = gaim_conversation_get_index(c); | |
4353 gaim_conv_window_switch_conversation(win, index); | |
8802
1076cd8579ea
[gaim-migrate @ 9564]
Christian Hammond <chipx86@chipx86.com>
parents:
8758
diff
changeset
|
4354 |
1076cd8579ea
[gaim-migrate @ 9564]
Christian Hammond <chipx86@chipx86.com>
parents:
8758
diff
changeset
|
4355 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); |
4702 | 4356 } |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4357 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
|
4358 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4359 char *protocol = NULL; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4360 char *username = NULL; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4361 GaimAccount *account; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4362 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4363 if (gaim_gtk_parse_x_im_contact(sd->data, FALSE, &account, |
7718 | 4364 &protocol, &username, NULL)) |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4365 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4366 if (account == NULL) |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4367 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4368 gaim_notify_error(NULL, NULL, |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4369 _("You are not currently signed on with an account that " |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4370 "can add that buddy."), NULL); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4371 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4372 else |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4373 { |
7718 | 4374 c = gaim_conversation_new(GAIM_CONV_IM, account, username); |
4375 gaim_conv_window_add_conversation(win, c); | |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4376 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4377 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4378 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4379 if (username != NULL) g_free(username); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4380 if (protocol != NULL) g_free(protocol); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4381 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4382 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4383 } |
9525 | 4384 else if (sd->target == gdk_atom_intern("text/uri-list", FALSE)) { |
9673 | 4385 GList *tmp; |
4386 GList *files = gaim_uri_list_extract_filenames(sd->data); | |
4387 for(tmp = files; tmp != NULL ; tmp = g_list_next(tmp)) { | |
4388 gchar *filename = tmp->data; | |
4389 /* XXX - Make ft API support creating a transfer with more than one file */ | |
4390 if (g_file_test(filename, G_FILE_TEST_EXISTS) | |
4391 && !g_file_test(filename, G_FILE_TEST_IS_DIR) | |
4392 && gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
4393 serv_send_file(gaim_conversation_get_gc(conv), | |
4394 gaim_conversation_get_name(conv), filename); | |
4395 } | |
4396 g_free(filename); | |
9495 | 4397 } |
9673 | 4398 g_list_free(files); |
4399 /* XXX - Attempt to load this file into gdk_pixbuf, or otherwise determine if it is an image. If it is, offer | |
4400 * the choice of a) sending this file b) inserting this file as an IM image or c) setting this file as a custom | |
4401 * buddy icon for this buddy */ | |
9495 | 4402 } |
4403 gtk_drag_finish(dc, FALSE, FALSE, t); | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4404 } |
4359 | 4405 |
4406 /************************************************************************** | |
4407 * GTK+ window ops | |
4408 **************************************************************************/ | |
4409 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4410 gaim_gtk_new_window(GaimConvWindow *win) |
4359 | 4411 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4412 GaimGtkWindow *gtkwin; |
4359 | 4413 GtkPositionType pos; |
4414 GtkWidget *testidea; | |
4415 GtkWidget *menubar; | |
4416 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4417 gtkwin = g_malloc0(sizeof(GaimGtkWindow)); |
4359 | 4418 |
4419 win->ui_data = gtkwin; | |
4420 | |
4421 /* Create the window. */ | |
4422 gtkwin->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
4423 gtk_window_set_role(GTK_WINDOW(gtkwin->window), "conversation"); | |
9614 | 4424 gtk_window_set_resizable(GTK_WINDOW(gtkwin->window), TRUE); |
4510
4c394222c732
[gaim-migrate @ 4786]
Christian Hammond <chipx86@chipx86.com>
parents:
4505
diff
changeset
|
4425 gtk_container_set_border_width(GTK_CONTAINER(gtkwin->window), 0); |
9614 | 4426 GTK_WINDOW(gtkwin->window)->allow_shrink = TRUE; |
4359 | 4427 |
4428 g_signal_connect(G_OBJECT(gtkwin->window), "delete_event", | |
4429 G_CALLBACK(close_win_cb), win); | |
4430 | |
4431 /* Create the notebook. */ | |
4432 gtkwin->notebook = gtk_notebook_new(); | |
4433 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4434 pos = gaim_prefs_get_int("/gaim/gtk/conversations/tab_side"); |
4359 | 4435 |
4436 #if 0 | |
4437 gtk_notebook_set_tab_hborder(GTK_NOTEBOOK(gtkwin->notebook), 0); | |
4438 gtk_notebook_set_tab_vborder(GTK_NOTEBOOK(gtkwin->notebook), 0); | |
4439 #endif | |
4440 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos); | |
4441 gtk_notebook_set_scrollable(GTK_NOTEBOOK(gtkwin->notebook), TRUE); | |
4442 gtk_notebook_popup_enable(GTK_NOTEBOOK(gtkwin->notebook)); | |
4818 | 4443 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), FALSE); |
4444 | |
4359 | 4445 gtk_widget_show(gtkwin->notebook); |
4446 | |
8189 | 4447 g_signal_connect(G_OBJECT(gtkwin->notebook), "switch_page", |
4448 G_CALLBACK(before_switch_conv_cb), win); | |
4359 | 4449 g_signal_connect_after(G_OBJECT(gtkwin->notebook), "switch_page", |
4450 G_CALLBACK(switch_conv_cb), win); | |
4451 | |
4452 /* Setup the tab drag and drop signals. */ | |
4486 | 4453 gtk_widget_add_events(gtkwin->notebook, |
4454 GDK_BUTTON1_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK); | |
4455 g_signal_connect(G_OBJECT(gtkwin->notebook), "button_press_event", | |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4456 G_CALLBACK(notebook_press_cb), win); |
4486 | 4457 g_signal_connect(G_OBJECT(gtkwin->notebook), "button_release_event", |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4458 G_CALLBACK(notebook_release_cb), win); |
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4459 |
4359 | 4460 testidea = gtk_vbox_new(FALSE, 0); |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4461 |
4359 | 4462 /* Setup the menubar. */ |
4463 menubar = setup_menubar(win); | |
4464 gtk_box_pack_start(GTK_BOX(testidea), menubar, FALSE, TRUE, 0); | |
4465 | |
4466 gtk_box_pack_start(GTK_BOX(testidea), gtkwin->notebook, TRUE, TRUE, 0); | |
4467 | |
4468 gtk_container_add(GTK_CONTAINER(gtkwin->window), testidea); | |
4469 | |
4470 gtk_widget_show(testidea); | |
4471 } | |
4472 | |
4473 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4474 gaim_gtk_destroy_window(GaimConvWindow *win) |
4359 | 4475 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4476 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4477 |
4478 gtk_widget_destroy(gtkwin->window); | |
4479 | |
4630 | 4480 g_object_unref(G_OBJECT(gtkwin->menu.item_factory)); |
4481 | |
4359 | 4482 g_free(gtkwin); |
4483 win->ui_data = NULL; | |
4484 } | |
4485 | |
4486 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4487 gaim_gtk_show(GaimConvWindow *win) |
4359 | 4488 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4489 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4490 |
4491 gtk_widget_show(gtkwin->window); | |
4492 } | |
4493 | |
4494 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4495 gaim_gtk_hide(GaimConvWindow *win) |
4359 | 4496 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4497 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4498 |
4499 gtk_widget_hide(gtkwin->window); | |
4500 } | |
4501 | |
4502 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4503 gaim_gtk_raise(GaimConvWindow *win) |
4359 | 4504 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4505 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4506 |
9728 | 4507 gtk_widget_show(gtkwin->window); |
4508 gtk_window_deiconify(GTK_WINDOW(gtkwin->window)); | |
4509 gdk_window_raise(gtkwin->window->window); | |
4359 | 4510 } |
4511 | |
4512 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4513 gaim_gtk_flash(GaimConvWindow *win) |
4359 | 4514 { |
4515 #ifdef _WIN32 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4516 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4517 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4518 wgaim_conv_im_blink(gtkwin->window); |
4359 | 4519 #endif |
4520 } | |
4521 | |
4522 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4523 gaim_gtk_switch_conversation(GaimConvWindow *win, unsigned int index) |
4359 | 4524 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4525 GaimGtkWindow *gtkwin; |
4359 | 4526 |
4527 gtkwin = GAIM_GTK_WINDOW(win); | |
4528 | |
4529 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), index); | |
4530 } | |
4531 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4532 static const GtkTargetEntry te[] = |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4533 { |
9525 | 4534 {"text/uri-list", 0, 0}, |
4535 {"GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, 1}, | |
4536 {"text/plain", 0, 2}, | |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4537 {"STRING", 0, 3}, |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4538 {"application/x-im-contact", 0, 4} |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4539 }; |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4540 |
4359 | 4541 static void |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4542 gaim_gtk_add_conversation(GaimConvWindow *win, GaimConversation *conv) |
4359 | 4543 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4544 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4545 GaimGtkConversation *gtkconv, *focus_gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4546 GaimConversation *focus_conv; |
4359 | 4547 GtkWidget *pane = NULL; |
4548 GtkWidget *tab_cont; | |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4549 GtkWidget *tabby, *menu_tabby; |
4359 | 4550 gboolean new_ui; |
4383
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4551 GaimConversationType conv_type; |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4552 const char *name; |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4553 |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4554 name = gaim_conversation_get_name(conv); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4555 conv_type = gaim_conversation_get_type(conv); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4556 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4557 |
4558 if (conv->ui_data != NULL) { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4559 gtkconv = (GaimGtkConversation *)conv->ui_data; |
4359 | 4560 |
4561 tab_cont = gtkconv->tab_cont; | |
4562 | |
4563 new_ui = FALSE; | |
4564 } | |
4565 else { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4566 gtkconv = g_malloc0(sizeof(GaimGtkConversation)); |
4359 | 4567 conv->ui_data = gtkconv; |
4568 | |
4569 /* Setup some initial variables. */ | |
9749 | 4570 gtkconv->sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); |
4359 | 4571 gtkconv->tooltips = gtk_tooltips_new(); |
4572 | |
7879 | 4573 if (conv_type == GAIM_CONV_IM) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4574 gtkconv->u.im = g_malloc0(sizeof(GaimGtkImPane)); |
4359 | 4575 gtkconv->u.im->a_virgin = TRUE; |
4576 | |
4577 pane = setup_im_pane(conv); | |
4578 } | |
7879 | 4579 else if (conv_type == GAIM_CONV_CHAT) { |
4580 gtkconv->u.chat = g_malloc0(sizeof(GaimGtkChatPane)); | |
4581 | |
4582 pane = setup_chat_pane(conv); | |
4583 } | |
4359 | 4584 |
4585 if (pane == NULL) { | |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4586 if (conv_type == GAIM_CONV_CHAT) g_free(gtkconv->u.chat); |
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4587 else if (conv_type == GAIM_CONV_IM) g_free(gtkconv->u.im); |
4359 | 4588 |
4589 g_free(gtkconv); | |
4590 conv->ui_data = NULL; | |
4591 | |
4592 return; | |
4593 } | |
4594 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4595 /* Setup drag-and-drop */ |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4596 gtk_drag_dest_set(pane, |
9300 | 4597 GTK_DEST_DEFAULT_MOTION | |
4598 GTK_DEST_DEFAULT_DROP, | |
4599 te, sizeof(te) / sizeof(GtkTargetEntry), | |
4600 GDK_ACTION_COPY); | |
4601 gtk_drag_dest_set(pane, | |
4602 GTK_DEST_DEFAULT_MOTION | | |
4603 GTK_DEST_DEFAULT_DROP, | |
4604 te, sizeof(te) / sizeof(GtkTargetEntry), | |
4605 GDK_ACTION_COPY); | |
4606 gtk_drag_dest_set(gtkconv->imhtml, 0, | |
4607 te, sizeof(te) / sizeof(GtkTargetEntry), | |
4608 GDK_ACTION_COPY); | |
4609 | |
4610 gtk_drag_dest_set(gtkconv->entry, 0, | |
4611 te, sizeof(te) / sizeof(GtkTargetEntry), | |
4612 GDK_ACTION_COPY); | |
4613 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4614 g_signal_connect(G_OBJECT(pane), "drag_data_received", |
9300 | 4615 G_CALLBACK(conv_dnd_recv), conv); |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4616 g_signal_connect(G_OBJECT(gtkconv->imhtml), "drag_data_received", |
9300 | 4617 G_CALLBACK(conv_dnd_recv), conv); |
8105 | 4618 g_signal_connect(G_OBJECT(gtkconv->entry), "drag_data_received", |
9300 | 4619 G_CALLBACK(conv_dnd_recv), conv); |
4620 | |
4359 | 4621 /* Setup the container for the tab. */ |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4622 gtkconv->tab_cont = tab_cont = gtk_vbox_new(FALSE, 6); |
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4623 gtk_container_set_border_width(GTK_CONTAINER(tab_cont), 6); |
4359 | 4624 gtk_container_add(GTK_CONTAINER(tab_cont), pane); |
4625 gtk_widget_show(pane); | |
4626 | |
4627 new_ui = TRUE; | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
4628 |
4359 | 4629 gtkconv->make_sound = TRUE; |
5902
6889b89cab90
[gaim-migrate @ 6334]
Christian Hammond <chipx86@chipx86.com>
parents:
5901
diff
changeset
|
4630 |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4631 gtkconv->show_formatting_toolbar = gaim_prefs_get_bool( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4632 "/gaim/gtk/conversations/show_formatting_toolbar"); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4633 |
8329
9dd7c75ed433
[gaim-migrate @ 9053]
Christian Hammond <chipx86@chipx86.com>
parents:
8319
diff
changeset
|
4634 if (gtkconv->show_formatting_toolbar) |
9dd7c75ed433
[gaim-migrate @ 9053]
Christian Hammond <chipx86@chipx86.com>
parents:
8319
diff
changeset
|
4635 gtk_widget_show(gtkconv->toolbar); |
9dd7c75ed433
[gaim-migrate @ 9053]
Christian Hammond <chipx86@chipx86.com>
parents:
8319
diff
changeset
|
4636 |
9188 | 4637 gtkconv->show_timestamps = gaim_prefs_get_bool( |
4638 "/gaim/gtk/conversations/show_timestamps"); | |
4639 | |
4640 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
4641 gtkconv->show_timestamps); | |
4642 | |
8176 | 4643 g_signal_connect_swapped(G_OBJECT(pane), "focus", |
9080 | 4644 G_CALLBACK(gtk_widget_grab_focus), |
4645 gtkconv->entry); | |
4359 | 4646 } |
4647 | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4648 gtkconv->tabby = tabby = gtk_hbox_new(FALSE, 6); |
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4649 gtkconv->menu_tabby = menu_tabby = gtk_hbox_new(FALSE, 6); |
4359 | 4650 |
4651 /* Close button. */ | |
4652 gtkconv->close = gtk_button_new(); | |
4653 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
|
4654 gtk_button_set_relief(GTK_BUTTON(gtkconv->close), GTK_RELIEF_NONE); |
4359 | 4655 gtk_container_add(GTK_CONTAINER(gtkconv->close), |
4445 | 4656 gtk_image_new_from_stock(GTK_STOCK_CLOSE, |
4657 GTK_ICON_SIZE_MENU)); | |
4359 | 4658 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->close, |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4659 _("Close conversation"), NULL); |
4359 | 4660 |
4661 g_signal_connect(G_OBJECT(gtkconv->close), "clicked", | |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4662 G_CALLBACK(close_conv_cb), conv); |
4359 | 4663 |
7446
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4664 /* |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4665 * 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
|
4666 * border bug. I love you guys! -- ChipX86 |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4667 */ |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4668 g_signal_connect(G_OBJECT(gtkconv->close), "state_changed", |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4669 G_CALLBACK(tab_close_button_state_changed_cb), NULL); |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4670 |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4671 /* Status icon. */ |
6440 | 4672 gtkconv->icon = gtk_image_new(); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4673 gtkconv->menu_icon = gtk_image_new(); |
6440 | 4674 update_tab_icon(conv); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4675 |
4359 | 4676 /* Tab label. */ |
4677 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
|
4678 gtkconv->menu_label = gtk_label_new(gaim_conversation_get_title(conv)); |
4359 | 4679 #if 0 |
4680 gtk_misc_set_alignment(GTK_MISC(gtkconv->tab_label), 0.00, 0.5); | |
4681 gtk_misc_set_padding(GTK_MISC(gtkconv->tab_label), 4, 0); | |
4682 #endif | |
4683 | |
4684 /* Pack it all together. */ | |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4685 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
|
4686 gtk_box_pack_start(GTK_BOX(menu_tabby), gtkconv->menu_icon, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4687 FALSE, FALSE, 0); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4688 |
8946 | 4689 gtk_widget_show_all(gtkconv->icon); |
4690 gtk_widget_show_all(gtkconv->menu_icon); | |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4691 |
4359 | 4692 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
|
4693 gtk_box_pack_start(GTK_BOX(menu_tabby), gtkconv->menu_label, TRUE, TRUE, 0); |
4445 | 4694 gtk_widget_show(gtkconv->tab_label); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4695 gtk_widget_show(gtkconv->menu_label); |
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4696 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
|
4697 |
4445 | 4698 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
|
4699 if (gaim_prefs_get_bool("/gaim/gtk/conversations/close_on_tabs")) |
4445 | 4700 gtk_widget_show_all(gtkconv->close); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4701 |
4445 | 4702 gtk_widget_show(tabby); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4703 gtk_widget_show(menu_tabby); |
4359 | 4704 |
7143 | 4705 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
4706 gaim_gtkconv_update_buddy_icon(conv); | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4707 |
9297 | 4708 /* Add this pane to the conversation's notebook. */ |
9606 | 4709 gtk_notebook_append_page_menu(GTK_NOTEBOOK(gtkwin->notebook), tab_cont, tabby, menu_tabby); |
4359 | 4710 |
4711 gtk_widget_show(tab_cont); | |
4712 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4713 if (gaim_conv_window_get_conversation_count(win) == 1) { |
4818 | 4714 /* Er, bug in notebooks? Switch to the page manually. */ |
4359 | 4715 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), 0); |
4851 | 4716 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4717 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4718 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4719 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4720 else |
4818 | 4721 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), TRUE); |
4359 | 4722 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4723 focus_conv = g_list_nth_data(gaim_conv_window_get_conversations(win), |
5204 | 4724 gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook))); |
4725 focus_gtkconv = GAIM_GTK_CONVERSATION(focus_conv); | |
4726 gtk_widget_grab_focus(focus_gtkconv->entry); | |
4359 | 4727 |
4728 if (!new_ui) | |
4729 g_object_unref(gtkconv->tab_cont); | |
4730 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4731 if (gaim_conv_window_get_conversation_count(win) == 1) |
4685 | 4732 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); |
4359 | 4733 } |
4734 | |
4735 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4736 gaim_gtk_remove_conversation(GaimConvWindow *win, GaimConversation *conv) |
4359 | 4737 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4738 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4739 GaimGtkConversation *gtkconv; |
4359 | 4740 unsigned int index; |
4818 | 4741 GaimConversationType conv_type; |
4742 | |
4743 conv_type = gaim_conversation_get_type(conv); | |
4359 | 4744 index = gaim_conversation_get_index(conv); |
4745 | |
4746 gtkwin = GAIM_GTK_WINDOW(win); | |
4747 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4748 | |
4749 g_object_ref(gtkconv->tab_cont); | |
4750 gtk_object_sink(GTK_OBJECT(gtkconv->tab_cont)); | |
4751 | |
4752 gtk_notebook_remove_page(GTK_NOTEBOOK(gtkwin->notebook), index); | |
4753 | |
4818 | 4754 /* go back to tabless if need be */ |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4755 if (gaim_conv_window_get_conversation_count(win) <= 2) { |
4818 | 4756 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4757 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); |
4818 | 4758 } |
4759 | |
4760 | |
4359 | 4761 /* If this window is setup with an inactive gc, regenerate the menu. */ |
4818 | 4762 if (conv_type == GAIM_CONV_IM && |
4359 | 4763 gaim_conversation_get_gc(conv) == NULL) { |
4764 | |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
4765 generate_send_as_items(win, conv); |
4359 | 4766 } |
4767 } | |
4768 | |
4769 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4770 gaim_gtk_move_conversation(GaimConvWindow *win, GaimConversation *conv, |
4359 | 4771 unsigned int new_index) |
4772 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4773 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4774 GaimGtkConversation *gtkconv; |
4359 | 4775 |
4776 gtkwin = GAIM_GTK_WINDOW(win); | |
4777 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4778 | |
4415
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4779 if (new_index > gaim_conversation_get_index(conv)) |
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4780 new_index--; |
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4781 |
4359 | 4782 gtk_notebook_reorder_child(GTK_NOTEBOOK(gtkwin->notebook), |
4783 gtkconv->tab_cont, new_index); | |
4784 } | |
4785 | |
4786 static int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4787 gaim_gtk_get_active_index(const GaimConvWindow *win) |
4359 | 4788 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4789 GaimGtkWindow *gtkwin; |
5680
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4790 int index; |
4359 | 4791 |
4792 gtkwin = GAIM_GTK_WINDOW(win); | |
4793 | |
5680
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4794 index = gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook)); |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4795 |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4796 /* |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4797 * A fix, because the first conversation may be active, but not |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4798 * appear in the notebook just yet. -- ChipX86 |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4799 */ |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4800 return (index == -1 ? 0 : index); |
4359 | 4801 } |
4802 | |
9260
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4803 static gboolean |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4804 gaim_gtk_has_focus(GaimConvWindow *win) |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4805 { |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4806 GaimGtkWindow *gtkwin; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4807 gboolean has_focus = FALSE; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4808 |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4809 gtkwin = GAIM_GTK_WINDOW(win); |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4810 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
|
4811 |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4812 return has_focus; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4813 } |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4814 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4815 static GaimConvWindowUiOps window_ui_ops = |
4359 | 4816 { |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
4817 gaim_gtk_conversations_get_conv_ui_ops, |
4359 | 4818 gaim_gtk_new_window, |
4819 gaim_gtk_destroy_window, | |
4820 gaim_gtk_show, | |
4821 gaim_gtk_hide, | |
4822 gaim_gtk_raise, | |
4823 gaim_gtk_flash, | |
4824 gaim_gtk_switch_conversation, | |
4825 gaim_gtk_add_conversation, | |
4826 gaim_gtk_remove_conversation, | |
4827 gaim_gtk_move_conversation, | |
9260
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4828 gaim_gtk_get_active_index, |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4829 gaim_gtk_has_focus |
4359 | 4830 }; |
4831 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4832 GaimConvWindowUiOps * |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
4833 gaim_gtk_conversations_get_win_ui_ops(void) |
4359 | 4834 { |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4835 return &window_ui_ops; |
4359 | 4836 } |
4837 | |
4838 /************************************************************************** | |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4839 * Conversation UI operations |
4359 | 4840 **************************************************************************/ |
4841 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4842 gaim_gtkconv_destroy(GaimConversation *conv) |
4359 | 4843 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4844 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); |
4359 | 4845 |
9504 | 4846 /* If the "Save Conversation" or "Save Icon" dialogs are open then close them */ |
4847 gaim_request_close_with_handle(conv); | |
4359 | 4848 |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4849 gtk_widget_destroy(gtkconv->tab_cont); |
4892 | 4850 g_object_unref(gtkconv->tab_cont); |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4851 |
4359 | 4852 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
4755 | 4853 if (gtkconv->u.im->icon_timer != 0) |
4854 g_source_remove(gtkconv->u.im->icon_timer); | |
4855 | |
4359 | 4856 if (gtkconv->u.im->anim != NULL) |
4793 | 4857 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); |
4359 | 4858 |
4859 g_free(gtkconv->u.im); | |
4860 } | |
4861 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
4862 g_free(gtkconv->u.chat); | |
4863 } | |
4864 | |
4633 | 4865 gtk_object_sink(GTK_OBJECT(gtkconv->tooltips)); |
4866 | |
4359 | 4867 g_free(gtkconv); |
4868 } | |
4869 | |
4870 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4871 gaim_gtkconv_write_im(GaimConversation *conv, const char *who, |
6982 | 4872 const char *message, GaimMessageFlags flags, |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4873 time_t mtime) |
4359 | 4874 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4875 GaimGtkConversation *gtkconv; |
8630 | 4876 GaimConvWindow *gaimwin; |
4877 GaimGtkWindow *gtkwin; | |
4878 gboolean has_focus; | |
4359 | 4879 |
4880 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
8630 | 4881 gaimwin = gaim_conversation_get_window(conv); |
4882 gtkwin = GAIM_GTK_WINDOW(gaimwin); | |
4883 | |
4884 g_object_get(G_OBJECT(gtkwin->window), "has-toplevel-focus", &has_focus, NULL); | |
4359 | 4885 |
6621 | 4886 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
9301 | 4887 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
|
4888 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4889 gaim_conv_window_raise(gaim_conversation_get_window(conv)); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4890 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4891 |
4382
76223649765b
[gaim-migrate @ 4648]
Christian Hammond <chipx86@chipx86.com>
parents:
4378
diff
changeset
|
4892 /* Play a sound, if specified in prefs. */ |
8630 | 4893 if (gtkconv->make_sound && !((gaim_conv_window_get_active_conversation(gaimwin) == conv) && |
8633 | 4894 !gaim_prefs_get_bool("/gaim/gtk/sound/conv_focus") && has_focus)) { |
6621 | 4895 if (flags & GAIM_MESSAGE_RECV) { |
4359 | 4896 if (gtkconv->u.im->a_virgin && |
5820 | 4897 gaim_prefs_get_bool("/gaim/gtk/sound/enabled/first_im_recv")) { |
4359 | 4898 |
4561 | 4899 gaim_sound_play_event(GAIM_SOUND_FIRST_RECEIVE); |
4359 | 4900 } |
4901 else | |
4561 | 4902 gaim_sound_play_event(GAIM_SOUND_RECEIVE); |
4359 | 4903 } |
4904 else { | |
4561 | 4905 gaim_sound_play_event(GAIM_SOUND_SEND); |
4359 | 4906 } |
4907 } | |
4908 | |
4909 gtkconv->u.im->a_virgin = FALSE; | |
4910 | |
6982 | 4911 gaim_conversation_write(conv, who, message, flags, mtime); |
4359 | 4912 } |
4913 | |
4914 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4915 gaim_gtkconv_write_chat(GaimConversation *conv, const char *who, |
6621 | 4916 const char *message, GaimMessageFlags flags, time_t mtime) |
4359 | 4917 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4918 GaimGtkConversation *gtkconv; |
8630 | 4919 GaimConvWindow *gaimwin; |
4920 GaimGtkWindow *gtkwin; | |
4921 gboolean has_focus; | |
4359 | 4922 |
4923 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
8630 | 4924 gaimwin = gaim_conversation_get_window(conv); |
4925 gtkwin = GAIM_GTK_WINDOW(gaimwin); | |
4926 | |
4927 g_object_get(G_OBJECT(gtkwin->window), "has-toplevel-focus", &has_focus, NULL); | |
4359 | 4928 |
4382
76223649765b
[gaim-migrate @ 4648]
Christian Hammond <chipx86@chipx86.com>
parents:
4378
diff
changeset
|
4929 /* Play a sound, if specified in prefs. */ |
8630 | 4930 if (gtkconv->make_sound && !((gaim_conv_window_get_active_conversation(gaimwin) == conv) && |
9704 | 4931 !gaim_prefs_get_bool("/gaim/gtk/sound/conv_focus") && has_focus) && |
4932 !(flags & GAIM_MESSAGE_DELAYED) && | |
4933 !(flags & GAIM_MESSAGE_SYSTEM)) { | |
4934 | |
6621 | 4935 if (!(flags & GAIM_MESSAGE_WHISPER) && (flags & GAIM_MESSAGE_SEND)) |
4561 | 4936 gaim_sound_play_event(GAIM_SOUND_CHAT_YOU_SAY); |
9704 | 4937 else if (flags & GAIM_MESSAGE_RECV) { |
6621 | 4938 if ((flags & GAIM_MESSAGE_NICK) && |
9584 | 4939 gaim_prefs_get_bool("/gaim/gtk/sound/enabled/nick_said")) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4940 |
4561 | 4941 gaim_sound_play_event(GAIM_SOUND_CHAT_NICK); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4942 } |
4359 | 4943 else |
4561 | 4944 gaim_sound_play_event(GAIM_SOUND_CHAT_SAY); |
4359 | 4945 } |
4946 } | |
4947 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4948 if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/color_nicks")) |
6621 | 4949 flags |= GAIM_MESSAGE_COLORIZE; |
4359 | 4950 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4951 /* Raise the window, if specified in prefs. */ |
6621 | 4952 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
9150 | 4953 /* we may want to change this */ |
9301 | 4954 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
|
4955 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4956 gaim_conv_window_raise(gaim_conversation_get_window(conv)); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4957 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4958 |
6982 | 4959 gaim_conversation_write(conv, who, message, flags, mtime); |
4359 | 4960 } |
4961 | |
4962 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4963 gaim_gtkconv_write_conv(GaimConversation *conv, const char *who, |
6982 | 4964 const char *message, GaimMessageFlags flags, |
4359 | 4965 time_t mtime) |
4966 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4967 GaimGtkConversation *gtkconv; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4968 GaimConvWindow *win; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
4969 GaimConnection *gc; |
4359 | 4970 int gtk_font_options = 0; |
7440 | 4971 char buf[BUF_LONG]; |
4359 | 4972 char buf2[BUF_LONG]; |
4973 char mdate[64]; | |
4974 char color[10]; | |
4975 char *str; | |
4976 char *with_font_tag; | |
4896 | 4977 char *sml_attrib = NULL; |
6982 | 4978 size_t length = strlen(message) + 1; |
4895 | 4979 |
4359 | 4980 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4981 gc = gaim_conversation_get_gc(conv); | |
4982 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4983 win = gaim_conversation_get_window(conv); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4984 |
9301 | 4985 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
4986 ((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT && | |
4987 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) || | |
4988 (gaim_conversation_get_type(conv) == GAIM_CONV_IM && | |
4989 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
|
4990 gaim_conv_window_show(win); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4991 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4992 |
8677 | 4993 if (gtk_text_buffer_get_char_count(gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)))) |
4994 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", 0); | |
4995 | |
5133 | 4996 if(time(NULL) > mtime + 20*60) /* show date if older than 20 minutes */ |
4997 strftime(mdate, sizeof(mdate), "%Y-%m-%d %H:%M:%S", localtime(&mtime)); | |
4998 else | |
4999 strftime(mdate, sizeof(mdate), "%H:%M:%S", localtime(&mtime)); | |
4359 | 5000 |
4896 | 5001 if(gc) |
9699 | 5002 sml_attrib = g_strdup_printf("sml=\"%s\"", |
5003 gaim_account_get_protocol_name(conv->account)); | |
7440 | 5004 |
4359 | 5005 gtk_font_options ^= GTK_IMHTML_NO_COMMENTS; |
5006 | |
9049 | 5007 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_colors")) |
5008 gtk_font_options ^= GTK_IMHTML_NO_COLOURS; | |
5009 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_fonts")) | |
5010 gtk_font_options ^= GTK_IMHTML_NO_FONTS; | |
5011 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_font_sizes")) | |
5012 gtk_font_options ^= GTK_IMHTML_NO_SIZES; | |
4359 | 5013 |
7956 | 5014 /* this is gonna crash one day, I can feel it. */ |
5015 if (GAIM_PLUGIN_PROTOCOL_INFO(gaim_find_prpl(gaim_account_get_protocol_id(conv->account)))->options & | |
7431 | 5016 OPT_PROTO_USE_POINTSIZE) { |
5367 | 5017 gtk_font_options ^= GTK_IMHTML_USE_POINTSIZE; |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5018 } |
4359 | 5019 |
6621 | 5020 if (flags & GAIM_MESSAGE_SYSTEM) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5021 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) |
8380 | 5022 g_snprintf(buf, BUF_LONG, "<FONT SIZE=\"2\">(%s)</FONT> <B>%s</B>", |
7431 | 5023 mdate, message); |
4359 | 5024 else |
5025 g_snprintf(buf, BUF_LONG, "<B>%s</B>", message); | |
7440 | 5026 |
4359 | 5027 g_snprintf(buf2, sizeof(buf2), |
8690 | 5028 "<FONT %s><FONT SIZE=\"2\"><!--(%s) --></FONT><B>%s</B></FONT>", |
7850 | 5029 sml_attrib, mdate, message); |
7440 | 5030 |
8962 | 5031 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, 0); |
7440 | 5032 |
7583 | 5033 /* Add the message to a conversations scrollback buffer */ |
5034 conv->history = g_string_append(conv->history, buf); | |
5035 conv->history = g_string_append(conv->history, "<BR>\n"); | |
7440 | 5036 |
8722 | 5037 } else if (flags & GAIM_MESSAGE_ERROR) { |
5038 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) | |
9627 | 5039 g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"#ff0000\"><FONT SIZE=\"2\">(%s)</FONT> <B>%s</B></FONT>", |
8722 | 5040 mdate, message); |
5041 else | |
5042 g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"#ff0000\"><B>%s</B></FONT>", message); | |
9554 | 5043 |
8722 | 5044 g_snprintf(buf2, sizeof(buf2), |
9627 | 5045 "<FONT COLOR=\"#ff0000\"><FONT %s><FONT SIZE=\"2\"><!--(%s) --></FONT><B>%s</B></FONT></FONT>", |
8722 | 5046 sml_attrib, mdate, message); |
9554 | 5047 |
8962 | 5048 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, 0); |
5049 | |
8722 | 5050 /* Add the message to a conversations scrollback buffer */ |
5051 conv->history = g_string_append(conv->history, buf); | |
5052 conv->history = g_string_append(conv->history, "<BR>\n"); | |
7431 | 5053 } else if (flags & GAIM_MESSAGE_NO_LOG) { |
4359 | 5054 g_snprintf(buf, BUF_LONG, |
8690 | 5055 "<B><FONT %s COLOR=\"#777777\">%s</FONT></B>", |
7850 | 5056 sml_attrib, message); |
7440 | 5057 |
8962 | 5058 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf, 0); |
4359 | 5059 } |
5060 else { | |
4895 | 5061 char *new_message = g_memdup(message, length); |
9613 | 5062 char *who_escaped = (who ? g_markup_escape_text(who, strlen(who)) : g_strdup("")); |
7440 | 5063 |
6621 | 5064 if (flags & GAIM_MESSAGE_WHISPER) { |
4359 | 5065 str = g_malloc(1024); |
7440 | 5066 |
4359 | 5067 /* If we're whispering, it's not an autoresponse. */ |
7564 | 5068 if (gaim_message_meify(new_message, length)) { |
8908 | 5069 g_snprintf(str, 1024, "***%s", who_escaped); |
4359 | 5070 strcpy(color, "#6C2585"); |
5071 } | |
5072 else { | |
8908 | 5073 g_snprintf(str, 1024, "*%s*:", who_escaped); |
4359 | 5074 strcpy(color, "#00FF00"); |
5075 } | |
7440 | 5076 } |
4359 | 5077 else { |
7564 | 5078 if (gaim_message_meify(new_message, length)) { |
4359 | 5079 str = g_malloc(1024); |
7440 | 5080 |
6621 | 5081 if (flags & GAIM_MESSAGE_AUTO_RESP) |
8908 | 5082 g_snprintf(str, 1024, "%s ***%s", AUTO_RESPONSE, who_escaped); |
4359 | 5083 else |
8908 | 5084 g_snprintf(str, 1024, "***%s", who_escaped); |
7440 | 5085 |
6621 | 5086 if (flags & GAIM_MESSAGE_NICK) |
4359 | 5087 strcpy(color, "#AF7F00"); |
5088 else | |
5089 strcpy(color, "#062585"); | |
5090 } | |
5091 else { | |
5092 str = g_malloc(1024); | |
6621 | 5093 if (flags & GAIM_MESSAGE_AUTO_RESP) |
8908 | 5094 g_snprintf(str, 1024, "%s %s", who_escaped, AUTO_RESPONSE); |
4359 | 5095 else |
8908 | 5096 g_snprintf(str, 1024, "%s:", who_escaped); |
6621 | 5097 if (flags & GAIM_MESSAGE_NICK) |
4359 | 5098 strcpy(color, "#AF7F00"); |
6621 | 5099 else if (flags & GAIM_MESSAGE_RECV) { |
5100 if (flags & GAIM_MESSAGE_COLORIZE) { | |
4359 | 5101 const char *u; |
5102 int m = 0; | |
7440 | 5103 |
4359 | 5104 for (u = who; *u != '\0'; u++) |
5105 m += *u; | |
7440 | 5106 |
4359 | 5107 m = m % NUM_NICK_COLORS; |
7440 | 5108 |
4359 | 5109 strcpy(color, nick_colors[m]); |
5110 } | |
5111 else | |
7854 | 5112 strcpy(color, RECV_COLOR); |
4359 | 5113 } |
6621 | 5114 else if (flags & GAIM_MESSAGE_SEND) |
7854 | 5115 strcpy(color, SEND_COLOR); |
4359 | 5116 } |
8908 | 5117 |
5118 if(who_escaped) | |
5119 g_free(who_escaped); | |
4359 | 5120 } |
7440 | 5121 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5122 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) |
4359 | 5123 g_snprintf(buf, BUF_LONG, |
8380 | 5124 "<FONT COLOR=\"%s\" %s><FONT SIZE=\"2\">(%s)</FONT> " |
7431 | 5125 "<B>%s</B></FONT> ", color, |
5126 sml_attrib ? sml_attrib : "", mdate, str); | |
4359 | 5127 else |
5128 g_snprintf(buf, BUF_LONG, | |
7431 | 5129 "<FONT COLOR=\"%s\" %s><B>%s</B></FONT> ", color, |
5130 sml_attrib ? sml_attrib : "", str); | |
7440 | 5131 |
4359 | 5132 g_snprintf(buf2, BUF_LONG, |
8380 | 5133 "<FONT COLOR=\"%s\" %s><FONT SIZE=\"2\"><!--(%s) --></FONT>" |
7431 | 5134 "<B>%s</B></FONT> ", |
5135 color, sml_attrib ? sml_attrib : "", mdate, str); | |
7440 | 5136 |
4359 | 5137 g_free(str); |
5138 | |
8962 | 5139 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), |
5140 buf2, 0); | |
4359 | 5141 |
4895 | 5142 if(gc){ |
4896 | 5143 char *pre = g_strdup_printf("<font %s>", sml_attrib ? sml_attrib : ""); |
4895 | 5144 char *post = "</font>"; |
5145 int pre_len = strlen(pre); | |
5146 int post_len = strlen(post); | |
7440 | 5147 |
4895 | 5148 with_font_tag = g_malloc(length + pre_len + post_len + 1); |
7440 | 5149 |
4895 | 5150 strcpy(with_font_tag, pre); |
5151 memcpy(with_font_tag + pre_len, new_message, length); | |
5152 strcpy(with_font_tag + pre_len + length, post); | |
7440 | 5153 |
4895 | 5154 length += pre_len + post_len; |
5155 g_free(pre); | |
5156 } | |
4608 | 5157 else |
4895 | 5158 with_font_tag = g_memdup(new_message, length); |
7440 | 5159 |
8962 | 5160 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), |
5161 with_font_tag, gtk_font_options); | |
7440 | 5162 |
8557 | 5163 conv->history = g_string_append(conv->history, buf); |
5164 conv->history = g_string_append(conv->history, new_message); | |
5165 conv->history = g_string_append(conv->history, "<BR>\n"); | |
7440 | 5166 |
5167 g_free(with_font_tag); | |
7447 | 5168 g_free(new_message); |
7440 | 5169 } |
5170 | |
6062 | 5171 |
5012 | 5172 if(sml_attrib) |
5173 g_free(sml_attrib); | |
4359 | 5174 } |
5175 | |
5176 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5177 gaim_gtkconv_chat_add_user(GaimConversation *conv, const char *user) |
4359 | 5178 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5179 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5180 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5181 GaimGtkChatPane *gtkchat; |
4359 | 5182 char tmp[BUF_LONG]; |
5183 int num_users; | |
5184 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5185 chat = GAIM_CONV_CHAT(conv); |
4359 | 5186 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5187 gtkchat = gtkconv->u.chat; | |
5188 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5189 num_users = g_list_length(gaim_conv_chat_get_users(chat)); |
4359 | 5190 |
5191 g_snprintf(tmp, sizeof(tmp), | |
5192 ngettext("%d person in room", "%d people in room", | |
5193 num_users), | |
5194 num_users); | |
5195 | |
5196 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); | |
5197 | |
5198 if (gtkconv->make_sound) | |
4561 | 5199 gaim_sound_play_event(GAIM_SOUND_CHAT_JOIN); |
4359 | 5200 |
9554 | 5201 add_chat_buddy_common(conv, user); |
4359 | 5202 } |
5203 | |
5204 static void | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5205 gaim_gtkconv_chat_add_users(GaimConversation *conv, GList *users) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5206 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5207 GaimConvChat *chat; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5208 GaimGtkConversation *gtkconv; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5209 GaimGtkChatPane *gtkchat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5210 GList *l; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5211 char tmp[BUF_LONG]; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5212 int num_users; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5213 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5214 chat = GAIM_CONV_CHAT(conv); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5215 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5216 gtkchat = gtkconv->u.chat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5217 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5218 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
|
5219 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5220 g_snprintf(tmp, sizeof(tmp), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5221 ngettext("%d person in room", "%d people in room", |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5222 num_users), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5223 num_users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5224 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5225 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5226 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5227 for (l = users; l != NULL; l = l->next) { |
9554 | 5228 add_chat_buddy_common(conv, (char *)l->data); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5229 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5230 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5231 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5232 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5233 gaim_gtkconv_chat_rename_user(GaimConversation *conv, const char *old_name, |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5234 const char *new_name) |
4359 | 5235 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5236 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5237 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5238 GaimGtkChatPane *gtkchat; |
4359 | 5239 GtkTreeIter iter; |
5240 GtkTreeModel *model; | |
5241 int f = 1; | |
5242 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5243 chat = GAIM_CONV_CHAT(conv); |
4359 | 5244 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5245 gtkchat = gtkconv->u.chat; | |
5246 | |
9554 | 5247 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
5248 | |
5249 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
5250 return; | |
5251 | |
5252 while (f != 0) { | |
5253 char *val; | |
5254 | |
5255 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &val, -1); | |
5256 | |
5257 if (!gaim_utf8_strcasecmp(old_name, val)) { | |
5258 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); | |
5259 g_free(val); | |
4359 | 5260 break; |
5261 } | |
9554 | 5262 |
5263 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
5264 | |
5265 g_free(val); | |
4359 | 5266 } |
5267 | |
9554 | 5268 if (!gaim_conv_chat_find_user(chat, old_name)) |
4359 | 5269 return; |
5270 | |
9554 | 5271 add_chat_buddy_common(conv, new_name); |
4359 | 5272 } |
5273 | |
5274 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5275 gaim_gtkconv_chat_remove_user(GaimConversation *conv, const char *user) |
4359 | 5276 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5277 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5278 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5279 GaimGtkChatPane *gtkchat; |
4359 | 5280 GtkTreeIter iter; |
5281 GtkTreeModel *model; | |
5282 char tmp[BUF_LONG]; | |
5283 int num_users; | |
5284 int f = 1; | |
5285 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5286 chat = GAIM_CONV_CHAT(conv); |
4359 | 5287 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5288 gtkchat = gtkconv->u.chat; | |
5289 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5290 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
|
5291 |
9554 | 5292 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
5293 | |
5294 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
5295 return; | |
5296 | |
5297 while (f != 0) { | |
5298 char *val; | |
5299 | |
5300 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &val, -1); | |
5301 | |
5302 if (!gaim_utf8_strcasecmp(user, val)) { | |
5303 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); | |
5304 g_free(val); | |
4359 | 5305 break; |
5306 } | |
9554 | 5307 |
5308 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
5309 | |
5310 g_free(val); | |
4359 | 5311 } |
5312 | |
9554 | 5313 if (!gaim_conv_chat_find_user(chat, user)) |
4359 | 5314 return; |
5315 | |
5316 g_snprintf(tmp, sizeof(tmp), | |
9554 | 5317 ngettext("%d person in room", "%d people in room", |
5318 num_users), num_users); | |
4359 | 5319 |
5320 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); | |
5321 | |
5322 if (gtkconv->make_sound) | |
4561 | 5323 gaim_sound_play_event(GAIM_SOUND_CHAT_LEAVE); |
4359 | 5324 } |
5325 | |
5326 static void | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5327 gaim_gtkconv_chat_remove_users(GaimConversation *conv, GList *users) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5328 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5329 GaimConvChat *chat; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5330 GaimGtkConversation *gtkconv; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5331 GaimGtkChatPane *gtkchat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5332 GtkTreeIter iter; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5333 GtkTreeModel *model; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5334 GList *l; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5335 char tmp[BUF_LONG]; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5336 int num_users; |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
5337 gboolean f; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5338 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5339 chat = GAIM_CONV_CHAT(conv); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5340 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5341 gtkchat = gtkconv->u.chat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5342 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5343 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
|
5344 g_list_length(users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5345 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5346 for (l = users; l != NULL; l = l->next) { |
9554 | 5347 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
5348 | |
5349 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), | |
5350 &iter)) | |
5351 continue; | |
5352 | |
5353 do { | |
5354 char *val; | |
5355 | |
5356 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, | |
5357 CHAT_USERS_NAME_COLUMN, &val, -1); | |
5358 | |
9696 | 5359 if (!gaim_utf8_strcasecmp((char *)l->data, val)) { |
5360 #if GTK_CHECK_VERSION(2,2,0) | |
9554 | 5361 f = gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
9696 | 5362 #else |
5363 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); | |
5364 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
5365 #endif | |
5366 } | |
9554 | 5367 else |
5368 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
5369 | |
5370 g_free(val); | |
5371 } while (f); | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5372 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5373 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5374 g_snprintf(tmp, sizeof(tmp), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5375 ngettext("%d person in room", "%d people in room", |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5376 num_users), num_users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5377 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5378 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5379 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5380 |
9554 | 5381 static void |
5382 gaim_gtkconv_chat_update_user(GaimConversation *conv, const char *user) | |
5383 { | |
5384 GaimConvChat *chat; | |
5385 GaimGtkConversation *gtkconv; | |
5386 GaimGtkChatPane *gtkchat; | |
5387 GtkTreeIter iter; | |
5388 GtkTreeModel *model; | |
5389 int f = 1; | |
5390 | |
5391 chat = GAIM_CONV_CHAT(conv); | |
5392 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5393 gtkchat = gtkconv->u.chat; | |
5394 | |
5395 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | |
5396 | |
5397 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
5398 return; | |
5399 | |
5400 while (f != 0) { | |
5401 char *val; | |
5402 | |
5403 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &val, -1); | |
5404 | |
5405 if (!gaim_utf8_strcasecmp(user, val)) { | |
5406 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); | |
5407 g_free(val); | |
5408 break; | |
5409 } | |
5410 | |
5411 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
5412 | |
5413 g_free(val); | |
5414 } | |
5415 | |
5416 if (!gaim_conv_chat_find_user(chat, user)) | |
5417 return; | |
5418 | |
5419 add_chat_buddy_common(conv, user); | |
5420 } | |
5421 | |
9260
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5422 static gboolean |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5423 gaim_gtkconv_has_focus(GaimConversation *conv) |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5424 { |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5425 GaimConvWindow *win; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5426 GaimGtkWindow *gtkwin; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5427 gboolean has_focus; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5428 |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5429 win = gaim_conversation_get_window(conv); |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5430 gtkwin = GAIM_GTK_WINDOW(win); |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5431 |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5432 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
|
5433 |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5434 return has_focus; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5435 } |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5436 |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5437 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5438 gaim_gtkconv_updated(GaimConversation *conv, GaimConvUpdateType type) |
4359 | 5439 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5440 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5441 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5442 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5443 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5444 GaimConvChat *chat; |
4359 | 5445 |
5446 win = gaim_conversation_get_window(conv); | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5447 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 5448 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5449 | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5450 if (type == GAIM_CONV_UPDATE_ACCOUNT) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5451 { |
4359 | 5452 gaim_conversation_autoset_title(conv); |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5453 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5454 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5455 gaim_gtkconv_update_buddy_icon(conv); |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5456 |
4359 | 5457 gaim_gtkconv_update_buttons_by_protocol(conv); |
5458 | |
4685 | 5459 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); |
4359 | 5460 |
5461 smiley_themeize(gtkconv->imhtml); | |
6394 | 5462 |
6395 | 5463 update_tab_icon(conv); |
4359 | 5464 } |
5465 else if (type == GAIM_CONV_UPDATE_TYPING || | |
8155
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5466 type == GAIM_CONV_UPDATE_UNSEEN || |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5467 type == GAIM_CONV_UPDATE_TITLE) |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5468 { |
9472 | 5469 char *title; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5470 GaimConvIm *im = NULL; |
9472 | 5471 GaimConnection *gc = gaim_conversation_get_gc(conv); |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5472 char color[8]; |
4736 | 5473 |
4359 | 5474 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5475 im = GAIM_CONV_IM(conv); |
4359 | 5476 |
9472 | 5477 if (!gc || ((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) |
5478 && gaim_conv_chat_has_left(GAIM_CONV_CHAT(conv)))) | |
5479 title = g_strdup_printf("(%s)", gaim_conversation_get_title(conv)); | |
5480 | |
5481 else | |
5482 title = g_strdup(gaim_conversation_get_title(conv)); | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5483 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5484 *color = '\0'; |
4359 | 5485 |
5486 if (!GTK_WIDGET_REALIZED(gtkconv->tab_label)) | |
5487 gtk_widget_realize(gtkconv->tab_label); | |
5488 | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5489 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
|
5490 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5491 strcpy(color, "#47A046"); |
4359 | 5492 } |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5493 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
|
5494 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5495 strcpy(color, "#D1940C"); |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5496 } |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5497 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_NICK) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5498 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5499 strcpy(color, "#314E6C"); |
4359 | 5500 } |
8252 | 5501 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_TEXT) |
5502 { | |
5503 strcpy(color, "#DF421E"); | |
5504 } | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5505 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_EVENT) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5506 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5507 strcpy(color, "#868272"); |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5508 } |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5509 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5510 if (*color != '\0') |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5511 { |
8536 | 5512 char *html_title,*label; |
5513 | |
5514 html_title = gaim_escape_html(title); | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5515 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5516 label = g_strdup_printf("<span color=\"%s\">%s</span>", |
8536 | 5517 color, html_title); |
5518 g_free(html_title); | |
7995
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
5519 gtk_label_set_markup(GTK_LABEL(gtkconv->tab_label), label); |
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
5520 g_free(label); |
4359 | 5521 } |
7995
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
5522 else |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5523 gtk_label_set_text(GTK_LABEL(gtkconv->tab_label), title); |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5524 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5525 if (conv == gaim_conv_window_get_active_conversation(win)) |
4736 | 5526 update_typing_icon(conv); |
8155
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5527 |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5528 if (type == GAIM_CONV_UPDATE_TITLE) { |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5529 gtk_label_set_text(GTK_LABEL(gtkconv->menu_label), title); |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5530 if (conv == gaim_conv_window_get_active_conversation(win)) |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5531 gtk_window_set_title(GTK_WINDOW(gtkwin->window), title); |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5532 } |
9472 | 5533 |
5534 g_free(title); | |
4359 | 5535 } |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5536 else if (type == GAIM_CONV_UPDATE_TOPIC) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5537 { |
7154 | 5538 const char *topic; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5539 chat = GAIM_CONV_CHAT(conv); |
4359 | 5540 gtkchat = gtkconv->u.chat; |
5541 | |
7154 | 5542 topic = gaim_conv_chat_get_topic(chat); |
5543 | |
9554 | 5544 gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), topic ? topic : ""); |
7154 | 5545 gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->topic_text, |
9554 | 5546 topic ? topic : "", NULL); |
4359 | 5547 } |
5548 else if (type == GAIM_CONV_ACCOUNT_ONLINE || | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5549 type == GAIM_CONV_ACCOUNT_OFFLINE) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5550 { |
7929 | 5551 gray_stuff_out(gaim_conv_window_get_active_conversation(win)); |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
5552 generate_send_as_items(win, NULL); |
8946 | 5553 update_tab_icon(conv); |
9472 | 5554 gaim_conversation_autoset_title(conv); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5555 } |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5556 else if (type == GAIM_CONV_UPDATE_AWAY) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5557 { |
8946 | 5558 update_tab_icon(conv); |
4359 | 5559 } |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
5560 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
|
5561 type == GAIM_CONV_UPDATE_CHATLEFT) |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5562 { |
9472 | 5563 gaim_conversation_autoset_title(conv); |
7929 | 5564 gray_stuff_out(conv); |
4397
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
5565 } |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5566 else if (type == GAIM_CONV_UPDATE_ICON) |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5567 { |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5568 gaim_gtkconv_update_buddy_icon(conv); |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5569 } |
4359 | 5570 } |
5571 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5572 static GaimConversationUiOps conversation_ui_ops = |
4359 | 5573 { |
5574 gaim_gtkconv_destroy, /* destroy_conversation */ | |
5575 gaim_gtkconv_write_chat, /* write_chat */ | |
5576 gaim_gtkconv_write_im, /* write_im */ | |
5577 gaim_gtkconv_write_conv, /* write_conv */ | |
5578 gaim_gtkconv_chat_add_user, /* chat_add_user */ | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5579 gaim_gtkconv_chat_add_users, /* chat_add_users */ |
4359 | 5580 gaim_gtkconv_chat_rename_user, /* chat_rename_user */ |
5581 gaim_gtkconv_chat_remove_user, /* chat_remove_user */ | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5582 gaim_gtkconv_chat_remove_users, /* chat_remove_users */ |
9554 | 5583 gaim_gtkconv_chat_update_user, /* chat_update_user */ |
4359 | 5584 NULL, /* update_progress */ |
9260
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5585 gaim_gtkconv_has_focus, /* has_focus */ |
4359 | 5586 gaim_gtkconv_updated /* updated */ |
5587 }; | |
5588 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5589 GaimConversationUiOps * |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
5590 gaim_gtk_conversations_get_conv_ui_ops(void) |
4359 | 5591 { |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
5592 return &conversation_ui_ops; |
4359 | 5593 } |
5594 | |
5595 /************************************************************************** | |
5596 * Public conversation utility functions | |
5597 **************************************************************************/ | |
5598 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5599 gaim_gtkconv_update_buddy_icon(GaimConversation *conv) |
4359 | 5600 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5601 GaimGtkConversation *gtkconv; |
7143 | 5602 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); |
4359 | 5603 |
5604 char filename[256]; | |
5605 FILE *file; | |
5606 GError *err = NULL; | |
5607 | |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5608 const void *data; |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5609 size_t len; |
4359 | 5610 |
5611 GdkPixbuf *buf; | |
5612 | |
8821 | 5613 GtkWidget *vbox; |
4359 | 5614 GtkWidget *event; |
5615 GtkWidget *frame; | |
5616 GdkPixbuf *scale; | |
5617 GdkPixmap *pm; | |
5618 GdkBitmap *bm; | |
9318 | 5619 int scale_width, scale_height; |
9332 | 5620 GtkRequisition requisition; |
9318 | 5621 |
5622 GaimAccount *account; | |
5623 GaimPluginProtocolInfo *prpl_info = NULL; | |
4359 | 5624 |
8821 | 5625 GaimButtonStyle button_type; |
5626 | |
9324 | 5627 GaimBuddyIcon *icon; |
5628 | |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5629 g_return_if_fail(conv != NULL); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5630 g_return_if_fail(GAIM_IS_GTK_CONVERSATION(conv)); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5631 g_return_if_fail(gaim_conversation_get_type(conv) == GAIM_CONV_IM); |
4359 | 5632 |
5633 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
9687 | 5634 |
5635 if (!gtkconv->u.im->show_icon) | |
5636 return; | |
5637 | |
9318 | 5638 account = gaim_conversation_get_account(conv); |
5639 if(account && account->gc) | |
5640 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl); | |
4359 | 5641 |
5642 remove_icon(gtkconv); | |
5643 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5644 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/im/show_buddy_icons")) |
4359 | 5645 return; |
5646 | |
5647 if (gaim_conversation_get_gc(conv) == NULL) | |
5648 return; | |
5649 | |
8189 | 5650 if (gtkconv->u.im->anim) |
4793 | 5651 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); |
5652 | |
9324 | 5653 |
5654 | |
5655 icon = gaim_conv_im_get_icon(GAIM_CONV_IM(conv)); | |
5656 | |
5657 if (icon == NULL) | |
5658 return; | |
5659 | |
5660 data = gaim_buddy_icon_get_data(icon, &len); | |
5661 | |
5662 /* this is such an evil hack, i don't know why i'm even considering it. | |
5663 * we'll do it differently when gdk-pixbuf-loader isn't leaky anymore. */ | |
5664 /* gdk-pixbuf-loader was leaky? is it still? */ | |
5665 g_snprintf(filename, sizeof(filename), | |
5666 "%s" G_DIR_SEPARATOR_S "gaimicon-%s.%d", | |
5667 g_get_tmp_dir(), gaim_conversation_get_name(conv), getpid()); | |
5668 | |
5669 if (!(file = fopen(filename, "wb"))) | |
5670 return; | |
5671 | |
5672 fwrite(data, 1, len, file); | |
5673 fclose(file); | |
5674 | |
5675 gtkconv->u.im->anim = gdk_pixbuf_animation_new_from_file(filename, &err); | |
5676 /* make sure we remove the file as soon as possible */ | |
5677 unlink(filename); | |
5678 | |
4359 | 5679 |
5680 if (err) { | |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5681 gaim_debug(GAIM_DEBUG_ERROR, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5682 "Buddy icon error: %s\n", err->message); |
4359 | 5683 g_error_free(err); |
5684 } | |
5685 | |
5686 if (!gtkconv->u.im->anim) | |
5687 return; | |
5688 | |
4793 | 5689 if(gtkconv->u.im->iter) |
5690 g_object_unref(G_OBJECT(gtkconv->u.im->iter)); | |
5691 | |
4359 | 5692 if (gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim)) { |
5693 gtkconv->u.im->iter = NULL; | |
5694 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); | |
5695 } else { | |
5696 gtkconv->u.im->iter = | |
8496 | 5697 gdk_pixbuf_animation_get_iter(gtkconv->u.im->anim, NULL); /* LEAK */ |
4359 | 5698 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); |
8189 | 5699 if (gtkconv->u.im->animate) |
5700 start_anim(NULL, conv); | |
4359 | 5701 } |
5702 | |
9318 | 5703 get_icon_scale_size(gtkconv->u.im->anim, prpl_info ? &prpl_info->icon_spec : |
5704 NULL, &scale_width, &scale_height); | |
4359 | 5705 scale = gdk_pixbuf_scale_simple(buf, |
9318 | 5706 MAX(gdk_pixbuf_get_width(buf) * scale_width / |
4359 | 5707 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), |
9318 | 5708 MAX(gdk_pixbuf_get_height(buf) * scale_height / |
4359 | 5709 gdk_pixbuf_animation_get_height(gtkconv->u.im->anim), 1), |
5710 GDK_INTERP_NEAREST); | |
5711 | |
5712 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); | |
4793 | 5713 g_object_unref(G_OBJECT(scale)); |
4359 | 5714 |
8821 | 5715 |
5716 vbox = gtk_vbox_new(FALSE, 0); | |
5717 | |
4359 | 5718 frame = gtk_frame_new(NULL); |
5719 gtk_frame_set_shadow_type(GTK_FRAME(frame), | |
5720 (bm ? GTK_SHADOW_NONE : GTK_SHADOW_IN)); | |
8821 | 5721 gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); |
5722 | |
4359 | 5723 event = gtk_event_box_new(); |
5724 gtk_container_add(GTK_CONTAINER(frame), event); | |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
5725 g_signal_connect(G_OBJECT(event), "button-press-event", |
4359 | 5726 G_CALLBACK(icon_menu), conv); |
5727 gtk_widget_show(event); | |
5728 | |
4635 | 5729 gtkconv->u.im->icon = gtk_image_new_from_pixmap(pm, bm); |
9318 | 5730 gtk_widget_set_size_request(gtkconv->u.im->icon, scale_width, scale_height); |
4359 | 5731 gtk_container_add(GTK_CONTAINER(event), gtkconv->u.im->icon); |
5732 gtk_widget_show(gtkconv->u.im->icon); | |
5733 | |
4793 | 5734 g_object_unref(G_OBJECT(pm)); |
4359 | 5735 |
5736 if (bm) | |
4793 | 5737 g_object_unref(G_OBJECT(bm)); |
7143 | 5738 |
9332 | 5739 button_type = gaim_prefs_get_int("/gaim/gtk/conversations/button_type"); |
5740 gtk_widget_size_request(gtkconv->bbox, &requisition); | |
9683 | 5741 if (button_type == GAIM_BUTTON_NONE || requisition.height * 1.5 < scale_height) { |
9332 | 5742 gtk_box_pack_start(GTK_BOX(gtkconv->lower_hbox), vbox, FALSE, FALSE, 0); |
5743 /* gtk_box_reorder_child(GTK_BOX(gtkconv->lower_hbox), vbox, 0); */ | |
5744 } else { | |
5745 gtk_box_pack_start(GTK_BOX(gtkconv->bbox), vbox, FALSE, FALSE, 0); | |
5746 gtk_box_reorder_child(GTK_BOX(gtkconv->bbox), vbox, 0); | |
5747 } | |
5748 | |
5749 gtk_widget_show(vbox); | |
5750 gtk_widget_show(frame); | |
5751 | |
7143 | 5752 /* The buddy icon code needs badly to be fixed. */ |
5753 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); | |
8068 | 5754 if(conv == gaim_conv_window_get_active_conversation(gaim_conversation_get_window(conv))) |
5755 gtk_window_set_icon(GTK_WINDOW(gtkwin->window), buf); | |
4359 | 5756 } |
5757 | |
5758 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5759 gaim_gtkconv_update_buttons_by_protocol(GaimConversation *conv) |
4359 | 5760 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5761 GaimConvWindow *win; |
4359 | 5762 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5763 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
4359 | 5764 return; |
5765 | |
7887 | 5766 win = gaim_conversation_get_window(conv); |
5767 | |
5768 if (win != NULL && gaim_conv_window_get_active_conversation(win) == conv) | |
5769 gray_stuff_out(conv); | |
4359 | 5770 } |
5771 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5772 GaimConvWindow * |
4359 | 5773 gaim_gtkwin_get_at_xy(int x, int y) |
5774 { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5775 GaimConvWindow *win = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5776 GaimGtkWindow *gtkwin; |
4359 | 5777 GdkWindow *gdkwin; |
5778 GList *l; | |
5779 | |
5780 gdkwin = gdk_window_at_pointer(&x, &y); | |
5781 | |
5782 if (gdkwin) | |
5783 gdkwin = gdk_window_get_toplevel(gdkwin); | |
5784 | |
5785 for (l = gaim_get_windows(); l != NULL; l = l->next) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5786 win = (GaimConvWindow *)l->data; |
4359 | 5787 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5788 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5789 continue; |
5790 | |
5791 gtkwin = GAIM_GTK_WINDOW(win); | |
5792 | |
5793 if (gdkwin == gtkwin->window->window) | |
5794 return win; | |
5795 } | |
5796 | |
5797 return NULL; | |
5798 } | |
5799 | |
5800 int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5801 gaim_gtkconv_get_tab_at_xy(GaimConvWindow *win, int x, int y) |
4359 | 5802 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5803 GaimGtkWindow *gtkwin; |
4359 | 5804 GList *l; |
5805 gint nb_x, nb_y, x_rel, y_rel; | |
5806 GtkNotebook *notebook; | |
5807 GtkWidget *tab; | |
5808 gint i, page_num = 0; | |
5809 gboolean first_visible = TRUE; | |
5810 | |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5811 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5812 return -1; |
5813 | |
5814 gtkwin = GAIM_GTK_WINDOW(win); | |
5815 notebook = GTK_NOTEBOOK(gtkwin->notebook); | |
5816 | |
5817 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
5818 x_rel = x - nb_x; | |
5819 y_rel = y - nb_y; | |
5820 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5821 for (l = gaim_conv_window_get_conversations(win), i = 0; |
4359 | 5822 l != NULL; |
5823 l = l->next, i++) { | |
5824 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5825 GaimConversation *conv = l->data; |
4359 | 5826 tab = GAIM_GTK_CONVERSATION(conv)->tab_label; |
5827 | |
5828 if (!GTK_WIDGET_MAPPED(tab)) | |
5829 continue; | |
5830 | |
5831 if (first_visible) { | |
5832 first_visible = FALSE; | |
5833 | |
5834 if (x_rel < tab->allocation.x) x_rel = tab->allocation.x; | |
5835 if (y_rel < tab->allocation.y) y_rel = tab->allocation.y; | |
5836 } | |
5837 | |
5838 if (gtk_notebook_get_tab_pos(notebook) == GTK_POS_TOP || | |
5839 gtk_notebook_get_tab_pos(notebook) == GTK_POS_BOTTOM) { | |
5840 | |
5841 if (tab->allocation.x <= x_rel) { | |
5842 if (tab->allocation.x + tab->allocation.width <= x_rel) | |
5843 page_num = i + 1; | |
5844 else | |
5845 page_num = i; | |
5846 } | |
5847 else | |
5848 break; | |
5849 } | |
5850 else { | |
5851 if (tab->allocation.y <= y_rel) { | |
5852 if (tab->allocation.y + tab->allocation.height <= y_rel) | |
5853 page_num = i + 1; | |
5854 else | |
5855 page_num = i; | |
5856 } | |
5857 else | |
5858 break; | |
5859 } | |
5860 } | |
5861 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5862 if (i == gaim_conv_window_get_conversation_count(win) + 1) |
4359 | 5863 return -1; |
5864 | |
5865 return page_num; | |
5866 } | |
5867 | |
5868 int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5869 gaim_gtkconv_get_dest_tab_at_xy(GaimConvWindow *win, int x, int y) |
4359 | 5870 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5871 GaimGtkWindow *gtkwin; |
4359 | 5872 GList *l; |
5873 gint nb_x, nb_y, x_rel, y_rel; | |
5874 GtkNotebook *notebook; | |
5875 GtkWidget *tab; | |
5876 gint i, page_num = 0; | |
5877 | |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5878 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5879 return -1; |
5880 | |
5881 gtkwin = GAIM_GTK_WINDOW(win); | |
5882 notebook = GTK_NOTEBOOK(gtkwin->notebook); | |
5883 | |
5884 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
5885 x_rel = x - nb_x; | |
5886 y_rel = y - nb_y; | |
5887 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5888 for (l = gaim_conv_window_get_conversations(win), i = 0; |
4359 | 5889 l != NULL; |
5890 l = l->next, i++) { | |
5891 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5892 GaimConversation *conv = l->data; |
4359 | 5893 tab = GAIM_GTK_CONVERSATION(conv)->tab_label; |
5894 | |
5895 if (!GTK_WIDGET_MAPPED(tab)) | |
5896 continue; | |
5897 | |
5898 if (gtk_notebook_get_tab_pos(notebook) == GTK_POS_TOP || | |
5899 gtk_notebook_get_tab_pos(notebook) == GTK_POS_BOTTOM) { | |
5900 | |
5901 if (tab->allocation.x <= x_rel) { | |
5902 if (tab->allocation.x + (tab->allocation.width / 2) <= x_rel) | |
5903 page_num = i + 1; | |
5904 else | |
5905 page_num = i; | |
5906 } | |
5907 else | |
5908 break; | |
5909 } | |
5910 else { | |
5911 if (tab->allocation.y <= y_rel) { | |
5912 if (tab->allocation.y + (tab->allocation.height / 2) <= y_rel) | |
5913 page_num = i + 1; | |
5914 else | |
5915 page_num = i; | |
5916 } | |
5917 else | |
5918 break; | |
5919 } | |
5920 } | |
5921 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5922 if (i == gaim_conv_window_get_conversation_count(win) + 1) |
4359 | 5923 return -1; |
5924 | |
5925 return page_num; | |
5926 } | |
4940
3708545afe42
[gaim-migrate @ 5274]
Christian Hammond <chipx86@chipx86.com>
parents:
4939
diff
changeset
|
5927 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5928 static void |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5929 escape_closes_pref_cb(const char *name, GaimPrefType type, gpointer value, |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5930 gpointer data) |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5931 { |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5932 if (value) |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5933 gtk_accel_map_change_entry(N_("<main>/Conversation/Close"), |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5934 GDK_Escape, 0, TRUE); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5935 else |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5936 gtk_accel_map_change_entry(N_("<main>/Conversation/Close"), |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5937 GDK_W, GDK_CONTROL_MASK, TRUE); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5938 } |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5939 |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5940 static void |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5941 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
|
5942 gpointer data) |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5943 { |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5944 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5945 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5946 GaimGtkConversation *gtkconv; |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5947 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5948 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5949 conv = (GaimConversation *)l->data; |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5950 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5951 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5952 continue; |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5953 |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5954 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5955 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5956 if (value) |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5957 gtk_widget_show(gtkconv->close); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5958 else |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5959 gtk_widget_hide(gtkconv->close); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5960 } |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5961 } |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5962 |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5963 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5964 show_timestamps_pref_cb(const char *name, GaimPrefType type, gpointer value, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5965 gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5966 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5967 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5968 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5969 GaimGtkConversation *gtkconv; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5970 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5971 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5972 conv = (GaimConversation *)l->data; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5973 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5974 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5975 continue; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5976 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5977 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5978 |
7386 | 5979 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
|
5980 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5981 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5982 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5983 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5984 spellcheck_pref_cb(const char *name, GaimPrefType type, gpointer value, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5985 gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5986 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5987 #ifdef USE_GTKSPELL |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5988 GList *cl; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5989 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5990 GaimGtkConversation *gtkconv; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5991 GtkSpell *spell; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5992 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5993 for (cl = gaim_get_conversations(); cl != NULL; cl = cl->next) { |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
5994 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5995 conv = (GaimConversation *)cl->data; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5996 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5997 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5998 continue; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5999 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6000 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6001 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6002 if (value) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
6003 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6004 else { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6005 spell = gtkspell_get_from_text_view(GTK_TEXT_VIEW(gtkconv->entry)); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6006 gtkspell_detach(spell); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6007 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6008 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6009 #endif |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6010 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6011 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6012 static void |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6013 tab_side_pref_cb(const char *name, GaimPrefType type, gpointer value, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6014 gpointer data) |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6015 { |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6016 GList *l; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6017 GtkPositionType pos; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
6018 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6019 GaimGtkWindow *gtkwin; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6020 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6021 pos = GPOINTER_TO_INT(value); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6022 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6023 for (l = gaim_get_windows(); l != NULL; l = l->next) { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
6024 win = (GaimConvWindow *)l->data; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6025 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6026 if (!GAIM_IS_GTK_WINDOW(win)) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6027 continue; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6028 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6029 gtkwin = GAIM_GTK_WINDOW(win); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6030 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6031 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6032 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6033 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6034 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6035 static void |
8456 | 6036 html_shortcuts_pref_cb(const char *name, GaimPrefType type, |
6037 gpointer value, gpointer data) | |
6038 { | |
6039 GList *l; | |
6040 GaimConversation *conv; | |
6041 GaimGtkConversation *gtkconv; | |
9487 | 6042 |
8456 | 6043 for(l = gaim_get_conversations(); l != NULL; l = l->next) { |
6044 conv = (GaimConversation *)l->data; | |
9487 | 6045 |
8456 | 6046 if(!GAIM_IS_GTK_CONVERSATION(conv)) |
6047 continue; | |
9487 | 6048 |
8456 | 6049 gtkconv = GAIM_GTK_CONVERSATION(conv); |
9487 | 6050 |
8456 | 6051 gtk_imhtml_html_shortcuts(GTK_IMHTML(gtkconv->entry), |
6052 (gboolean)GPOINTER_TO_INT(value)); | |
6053 } | |
6054 } | |
6055 | |
6056 static void | |
6057 smiley_shortcuts_pref_cb(const char *name, GaimPrefType type, | |
6058 gpointer value, gpointer data) | |
6059 { | |
6060 GList *l; | |
6061 GaimConversation *conv; | |
6062 GaimGtkConversation *gtkconv; | |
9487 | 6063 |
8456 | 6064 for(l = gaim_get_conversations(); l != NULL; l = l->next) { |
6065 conv = (GaimConversation *)l->data; | |
9487 | 6066 |
8456 | 6067 if(!GAIM_IS_GTK_CONVERSATION(conv)) |
6068 continue; | |
9487 | 6069 |
8456 | 6070 gtkconv = GAIM_GTK_CONVERSATION(conv); |
9487 | 6071 |
6072 gtk_imhtml_smiley_shortcuts(GTK_IMHTML(gtkconv->entry), | |
8456 | 6073 (gboolean)GPOINTER_TO_INT(value)); |
6074 } | |
6075 } | |
6076 | |
6077 static void | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6078 show_formatting_toolbar_pref_cb(const char *name, GaimPrefType type, |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6079 gpointer value, gpointer data) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6080 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6081 GList *l; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6082 GaimConversation *conv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6083 GaimGtkConversation *gtkconv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6084 GaimConvWindow *win; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6085 GaimGtkWindow *gtkwin; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6086 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6087 for (l = gaim_get_conversations(); l != NULL; l = l->next) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6088 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6089 conv = (GaimConversation *)l->data; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6090 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6091 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6092 continue; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6093 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6094 gtkconv = GAIM_GTK_CONVERSATION(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6095 win = gaim_conversation_get_window(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6096 gtkwin = GAIM_GTK_WINDOW(win); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6097 |
7386 | 6098 gtkconv->show_formatting_toolbar = (gboolean)GPOINTER_TO_INT(value); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6099 gtk_check_menu_item_set_active( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6100 GTK_CHECK_MENU_ITEM(gtkwin->menu.show_formatting_toolbar), |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6101 gtkconv->show_formatting_toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6102 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6103 if (gtkconv->show_formatting_toolbar) |
8317 | 6104 gtk_widget_show(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6105 else |
8317 | 6106 gtk_widget_hide(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6107 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6108 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6109 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6110 static void |
9150 | 6111 button_type_pref_cb(const char *name, GaimPrefType type, |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6112 gpointer value, gpointer data) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6113 { |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6114 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6115 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6116 GaimGtkConversation *gtkconv; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6117 |
9150 | 6118 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6119 conv = (GaimConversation *)l->data; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6120 gtkconv = GAIM_GTK_CONVERSATION(conv); |
9150 | 6121 switch (conv->type) { |
6122 case GAIM_CONV_IM: | |
9749 | 6123 setup_im_buttons(conv, gtkconv->bbox); |
9150 | 6124 gaim_gtkconv_update_buddy_icon(conv); |
6125 break; | |
6126 case GAIM_CONV_CHAT: | |
9749 | 6127 setup_chat_buttons(conv, gtkconv->bbox); |
9150 | 6128 break; |
6129 default: | |
6130 break; | |
6131 } | |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6132 } |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6133 } |
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 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6136 animate_buddy_icons_pref_cb(const char *name, GaimPrefType type, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6137 gpointer value, gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6138 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6139 GList *l; |
8189 | 6140 GaimConversation *conv; |
6141 GaimGtkConversation *gtkconv; | |
6142 GaimConvWindow *win; | |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6143 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6144 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
|
6145 return; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6146 |
8189 | 6147 /* Set the "animate" flag for each icon based on the new preference */ |
6148 for (l = gaim_get_ims(); l != NULL; l = l->next) { | |
6149 conv = (GaimConversation *)l->data; | |
6150 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
6151 gtkconv->u.im->animate = (gboolean)value; | |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6152 } |
8189 | 6153 |
6154 /* Now either stop or start animation for the active conversation in each window */ | |
6155 for (l = gaim_get_windows(); l != NULL; l = l->next) { | |
6156 win = (GaimConvWindow *)l->data; | |
6157 conv = gaim_conv_window_get_active_conversation(win); | |
6158 gaim_gtkconv_update_buddy_icon(conv); | |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6159 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6160 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6161 |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6162 static void |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6163 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
|
6164 gpointer data) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6165 { |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6166 GList *l; |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6167 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6168 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6169 GaimConversation *conv = l->data; |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6170 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6171 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6172 gaim_conversation_foreach(gaim_gtkconv_update_buddy_icon); |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6173 } |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6174 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6175 |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5680
diff
changeset
|
6176 static void |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6177 conv_placement_pref_cb(const char *name, GaimPrefType type, |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6178 gpointer value, gpointer data) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6179 { |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6180 GaimConvPlacementFunc func; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6181 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6182 if (strcmp(name, "/gaim/gtk/conversations/placement")) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6183 return; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6184 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6185 func = gaim_conv_placement_get_fnc(value); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6186 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6187 if (func == NULL) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6188 return; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6189 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6190 gaim_conv_placement_set_current_func(func); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6191 } |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6192 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6193 void * |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6194 gaim_gtk_conversations_get_handle(void) |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6195 { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6196 static int handle; |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6197 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6198 return &handle; |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6199 } |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6200 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6201 void |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
6202 gaim_gtk_conversations_init(void) |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6203 { |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6204 void *handle = gaim_gtk_conversations_get_handle(); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6205 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6206 /* Conversations */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6207 gaim_prefs_add_none("/gaim/gtk/conversations"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6208 gaim_prefs_add_bool("/gaim/gtk/conversations/close_on_tabs", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6209 gaim_prefs_add_bool("/gaim/gtk/conversations/ctrl_enter_sends", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6210 gaim_prefs_add_bool("/gaim/gtk/conversations/enter_sends", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6211 gaim_prefs_add_bool("/gaim/gtk/conversations/escape_closes", FALSE); |
9025 | 6212 gaim_prefs_add_bool("/gaim/gtk/conversations/send_formatting", FALSE); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6213 gaim_prefs_add_bool("/gaim/gtk/conversations/send_bold", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6214 gaim_prefs_add_bool("/gaim/gtk/conversations/send_italic", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6215 gaim_prefs_add_bool("/gaim/gtk/conversations/send_underline", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6216 gaim_prefs_add_bool("/gaim/gtk/conversations/show_timestamps", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6217 gaim_prefs_add_bool("/gaim/gtk/conversations/spellcheck", TRUE); |
9049 | 6218 #if 1 |
6219 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_colors", FALSE); | |
6220 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_fonts", FALSE); | |
6221 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_font_sizes", FALSE); | |
6222 #else | |
8944 | 6223 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_formatting", FALSE); |
9049 | 6224 #endif |
9572 | 6225 gaim_prefs_add_bool("/gaim/gtk/conversations/html_shortcuts", TRUE); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6226 gaim_prefs_add_bool("/gaim/gtk/conversations/smiley_shortcuts", FALSE); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6227 gaim_prefs_add_bool("/gaim/gtk/conversations/show_formatting_toolbar", TRUE); |
9130 | 6228 gaim_prefs_add_bool("/gaim/gtk/conversations/enable_commands", TRUE); |
6229 | |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6230 gaim_prefs_add_string("/gaim/gtk/conversations/placement", "last"); |
8998 | 6231 gaim_prefs_add_int("/gaim/gtk/conversations/placement_number", 1); |
9025 | 6232 gaim_prefs_add_string("/gaim/gtk/conversations/bgcolor", ""); |
6233 gaim_prefs_add_string("/gaim/gtk/conversations/fgcolor", ""); | |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6234 gaim_prefs_add_string("/gaim/gtk/conversations/font_face", ""); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6235 gaim_prefs_add_int("/gaim/gtk/conversations/font_size", 3); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6236 gaim_prefs_add_bool("/gaim/gtk/conversations/tabs", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6237 gaim_prefs_add_int("/gaim/gtk/conversations/tab_side", GTK_POS_TOP); |
9150 | 6238 gaim_prefs_add_int("/gaim/gtk/conversations/button_type", |
6239 GAIM_BUTTON_TEXT_IMAGE); | |
6240 | |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6241 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6242 /* Conversations -> Chat */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6243 gaim_prefs_add_none("/gaim/gtk/conversations/chat"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6244 gaim_prefs_add_bool("/gaim/gtk/conversations/chat/color_nicks", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6245 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_width", 410); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6246 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_height", 160); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6247 gaim_prefs_add_int("/gaim/gtk/conversations/chat/entry_height", 50); |
9319 | 6248 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
|
6249 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6250 /* Conversations -> IM */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6251 gaim_prefs_add_none("/gaim/gtk/conversations/im"); |
9150 | 6252 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6253 gaim_prefs_add_bool("/gaim/gtk/conversations/im/animate_buddy_icons", TRUE); |
9150 | 6254 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6255 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_width", 410); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6256 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_height", 160); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6257 gaim_prefs_add_int("/gaim/gtk/conversations/im/entry_height", 50); |
9319 | 6258 gaim_prefs_add_bool("/gaim/gtk/conversations/im/raise_on_events", FALSE); |
6259 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
|
6260 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6261 /* Connect callbacks. */ |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6262 gaim_prefs_connect_callback("/gaim/gtk/conversations/escape_closes", |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6263 escape_closes_pref_cb, NULL); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6264 gaim_prefs_connect_callback("/gaim/gtk/conversations/close_on_tabs", |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6265 close_on_tabs_pref_cb, NULL); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6266 gaim_prefs_connect_callback("/gaim/gtk/conversations/show_timestamps", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6267 show_timestamps_pref_cb, NULL); |
8456 | 6268 gaim_prefs_connect_callback("/gaim/gtk/conversations/html_shortcuts", |
6269 html_shortcuts_pref_cb, NULL); | |
6270 gaim_prefs_connect_callback("/gaim/gtk/conversations/smiley_shortcuts", | |
6271 smiley_shortcuts_pref_cb, NULL); | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6272 gaim_prefs_connect_callback("/gaim/gtk/conversations/show_formatting_toolbar", |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6273 show_formatting_toolbar_pref_cb, NULL); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6274 gaim_prefs_connect_callback("/gaim/gtk/conversations/spellcheck", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6275 spellcheck_pref_cb, NULL); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6276 gaim_prefs_connect_callback("/gaim/gtk/conversations/tab_side", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6277 tab_side_pref_cb, NULL); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6278 |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6279 gaim_prefs_connect_callback("/gaim/gtk/conversations/placement", |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6280 conv_placement_pref_cb, NULL); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6281 gaim_prefs_trigger_callback("/gaim/gtk/conversations/placement"); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6282 |
9150 | 6283 gaim_prefs_connect_callback("/gaim/gtk/conversations/button_type", |
6284 button_type_pref_cb, NULL); | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
6285 |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6286 /* IM callbacks */ |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6287 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/animate_buddy_icons", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6288 animate_buddy_icons_pref_cb, NULL); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6289 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/show_buddy_icons", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6290 show_buddy_icons_pref_cb, NULL); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6291 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6292 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6293 /********************************************************************** |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6294 * Register signals |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6295 **********************************************************************/ |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6296 gaim_signal_register(handle, "conversation-drag-ended", |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6297 gaim_marshal_VOID__POINTER_POINTER, NULL, 2, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6298 gaim_value_new(GAIM_TYPE_SUBTYPE, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6299 GAIM_SUBTYPE_CONV_WINDOW), |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6300 gaim_value_new(GAIM_TYPE_SUBTYPE, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6301 GAIM_SUBTYPE_CONV_WINDOW)); |
9167 | 6302 |
6303 /********************************************************************** | |
6304 * Register commands | |
6305 **********************************************************************/ | |
9829 | 6306 gaim_cmd_register("say", "S", GAIM_CMD_P_DEFAULT, |
6307 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, | |
6308 say_command_cb, _("say <message>: Send a message normally as if you weren't using a command."), NULL); | |
9213 | 6309 gaim_cmd_register("me", "S", GAIM_CMD_P_DEFAULT, |
6310 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, | |
9597 | 6311 me_command_cb, _("me <action>: Send an IRC style action to a buddy or chat."), NULL); |
9213 | 6312 gaim_cmd_register("debug", "w", GAIM_CMD_P_DEFAULT, |
6313 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, | |
9597 | 6314 debug_command_cb, _("debug <option>: Send various debug information to the current conversation."), NULL); |
9213 | 6315 |
6316 gaim_cmd_register("help", "w", GAIM_CMD_P_DEFAULT, | |
9597 | 6317 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, NULL, |
6318 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
|
6319 } |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6320 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6321 void |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6322 gaim_gtk_conversations_uninit(void) |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6323 { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6324 gaim_signals_unregister_by_instance(gaim_gtk_conversations_get_handle()); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6325 } |