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