Mercurial > pidgin.yaz
annotate src/gtkconv.c @ 9540:44cef0cee90c
[gaim-migrate @ 10368]
Well, I am now, anyway.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 16 Jul 2004 02:36:48 +0000 |
parents | 03066f174777 |
children | 8b2451878e26 |
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 */ | |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
24 #include "gtkinternal.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
25 |
4359 | 26 #ifndef _WIN32 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
27 # include <X11/Xlib.h> |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
28 #endif |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
29 |
4359 | 30 #ifdef USE_GTKSPELL |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
31 # include <gtkspell/gtkspell.h> |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
32 # ifdef _WIN32 |
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
33 # include "wspell.h" |
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
34 # endif |
4359 | 35 #endif |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
36 |
4359 | 37 #include <gdk/gdkkeysyms.h> |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
38 |
9130 | 39 #include "cmds.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
40 #include "debug.h" |
6982 | 41 #include "imgstore.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
42 #include "log.h" |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5402
diff
changeset
|
43 #include "notify.h" |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
44 #include "prefs.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
45 #include "prpl.h" |
6038 | 46 #include "request.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
47 #include "sound.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
48 #include "util.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
49 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
50 #include "dnd-hints.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
51 #include "gtkblist.h" |
5717 | 52 #include "gtkconv.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
53 #include "gtkimhtml.h" |
8317 | 54 #include "gtkimhtmltoolbar.h" |
7431 | 55 #include "gtklog.h" |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
56 #include "gtkpounce.h" |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
57 #include "gtkprivacy.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
58 #include "gtkutils.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
59 #include "stock.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
60 |
5717 | 61 #include "ui.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
62 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
63 /* XXX */ |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
64 #include "gaim.h" |
4359 | 65 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
66 #define AUTO_RESPONSE "<AUTO-REPLY> : " |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
67 |
7990 | 68 #define SEND_COLOR "#16569E" |
7855 | 69 #define RECV_COLOR "#A82F2F" |
7854 | 70 |
4359 | 71 static char nick_colors[][8] = { |
72 "#ba55d3", /* Medium Orchid */ | |
73 "#ee82ee", /* Violet */ | |
74 "#c715b4", /* Medium Violet Red */ | |
75 "#ff69b4", /* Hot Pink */ | |
76 "#ff6347", /* Tomato */ | |
77 "#fa8c00", /* Dark Orange */ | |
78 "#fa8072", /* Salmon */ | |
79 "#b22222", /* Fire Brick */ | |
80 "#f4a460", /* Sandy Brown */ | |
81 "#cd5c5c", /* Indian Red */ | |
82 "#bc8f8f", /* Rosy Brown */ | |
83 "#f0e68c", /* Khaki */ | |
84 "#bdb76b", /* Dark Khaki */ | |
85 "#228b22", /* Forest Green */ | |
86 "#9acd32", /* Yellow Green */ | |
87 "#32cd32", /* Lime Green */ | |
7755 | 88 "#3cb371", /* Medium Sea Green (Medium Sea Green?! What are we women?!) */ |
4359 | 89 "#2e8b57", /* Sea Green */ |
90 "#8fbc8f", /* Dark Sea Green */ | |
91 "#66cdaa", /* Medium Aquamarine */ | |
92 "#5f9ea0", /* Cadet Blue */ | |
93 "#48d1cc", /* Medium Turquoise */ | |
94 "#00ced1", /* Dark Turquoise */ | |
95 "#4682b4", /* Stell Blue */ | |
96 "#00bfff", /* Deep Sky Blue */ | |
97 "#1690ff", /* Dodger Blue */ | |
98 "#4169ff", /* Royal Blue */ | |
99 "#6a5acd", /* Slate Blue */ | |
100 "#6495ed", /* Cornflower Blue */ | |
101 "#708090", /* Slate gray */ | |
7995
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
102 "#2f4f4f", /* Dark Slate Gray */ |
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
103 "#ff8c00", /* Dark Orange */ |
8535 | 104 "#006400", /* DarkGreen */ |
105 "#8b4513", /* SaddleBrown */ | |
106 "#8b8989", /* snow4 */ | |
107 "#7d26cd", /* purple3 */ | |
4359 | 108 }; |
6291 | 109 |
4359 | 110 #define NUM_NICK_COLORS (sizeof(nick_colors) / sizeof(*nick_colors)) |
111 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
112 typedef struct |
4359 | 113 { |
114 GtkWidget *window; | |
115 | |
116 GtkWidget *entry; | |
117 GtkWidget *message; | |
118 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
119 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
120 |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
121 } InviteBuddyInfo; |
4359 | 122 |
123 static GtkWidget *invite_dialog = NULL; | |
124 | |
125 /* Prototypes. <-- because Paco-Paco hates this comment. */ | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
126 static void got_typing_keypress(GaimConversation *conv, gboolean first); |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
127 static GList *generate_invite_user_names(GaimConnection *gc); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
128 static void add_chat_buddy_common(GaimConversation *conv, |
4359 | 129 const char *name, int pos); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
130 static void tab_complete(GaimConversation *conv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
131 static void update_typing_icon(GaimConversation *conv); |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
132 static gboolean update_send_as_selection(GaimConvWindow *win); |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
133 static char *item_factory_translate_func (const char *path, gpointer func_data); |
4359 | 134 |
135 /************************************************************************** | |
136 * Callbacks | |
137 **************************************************************************/ | |
138 static gint | |
139 close_win_cb(GtkWidget *w, GdkEventAny *e, gpointer d) | |
140 { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
141 GaimConvWindow *win = (GaimConvWindow *)d; |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
142 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
143 gaim_conv_window_destroy(win); |
4361
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
144 |
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
145 return TRUE; |
4359 | 146 } |
147 | |
148 static gint | |
149 close_conv_cb(GtkWidget *w, gpointer d) | |
150 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
151 GaimConversation *conv = (GaimConversation *)d; |
4359 | 152 |
153 gaim_conversation_destroy(conv); | |
4361
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
154 |
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
155 return TRUE; |
4359 | 156 } |
157 | |
8914 | 158 static gboolean |
159 size_allocate_cb(GtkWidget *w, GtkAllocation *allocation, GaimConversation *conv) | |
160 { | |
161 GaimGtkConversation *gtkconv; | |
9048 | 162 GaimConvWindow *win = gaim_conversation_get_window(conv); |
9459 | 163 gboolean saveheight; |
8914 | 164 |
165 if (!GTK_WIDGET_VISIBLE(w)) | |
166 return FALSE; | |
167 | |
168 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
169 return FALSE; | |
170 | |
171 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
172 | |
9459 | 173 /* we only save the new height if the formatting toolbar visibility matches the pref */ |
174 saveheight = (gtkconv->show_formatting_toolbar == gaim_prefs_get_bool("/gaim/gtk/conversations/show_formatting_toolbar")); | |
175 | |
9048 | 176 /* I find that I resize the window when it has a bunch of conversations in it, mostly so that the tab bar |
177 * will fit, but then I don't want new windows taking up the entire screen. I check to see if there is only one | |
178 * conversation in the window. This way we'll be setting new windows to the size of the last resized new window. */ | |
179 | |
8914 | 180 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
181 { | |
9048 | 182 if (w == gtkconv->sw && (gaim_conv_window_get_conversation_count(win) == 1)) |
8914 | 183 { |
184 gaim_prefs_set_int("/gaim/gtk/conversations/im/default_width", allocation->width); | |
9459 | 185 if (saveheight) |
186 gaim_prefs_set_int("/gaim/gtk/conversations/im/default_height", allocation->height); | |
8914 | 187 } |
188 if (w == gtkconv->entry) | |
189 gaim_prefs_set_int("/gaim/gtk/conversations/im/entry_height", allocation->height); | |
190 } | |
191 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
192 { | |
9048 | 193 if (w == gtkconv->sw && (gaim_conv_window_get_conversation_count(win) == 1)) |
8914 | 194 { |
195 gaim_prefs_set_int("/gaim/gtk/conversations/chat/default_width", allocation->width); | |
9459 | 196 if (saveheight) |
197 gaim_prefs_set_int("/gaim/gtk/conversations/chat/default_height", allocation->height); | |
8914 | 198 } |
199 if (w == gtkconv->entry) | |
200 gaim_prefs_set_int("/gaim/gtk/conversations/chat/entry_height", allocation->height); | |
201 } | |
202 | |
203 return FALSE; | |
204 } | |
205 | |
7446
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
206 /* Courtesy of Galeon! */ |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
207 static void |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
208 tab_close_button_state_changed_cb(GtkWidget *widget, GtkStateType prev_state) |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
209 { |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
210 if (GTK_WIDGET_STATE(widget) == GTK_STATE_ACTIVE) |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
211 gtk_widget_set_state(widget, GTK_STATE_NORMAL); |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
212 } |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
213 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
214 static void |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
215 default_formatize(GaimConversation *conv) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
216 { |
8061 | 217 GaimGtkConversation *c = GAIM_GTK_CONVERSATION(conv); |
218 GaimConnection *gc = gaim_conversation_get_gc(conv); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
219 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
220 if (gc && gc->flags & GAIM_CONNECTION_HTML) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
221 { |
9025 | 222 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_formatting")) |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
223 { |
9025 | 224 char *color; |
225 GdkColor fg_color, bg_color; | |
226 | |
227 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold")) | |
228 gtk_imhtml_toggle_bold(GTK_IMHTML(c->entry)); | |
229 | |
230 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic")) | |
231 gtk_imhtml_toggle_italic(GTK_IMHTML(c->entry)); | |
232 | |
233 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline")) | |
234 gtk_imhtml_toggle_underline(GTK_IMHTML(c->entry)); | |
235 | |
236 gtk_imhtml_toggle_fontface(GTK_IMHTML(c->entry), | |
237 gaim_prefs_get_string("/gaim/gtk/conversations/font_face")); | |
238 | |
239 if (!(gc->flags & GAIM_CONNECTION_NO_FONTSIZE)) | |
240 gtk_imhtml_font_set_size(GTK_IMHTML(c->entry), | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
241 gaim_prefs_get_int("/gaim/gtk/conversations/font_size")); |
9025 | 242 |
243 if(strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"), "") != 0) | |
244 { | |
245 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"), | |
246 &fg_color); | |
247 color = g_strdup_printf("#%02x%02x%02x", | |
248 fg_color.red / 256, | |
249 fg_color.green / 256, | |
250 fg_color.blue / 256); | |
251 } | |
252 else | |
253 color = g_strdup(""); | |
254 | |
8061 | 255 gtk_imhtml_toggle_forecolor(GTK_IMHTML(c->entry), color); |
256 g_free(color); | |
9025 | 257 |
258 if(!(gc->flags & GAIM_CONNECTION_NO_BGCOLOR) && | |
259 strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), "") != 0) | |
260 { | |
261 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), | |
262 &bg_color); | |
263 color = g_strdup_printf("#%02x%02x%02x", | |
264 bg_color.red / 256, | |
265 bg_color.green / 256, | |
266 bg_color.blue / 256); | |
267 } | |
268 else | |
269 color = g_strdup(""); | |
270 | |
8061 | 271 gtk_imhtml_toggle_backcolor(GTK_IMHTML(c->entry), color); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
272 g_free(color); |
8061 | 273 } |
8677 | 274 |
9025 | 275 |
8677 | 276 if (gc->flags & GAIM_CONNECTION_FORMATTING_WBFO) |
277 gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(c->entry), TRUE); | |
278 else | |
279 gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(c->entry), FALSE); | |
8061 | 280 } |
281 } | |
9130 | 282 |
283 static const char * | |
284 gaim_gtk_get_cmd_prefix(void) | |
285 { | |
286 return "/"; | |
287 } | |
288 | |
9167 | 289 static GaimCmdRet |
290 me_command_cb(GaimConversation *conv, | |
291 const char *cmd, char **args, char **error) | |
292 { | |
293 char *tmp; | |
294 | |
295 tmp = g_strdup_printf("/me %s", args[0]); | |
9175 | 296 |
9167 | 297 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
298 gaim_conv_im_send(GAIM_CONV_IM(conv), tmp); | |
299 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
300 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), tmp); | |
301 | |
302 g_free(tmp); | |
303 return GAIM_CMD_RET_OK; | |
304 } | |
305 | |
9212 | 306 static GaimCmdRet |
307 debug_command_cb(GaimConversation *conv, | |
308 const char *cmd, char **args, char **error) | |
309 { | |
310 char *tmp, *markup; | |
311 GaimCmdStatus status; | |
312 | |
313 if (!g_ascii_strcasecmp(args[0], "version")) { | |
314 tmp = g_strdup_printf(_("me is using Gaim v%s."), VERSION); | |
315 markup = gaim_escape_html(tmp); | |
316 | |
317 status = gaim_cmd_do_command(conv, tmp, markup, error); | |
318 | |
319 g_free(tmp); | |
320 g_free(markup); | |
321 return status; | |
322 } else { | |
323 gaim_conversation_write(conv, NULL, _("Supported debug options are: version"), | |
324 GAIM_MESSAGE_NO_LOG|GAIM_MESSAGE_ERROR, time(NULL)); | |
325 return GAIM_CMD_STATUS_OK; | |
326 } | |
327 } | |
328 | |
9213 | 329 static GaimCmdRet |
330 help_command_cb(GaimConversation *conv, | |
331 const char *cmd, char **args, char **error) | |
332 { | |
333 GString *s; | |
334 GList *cmds, *l; | |
335 | |
336 s = g_string_new(_("Use \"/help <command>\" for help on a specific command.\n" | |
337 "The following commands are available in this context:\n")); | |
338 | |
339 cmds = gaim_cmd_list(conv); | |
340 for (l = cmds; l; l = l->next) | |
341 if (l->next) | |
342 g_string_append_printf(s, "%s, ", (char *)l->data); | |
343 else | |
344 g_string_append_printf(s, "%s.", (char *)l->data); | |
345 | |
346 gaim_conversation_write(conv, NULL, s->str, GAIM_MESSAGE_NO_LOG, time(NULL)); | |
347 g_string_free(s, TRUE); | |
348 g_list_free(cmds); | |
349 | |
350 return GAIM_CMD_STATUS_OK; | |
351 } | |
352 | |
353 static GaimCmdRet | |
354 help_arg_command_cb(GaimConversation *conv, | |
355 const char *cmd, char **args, char **error) | |
356 { | |
357 GList *help, *l; | |
358 GString *s; | |
359 | |
360 s = g_string_new(""); | |
361 help = gaim_cmd_help(conv, args[0]); | |
362 | |
363 if (help) { | |
364 for (l = help; l; l = l->next) | |
365 if (l->next) | |
9247 | 366 g_string_append_printf(s, "/%s\n", (char *)l->data); |
9213 | 367 else |
9247 | 368 g_string_append_printf(s, "/%s", (char *)l->data); |
9213 | 369 } else { |
370 g_string_append(s, _("No such command (in this context).")); | |
371 } | |
372 | |
373 gaim_conversation_write(conv, NULL, s->str, GAIM_MESSAGE_NO_LOG, time(NULL)); | |
374 g_string_free(s, TRUE); | |
375 g_list_free(help); | |
376 | |
377 return GAIM_CMD_STATUS_OK; | |
378 } | |
379 | |
4359 | 380 static void |
9374 | 381 send_history_add(GaimConversation *conv, const char *message) |
382 { | |
383 GList *first; | |
384 | |
385 first = g_list_first(conv->send_history); | |
386 | |
387 if (first->data) | |
388 g_free(first->data); | |
389 | |
390 first->data = g_strdup(message); | |
391 | |
392 conv->send_history = g_list_prepend(first, NULL); | |
393 } | |
394 | |
395 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
396 send_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 397 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
398 GaimGtkConversation *gtkconv; |
9130 | 399 char *cmd; |
400 const char *prefix; | |
8655 | 401 GaimAccount *account; |
8677 | 402 GaimConnection *gc; |
8448 | 403 char *buf, *clean; |
4359 | 404 |
405 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
8655 | 406 account = gaim_conversation_get_account(conv); |
9130 | 407 prefix = gaim_gtk_get_cmd_prefix(); |
408 | |
9471 | 409 if (!gaim_account_is_connected(account)) |
410 return; | |
411 | |
9474 | 412 if ((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) && |
413 gaim_conv_chat_has_left(GAIM_CONV_CHAT(conv))) | |
9471 | 414 return; |
415 | |
9130 | 416 if(gaim_prefs_get_bool("/gaim/gtk/conversations/enable_commands")) { |
417 cmd = gtk_imhtml_get_text(GTK_IMHTML(gtkconv->entry), NULL, NULL); | |
418 if(cmd && (strncmp(cmd, prefix, strlen(prefix)) == 0)) { | |
419 GaimCmdStatus status; | |
9374 | 420 char *error, *cmdline, *markup, *send_history; |
9175 | 421 GtkTextIter start, end; |
9130 | 422 |
9374 | 423 send_history = gtk_imhtml_get_markup(GTK_IMHTML(gtkconv->entry)); |
424 send_history_add(conv, send_history); | |
425 g_free(send_history); | |
426 | |
9130 | 427 cmdline = cmd + strlen(prefix); |
9175 | 428 gtk_text_buffer_get_start_iter(GTK_IMHTML(gtkconv->entry)->text_buffer, &start); |
429 gtk_text_iter_forward_chars(&start, g_utf8_strlen(prefix, -1)); | |
430 gtk_text_buffer_get_end_iter(GTK_IMHTML(gtkconv->entry)->text_buffer, &end); | |
431 markup = gtk_imhtml_get_markup_range(GTK_IMHTML(gtkconv->entry), &start, &end); | |
432 status = gaim_cmd_do_command(conv, cmdline, markup, &error); | |
9130 | 433 g_free(cmd); |
9175 | 434 g_free(markup); |
9130 | 435 |
436 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); | |
437 default_formatize(conv); | |
438 | |
439 switch(status) { | |
440 case GAIM_CMD_STATUS_OK: | |
441 return; | |
442 case GAIM_CMD_STATUS_NOT_FOUND: | |
9212 | 443 gaim_conversation_write(conv, "", _("No such command. If you didn't mean " |
444 "to type a command, you can turn " | |
445 "commands off from Tools->" | |
446 "Preferences->Interface->Conversation" | |
447 "->Enable \"slash\" commands."), | |
9213 | 448 GAIM_MESSAGE_NO_LOG, time(NULL)); |
9130 | 449 return; |
450 case GAIM_CMD_STATUS_WRONG_ARGS: | |
9212 | 451 gaim_conversation_write(conv, "", _("Syntax Error: You typed the wrong number of arguments " |
452 "to that command. If you didn't mean to type a command, " | |
453 "you can turn commands off from Tools->Preferences->" | |
454 "Interface->Conversation->Enable \"slash\" commands."), | |
9213 | 455 GAIM_MESSAGE_NO_LOG, time(NULL)); |
9130 | 456 return; |
457 case GAIM_CMD_STATUS_FAILED: | |
9212 | 458 gaim_conversation_write(conv, "", error ? error : _("Your command failed for an unknown reason."), |
9213 | 459 GAIM_MESSAGE_NO_LOG, time(NULL)); |
9130 | 460 if(error) |
461 g_free(error); | |
462 return; | |
463 case GAIM_CMD_STATUS_WRONG_TYPE: | |
464 if(gaim_conversation_get_type(conv) == GAIM_CONV_IM) | |
465 gaim_conversation_write(conv, "", _("That command only works in Chats, not IMs."), | |
9213 | 466 GAIM_MESSAGE_NO_LOG, time(NULL)); |
9130 | 467 else |
468 gaim_conversation_write(conv, "", _("That command only works in IMs, not Chats."), | |
9213 | 469 GAIM_MESSAGE_NO_LOG, time(NULL)); |
9130 | 470 return; |
471 case GAIM_CMD_STATUS_WRONG_PRPL: | |
472 gaim_conversation_write(conv, "", _("That command doesn't work on this protocol."), | |
9213 | 473 GAIM_MESSAGE_NO_LOG, time(NULL)); |
9130 | 474 return; |
475 } | |
476 } | |
477 | |
478 g_free(cmd); | |
479 } | |
480 | |
8655 | 481 |
8442 | 482 buf = gtk_imhtml_get_markup(GTK_IMHTML(gtkconv->entry)); |
8962 | 483 clean = gtk_imhtml_get_text(GTK_IMHTML(gtkconv->entry), NULL, NULL); |
8448 | 484 |
4359 | 485 gtk_widget_grab_focus(gtkconv->entry); |
486 | |
8448 | 487 if (strlen(clean) == 0) { |
488 g_free(clean); | |
4359 | 489 return; |
490 } | |
491 | |
8677 | 492 gc = gaim_account_get_connection(account); |
493 if (gc && (gc->flags & GAIM_CONNECTION_NO_NEWLINES)) { | |
494 char **bufs; | |
495 int i; | |
496 | |
497 bufs = gtk_imhtml_get_markup_lines(GTK_IMHTML(gtkconv->entry)); | |
498 for (i = 0; bufs[i]; i++) { | |
9374 | 499 send_history_add(conv, bufs[i]); |
8677 | 500 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
501 gaim_conv_im_send(GAIM_CONV_IM(conv), bufs[i]); | |
502 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
503 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), bufs[i]); | |
504 } | |
505 | |
506 g_strfreev(bufs); | |
507 | |
508 } else { | |
9374 | 509 send_history_add(conv, buf); |
8677 | 510 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
511 gaim_conv_im_send(GAIM_CONV_IM(conv), buf); | |
512 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
513 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), buf); | |
514 } | |
4359 | 515 |
8677 | 516 g_free(clean); |
4359 | 517 g_free(buf); |
518 | |
8061 | 519 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); |
520 default_formatize(conv); | |
4359 | 521 } |
522 | |
523 static void | |
7928 | 524 add_remove_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 525 { |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
526 GaimAccount *account; |
4359 | 527 const char *name; |
528 | |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
529 account = gaim_conversation_get_account(conv); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
530 name = gaim_conversation_get_name(conv); |
7879 | 531 |
532 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
7859 | 533 GaimBuddy *b; |
534 | |
535 b = gaim_find_buddy(account, name); | |
536 if (b != NULL) | |
537 show_confirm_del(b); | |
538 else if (account != NULL && gaim_account_is_connected(account)) | |
539 gaim_blist_request_add_buddy(account, (char *)name, NULL, NULL); | |
7879 | 540 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
7859 | 541 GaimChat *c; |
542 | |
543 c = gaim_blist_find_chat(account, name); | |
544 if (c != NULL) | |
545 show_confirm_del_blist_chat(c); | |
546 else if (account != NULL && gaim_account_is_connected(account)) | |
547 gaim_blist_request_add_chat(account, NULL, NULL); | |
548 } | |
4359 | 549 |
550 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
551 } | |
552 | |
7975 | 553 static void chat_do_info(GaimConversation *conv, const char *who) |
554 { | |
555 GaimPluginProtocolInfo *prpl_info = NULL; | |
556 GaimConnection *gc; | |
557 | |
558 if ((gc = gaim_conversation_get_gc(conv))) { | |
559 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | |
560 | |
561 /* | |
562 * If there are special needs for getting info on users in | |
563 * buddy chat "rooms"... | |
564 */ | |
565 if (prpl_info->get_cb_info != NULL) | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
566 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
567 prpl_info->get_cb_info(gc, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
568 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
569 } |
7975 | 570 else |
571 prpl_info->get_info(gc, who); | |
572 } | |
573 } | |
574 | |
575 | |
4359 | 576 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
577 info_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 578 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
579 GaimGtkConversation *gtkconv; |
4359 | 580 |
581 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
582 | |
7879 | 583 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
584 serv_get_info(gaim_conversation_get_gc(conv), | |
585 gaim_conversation_get_name(conv)); | |
586 | |
587 gtk_widget_grab_focus(gtkconv->entry); | |
588 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
589 /* Get info of the person currently selected in the GtkTreeView */ | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
590 GaimGtkChatPane *gtkchat; |
4359 | 591 GtkTreeIter iter; |
592 GtkTreeModel *model; | |
593 GtkTreeSelection *sel; | |
594 const char *name; | |
595 | |
596 gtkchat = gtkconv->u.chat; | |
597 | |
598 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | |
599 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); | |
600 | |
601 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) | |
9498 | 602 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &name, -1); |
4359 | 603 else |
604 return; | |
605 | |
7975 | 606 chat_do_info(conv, name); |
4359 | 607 } |
608 } | |
609 | |
610 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
611 warn_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 612 { |
613 show_warn_dialog(gaim_conversation_get_gc(conv), | |
7879 | 614 gaim_conversation_get_name(conv)); |
4359 | 615 |
616 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
617 } | |
618 | |
619 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
620 block_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 621 { |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
622 GaimAccount *account; |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
623 |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
624 account = gaim_conversation_get_account(conv); |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
625 |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
626 if (account != NULL && gaim_account_is_connected(account)) |
6399
d726a36628e8
[gaim-migrate @ 6904]
Christian Hammond <chipx86@chipx86.com>
parents:
6398
diff
changeset
|
627 gaim_gtk_request_add_block(account, gaim_conversation_get_name(conv)); |
4359 | 628 |
629 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
630 } | |
631 | |
632 static void | |
9468 | 633 send_file_cb(GtkWidget *widget, GaimConversation *conv) |
634 { | |
635 serv_send_file(gaim_conversation_get_gc(conv), gaim_conversation_get_name(conv), NULL); | |
636 } | |
637 | |
638 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
639 do_invite(GtkWidget *w, int resp, InviteBuddyInfo *info) |
4359 | 640 { |
641 const char *buddy, *message; | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
642 GaimGtkConversation *gtkconv; |
4359 | 643 |
644 gtkconv = GAIM_GTK_CONVERSATION(info->conv); | |
645 | |
646 if (resp == GTK_RESPONSE_OK) { | |
647 buddy = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(info->entry)->entry)); | |
648 message = gtk_entry_get_text(GTK_ENTRY(info->message)); | |
649 | |
4793 | 650 if (!g_ascii_strcasecmp(buddy, "")) { |
4359 | 651 g_free(info); |
652 | |
653 return; | |
654 } | |
655 | |
656 serv_chat_invite(gaim_conversation_get_gc(info->conv), | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
657 gaim_conv_chat_get_id(GAIM_CONV_CHAT(info->conv)), |
4359 | 658 message, buddy); |
659 } | |
660 | |
661 gtk_widget_destroy(invite_dialog); | |
662 invite_dialog = NULL; | |
663 | |
664 g_free(info); | |
665 } | |
666 | |
667 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
668 invite_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 669 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
670 InviteBuddyInfo *info = NULL; |
4359 | 671 |
672 if (invite_dialog == NULL) { | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
673 GaimConnection *gc; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
674 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
675 GaimGtkWindow *gtkwin; |
4359 | 676 GtkWidget *label; |
677 GtkWidget *vbox, *hbox; | |
678 GtkWidget *table; | |
679 GtkWidget *img; | |
680 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
681 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
682 GTK_ICON_SIZE_DIALOG); |
4359 | 683 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
684 info = g_new0(InviteBuddyInfo, 1); |
4359 | 685 info->conv = conv; |
686 | |
687 gc = gaim_conversation_get_gc(conv); | |
688 win = gaim_conversation_get_window(conv); | |
689 gtkwin = GAIM_GTK_WINDOW(win); | |
690 | |
691 /* Create the new dialog. */ | |
692 invite_dialog = gtk_dialog_new_with_buttons( | |
7859 | 693 _("Invite Buddy Into Chat Room"), |
7879 | 694 GTK_WINDOW(gtkwin->window), 0, |
695 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, | |
9443
3584cdab1d0b
[gaim-migrate @ 10264]
Christian Hammond <chipx86@chipx86.com>
parents:
9374
diff
changeset
|
696 GAIM_STOCK_INVITE, GTK_RESPONSE_OK, NULL); |
4359 | 697 |
698 gtk_dialog_set_default_response(GTK_DIALOG(invite_dialog), | |
699 GTK_RESPONSE_OK); | |
700 gtk_container_set_border_width(GTK_CONTAINER(invite_dialog), 6); | |
701 gtk_window_set_resizable(GTK_WINDOW(invite_dialog), FALSE); | |
702 gtk_dialog_set_has_separator(GTK_DIALOG(invite_dialog), FALSE); | |
703 | |
704 /* Setup the outside spacing. */ | |
705 vbox = GTK_DIALOG(invite_dialog)->vbox; | |
706 | |
707 gtk_box_set_spacing(GTK_BOX(vbox), 12); | |
708 gtk_container_set_border_width(GTK_CONTAINER(vbox), 6); | |
709 | |
710 /* Setup the inner hbox and put the dialog's icon in it. */ | |
711 hbox = gtk_hbox_new(FALSE, 12); | |
712 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
713 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
714 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
715 | |
716 /* Setup the right vbox. */ | |
717 vbox = gtk_vbox_new(FALSE, 0); | |
718 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
719 | |
720 /* Put our happy label in it. */ | |
721 label = gtk_label_new(_("Please enter the name of the user you wish " | |
722 "to invite, along with an optional invite " | |
723 "message.")); | |
724 gtk_widget_set_size_request(label, 350, -1); | |
725 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
726 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
727 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
728 | |
729 /* hbox for the table, and to give it some spacing on the left. */ | |
730 hbox = gtk_hbox_new(FALSE, 6); | |
731 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
732 | |
733 /* Setup the table we're going to use to lay stuff out. */ | |
734 table = gtk_table_new(2, 2, FALSE); | |
735 gtk_table_set_row_spacings(GTK_TABLE(table), 6); | |
736 gtk_table_set_col_spacings(GTK_TABLE(table), 6); | |
737 gtk_container_set_border_width(GTK_CONTAINER(table), 12); | |
738 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); | |
739 | |
740 /* Now the Buddy label */ | |
741 label = gtk_label_new(NULL); | |
742 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Buddy:")); | |
743 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
744 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); | |
745 | |
746 /* Now the Buddy drop-down entry field. */ | |
747 info->entry = gtk_combo_new(); | |
748 gtk_combo_set_case_sensitive(GTK_COMBO(info->entry), FALSE); | |
749 gtk_entry_set_activates_default( | |
750 GTK_ENTRY(GTK_COMBO(info->entry)->entry), TRUE); | |
751 | |
752 gtk_table_attach_defaults(GTK_TABLE(table), info->entry, 1, 2, 0, 1); | |
753 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->entry); | |
754 | |
755 /* Fill in the names. */ | |
756 gtk_combo_set_popdown_strings(GTK_COMBO(info->entry), | |
757 generate_invite_user_names(gc)); | |
758 | |
759 | |
760 /* Now the label for "Message" */ | |
761 label = gtk_label_new(NULL); | |
762 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Message:")); | |
763 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
764 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); | |
765 | |
766 | |
767 /* And finally, the Message entry field. */ | |
768 info->message = gtk_entry_new(); | |
769 gtk_entry_set_activates_default(GTK_ENTRY(info->message), TRUE); | |
770 | |
771 gtk_table_attach_defaults(GTK_TABLE(table), info->message, 1, 2, 1, 2); | |
772 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->message); | |
773 | |
774 /* Connect the signals. */ | |
775 g_signal_connect(G_OBJECT(invite_dialog), "response", | |
776 G_CALLBACK(do_invite), info); | |
777 } | |
778 | |
779 gtk_widget_show_all(invite_dialog); | |
780 | |
781 if (info != NULL) | |
782 gtk_widget_grab_focus(GTK_COMBO(info->entry)->entry); | |
783 } | |
784 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
785 static void |
7748 | 786 menu_new_conv_cb(gpointer data, guint action, GtkWidget *widget) |
787 { | |
788 show_im_dialog(); | |
789 } | |
790 | |
791 static void | |
9504 | 792 savelog_writefile_cb(void *user_data, const char *filename) |
9489 | 793 { |
9504 | 794 GaimConversation *conv = (GaimConversation *)user_data; |
9489 | 795 FILE *fp; |
796 const char *name; | |
797 | |
798 if ((fp = fopen(filename, "w+")) == NULL) { | |
9504 | 799 gaim_notify_error(conv, NULL, _("Unable to open file."), NULL); |
9489 | 800 return; |
801 } | |
802 | |
803 name = gaim_conversation_get_name(conv); | |
804 fprintf(fp, _("<h1>Conversation with %s</h1>\n"), name); | |
805 fprintf(fp, "%s", conv->history->str); | |
806 fclose(fp); | |
807 } | |
808 | |
809 static void | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
810 menu_save_as_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
811 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
812 GaimConvWindow *win = (GaimConvWindow *)data; |
9489 | 813 GaimConversation *conv = gaim_conv_window_get_active_conversation(win); |
814 gchar *buf; | |
815 | |
816 buf = g_strdup_printf("%s.html", gaim_normalize(conv->account, conv->name)); | |
9504 | 817 |
818 gaim_request_file(conv, _("Save Conversation"), buf, TRUE, | |
819 G_CALLBACK(savelog_writefile_cb), NULL, conv); | |
9489 | 820 |
821 g_free(buf); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
822 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
823 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
824 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
825 menu_view_log_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
826 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
827 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
828 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
829 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
830 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
831 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
832 gaim_gtk_log_show((char *)gaim_conversation_get_name(conv), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
833 gaim_conversation_get_account(conv)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
834 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
835 |
8974 | 836 static void |
837 menu_clear_cb(gpointer data, guint action, GtkWidget *widget) | |
838 { | |
839 GaimConvWindow *win = (GaimConvWindow *)data; | |
840 GaimConversation *conv; | |
841 GaimGtkConversation *gtkconv; | |
842 | |
843 conv = gaim_conv_window_get_active_conversation(win); | |
844 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
845 | |
846 gtk_imhtml_clear(GTK_IMHTML(gtkconv->imhtml)); | |
847 g_string_free(conv->history, TRUE); | |
848 conv->history = g_string_new(""); | |
849 } | |
850 | |
7295 | 851 struct _search { |
852 GaimGtkConversation *gtkconv; | |
853 GtkWidget *entry; | |
854 }; | |
855 | |
7929 | 856 static void do_search_cb(GtkWidget *widget, gint resp, struct _search *s) |
7295 | 857 { |
7929 | 858 switch (resp) { |
859 case GTK_RESPONSE_OK: | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
860 gtk_imhtml_search_find(GTK_IMHTML(s->gtkconv->imhtml), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
861 gtk_entry_get_text(GTK_ENTRY(s->entry))); |
7929 | 862 break; |
863 | |
864 case GTK_RESPONSE_DELETE_EVENT: | |
865 case GTK_RESPONSE_CLOSE: | |
866 gtk_imhtml_search_clear(GTK_IMHTML(s->gtkconv->imhtml)); | |
867 gtk_widget_destroy(s->gtkconv->dialogs.search); | |
868 s->gtkconv->dialogs.search = NULL; | |
869 g_free(s); | |
870 break; | |
871 } | |
7295 | 872 } |
873 | |
874 static void | |
7751 | 875 menu_find_cb(gpointer data, guint action, GtkWidget *widget) |
7295 | 876 { |
877 GaimConvWindow *win = (GaimConvWindow *)data; | |
878 GaimConversation *conv = gaim_conv_window_get_active_conversation(win); | |
879 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); | |
880 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7929 | 881 GtkWidget *hbox; |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
882 GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
883 GTK_ICON_SIZE_DIALOG); |
7929 | 884 GtkWidget *label; |
7295 | 885 struct _search *s; |
886 | |
7798 | 887 if (gtkconv->dialogs.search) { |
888 gtk_window_present(GTK_WINDOW(gtkconv->dialogs.search)); | |
7295 | 889 return; |
7798 | 890 } |
7300
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
891 |
7295 | 892 s = g_malloc(sizeof(struct _search)); |
893 s->gtkconv = gtkconv; | |
7929 | 894 |
895 gtkconv->dialogs.search = gtk_dialog_new_with_buttons(_("Find"), | |
896 GTK_WINDOW(gtkwin->window), GTK_DIALOG_DESTROY_WITH_PARENT, | |
897 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, | |
898 GTK_STOCK_FIND, GTK_RESPONSE_OK, NULL); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
899 gtk_dialog_set_default_response(GTK_DIALOG(gtkconv->dialogs.search), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
900 GTK_RESPONSE_OK); |
7929 | 901 g_signal_connect(G_OBJECT(gtkconv->dialogs.search), "response", |
902 G_CALLBACK(do_search_cb), s); | |
903 | |
904 gtk_container_set_border_width(GTK_CONTAINER(gtkconv->dialogs.search), 6); | |
905 gtk_window_set_resizable(GTK_WINDOW(gtkconv->dialogs.search), FALSE); | |
906 gtk_dialog_set_has_separator(GTK_DIALOG(gtkconv->dialogs.search), FALSE); | |
907 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
|
908 gtk_container_set_border_width( |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
909 GTK_CONTAINER(GTK_DIALOG(gtkconv->dialogs.search)->vbox), 6); |
7929 | 910 |
911 hbox = gtk_hbox_new(FALSE, 12); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
912 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(gtkconv->dialogs.search)->vbox), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
913 hbox); |
7929 | 914 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); |
915 | |
916 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
917 gtk_dialog_set_response_sensitive(GTK_DIALOG(gtkconv->dialogs.search), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
918 GTK_RESPONSE_OK, FALSE); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
919 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
920 label = gtk_label_new(NULL); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
921 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Search for:")); |
7929 | 922 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
923 | |
924 s->entry = gtk_entry_new(); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
925 gtk_entry_set_activates_default(GTK_ENTRY(s->entry), TRUE); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
926 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(s->entry)); |
7929 | 927 g_signal_connect(G_OBJECT(s->entry), "changed", |
928 G_CALLBACK(gaim_gtk_set_sensitive_if_input), | |
929 gtkconv->dialogs.search); | |
930 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
|
931 |
7295 | 932 gtk_widget_show_all(gtkconv->dialogs.search); |
7929 | 933 gtk_widget_grab_focus(s->entry); |
7295 | 934 } |
935 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
936 static void |
9468 | 937 menu_send_file_cb(gpointer data, guint action, GtkWidget *widget) |
938 { | |
939 GaimConvWindow *win = (GaimConvWindow *)data; | |
940 GaimConversation *conv = gaim_conv_window_get_active_conversation(win); | |
941 | |
942 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
943 serv_send_file(gaim_conversation_get_gc(conv), gaim_conversation_get_name(conv), NULL); | |
944 } | |
945 | |
946 } | |
947 | |
948 static void | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
949 menu_add_pounce_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
950 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
951 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
952 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
953 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
954 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
955 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
956 gaim_gtkpounce_dialog_show(gaim_conversation_get_account(conv), |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
957 gaim_conversation_get_name(conv), NULL); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
958 } |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
959 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
960 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
961 menu_insert_link_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
962 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
963 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
964 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
965 GaimGtkConversation *gtkconv; |
8756 | 966 GtkIMHtmlToolbar *toolbar; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
967 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
968 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
969 gtkconv = GAIM_GTK_CONVERSATION(conv); |
8756 | 970 toolbar = GTK_IMHTMLTOOLBAR(gtkconv->toolbar); |
971 | |
972 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->link), | |
973 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->link))); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
974 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
975 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
976 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
977 menu_insert_image_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
978 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
979 GaimConvWindow *win = (GaimConvWindow *)data; |
8756 | 980 GaimConversation *conv; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
981 GaimGtkConversation *gtkconv; |
8756 | 982 GtkIMHtmlToolbar *toolbar; |
983 | |
984 conv = gaim_conv_window_get_active_conversation(win); | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
985 gtkconv = GAIM_GTK_CONVERSATION(gaim_conv_window_get_active_conversation(win)); |
8756 | 986 toolbar = GTK_IMHTMLTOOLBAR(gtkconv->toolbar); |
987 | |
988 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->image), | |
989 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->image))); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
990 } |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
991 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
992 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
993 menu_alias_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
994 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
995 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
996 GaimConversation *conv; |
7879 | 997 GaimAccount *account; |
998 const char *name; | |
999 | |
1000 conv = gaim_conv_window_get_active_conversation(win); | |
1001 account = gaim_conversation_get_account(conv); | |
1002 name = gaim_conversation_get_name(conv); | |
1003 | |
1004 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
1005 GaimBuddy *b; | |
1006 | |
1007 b = gaim_find_buddy(account, name); | |
1008 if (b != NULL) | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1009 alias_dialog_bud(b); |
7879 | 1010 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
1011 GaimChat *c; | |
1012 | |
1013 c = gaim_blist_find_chat(account, name); | |
1014 if (c != NULL) | |
1015 alias_dialog_blist_chat(c); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1016 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1017 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1018 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1019 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1020 menu_get_info_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1021 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1022 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1023 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1024 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1025 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1026 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1027 info_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1028 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1029 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1030 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1031 menu_invite_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1032 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1033 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1034 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1035 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1036 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1037 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1038 invite_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1039 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1040 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1041 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1042 menu_warn_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1043 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1044 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1045 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1046 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1047 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1048 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1049 warn_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1050 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1051 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1052 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1053 menu_block_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1054 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1055 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1056 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1057 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1058 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1059 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1060 block_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1061 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1062 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1063 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1064 menu_add_remove_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1065 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1066 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1067 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1068 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1069 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1070 |
7928 | 1071 add_remove_cb(NULL, conv); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1072 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1073 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1074 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1075 menu_close_conv_cb(gpointer data, guint action, GtkWidget *widget) |
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 GaimConvWindow *win = (GaimConvWindow *)data; |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1078 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1079 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
|
1080 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1081 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1082 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1083 menu_logging_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1084 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1085 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1086 GaimConversation *conv; |
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 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1089 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1090 if (conv == NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1091 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1092 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1093 gaim_conversation_set_logging(conv, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1094 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1095 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1096 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1097 static void |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1098 menu_toolbar_cb(gpointer data, guint action, GtkWidget *widget) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1099 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1100 GaimConvWindow *win = (GaimConvWindow *)data; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1101 GaimConversation *conv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1102 GaimGtkConversation *gtkconv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1103 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1104 conv = gaim_conv_window_get_active_conversation(win); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1105 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1106 if (conv == NULL) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1107 return; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1108 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1109 gtkconv = GAIM_GTK_CONVERSATION(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1110 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1111 gtkconv->show_formatting_toolbar = |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1112 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1113 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1114 if (gtkconv->show_formatting_toolbar) |
8317 | 1115 gtk_widget_show(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1116 else |
8317 | 1117 gtk_widget_hide(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1118 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1119 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1120 static void |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1121 menu_sounds_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1122 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1123 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1124 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1125 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1126 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1127 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1128 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1129 if (!conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1130 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1131 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1132 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1133 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1134 gtkconv->make_sound = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1135 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1136 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1137 |
7961 | 1138 static void |
9188 | 1139 menu_timestamps_cb(gpointer data, guint action, GtkWidget *widget) |
1140 { | |
1141 GaimConvWindow *win = (GaimConvWindow *)data; | |
1142 GaimConversation *conv; | |
1143 GaimGtkConversation *gtkconv; | |
1144 | |
1145 conv = gaim_conv_window_get_active_conversation(win); | |
1146 | |
1147 if (!conv) | |
1148 return; | |
1149 | |
1150 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1151 | |
1152 gtkconv->show_timestamps = | |
1153 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); | |
1154 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
1155 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))); | |
1156 } | |
1157 | |
1158 static void | |
7961 | 1159 chat_do_im(GaimConversation *conv, const char *who) |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1160 { |
7961 | 1161 GaimPluginProtocolInfo *prpl_info = NULL; |
1162 char *real_who; | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1163 GaimConversation *conv2; |
7961 | 1164 GaimAccount *account; |
1165 | |
1166 account = gaim_conversation_get_account(conv); | |
1167 | |
1168 if(account && account->gc) | |
1169 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl); | |
1170 | |
1171 if(prpl_info && prpl_info->get_cb_real_name) | |
1172 real_who = prpl_info->get_cb_real_name(account->gc, | |
1173 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); | |
1174 else | |
1175 real_who = g_strdup(who); | |
1176 | |
1177 if(!real_who) | |
1178 return; | |
1179 | |
1180 conv2 = gaim_find_conversation_with_account(real_who, account); | |
1181 | |
1182 if (conv2 != NULL) | |
1183 gaim_conv_window_show(gaim_conversation_get_window(conv2)); | |
1184 else | |
1185 conv2 = gaim_conversation_new(GAIM_CONV_IM, account, real_who); | |
1186 | |
1187 g_free(real_who); | |
1188 } | |
1189 | |
1190 | |
1191 static void | |
1192 chat_im_button_cb(GtkWidget *widget, GaimConversation *conv) | |
1193 { | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1194 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1195 GaimGtkChatPane *gtkchat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1196 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1197 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1198 GtkTreeSelection *sel; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1199 const char *name; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1200 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1201 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1202 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1203 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1204 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1205 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1206 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1207 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) |
9498 | 1208 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
|
1209 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1210 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1211 |
7961 | 1212 chat_do_im(conv, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1213 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1214 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1215 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1216 ignore_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1217 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1218 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1219 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1220 GaimConvChat *chat; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1221 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1222 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1223 GtkTreeSelection *sel; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1224 const char *name; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1225 int pos; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1226 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1227 chat = GAIM_CONV_CHAT(conv); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1228 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1229 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1230 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1231 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1232 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1233 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1234 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) { |
9498 | 1235 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
|
1236 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
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 else |
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 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1241 pos = g_list_index(gaim_conv_chat_get_users(chat), name); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1242 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1243 if (gaim_conv_chat_is_user_ignored(chat, name)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1244 gaim_conv_chat_unignore(chat, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1245 else |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1246 gaim_conv_chat_ignore(chat, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1247 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1248 add_chat_buddy_common(conv, name, pos); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1249 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1250 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1251 static void |
7398 | 1252 menu_chat_im_cb(GtkWidget *w, GaimConversation *conv) |
1253 { | |
1254 const char *who = g_object_get_data(G_OBJECT(w), "user_data"); | |
1255 | |
1256 chat_do_im(conv, who); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1257 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1258 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1259 static void |
9468 | 1260 menu_chat_send_file_cb(GtkWidget *w, GaimConversation *conv) |
1261 { | |
1262 const char *who = g_object_get_data(G_OBJECT(w), "user_data"); | |
1263 GaimConnection *gc = gaim_conversation_get_gc(conv); | |
1264 | |
1265 serv_send_file(gc, who, NULL); | |
1266 } | |
1267 | |
1268 static void | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1269 menu_chat_info_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1270 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1271 char *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1272 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1273 who = g_object_get_data(G_OBJECT(w), "user_data"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1274 |
7975 | 1275 chat_do_info(conv, who); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1276 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1277 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1278 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1279 menu_chat_get_away_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1280 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1281 GaimPluginProtocolInfo *prpl_info = NULL; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1282 GaimConnection *gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1283 char *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1284 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1285 gc = gaim_conversation_get_gc(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1286 who = g_object_get_data(G_OBJECT(w), "user_data"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1287 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1288 if (gc != NULL) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1289 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1290 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1291 /* |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1292 * 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
|
1293 */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1294 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1295 if (prpl_info->get_cb_away != NULL) |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1296 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1297 prpl_info->get_cb_away(gc, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1298 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1299 } |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1300 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1301 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1302 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1303 static void |
7928 | 1304 menu_chat_add_remove_cb(GtkWidget *w, GaimConversation *conv) |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1305 { |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1306 GaimAccount *account; |
6695 | 1307 GaimBuddy *b; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1308 char *name; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1309 |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1310 account = gaim_conversation_get_account(conv); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1311 name = g_object_get_data(G_OBJECT(w), "user_data"); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1312 b = gaim_find_buddy(account, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1313 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1314 if (b != NULL) |
5975 | 1315 show_confirm_del(b); |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1316 else if (account != NULL && gaim_account_is_connected(account)) |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1317 gaim_blist_request_add_buddy(account, name, NULL, NULL); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1318 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1319 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1320 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1321 |
8143 | 1322 static GtkWidget * |
1323 create_chat_menu(GaimConversation *conv, gchar *who, | |
1324 GaimPluginProtocolInfo *prpl_info, GaimConnection *gc) | |
1325 { | |
1326 static GtkWidget *menu = NULL; | |
1327 GtkWidget *button; | |
1328 | |
1329 /* | |
1330 * If a menu already exists, destroy it before creating a new one, | |
1331 * thus freeing-up the memory it occupied. | |
1332 */ | |
1333 if (menu) | |
1334 gtk_widget_destroy(menu); | |
1335 | |
1336 menu = gtk_menu_new(); | |
1337 | |
1338 button = gtk_menu_item_new_with_label(_("IM")); | |
1339 g_signal_connect(G_OBJECT(button), "activate", | |
1340 G_CALLBACK(menu_chat_im_cb), conv); | |
1341 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1342 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1343 gtk_widget_show(button); | |
1344 | |
9468 | 1345 if (gc && prpl_info && prpl_info->send_file |
1346 && (!prpl_info->can_receive_file || prpl_info->can_receive_file(gc, who))) { | |
1347 button = gtk_menu_item_new_with_label(_("Send File")); | |
1348 g_signal_connect(G_OBJECT(button), "activate", | |
1349 G_CALLBACK(menu_chat_send_file_cb), conv); | |
1350 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1351 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1352 gtk_widget_show(button); | |
1353 } | |
9498 | 1354 |
8143 | 1355 if (gaim_conv_chat_is_user_ignored(GAIM_CONV_CHAT(conv), who)) |
1356 button = gtk_menu_item_new_with_label(_("Un-Ignore")); | |
1357 else | |
1358 button = gtk_menu_item_new_with_label(_("Ignore")); | |
1359 | |
1360 g_signal_connect(G_OBJECT(button), "activate", | |
1361 G_CALLBACK(ignore_cb), conv); | |
1362 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1363 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1364 gtk_widget_show(button); | |
1365 | |
8170 | 1366 if (gc && (prpl_info->get_info || prpl_info->get_cb_info)) { |
8143 | 1367 button = gtk_menu_item_new_with_label(_("Info")); |
1368 g_signal_connect(G_OBJECT(button), "activate", | |
1369 G_CALLBACK(menu_chat_info_cb), conv); | |
1370 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1371 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1372 gtk_widget_show(button); | |
1373 } | |
1374 | |
1375 if (gc && prpl_info->get_cb_away) { | |
1376 button = gtk_menu_item_new_with_label(_("Get Away Msg")); | |
1377 g_signal_connect(G_OBJECT(button), "activate", | |
1378 G_CALLBACK(menu_chat_get_away_cb), conv); | |
1379 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1380 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1381 gtk_widget_show(button); | |
1382 } | |
1383 | |
8170 | 1384 /* XXX: jabber can only add buddies from here in certain circumstances */ |
8143 | 1385 /* Added by Jonas <jonas@birme.se> */ |
1386 if (gc) { | |
1387 if (gaim_find_buddy(gc->account, who)) | |
1388 button = gtk_menu_item_new_with_label(_("Remove")); | |
1389 else | |
1390 button = gtk_menu_item_new_with_label(_("Add")); | |
1391 | |
1392 g_signal_connect(G_OBJECT(button), "activate", | |
1393 G_CALLBACK(menu_chat_add_remove_cb), conv); | |
1394 | |
1395 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1396 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1397 gtk_widget_show(button); | |
1398 } | |
1399 /* End Jonas */ | |
1400 | |
1401 return menu; | |
1402 } | |
1403 | |
1404 | |
1405 static gint | |
1406 gtkconv_chat_popup_menu_cb(GtkWidget *widget, GaimConversation *conv) | |
1407 { | |
1408 GaimGtkConversation *gtkconv; | |
1409 GaimPluginProtocolInfo *prpl_info = NULL; | |
1410 GaimGtkChatPane *gtkchat; | |
1411 GaimConnection *gc; | |
1412 GaimAccount *account; | |
1413 GtkTreeSelection *sel; | |
1414 GtkTreeIter iter; | |
1415 GtkTreeModel *model; | |
1416 GtkWidget *menu; | |
1417 gchar *who; | |
1418 | |
1419 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1420 gtkchat = gtkconv->u.chat; | |
1421 account = gaim_conversation_get_account(conv); | |
1422 gc = account->gc; | |
1423 | |
1424 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | |
1425 | |
1426 if (gc != NULL) | |
1427 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | |
1428 | |
1429 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); | |
1430 if(!gtk_tree_selection_get_selected(sel, NULL, &iter)) | |
1431 return FALSE; | |
1432 | |
9498 | 1433 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &who, -1); |
8143 | 1434 menu = create_chat_menu (conv, who, prpl_info, gc); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1435 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1436 gaim_gtk_treeview_popup_menu_position_func, widget, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1437 0, GDK_CURRENT_TIME); |
8143 | 1438 |
1439 return TRUE; | |
1440 } | |
1441 | |
1442 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1443 static gint |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1444 right_click_chat_cb(GtkWidget *widget, GdkEventButton *event, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1445 GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1446 { |
8143 | 1447 GaimGtkConversation *gtkconv; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1448 GaimPluginProtocolInfo *prpl_info = NULL; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1449 GaimGtkChatPane *gtkchat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1450 GaimConnection *gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1451 GaimAccount *account; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1452 GtkTreePath *path; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1453 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1454 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1455 GtkTreeViewColumn *column; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1456 gchar *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1457 int x, y; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1458 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1459 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1460 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1461 account = gaim_conversation_get_account(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1462 gc = account->gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1463 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1464 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1465 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1466 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
|
1467 event->x, event->y, &path, &column, &x, &y); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1468 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1469 if (path == NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1470 return FALSE; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1471 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1472 if (gc != NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1473 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1474 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1475 gtk_tree_selection_select_path(GTK_TREE_SELECTION( |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1476 gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list))), path); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1477 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1478 gtk_tree_model_get_iter(GTK_TREE_MODEL(model), &iter, path); |
9498 | 1479 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
|
1480 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1481 if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) { |
7398 | 1482 chat_do_im(conv, who); |
1483 } else if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { | |
8143 | 1484 GtkWidget *menu = create_chat_menu (conv, who, prpl_info, gc); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1485 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1486 event->button, event->time); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1487 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1488 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1489 return TRUE; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1490 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1491 |
8133 | 1492 static void |
1493 move_to_next_unread_tab(GaimConversation *conv) | |
1494 { | |
1495 GaimConversation *next_conv = NULL; | |
1496 GaimConvWindow *win; | |
1497 GList *l; | |
1498 int index, i; | |
1499 | |
1500 win = gaim_conversation_get_window(conv); | |
1501 index = gaim_conversation_get_index(conv); | |
1502 | |
1503 /* First check the tabs after this position. */ | |
1504 for (l = g_list_nth(gaim_conv_window_get_conversations(win), index); | |
1505 l != NULL; | |
1506 l = l->next) { | |
1507 | |
1508 next_conv = (GaimConversation *)l->data; | |
1509 | |
1510 if (gaim_conversation_get_unseen(next_conv) > 0) | |
1511 break; | |
1512 | |
1513 next_conv = NULL; | |
1514 } | |
1515 | |
1516 if (next_conv == NULL) { | |
1517 | |
1518 /* Now check before this position. */ | |
1519 for (l = gaim_conv_window_get_conversations(win), i = 0; | |
1520 l != NULL && i < index; | |
1521 l = l->next) { | |
1522 | |
1523 next_conv = (GaimConversation *)l->data; | |
1524 | |
1525 if (gaim_conversation_get_unseen(next_conv) > 0) | |
1526 break; | |
1527 | |
1528 next_conv = NULL; | |
1529 } | |
1530 | |
1531 if (next_conv == NULL) { | |
1532 /* Okay, just grab the next conversation tab. */ | |
1533 if (index == gaim_conv_window_get_conversation_count(win) - 1) | |
1534 next_conv = gaim_conv_window_get_conversation_at(win, 0); | |
1535 else | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1536 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1537 next_conv = gaim_conv_window_get_conversation_at(win, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1538 index + 1); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1539 } |
8133 | 1540 } |
1541 } | |
1542 | |
1543 if (next_conv != NULL && next_conv != conv) { | |
1544 gaim_conv_window_switch_conversation(win, | |
1545 gaim_conversation_get_index(next_conv)); | |
1546 } | |
1547 } | |
1548 | |
4359 | 1549 static gboolean |
8105 | 1550 entry_key_press_cb(GtkWidget *entry, GdkEventKey *event, gpointer data) |
4359 | 1551 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1552 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1553 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1554 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1555 GaimGtkWindow *gtkwin; |
8105 | 1556 int numconvs; |
1557 int curconv; | |
1558 | |
1559 conv = (GaimConversation *)data; | |
1560 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1561 win = gaim_conversation_get_window(conv); | |
1562 gtkwin = GAIM_GTK_WINDOW(win); | |
1563 numconvs = gaim_conv_window_get_conversation_count(win); | |
1564 curconv = gaim_conversation_get_index(conv); | |
1565 | |
1566 /* If CTRL was held down... */ | |
1567 if (event->state & GDK_CONTROL_MASK) { | |
4359 | 1568 switch (event->keyval) { |
8105 | 1569 case GDK_Return: |
1570 case GDK_KP_Enter: | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1571 if (gaim_prefs_get_bool( |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1572 "/gaim/gtk/conversations/ctrl_enter_sends")) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1573 { |
8105 | 1574 send_cb(NULL, conv); |
1575 | |
1576 return TRUE; | |
1577 } | |
1578 break; | |
1579 | |
4359 | 1580 case GDK_Up: |
1581 if (!conv->send_history) | |
1582 break; | |
1583 | |
1584 if (!conv->send_history->prev) { | |
1585 GtkTextIter start, end; | |
1586 | |
1587 if (conv->send_history->data) | |
1588 g_free(conv->send_history->data); | |
1589 | |
1590 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, | |
1591 &start); | |
1592 gtk_text_buffer_get_end_iter(gtkconv->entry_buffer, &end); | |
1593 | |
1594 conv->send_history->data = | |
8506 | 1595 gtk_imhtml_get_markup(GTK_IMHTML(gtkconv->entry)); |
4359 | 1596 } |
8677 | 1597 |
4359 | 1598 if (conv->send_history->next && |
1599 conv->send_history->next->data) { | |
8677 | 1600 GtkTextIter iter; |
1601 GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); | |
4359 | 1602 |
1603 conv->send_history = conv->send_history->next; | |
8061 | 1604 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1605 gtk_imhtml_append_text_with_images( |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1606 GTK_IMHTML(gtkconv->entry), conv->send_history->data, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1607 0, NULL); |
8677 | 1608 /* this is mainly just a hack so the formatting at the |
1609 * cursor gets picked up. */ | |
1610 gtk_text_buffer_get_end_iter(buffer, &iter); | |
1611 gtk_text_buffer_move_mark_by_name(buffer, "insert", &iter); | |
4359 | 1612 } |
1613 | |
8105 | 1614 return TRUE; |
4359 | 1615 break; |
1616 | |
1617 case GDK_Down: | |
1618 if (!conv->send_history) | |
1619 break; | |
1620 | |
8105 | 1621 if (conv->send_history->prev && |
1622 conv->send_history->prev->data) { | |
8677 | 1623 GtkTextIter iter; |
1624 GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); | |
8105 | 1625 |
4359 | 1626 conv->send_history = conv->send_history->prev; |
8105 | 1627 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1628 gtk_imhtml_append_text_with_images( |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1629 GTK_IMHTML(gtkconv->entry), conv->send_history->data, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1630 0, NULL); |
8677 | 1631 /* this is mainly just a hack so the formatting at the |
1632 * cursor gets picked up. */ | |
1633 gtk_text_buffer_get_end_iter(buffer, &iter); | |
1634 gtk_text_buffer_move_mark_by_name(buffer, "insert", &iter); | |
4359 | 1635 } |
1636 | |
8105 | 1637 return TRUE; |
4359 | 1638 break; |
8105 | 1639 |
8108 | 1640 case GDK_Page_Down: |
8143 | 1641 case ']': |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1642 gaim_conv_window_switch_conversation(win, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1643 (curconv + 1) % numconvs); |
8105 | 1644 |
1645 return TRUE; | |
1646 break; | |
1647 | |
8108 | 1648 case GDK_Page_Up: |
8143 | 1649 case '[': |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1650 gaim_conv_window_switch_conversation(win, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1651 (curconv + numconvs - 1) % numconvs); |
8133 | 1652 |
1653 return TRUE; | |
1654 break; | |
1655 | |
8108 | 1656 case GDK_Tab: |
8133 | 1657 move_to_next_unread_tab(conv); |
8108 | 1658 |
1659 return TRUE; | |
1660 break; | |
1661 | |
1662 case 'z': | |
1663 gtk_window_iconify(GTK_WINDOW(gtkwin->window)); | |
8105 | 1664 |
1665 return TRUE; | |
1666 break; | |
1667 | |
1668 } /* End of switch */ | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1669 } |
8758 | 1670 |
8105 | 1671 /* If ALT (or whatever) was held down... */ |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1672 else if (event->state & GDK_MOD1_MASK) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1673 { |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8730
diff
changeset
|
1674 /* XXX - Make sure the conv exists before switching to it */ |
8105 | 1675 if (event->keyval > '0' && event->keyval <= '9') { |
1676 int switchto = event->keyval - '1'; | |
1677 if (switchto < numconvs) | |
1678 gaim_conv_window_switch_conversation(win, switchto); | |
4359 | 1679 |
1680 return TRUE; | |
1681 } | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1682 } |
8758 | 1683 |
8105 | 1684 /* If neither CTRL nor ALT were held down... */ |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1685 else |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1686 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1687 switch (event->keyval) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1688 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1689 case GDK_Return: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1690 case GDK_KP_Enter: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1691 if (!(event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK)) && |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1692 gaim_prefs_get_bool("/gaim/gtk/conversations/enter_sends")) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1693 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1694 send_cb(NULL, conv); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1695 return TRUE; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1696 } |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1697 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1698 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1699 case GDK_Tab: |
8941 | 1700 if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1701 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1702 tab_complete(conv); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1703 return TRUE; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1704 } |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1705 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1706 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1707 case GDK_Page_Up: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1708 gtk_imhtml_page_up(GTK_IMHTML(gtkconv->imhtml)); |
8105 | 1709 return TRUE; |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1710 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1711 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1712 case GDK_Page_Down: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1713 gtk_imhtml_page_down(GTK_IMHTML(gtkconv->imhtml)); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1714 return TRUE; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1715 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1716 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1717 } |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1718 } |
4359 | 1719 |
1720 return FALSE; | |
1721 } | |
1722 | |
1723 /* | |
1724 * NOTE: | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1725 * This guy just kills a single right click from being propagated any |
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1726 * further. I have no idea *why* we need this, but we do ... It |
4359 | 1727 * prevents right clicks on the GtkTextView in a convo dialog from |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1728 * going all the way down to the notebook. I suspect a bug in |
4359 | 1729 * GtkTextView, but I'm not ready to point any fingers yet. |
1730 */ | |
1731 static gboolean | |
1732 entry_stop_rclick_cb(GtkWidget *widget, GdkEventButton *event, gpointer data) | |
1733 { | |
1734 if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { | |
1735 /* Right single click */ | |
1736 g_signal_stop_emission_by_name(G_OBJECT(widget), "button_press_event"); | |
1737 | |
1738 return TRUE; | |
1739 } | |
1740 | |
1741 return FALSE; | |
1742 } | |
1743 | |
8173 | 1744 /* |
1745 * If someone tries to type into the conversation backlog of a | |
1746 * conversation window then we yank focus from the conversation backlog | |
1747 * and give it to the text entry box so that people can type | |
1748 * all the live long day and it will get entered into the entry box. | |
1749 */ | |
6057 | 1750 static gboolean |
8105 | 1751 refocus_entry_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) |
6057 | 1752 { |
1753 GaimGtkConversation *gtkconv = data; | |
1754 | |
8237 | 1755 /* If we have a valid key for the conversation display, then exit */ |
8224 | 1756 if ((event->state & GDK_CONTROL_MASK) || |
8237 | 1757 (event->keyval == GDK_F10) || |
1758 (event->keyval == GDK_Shift_L) || | |
1759 (event->keyval == GDK_Shift_R) || | |
1760 (event->keyval == GDK_Escape) || | |
8177 | 1761 (event->keyval == GDK_Up) || |
1762 (event->keyval == GDK_Down) || | |
1763 (event->keyval == GDK_Left) || | |
8191 | 1764 (event->keyval == GDK_Right) || |
1765 (event->keyval == GDK_Home) || | |
9297 | 1766 (event->keyval == GDK_End) || |
1767 (event->keyval == GDK_Tab) || | |
1768 (event->keyval == GDK_ISO_Left_Tab)) | |
8177 | 1769 return FALSE; |
1770 | |
1771 if (event->type == GDK_KEY_RELEASE) | |
1772 gtk_widget_grab_focus(gtkconv->entry); | |
1773 | |
1774 gtk_widget_event(gtkconv->entry, (GdkEvent *)event); | |
1775 | |
1776 return TRUE; | |
6057 | 1777 } |
1778 | |
4359 | 1779 static void |
4673 | 1780 menu_conv_sel_send_cb(GObject *m, gpointer data) |
4359 | 1781 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1782 GaimConvWindow *win = g_object_get_data(m, "user_data"); |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
1783 GaimAccount *account = g_object_get_data(m, "gaim_account"); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1784 GaimConversation *conv; |
8456 | 1785 GaimGtkConversation *gtkconv; |
1786 GaimPlugin *protocol; | |
4359 | 1787 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1788 conv = gaim_conv_window_get_active_conversation(win); |
4359 | 1789 |
4491 | 1790 gaim_conversation_set_account(conv, account); |
8456 | 1791 |
1792 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1793 protocol = gaim_find_prpl(conv->account->protocol_id); | |
1794 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), | |
1795 protocol->info->name); | |
4359 | 1796 } |
1797 | |
1798 static void | |
1799 insert_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *position, | |
1800 gchar *new_text, gint new_text_length, gpointer user_data) | |
1801 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1802 GaimConversation *conv = (GaimConversation *)user_data; |
4359 | 1803 |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1804 g_return_if_fail(conv != NULL); |
4359 | 1805 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1806 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) |
4359 | 1807 return; |
1808 | |
1809 got_typing_keypress(conv, (gtk_text_iter_is_start(position) && | |
1810 gtk_text_iter_is_end(position))); | |
1811 } | |
1812 | |
1813 static void | |
1814 delete_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *start_pos, | |
1815 GtkTextIter *end_pos, gpointer user_data) | |
1816 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1817 GaimConversation *conv = (GaimConversation *)user_data; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1818 GaimConvIm *im; |
4359 | 1819 |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1820 g_return_if_fail(conv != NULL); |
4359 | 1821 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1822 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) |
4359 | 1823 return; |
1824 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1825 im = GAIM_CONV_IM(conv); |
4359 | 1826 |
1827 if (gtk_text_iter_is_start(start_pos) && gtk_text_iter_is_end(end_pos)) { | |
1828 | |
1829 /* We deleted all the text, so turn off typing. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1830 if (gaim_conv_im_get_type_again_timeout(im)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1831 gaim_conv_im_stop_type_again_timeout(im); |
4359 | 1832 |
1833 serv_send_typing(gaim_conversation_get_gc(conv), | |
6695 | 1834 gaim_conversation_get_name(conv), |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
1835 GAIM_NOT_TYPING); |
4359 | 1836 } |
1837 else { | |
1838 /* We're deleting, but not all of it, so it counts as typing. */ | |
1839 got_typing_keypress(conv, FALSE); | |
1840 } | |
1841 } | |
1842 | |
1843 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1844 notebook_init_grab(GaimGtkWindow *gtkwin, GtkWidget *widget) |
4359 | 1845 { |
1846 static GdkCursor *cursor = NULL; | |
1847 | |
1848 gtkwin->in_drag = TRUE; | |
1849 | |
1850 if (gtkwin->drag_leave_signal) { | |
1851 g_signal_handler_disconnect(G_OBJECT(widget), | |
1852 gtkwin->drag_leave_signal); | |
1853 | |
1854 gtkwin->drag_leave_signal = 0; | |
1855 } | |
1856 | |
1857 if (cursor == NULL) | |
1858 cursor = gdk_cursor_new(GDK_FLEUR); | |
1859 | |
1860 /* Grab the pointer */ | |
1861 gtk_grab_add(gtkwin->notebook); | |
5114
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1862 #ifndef _WIN32 |
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1863 /* 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
|
1864 always be true after a button press. */ |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1865 if (!gdk_pointer_is_grabbed()) |
5114
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1866 #endif |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1867 gdk_pointer_grab(gtkwin->notebook->window, FALSE, |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1868 GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1869 NULL, cursor, GDK_CURRENT_TIME); |
4359 | 1870 } |
1871 | |
1872 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1873 notebook_motion_cb(GtkWidget *widget, GdkEventButton *e, GaimConvWindow *win) |
4359 | 1874 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1875 GaimGtkWindow *gtkwin; |
4359 | 1876 |
1877 gtkwin = GAIM_GTK_WINDOW(win); | |
1878 | |
1879 /* | |
1880 * Make sure the user moved the mouse far enough for the | |
1881 * drag to be initiated. | |
1882 */ | |
1883 if (gtkwin->in_predrag) { | |
1884 if (e->x_root < gtkwin->drag_min_x || | |
1885 e->x_root >= gtkwin->drag_max_x || | |
1886 e->y_root < gtkwin->drag_min_y || | |
1887 e->y_root >= gtkwin->drag_max_y) { | |
1888 | |
1889 gtkwin->in_predrag = FALSE; | |
1890 notebook_init_grab(gtkwin, widget); | |
1891 } | |
1892 } | |
1893 else { /* Otherwise, draw the arrows. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1894 GaimConvWindow *dest_win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1895 GaimGtkWindow *dest_gtkwin; |
4359 | 1896 GtkNotebook *dest_notebook; |
1897 GtkWidget *tab, *last_vis_tab = NULL; | |
1898 gint nb_x, nb_y, page_num, i, last_vis_tab_loc = -1; | |
1899 gint arrow1_x, arrow1_y, arrow2_x, arrow2_y; | |
1900 gboolean horiz_tabs = FALSE, tab_found = FALSE; | |
1901 GList *l; | |
1902 | |
1903 /* Get the window that the cursor is over. */ | |
1904 dest_win = gaim_gtkwin_get_at_xy(e->x_root, e->y_root); | |
1905 | |
1906 if (dest_win == NULL) { | |
1907 dnd_hints_hide_all(); | |
1908 | |
1909 return TRUE; | |
1910 } | |
1911 | |
1912 dest_gtkwin = GAIM_GTK_WINDOW(dest_win); | |
1913 | |
1914 dest_notebook = GTK_NOTEBOOK(dest_gtkwin->notebook); | |
1915 | |
1916 gdk_window_get_origin(GTK_WIDGET(dest_notebook)->window, &nb_x, &nb_y); | |
1917 | |
1918 arrow1_x = arrow2_x = nb_x; | |
1919 arrow1_y = arrow2_y = nb_y; | |
1920 | |
1921 page_num = gaim_gtkconv_get_dest_tab_at_xy(dest_win, | |
1922 e->x_root, e->y_root); | |
1923 | |
1924 if (gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_TOP || | |
1925 gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_BOTTOM) { | |
1926 | |
1927 horiz_tabs = TRUE; | |
1928 } | |
1929 | |
1930 /* Find out where to put the arrows. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1931 for (l = gaim_conv_window_get_conversations(dest_win), i = 0; |
4359 | 1932 l != NULL; |
1933 l = l->next, i++) { | |
1934 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1935 GaimConversation *conv = l->data; |
4359 | 1936 |
1937 tab = GAIM_GTK_CONVERSATION(conv)->tabby; | |
1938 | |
1939 /* | |
1940 * If this is the correct tab, record the positions | |
1941 * for the arrows. | |
1942 */ | |
1943 if (i == page_num) { | |
1944 if (horiz_tabs) { | |
1945 arrow1_x = arrow2_x = nb_x + tab->allocation.x; | |
1946 arrow1_y = nb_y + tab->allocation.y; | |
1947 arrow2_y = nb_y + tab->allocation.y + | |
1948 tab->allocation.height; | |
1949 } | |
1950 else { | |
1951 arrow1_x = nb_x + tab->allocation.x; | |
1952 arrow2_x = nb_x + tab->allocation.x + | |
1953 tab->allocation.width; | |
1954 arrow1_y = arrow2_y = nb_y + tab->allocation.y; | |
1955 } | |
1956 | |
1957 tab_found = TRUE; | |
1958 break; | |
1959 } | |
1960 else { /* Keep track of the right-most tab that we see. */ | |
1961 if (horiz_tabs && tab->allocation.x > last_vis_tab_loc) { | |
1962 last_vis_tab = tab; | |
1963 last_vis_tab_loc = tab->allocation.x; | |
1964 } | |
1965 else if (!horiz_tabs && tab->allocation.y > last_vis_tab_loc) { | |
1966 last_vis_tab = tab; | |
1967 last_vis_tab_loc = tab->allocation.y; | |
1968 } | |
1969 } | |
1970 } | |
1971 | |
1972 /* | |
1973 * If we didn't find the tab, then we'll just place the | |
1974 * arrows to the right/bottom of the last visible tab. | |
1975 */ | |
1976 if (!tab_found && last_vis_tab) { | |
1977 if (horiz_tabs) { | |
1978 arrow1_x = arrow2_x = nb_x + last_vis_tab->allocation.x + | |
1979 last_vis_tab->allocation.width; | |
1980 arrow1_y = nb_y + last_vis_tab->allocation.y; | |
1981 arrow2_y = nb_y + last_vis_tab->allocation.y + | |
1982 last_vis_tab->allocation.height; | |
1983 } | |
1984 else { | |
1985 arrow1_x = nb_x + last_vis_tab->allocation.x; | |
1986 arrow2_x = nb_x + last_vis_tab->allocation.x + | |
1987 last_vis_tab->allocation.width; | |
1988 arrow1_y = arrow2_y = nb_y + last_vis_tab->allocation.y + | |
1989 last_vis_tab->allocation.height; | |
1990 } | |
1991 } | |
1992 | |
1993 if (horiz_tabs) { | |
1994 dnd_hints_show(HINT_ARROW_DOWN, arrow1_x, arrow1_y); | |
1995 dnd_hints_show(HINT_ARROW_UP, arrow2_x, arrow2_y); | |
1996 } | |
1997 else { | |
1998 dnd_hints_show(HINT_ARROW_RIGHT, arrow1_x, arrow1_y); | |
1999 dnd_hints_show(HINT_ARROW_LEFT, arrow2_x, arrow2_y); | |
2000 } | |
2001 } | |
2002 | |
2003 return TRUE; | |
2004 } | |
2005 | |
2006 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2007 notebook_leave_cb(GtkWidget *widget, GdkEventCrossing *e, GaimConvWindow *win) |
4359 | 2008 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2009 GaimGtkWindow *gtkwin; |
4359 | 2010 |
2011 gtkwin = GAIM_GTK_WINDOW(win); | |
2012 | |
2013 if (gtkwin->in_drag) | |
2014 return FALSE; | |
2015 | |
2016 if (e->x_root < gtkwin->drag_min_x || | |
2017 e->x_root >= gtkwin->drag_max_x || | |
2018 e->y_root < gtkwin->drag_min_y || | |
2019 e->y_root >= gtkwin->drag_max_y) { | |
2020 | |
2021 gtkwin->in_predrag = FALSE; | |
2022 notebook_init_grab(gtkwin, widget); | |
2023 } | |
2024 | |
2025 return TRUE; | |
2026 } | |
2027 | |
2028 /* | |
2029 * THANK YOU GALEON! | |
2030 */ | |
2031 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2032 notebook_press_cb(GtkWidget *widget, GdkEventButton *e, GaimConvWindow *win) |
4359 | 2033 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2034 GaimGtkWindow *gtkwin; |
4359 | 2035 gint nb_x, nb_y, x_rel, y_rel; |
2036 GList *l; | |
2037 int tab_clicked; | |
2038 | |
2039 if (e->button != 1 || e->type != GDK_BUTTON_PRESS) | |
2040 return FALSE; | |
2041 | |
2042 gtkwin = GAIM_GTK_WINDOW(win); | |
2043 | |
2044 if (gtkwin->in_drag) { | |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
2045 gaim_debug(GAIM_DEBUG_WARNING, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
2046 "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
|
2047 return TRUE; |
4359 | 2048 } |
2049 | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2050 /* |
4359 | 2051 * Make sure a tab was actually clicked. The arrow buttons |
2052 * mess things up. | |
2053 */ | |
2054 tab_clicked = gaim_gtkconv_get_tab_at_xy(win, e->x_root, e->y_root); | |
2055 | |
2056 if (tab_clicked == -1) | |
2057 return FALSE; | |
2058 | |
2059 /* | |
2060 * Get the relative position of the press event, with regards to | |
2061 * the position of the notebook. | |
2062 */ | |
2063 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
2064 | |
2065 x_rel = e->x_root - nb_x; | |
2066 y_rel = e->y_root - nb_y; | |
2067 | |
2068 /* Reset the min/max x/y */ | |
2069 gtkwin->drag_min_x = 0; | |
2070 gtkwin->drag_min_y = 0; | |
2071 gtkwin->drag_max_x = 0; | |
2072 gtkwin->drag_max_y = 0; | |
2073 | |
2074 /* Find out which tab was dragged. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2075 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
|
2076 GaimConversation *conv = l->data; |
4359 | 2077 GtkWidget *tab = GAIM_GTK_CONVERSATION(conv)->tabby; |
2078 | |
2079 if (!GTK_WIDGET_VISIBLE(tab)) | |
2080 continue; | |
2081 | |
2082 if (tab->allocation.x > x_rel || tab->allocation.y > y_rel) | |
2083 break; | |
2084 | |
2085 /* Save the borders of the tab. */ | |
2086 gtkwin->drag_min_x = tab->allocation.x + nb_x; | |
2087 gtkwin->drag_min_y = tab->allocation.y + nb_y; | |
2088 gtkwin->drag_max_x = tab->allocation.width + gtkwin->drag_min_x; | |
2089 gtkwin->drag_max_y = tab->allocation.height + gtkwin->drag_min_y; | |
2090 } | |
2091 | |
2092 /* Make sure the click occurred in the tab. */ | |
2093 if (e->x_root < gtkwin->drag_min_x || | |
2094 e->x_root >= gtkwin->drag_max_x || | |
2095 e->y_root < gtkwin->drag_min_y || | |
2096 e->y_root >= gtkwin->drag_max_y) { | |
2097 | |
2098 return FALSE; | |
2099 } | |
2100 | |
2101 gtkwin->in_predrag = TRUE; | |
2102 | |
2103 /* Connect the new motion signals. */ | |
2104 gtkwin->drag_motion_signal = | |
2105 g_signal_connect(G_OBJECT(widget), "motion_notify_event", | |
2106 G_CALLBACK(notebook_motion_cb), win); | |
2107 | |
2108 gtkwin->drag_leave_signal = | |
2109 g_signal_connect(G_OBJECT(widget), "leave_notify_event", | |
2110 G_CALLBACK(notebook_leave_cb), win); | |
2111 | |
2112 return FALSE; | |
2113 } | |
2114 | |
2115 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2116 notebook_release_cb(GtkWidget *widget, GdkEventButton *e, GaimConvWindow *win) |
4359 | 2117 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2118 GaimConvWindow *dest_win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2119 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2120 GaimGtkWindow *dest_gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2121 GaimConversation *conv; |
4359 | 2122 GtkNotebook *dest_notebook; |
2123 gint dest_page_num; | |
2124 | |
2125 /* | |
2126 * Don't check to make sure that the event's window matches the | |
2127 * widget's, because we may be getting an event passed on from the | |
2128 * close button. | |
2129 */ | |
2130 if (e->button != 1 && e->type != GDK_BUTTON_RELEASE) | |
2131 return FALSE; | |
2132 | |
2133 if (gdk_pointer_is_grabbed()) { | |
2134 gdk_pointer_ungrab(GDK_CURRENT_TIME); | |
2135 gtk_grab_remove(widget); | |
2136 } | |
2137 | |
2138 gtkwin = GAIM_GTK_WINDOW(win); | |
2139 | |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
2140 if (!gtkwin->in_predrag && !gtkwin->in_drag) |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
2141 return FALSE; |
4359 | 2142 |
2143 /* Disconnect the motion signal. */ | |
2144 if (gtkwin->drag_motion_signal) { | |
2145 g_signal_handler_disconnect(G_OBJECT(widget), | |
2146 gtkwin->drag_motion_signal); | |
2147 | |
2148 gtkwin->drag_motion_signal = 0; | |
2149 } | |
2150 | |
2151 /* | |
2152 * If we're in a pre-drag, we'll also need to disconnect the leave | |
2153 * signal. | |
2154 */ | |
2155 if (gtkwin->in_predrag) { | |
2156 gtkwin->in_predrag = FALSE; | |
2157 | |
2158 if (gtkwin->drag_leave_signal) { | |
2159 g_signal_handler_disconnect(G_OBJECT(widget), | |
2160 gtkwin->drag_leave_signal); | |
2161 | |
2162 gtkwin->drag_leave_signal = 0; | |
2163 } | |
2164 } | |
2165 | |
2166 /* If we're not in drag... */ | |
2167 /* We're perfectly normal people! */ | |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
2168 if (!gtkwin->in_drag) |
4359 | 2169 return FALSE; |
2170 | |
2171 gtkwin->in_drag = FALSE; | |
2172 | |
2173 dnd_hints_hide_all(); | |
2174 | |
4369
7e1fb422e5fd
[gaim-migrate @ 4635]
Christian Hammond <chipx86@chipx86.com>
parents:
4368
diff
changeset
|
2175 dest_win = gaim_gtkwin_get_at_xy(e->x_root, e->y_root); |
4359 | 2176 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2177 conv = gaim_conv_window_get_active_conversation(win); |
4359 | 2178 |
2179 if (dest_win == NULL) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2180 if (gaim_conv_window_get_conversation_count(win) < 2) |
4359 | 2181 return FALSE; |
2182 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2183 if (gaim_conv_window_get_conversation_count(win) > 1) { |
4359 | 2184 /* Make a new window to stick this to. */ |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2185 GaimGtkConversation *gtkconv; |
4748
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2186 gint win_width, win_height; |
5121 | 2187 |
2188 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4359 | 2189 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2190 dest_win = gaim_conv_window_new(); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2191 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2192 gaim_conv_window_add_conversation(dest_win, |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2193 gaim_conv_window_remove_conversation(win, |
5139
d0182ae31ab8
[gaim-migrate @ 5503]
Christian Hammond <chipx86@chipx86.com>
parents:
5133
diff
changeset
|
2194 gaim_conversation_get_index(conv))); |
5121 | 2195 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2196 dest_gtkwin = GAIM_GTK_WINDOW(dest_win); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2197 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2198 gtk_window_get_size(GTK_WINDOW(dest_gtkwin->window), |
4748
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2199 &win_width, &win_height); |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2200 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2201 gtk_window_move(GTK_WINDOW(dest_gtkwin->window), |
4748
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2202 e->x_root - (win_width / 2), |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2203 e->y_root - (win_height / 2)); |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2204 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2205 gaim_conv_window_show(dest_win); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2206 } |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2207 } else { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2208 dest_gtkwin = GAIM_GTK_WINDOW(dest_win); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2209 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2210 /* Get the destination notebook. */ |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2211 dest_notebook = GTK_NOTEBOOK(gtkwin->notebook); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2212 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2213 /* Get the destination page number. */ |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2214 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
|
2215 e->x_root, e->y_root); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2216 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2217 if (win == dest_win) { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2218 gaim_conv_window_move_conversation(win, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2219 gaim_conversation_get_index(conv), dest_page_num); |
4359 | 2220 } |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2221 else { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2222 size_t pos; |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2223 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2224 gaim_conv_window_remove_conversation(win, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2225 gaim_conversation_get_index(conv)); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2226 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2227 pos = gaim_conv_window_add_conversation(dest_win, conv); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2228 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2229 if (pos != dest_page_num) |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2230 gaim_conv_window_move_conversation(dest_win, pos, dest_page_num); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2231 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2232 gaim_conv_window_switch_conversation(dest_win, dest_page_num); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2233 } |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2234 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2235 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); |
4359 | 2236 } |
2237 | |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2238 gaim_signal_emit(gaim_gtk_conversations_get_handle(), "conversation-drag-ended", |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2239 win, dest_win); |
4359 | 2240 |
2241 return TRUE; | |
2242 } | |
2243 | |
8189 | 2244 /************************************************************************** |
2245 * A bunch of buddy icon functions | |
2246 **************************************************************************/ | |
2247 static GdkPixbuf * | |
8755
d0364feabf96
[gaim-migrate @ 9510]
Christian Hammond <chipx86@chipx86.com>
parents:
8748
diff
changeset
|
2248 get_tab_icon(GaimConversation *conv, gboolean small_icon) |
7143 | 2249 { |
2250 GaimAccount *account = gaim_conversation_get_account(conv); | |
2251 const char *name = gaim_conversation_get_name(conv); | |
2252 GdkPixbuf *status = NULL; | |
2253 | |
2254 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
2255 GaimBuddy *b = gaim_find_buddy(account, name); | |
2256 if (b != NULL) { | |
2257 status = gaim_gtk_blist_get_status_icon((GaimBlistNode*)b, | |
8755
d0364feabf96
[gaim-migrate @ 9510]
Christian Hammond <chipx86@chipx86.com>
parents:
8748
diff
changeset
|
2258 (small_icon ? GAIM_STATUS_ICON_SMALL : GAIM_STATUS_ICON_LARGE)); |
7143 | 2259 } |
2260 } | |
2261 | |
2262 if (!status) { | |
2263 GdkPixbuf *pixbuf; | |
2264 pixbuf = create_prpl_icon(account); | |
2265 | |
8755
d0364feabf96
[gaim-migrate @ 9510]
Christian Hammond <chipx86@chipx86.com>
parents:
8748
diff
changeset
|
2266 if (small_icon && pixbuf != NULL) |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2267 { |
7143 | 2268 status = gdk_pixbuf_scale_simple(pixbuf, 15, 15, |
2269 GDK_INTERP_BILINEAR); | |
2270 g_object_unref(pixbuf); | |
2271 } | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2272 else |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2273 status = pixbuf; |
7143 | 2274 } |
2275 return status; | |
2276 } | |
2277 | |
8189 | 2278 static void |
2279 update_tab_icon(GaimConversation *conv) | |
2280 { | |
2281 GaimGtkConversation *gtkconv; | |
2282 GaimConvWindow *win = gaim_conversation_get_window(conv); | |
2283 GaimAccount *account; | |
2284 const char *name; | |
2285 GdkPixbuf *status = NULL; | |
2286 | |
2287 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2288 name = gaim_conversation_get_name(conv); | |
2289 account = gaim_conversation_get_account(conv); | |
2290 | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2291 status = get_tab_icon(conv, TRUE); |
8189 | 2292 |
2293 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->icon), status); | |
2294 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->menu_icon), status); | |
2295 | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2296 if (status != NULL) |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2297 g_object_unref(status); |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2298 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2299 if (gaim_conv_window_get_active_conversation(win) == conv && |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2300 gtkconv->u.im->anim == NULL) |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2301 { |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2302 status = get_tab_icon(conv, FALSE); |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2303 |
8189 | 2304 gtk_window_set_icon(GTK_WINDOW(GAIM_GTK_WINDOW(win)->window), status); |
2305 | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2306 if (status != NULL) |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2307 g_object_unref(status); |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2308 } |
8189 | 2309 } |
2310 | |
9318 | 2311 static void |
2312 get_icon_scale_size(GdkPixbufAnimation *icon, GaimBuddyIconSpec *spec, int *width, int *height) | |
2313 { | |
2314 *width = gdk_pixbuf_animation_get_width(icon); | |
2315 *height = gdk_pixbuf_animation_get_height(icon); | |
2316 | |
2317 /* this should eventually get smarter about preserving the aspect | |
2318 * ratio when scaling, but gimmie a break, I just woke up */ | |
2319 if(spec && spec->scale_rules & GAIM_ICON_SCALE_DISPLAY) { | |
2320 if(*width < spec->min_width) | |
2321 *width = spec->min_width; | |
2322 else if(*width > spec->max_width) | |
2323 *width = spec->max_width; | |
2324 | |
2325 if(*height < spec->min_height) | |
2326 *height = spec->min_height; | |
9319 | 2327 else if(*height > spec->max_height) |
9318 | 2328 *height = spec->max_height; |
2329 } | |
2330 | |
2331 /* and now for some arbitrary sanity checks */ | |
2332 if(*width > 100) | |
2333 *width = 100; | |
2334 if(*height > 100) | |
2335 *height = 100; | |
2336 } | |
2337 | |
8189 | 2338 static gboolean |
2339 redraw_icon(gpointer data) | |
2340 { | |
2341 GaimConversation *conv = (GaimConversation *)data; | |
2342 GaimGtkConversation *gtkconv; | |
9318 | 2343 GaimAccount *account; |
2344 GaimPluginProtocolInfo *prpl_info = NULL; | |
8189 | 2345 |
2346 GdkPixbuf *buf; | |
2347 GdkPixbuf *scale; | |
2348 GdkPixmap *pm; | |
2349 GdkBitmap *bm; | |
2350 gint delay; | |
9318 | 2351 int scale_width, scale_height; |
8189 | 2352 |
2353 if (!g_list_find(gaim_get_ims(), conv)) { | |
2354 gaim_debug(GAIM_DEBUG_WARNING, "gtkconv", | |
2355 "Conversation not found in redraw_icon. I think this " | |
2356 "is a bug.\n"); | |
2357 return FALSE; | |
2358 } | |
2359 | |
2360 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
9318 | 2361 account = gaim_conversation_get_account(conv); |
2362 if(account && account->gc) | |
2363 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl); | |
8189 | 2364 |
2365 gdk_pixbuf_animation_iter_advance(gtkconv->u.im->iter, NULL); | |
2366 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); | |
2367 | |
9318 | 2368 get_icon_scale_size(gtkconv->u.im->anim, prpl_info ? &prpl_info->icon_spec : |
2369 NULL, &scale_width, &scale_height); | |
2370 | |
2371 /* this code is ugly, and scares me */ | |
8189 | 2372 scale = gdk_pixbuf_scale_simple(buf, |
9318 | 2373 MAX(gdk_pixbuf_get_width(buf) * scale_width / |
8189 | 2374 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), |
9318 | 2375 MAX(gdk_pixbuf_get_height(buf) * scale_height / |
8189 | 2376 gdk_pixbuf_animation_get_height(gtkconv->u.im->anim), 1), |
2377 GDK_INTERP_NEAREST); | |
2378 | |
2379 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); | |
2380 g_object_unref(G_OBJECT(scale)); | |
2381 gtk_image_set_from_pixmap(GTK_IMAGE(gtkconv->u.im->icon), pm, bm); | |
2382 g_object_unref(G_OBJECT(pm)); | |
2383 gtk_widget_queue_draw(gtkconv->u.im->icon); | |
2384 | |
2385 if (bm) | |
2386 g_object_unref(G_OBJECT(bm)); | |
2387 | |
9131 | 2388 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter); |
2389 if (delay <= 0) | |
2390 delay = 100; | |
2391 | |
2392 gtkconv->u.im->icon_timer = g_timeout_add(delay, redraw_icon, conv); | |
8189 | 2393 |
2394 return FALSE; | |
2395 } | |
2396 | |
2397 static void | |
2398 start_anim(GtkObject *obj, GaimConversation *conv) | |
2399 { | |
2400 GaimGtkConversation *gtkconv; | |
2401 int delay; | |
2402 | |
2403 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
2404 return; | |
2405 | |
2406 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2407 | |
8228 | 2408 if (gtkconv->u.im->anim == NULL) |
2409 return; | |
2410 | |
8202 | 2411 if (gtkconv->u.im->icon_timer != 0) |
2412 return; | |
2413 | |
8189 | 2414 if (gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim)) |
2415 return; | |
2416 | |
2417 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter) / 10; | |
2418 | |
8758 | 2419 gtkconv->u.im->icon_timer = g_timeout_add(delay * 10, redraw_icon, conv); |
8189 | 2420 } |
2421 | |
2422 static void | |
2423 stop_anim(GtkObject *obj, GaimConversation *conv) | |
2424 { | |
2425 GaimGtkConversation *gtkconv; | |
2426 | |
2427 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
2428 return; | |
2429 | |
2430 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2431 | |
2432 if (gtkconv->u.im->icon_timer != 0) | |
2433 g_source_remove(gtkconv->u.im->icon_timer); | |
2434 | |
2435 gtkconv->u.im->icon_timer = 0; | |
2436 } | |
2437 | |
2438 static void | |
2439 toggle_icon_animate_cb(GtkWidget *w, GaimConversation *conv) | |
2440 { | |
2441 GaimGtkConversation *gtkconv; | |
2442 | |
2443 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
2444 return; | |
2445 | |
2446 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2447 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2448 gtkconv->u.im->animate = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2449 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w)); |
8189 | 2450 |
2451 if (gtkconv->u.im->animate) | |
2452 start_anim(NULL, conv); | |
2453 else | |
2454 stop_anim(NULL, conv); | |
2455 } | |
2456 static void | |
2457 remove_icon(GaimGtkConversation *gtkconv) | |
2458 { | |
2459 g_return_if_fail(gtkconv != NULL); | |
2460 | |
2461 if (gtkconv->u.im->icon != NULL) | |
8821 | 2462 gtk_widget_destroy(gtkconv->u.im->icon->parent->parent->parent); |
8189 | 2463 |
2464 if (gtkconv->u.im->anim != NULL) | |
2465 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); | |
2466 | |
2467 if (gtkconv->u.im->icon_timer != 0) | |
2468 g_source_remove(gtkconv->u.im->icon_timer); | |
2469 | |
2470 if (gtkconv->u.im->iter != NULL) | |
2471 g_object_unref(G_OBJECT(gtkconv->u.im->iter)); | |
2472 | |
2473 gtkconv->u.im->icon_timer = 0; | |
2474 gtkconv->u.im->icon = NULL; | |
2475 gtkconv->u.im->anim = NULL; | |
2476 gtkconv->u.im->iter = NULL; | |
2477 } | |
2478 | |
9497 | 2479 static void |
9504 | 2480 saveicon_writefile_cb(void *user_data, const char *filename) |
9497 | 2481 { |
9504 | 2482 GaimConversation *conv = (GaimConversation *)user_data; |
9497 | 2483 FILE *fp; |
2484 GaimBuddyIcon *icon; | |
2485 const void *data; | |
2486 size_t len; | |
2487 | |
2488 if ((fp = fopen(filename, "wb")) == NULL) { | |
9504 | 2489 gaim_notify_error(conv, NULL, _("Unable to open file."), NULL); |
9497 | 2490 return; |
2491 } | |
2492 | |
2493 icon = gaim_conv_im_get_icon(GAIM_CONV_IM(conv)); | |
2494 data = gaim_buddy_icon_get_data(icon, &len); | |
2495 | |
2496 if ((len <= 0) || (data == NULL)) { | |
9504 | 2497 gaim_notify_error(conv, NULL, _("Unable to save icon file to disk."), NULL); |
9497 | 2498 return; |
2499 } | |
2500 | |
2501 fwrite(data, 1, len, fp); | |
2502 fclose(fp); | |
2503 } | |
2504 | |
2505 static void | |
2506 icon_menu_save_cb(GtkWidget *widget, GaimConversation *conv) | |
2507 { | |
2508 gchar *buf; | |
2509 | |
2510 g_return_if_fail(conv != NULL); | |
9504 | 2511 |
9497 | 2512 buf = g_strdup_printf("%s.icon", gaim_normalize(conv->account, conv->name)); |
9504 | 2513 |
2514 gaim_request_file(conv, _("Save Icon"), buf, TRUE, | |
2515 G_CALLBACK(saveicon_writefile_cb), NULL, conv); | |
9497 | 2516 |
2517 g_free(buf); | |
2518 } | |
2519 | |
8189 | 2520 static gboolean |
2521 icon_menu(GtkObject *obj, GdkEventButton *e, GaimConversation *conv) | |
2522 { | |
2523 GaimGtkConversation *gtkconv; | |
2524 static GtkWidget *menu = NULL; | |
2525 GtkWidget *button; | |
2526 | |
2527 if (e->button != 3 || e->type != GDK_BUTTON_PRESS) | |
2528 return FALSE; | |
2529 | |
2530 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2531 | |
2532 /* | |
2533 * If a menu already exists, destroy it before creating a new one, | |
2534 * thus freeing-up the memory it occupied. | |
2535 */ | |
2536 if (menu != NULL) | |
2537 gtk_widget_destroy(menu); | |
2538 | |
2539 menu = gtk_menu_new(); | |
2540 | |
2541 if (gtkconv->u.im->anim && | |
2542 !(gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim))) | |
2543 { | |
2544 gaim_new_check_item(menu, _("Animate"), | |
2545 G_CALLBACK(toggle_icon_animate_cb), conv, | |
2546 gtkconv->u.im->icon_timer); | |
2547 } | |
2548 | |
2549 button = gtk_menu_item_new_with_label(_("Hide Icon")); | |
2550 g_signal_connect_swapped(G_OBJECT(button), "activate", | |
2551 G_CALLBACK(remove_icon), gtkconv); | |
2552 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
2553 gtk_widget_show(button); | |
2554 | |
2555 gaim_new_item_from_stock(menu, _("Save Icon As..."), GTK_STOCK_SAVE_AS, | |
9497 | 2556 G_CALLBACK(icon_menu_save_cb), conv, |
8189 | 2557 0, 0, NULL); |
2558 | |
2559 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, e->button, e->time); | |
2560 | |
2561 return TRUE; | |
2562 } | |
2563 /************************************************************************** | |
2564 * End of the bunch of buddy icon functions | |
2565 **************************************************************************/ | |
2566 | |
7887 | 2567 /* |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2568 * 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
|
2569 * sensitive/insensitive. This is called after changing tabs and when an |
7887 | 2570 * account signs on or off. |
2571 */ | |
4359 | 2572 static void |
7887 | 2573 gray_stuff_out(GaimConversation *conv) |
4359 | 2574 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2575 GaimConvWindow *win; |
7887 | 2576 GaimGtkWindow *gtkwin; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2577 GaimGtkConversation *gtkconv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2578 GaimConnection *gc; |
7887 | 2579 GaimPluginProtocolInfo *prpl_info = NULL; |
7222 | 2580 GdkPixbuf *window_icon = NULL; |
8439 | 2581 GtkIMHtmlButtons buttons; |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2582 |
7887 | 2583 win = gaim_conversation_get_window(conv); |
4359 | 2584 gtkwin = GAIM_GTK_WINDOW(win); |
2585 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7887 | 2586 gc = gaim_conversation_get_gc(conv); |
8439 | 2587 |
7879 | 2588 if (gc != NULL) |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
2589 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2590 |
7887 | 2591 if (gtkwin->menu.send_as != NULL) |
2592 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); | |
2593 | |
2594 /* | |
2595 * 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
|
2596 * 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
|
2597 * conversations. Stuff that Gaim chats support in general should be |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2598 * shown for chat conversations. It doesn't matter whether the PRPL |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2599 * supports it or not--that only affects if the button or menu item |
7929 | 2600 * is sensitive or not. |
7887 | 2601 */ |
4359 | 2602 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
7887 | 2603 /* Show stuff that applies to IMs, hide stuff that applies to chats */ |
2604 | |
2605 /* Deal with buttons */ | |
2606 gtk_widget_show(gtkconv->info); | |
2607 gtk_widget_show(gtkconv->send); | |
2608 gtk_widget_show(gtkconv->u.im->warn); | |
2609 gtk_widget_show(gtkconv->u.im->block); | |
9468 | 2610 gtk_widget_show(gtkconv->u.im->send_file); |
7887 | 2611 |
2612 /* Deal with menu items */ | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2613 gtk_widget_show(gtkwin->menu.view_log); |
9468 | 2614 gtk_widget_show(gtkwin->menu.send_file); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2615 gtk_widget_show(gtkwin->menu.add_pounce); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2616 gtk_widget_show(gtkwin->menu.get_info); |
7887 | 2617 gtk_widget_show(gtkwin->menu.warn); |
7859 | 2618 gtk_widget_hide(gtkwin->menu.invite); |
7887 | 2619 gtk_widget_show(gtkwin->menu.alias); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2620 gtk_widget_show(gtkwin->menu.block); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2621 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2622 if (gaim_find_buddy(gaim_conversation_get_account(conv), |
7143 | 2623 gaim_conversation_get_name(conv)) == NULL) { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2624 gtk_widget_show(gtkwin->menu.add); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2625 gtk_widget_hide(gtkwin->menu.remove); |
7929 | 2626 gtk_widget_show(gtkconv->add); |
2627 gtk_widget_hide(gtkconv->remove); | |
7859 | 2628 } else { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2629 gtk_widget_show(gtkwin->menu.remove); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2630 gtk_widget_hide(gtkwin->menu.add); |
7929 | 2631 gtk_widget_hide(gtkconv->add); |
2632 gtk_widget_show(gtkconv->remove); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2633 } |
7887 | 2634 |
2635 gtk_widget_show(gtkwin->menu.insert_link); | |
9287 | 2636 gtk_widget_show(gtkwin->menu.insert_image); |
7887 | 2637 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
9470 | 2638 /* Show stuff that applies to Chats, hide stuff that applies to IMs */ |
7887 | 2639 |
2640 /* Deal with buttons */ | |
7952 | 2641 gtk_widget_show(gtkconv->info); |
7887 | 2642 gtk_widget_show(gtkconv->send); |
2643 gtk_widget_show(gtkconv->u.chat->invite); | |
2644 | |
2645 /* Deal with menu items */ | |
7859 | 2646 gtk_widget_hide(gtkwin->menu.view_log); |
9468 | 2647 gtk_widget_hide(gtkwin->menu.send_file); |
7859 | 2648 gtk_widget_hide(gtkwin->menu.add_pounce); |
2649 gtk_widget_hide(gtkwin->menu.get_info); | |
7887 | 2650 gtk_widget_hide(gtkwin->menu.warn); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2651 gtk_widget_show(gtkwin->menu.invite); |
7887 | 2652 gtk_widget_show(gtkwin->menu.alias); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2653 gtk_widget_hide(gtkwin->menu.block); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2654 |
7879 | 2655 if (gaim_blist_find_chat(gaim_conversation_get_account(conv), |
2656 gaim_conversation_get_name(conv)) == NULL) { | |
9470 | 2657 /* If the chat is NOT in the buddy list */ |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2658 gtk_widget_show(gtkwin->menu.add); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2659 gtk_widget_hide(gtkwin->menu.remove); |
7929 | 2660 gtk_widget_show(gtkconv->add); |
2661 gtk_widget_hide(gtkconv->remove); | |
7859 | 2662 } else { |
9470 | 2663 /* If the chat IS in the buddy list */ |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2664 gtk_widget_show(gtkwin->menu.remove); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2665 gtk_widget_hide(gtkwin->menu.add); |
7929 | 2666 gtk_widget_hide(gtkconv->add); |
2667 gtk_widget_show(gtkconv->remove); | |
7887 | 2668 } |
2669 | |
2670 gtk_widget_show(gtkwin->menu.insert_link); | |
2671 gtk_widget_hide(gtkwin->menu.insert_image); | |
2672 } | |
2673 | |
2674 /* | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2675 * Handle graying stuff out based on whether an account is connected |
7887 | 2676 * and what features that account supports. |
2677 */ | |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
2678 if ((gc != NULL) && |
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
2679 ( (gaim_conversation_get_type(conv) != GAIM_CONV_CHAT) || |
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
2680 !gaim_conv_chat_has_left(GAIM_CONV_CHAT(conv)) )) { |
7887 | 2681 /* Account is online */ |
2682 | |
2683 /* Deal with buttons */ | |
7929 | 2684 gtk_widget_set_sensitive(gtkconv->add, TRUE); |
2685 gtk_widget_set_sensitive(gtkconv->remove, TRUE); | |
7887 | 2686 gtk_widget_set_sensitive(gtkconv->info, (prpl_info->get_info != NULL)); |
7929 | 2687 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2688 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2689 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2690 gtk_widget_set_sensitive(gtkconv->send, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2691 (prpl_info->send_im != NULL)); |
7887 | 2692 gtk_widget_set_sensitive(gtkconv->u.im->warn, |
2693 (prpl_info->warn != NULL)); | |
2694 gtk_widget_set_sensitive(gtkconv->u.im->block, | |
2695 (prpl_info->add_deny != NULL)); | |
9468 | 2696 gtk_widget_set_sensitive(gtkconv->u.im->send_file, |
2697 (prpl_info->send_file | |
2698 && (!prpl_info->can_receive_file | |
2699 || 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
|
2700 } |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2701 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2702 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2703 gtk_widget_set_sensitive(gtkconv->send, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2704 (prpl_info->chat_send != NULL)); |
7887 | 2705 gtk_widget_set_sensitive(gtkconv->u.chat->invite, |
2706 (prpl_info->chat_invite != NULL)); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2707 } |
7887 | 2708 |
2709 /* Deal with the toolbar */ | |
8422 | 2710 |
8420 | 2711 if (gc->flags & GAIM_CONNECTION_HTML) { |
8677 | 2712 buttons = GTK_IMHTML_ALL; /* Everything on */ |
8420 | 2713 if (!(prpl_info->options & OPT_PROTO_IM_IMAGE)) |
8422 | 2714 buttons &= ~GTK_IMHTML_IMAGE; |
8420 | 2715 if (gc->flags & GAIM_CONNECTION_NO_BGCOLOR) |
8422 | 2716 buttons &= ~GTK_IMHTML_BACKCOLOR; |
8691
0eb5161ef333
[gaim-migrate @ 9444]
Christian Hammond <chipx86@chipx86.com>
parents:
8690
diff
changeset
|
2717 if (gc->flags & GAIM_CONNECTION_NO_FONTSIZE) { |
0eb5161ef333
[gaim-migrate @ 9444]
Christian Hammond <chipx86@chipx86.com>
parents:
8690
diff
changeset
|
2718 buttons &= ~GTK_IMHTML_GROW; |
0eb5161ef333
[gaim-migrate @ 9444]
Christian Hammond <chipx86@chipx86.com>
parents:
8690
diff
changeset
|
2719 buttons &= ~GTK_IMHTML_SHRINK; |
0eb5161ef333
[gaim-migrate @ 9444]
Christian Hammond <chipx86@chipx86.com>
parents:
8690
diff
changeset
|
2720 } |
9041 | 2721 if (gc->flags & GAIM_CONNECTION_NO_URLDESC) |
2722 buttons &= ~GTK_IMHTML_LINKDESC; | |
8420 | 2723 } else { |
8422 | 2724 buttons = GTK_IMHTML_SMILEY; |
8420 | 2725 } |
2726 gtk_imhtml_set_format_functions(GTK_IMHTML(gtkconv->entry), buttons); | |
8427 | 2727 gtk_imhtmltoolbar_associate_smileys (GTK_IMHTMLTOOLBAR(gtkconv->toolbar), gaim_account_get_protocol_id(gaim_conversation_get_account(conv))); |
8422 | 2728 |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
2729 /* Deal with menu items */ |
7887 | 2730 gtk_widget_set_sensitive(gtkwin->menu.view_log, TRUE); |
2731 gtk_widget_set_sensitive(gtkwin->menu.add_pounce, TRUE); | |
2732 gtk_widget_set_sensitive(gtkwin->menu.get_info, (prpl_info->get_info != NULL)); | |
2733 gtk_widget_set_sensitive(gtkwin->menu.warn, (prpl_info->warn != NULL)); | |
2734 gtk_widget_set_sensitive(gtkwin->menu.invite, | |
2735 (prpl_info->chat_invite != NULL)); | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
2736 |
7887 | 2737 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
9468 | 2738 gtk_widget_set_sensitive(gtkwin->menu.send_file, |
9470 | 2739 (gc && prpl_info->send_file != NULL |
9468 | 2740 && (!prpl_info->can_receive_file |
2741 || prpl_info->can_receive_file(gc, gaim_conversation_get_name(conv))))); | |
7887 | 2742 if (gaim_find_buddy(gaim_conversation_get_account(conv), |
2743 gaim_conversation_get_name(conv)) == NULL) | |
2744 gtk_widget_set_sensitive(gtkwin->menu.alias, FALSE); | |
2745 else | |
2746 gtk_widget_set_sensitive(gtkwin->menu.alias, TRUE); | |
2747 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
2748 if (gaim_blist_find_chat(gaim_conversation_get_account(conv), | |
2749 gaim_conversation_get_name(conv)) == NULL) | |
2750 gtk_widget_set_sensitive(gtkwin->menu.alias, FALSE); | |
2751 else | |
2752 gtk_widget_set_sensitive(gtkwin->menu.alias, TRUE); | |
2753 } | |
2754 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2755 gtk_widget_set_sensitive(gtkwin->menu.block, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2756 (prpl_info->add_deny != NULL)); |
7887 | 2757 gtk_widget_set_sensitive(gtkwin->menu.add, TRUE); |
7859 | 2758 gtk_widget_set_sensitive(gtkwin->menu.remove, TRUE); |
8758 | 2759 gtk_widget_set_sensitive(gtkwin->menu.insert_link, |
2760 gc->flags & GAIM_CONNECTION_HTML); | |
7887 | 2761 gtk_widget_set_sensitive(gtkwin->menu.insert_image, |
2762 (prpl_info->options & OPT_PROTO_IM_IMAGE)); | |
2763 } else { | |
2764 /* Account is offline */ | |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
2765 /* Or it's a chat where we left. */ |
7887 | 2766 |
2767 /* Deal with buttons */ | |
7929 | 2768 gtk_widget_set_sensitive(gtkconv->add, FALSE); |
2769 gtk_widget_set_sensitive(gtkconv->remove, FALSE); | |
7887 | 2770 gtk_widget_set_sensitive(gtkconv->info, FALSE); |
2771 gtk_widget_set_sensitive(gtkconv->send, FALSE); | |
2772 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
2773 gtk_widget_set_sensitive(gtkconv->u.im->warn, FALSE); | |
2774 gtk_widget_set_sensitive(gtkconv->u.im->block, FALSE); | |
9468 | 2775 gtk_widget_set_sensitive(gtkconv->u.im->send_file, FALSE); |
7887 | 2776 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
2777 gtk_widget_set_sensitive(gtkconv->u.chat->invite, FALSE); | |
2778 } | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2779 |
7887 | 2780 /* Then deal with menu items */ |
2781 gtk_widget_set_sensitive(gtkwin->menu.view_log, TRUE); | |
9468 | 2782 gtk_widget_set_sensitive(gtkwin->menu.send_file, FALSE); |
7887 | 2783 gtk_widget_set_sensitive(gtkwin->menu.add_pounce, TRUE); |
2784 gtk_widget_set_sensitive(gtkwin->menu.get_info, FALSE); | |
2785 gtk_widget_set_sensitive(gtkwin->menu.warn, FALSE); | |
2786 gtk_widget_set_sensitive(gtkwin->menu.invite, FALSE); | |
2787 gtk_widget_set_sensitive(gtkwin->menu.alias, FALSE); | |
2788 gtk_widget_set_sensitive(gtkwin->menu.block, FALSE); | |
2789 gtk_widget_set_sensitive(gtkwin->menu.add, FALSE); | |
2790 gtk_widget_set_sensitive(gtkwin->menu.remove, FALSE); | |
7929 | 2791 gtk_widget_set_sensitive(gtkwin->menu.insert_link, TRUE); |
7887 | 2792 gtk_widget_set_sensitive(gtkwin->menu.insert_image, FALSE); |
2793 } | |
2794 | |
2795 /* | |
2796 * Update the window's icon | |
2797 */ | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2798 if ((gaim_conversation_get_type(conv) == GAIM_CONV_IM) && |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2799 (gtkconv->u.im->anim)) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2800 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2801 window_icon = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2802 gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); |
7887 | 2803 g_object_ref(window_icon); |
2804 } else { | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2805 window_icon = get_tab_icon(conv, FALSE); |
4359 | 2806 } |
7887 | 2807 gtk_window_set_icon(GTK_WINDOW(gtkwin->window), window_icon); |
2808 g_object_unref(G_OBJECT(window_icon)); | |
2809 } | |
2810 | |
2811 static void | |
8189 | 2812 before_switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, |
2813 gpointer user_data) | |
2814 { | |
2815 GaimConvWindow *win; | |
2816 GaimConversation *conv; | |
2817 GaimGtkConversation *gtkconv; | |
2818 | |
2819 win = (GaimConvWindow *)user_data; | |
2820 conv = gaim_conv_window_get_active_conversation(win); | |
2821 | |
2822 g_return_if_fail(conv != NULL); | |
2823 | |
8192 | 2824 if (gaim_conversation_get_type(conv) != GAIM_CONV_IM) |
2825 return; | |
2826 | |
8189 | 2827 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2828 | |
2829 stop_anim(NULL, conv); | |
2830 } | |
2831 | |
2832 static void | |
7887 | 2833 switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, |
2834 gpointer user_data) | |
2835 { | |
2836 GaimConvWindow *win; | |
2837 GaimConversation *conv; | |
2838 GaimGtkConversation *gtkconv; | |
2839 GaimGtkWindow *gtkwin; | |
2840 | |
2841 win = (GaimConvWindow *)user_data; | |
2842 conv = gaim_conv_window_get_conversation_at(win, page_num); | |
2843 | |
2844 g_return_if_fail(conv != NULL); | |
2845 | |
2846 gtkwin = GAIM_GTK_WINDOW(win); | |
2847 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2848 | |
2849 gaim_conversation_set_unseen(conv, GAIM_UNSEEN_NONE); | |
2850 | |
2851 /* Update the menubar */ | |
2852 gray_stuff_out(conv); | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2853 |
4736 | 2854 update_typing_icon(conv); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2855 |
4359 | 2856 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.logging), |
7143 | 2857 gaim_conversation_is_logging(conv)); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2858 |
4359 | 2859 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.sounds), |
7143 | 2860 gtkconv->make_sound); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2861 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2862 gtk_check_menu_item_set_active( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2863 GTK_CHECK_MENU_ITEM(gtkwin->menu.show_formatting_toolbar), |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2864 gtkconv->show_formatting_toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2865 |
9188 | 2866 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.show_timestamps), |
2867 gtkconv->show_timestamps); | |
2868 | |
8189 | 2869 /* |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2870 * We pause icons when they are not visible. If this icon should |
9297 | 2871 * be animated then start it back up again. |
8189 | 2872 */ |
8192 | 2873 if ((gaim_conversation_get_type(conv) == GAIM_CONV_IM) && |
2874 (gtkconv->u.im->animate)) | |
8189 | 2875 start_anim(NULL, conv); |
2876 | |
4965 | 2877 gtk_window_set_title(GTK_WINDOW(gtkwin->window), |
7143 | 2878 gtk_label_get_text(GTK_LABEL(gtkconv->tab_label))); |
4359 | 2879 } |
2880 | |
2881 /************************************************************************** | |
2882 * Utility functions | |
2883 **************************************************************************/ | |
2884 | |
2885 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2886 got_typing_keypress(GaimConversation *conv, gboolean first) |
4359 | 2887 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2888 GaimConvIm *im; |
4685 | 2889 |
4359 | 2890 /* |
2891 * 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
|
2892 * send GAIM_TYPED any time soon. |
4359 | 2893 */ |
2894 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2895 im = GAIM_CONV_IM(conv); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2896 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2897 if (gaim_conv_im_get_type_again_timeout(im)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2898 gaim_conv_im_stop_type_again_timeout(im); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2899 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2900 gaim_conv_im_start_type_again_timeout(im); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2901 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2902 if (first || (gaim_conv_im_get_type_again(im) != 0 && |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2903 time(NULL) > gaim_conv_im_get_type_again(im))) { |
4359 | 2904 |
2905 int timeout = serv_send_typing(gaim_conversation_get_gc(conv), | |
2906 (char *)gaim_conversation_get_name(conv), | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
2907 GAIM_TYPING); |
4359 | 2908 |
2909 if (timeout) | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2910 gaim_conv_im_set_type_again(im, time(NULL) + timeout); |
4359 | 2911 else |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2912 gaim_conv_im_set_type_again(im, 0); |
4359 | 2913 } |
2914 } | |
2915 | |
4736 | 2916 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2917 update_typing_icon(GaimConversation *conv) |
4736 | 2918 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2919 GaimGtkWindow *gtkwin; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2920 GaimConvIm *im = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2921 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); |
4736 | 2922 |
2923 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); | |
2924 | |
2925 if(gaim_conversation_get_type(conv) == GAIM_CONV_IM) | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2926 im = GAIM_CONV_IM(conv); |
4736 | 2927 |
2928 if(gtkwin->menu.typing_icon) { | |
2929 gtk_widget_destroy(gtkwin->menu.typing_icon); | |
2930 gtkwin->menu.typing_icon = NULL; | |
2931 } | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2932 if(im && gaim_conv_im_get_typing_state(im) == GAIM_TYPING) { |
4736 | 2933 gtkwin->menu.typing_icon = gtk_image_menu_item_new(); |
2934 gtk_image_menu_item_set_image( | |
2935 GTK_IMAGE_MENU_ITEM(gtkwin->menu.typing_icon), | |
2936 gtk_image_new_from_stock(GAIM_STOCK_TYPING, | |
2937 GTK_ICON_SIZE_MENU)); | |
4757 | 2938 gtk_tooltips_set_tip(gtkconv->tooltips, gtkwin->menu.typing_icon, |
4736 | 2939 _("User is typing..."), NULL); |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2940 } else if(im && gaim_conv_im_get_typing_state(im) == GAIM_TYPED) { |
4736 | 2941 gtkwin->menu.typing_icon = gtk_image_menu_item_new(); |
2942 gtk_image_menu_item_set_image( | |
2943 GTK_IMAGE_MENU_ITEM(gtkwin->menu.typing_icon), | |
2944 gtk_image_new_from_stock(GAIM_STOCK_TYPED, | |
2945 GTK_ICON_SIZE_MENU)); | |
4757 | 2946 gtk_tooltips_set_tip(gtkconv->tooltips, gtkwin->menu.typing_icon, |
4736 | 2947 _("User has typed something and paused"), NULL); |
2948 } | |
2949 | |
2950 if(gtkwin->menu.typing_icon) { | |
2951 gtk_menu_item_set_right_justified( | |
2952 GTK_MENU_ITEM(gtkwin->menu.typing_icon), TRUE); | |
2953 gtk_widget_show_all(gtkwin->menu.typing_icon); | |
2954 gtk_menu_shell_append(GTK_MENU_SHELL(gtkwin->menu.menubar), | |
2955 gtkwin->menu.typing_icon); | |
2956 } | |
2957 } | |
2958 | |
4685 | 2959 static gboolean |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2960 update_send_as_selection(GaimConvWindow *win) |
4359 | 2961 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2962 GaimAccount *account; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2963 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2964 GaimGtkWindow *gtkwin; |
4359 | 2965 GtkWidget *menu; |
2966 GList *child; | |
2967 | |
7090
04f9f7440bc3
[gaim-migrate @ 7655]
Christian Hammond <chipx86@chipx86.com>
parents:
7089
diff
changeset
|
2968 if (g_list_find(gaim_get_windows(), win) == NULL) |
04f9f7440bc3
[gaim-migrate @ 7655]
Christian Hammond <chipx86@chipx86.com>
parents:
7089
diff
changeset
|
2969 return FALSE; |
4849 | 2970 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2971 conv = gaim_conv_window_get_active_conversation(win); |
4359 | 2972 |
5860
52d5fad43950
[gaim-migrate @ 6291]
Christian Hammond <chipx86@chipx86.com>
parents:
5858
diff
changeset
|
2973 if (conv == NULL) |
52d5fad43950
[gaim-migrate @ 6291]
Christian Hammond <chipx86@chipx86.com>
parents:
5858
diff
changeset
|
2974 return FALSE; |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2975 |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2976 account = gaim_conversation_get_account(conv); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2977 gtkwin = GAIM_GTK_WINDOW(win); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2978 |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2979 if (gtkwin->menu.send_as == NULL) |
4685 | 2980 return FALSE; |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2981 |
4359 | 2982 gtk_widget_show(gtkwin->menu.send_as); |
2983 | |
2984 menu = gtk_menu_item_get_submenu( | |
2985 GTK_MENU_ITEM(gtkwin->menu.send_as)); | |
2986 | |
2987 for (child = gtk_container_get_children(GTK_CONTAINER(menu)); | |
2988 child != NULL; | |
2989 child = child->next) { | |
2990 | |
2991 GtkWidget *item = child->data; | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2992 GaimAccount *item_account = g_object_get_data(G_OBJECT(item), |
4673 | 2993 "gaim_account"); |
2994 | |
2995 if (account == item_account) { | |
4359 | 2996 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE); |
2997 break; | |
2998 } | |
2999 } | |
6030
54c37db13279
[gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents:
6016
diff
changeset
|
3000 |
4685 | 3001 return FALSE; |
4359 | 3002 } |
3003 | |
3004 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3005 generate_send_as_items(GaimConvWindow *win, GaimConversation *deleted_conv) |
4359 | 3006 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3007 GaimGtkWindow *gtkwin; |
4359 | 3008 GtkWidget *menu; |
3009 GtkWidget *menuitem; | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3010 GList *gcs; |
4359 | 3011 GList *convs; |
3012 GSList *group = NULL; | |
3013 gboolean first_offline = TRUE; | |
3014 gboolean found_online = FALSE; | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3015 GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
4359 | 3016 |
3017 gtkwin = GAIM_GTK_WINDOW(win); | |
3018 | |
3019 if (gtkwin->menu.send_as != NULL) | |
3020 gtk_widget_destroy(gtkwin->menu.send_as); | |
3021 | |
3022 /* See if we have > 1 connection active. */ | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3023 if (g_list_length(gaim_connections_get_all()) < 2) { |
4359 | 3024 /* Now make sure we don't have any Offline entries. */ |
3025 gboolean found_offline = FALSE; | |
3026 | |
3027 for (convs = gaim_get_conversations(); | |
3028 convs != NULL; | |
3029 convs = convs->next) { | |
3030 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3031 GaimConversation *conv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3032 GaimAccount *account; |
4491 | 3033 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3034 conv = (GaimConversation *)convs->data; |
4491 | 3035 account = gaim_conversation_get_account(conv); |
3036 | |
6495
8ce66049ce68
[gaim-migrate @ 7010]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
3037 if (account != NULL && account->gc == NULL) { |
4359 | 3038 found_offline = TRUE; |
3039 break; | |
3040 } | |
3041 } | |
3042 | |
3043 if (!found_offline) { | |
3044 gtkwin->menu.send_as = NULL; | |
3045 return; | |
3046 } | |
3047 } | |
3048 | |
3049 /* Build the Send As menu */ | |
3050 gtkwin->menu.send_as = gtk_menu_item_new_with_mnemonic(_("_Send As")); | |
3051 gtk_widget_show(gtkwin->menu.send_as); | |
3052 | |
3053 menu = gtk_menu_new(); | |
7857
43f63ff8a6d8
[gaim-migrate @ 8511]
Christian Hammond <chipx86@chipx86.com>
parents:
7855
diff
changeset
|
3054 gtk_menu_shell_insert(GTK_MENU_SHELL(gtkwin->menu.menubar), |
43f63ff8a6d8
[gaim-migrate @ 8511]
Christian Hammond <chipx86@chipx86.com>
parents:
7855
diff
changeset
|
3055 gtkwin->menu.send_as, 2); |
4359 | 3056 gtk_menu_item_set_submenu(GTK_MENU_ITEM(gtkwin->menu.send_as), menu); |
3057 | |
3058 gtk_widget_show(menu); | |
3059 | |
3060 /* Fill it with entries. */ | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3061 for (gcs = gaim_connections_get_all(); gcs != NULL; gcs = gcs->next) { |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3062 |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3063 GaimConnection *gc; |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3064 GaimAccount *account; |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3065 GtkWidget *box; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3066 GtkWidget *label; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3067 GtkWidget *image; |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3068 GdkPixbuf *pixbuf, *scale; |
4359 | 3069 |
3070 found_online = TRUE; | |
3071 | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3072 gc = (GaimConnection *)gcs->data; |
4359 | 3073 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3074 /* Create a pixmap for the protocol icon. */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3075 pixbuf = create_prpl_icon(gc->account); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3076 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
|
3077 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3078 /* Now convert it to GtkImage */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3079 if (pixbuf == NULL) |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3080 image = gtk_image_new(); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3081 else |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3082 image = gtk_image_new_from_pixbuf(scale); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3083 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3084 gtk_size_group_add_widget(sg, image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3085 |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3086 g_object_unref(G_OBJECT(scale)); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3087 g_object_unref(G_OBJECT(pixbuf)); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3088 |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3089 account = gaim_connection_get_account(gc); |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3090 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3091 /* Make our menu item */ |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3092 menuitem = gtk_radio_menu_item_new_with_label(group, |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3093 gaim_account_get_username(account)); |
4793 | 3094 group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem)); |
4359 | 3095 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3096 /* Do some evil, see some evil, speak some evil. */ |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3097 box = gtk_hbox_new(FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3098 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3099 label = gtk_bin_get_child(GTK_BIN(menuitem)); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3100 g_object_ref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3101 gtk_container_remove(GTK_CONTAINER(menuitem), label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3102 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3103 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3104 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 4); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3105 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3106 g_object_unref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3107 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3108 gtk_container_add(GTK_CONTAINER(menuitem), box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3109 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3110 gtk_widget_show(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3111 gtk_widget_show(image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3112 gtk_widget_show(box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3113 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3114 /* Set our data and callbacks. */ |
4359 | 3115 g_object_set_data(G_OBJECT(menuitem), "user_data", win); |
4673 | 3116 g_object_set_data(G_OBJECT(menuitem), "gaim_account", gc->account); |
4359 | 3117 |
4786 | 3118 g_signal_connect(G_OBJECT(menuitem), "activate", |
4673 | 3119 G_CALLBACK(menu_conv_sel_send_cb), NULL); |
4359 | 3120 |
3121 gtk_widget_show(menuitem); | |
3122 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
3123 } | |
3124 | |
3125 /* | |
3126 * Fill it with any accounts that still has an open (yet disabled) window | |
3127 * (signed off accounts with a window open). | |
3128 */ | |
3129 for (convs = gaim_get_conversations(); | |
3130 convs != NULL; | |
3131 convs = convs->next) { | |
3132 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3133 GaimConversation *conv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3134 GaimAccount *account; |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3135 GtkWidget *box; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3136 GtkWidget *label; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3137 GtkWidget *image; |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3138 GdkPixbuf *pixbuf, *scale; |
4359 | 3139 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3140 conv = (GaimConversation *)convs->data; |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3141 |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3142 if (conv == deleted_conv) |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3143 continue; |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3144 |
4491 | 3145 account = gaim_conversation_get_account(conv); |
3146 | |
6495
8ce66049ce68
[gaim-migrate @ 7010]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
3147 if (account != NULL && account->gc == NULL) { |
4359 | 3148 if (first_offline && found_online) { |
3149 menuitem = gtk_separator_menu_item_new(); | |
3150 gtk_widget_show(menuitem); | |
3151 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
3152 | |
3153 first_offline = FALSE; | |
3154 } | |
3155 | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3156 /* Create a pixmap for the protocol icon. */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3157 pixbuf = create_prpl_icon(account); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3158 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3159 GDK_INTERP_BILINEAR); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3160 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3161 /* Now convert it to GtkImage */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3162 if (pixbuf == NULL) |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3163 image = gtk_image_new(); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3164 else |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3165 image = gtk_image_new_from_pixbuf(scale); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3166 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3167 gtk_size_group_add_widget(sg, image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3168 |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3169 if (scale != NULL) g_object_unref(scale); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3170 if (pixbuf != NULL) g_object_unref(pixbuf); |
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 /* Make our menu item */ |
4359 | 3173 menuitem = gtk_radio_menu_item_new_with_label(group, |
4491 | 3174 account->username); |
4793 | 3175 group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem)); |
4359 | 3176 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3177 /* Do some evil, see some evil, speak some evil. */ |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3178 box = gtk_hbox_new(FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3179 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3180 label = gtk_bin_get_child(GTK_BIN(menuitem)); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3181 g_object_ref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3182 gtk_container_remove(GTK_CONTAINER(menuitem), label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3183 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3184 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3185 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 4); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3186 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3187 g_object_unref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3188 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3189 gtk_container_add(GTK_CONTAINER(menuitem), box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3190 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3191 gtk_widget_show(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3192 gtk_widget_show(image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3193 gtk_widget_show(box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3194 |
4359 | 3195 gtk_widget_set_sensitive(menuitem, FALSE); |
4786 | 3196 g_object_set_data(G_OBJECT(menuitem), "user_data", win); |
4674 | 3197 g_object_set_data(G_OBJECT(menuitem), "gaim_account", account); |
4359 | 3198 |
4786 | 3199 g_signal_connect(G_OBJECT(menuitem), "activate", |
5902
6889b89cab90
[gaim-migrate @ 6334]
Christian Hammond <chipx86@chipx86.com>
parents:
5901
diff
changeset
|
3200 G_CALLBACK(menu_conv_sel_send_cb), NULL); |
4786 | 3201 |
4359 | 3202 gtk_widget_show(menuitem); |
3203 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
3204 } | |
3205 } | |
3206 | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3207 g_object_unref(sg); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3208 |
4359 | 3209 gtk_widget_show(gtkwin->menu.send_as); |
3210 update_send_as_selection(win); | |
3211 } | |
3212 | |
3213 static GList * | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3214 generate_invite_user_names(GaimConnection *gc) |
4359 | 3215 { |
6695 | 3216 GaimBlistNode *gnode,*cnode,*bnode; |
4359 | 3217 static GList *tmp = NULL; |
3218 | |
3219 if (tmp) | |
3220 g_list_free(tmp); | |
3221 | |
3222 tmp = g_list_append(NULL, ""); | |
3223 | |
3224 if (gc != NULL) { | |
4785 | 3225 for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { |
3226 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) | |
3227 continue; | |
6695 | 3228 for(cnode = gnode->child; cnode; cnode = cnode->next) { |
3229 if(!GAIM_BLIST_NODE_IS_CONTACT(cnode)) | |
4785 | 3230 continue; |
6695 | 3231 for(bnode = cnode->child; bnode; bnode = bnode->next) { |
3232 GaimBuddy *buddy; | |
3233 | |
3234 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) | |
3235 continue; | |
3236 | |
3237 buddy = (GaimBuddy *)bnode; | |
3238 | |
3239 if (buddy->account == gc->account && | |
3240 GAIM_BUDDY_IS_ONLINE(buddy)) | |
3241 tmp = g_list_append(tmp, buddy->name); | |
3242 } | |
4359 | 3243 } |
3244 } | |
3245 } | |
3246 | |
3247 return tmp; | |
3248 } | |
3249 | |
9498 | 3250 static GdkPixbuf * |
3251 get_chat_user_status_icon(GaimConvChat *chat, const char *name) | |
3252 { | |
3253 GdkPixbuf *pixbuf, *scale; | |
3254 char *filename; | |
3255 | |
3256 /* Eventually this should compose the pixbuf based on user status (op, voice, etc.) | |
3257 * and ignored status and any other fancy things we want to show. For now though, | |
3258 * it's just ignored users that have the privilege of an icon */ | |
3259 | |
3260 if(gaim_conv_chat_is_user_ignored(chat, name)) { | |
3261 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", "ignored.svg", NULL); | |
3262 pixbuf = gdk_pixbuf_new_from_file(filename, NULL); | |
3263 g_free(filename); | |
3264 if (!pixbuf) | |
3265 return NULL; | |
3266 scale = gdk_pixbuf_scale_simple(pixbuf, 15, 15, GDK_INTERP_BILINEAR); | |
3267 g_object_unref(pixbuf); | |
3268 return scale; | |
3269 } | |
3270 | |
3271 return NULL; | |
3272 } | |
3273 | |
4359 | 3274 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3275 add_chat_buddy_common(GaimConversation *conv, const char *name, int pos) |
4359 | 3276 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3277 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3278 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3279 GaimConvChat *chat; |
4359 | 3280 GtkTreeIter iter; |
3281 GtkListStore *ls; | |
9498 | 3282 GdkPixbuf *pixbuf; |
4359 | 3283 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3284 chat = GAIM_CONV_CHAT(conv); |
4359 | 3285 gtkconv = GAIM_GTK_CONVERSATION(conv); |
3286 gtkchat = gtkconv->u.chat; | |
3287 | |
3288 ls = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list))); | |
3289 | |
9498 | 3290 pixbuf = get_chat_user_status_icon(chat, name); |
3291 | |
4359 | 3292 gtk_list_store_append(ls, &iter); |
9498 | 3293 gtk_list_store_set(ls, &iter, CHAT_USERS_ICON_COLUMN, pixbuf, |
3294 CHAT_USERS_NAME_COLUMN, name, -1); | |
3295 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), CHAT_USERS_NAME_COLUMN, | |
4359 | 3296 GTK_SORT_ASCENDING); |
3297 } | |
3298 | |
3299 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3300 tab_complete(GaimConversation *conv) |
4359 | 3301 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3302 GaimGtkConversation *gtkconv; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3303 GaimConvChat *chat; |
4359 | 3304 GtkTextIter cursor, word_start, start_buffer; |
3305 int start; | |
3306 int most_matched = -1; | |
3307 char *entered, *partial = NULL; | |
3308 char *text; | |
8021 | 3309 char *nick_partial; |
4359 | 3310 GList *matches = NULL; |
3311 GList *nicks = NULL; | |
3312 | |
3313 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3314 chat = GAIM_CONV_CHAT(conv); |
4359 | 3315 |
3316 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_buffer); | |
3317 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, | |
3318 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
3319 | |
3320 word_start = cursor; | |
3321 | |
3322 /* if there's nothing there just return */ | |
3323 if (!gtk_text_iter_compare(&cursor, &start_buffer)) | |
3324 return; | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
3325 |
4359 | 3326 text = gtk_text_buffer_get_text(gtkconv->entry_buffer, &start_buffer, |
3327 &cursor, FALSE); | |
3328 | |
3329 /* if we're at the end of ": " we need to move back 2 spaces */ | |
3330 start = strlen(text) - 1; | |
3331 | |
8021 | 3332 if (strlen(text) >= 2 && !strncmp(&text[start-1], ": ", 2)) { |
4359 | 3333 gtk_text_iter_backward_chars(&word_start, 2); |
8021 | 3334 start-=2; |
3335 } | |
4359 | 3336 |
3337 /* find the start of the word that we're tabbing */ | |
3338 while (start >= 0 && text[start] != ' ') { | |
3339 gtk_text_iter_backward_char(&word_start); | |
3340 start--; | |
3341 } | |
3342 | |
3343 g_free(text); | |
3344 | |
3345 entered = gtk_text_buffer_get_text(gtkconv->entry_buffer, &word_start, | |
3346 &cursor, FALSE); | |
3347 | |
8021 | 3348 if (!g_utf8_strlen(entered, -1)) { |
4359 | 3349 g_free(entered); |
3350 return; | |
3351 } | |
3352 | |
8021 | 3353 nick_partial = g_malloc(strlen(entered)+1); |
3354 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3355 for (nicks = gaim_conv_chat_get_users(chat); |
4359 | 3356 nicks != NULL; |
3357 nicks = nicks->next) { | |
3358 | |
3359 char *nick = nicks->data; | |
8021 | 3360 |
8159 | 3361 strncpy(nick_partial, nick, strlen(entered)); |
8172 | 3362 nick_partial[strlen(entered)] = '\0'; |
8021 | 3363 if(gaim_utf8_strcasecmp(nick_partial, entered)) |
3364 continue; | |
4359 | 3365 |
3366 /* if we're here, it's a possible completion */ | |
3367 | |
3368 if (most_matched == -1) { | |
3369 /* | |
3370 * this will only get called once, since from now | |
3371 * on most_matched is >= 0 | |
3372 */ | |
3373 most_matched = strlen(nick); | |
3374 partial = g_strdup(nick); | |
3375 } | |
3376 else if (most_matched) { | |
8021 | 3377 char *tmp = g_strdup(nick); |
3378 | |
3379 while (gaim_utf8_strcasecmp(tmp, partial)) { | |
3380 partial[most_matched] = '\0'; | |
3381 if(most_matched < strlen(tmp)) | |
3382 tmp[most_matched] = '\0'; | |
4359 | 3383 most_matched--; |
8021 | 3384 } |
8079 | 3385 most_matched++; |
8021 | 3386 |
3387 g_free(tmp); | |
4359 | 3388 } |
3389 | |
3390 matches = g_list_append(matches, nick); | |
3391 } | |
3392 | |
8021 | 3393 g_free(nick_partial); |
3394 | |
4359 | 3395 /* we're only here if we're doing new style */ |
3396 | |
3397 /* if there weren't any matches, return */ | |
3398 if (!matches) { | |
3399 /* if matches isn't set partials won't be either */ | |
3400 g_free(entered); | |
3401 return; | |
3402 } | |
3403 | |
3404 gtk_text_buffer_delete(gtkconv->entry_buffer, &word_start, &cursor); | |
3405 | |
3406 if (!matches->next) { | |
3407 /* there was only one match. fill it in. */ | |
3408 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_buffer); | |
3409 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, | |
3410 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
3411 | |
3412 if (!gtk_text_iter_compare(&cursor, &start_buffer)) { | |
3413 char *tmp = g_strdup_printf("%s: ", (char *)matches->data); | |
3414 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, tmp, -1); | |
3415 g_free(tmp); | |
3416 } | |
3417 else | |
3418 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, | |
3419 matches->data, -1); | |
3420 | |
3421 matches = g_list_remove(matches, matches->data); | |
3422 } | |
3423 else { | |
3424 /* | |
3425 * there were lots of matches, fill in as much as possible | |
3426 * and display all of them | |
3427 */ | |
3428 char *addthis = g_malloc0(1); | |
3429 | |
3430 while (matches) { | |
3431 char *tmp = addthis; | |
3432 addthis = g_strconcat(tmp, matches->data, " ", NULL); | |
3433 g_free(tmp); | |
3434 matches = g_list_remove(matches, matches->data); | |
3435 } | |
3436 | |
6982 | 3437 gaim_conversation_write(conv, NULL, addthis, GAIM_MESSAGE_NO_LOG, |
4359 | 3438 time(NULL)); |
3439 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, partial, -1); | |
3440 g_free(addthis); | |
3441 } | |
3442 | |
3443 g_free(entered); | |
3444 g_free(partial); | |
3445 } | |
3446 | |
3447 static GtkItemFactoryEntry menu_items[] = | |
3448 { | |
3449 /* Conversation menu */ | |
4596 | 3450 { N_("/_Conversation"), NULL, NULL, 0, "<Branch>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3451 |
7887 | 3452 { N_("/Conversation/New Instant _Message..."), "<CTL>M", menu_new_conv_cb, |
7859 | 3453 0, "<StockItem>", GAIM_STOCK_IM }, |
3454 | |
3455 { "/Conversation/sep0", NULL, NULL, 0, "<Separator>" }, | |
3456 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3457 { N_("/Conversation/_Find..."), NULL, menu_find_cb, 0, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3458 "<StockItem>", GTK_STOCK_FIND }, |
7859 | 3459 { N_("/Conversation/View _Log"), NULL, menu_view_log_cb, 0, NULL }, |
4596 | 3460 { N_("/Conversation/_Save As..."), NULL, menu_save_as_cb, 0, |
4359 | 3461 "<StockItem>", GTK_STOCK_SAVE_AS }, |
8974 | 3462 { 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
|
3463 |
4359 | 3464 { "/Conversation/sep1", NULL, NULL, 0, "<Separator>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3465 |
9468 | 3466 { 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
|
3467 { N_("/Conversation/Add Buddy _Pounce..."), NULL, menu_add_pounce_cb, |
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
3468 0, NULL }, |
7859 | 3469 { N_("/Conversation/_Get Info"), NULL, menu_get_info_cb, 0, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3470 "<StockItem>", GAIM_STOCK_INFO }, |
7859 | 3471 { N_("/Conversation/_Warn..."), NULL, menu_warn_cb, 0, |
3472 "<StockItem>", GAIM_STOCK_WARN }, | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3473 { N_("/Conversation/In_vite..."), NULL, menu_invite_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3474 "<StockItem>", GAIM_STOCK_INVITE }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3475 |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
3476 { "/Conversation/sep2", NULL, NULL, 0, "<Separator>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3477 |
7859 | 3478 { N_("/Conversation/A_lias..."), NULL, menu_alias_cb, 0, |
3479 "<StockItem>", GAIM_STOCK_EDIT }, | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3480 { N_("/Conversation/_Block..."), NULL, menu_block_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3481 "<StockItem>", GAIM_STOCK_BLOCK }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3482 { N_("/Conversation/_Add..."), NULL, menu_add_remove_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3483 "<StockItem>", GTK_STOCK_ADD }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3484 { N_("/Conversation/_Remove..."), NULL, menu_add_remove_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3485 "<StockItem>", GTK_STOCK_REMOVE }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3486 |
7859 | 3487 { "/Conversation/sep3", NULL, NULL, 0, "<Separator>" }, |
3488 | |
8756 | 3489 { N_("/Conversation/Insert Lin_k..."), NULL, menu_insert_link_cb, 0, |
7859 | 3490 "<StockItem>", GAIM_STOCK_LINK }, |
9287 | 3491 { N_("/Conversation/Insert Imag_e..."), NULL, menu_insert_image_cb, 0, |
7859 | 3492 "<StockItem>", GAIM_STOCK_IMAGE }, |
3493 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3494 { "/Conversation/sep4", NULL, NULL, 0, "<Separator>" }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3495 |
4596 | 3496 { N_("/Conversation/_Close"), NULL, menu_close_conv_cb, 0, |
4359 | 3497 "<StockItem>", GTK_STOCK_CLOSE }, |
3498 | |
3499 /* Options */ | |
4596 | 3500 { N_("/_Options"), NULL, NULL, 0, "<Branch>" }, |
3501 { N_("/Options/Enable _Logging"), NULL, menu_logging_cb, 0, "<CheckItem>" }, | |
3502 { N_("/Options/Enable _Sounds"), NULL, menu_sounds_cb, 0, "<CheckItem>" }, | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3503 { N_("/Options/Show Formatting _Toolbar"), NULL, menu_toolbar_cb, 0, "<CheckItem>" }, |
9188 | 3504 { N_("/Options/Show T_imestamps"), "F2", menu_timestamps_cb, 0, "<CheckItem>" }, |
4359 | 3505 }; |
3506 | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
3507 static const int menu_item_count = |
4359 | 3508 sizeof(menu_items) / sizeof(*menu_items); |
3509 | |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3510 static char * |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3511 item_factory_translate_func (const char *path, gpointer func_data) |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3512 { |
7386 | 3513 return _((char *)path); |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3514 } |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3515 |
4359 | 3516 static GtkWidget * |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3517 setup_menubar(GaimConvWindow *win) |
4359 | 3518 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3519 GaimGtkWindow *gtkwin; |
5116 | 3520 GtkAccelGroup *accel_group; |
4359 | 3521 gtkwin = GAIM_GTK_WINDOW(win); |
3522 | |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
3523 accel_group = gtk_accel_group_new (); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
3524 gtk_window_add_accel_group (GTK_WINDOW (gtkwin->window), accel_group); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
3525 g_object_unref (accel_group); |
5116 | 3526 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3527 gtkwin->menu.item_factory = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3528 gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<main>", accel_group); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3529 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3530 gtk_item_factory_set_translate_func(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3531 item_factory_translate_func, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3532 NULL, NULL); |
4630 | 3533 |
3534 gtk_item_factory_create_items(gtkwin->menu.item_factory, menu_item_count, | |
4359 | 3535 menu_items, win); |
7420 | 3536 g_signal_connect(G_OBJECT(accel_group), "accel-changed", |
3537 G_CALLBACK(gaim_gtk_save_accels_cb), NULL); | |
4359 | 3538 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3539 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3540 gtkwin->menu.menubar = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3541 gtk_item_factory_get_widget(gtkwin->menu.item_factory, "<main>"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3542 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3543 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3544 gtkwin->menu.view_log = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3545 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
7295 | 3546 N_("/Conversation/View Log")); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3547 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3548 |
9468 | 3549 gtkwin->menu.send_file = |
3550 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3551 N_("/Conversation/Send File...")); | |
9498 | 3552 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3553 gtkwin->menu.add_pounce = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3554 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3555 N_("/Conversation/Add Buddy Pounce...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3556 |
7879 | 3557 /* --- */ |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3558 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3559 gtkwin->menu.get_info = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3560 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
7859 | 3561 N_("/Conversation/Get Info")); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3562 |
7879 | 3563 gtkwin->menu.warn = |
3564 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3565 N_("/Conversation/Warn...")); | |
3566 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3567 gtkwin->menu.invite = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3568 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3569 N_("/Conversation/Invite...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3570 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3571 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3572 |
7879 | 3573 gtkwin->menu.alias = |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3574 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
7879 | 3575 N_("/Conversation/Alias...")); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3576 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3577 gtkwin->menu.block = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3578 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3579 N_("/Conversation/Block...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3580 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3581 gtkwin->menu.add = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3582 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3583 N_("/Conversation/Add...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3584 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3585 gtkwin->menu.remove = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3586 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3587 N_("/Conversation/Remove...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3588 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3589 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3590 |
7879 | 3591 gtkwin->menu.insert_link = |
3592 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3593 N_("/Conversation/Insert Link...")); | |
3594 | |
3595 gtkwin->menu.insert_image = | |
3596 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3597 N_("/Conversation/Insert Image...")); | |
3598 | |
3599 /* --- */ | |
3600 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3601 gtkwin->menu.logging = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3602 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3603 N_("/Options/Enable Logging")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3604 gtkwin->menu.sounds = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3605 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3606 N_("/Options/Enable Sounds")); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3607 gtkwin->menu.show_formatting_toolbar = |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3608 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3609 N_("/Options/Show Formatting Toolbar")); |
9188 | 3610 gtkwin->menu.show_timestamps = |
3611 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3612 N_("/Options/Show Timestamps")); | |
4359 | 3613 |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3614 generate_send_as_items(win, NULL); |
4359 | 3615 |
3616 gtk_widget_show(gtkwin->menu.menubar); | |
4931 | 3617 |
3618 return gtkwin->menu.menubar; | |
4359 | 3619 } |
3620 | |
3621 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3622 setup_im_buttons(GaimConversation *conv, GtkWidget *parent) |
4359 | 3623 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3624 GaimConnection *gc; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3625 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3626 GaimGtkImPane *gtkim; |
8811 | 3627 GaimButtonStyle button_type; |
4359 | 3628 |
3629 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3630 gtkim = gtkconv->u.im; | |
3631 gc = gaim_conversation_get_gc(conv); | |
3632 | |
3633 /* From right to left... */ | |
3634 | |
3635 /* Send button */ | |
3636 gtkconv->send = gaim_gtk_change_text(_("Send"), gtkconv->send, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3637 GAIM_STOCK_SEND, GAIM_CONV_IM); |
4359 | 3638 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->send, _("Send"), NULL); |
3639 gtk_box_pack_end(GTK_BOX(parent), gtkconv->send, FALSE, FALSE, 0); | |
3640 | |
3641 /* Separator */ | |
3642 if (gtkim->sep2 != NULL) | |
3643 gtk_widget_destroy(gtkim->sep2); | |
3644 | |
3645 gtkim->sep2 = gtk_vseparator_new(); | |
3646 gtk_box_pack_end(GTK_BOX(parent), gtkim->sep2, FALSE, TRUE, 0); | |
3647 gtk_widget_show(gtkim->sep2); | |
3648 | |
3649 /* Now, um, just kind of all over the place. Huh? */ | |
3650 | |
3651 /* Warn button */ | |
3652 gtkim->warn = gaim_gtk_change_text(_("Warn"), gtkim->warn, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3653 GAIM_STOCK_WARN, GAIM_CONV_IM); |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3654 gtk_tooltips_set_tip(gtkconv->tooltips, gtkim->warn, |
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3655 _("Warn the user"), NULL); |
7929 | 3656 gtk_box_pack_start(GTK_BOX(parent), gtkim->warn, FALSE, FALSE, 0); |
3657 | |
3658 /* Block button */ | |
3659 gtkim->block = gaim_gtk_change_text(_("Block"), gtkim->block, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3660 GAIM_STOCK_BLOCK, GAIM_CONV_IM); |
7929 | 3661 gtk_tooltips_set_tip(gtkconv->tooltips, gtkim->block, |
3662 _("Block the user"), NULL); | |
3663 gtk_box_pack_start(GTK_BOX(parent), gtkim->block, FALSE, FALSE, 0); | |
3664 | |
9468 | 3665 /* Block button */ |
3666 gtkim->send_file = gaim_gtk_change_text(_("Send File"), gtkim->send_file, | |
3667 GAIM_STOCK_FILE_TRANSFER, GAIM_CONV_IM); | |
3668 gtk_tooltips_set_tip(gtkconv->tooltips, gtkim->send_file, | |
3669 _("Send a file to the user"), NULL); | |
3670 gtk_box_pack_start(GTK_BOX(parent), gtkim->send_file, FALSE, FALSE, 0); | |
3671 | |
7929 | 3672 /* Add button */ |
3673 gtkconv->add = gaim_gtk_change_text(_("Add"), gtkconv->add, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3674 GTK_STOCK_ADD, GAIM_CONV_IM); |
7929 | 3675 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->add, |
3676 _("Add the user to your buddy list"), NULL); | |
3677 gtk_box_pack_start(GTK_BOX(parent), gtkconv->add, FALSE, FALSE, 0); | |
3678 | |
3679 /* Remove button */ | |
3680 gtkconv->remove = gaim_gtk_change_text(_("Remove"), gtkconv->remove, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3681 GTK_STOCK_REMOVE, GAIM_CONV_IM); |
7929 | 3682 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->remove, |
3683 _("Remove the user from your buddy list"), NULL); | |
3684 gtk_box_pack_start(GTK_BOX(parent), gtkconv->remove, FALSE, FALSE, 0); | |
4359 | 3685 |
3686 /* Info button */ | |
3687 gtkconv->info = gaim_gtk_change_text(_("Info"), gtkconv->info, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3688 GAIM_STOCK_INFO, GAIM_CONV_IM); |
4359 | 3689 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->info, |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3690 _("Get the user's information"), NULL); |
7929 | 3691 gtk_box_pack_start(GTK_BOX(parent), gtkconv->info, FALSE, FALSE, 0); |
3692 | |
3693 gtk_button_set_relief(GTK_BUTTON(gtkim->warn), GTK_RELIEF_NONE); | |
3694 gtk_button_set_relief(GTK_BUTTON(gtkim->block), GTK_RELIEF_NONE); | |
9468 | 3695 gtk_button_set_relief(GTK_BUTTON(gtkim->send_file), GTK_RELIEF_NONE); |
7929 | 3696 gtk_button_set_relief(GTK_BUTTON(gtkconv->add), GTK_RELIEF_NONE); |
3697 gtk_button_set_relief(GTK_BUTTON(gtkconv->remove), GTK_RELIEF_NONE); | |
4359 | 3698 gtk_button_set_relief(GTK_BUTTON(gtkconv->info), GTK_RELIEF_NONE); |
3699 gtk_button_set_relief(GTK_BUTTON(gtkconv->send), GTK_RELIEF_NONE); | |
7929 | 3700 |
3701 gtk_size_group_add_widget(gtkconv->sg, gtkim->warn); | |
3702 gtk_size_group_add_widget(gtkconv->sg, gtkim->block); | |
9468 | 3703 gtk_size_group_add_widget(gtkconv->sg, gtkim->send_file); |
7929 | 3704 gtk_size_group_add_widget(gtkconv->sg, gtkconv->add); |
3705 gtk_size_group_add_widget(gtkconv->sg, gtkconv->remove); | |
4359 | 3706 gtk_size_group_add_widget(gtkconv->sg, gtkconv->info); |
3707 gtk_size_group_add_widget(gtkconv->sg, gtkconv->send); | |
7929 | 3708 |
3709 gtk_box_reorder_child(GTK_BOX(parent), gtkim->warn, 1); | |
3710 gtk_box_reorder_child(GTK_BOX(parent), gtkim->block, 2); | |
9468 | 3711 gtk_box_reorder_child(GTK_BOX(parent), gtkim->send_file,3); |
3712 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->add, 4); | |
3713 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->remove, 5); | |
3714 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->info, 6); | |
4359 | 3715 |
3716 gaim_gtkconv_update_buttons_by_protocol(conv); | |
3717 | |
8811 | 3718 /* Check if the buttons should be visible or not */ |
9150 | 3719 button_type = gaim_prefs_get_int("/gaim/gtk/conversations/button_type"); |
8811 | 3720 if (button_type == GAIM_BUTTON_NONE) |
3721 gtk_widget_hide(gtkconv->bbox); | |
3722 else | |
3723 gtk_widget_show(gtkconv->bbox); | |
3724 | |
4359 | 3725 g_signal_connect(G_OBJECT(gtkim->warn), "clicked", |
3726 G_CALLBACK(warn_cb), conv); | |
3727 g_signal_connect(G_OBJECT(gtkim->block), "clicked", | |
3728 G_CALLBACK(block_cb), conv); | |
9468 | 3729 g_signal_connect(G_OBJECT(gtkim->send_file), "clicked", |
3730 G_CALLBACK(send_file_cb), conv); | |
7929 | 3731 g_signal_connect(G_OBJECT(gtkconv->add), "clicked", |
3732 G_CALLBACK(add_remove_cb), conv); | |
3733 g_signal_connect(G_OBJECT(gtkconv->remove), "clicked", | |
3734 G_CALLBACK(add_remove_cb), conv); | |
3735 g_signal_connect(G_OBJECT(gtkconv->info), "clicked", | |
3736 G_CALLBACK(info_cb), conv); | |
3737 g_signal_connect(G_OBJECT(gtkconv->send), "clicked", | |
3738 G_CALLBACK(send_cb), conv); | |
4359 | 3739 } |
3740 | |
3741 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3742 setup_chat_buttons(GaimConversation *conv, GtkWidget *parent) |
4359 | 3743 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3744 GaimConnection *gc; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3745 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3746 GaimGtkChatPane *gtkchat; |
8811 | 3747 GaimButtonStyle button_type; |
4359 | 3748 |
3749 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3750 gtkchat = gtkconv->u.chat; | |
3751 gc = gaim_conversation_get_gc(conv); | |
3752 | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3753 /* From right to left... */ |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3754 |
4359 | 3755 /* Send button */ |
3756 gtkconv->send = gaim_gtk_change_text(_("Send"), gtkconv->send, | |
3757 GAIM_STOCK_SEND, GAIM_CONV_CHAT); | |
3758 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->send, _("Send"), NULL); | |
3759 gtk_box_pack_end(GTK_BOX(parent), gtkconv->send, FALSE, FALSE, 0); | |
3760 | |
3761 /* Separator */ | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3762 if (gtkchat->sep != NULL) |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3763 gtk_widget_destroy(gtkchat->sep); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3764 |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3765 gtkchat->sep = gtk_vseparator_new(); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3766 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
|
3767 gtk_widget_show(gtkchat->sep); |
4359 | 3768 |
3769 /* Invite */ | |
3770 gtkchat->invite = gaim_gtk_change_text(_("Invite"), gtkchat->invite, | |
3771 GAIM_STOCK_INVITE, GAIM_CONV_CHAT); | |
3772 gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->invite, | |
3773 _("Invite a user"), NULL); | |
7931 | 3774 gtk_box_pack_start(GTK_BOX(parent), gtkchat->invite, FALSE, FALSE, 0); |
4359 | 3775 |
7929 | 3776 /* Add button */ |
3777 gtkconv->add = gaim_gtk_change_text(_("Add"), gtkconv->add, | |
3778 GTK_STOCK_ADD, GAIM_CONV_CHAT); | |
3779 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->add, | |
3780 _("Add the chat to your buddy list"), NULL); | |
3781 gtk_box_pack_start(GTK_BOX(parent), gtkconv->add, FALSE, FALSE, 0); | |
3782 | |
3783 /* Remove button */ | |
3784 gtkconv->remove = gaim_gtk_change_text(_("Remove"), gtkconv->remove, | |
3785 GTK_STOCK_REMOVE, GAIM_CONV_CHAT); | |
3786 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->remove, | |
3787 _("Remove the chat from your buddy list"), NULL); | |
3788 gtk_box_pack_start(GTK_BOX(parent), gtkconv->remove, FALSE, FALSE, 0); | |
3789 | |
4359 | 3790 /* Set the relief on these. */ |
3791 gtk_button_set_relief(GTK_BUTTON(gtkchat->invite), GTK_RELIEF_NONE); | |
7929 | 3792 gtk_button_set_relief(GTK_BUTTON(gtkconv->add), GTK_RELIEF_NONE); |
3793 gtk_button_set_relief(GTK_BUTTON(gtkconv->remove), GTK_RELIEF_NONE); | |
4359 | 3794 gtk_button_set_relief(GTK_BUTTON(gtkconv->send), GTK_RELIEF_NONE); |
3795 | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3796 gtk_size_group_add_widget(gtkconv->sg, gtkchat->invite); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3797 gtk_size_group_add_widget(gtkconv->sg, gtkconv->add); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3798 gtk_size_group_add_widget(gtkconv->sg, gtkconv->remove); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3799 gtk_size_group_add_widget(gtkconv->sg, gtkconv->send); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3800 |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3801 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->add, 1); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3802 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->remove, 3); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3803 gtk_box_reorder_child(GTK_BOX(parent), gtkchat->invite, 3); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3804 |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3805 gaim_gtkconv_update_buttons_by_protocol(conv); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3806 |
8811 | 3807 /* Check if the buttons should be visible or not */ |
9150 | 3808 button_type = gaim_prefs_get_int("/gaim/gtk/conversations/button_type"); |
8811 | 3809 if (button_type == GAIM_BUTTON_NONE) |
3810 gtk_widget_hide(gtkconv->bbox); | |
3811 else | |
3812 gtk_widget_show(gtkconv->bbox); | |
3813 | |
4359 | 3814 /* Callbacks */ |
7929 | 3815 g_signal_connect(G_OBJECT(gtkchat->invite), "clicked", |
3816 G_CALLBACK(invite_cb), conv); | |
3817 g_signal_connect(G_OBJECT(gtkconv->add), "clicked", | |
3818 G_CALLBACK(add_remove_cb), conv); | |
3819 g_signal_connect(G_OBJECT(gtkconv->remove), "clicked", | |
3820 G_CALLBACK(add_remove_cb), conv); | |
4359 | 3821 g_signal_connect(G_OBJECT(gtkconv->send), "clicked", |
3822 G_CALLBACK(send_cb), conv); | |
3823 } | |
3824 | |
3825 | |
7971 | 3826 static void topic_callback(GtkWidget *w, GaimConversation *conv) |
3827 { | |
3828 GaimPluginProtocolInfo *prpl_info = NULL; | |
3829 GaimConnection *gc; | |
3830 GaimGtkConversation *gtkconv; | |
3831 GaimGtkChatPane *gtkchat; | |
8858 | 3832 const char *new_topic; |
3833 const char *current_topic; | |
7971 | 3834 |
3835 gc = gaim_conversation_get_gc(conv); | |
3836 | |
3837 if(!gc || !(prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl))) | |
3838 return; | |
3839 | |
3840 if(prpl_info->set_chat_topic == NULL) | |
3841 return; | |
3842 | |
3843 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3844 gtkchat = gtkconv->u.chat; | |
8858 | 3845 new_topic = gtk_entry_get_text(GTK_ENTRY(gtkchat->topic_text)); |
3846 current_topic = gaim_conv_chat_get_topic(GAIM_CONV_CHAT(conv)); | |
3847 | |
3848 if(current_topic && !g_utf8_collate(new_topic, current_topic)) | |
7971 | 3849 return; |
3850 | |
8858 | 3851 prpl_info->set_chat_topic(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), |
3852 new_topic); | |
7971 | 3853 } |
3854 | |
4359 | 3855 static GtkWidget * |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3856 setup_chat_pane(GaimConversation *conv) |
4359 | 3857 { |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3858 GaimPluginProtocolInfo *prpl_info = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3859 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3860 GaimGtkChatPane *gtkchat; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3861 GaimConnection *gc; |
8456 | 3862 GaimPlugin *protocol; |
4359 | 3863 GtkWidget *vpaned, *hpaned; |
3864 GtkWidget *vbox, *hbox; | |
3865 GtkWidget *lbox, *bbox; | |
3866 GtkWidget *label; | |
3867 GtkWidget *list; | |
3868 GtkWidget *button; | |
7949 | 3869 GtkWidget *sw; |
4359 | 3870 GtkListStore *ls; |
3871 GtkCellRenderer *rend; | |
3872 GtkTreeViewColumn *col; | |
9080 | 3873 GList *focus_chain = NULL; |
4359 | 3874 |
3875 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3876 gtkchat = gtkconv->u.chat; | |
3877 gc = gaim_conversation_get_gc(conv); | |
3878 | |
3879 /* Setup the outer pane. */ | |
3880 vpaned = gtk_vpaned_new(); | |
3881 gtk_widget_show(vpaned); | |
3882 | |
3883 /* Setup the top part of the pane. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3884 vbox = gtk_vbox_new(FALSE, 6); |
8914 | 3885 gtk_paned_pack1(GTK_PANED(vpaned), vbox, TRUE, TRUE); |
4359 | 3886 gtk_widget_show(vbox); |
3887 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3888 if (gc != NULL) |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3889 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3890 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3891 if (prpl_info->options & OPT_PROTO_CHAT_TOPIC) |
4359 | 3892 { |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3893 hbox = gtk_hbox_new(FALSE, 6); |
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3894 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
4359 | 3895 gtk_widget_show(hbox); |
3896 | |
3897 label = gtk_label_new(_("Topic:")); | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3898 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
4359 | 3899 gtk_widget_show(label); |
3900 | |
3901 gtkchat->topic_text = gtk_entry_new(); | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3902 |
7971 | 3903 if(prpl_info->set_chat_topic == NULL) { |
3904 gtk_editable_set_editable(GTK_EDITABLE(gtkchat->topic_text), FALSE); | |
3905 } else { | |
3906 g_signal_connect(GTK_OBJECT(gtkchat->topic_text), "activate", | |
3907 G_CALLBACK(topic_callback), conv); | |
3908 } | |
3909 | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3910 gtk_box_pack_start(GTK_BOX(hbox), gtkchat->topic_text, TRUE, TRUE, 0); |
4359 | 3911 gtk_widget_show(gtkchat->topic_text); |
3912 } | |
3913 | |
3914 /* Setup the horizontal pane. */ | |
3915 hpaned = gtk_hpaned_new(); | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3916 gtk_box_pack_start(GTK_BOX(vbox), hpaned, TRUE, TRUE, 0); |
4359 | 3917 gtk_widget_show(hpaned); |
3918 | |
3919 /* Setup the scrolled window to put gtkimhtml in. */ | |
3920 gtkconv->sw = gtk_scrolled_window_new(NULL, NULL); | |
3921 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
8076 | 3922 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
4359 | 3923 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(gtkconv->sw), |
3924 GTK_SHADOW_IN); | |
3925 gtk_paned_pack1(GTK_PANED(hpaned), gtkconv->sw, TRUE, TRUE); | |
3926 | |
3927 gtk_widget_set_size_request(gtkconv->sw, | |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3928 gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_width"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3929 gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_height")); |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3930 |
8914 | 3931 g_signal_connect(G_OBJECT(gtkconv->sw), "size-allocate", |
3932 G_CALLBACK(size_allocate_cb), conv); | |
3933 | |
4359 | 3934 gtk_widget_show(gtkconv->sw); |
3935 | |
3936 /* Setup gtkihmtml. */ | |
3937 gtkconv->imhtml = gtk_imhtml_new(NULL, NULL); | |
9005 | 3938 gtk_widget_set_name(gtkconv->imhtml, "gaim_gtkconv_imhtml"); |
4359 | 3939 gtk_container_add(GTK_CONTAINER(gtkconv->sw), gtkconv->imhtml); |
3940 | |
3941 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3942 gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); |
4359 | 3943 |
3944 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", | |
3945 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
8105 | 3946 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_press_event", |
6057 | 3947 G_CALLBACK(refocus_entry_cb), gtkconv); |
8109 | 3948 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_release_event", |
3949 G_CALLBACK(refocus_entry_cb), gtkconv); | |
4359 | 3950 |
3951 gaim_setup_imhtml(gtkconv->imhtml); | |
3952 gtk_widget_show(gtkconv->imhtml); | |
3953 | |
3954 /* Build the right pane. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3955 lbox = gtk_vbox_new(FALSE, 6); |
4409
0521eec12c33
[gaim-migrate @ 4682]
Christian Hammond <chipx86@chipx86.com>
parents:
4398
diff
changeset
|
3956 gtk_paned_pack2(GTK_PANED(hpaned), lbox, FALSE, TRUE); |
4359 | 3957 gtk_widget_show(lbox); |
3958 | |
3959 /* Setup the label telling how many people are in the room. */ | |
3960 gtkchat->count = gtk_label_new(_("0 people in room")); | |
3961 gtk_box_pack_start(GTK_BOX(lbox), gtkchat->count, FALSE, FALSE, 0); | |
3962 gtk_widget_show(gtkchat->count); | |
3963 | |
3964 /* Setup the list of users. */ | |
7949 | 3965 sw = gtk_scrolled_window_new(NULL, NULL); |
3966 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
8076 | 3967 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
7949 | 3968 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); |
3969 gtk_box_pack_start(GTK_BOX(lbox), sw, TRUE, TRUE, 0); | |
3970 gtk_widget_show(sw); | |
4359 | 3971 |
9533 | 3972 ls = gtk_list_store_new(CHAT_USERS_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING); |
9498 | 3973 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), CHAT_USERS_NAME_COLUMN, |
4359 | 3974 GTK_SORT_ASCENDING); |
3975 | |
3976 list = gtk_tree_view_new_with_model(GTK_TREE_MODEL(ls)); | |
3977 | |
9498 | 3978 rend = gtk_cell_renderer_pixbuf_new(); |
3979 | |
4359 | 3980 col = gtk_tree_view_column_new_with_attributes(NULL, rend, |
9498 | 3981 "pixbuf", CHAT_USERS_ICON_COLUMN, NULL); |
3982 gtk_tree_view_append_column(GTK_TREE_VIEW(list), col); | |
4359 | 3983 |
3984 g_signal_connect(G_OBJECT(list), "button_press_event", | |
3985 G_CALLBACK(right_click_chat_cb), conv); | |
8143 | 3986 g_signal_connect(G_OBJECT(list), "popup-menu", |
3987 G_CALLBACK(gtkconv_chat_popup_menu_cb), conv); | |
4359 | 3988 |
9498 | 3989 rend = gtk_cell_renderer_text_new(); |
3990 | |
4359 | 3991 col = gtk_tree_view_column_new_with_attributes(NULL, rend, |
9498 | 3992 "text", CHAT_USERS_NAME_COLUMN, NULL); |
4359 | 3993 gtk_tree_view_column_set_clickable(GTK_TREE_VIEW_COLUMN(col), TRUE); |
3994 | |
3995 gtk_tree_view_append_column(GTK_TREE_VIEW(list), col); | |
3996 | |
3997 gtk_widget_set_size_request(list, 150, -1); | |
3998 | |
3999 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(list), FALSE); | |
4000 gtk_widget_show(list); | |
4001 | |
4002 gtkchat->list = list; | |
4003 | |
7949 | 4004 gtk_container_add(GTK_CONTAINER(sw), list); |
4359 | 4005 |
4006 /* Setup the user list toolbar. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4007 bbox = gtk_hbox_new(TRUE, 6); |
4359 | 4008 gtk_box_pack_start(GTK_BOX(lbox), bbox, FALSE, FALSE, 0); |
4009 gtk_widget_show(bbox); | |
4010 | |
4011 /* IM */ | |
4012 button = gaim_pixbuf_button_from_stock(NULL, GTK_STOCK_REDO, | |
4013 GAIM_BUTTON_VERTICAL); | |
4014 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
4015 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
|
4016 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("IM the user"), NULL); |
4359 | 4017 g_signal_connect(G_OBJECT(button), "clicked", |
7961 | 4018 G_CALLBACK(chat_im_button_cb), conv); |
4359 | 4019 |
4020 gtk_widget_show(button); | |
4021 | |
4022 /* Ignore */ | |
4023 button = gaim_pixbuf_button_from_stock(NULL, GAIM_STOCK_IGNORE, | |
4024 GAIM_BUTTON_VERTICAL); | |
4025 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
4026 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
|
4027 gtk_tooltips_set_tip(gtkconv->tooltips, button, |
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
4028 _("Ignore the user"), NULL); |
4359 | 4029 g_signal_connect(G_OBJECT(button), "clicked", |
4030 G_CALLBACK(ignore_cb), conv); | |
4031 gtk_widget_show(button); | |
4032 | |
4033 /* Info */ | |
4034 button = gaim_pixbuf_button_from_stock(NULL, GAIM_STOCK_INFO, | |
4035 GAIM_BUTTON_VERTICAL); | |
4036 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
4037 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
4038 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
4039 _("Get the user's information"), NULL); |
4359 | 4040 g_signal_connect(G_OBJECT(button), "clicked", |
4041 G_CALLBACK(info_cb), conv); | |
4042 | |
4043 gtk_widget_show(button); | |
4044 | |
4045 gtkconv->info = button; | |
4046 | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4047 /* Build the toolbar. */ |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4048 vbox = gtk_vbox_new(FALSE, 6); |
8914 | 4049 gtk_paned_pack2(GTK_PANED(vpaned), vbox, FALSE, TRUE); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4050 gtk_widget_show(vbox); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4051 |
8317 | 4052 gtkconv->toolbar = gtk_imhtmltoolbar_new(); |
4053 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
|
4054 |
9332 | 4055 gtkconv->lower_hbox = gtk_hbox_new(FALSE, 6); |
4056 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->lower_hbox, TRUE, TRUE, 0); | |
4057 gtk_widget_show(gtkconv->lower_hbox); | |
4058 | |
4059 vbox = gtk_vbox_new(FALSE, 6); | |
4060 gtk_box_pack_end(GTK_BOX(gtkconv->lower_hbox), vbox, TRUE, TRUE, 0); | |
4061 gtk_widget_show(vbox); | |
4062 | |
8123 | 4063 /* Setup the entry widget. |
4064 * We never show the horizontal scrollbar because it was causing weird | |
4065 * lockups when typing text just as you type the character that would | |
4066 * cause both scrollbars to appear. Definitely seems like a gtk bug. | |
4067 */ | |
7949 | 4068 sw = gtk_scrolled_window_new(NULL, NULL); |
4069 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
8112 | 4070 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); |
8061 | 4071 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), |
4072 GTK_SHADOW_IN); | |
9332 | 4073 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); |
7949 | 4074 gtk_widget_show(sw); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4075 |
8061 | 4076 gtkconv->entry = gtk_imhtml_new(NULL, NULL); |
9005 | 4077 gtk_widget_set_name(gtkconv->entry, "gaim_gtkconv_entry"); |
8456 | 4078 gtk_imhtml_smiley_shortcuts(GTK_IMHTML(gtkconv->entry), |
4079 gaim_prefs_get_bool("/gaim/gtk/conversations/smiley_shortcuts")); | |
4080 gtk_imhtml_html_shortcuts(GTK_IMHTML(gtkconv->entry), | |
4081 gaim_prefs_get_bool("/gaim/gtk/conversations/html_shortcuts")); | |
4082 | |
4083 protocol = gaim_find_prpl(conv->account->protocol_id); | |
4084 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), | |
4085 protocol->info->name); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4086 gtkconv->entry_buffer = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4087 gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); |
8061 | 4088 gaim_setup_imhtml(gtkconv->entry); |
4089 gtk_imhtml_set_editable(GTK_IMHTML(gtkconv->entry), TRUE); | |
4090 default_formatize(conv); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4091 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(gtkconv->entry), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4092 GTK_WRAP_WORD_CHAR); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4093 gtk_widget_set_size_request(gtkconv->entry, -1, |
8106 | 4094 gaim_prefs_get_int("/gaim/gtk/conversations/chat/entry_height")); |
7949 | 4095 g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", conv); |
4096 | |
4097 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", | |
8105 | 4098 G_CALLBACK(entry_key_press_cb), conv); |
4359 | 4099 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", |
4100 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
8914 | 4101 g_signal_connect(G_OBJECT(gtkconv->entry), "size-allocate", |
4102 G_CALLBACK(size_allocate_cb), conv); | |
4359 | 4103 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4104 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
4105 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4106 gtk_imhtmltoolbar_attach(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4107 gtkconv->entry); |
4359 | 4108 |
7949 | 4109 gtk_container_add(GTK_CONTAINER(sw), GTK_WIDGET(gtkconv->entry)); |
4359 | 4110 gtk_widget_show(gtkconv->entry); |
4111 | |
4112 /* Setup the bottom button box. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4113 gtkconv->bbox = gtk_hbox_new(FALSE, 6); |
4359 | 4114 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->bbox, FALSE, FALSE, 0); |
4115 gtk_widget_show(gtkconv->bbox); | |
4116 | |
4117 setup_chat_buttons(conv, gtkconv->bbox); | |
4118 | |
9080 | 4119 /* |
4120 * Focus for chat windows should be as follows: | |
4121 * Tab title -> chat topic -> conversation scrollback -> user list -> | |
4122 * user list buttons -> entry -> buttons at bottom | |
4123 */ | |
4124 focus_chain = g_list_prepend(focus_chain, gtkconv->bbox); | |
9332 | 4125 focus_chain = g_list_prepend(focus_chain, gtkconv->entry); |
9080 | 4126 gtk_container_set_focus_chain(GTK_CONTAINER(vbox), focus_chain); |
4127 | |
4359 | 4128 return vpaned; |
4129 } | |
4130 | |
4131 static GtkWidget * | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4132 setup_im_pane(GaimConversation *conv) |
4359 | 4133 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4134 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4135 GaimGtkImPane *gtkim; |
8456 | 4136 GaimPlugin *protocol; |
4359 | 4137 GtkWidget *paned; |
4138 GtkWidget *vbox; | |
4139 GtkWidget *vbox2; | |
7949 | 4140 GtkWidget *sw; |
9080 | 4141 GList *focus_chain = NULL; |
4359 | 4142 |
4143 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4144 gtkim = gtkconv->u.im; | |
4145 | |
4146 /* Setup the outer pane. */ | |
4147 paned = gtk_vpaned_new(); | |
4148 gtk_widget_show(paned); | |
4149 | |
4150 /* Setup the top part of the pane. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4151 vbox = gtk_vbox_new(FALSE, 6); |
4409
0521eec12c33
[gaim-migrate @ 4682]
Christian Hammond <chipx86@chipx86.com>
parents:
4398
diff
changeset
|
4152 gtk_paned_pack1(GTK_PANED(paned), vbox, TRUE, TRUE); |
4359 | 4153 gtk_widget_show(vbox); |
4154 | |
4155 /* Setup the gtkimhtml widget. */ | |
4156 gtkconv->sw = gtk_scrolled_window_new(NULL, NULL); | |
4157 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
8076 | 4158 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
4359 | 4159 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(gtkconv->sw), |
4160 GTK_SHADOW_IN); | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4161 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->sw, TRUE, TRUE, 0); |
4851 | 4162 |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
4163 gtk_widget_set_size_request(gtkconv->sw, |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
4164 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_width"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
4165 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_height")); |
8914 | 4166 g_signal_connect(G_OBJECT(gtkconv->sw), "size-allocate", |
4167 G_CALLBACK(size_allocate_cb), conv); | |
4359 | 4168 gtk_widget_show(gtkconv->sw); |
4169 | |
4170 gtkconv->imhtml = gtk_imhtml_new(NULL, NULL); | |
9005 | 4171 gtk_widget_set_name(gtkconv->imhtml, "gaim_gtkconv_imhtml"); |
4359 | 4172 gtk_container_add(GTK_CONTAINER(gtkconv->sw), gtkconv->imhtml); |
4173 | |
4174 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", | |
4175 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
8105 | 4176 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_press_event", |
6057 | 4177 G_CALLBACK(refocus_entry_cb), gtkconv); |
8109 | 4178 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_release_event", |
4179 G_CALLBACK(refocus_entry_cb), gtkconv); | |
4359 | 4180 |
4181 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4182 gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); |
4359 | 4183 gaim_setup_imhtml(gtkconv->imhtml); |
4184 gtk_widget_show(gtkconv->imhtml); | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4185 vbox2 = gtk_vbox_new(FALSE, 6); |
8914 | 4186 gtk_paned_pack2(GTK_PANED(paned), vbox2, FALSE, TRUE); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4187 gtk_widget_show(vbox2); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4188 |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4189 /* Build the toolbar. */ |
8317 | 4190 gtkconv->toolbar = gtk_imhtmltoolbar_new(); |
4191 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
|
4192 |
8123 | 4193 /* Setup the entry widget. |
4194 * 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
|
4195 * lockups when typing text just as you type the character that would |
8123 | 4196 * cause both scrollbars to appear. Definitely seems like a gtk bug. |
4197 */ | |
9332 | 4198 gtkconv->lower_hbox = gtk_hbox_new(FALSE, 6); |
4199 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->lower_hbox, TRUE, TRUE, 0); | |
4200 gtk_widget_show(gtkconv->lower_hbox); | |
4201 | |
4202 vbox2 = gtk_vbox_new(FALSE, 6); | |
4203 gtk_box_pack_end(GTK_BOX(gtkconv->lower_hbox), vbox2, TRUE, TRUE, 0); | |
4204 gtk_widget_show(vbox2); | |
8821 | 4205 |
7949 | 4206 sw = gtk_scrolled_window_new(NULL, NULL); |
4207 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
8112 | 4208 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); |
8061 | 4209 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), |
4210 GTK_SHADOW_IN); | |
9332 | 4211 gtk_box_pack_start(GTK_BOX(vbox2), sw, TRUE, TRUE, 0); |
7949 | 4212 gtk_widget_show(sw); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4213 |
8061 | 4214 gtkconv->entry = gtk_imhtml_new(NULL, NULL); |
9005 | 4215 gtk_widget_set_name(gtkconv->entry, "gaim_gtkconv_entry"); |
8456 | 4216 |
4217 gtk_imhtml_smiley_shortcuts(GTK_IMHTML(gtkconv->entry), | |
4218 gaim_prefs_get_bool("/gaim/gtk/conversations/smiley_shortcuts")); | |
4219 gtk_imhtml_html_shortcuts(GTK_IMHTML(gtkconv->entry), | |
4220 gaim_prefs_get_bool("/gaim/gtk/conversations/html_shortcuts")); | |
4221 | |
4222 protocol = gaim_find_prpl(conv->account->protocol_id); | |
4223 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), | |
4224 protocol->info->name); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4225 gtkconv->entry_buffer = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4226 gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); |
8061 | 4227 gaim_setup_imhtml(gtkconv->entry); |
4228 gtk_imhtml_set_editable(GTK_IMHTML(gtkconv->entry), TRUE); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4229 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(gtkconv->entry), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4230 GTK_WRAP_WORD_CHAR); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4231 gtk_widget_set_size_request(gtkconv->entry, -1, |
8106 | 4232 gaim_prefs_get_int("/gaim/gtk/conversations/im/entry_height")); |
7949 | 4233 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
|
4234 |
4359 | 4235 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", |
8105 | 4236 G_CALLBACK(entry_key_press_cb), conv); |
4359 | 4237 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", |
4238 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
8914 | 4239 g_signal_connect(G_OBJECT(gtkconv->entry), "size-allocate", |
4240 G_CALLBACK(size_allocate_cb), conv); | |
4359 | 4241 |
4242 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "insert_text", | |
4243 G_CALLBACK(insert_text_cb), conv); | |
4244 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "delete_range", | |
4245 G_CALLBACK(delete_text_cb), conv); | |
4246 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4247 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
4248 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
4359 | 4249 |
7949 | 4250 gtk_container_add(GTK_CONTAINER(sw), GTK_WIDGET(gtkconv->entry)); |
4359 | 4251 gtk_widget_show(gtkconv->entry); |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
4252 gtk_imhtmltoolbar_attach(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), |
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
4253 gtkconv->entry); |
8481 | 4254 /* had to move this after the imtoolbar is attached so that the |
4255 * signals get fired to toggle the buttons on the toolbar as well. | |
4256 */ | |
4257 default_formatize(conv); | |
4359 | 4258 |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4259 gtkconv->bbox = gtk_hbox_new(FALSE, 6); |
4359 | 4260 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->bbox, FALSE, FALSE, 0); |
4261 gtk_widget_show(gtkconv->bbox); | |
4262 | |
4263 setup_im_buttons(conv, gtkconv->bbox); | |
8758 | 4264 gtkconv->u.im->animate = gaim_prefs_get_bool("/gaim/gtk/conversations/im/animate_buddy_icons"); |
4359 | 4265 |
9080 | 4266 /* |
4267 * Focus for IM windows should be as follows: | |
4268 * Tab title -> conversation scrollback -> entry -> buttons at bottom | |
4269 */ | |
4270 focus_chain = g_list_prepend(focus_chain, gtkconv->bbox); | |
9332 | 4271 focus_chain = g_list_prepend(focus_chain, gtkconv->entry); |
9080 | 4272 gtk_container_set_focus_chain(GTK_CONTAINER(vbox2), focus_chain); |
8143 | 4273 |
4359 | 4274 return paned; |
4275 } | |
4276 | |
4277 static void | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4278 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
|
4279 GtkSelectionData *sd, guint info, guint t, |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4280 GaimConversation *conv) |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4281 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4282 GaimConvWindow *win = conv->window; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4283 GaimConversation *c; |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4284 if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE)) |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4285 { |
4781 | 4286 GaimBlistNode *n = NULL; |
6695 | 4287 GaimBuddy *b; |
4781 | 4288 memcpy(&n, sd->data, sizeof(n)); |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
4289 |
6695 | 4290 if (GAIM_BLIST_NODE_IS_CONTACT(n)) |
4291 b = gaim_contact_get_priority_buddy((GaimContact*)n); | |
4292 else if (GAIM_BLIST_NODE_IS_BUDDY(n)) | |
4293 b = (GaimBuddy*)n; | |
4294 else | |
4781 | 4295 return; |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
4296 |
7089
2cd3756a637b
[gaim-migrate @ 7654]
Christian Hammond <chipx86@chipx86.com>
parents:
7078
diff
changeset
|
4297 c = gaim_conversation_new(GAIM_CONV_IM, b->account, b->name); |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
4298 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4299 gaim_conv_window_add_conversation(win, c); |
8802
1076cd8579ea
[gaim-migrate @ 9564]
Christian Hammond <chipx86@chipx86.com>
parents:
8758
diff
changeset
|
4300 |
1076cd8579ea
[gaim-migrate @ 9564]
Christian Hammond <chipx86@chipx86.com>
parents:
8758
diff
changeset
|
4301 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); |
4702 | 4302 } |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4303 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
|
4304 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4305 char *protocol = NULL; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4306 char *username = NULL; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4307 GaimAccount *account; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4308 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4309 if (gaim_gtk_parse_x_im_contact(sd->data, FALSE, &account, |
7718 | 4310 &protocol, &username, NULL)) |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4311 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4312 if (account == NULL) |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4313 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4314 gaim_notify_error(NULL, NULL, |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4315 _("You are not currently signed on with an account that " |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4316 "can add that buddy."), NULL); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4317 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4318 else |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4319 { |
7718 | 4320 c = gaim_conversation_new(GAIM_CONV_IM, account, username); |
4321 gaim_conv_window_add_conversation(win, c); | |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4322 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4323 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4324 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4325 if (username != NULL) g_free(username); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4326 if (protocol != NULL) g_free(protocol); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4327 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4328 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4329 } |
9525 | 4330 else if (sd->target == gdk_atom_intern("text/uri-list", FALSE)) { |
9495 | 4331 if (!g_ascii_strncasecmp(sd->data, "file://", 7)) { |
4332 GError *converr = NULL; | |
4333 gchar *file; | |
4334 if(!(file = g_filename_from_uri(sd->data, NULL, &converr))) { | |
4335 gaim_debug(GAIM_DEBUG_ERROR, "conv dnd", "%s\n", | |
4336 (converr ? converr->message : | |
4337 "g_filename_from_uri error")); | |
9498 | 4338 g_error_free(converr); |
9495 | 4339 return; |
4340 } | |
4341 file = g_strchomp(file); | |
4342 /* XXX - Handle dragging more than one file. Make ft API support creating a transfer with more than one file */ | |
4343 /* XXX - Attempt to load this file into gdk_pixbuf, or otherwise determine if it is an image. If it is, offer | |
4344 * the choice of a) sending this file b) inserting this file as an IM image or c) setting this file as a custom | |
4345 * buddy icon for this buddy */ | |
4346 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) | |
4347 serv_send_file(gaim_conversation_get_gc(conv), gaim_conversation_get_name(conv), file); | |
4348 g_free(file); | |
4349 } | |
4350 } | |
4351 gtk_drag_finish(dc, FALSE, FALSE, t); | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4352 } |
4359 | 4353 |
4354 /************************************************************************** | |
4355 * GTK+ window ops | |
4356 **************************************************************************/ | |
4357 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4358 gaim_gtk_new_window(GaimConvWindow *win) |
4359 | 4359 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4360 GaimGtkWindow *gtkwin; |
4359 | 4361 GtkPositionType pos; |
4362 GtkWidget *testidea; | |
4363 GtkWidget *menubar; | |
4364 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4365 gtkwin = g_malloc0(sizeof(GaimGtkWindow)); |
4359 | 4366 |
4367 win->ui_data = gtkwin; | |
4368 | |
4369 /* Create the window. */ | |
4370 gtkwin->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
4371 gtk_window_set_role(GTK_WINDOW(gtkwin->window), "conversation"); | |
4635 | 4372 gtk_window_set_resizable(GTK_WINDOW(gtkwin->window), TRUE); |
4510
4c394222c732
[gaim-migrate @ 4786]
Christian Hammond <chipx86@chipx86.com>
parents:
4505
diff
changeset
|
4373 gtk_container_set_border_width(GTK_CONTAINER(gtkwin->window), 0); |
5173 | 4374 GTK_WINDOW(gtkwin->window)->allow_shrink = TRUE; |
4359 | 4375 gtk_widget_realize(gtkwin->window); |
4376 | |
4377 g_signal_connect(G_OBJECT(gtkwin->window), "delete_event", | |
4378 G_CALLBACK(close_win_cb), win); | |
4379 | |
4380 /* Create the notebook. */ | |
4381 gtkwin->notebook = gtk_notebook_new(); | |
4382 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4383 pos = gaim_prefs_get_int("/gaim/gtk/conversations/tab_side"); |
4359 | 4384 |
4385 #if 0 | |
4386 gtk_notebook_set_tab_hborder(GTK_NOTEBOOK(gtkwin->notebook), 0); | |
4387 gtk_notebook_set_tab_vborder(GTK_NOTEBOOK(gtkwin->notebook), 0); | |
4388 #endif | |
4389 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos); | |
4390 gtk_notebook_set_scrollable(GTK_NOTEBOOK(gtkwin->notebook), TRUE); | |
4391 gtk_notebook_popup_enable(GTK_NOTEBOOK(gtkwin->notebook)); | |
4818 | 4392 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), FALSE); |
4393 | |
4359 | 4394 gtk_widget_show(gtkwin->notebook); |
4395 | |
8189 | 4396 g_signal_connect(G_OBJECT(gtkwin->notebook), "switch_page", |
4397 G_CALLBACK(before_switch_conv_cb), win); | |
4359 | 4398 g_signal_connect_after(G_OBJECT(gtkwin->notebook), "switch_page", |
4399 G_CALLBACK(switch_conv_cb), win); | |
4400 | |
4401 /* Setup the tab drag and drop signals. */ | |
4486 | 4402 gtk_widget_add_events(gtkwin->notebook, |
4403 GDK_BUTTON1_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK); | |
4404 g_signal_connect(G_OBJECT(gtkwin->notebook), "button_press_event", | |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4405 G_CALLBACK(notebook_press_cb), win); |
4486 | 4406 g_signal_connect(G_OBJECT(gtkwin->notebook), "button_release_event", |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4407 G_CALLBACK(notebook_release_cb), win); |
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4408 |
4359 | 4409 testidea = gtk_vbox_new(FALSE, 0); |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4410 |
4359 | 4411 /* Setup the menubar. */ |
4412 menubar = setup_menubar(win); | |
4413 gtk_box_pack_start(GTK_BOX(testidea), menubar, FALSE, TRUE, 0); | |
4414 | |
4415 gtk_box_pack_start(GTK_BOX(testidea), gtkwin->notebook, TRUE, TRUE, 0); | |
4416 | |
4417 gtk_container_add(GTK_CONTAINER(gtkwin->window), testidea); | |
4418 | |
4419 gtk_widget_show(testidea); | |
4420 } | |
4421 | |
4422 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4423 gaim_gtk_destroy_window(GaimConvWindow *win) |
4359 | 4424 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4425 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4426 |
4427 gtk_widget_destroy(gtkwin->window); | |
4428 | |
4630 | 4429 g_object_unref(G_OBJECT(gtkwin->menu.item_factory)); |
4430 | |
4359 | 4431 g_free(gtkwin); |
4432 win->ui_data = NULL; | |
4433 } | |
4434 | |
4435 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4436 gaim_gtk_show(GaimConvWindow *win) |
4359 | 4437 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4438 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4439 |
4440 gtk_widget_show(gtkwin->window); | |
7413 | 4441 |
4442 #ifdef _WIN32 | |
7415 | 4443 /* This works around a win32 gtk+ bug, where it can't handle |
4444 * creating the button correctly before the window is shown. | |
4445 * That's why we get the appearance of a button, without all | |
4446 * the normal button-like properties, like being able to click | |
7413 | 4447 * it. ;-) --Nathan */ |
7414 | 4448 if (gaim_prefs_get_bool("/gaim/gtk/conversations/close_on_tabs")) { |
4449 GaimConversation *conv; | |
4450 GaimGtkConversation *gtkconv; | |
4451 | |
4452 conv = gaim_conv_window_get_conversation_at(win, 0); | |
4453 if(conv) { | |
4454 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7415 | 4455 gtk_widget_hide(gtkconv->close); |
7414 | 4456 gtk_widget_show_all(gtkconv->close); |
4457 } | |
4458 } | |
7413 | 4459 #endif |
4359 | 4460 } |
4461 | |
4462 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4463 gaim_gtk_hide(GaimConvWindow *win) |
4359 | 4464 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4465 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4466 |
4467 gtk_widget_hide(gtkwin->window); | |
4468 } | |
4469 | |
4470 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4471 gaim_gtk_raise(GaimConvWindow *win) |
4359 | 4472 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4473 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4474 |
5484 | 4475 gtk_widget_show(gtkwin->window); |
5103 | 4476 gtk_window_deiconify(GTK_WINDOW(gtkwin->window)); |
4526 | 4477 gdk_window_raise(gtkwin->window->window); |
4359 | 4478 } |
4479 | |
4480 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4481 gaim_gtk_flash(GaimConvWindow *win) |
4359 | 4482 { |
4483 #ifdef _WIN32 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4484 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4485 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4486 wgaim_conv_im_blink(gtkwin->window); |
4359 | 4487 #endif |
4488 } | |
4489 | |
4490 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4491 gaim_gtk_switch_conversation(GaimConvWindow *win, unsigned int index) |
4359 | 4492 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4493 GaimGtkWindow *gtkwin; |
4359 | 4494 |
4495 gtkwin = GAIM_GTK_WINDOW(win); | |
4496 | |
4497 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), index); | |
4498 } | |
4499 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4500 static const GtkTargetEntry te[] = |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4501 { |
9525 | 4502 {"text/uri-list", 0, 0}, |
4503 {"GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, 1}, | |
4504 {"text/plain", 0, 2}, | |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4505 {"STRING", 0, 3}, |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4506 {"application/x-im-contact", 0, 4} |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4507 }; |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4508 |
4359 | 4509 static void |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4510 gaim_gtk_add_conversation(GaimConvWindow *win, GaimConversation *conv) |
4359 | 4511 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4512 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4513 GaimGtkConversation *gtkconv, *focus_gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4514 GaimConversation *focus_conv; |
4359 | 4515 GtkWidget *pane = NULL; |
4516 GtkWidget *tab_cont; | |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4517 GtkWidget *tabby, *menu_tabby; |
4359 | 4518 gboolean new_ui; |
4383
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4519 GaimConversationType conv_type; |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4520 const char *name; |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4521 |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4522 name = gaim_conversation_get_name(conv); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4523 conv_type = gaim_conversation_get_type(conv); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4524 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4525 |
4526 if (conv->ui_data != NULL) { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4527 gtkconv = (GaimGtkConversation *)conv->ui_data; |
4359 | 4528 |
4529 tab_cont = gtkconv->tab_cont; | |
4530 | |
4531 new_ui = FALSE; | |
4532 } | |
4533 else { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4534 gtkconv = g_malloc0(sizeof(GaimGtkConversation)); |
4359 | 4535 conv->ui_data = gtkconv; |
4536 | |
4537 /* Setup some initial variables. */ | |
4538 gtkconv->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
4539 gtkconv->tooltips = gtk_tooltips_new(); | |
4540 | |
7879 | 4541 if (conv_type == GAIM_CONV_IM) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4542 gtkconv->u.im = g_malloc0(sizeof(GaimGtkImPane)); |
4359 | 4543 gtkconv->u.im->a_virgin = TRUE; |
4544 | |
4545 pane = setup_im_pane(conv); | |
4546 } | |
7879 | 4547 else if (conv_type == GAIM_CONV_CHAT) { |
4548 gtkconv->u.chat = g_malloc0(sizeof(GaimGtkChatPane)); | |
4549 | |
4550 pane = setup_chat_pane(conv); | |
4551 } | |
4359 | 4552 |
4553 if (pane == NULL) { | |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4554 if (conv_type == GAIM_CONV_CHAT) g_free(gtkconv->u.chat); |
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4555 else if (conv_type == GAIM_CONV_IM) g_free(gtkconv->u.im); |
4359 | 4556 |
4557 g_free(gtkconv); | |
4558 conv->ui_data = NULL; | |
4559 | |
4560 return; | |
4561 } | |
4562 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4563 /* Setup drag-and-drop */ |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4564 gtk_drag_dest_set(pane, |
9300 | 4565 GTK_DEST_DEFAULT_MOTION | |
4566 GTK_DEST_DEFAULT_DROP, | |
4567 te, sizeof(te) / sizeof(GtkTargetEntry), | |
4568 GDK_ACTION_COPY); | |
4569 gtk_drag_dest_set(pane, | |
4570 GTK_DEST_DEFAULT_MOTION | | |
4571 GTK_DEST_DEFAULT_DROP, | |
4572 te, sizeof(te) / sizeof(GtkTargetEntry), | |
4573 GDK_ACTION_COPY); | |
4574 gtk_drag_dest_set(gtkconv->imhtml, 0, | |
4575 te, sizeof(te) / sizeof(GtkTargetEntry), | |
4576 GDK_ACTION_COPY); | |
4577 | |
4578 gtk_drag_dest_set(gtkconv->entry, 0, | |
4579 te, sizeof(te) / sizeof(GtkTargetEntry), | |
4580 GDK_ACTION_COPY); | |
4581 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4582 g_signal_connect(G_OBJECT(pane), "drag_data_received", |
9300 | 4583 G_CALLBACK(conv_dnd_recv), conv); |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4584 g_signal_connect(G_OBJECT(gtkconv->imhtml), "drag_data_received", |
9300 | 4585 G_CALLBACK(conv_dnd_recv), conv); |
8105 | 4586 g_signal_connect(G_OBJECT(gtkconv->entry), "drag_data_received", |
9300 | 4587 G_CALLBACK(conv_dnd_recv), conv); |
4588 | |
4359 | 4589 /* Setup the container for the tab. */ |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4590 gtkconv->tab_cont = tab_cont = gtk_vbox_new(FALSE, 6); |
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4591 gtk_container_set_border_width(GTK_CONTAINER(tab_cont), 6); |
4359 | 4592 gtk_container_add(GTK_CONTAINER(tab_cont), pane); |
4593 gtk_widget_show(pane); | |
4594 | |
4595 new_ui = TRUE; | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
4596 |
4359 | 4597 gtkconv->make_sound = TRUE; |
5902
6889b89cab90
[gaim-migrate @ 6334]
Christian Hammond <chipx86@chipx86.com>
parents:
5901
diff
changeset
|
4598 |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4599 gtkconv->show_formatting_toolbar = gaim_prefs_get_bool( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4600 "/gaim/gtk/conversations/show_formatting_toolbar"); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4601 |
8329
9dd7c75ed433
[gaim-migrate @ 9053]
Christian Hammond <chipx86@chipx86.com>
parents:
8319
diff
changeset
|
4602 if (gtkconv->show_formatting_toolbar) |
9dd7c75ed433
[gaim-migrate @ 9053]
Christian Hammond <chipx86@chipx86.com>
parents:
8319
diff
changeset
|
4603 gtk_widget_show(gtkconv->toolbar); |
9dd7c75ed433
[gaim-migrate @ 9053]
Christian Hammond <chipx86@chipx86.com>
parents:
8319
diff
changeset
|
4604 |
9188 | 4605 gtkconv->show_timestamps = gaim_prefs_get_bool( |
4606 "/gaim/gtk/conversations/show_timestamps"); | |
4607 | |
4608 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
4609 gtkconv->show_timestamps); | |
4610 | |
8176 | 4611 g_signal_connect_swapped(G_OBJECT(pane), "focus", |
9080 | 4612 G_CALLBACK(gtk_widget_grab_focus), |
4613 gtkconv->entry); | |
4359 | 4614 } |
4615 | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4616 gtkconv->tabby = tabby = gtk_hbox_new(FALSE, 6); |
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4617 gtkconv->menu_tabby = menu_tabby = gtk_hbox_new(FALSE, 6); |
4359 | 4618 |
4619 /* Close button. */ | |
4620 gtkconv->close = gtk_button_new(); | |
4621 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
|
4622 gtk_button_set_relief(GTK_BUTTON(gtkconv->close), GTK_RELIEF_NONE); |
4359 | 4623 gtk_container_add(GTK_CONTAINER(gtkconv->close), |
4445 | 4624 gtk_image_new_from_stock(GTK_STOCK_CLOSE, |
4625 GTK_ICON_SIZE_MENU)); | |
4359 | 4626 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->close, |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4627 _("Close conversation"), NULL); |
4359 | 4628 |
4629 g_signal_connect(G_OBJECT(gtkconv->close), "clicked", | |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4630 G_CALLBACK(close_conv_cb), conv); |
4359 | 4631 |
7446
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4632 /* |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4633 * 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
|
4634 * border bug. I love you guys! -- ChipX86 |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4635 */ |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4636 g_signal_connect(G_OBJECT(gtkconv->close), "state_changed", |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4637 G_CALLBACK(tab_close_button_state_changed_cb), NULL); |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4638 |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4639 /* Status icon. */ |
6440 | 4640 gtkconv->icon = gtk_image_new(); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4641 gtkconv->menu_icon = gtk_image_new(); |
6440 | 4642 update_tab_icon(conv); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4643 |
4359 | 4644 /* Tab label. */ |
4645 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
|
4646 gtkconv->menu_label = gtk_label_new(gaim_conversation_get_title(conv)); |
4359 | 4647 #if 0 |
4648 gtk_misc_set_alignment(GTK_MISC(gtkconv->tab_label), 0.00, 0.5); | |
4649 gtk_misc_set_padding(GTK_MISC(gtkconv->tab_label), 4, 0); | |
4650 #endif | |
4651 | |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
4652 |
4359 | 4653 /* Pack it all together. */ |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4654 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
|
4655 gtk_box_pack_start(GTK_BOX(menu_tabby), gtkconv->menu_icon, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4656 FALSE, FALSE, 0); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4657 |
8946 | 4658 gtk_widget_show_all(gtkconv->icon); |
4659 gtk_widget_show_all(gtkconv->menu_icon); | |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4660 |
4359 | 4661 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
|
4662 gtk_box_pack_start(GTK_BOX(menu_tabby), gtkconv->menu_label, TRUE, TRUE, 0); |
4445 | 4663 gtk_widget_show(gtkconv->tab_label); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4664 gtk_widget_show(gtkconv->menu_label); |
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4665 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
|
4666 |
4445 | 4667 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
|
4668 if (gaim_prefs_get_bool("/gaim/gtk/conversations/close_on_tabs")) |
4445 | 4669 gtk_widget_show_all(gtkconv->close); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4670 |
4445 | 4671 gtk_widget_show(tabby); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4672 gtk_widget_show(menu_tabby); |
4359 | 4673 |
7143 | 4674 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
4675 gaim_gtkconv_update_buddy_icon(conv); | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4676 |
9297 | 4677 /* Add this pane to the conversation's notebook. */ |
4359 | 4678 gtk_notebook_append_page(GTK_NOTEBOOK(gtkwin->notebook), tab_cont, tabby); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4679 gtk_notebook_set_menu_label(GTK_NOTEBOOK(gtkwin->notebook), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4680 tab_cont, menu_tabby); |
4359 | 4681 |
4682 gtk_widget_show(tab_cont); | |
4683 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4684 if (gaim_conv_window_get_conversation_count(win) == 1) { |
4818 | 4685 /* Er, bug in notebooks? Switch to the page manually. */ |
4359 | 4686 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), 0); |
4851 | 4687 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4688 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4689 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4690 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4691 else |
4818 | 4692 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), TRUE); |
4359 | 4693 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4694 focus_conv = g_list_nth_data(gaim_conv_window_get_conversations(win), |
5204 | 4695 gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook))); |
4696 focus_gtkconv = GAIM_GTK_CONVERSATION(focus_conv); | |
4697 gtk_widget_grab_focus(focus_gtkconv->entry); | |
4359 | 4698 |
4699 if (!new_ui) | |
4700 g_object_unref(gtkconv->tab_cont); | |
4701 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4702 if (gaim_conv_window_get_conversation_count(win) == 1) |
4685 | 4703 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); |
4359 | 4704 } |
4705 | |
4706 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4707 gaim_gtk_remove_conversation(GaimConvWindow *win, GaimConversation *conv) |
4359 | 4708 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4709 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4710 GaimGtkConversation *gtkconv; |
4359 | 4711 unsigned int index; |
4818 | 4712 GaimConversationType conv_type; |
4713 | |
4714 conv_type = gaim_conversation_get_type(conv); | |
4359 | 4715 index = gaim_conversation_get_index(conv); |
4716 | |
4717 gtkwin = GAIM_GTK_WINDOW(win); | |
4718 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4719 | |
4720 g_object_ref(gtkconv->tab_cont); | |
4721 gtk_object_sink(GTK_OBJECT(gtkconv->tab_cont)); | |
4722 | |
4723 gtk_notebook_remove_page(GTK_NOTEBOOK(gtkwin->notebook), index); | |
4724 | |
4818 | 4725 /* go back to tabless if need be */ |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4726 if (gaim_conv_window_get_conversation_count(win) <= 2) { |
4818 | 4727 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4728 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); |
4818 | 4729 } |
4730 | |
4731 | |
4359 | 4732 /* If this window is setup with an inactive gc, regenerate the menu. */ |
4818 | 4733 if (conv_type == GAIM_CONV_IM && |
4359 | 4734 gaim_conversation_get_gc(conv) == NULL) { |
4735 | |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
4736 generate_send_as_items(win, conv); |
4359 | 4737 } |
4738 } | |
4739 | |
4740 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4741 gaim_gtk_move_conversation(GaimConvWindow *win, GaimConversation *conv, |
4359 | 4742 unsigned int new_index) |
4743 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4744 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4745 GaimGtkConversation *gtkconv; |
4359 | 4746 |
4747 gtkwin = GAIM_GTK_WINDOW(win); | |
4748 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4749 | |
4415
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4750 if (new_index > gaim_conversation_get_index(conv)) |
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4751 new_index--; |
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4752 |
4359 | 4753 gtk_notebook_reorder_child(GTK_NOTEBOOK(gtkwin->notebook), |
4754 gtkconv->tab_cont, new_index); | |
4755 } | |
4756 | |
4757 static int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4758 gaim_gtk_get_active_index(const GaimConvWindow *win) |
4359 | 4759 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4760 GaimGtkWindow *gtkwin; |
5680
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4761 int index; |
4359 | 4762 |
4763 gtkwin = GAIM_GTK_WINDOW(win); | |
4764 | |
5680
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4765 index = gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook)); |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4766 |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4767 /* |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4768 * A fix, because the first conversation may be active, but not |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4769 * appear in the notebook just yet. -- ChipX86 |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4770 */ |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4771 return (index == -1 ? 0 : index); |
4359 | 4772 } |
4773 | |
9260
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4774 static gboolean |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4775 gaim_gtk_has_focus(GaimConvWindow *win) |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4776 { |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4777 GaimGtkWindow *gtkwin; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4778 gboolean has_focus = FALSE; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4779 |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4780 gtkwin = GAIM_GTK_WINDOW(win); |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4781 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
|
4782 |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4783 return has_focus; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4784 } |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4785 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4786 static GaimConvWindowUiOps window_ui_ops = |
4359 | 4787 { |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
4788 gaim_gtk_conversations_get_conv_ui_ops, |
4359 | 4789 gaim_gtk_new_window, |
4790 gaim_gtk_destroy_window, | |
4791 gaim_gtk_show, | |
4792 gaim_gtk_hide, | |
4793 gaim_gtk_raise, | |
4794 gaim_gtk_flash, | |
4795 gaim_gtk_switch_conversation, | |
4796 gaim_gtk_add_conversation, | |
4797 gaim_gtk_remove_conversation, | |
4798 gaim_gtk_move_conversation, | |
9260
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4799 gaim_gtk_get_active_index, |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4800 gaim_gtk_has_focus |
4359 | 4801 }; |
4802 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4803 GaimConvWindowUiOps * |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
4804 gaim_gtk_conversations_get_win_ui_ops(void) |
4359 | 4805 { |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4806 return &window_ui_ops; |
4359 | 4807 } |
4808 | |
4809 /************************************************************************** | |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4810 * Conversation UI operations |
4359 | 4811 **************************************************************************/ |
4812 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4813 gaim_gtkconv_destroy(GaimConversation *conv) |
4359 | 4814 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4815 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); |
4359 | 4816 |
9504 | 4817 /* If the "Save Conversation" or "Save Icon" dialogs are open then close them */ |
4818 gaim_request_close_with_handle(conv); | |
4359 | 4819 |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4820 gtk_widget_destroy(gtkconv->tab_cont); |
4892 | 4821 g_object_unref(gtkconv->tab_cont); |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4822 |
4359 | 4823 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
4755 | 4824 if (gtkconv->u.im->icon_timer != 0) |
4825 g_source_remove(gtkconv->u.im->icon_timer); | |
4826 | |
4359 | 4827 if (gtkconv->u.im->anim != NULL) |
4793 | 4828 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); |
4359 | 4829 |
4830 g_free(gtkconv->u.im); | |
4831 } | |
4832 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
4833 g_free(gtkconv->u.chat); | |
4834 } | |
4835 | |
4633 | 4836 gtk_object_sink(GTK_OBJECT(gtkconv->tooltips)); |
4837 | |
4359 | 4838 g_free(gtkconv); |
4839 } | |
4840 | |
4841 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4842 gaim_gtkconv_write_im(GaimConversation *conv, const char *who, |
6982 | 4843 const char *message, GaimMessageFlags flags, |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4844 time_t mtime) |
4359 | 4845 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4846 GaimGtkConversation *gtkconv; |
8630 | 4847 GaimConvWindow *gaimwin; |
4848 GaimGtkWindow *gtkwin; | |
4849 gboolean has_focus; | |
4359 | 4850 |
4851 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
8630 | 4852 gaimwin = gaim_conversation_get_window(conv); |
4853 gtkwin = GAIM_GTK_WINDOW(gaimwin); | |
4854 | |
4855 g_object_get(G_OBJECT(gtkwin->window), "has-toplevel-focus", &has_focus, NULL); | |
4359 | 4856 |
6621 | 4857 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
9301 | 4858 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
|
4859 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4860 gaim_conv_window_raise(gaim_conversation_get_window(conv)); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4861 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4862 |
4382
76223649765b
[gaim-migrate @ 4648]
Christian Hammond <chipx86@chipx86.com>
parents:
4378
diff
changeset
|
4863 /* Play a sound, if specified in prefs. */ |
8630 | 4864 if (gtkconv->make_sound && !((gaim_conv_window_get_active_conversation(gaimwin) == conv) && |
8633 | 4865 !gaim_prefs_get_bool("/gaim/gtk/sound/conv_focus") && has_focus)) { |
6621 | 4866 if (flags & GAIM_MESSAGE_RECV) { |
4359 | 4867 if (gtkconv->u.im->a_virgin && |
5820 | 4868 gaim_prefs_get_bool("/gaim/gtk/sound/enabled/first_im_recv")) { |
4359 | 4869 |
4561 | 4870 gaim_sound_play_event(GAIM_SOUND_FIRST_RECEIVE); |
4359 | 4871 } |
4872 else | |
4561 | 4873 gaim_sound_play_event(GAIM_SOUND_RECEIVE); |
4359 | 4874 } |
4875 else { | |
4561 | 4876 gaim_sound_play_event(GAIM_SOUND_SEND); |
4359 | 4877 } |
4878 } | |
4879 | |
4880 gtkconv->u.im->a_virgin = FALSE; | |
4881 | |
6982 | 4882 gaim_conversation_write(conv, who, message, flags, mtime); |
4359 | 4883 } |
4884 | |
4885 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4886 gaim_gtkconv_write_chat(GaimConversation *conv, const char *who, |
6621 | 4887 const char *message, GaimMessageFlags flags, time_t mtime) |
4359 | 4888 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4889 GaimGtkConversation *gtkconv; |
8630 | 4890 GaimConvWindow *gaimwin; |
4891 GaimGtkWindow *gtkwin; | |
4892 gboolean has_focus; | |
4359 | 4893 |
4894 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
8630 | 4895 gaimwin = gaim_conversation_get_window(conv); |
4896 gtkwin = GAIM_GTK_WINDOW(gaimwin); | |
4897 | |
4898 g_object_get(G_OBJECT(gtkwin->window), "has-toplevel-focus", &has_focus, NULL); | |
4359 | 4899 |
4382
76223649765b
[gaim-migrate @ 4648]
Christian Hammond <chipx86@chipx86.com>
parents:
4378
diff
changeset
|
4900 /* Play a sound, if specified in prefs. */ |
8630 | 4901 if (gtkconv->make_sound && !((gaim_conv_window_get_active_conversation(gaimwin) == conv) && |
8633 | 4902 !gaim_prefs_get_bool("/gaim/gtk/sound/conv_focus") && has_focus)) { |
6621 | 4903 if (!(flags & GAIM_MESSAGE_WHISPER) && (flags & GAIM_MESSAGE_SEND)) |
4561 | 4904 gaim_sound_play_event(GAIM_SOUND_CHAT_YOU_SAY); |
6621 | 4905 else if (flags & GAIM_MESSAGE_RECV) { |
4906 if ((flags & GAIM_MESSAGE_NICK) && | |
8573 | 4907 gaim_prefs_get_bool("/gaim/gtk/sound/enabled/nick_said") && |
4908 !(flags & GAIM_MESSAGE_SYSTEM)) { | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4909 |
4561 | 4910 gaim_sound_play_event(GAIM_SOUND_CHAT_NICK); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4911 } |
4359 | 4912 else |
4561 | 4913 gaim_sound_play_event(GAIM_SOUND_CHAT_SAY); |
4359 | 4914 } |
4915 } | |
4916 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4917 if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/color_nicks")) |
6621 | 4918 flags |= GAIM_MESSAGE_COLORIZE; |
4359 | 4919 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4920 /* Raise the window, if specified in prefs. */ |
6621 | 4921 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
9150 | 4922 /* we may want to change this */ |
9301 | 4923 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
|
4924 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4925 gaim_conv_window_raise(gaim_conversation_get_window(conv)); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4926 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4927 |
6982 | 4928 gaim_conversation_write(conv, who, message, flags, mtime); |
4359 | 4929 } |
4930 | |
4931 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4932 gaim_gtkconv_write_conv(GaimConversation *conv, const char *who, |
6982 | 4933 const char *message, GaimMessageFlags flags, |
4359 | 4934 time_t mtime) |
4935 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4936 GaimGtkConversation *gtkconv; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4937 GaimConvWindow *win; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
4938 GaimConnection *gc; |
4359 | 4939 int gtk_font_options = 0; |
7440 | 4940 char buf[BUF_LONG]; |
4359 | 4941 char buf2[BUF_LONG]; |
4942 char mdate[64]; | |
4943 char color[10]; | |
4944 char *str; | |
4945 char *with_font_tag; | |
4896 | 4946 char *sml_attrib = NULL; |
6982 | 4947 size_t length = strlen(message) + 1; |
4895 | 4948 |
4359 | 4949 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4950 gc = gaim_conversation_get_gc(conv); | |
4951 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4952 win = gaim_conversation_get_window(conv); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4953 |
9301 | 4954 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
4955 ((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT && | |
4956 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) || | |
4957 (gaim_conversation_get_type(conv) == GAIM_CONV_IM && | |
4958 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
|
4959 gaim_conv_window_show(win); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4960 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4961 |
8677 | 4962 if (gtk_text_buffer_get_char_count(gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)))) |
4963 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", 0); | |
4964 | |
5133 | 4965 if(time(NULL) > mtime + 20*60) /* show date if older than 20 minutes */ |
4966 strftime(mdate, sizeof(mdate), "%Y-%m-%d %H:%M:%S", localtime(&mtime)); | |
4967 else | |
4968 strftime(mdate, sizeof(mdate), "%H:%M:%S", localtime(&mtime)); | |
4359 | 4969 |
4896 | 4970 if(gc) |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4971 sml_attrib = g_strdup_printf("sml=\"%s\"", gc->prpl->info->name); |
7440 | 4972 |
4359 | 4973 gtk_font_options ^= GTK_IMHTML_NO_COMMENTS; |
4974 | |
9049 | 4975 #if 1 /* PREFSLASH04 */ |
4976 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_colors")) | |
4977 gtk_font_options ^= GTK_IMHTML_NO_COLOURS; | |
4978 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_fonts")) | |
4979 gtk_font_options ^= GTK_IMHTML_NO_FONTS; | |
4980 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_font_sizes")) | |
4981 gtk_font_options ^= GTK_IMHTML_NO_SIZES; | |
4982 #else | |
8944 | 4983 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_formatting")) { |
4359 | 4984 gtk_font_options ^= GTK_IMHTML_NO_COLOURS; |
4985 gtk_font_options ^= GTK_IMHTML_NO_FONTS; | |
4986 gtk_font_options ^= GTK_IMHTML_NO_SIZES; | |
8944 | 4987 } |
9049 | 4988 #endif |
4359 | 4989 |
7956 | 4990 /* this is gonna crash one day, I can feel it. */ |
4991 if (GAIM_PLUGIN_PROTOCOL_INFO(gaim_find_prpl(gaim_account_get_protocol_id(conv->account)))->options & | |
7431 | 4992 OPT_PROTO_USE_POINTSIZE) { |
5367 | 4993 gtk_font_options ^= GTK_IMHTML_USE_POINTSIZE; |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4994 } |
4359 | 4995 |
6621 | 4996 if (flags & GAIM_MESSAGE_SYSTEM) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4997 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) |
8380 | 4998 g_snprintf(buf, BUF_LONG, "<FONT SIZE=\"2\">(%s)</FONT> <B>%s</B>", |
7431 | 4999 mdate, message); |
4359 | 5000 else |
5001 g_snprintf(buf, BUF_LONG, "<B>%s</B>", message); | |
7440 | 5002 |
4359 | 5003 g_snprintf(buf2, sizeof(buf2), |
8690 | 5004 "<FONT %s><FONT SIZE=\"2\"><!--(%s) --></FONT><B>%s</B></FONT>", |
7850 | 5005 sml_attrib, mdate, message); |
7440 | 5006 |
8962 | 5007 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, 0); |
7440 | 5008 |
7583 | 5009 /* Add the message to a conversations scrollback buffer */ |
5010 conv->history = g_string_append(conv->history, buf); | |
5011 conv->history = g_string_append(conv->history, "<BR>\n"); | |
7440 | 5012 |
8722 | 5013 } else if (flags & GAIM_MESSAGE_ERROR) { |
5014 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) | |
5015 g_snprintf(buf, BUF_LONG, "<FONT SIZE=\"2\">(%s)</FONT> <B>%s</B>", | |
5016 mdate, message); | |
5017 else | |
5018 g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"#ff0000\"><B>%s</B></FONT>", message); | |
5019 | |
5020 g_snprintf(buf2, sizeof(buf2), | |
5021 "<FONT %s><FONT SIZE=\"2\"><!--(%s) --></FONT><B>%s</B></FONT>", | |
5022 sml_attrib, mdate, message); | |
5023 | |
8962 | 5024 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, 0); |
5025 | |
8722 | 5026 /* Add the message to a conversations scrollback buffer */ |
5027 conv->history = g_string_append(conv->history, buf); | |
5028 conv->history = g_string_append(conv->history, "<BR>\n"); | |
7431 | 5029 } else if (flags & GAIM_MESSAGE_NO_LOG) { |
4359 | 5030 g_snprintf(buf, BUF_LONG, |
8690 | 5031 "<B><FONT %s COLOR=\"#777777\">%s</FONT></B>", |
7850 | 5032 sml_attrib, message); |
7440 | 5033 |
8962 | 5034 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf, 0); |
4359 | 5035 } |
5036 else { | |
4895 | 5037 char *new_message = g_memdup(message, length); |
8908 | 5038 char *who_escaped = g_markup_escape_text(who, strlen(who)); |
7440 | 5039 |
6621 | 5040 if (flags & GAIM_MESSAGE_WHISPER) { |
4359 | 5041 str = g_malloc(1024); |
7440 | 5042 |
4359 | 5043 /* If we're whispering, it's not an autoresponse. */ |
7564 | 5044 if (gaim_message_meify(new_message, length)) { |
8908 | 5045 g_snprintf(str, 1024, "***%s", who_escaped); |
4359 | 5046 strcpy(color, "#6C2585"); |
5047 } | |
5048 else { | |
8908 | 5049 g_snprintf(str, 1024, "*%s*:", who_escaped); |
4359 | 5050 strcpy(color, "#00FF00"); |
5051 } | |
7440 | 5052 } |
4359 | 5053 else { |
7564 | 5054 if (gaim_message_meify(new_message, length)) { |
4359 | 5055 str = g_malloc(1024); |
7440 | 5056 |
6621 | 5057 if (flags & GAIM_MESSAGE_AUTO_RESP) |
8908 | 5058 g_snprintf(str, 1024, "%s ***%s", AUTO_RESPONSE, who_escaped); |
4359 | 5059 else |
8908 | 5060 g_snprintf(str, 1024, "***%s", who_escaped); |
7440 | 5061 |
6621 | 5062 if (flags & GAIM_MESSAGE_NICK) |
4359 | 5063 strcpy(color, "#AF7F00"); |
5064 else | |
5065 strcpy(color, "#062585"); | |
5066 } | |
5067 else { | |
5068 str = g_malloc(1024); | |
6621 | 5069 if (flags & GAIM_MESSAGE_AUTO_RESP) |
8908 | 5070 g_snprintf(str, 1024, "%s %s", who_escaped, AUTO_RESPONSE); |
4359 | 5071 else |
8908 | 5072 g_snprintf(str, 1024, "%s:", who_escaped); |
6621 | 5073 if (flags & GAIM_MESSAGE_NICK) |
4359 | 5074 strcpy(color, "#AF7F00"); |
6621 | 5075 else if (flags & GAIM_MESSAGE_RECV) { |
5076 if (flags & GAIM_MESSAGE_COLORIZE) { | |
4359 | 5077 const char *u; |
5078 int m = 0; | |
7440 | 5079 |
4359 | 5080 for (u = who; *u != '\0'; u++) |
5081 m += *u; | |
7440 | 5082 |
4359 | 5083 m = m % NUM_NICK_COLORS; |
7440 | 5084 |
4359 | 5085 strcpy(color, nick_colors[m]); |
5086 } | |
5087 else | |
7854 | 5088 strcpy(color, RECV_COLOR); |
4359 | 5089 } |
6621 | 5090 else if (flags & GAIM_MESSAGE_SEND) |
7854 | 5091 strcpy(color, SEND_COLOR); |
4359 | 5092 } |
8908 | 5093 |
5094 if(who_escaped) | |
5095 g_free(who_escaped); | |
4359 | 5096 } |
7440 | 5097 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5098 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) |
4359 | 5099 g_snprintf(buf, BUF_LONG, |
8380 | 5100 "<FONT COLOR=\"%s\" %s><FONT SIZE=\"2\">(%s)</FONT> " |
7431 | 5101 "<B>%s</B></FONT> ", color, |
5102 sml_attrib ? sml_attrib : "", mdate, str); | |
4359 | 5103 else |
5104 g_snprintf(buf, BUF_LONG, | |
7431 | 5105 "<FONT COLOR=\"%s\" %s><B>%s</B></FONT> ", color, |
5106 sml_attrib ? sml_attrib : "", str); | |
7440 | 5107 |
4359 | 5108 g_snprintf(buf2, BUF_LONG, |
8380 | 5109 "<FONT COLOR=\"%s\" %s><FONT SIZE=\"2\"><!--(%s) --></FONT>" |
7431 | 5110 "<B>%s</B></FONT> ", |
5111 color, sml_attrib ? sml_attrib : "", mdate, str); | |
7440 | 5112 |
4359 | 5113 g_free(str); |
5114 | |
8962 | 5115 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), |
5116 buf2, 0); | |
4359 | 5117 |
4895 | 5118 if(gc){ |
4896 | 5119 char *pre = g_strdup_printf("<font %s>", sml_attrib ? sml_attrib : ""); |
4895 | 5120 char *post = "</font>"; |
5121 int pre_len = strlen(pre); | |
5122 int post_len = strlen(post); | |
7440 | 5123 |
4895 | 5124 with_font_tag = g_malloc(length + pre_len + post_len + 1); |
7440 | 5125 |
4895 | 5126 strcpy(with_font_tag, pre); |
5127 memcpy(with_font_tag + pre_len, new_message, length); | |
5128 strcpy(with_font_tag + pre_len + length, post); | |
7440 | 5129 |
4895 | 5130 length += pre_len + post_len; |
5131 g_free(pre); | |
5132 } | |
4608 | 5133 else |
4895 | 5134 with_font_tag = g_memdup(new_message, length); |
7440 | 5135 |
8962 | 5136 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), |
5137 with_font_tag, gtk_font_options); | |
7440 | 5138 |
8557 | 5139 conv->history = g_string_append(conv->history, buf); |
5140 conv->history = g_string_append(conv->history, new_message); | |
5141 conv->history = g_string_append(conv->history, "<BR>\n"); | |
7440 | 5142 |
5143 g_free(with_font_tag); | |
7447 | 5144 g_free(new_message); |
7440 | 5145 } |
5146 | |
6062 | 5147 |
5012 | 5148 if(sml_attrib) |
5149 g_free(sml_attrib); | |
4359 | 5150 } |
5151 | |
5152 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5153 gaim_gtkconv_chat_add_user(GaimConversation *conv, const char *user) |
4359 | 5154 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5155 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5156 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5157 GaimGtkChatPane *gtkchat; |
4359 | 5158 char tmp[BUF_LONG]; |
5159 int num_users; | |
5160 int pos; | |
5161 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5162 chat = GAIM_CONV_CHAT(conv); |
4359 | 5163 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5164 gtkchat = gtkconv->u.chat; | |
5165 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5166 num_users = g_list_length(gaim_conv_chat_get_users(chat)); |
4359 | 5167 |
5168 g_snprintf(tmp, sizeof(tmp), | |
5169 ngettext("%d person in room", "%d people in room", | |
5170 num_users), | |
5171 num_users); | |
5172 | |
5173 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); | |
5174 | |
5175 if (gtkconv->make_sound) | |
4561 | 5176 gaim_sound_play_event(GAIM_SOUND_CHAT_JOIN); |
4359 | 5177 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5178 pos = g_list_index(gaim_conv_chat_get_users(chat), user); |
4359 | 5179 |
5180 add_chat_buddy_common(conv, user, pos); | |
5181 } | |
5182 | |
5183 static void | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5184 gaim_gtkconv_chat_add_users(GaimConversation *conv, GList *users) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5185 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5186 GaimConvChat *chat; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5187 GaimGtkConversation *gtkconv; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5188 GaimGtkChatPane *gtkchat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5189 GList *l; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5190 char tmp[BUF_LONG]; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5191 int num_users; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5192 int pos; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5193 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5194 chat = GAIM_CONV_CHAT(conv); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5195 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5196 gtkchat = gtkconv->u.chat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5197 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5198 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
|
5199 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5200 g_snprintf(tmp, sizeof(tmp), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5201 ngettext("%d person in room", "%d people in room", |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5202 num_users), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5203 num_users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5204 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5205 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5206 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5207 for (l = users; l != NULL; l = l->next) { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5208 pos = g_list_index(gaim_conv_chat_get_users(chat), (char *)l->data); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5209 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5210 add_chat_buddy_common(conv, (char *)l->data, pos); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5211 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5212 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5213 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5214 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5215 gaim_gtkconv_chat_rename_user(GaimConversation *conv, const char *old_name, |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5216 const char *new_name) |
4359 | 5217 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5218 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5219 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5220 GaimGtkChatPane *gtkchat; |
4359 | 5221 GtkTreeIter iter; |
5222 GtkTreeModel *model; | |
5223 GList *names; | |
5224 int pos; | |
5225 int f = 1; | |
5226 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5227 chat = GAIM_CONV_CHAT(conv); |
4359 | 5228 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5229 gtkchat = gtkconv->u.chat; | |
5230 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5231 for (names = gaim_conv_chat_get_users(chat); |
4359 | 5232 names != NULL; |
5233 names = names->next) { | |
5234 | |
5235 char *u = (char *)names->data; | |
5236 | |
4793 | 5237 if (!gaim_utf8_strcasecmp(u, old_name)) { |
4359 | 5238 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
5239 | |
5240 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
5241 break; | |
5242 | |
5243 while (f != 0) { | |
5244 char *val; | |
5245 | |
9498 | 5246 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &val, -1); |
4359 | 5247 |
4793 | 5248 if (!gaim_utf8_strcasecmp(old_name, val)) { |
4359 | 5249 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
4640 | 5250 break; |
5251 } | |
4359 | 5252 |
5253 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
5254 | |
5255 g_free(val); | |
5256 } | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
5257 |
4359 | 5258 break; |
5259 } | |
5260 } | |
5261 | |
5262 if (!names) | |
5263 return; | |
5264 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5265 pos = g_list_index(gaim_conv_chat_get_users(chat), new_name); |
4359 | 5266 |
5267 add_chat_buddy_common(conv, new_name, pos); | |
5268 } | |
5269 | |
5270 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5271 gaim_gtkconv_chat_remove_user(GaimConversation *conv, const char *user) |
4359 | 5272 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5273 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5274 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5275 GaimGtkChatPane *gtkchat; |
4359 | 5276 GtkTreeIter iter; |
5277 GtkTreeModel *model; | |
5278 GList *names; | |
5279 char tmp[BUF_LONG]; | |
5280 int num_users; | |
5281 int f = 1; | |
5282 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5283 chat = GAIM_CONV_CHAT(conv); |
4359 | 5284 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5285 gtkchat = gtkconv->u.chat; | |
5286 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5287 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
|
5288 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5289 for (names = gaim_conv_chat_get_users(chat); |
4359 | 5290 names != NULL; |
5291 names = names->next) { | |
5292 | |
5293 char *u = (char *)names->data; | |
5294 | |
4793 | 5295 if (!gaim_utf8_strcasecmp(u, user)) { |
4359 | 5296 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
5297 | |
5298 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
5299 break; | |
5300 | |
5301 while (f != 0) { | |
5302 char *val; | |
5303 | |
9498 | 5304 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &val, -1); |
4359 | 5305 |
4793 | 5306 if (!gaim_utf8_strcasecmp(user, val)) |
4359 | 5307 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
5308 | |
5309 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
5310 | |
5311 g_free(val); | |
5312 } | |
5313 | |
5314 break; | |
5315 } | |
5316 } | |
5317 | |
5318 if (names == NULL) | |
5319 return; | |
5320 | |
5321 g_snprintf(tmp, sizeof(tmp), | |
5322 ngettext("%d person in room", "%d people in room", | |
5323 num_users), num_users); | |
5324 | |
5325 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); | |
5326 | |
5327 if (gtkconv->make_sound) | |
4561 | 5328 gaim_sound_play_event(GAIM_SOUND_CHAT_LEAVE); |
4359 | 5329 } |
5330 | |
5331 static void | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5332 gaim_gtkconv_chat_remove_users(GaimConversation *conv, GList *users) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5333 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5334 GaimConvChat *chat; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5335 GaimGtkConversation *gtkconv; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5336 GaimGtkChatPane *gtkchat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5337 GtkTreeIter iter; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5338 GtkTreeModel *model; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5339 GList *names = NULL; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5340 GList *l; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5341 char tmp[BUF_LONG]; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5342 int num_users; |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
5343 gboolean f; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5344 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5345 chat = GAIM_CONV_CHAT(conv); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5346 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5347 gtkchat = gtkconv->u.chat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5348 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5349 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
|
5350 g_list_length(users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5351 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5352 for (l = users; l != NULL; l = l->next) { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5353 for (names = gaim_conv_chat_get_users(chat); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5354 names != NULL; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5355 names = names->next) { |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5356 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5357 char *u = (char *)names->data; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5358 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5359 if (!gaim_utf8_strcasecmp(u, (char *)l->data)) { |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5360 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5361 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5362 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5363 &iter)) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5364 break; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5365 |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
5366 do { |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5367 char *val; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5368 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5369 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, |
9498 | 5370 CHAT_USERS_NAME_COLUMN, &val, -1); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5371 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5372 if (!gaim_utf8_strcasecmp((char *)l->data, val)) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5373 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5374 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5375 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5376 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5377 g_free(val); |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
5378 } while (f); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
5379 |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5380 break; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5381 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5382 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5383 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5384 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5385 if (names == NULL) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5386 return; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5387 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5388 g_snprintf(tmp, sizeof(tmp), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5389 ngettext("%d person in room", "%d people in room", |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5390 num_users), num_users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5391 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5392 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5393 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5394 |
9260
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5395 static gboolean |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5396 gaim_gtkconv_has_focus(GaimConversation *conv) |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5397 { |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5398 GaimConvWindow *win; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5399 GaimGtkWindow *gtkwin; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5400 gboolean has_focus; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5401 |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5402 win = gaim_conversation_get_window(conv); |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5403 gtkwin = GAIM_GTK_WINDOW(win); |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5404 |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5405 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
|
5406 |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5407 return has_focus; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5408 } |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5409 |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5410 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5411 gaim_gtkconv_updated(GaimConversation *conv, GaimConvUpdateType type) |
4359 | 5412 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5413 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5414 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5415 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5416 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5417 GaimConvChat *chat; |
4359 | 5418 |
5419 win = gaim_conversation_get_window(conv); | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5420 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 5421 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5422 | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5423 if (type == GAIM_CONV_UPDATE_ACCOUNT) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5424 { |
4359 | 5425 gaim_conversation_autoset_title(conv); |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5426 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5427 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5428 gaim_gtkconv_update_buddy_icon(conv); |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5429 |
4359 | 5430 gaim_gtkconv_update_buttons_by_protocol(conv); |
5431 | |
4685 | 5432 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); |
4359 | 5433 |
5434 smiley_themeize(gtkconv->imhtml); | |
6394 | 5435 |
6395 | 5436 update_tab_icon(conv); |
4359 | 5437 } |
5438 else if (type == GAIM_CONV_UPDATE_TYPING || | |
8155
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5439 type == GAIM_CONV_UPDATE_UNSEEN || |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5440 type == GAIM_CONV_UPDATE_TITLE) |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5441 { |
9472 | 5442 char *title; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5443 GaimConvIm *im = NULL; |
9472 | 5444 GaimConnection *gc = gaim_conversation_get_gc(conv); |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5445 char color[8]; |
4736 | 5446 |
4359 | 5447 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5448 im = GAIM_CONV_IM(conv); |
4359 | 5449 |
9472 | 5450 if (!gc || ((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) |
5451 && gaim_conv_chat_has_left(GAIM_CONV_CHAT(conv)))) | |
5452 title = g_strdup_printf("(%s)", gaim_conversation_get_title(conv)); | |
5453 | |
5454 else | |
5455 title = g_strdup(gaim_conversation_get_title(conv)); | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5456 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5457 *color = '\0'; |
4359 | 5458 |
5459 if (!GTK_WIDGET_REALIZED(gtkconv->tab_label)) | |
5460 gtk_widget_realize(gtkconv->tab_label); | |
5461 | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5462 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
|
5463 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5464 strcpy(color, "#47A046"); |
4359 | 5465 } |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5466 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
|
5467 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5468 strcpy(color, "#D1940C"); |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5469 } |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5470 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_NICK) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5471 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5472 strcpy(color, "#314E6C"); |
4359 | 5473 } |
8252 | 5474 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_TEXT) |
5475 { | |
5476 strcpy(color, "#DF421E"); | |
5477 } | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5478 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_EVENT) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5479 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5480 strcpy(color, "#868272"); |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5481 } |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5482 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5483 if (*color != '\0') |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5484 { |
8536 | 5485 char *html_title,*label; |
5486 | |
5487 html_title = gaim_escape_html(title); | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5488 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5489 label = g_strdup_printf("<span color=\"%s\">%s</span>", |
8536 | 5490 color, html_title); |
5491 g_free(html_title); | |
7995
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
5492 gtk_label_set_markup(GTK_LABEL(gtkconv->tab_label), label); |
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
5493 g_free(label); |
4359 | 5494 } |
7995
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
5495 else |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5496 gtk_label_set_text(GTK_LABEL(gtkconv->tab_label), title); |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5497 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5498 if (conv == gaim_conv_window_get_active_conversation(win)) |
4736 | 5499 update_typing_icon(conv); |
8155
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5500 |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5501 if (type == GAIM_CONV_UPDATE_TITLE) { |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5502 gtk_label_set_text(GTK_LABEL(gtkconv->menu_label), title); |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5503 if (conv == gaim_conv_window_get_active_conversation(win)) |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5504 gtk_window_set_title(GTK_WINDOW(gtkwin->window), title); |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5505 } |
9472 | 5506 |
5507 g_free(title); | |
4359 | 5508 } |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5509 else if (type == GAIM_CONV_UPDATE_TOPIC) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5510 { |
7154 | 5511 const char *topic; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5512 chat = GAIM_CONV_CHAT(conv); |
4359 | 5513 gtkchat = gtkconv->u.chat; |
5514 | |
7154 | 5515 topic = gaim_conv_chat_get_topic(chat); |
5516 | |
5517 gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text),topic); | |
5518 gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->topic_text, | |
8155
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5519 topic, NULL); |
4359 | 5520 } |
5521 else if (type == GAIM_CONV_ACCOUNT_ONLINE || | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5522 type == GAIM_CONV_ACCOUNT_OFFLINE) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5523 { |
7929 | 5524 gray_stuff_out(gaim_conv_window_get_active_conversation(win)); |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
5525 generate_send_as_items(win, NULL); |
8946 | 5526 update_tab_icon(conv); |
9472 | 5527 gaim_conversation_autoset_title(conv); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5528 } |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5529 else if (type == GAIM_CONV_UPDATE_AWAY) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5530 { |
8946 | 5531 update_tab_icon(conv); |
4359 | 5532 } |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
5533 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
|
5534 type == GAIM_CONV_UPDATE_CHATLEFT) |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5535 { |
9472 | 5536 gaim_conversation_autoset_title(conv); |
7929 | 5537 gray_stuff_out(conv); |
4397
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
5538 } |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5539 else if (type == GAIM_CONV_UPDATE_ICON) |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5540 { |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5541 gaim_gtkconv_update_buddy_icon(conv); |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5542 } |
4359 | 5543 } |
5544 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5545 static GaimConversationUiOps conversation_ui_ops = |
4359 | 5546 { |
5547 gaim_gtkconv_destroy, /* destroy_conversation */ | |
5548 gaim_gtkconv_write_chat, /* write_chat */ | |
5549 gaim_gtkconv_write_im, /* write_im */ | |
5550 gaim_gtkconv_write_conv, /* write_conv */ | |
5551 gaim_gtkconv_chat_add_user, /* chat_add_user */ | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5552 gaim_gtkconv_chat_add_users, /* chat_add_users */ |
4359 | 5553 gaim_gtkconv_chat_rename_user, /* chat_rename_user */ |
5554 gaim_gtkconv_chat_remove_user, /* chat_remove_user */ | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5555 gaim_gtkconv_chat_remove_users, /* chat_remove_users */ |
4359 | 5556 NULL, /* update_progress */ |
9260
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5557 gaim_gtkconv_has_focus, /* has_focus */ |
4359 | 5558 gaim_gtkconv_updated /* updated */ |
5559 }; | |
5560 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5561 GaimConversationUiOps * |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
5562 gaim_gtk_conversations_get_conv_ui_ops(void) |
4359 | 5563 { |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
5564 return &conversation_ui_ops; |
4359 | 5565 } |
5566 | |
5567 /************************************************************************** | |
5568 * Public conversation utility functions | |
5569 **************************************************************************/ | |
5570 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5571 gaim_gtkconv_update_buddy_icon(GaimConversation *conv) |
4359 | 5572 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5573 GaimGtkConversation *gtkconv; |
7143 | 5574 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); |
4359 | 5575 |
5576 char filename[256]; | |
5577 FILE *file; | |
5578 GError *err = NULL; | |
5579 | |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5580 const void *data; |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5581 size_t len; |
4359 | 5582 |
5583 GdkPixbuf *buf; | |
5584 | |
8821 | 5585 GtkWidget *vbox; |
4359 | 5586 GtkWidget *event; |
5587 GtkWidget *frame; | |
5588 GdkPixbuf *scale; | |
5589 GdkPixmap *pm; | |
5590 GdkBitmap *bm; | |
9318 | 5591 int scale_width, scale_height; |
9332 | 5592 GtkRequisition requisition; |
9318 | 5593 |
5594 GaimAccount *account; | |
5595 GaimPluginProtocolInfo *prpl_info = NULL; | |
4359 | 5596 |
8821 | 5597 GaimButtonStyle button_type; |
5598 | |
9324 | 5599 GaimBuddyIcon *icon; |
5600 | |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5601 g_return_if_fail(conv != NULL); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5602 g_return_if_fail(GAIM_IS_GTK_CONVERSATION(conv)); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5603 g_return_if_fail(gaim_conversation_get_type(conv) == GAIM_CONV_IM); |
4359 | 5604 |
5605 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
9318 | 5606 account = gaim_conversation_get_account(conv); |
5607 if(account && account->gc) | |
5608 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl); | |
4359 | 5609 |
5610 remove_icon(gtkconv); | |
5611 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5612 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/im/show_buddy_icons")) |
4359 | 5613 return; |
5614 | |
5615 if (gaim_conversation_get_gc(conv) == NULL) | |
5616 return; | |
5617 | |
8189 | 5618 if (gtkconv->u.im->anim) |
4793 | 5619 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); |
5620 | |
9324 | 5621 |
5622 | |
5623 icon = gaim_conv_im_get_icon(GAIM_CONV_IM(conv)); | |
5624 | |
5625 if (icon == NULL) | |
5626 return; | |
5627 | |
5628 data = gaim_buddy_icon_get_data(icon, &len); | |
5629 | |
5630 /* this is such an evil hack, i don't know why i'm even considering it. | |
5631 * we'll do it differently when gdk-pixbuf-loader isn't leaky anymore. */ | |
5632 /* gdk-pixbuf-loader was leaky? is it still? */ | |
5633 g_snprintf(filename, sizeof(filename), | |
5634 "%s" G_DIR_SEPARATOR_S "gaimicon-%s.%d", | |
5635 g_get_tmp_dir(), gaim_conversation_get_name(conv), getpid()); | |
5636 | |
5637 if (!(file = fopen(filename, "wb"))) | |
5638 return; | |
5639 | |
5640 fwrite(data, 1, len, file); | |
5641 fclose(file); | |
5642 | |
5643 gtkconv->u.im->anim = gdk_pixbuf_animation_new_from_file(filename, &err); | |
5644 /* make sure we remove the file as soon as possible */ | |
5645 unlink(filename); | |
5646 | |
4359 | 5647 |
5648 if (err) { | |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5649 gaim_debug(GAIM_DEBUG_ERROR, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5650 "Buddy icon error: %s\n", err->message); |
4359 | 5651 g_error_free(err); |
5652 } | |
5653 | |
5654 if (!gtkconv->u.im->anim) | |
5655 return; | |
5656 | |
4793 | 5657 if(gtkconv->u.im->iter) |
5658 g_object_unref(G_OBJECT(gtkconv->u.im->iter)); | |
5659 | |
4359 | 5660 if (gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim)) { |
5661 gtkconv->u.im->iter = NULL; | |
5662 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); | |
5663 } else { | |
5664 gtkconv->u.im->iter = | |
8496 | 5665 gdk_pixbuf_animation_get_iter(gtkconv->u.im->anim, NULL); /* LEAK */ |
4359 | 5666 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); |
8189 | 5667 if (gtkconv->u.im->animate) |
5668 start_anim(NULL, conv); | |
4359 | 5669 } |
5670 | |
9318 | 5671 get_icon_scale_size(gtkconv->u.im->anim, prpl_info ? &prpl_info->icon_spec : |
5672 NULL, &scale_width, &scale_height); | |
4359 | 5673 scale = gdk_pixbuf_scale_simple(buf, |
9318 | 5674 MAX(gdk_pixbuf_get_width(buf) * scale_width / |
4359 | 5675 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), |
9318 | 5676 MAX(gdk_pixbuf_get_height(buf) * scale_height / |
4359 | 5677 gdk_pixbuf_animation_get_height(gtkconv->u.im->anim), 1), |
5678 GDK_INTERP_NEAREST); | |
5679 | |
5680 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); | |
4793 | 5681 g_object_unref(G_OBJECT(scale)); |
4359 | 5682 |
8821 | 5683 |
5684 vbox = gtk_vbox_new(FALSE, 0); | |
5685 | |
4359 | 5686 frame = gtk_frame_new(NULL); |
5687 gtk_frame_set_shadow_type(GTK_FRAME(frame), | |
5688 (bm ? GTK_SHADOW_NONE : GTK_SHADOW_IN)); | |
8821 | 5689 gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); |
5690 | |
4359 | 5691 event = gtk_event_box_new(); |
5692 gtk_container_add(GTK_CONTAINER(frame), event); | |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
5693 g_signal_connect(G_OBJECT(event), "button-press-event", |
4359 | 5694 G_CALLBACK(icon_menu), conv); |
5695 gtk_widget_show(event); | |
5696 | |
4635 | 5697 gtkconv->u.im->icon = gtk_image_new_from_pixmap(pm, bm); |
9318 | 5698 gtk_widget_set_size_request(gtkconv->u.im->icon, scale_width, scale_height); |
4359 | 5699 gtk_container_add(GTK_CONTAINER(event), gtkconv->u.im->icon); |
5700 gtk_widget_show(gtkconv->u.im->icon); | |
5701 | |
4793 | 5702 g_object_unref(G_OBJECT(pm)); |
4359 | 5703 |
5704 if (bm) | |
4793 | 5705 g_object_unref(G_OBJECT(bm)); |
7143 | 5706 |
9332 | 5707 button_type = gaim_prefs_get_int("/gaim/gtk/conversations/button_type"); |
5708 gtk_widget_size_request(gtkconv->bbox, &requisition); | |
5709 if(button_type == GAIM_BUTTON_NONE || requisition.height < scale_height) { | |
5710 gtk_box_pack_start(GTK_BOX(gtkconv->lower_hbox), vbox, FALSE, FALSE, 0); | |
5711 /* gtk_box_reorder_child(GTK_BOX(gtkconv->lower_hbox), vbox, 0); */ | |
5712 } else { | |
5713 gtk_box_pack_start(GTK_BOX(gtkconv->bbox), vbox, FALSE, FALSE, 0); | |
5714 gtk_box_reorder_child(GTK_BOX(gtkconv->bbox), vbox, 0); | |
5715 } | |
5716 | |
5717 gtk_widget_show(vbox); | |
5718 gtk_widget_show(frame); | |
5719 | |
7143 | 5720 /* The buddy icon code needs badly to be fixed. */ |
5721 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); | |
8068 | 5722 if(conv == gaim_conv_window_get_active_conversation(gaim_conversation_get_window(conv))) |
5723 gtk_window_set_icon(GTK_WINDOW(gtkwin->window), buf); | |
4359 | 5724 } |
5725 | |
5726 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5727 gaim_gtkconv_update_buttons_by_protocol(GaimConversation *conv) |
4359 | 5728 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5729 GaimConvWindow *win; |
4359 | 5730 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5731 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
4359 | 5732 return; |
5733 | |
7887 | 5734 win = gaim_conversation_get_window(conv); |
5735 | |
5736 if (win != NULL && gaim_conv_window_get_active_conversation(win) == conv) | |
5737 gray_stuff_out(conv); | |
4359 | 5738 } |
5739 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5740 GaimConvWindow * |
4359 | 5741 gaim_gtkwin_get_at_xy(int x, int y) |
5742 { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5743 GaimConvWindow *win = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5744 GaimGtkWindow *gtkwin; |
4359 | 5745 GdkWindow *gdkwin; |
5746 GList *l; | |
5747 | |
5748 gdkwin = gdk_window_at_pointer(&x, &y); | |
5749 | |
5750 if (gdkwin) | |
5751 gdkwin = gdk_window_get_toplevel(gdkwin); | |
5752 | |
5753 for (l = gaim_get_windows(); l != NULL; l = l->next) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5754 win = (GaimConvWindow *)l->data; |
4359 | 5755 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5756 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5757 continue; |
5758 | |
5759 gtkwin = GAIM_GTK_WINDOW(win); | |
5760 | |
5761 if (gdkwin == gtkwin->window->window) | |
5762 return win; | |
5763 } | |
5764 | |
5765 return NULL; | |
5766 } | |
5767 | |
5768 int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5769 gaim_gtkconv_get_tab_at_xy(GaimConvWindow *win, int x, int y) |
4359 | 5770 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5771 GaimGtkWindow *gtkwin; |
4359 | 5772 GList *l; |
5773 gint nb_x, nb_y, x_rel, y_rel; | |
5774 GtkNotebook *notebook; | |
5775 GtkWidget *tab; | |
5776 gint i, page_num = 0; | |
5777 gboolean first_visible = TRUE; | |
5778 | |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5779 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5780 return -1; |
5781 | |
5782 gtkwin = GAIM_GTK_WINDOW(win); | |
5783 notebook = GTK_NOTEBOOK(gtkwin->notebook); | |
5784 | |
5785 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
5786 x_rel = x - nb_x; | |
5787 y_rel = y - nb_y; | |
5788 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5789 for (l = gaim_conv_window_get_conversations(win), i = 0; |
4359 | 5790 l != NULL; |
5791 l = l->next, i++) { | |
5792 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5793 GaimConversation *conv = l->data; |
4359 | 5794 tab = GAIM_GTK_CONVERSATION(conv)->tab_label; |
5795 | |
5796 if (!GTK_WIDGET_MAPPED(tab)) | |
5797 continue; | |
5798 | |
5799 if (first_visible) { | |
5800 first_visible = FALSE; | |
5801 | |
5802 if (x_rel < tab->allocation.x) x_rel = tab->allocation.x; | |
5803 if (y_rel < tab->allocation.y) y_rel = tab->allocation.y; | |
5804 } | |
5805 | |
5806 if (gtk_notebook_get_tab_pos(notebook) == GTK_POS_TOP || | |
5807 gtk_notebook_get_tab_pos(notebook) == GTK_POS_BOTTOM) { | |
5808 | |
5809 if (tab->allocation.x <= x_rel) { | |
5810 if (tab->allocation.x + tab->allocation.width <= x_rel) | |
5811 page_num = i + 1; | |
5812 else | |
5813 page_num = i; | |
5814 } | |
5815 else | |
5816 break; | |
5817 } | |
5818 else { | |
5819 if (tab->allocation.y <= y_rel) { | |
5820 if (tab->allocation.y + tab->allocation.height <= y_rel) | |
5821 page_num = i + 1; | |
5822 else | |
5823 page_num = i; | |
5824 } | |
5825 else | |
5826 break; | |
5827 } | |
5828 } | |
5829 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5830 if (i == gaim_conv_window_get_conversation_count(win) + 1) |
4359 | 5831 return -1; |
5832 | |
5833 return page_num; | |
5834 } | |
5835 | |
5836 int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5837 gaim_gtkconv_get_dest_tab_at_xy(GaimConvWindow *win, int x, int y) |
4359 | 5838 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5839 GaimGtkWindow *gtkwin; |
4359 | 5840 GList *l; |
5841 gint nb_x, nb_y, x_rel, y_rel; | |
5842 GtkNotebook *notebook; | |
5843 GtkWidget *tab; | |
5844 gint i, page_num = 0; | |
5845 | |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5846 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5847 return -1; |
5848 | |
5849 gtkwin = GAIM_GTK_WINDOW(win); | |
5850 notebook = GTK_NOTEBOOK(gtkwin->notebook); | |
5851 | |
5852 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
5853 x_rel = x - nb_x; | |
5854 y_rel = y - nb_y; | |
5855 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5856 for (l = gaim_conv_window_get_conversations(win), i = 0; |
4359 | 5857 l != NULL; |
5858 l = l->next, i++) { | |
5859 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5860 GaimConversation *conv = l->data; |
4359 | 5861 tab = GAIM_GTK_CONVERSATION(conv)->tab_label; |
5862 | |
5863 if (!GTK_WIDGET_MAPPED(tab)) | |
5864 continue; | |
5865 | |
5866 if (gtk_notebook_get_tab_pos(notebook) == GTK_POS_TOP || | |
5867 gtk_notebook_get_tab_pos(notebook) == GTK_POS_BOTTOM) { | |
5868 | |
5869 if (tab->allocation.x <= x_rel) { | |
5870 if (tab->allocation.x + (tab->allocation.width / 2) <= x_rel) | |
5871 page_num = i + 1; | |
5872 else | |
5873 page_num = i; | |
5874 } | |
5875 else | |
5876 break; | |
5877 } | |
5878 else { | |
5879 if (tab->allocation.y <= y_rel) { | |
5880 if (tab->allocation.y + (tab->allocation.height / 2) <= y_rel) | |
5881 page_num = i + 1; | |
5882 else | |
5883 page_num = i; | |
5884 } | |
5885 else | |
5886 break; | |
5887 } | |
5888 } | |
5889 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5890 if (i == gaim_conv_window_get_conversation_count(win) + 1) |
4359 | 5891 return -1; |
5892 | |
5893 return page_num; | |
5894 } | |
4940
3708545afe42
[gaim-migrate @ 5274]
Christian Hammond <chipx86@chipx86.com>
parents:
4939
diff
changeset
|
5895 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5896 static void |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5897 escape_closes_pref_cb(const char *name, GaimPrefType type, gpointer value, |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5898 gpointer data) |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5899 { |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5900 if (value) |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5901 gtk_accel_map_change_entry(N_("<main>/Conversation/Close"), |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5902 GDK_Escape, 0, TRUE); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5903 else |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5904 gtk_accel_map_change_entry(N_("<main>/Conversation/Close"), |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5905 GDK_W, GDK_CONTROL_MASK, TRUE); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5906 } |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5907 |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5908 static void |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5909 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
|
5910 gpointer data) |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5911 { |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5912 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5913 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5914 GaimGtkConversation *gtkconv; |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5915 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5916 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5917 conv = (GaimConversation *)l->data; |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5918 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5919 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5920 continue; |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5921 |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5922 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5923 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5924 if (value) |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5925 gtk_widget_show(gtkconv->close); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5926 else |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5927 gtk_widget_hide(gtkconv->close); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5928 } |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5929 } |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5930 |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5931 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5932 show_timestamps_pref_cb(const char *name, GaimPrefType type, gpointer value, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5933 gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5934 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5935 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5936 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5937 GaimGtkConversation *gtkconv; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5938 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5939 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5940 conv = (GaimConversation *)l->data; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5941 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5942 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5943 continue; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5944 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5945 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5946 |
7386 | 5947 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
|
5948 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5949 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5950 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5951 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5952 spellcheck_pref_cb(const char *name, GaimPrefType type, gpointer value, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5953 gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5954 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5955 #ifdef USE_GTKSPELL |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5956 GList *cl; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5957 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5958 GaimGtkConversation *gtkconv; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5959 GtkSpell *spell; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5960 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5961 for (cl = gaim_get_conversations(); cl != NULL; cl = cl->next) { |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
5962 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5963 conv = (GaimConversation *)cl->data; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5964 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5965 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5966 continue; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5967 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5968 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5969 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5970 if (value) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
5971 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5972 else { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5973 spell = gtkspell_get_from_text_view(GTK_TEXT_VIEW(gtkconv->entry)); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5974 gtkspell_detach(spell); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5975 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5976 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5977 #endif |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5978 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5979 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5980 static void |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5981 tab_side_pref_cb(const char *name, GaimPrefType type, gpointer value, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5982 gpointer data) |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5983 { |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5984 GList *l; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5985 GtkPositionType pos; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5986 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5987 GaimGtkWindow *gtkwin; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5988 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5989 pos = GPOINTER_TO_INT(value); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5990 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5991 for (l = gaim_get_windows(); l != NULL; l = l->next) { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5992 win = (GaimConvWindow *)l->data; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5993 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5994 if (!GAIM_IS_GTK_WINDOW(win)) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5995 continue; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5996 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5997 gtkwin = GAIM_GTK_WINDOW(win); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5998 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5999 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6000 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6001 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6002 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6003 static void |
8456 | 6004 html_shortcuts_pref_cb(const char *name, GaimPrefType type, |
6005 gpointer value, gpointer data) | |
6006 { | |
6007 GList *l; | |
6008 GaimConversation *conv; | |
6009 GaimGtkConversation *gtkconv; | |
9487 | 6010 |
8456 | 6011 for(l = gaim_get_conversations(); l != NULL; l = l->next) { |
6012 conv = (GaimConversation *)l->data; | |
9487 | 6013 |
8456 | 6014 if(!GAIM_IS_GTK_CONVERSATION(conv)) |
6015 continue; | |
9487 | 6016 |
8456 | 6017 gtkconv = GAIM_GTK_CONVERSATION(conv); |
9487 | 6018 |
8456 | 6019 gtk_imhtml_html_shortcuts(GTK_IMHTML(gtkconv->entry), |
6020 (gboolean)GPOINTER_TO_INT(value)); | |
6021 } | |
6022 } | |
6023 | |
6024 static void | |
6025 smiley_shortcuts_pref_cb(const char *name, GaimPrefType type, | |
6026 gpointer value, gpointer data) | |
6027 { | |
6028 GList *l; | |
6029 GaimConversation *conv; | |
6030 GaimGtkConversation *gtkconv; | |
9487 | 6031 |
8456 | 6032 for(l = gaim_get_conversations(); l != NULL; l = l->next) { |
6033 conv = (GaimConversation *)l->data; | |
9487 | 6034 |
8456 | 6035 if(!GAIM_IS_GTK_CONVERSATION(conv)) |
6036 continue; | |
9487 | 6037 |
8456 | 6038 gtkconv = GAIM_GTK_CONVERSATION(conv); |
9487 | 6039 |
6040 gtk_imhtml_smiley_shortcuts(GTK_IMHTML(gtkconv->entry), | |
8456 | 6041 (gboolean)GPOINTER_TO_INT(value)); |
6042 } | |
6043 } | |
6044 | |
6045 static void | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6046 show_formatting_toolbar_pref_cb(const char *name, GaimPrefType type, |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6047 gpointer value, gpointer data) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6048 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6049 GList *l; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6050 GaimConversation *conv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6051 GaimGtkConversation *gtkconv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6052 GaimConvWindow *win; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6053 GaimGtkWindow *gtkwin; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6054 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6055 for (l = gaim_get_conversations(); l != NULL; l = l->next) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6056 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6057 conv = (GaimConversation *)l->data; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6058 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6059 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6060 continue; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6061 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6062 gtkconv = GAIM_GTK_CONVERSATION(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6063 win = gaim_conversation_get_window(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6064 gtkwin = GAIM_GTK_WINDOW(win); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6065 |
7386 | 6066 gtkconv->show_formatting_toolbar = (gboolean)GPOINTER_TO_INT(value); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6067 gtk_check_menu_item_set_active( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6068 GTK_CHECK_MENU_ITEM(gtkwin->menu.show_formatting_toolbar), |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6069 gtkconv->show_formatting_toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6070 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6071 if (gtkconv->show_formatting_toolbar) |
8317 | 6072 gtk_widget_show(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6073 else |
8317 | 6074 gtk_widget_hide(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6075 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6076 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6077 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6078 static void |
9150 | 6079 button_type_pref_cb(const char *name, GaimPrefType type, |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6080 gpointer value, gpointer data) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6081 { |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6082 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6083 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6084 GaimGtkConversation *gtkconv; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6085 |
9150 | 6086 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6087 conv = (GaimConversation *)l->data; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6088 gtkconv = GAIM_GTK_CONVERSATION(conv); |
9150 | 6089 switch (conv->type) { |
6090 case GAIM_CONV_IM: | |
6091 setup_im_buttons(conv, gtk_widget_get_parent(gtkconv->send)); | |
6092 gaim_gtkconv_update_buddy_icon(conv); | |
6093 break; | |
6094 case GAIM_CONV_CHAT: | |
6095 setup_chat_buttons(conv, gtk_widget_get_parent(gtkconv->send)); | |
6096 break; | |
6097 default: | |
6098 break; | |
6099 } | |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6100 } |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6101 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6102 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6103 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6104 animate_buddy_icons_pref_cb(const char *name, GaimPrefType type, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6105 gpointer value, gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6106 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6107 GList *l; |
8189 | 6108 GaimConversation *conv; |
6109 GaimGtkConversation *gtkconv; | |
6110 GaimConvWindow *win; | |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6111 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6112 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/im/show_buddy_icons")) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6113 return; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6114 |
8189 | 6115 /* Set the "animate" flag for each icon based on the new preference */ |
6116 for (l = gaim_get_ims(); l != NULL; l = l->next) { | |
6117 conv = (GaimConversation *)l->data; | |
6118 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
6119 gtkconv->u.im->animate = (gboolean)value; | |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6120 } |
8189 | 6121 |
6122 /* Now either stop or start animation for the active conversation in each window */ | |
6123 for (l = gaim_get_windows(); l != NULL; l = l->next) { | |
6124 win = (GaimConvWindow *)l->data; | |
6125 conv = gaim_conv_window_get_active_conversation(win); | |
6126 gaim_gtkconv_update_buddy_icon(conv); | |
5674
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 |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6130 static void |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6131 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
|
6132 gpointer data) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6133 { |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6134 GList *l; |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6135 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6136 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6137 GaimConversation *conv = l->data; |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6138 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6139 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6140 gaim_conversation_foreach(gaim_gtkconv_update_buddy_icon); |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6141 } |
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 |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5680
diff
changeset
|
6144 static void |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6145 conv_placement_pref_cb(const char *name, GaimPrefType type, |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6146 gpointer value, gpointer data) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6147 { |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6148 GaimConvPlacementFunc func; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6149 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6150 if (strcmp(name, "/gaim/gtk/conversations/placement")) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6151 return; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6152 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6153 func = gaim_conv_placement_get_fnc(value); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6154 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6155 if (func == NULL) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6156 return; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6157 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6158 gaim_conv_placement_set_current_func(func); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6159 } |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6160 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6161 void * |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6162 gaim_gtk_conversations_get_handle(void) |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6163 { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6164 static int handle; |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6165 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6166 return &handle; |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6167 } |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6168 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6169 void |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
6170 gaim_gtk_conversations_init(void) |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6171 { |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6172 void *handle = gaim_gtk_conversations_get_handle(); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6173 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6174 /* Conversations */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6175 gaim_prefs_add_none("/gaim/gtk/conversations"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6176 gaim_prefs_add_bool("/gaim/gtk/conversations/close_on_tabs", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6177 gaim_prefs_add_bool("/gaim/gtk/conversations/ctrl_enter_sends", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6178 gaim_prefs_add_bool("/gaim/gtk/conversations/enter_sends", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6179 gaim_prefs_add_bool("/gaim/gtk/conversations/escape_closes", FALSE); |
9025 | 6180 gaim_prefs_add_bool("/gaim/gtk/conversations/send_formatting", FALSE); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6181 gaim_prefs_add_bool("/gaim/gtk/conversations/send_bold", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6182 gaim_prefs_add_bool("/gaim/gtk/conversations/send_italic", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6183 gaim_prefs_add_bool("/gaim/gtk/conversations/send_underline", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6184 gaim_prefs_add_bool("/gaim/gtk/conversations/show_timestamps", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6185 gaim_prefs_add_bool("/gaim/gtk/conversations/spellcheck", TRUE); |
9049 | 6186 #if 1 |
6187 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_colors", FALSE); | |
6188 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_fonts", FALSE); | |
6189 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_font_sizes", FALSE); | |
6190 #else | |
8944 | 6191 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_formatting", FALSE); |
9049 | 6192 #endif |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6193 gaim_prefs_add_bool("/gaim/gtk/conversations/html_shortcuts", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6194 gaim_prefs_add_bool("/gaim/gtk/conversations/smiley_shortcuts", FALSE); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6195 gaim_prefs_add_bool("/gaim/gtk/conversations/show_formatting_toolbar", TRUE); |
9130 | 6196 gaim_prefs_add_bool("/gaim/gtk/conversations/enable_commands", TRUE); |
6197 | |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6198 gaim_prefs_add_string("/gaim/gtk/conversations/placement", "last"); |
8998 | 6199 gaim_prefs_add_int("/gaim/gtk/conversations/placement_number", 1); |
9025 | 6200 gaim_prefs_add_string("/gaim/gtk/conversations/bgcolor", ""); |
6201 gaim_prefs_add_string("/gaim/gtk/conversations/fgcolor", ""); | |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6202 gaim_prefs_add_string("/gaim/gtk/conversations/font_face", ""); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6203 gaim_prefs_add_int("/gaim/gtk/conversations/font_size", 3); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6204 gaim_prefs_add_bool("/gaim/gtk/conversations/tabs", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6205 gaim_prefs_add_int("/gaim/gtk/conversations/tab_side", GTK_POS_TOP); |
9150 | 6206 gaim_prefs_add_int("/gaim/gtk/conversations/button_type", |
6207 GAIM_BUTTON_TEXT_IMAGE); | |
6208 | |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6209 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6210 /* Conversations -> Chat */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6211 gaim_prefs_add_none("/gaim/gtk/conversations/chat"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6212 gaim_prefs_add_bool("/gaim/gtk/conversations/chat/color_nicks", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6213 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_width", 410); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6214 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_height", 160); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6215 gaim_prefs_add_int("/gaim/gtk/conversations/chat/entry_height", 50); |
9319 | 6216 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
|
6217 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6218 /* Conversations -> IM */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6219 gaim_prefs_add_none("/gaim/gtk/conversations/im"); |
9150 | 6220 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6221 gaim_prefs_add_bool("/gaim/gtk/conversations/im/animate_buddy_icons", TRUE); |
9150 | 6222 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6223 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_width", 410); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6224 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_height", 160); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6225 gaim_prefs_add_int("/gaim/gtk/conversations/im/entry_height", 50); |
9319 | 6226 gaim_prefs_add_bool("/gaim/gtk/conversations/im/raise_on_events", FALSE); |
6227 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
|
6228 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6229 /* Connect callbacks. */ |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6230 gaim_prefs_connect_callback("/gaim/gtk/conversations/escape_closes", |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6231 escape_closes_pref_cb, NULL); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6232 gaim_prefs_connect_callback("/gaim/gtk/conversations/close_on_tabs", |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6233 close_on_tabs_pref_cb, NULL); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6234 gaim_prefs_connect_callback("/gaim/gtk/conversations/show_timestamps", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6235 show_timestamps_pref_cb, NULL); |
8456 | 6236 gaim_prefs_connect_callback("/gaim/gtk/conversations/html_shortcuts", |
6237 html_shortcuts_pref_cb, NULL); | |
6238 gaim_prefs_connect_callback("/gaim/gtk/conversations/smiley_shortcuts", | |
6239 smiley_shortcuts_pref_cb, NULL); | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6240 gaim_prefs_connect_callback("/gaim/gtk/conversations/show_formatting_toolbar", |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6241 show_formatting_toolbar_pref_cb, NULL); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6242 gaim_prefs_connect_callback("/gaim/gtk/conversations/spellcheck", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6243 spellcheck_pref_cb, NULL); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6244 gaim_prefs_connect_callback("/gaim/gtk/conversations/tab_side", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6245 tab_side_pref_cb, NULL); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6246 |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6247 gaim_prefs_connect_callback("/gaim/gtk/conversations/placement", |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6248 conv_placement_pref_cb, NULL); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6249 gaim_prefs_trigger_callback("/gaim/gtk/conversations/placement"); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6250 |
9150 | 6251 gaim_prefs_connect_callback("/gaim/gtk/conversations/button_type", |
6252 button_type_pref_cb, NULL); | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
6253 |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6254 /* IM callbacks */ |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6255 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/animate_buddy_icons", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6256 animate_buddy_icons_pref_cb, NULL); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6257 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/show_buddy_icons", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6258 show_buddy_icons_pref_cb, NULL); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6259 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6260 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6261 /********************************************************************** |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6262 * Register signals |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6263 **********************************************************************/ |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6264 gaim_signal_register(handle, "conversation-drag-ended", |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6265 gaim_marshal_VOID__POINTER_POINTER, NULL, 2, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6266 gaim_value_new(GAIM_TYPE_SUBTYPE, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6267 GAIM_SUBTYPE_CONV_WINDOW), |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6268 gaim_value_new(GAIM_TYPE_SUBTYPE, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6269 GAIM_SUBTYPE_CONV_WINDOW)); |
9167 | 6270 |
6271 /********************************************************************** | |
6272 * Register commands | |
6273 **********************************************************************/ | |
9213 | 6274 gaim_cmd_register("me", "S", GAIM_CMD_P_DEFAULT, |
6275 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, | |
9247 | 6276 me_command_cb, _("me <action>: Send an IRC style action to a buddy or chat.")); |
9213 | 6277 gaim_cmd_register("debug", "w", GAIM_CMD_P_DEFAULT, |
6278 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, | |
9247 | 6279 debug_command_cb, _("debug <option>: Send various debug information to the current conversation.")); |
9213 | 6280 |
6281 gaim_cmd_register("help", "", GAIM_CMD_P_DEFAULT, | |
6282 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, | |
9247 | 6283 help_command_cb, _("help: List available commands.")); |
9213 | 6284 |
6285 gaim_cmd_register("help", "w", GAIM_CMD_P_DEFAULT, | |
6286 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, | |
9247 | 6287 help_arg_command_cb, _("help <command>: Help on a specific command.")); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6288 } |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6289 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6290 void |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6291 gaim_gtk_conversations_uninit(void) |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6292 { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6293 gaim_signals_unregister_by_instance(gaim_gtk_conversations_get_handle()); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6294 } |