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