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