Mercurial > pidgin
annotate src/gtkconv.c @ 10039:cf02e7104706
[gaim-migrate @ 10998]
A patch from rian hunter (chrono86):
In src/protocols/oscar/oscar.c, in the function
gaim_plugin_oscar_convert_to_best_encoding. g_convert
is called multiple times. As its 5th argument g_convert
takes a gsize* (8 byte), yet the argument to
gaim_plugin_oscar_convert_to_best_encoding is a int* (4
byte).
On LP64 machines this can allow the int* to be
overwritten. This is especially bad on big endian
64-bit machines, causing the high 32-bits to be written
into the low 32-bits of the int.
This is a quick fix patch that lets g_convert deal with
a gsize* pointer instead, then casting the value at
gsize* to the value at the int*.
A real fix would be to fix the aim_sendimext_args
structure to have a gsize instead of an int (and all
functions that use the aim_sendimext_args struct), and
changing gaim_plugin_oscar_convert_to_best_encoding to
accept a gsize*. of course, this woudl promote glib2
dependence, so that's probably not the best thing to do.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sat, 18 Sep 2004 23:17:18 +0000 |
parents | c9f95600d6ce |
children | a4ceacb1816d |
rev | line source |
---|---|
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
1 /** |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
2 * @file gtkconv.h GTK+ Conversation API |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
3 * @ingroup gtkui |
4359 | 4 * |
8046 | 5 * Gaim is the legal property of its developers, whose names are too numerous |
6 * to list here. Please refer to the COPYRIGHT file distributed with this | |
7 * source distribution. | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
8 * |
4359 | 9 * This program is free software; you can redistribute it and/or modify |
10 * it under the terms of the GNU General Public License as published by | |
11 * the Free Software Foundation; either version 2 of the License, or | |
12 * (at your option) any later version. | |
13 * | |
14 * This program is distributed in the hope that it will be useful, | |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 * GNU General Public License for more details. | |
18 * | |
19 * You should have received a copy of the GNU General Public License | |
20 * along with this program; if not, write to the Free Software | |
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
22 * | |
23 */ | |
9791 | 24 #include "internal.h" |
25 #include "gtkgaim.h" | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
26 |
4359 | 27 #ifndef _WIN32 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
28 # include <X11/Xlib.h> |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
29 #endif |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
30 |
4359 | 31 #ifdef USE_GTKSPELL |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
32 # include <gtkspell/gtkspell.h> |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
33 # ifdef _WIN32 |
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
34 # include "wspell.h" |
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
35 # endif |
4359 | 36 #endif |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
37 |
4359 | 38 #include <gdk/gdkkeysyms.h> |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
39 |
9699 | 40 #include "account.h" |
9130 | 41 #include "cmds.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
42 #include "debug.h" |
6982 | 43 #include "imgstore.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
44 #include "log.h" |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5402
diff
changeset
|
45 #include "notify.h" |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
46 #include "prefs.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
47 #include "prpl.h" |
6038 | 48 #include "request.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
49 #include "sound.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
50 #include "util.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
51 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
52 #include "dnd-hints.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
53 #include "gtkblist.h" |
5717 | 54 #include "gtkconv.h" |
9709 | 55 #include "gtkdialogs.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
56 #include "gtkimhtml.h" |
8317 | 57 #include "gtkimhtmltoolbar.h" |
7431 | 58 #include "gtklog.h" |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
59 #include "gtkpounce.h" |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
60 #include "gtkprivacy.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
61 #include "gtkutils.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
62 #include "stock.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
63 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
64 /* XXX */ |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
65 #include "gaim.h" |
4359 | 66 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
67 #define AUTO_RESPONSE "<AUTO-REPLY> : " |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
68 |
7990 | 69 #define SEND_COLOR "#16569E" |
7855 | 70 #define RECV_COLOR "#A82F2F" |
7854 | 71 |
4359 | 72 static char nick_colors[][8] = { |
73 "#ba55d3", /* Medium Orchid */ | |
74 "#ee82ee", /* Violet */ | |
75 "#c715b4", /* Medium Violet Red */ | |
76 "#ff69b4", /* Hot Pink */ | |
77 "#ff6347", /* Tomato */ | |
78 "#fa8c00", /* Dark Orange */ | |
79 "#fa8072", /* Salmon */ | |
80 "#b22222", /* Fire Brick */ | |
81 "#f4a460", /* Sandy Brown */ | |
82 "#cd5c5c", /* Indian Red */ | |
83 "#bc8f8f", /* Rosy Brown */ | |
84 "#f0e68c", /* Khaki */ | |
85 "#bdb76b", /* Dark Khaki */ | |
86 "#228b22", /* Forest Green */ | |
87 "#9acd32", /* Yellow Green */ | |
88 "#32cd32", /* Lime Green */ | |
7755 | 89 "#3cb371", /* Medium Sea Green (Medium Sea Green?! What are we women?!) */ |
4359 | 90 "#2e8b57", /* Sea Green */ |
91 "#8fbc8f", /* Dark Sea Green */ | |
92 "#66cdaa", /* Medium Aquamarine */ | |
93 "#5f9ea0", /* Cadet Blue */ | |
94 "#48d1cc", /* Medium Turquoise */ | |
95 "#00ced1", /* Dark Turquoise */ | |
96 "#4682b4", /* Stell Blue */ | |
97 "#00bfff", /* Deep Sky Blue */ | |
98 "#1690ff", /* Dodger Blue */ | |
99 "#4169ff", /* Royal Blue */ | |
100 "#6a5acd", /* Slate Blue */ | |
101 "#6495ed", /* Cornflower Blue */ | |
102 "#708090", /* Slate gray */ | |
7995
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
103 "#2f4f4f", /* Dark Slate Gray */ |
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
104 "#ff8c00", /* Dark Orange */ |
8535 | 105 "#006400", /* DarkGreen */ |
106 "#8b4513", /* SaddleBrown */ | |
107 "#8b8989", /* snow4 */ | |
108 "#7d26cd", /* purple3 */ | |
4359 | 109 }; |
6291 | 110 |
4359 | 111 #define NUM_NICK_COLORS (sizeof(nick_colors) / sizeof(*nick_colors)) |
112 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
113 typedef struct |
4359 | 114 { |
115 GtkWidget *window; | |
116 | |
117 GtkWidget *entry; | |
118 GtkWidget *message; | |
119 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
120 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
121 |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
122 } InviteBuddyInfo; |
4359 | 123 |
124 static GtkWidget *invite_dialog = NULL; | |
125 | |
126 /* Prototypes. <-- because Paco-Paco hates this comment. */ | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
127 static void got_typing_keypress(GaimConversation *conv, gboolean first); |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
128 static GList *generate_invite_user_names(GaimConnection *gc); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
129 static void add_chat_buddy_common(GaimConversation *conv, |
9554 | 130 const char *name); |
9605 | 131 static gboolean tab_complete(GaimConversation *conv); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
132 static void update_typing_icon(GaimConversation *conv); |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
133 static gboolean update_send_as_selection(GaimConvWindow *win); |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
134 static char *item_factory_translate_func (const char *path, gpointer func_data); |
4359 | 135 |
136 /************************************************************************** | |
137 * Callbacks | |
138 **************************************************************************/ | |
139 static gint | |
140 close_win_cb(GtkWidget *w, GdkEventAny *e, gpointer d) | |
141 { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
142 GaimConvWindow *win = (GaimConvWindow *)d; |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
143 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
144 gaim_conv_window_destroy(win); |
4361
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
145 |
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
146 return TRUE; |
4359 | 147 } |
148 | |
149 static gint | |
150 close_conv_cb(GtkWidget *w, gpointer d) | |
151 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
152 GaimConversation *conv = (GaimConversation *)d; |
4359 | 153 |
154 gaim_conversation_destroy(conv); | |
4361
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
155 |
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
156 return TRUE; |
4359 | 157 } |
158 | |
8914 | 159 static gboolean |
160 size_allocate_cb(GtkWidget *w, GtkAllocation *allocation, GaimConversation *conv) | |
161 { | |
162 GaimGtkConversation *gtkconv; | |
9048 | 163 GaimConvWindow *win = gaim_conversation_get_window(conv); |
9459 | 164 gboolean saveheight; |
8914 | 165 |
166 if (!GTK_WIDGET_VISIBLE(w)) | |
167 return FALSE; | |
168 | |
169 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
170 return FALSE; | |
171 | |
172 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
173 | |
9459 | 174 /* we only save the new height if the formatting toolbar visibility matches the pref */ |
175 saveheight = (gtkconv->show_formatting_toolbar == gaim_prefs_get_bool("/gaim/gtk/conversations/show_formatting_toolbar")); | |
176 | |
9048 | 177 /* I find that I resize the window when it has a bunch of conversations in it, mostly so that the tab bar |
178 * will fit, but then I don't want new windows taking up the entire screen. I check to see if there is only one | |
179 * conversation in the window. This way we'll be setting new windows to the size of the last resized new window. */ | |
180 | |
8914 | 181 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
182 { | |
9048 | 183 if (w == gtkconv->sw && (gaim_conv_window_get_conversation_count(win) == 1)) |
8914 | 184 { |
185 gaim_prefs_set_int("/gaim/gtk/conversations/im/default_width", allocation->width); | |
9459 | 186 if (saveheight) |
187 gaim_prefs_set_int("/gaim/gtk/conversations/im/default_height", allocation->height); | |
8914 | 188 } |
189 if (w == gtkconv->entry) | |
190 gaim_prefs_set_int("/gaim/gtk/conversations/im/entry_height", allocation->height); | |
191 } | |
192 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
193 { | |
9048 | 194 if (w == gtkconv->sw && (gaim_conv_window_get_conversation_count(win) == 1)) |
8914 | 195 { |
196 gaim_prefs_set_int("/gaim/gtk/conversations/chat/default_width", allocation->width); | |
9459 | 197 if (saveheight) |
198 gaim_prefs_set_int("/gaim/gtk/conversations/chat/default_height", allocation->height); | |
8914 | 199 } |
200 if (w == gtkconv->entry) | |
201 gaim_prefs_set_int("/gaim/gtk/conversations/chat/entry_height", allocation->height); | |
202 } | |
203 | |
204 return FALSE; | |
205 } | |
206 | |
7446
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
207 /* Courtesy of Galeon! */ |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
208 static void |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
209 tab_close_button_state_changed_cb(GtkWidget *widget, GtkStateType prev_state) |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
210 { |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
211 if (GTK_WIDGET_STATE(widget) == GTK_STATE_ACTIVE) |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
212 gtk_widget_set_state(widget, GTK_STATE_NORMAL); |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
213 } |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
214 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
215 static void |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
216 default_formatize(GaimConversation *conv) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
217 { |
8061 | 218 GaimGtkConversation *c = GAIM_GTK_CONVERSATION(conv); |
219 GaimConnection *gc = gaim_conversation_get_gc(conv); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
220 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
221 if (gc && gc->flags & GAIM_CONNECTION_HTML) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
222 { |
9025 | 223 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_formatting")) |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
224 { |
9025 | 225 char *color; |
226 GdkColor fg_color, bg_color; | |
227 | |
228 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold")) | |
229 gtk_imhtml_toggle_bold(GTK_IMHTML(c->entry)); | |
230 | |
231 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic")) | |
232 gtk_imhtml_toggle_italic(GTK_IMHTML(c->entry)); | |
233 | |
234 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline")) | |
235 gtk_imhtml_toggle_underline(GTK_IMHTML(c->entry)); | |
236 | |
237 gtk_imhtml_toggle_fontface(GTK_IMHTML(c->entry), | |
238 gaim_prefs_get_string("/gaim/gtk/conversations/font_face")); | |
239 | |
240 if (!(gc->flags & GAIM_CONNECTION_NO_FONTSIZE)) | |
241 gtk_imhtml_font_set_size(GTK_IMHTML(c->entry), | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
242 gaim_prefs_get_int("/gaim/gtk/conversations/font_size")); |
9025 | 243 |
244 if(strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"), "") != 0) | |
245 { | |
246 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"), | |
247 &fg_color); | |
248 color = g_strdup_printf("#%02x%02x%02x", | |
249 fg_color.red / 256, | |
250 fg_color.green / 256, | |
251 fg_color.blue / 256); | |
252 } | |
253 else | |
254 color = g_strdup(""); | |
255 | |
8061 | 256 gtk_imhtml_toggle_forecolor(GTK_IMHTML(c->entry), color); |
257 g_free(color); | |
9025 | 258 |
259 if(!(gc->flags & GAIM_CONNECTION_NO_BGCOLOR) && | |
260 strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), "") != 0) | |
261 { | |
262 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), | |
263 &bg_color); | |
264 color = g_strdup_printf("#%02x%02x%02x", | |
265 bg_color.red / 256, | |
266 bg_color.green / 256, | |
267 bg_color.blue / 256); | |
268 } | |
269 else | |
270 color = g_strdup(""); | |
271 | |
8061 | 272 gtk_imhtml_toggle_backcolor(GTK_IMHTML(c->entry), color); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
273 g_free(color); |
8061 | 274 } |
8677 | 275 |
9025 | 276 |
8677 | 277 if (gc->flags & GAIM_CONNECTION_FORMATTING_WBFO) |
278 gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(c->entry), TRUE); | |
279 else | |
280 gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(c->entry), FALSE); | |
8061 | 281 } |
282 } | |
9130 | 283 |
284 static const char * | |
285 gaim_gtk_get_cmd_prefix(void) | |
286 { | |
287 return "/"; | |
288 } | |
289 | |
9167 | 290 static GaimCmdRet |
9829 | 291 say_command_cb(GaimConversation *conv, |
292 const char *cmd, char **args, char **error, void *data) | |
293 { | |
294 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) | |
295 gaim_conv_im_send(GAIM_CONV_IM(conv), args[0]); | |
296 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
297 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), args[0]); | |
298 | |
299 return GAIM_CMD_RET_OK; | |
300 } | |
301 | |
302 static GaimCmdRet | |
9167 | 303 me_command_cb(GaimConversation *conv, |
9597 | 304 const char *cmd, char **args, char **error, void *data) |
9167 | 305 { |
306 char *tmp; | |
307 | |
308 tmp = g_strdup_printf("/me %s", args[0]); | |
9175 | 309 |
9167 | 310 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
311 gaim_conv_im_send(GAIM_CONV_IM(conv), tmp); | |
312 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
313 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), tmp); | |
314 | |
315 g_free(tmp); | |
316 return GAIM_CMD_RET_OK; | |
317 } | |
318 | |
9212 | 319 static GaimCmdRet |
320 debug_command_cb(GaimConversation *conv, | |
9597 | 321 const char *cmd, char **args, char **error, void *data) |
9212 | 322 { |
323 char *tmp, *markup; | |
324 GaimCmdStatus status; | |
325 | |
326 if (!g_ascii_strcasecmp(args[0], "version")) { | |
327 tmp = g_strdup_printf(_("me is using Gaim v%s."), VERSION); | |
328 markup = gaim_escape_html(tmp); | |
329 | |
330 status = gaim_cmd_do_command(conv, tmp, markup, error); | |
331 | |
332 g_free(tmp); | |
333 g_free(markup); | |
334 return status; | |
335 } else { | |
336 gaim_conversation_write(conv, NULL, _("Supported debug options are: version"), | |
337 GAIM_MESSAGE_NO_LOG|GAIM_MESSAGE_ERROR, time(NULL)); | |
338 return GAIM_CMD_STATUS_OK; | |
339 } | |
340 } | |
341 | |
9213 | 342 static GaimCmdRet |
343 help_command_cb(GaimConversation *conv, | |
9597 | 344 const char *cmd, char **args, char **error, void *data) |
9213 | 345 { |
9597 | 346 GList *l, *text; |
9213 | 347 GString *s; |
9597 | 348 |
349 if (args[0] != NULL) { | |
350 s = g_string_new(""); | |
351 text = gaim_cmd_help(conv, args[0]); | |
352 | |
353 if (text) { | |
354 for (l = text; l; l = l->next) | |
355 if (l->next) | |
9816 | 356 g_string_append_printf(s, "%s\n", (char *)l->data); |
9597 | 357 else |
9816 | 358 g_string_append_printf(s, "%s", (char *)l->data); |
9597 | 359 } else { |
360 g_string_append(s, _("No such command (in this context).")); | |
361 } | |
362 } else { | |
363 s = g_string_new(_("Use \"/help <command>\" for help on a specific command.\n" | |
364 "The following commands are available in this context:\n")); | |
365 | |
366 text = gaim_cmd_list(conv); | |
367 for (l = text; l; l = l->next) | |
9213 | 368 if (l->next) |
9597 | 369 g_string_append_printf(s, "%s, ", (char *)l->data); |
9213 | 370 else |
9597 | 371 g_string_append_printf(s, "%s.", (char *)l->data); |
9213 | 372 } |
373 | |
374 gaim_conversation_write(conv, NULL, s->str, GAIM_MESSAGE_NO_LOG, time(NULL)); | |
375 g_string_free(s, TRUE); | |
376 | |
377 return GAIM_CMD_STATUS_OK; | |
378 } | |
379 | |
4359 | 380 static void |
9374 | 381 send_history_add(GaimConversation *conv, const char *message) |
382 { | |
383 GList *first; | |
384 | |
385 first = g_list_first(conv->send_history); | |
386 | |
387 if (first->data) | |
388 g_free(first->data); | |
389 | |
390 first->data = g_strdup(message); | |
391 | |
392 conv->send_history = g_list_prepend(first, NULL); | |
393 } | |
394 | |
9832 | 395 static gboolean |
396 check_for_and_do_command(GaimConversation *conv) | |
397 { | |
398 GaimGtkConversation *gtkconv; | |
399 char *cmd; | |
400 const char *prefix; | |
401 GaimAccount *account; | |
402 GtkTextIter start; | |
403 | |
404 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
405 account = gaim_conversation_get_account(conv); | |
406 prefix = gaim_gtk_get_cmd_prefix(); | |
407 | |
408 cmd = gtk_imhtml_get_text(GTK_IMHTML(gtkconv->entry), NULL, NULL); | |
409 gtk_text_buffer_get_start_iter(GTK_IMHTML(gtkconv->entry)->text_buffer, &start); | |
410 | |
411 if (cmd && (strncmp(cmd, prefix, strlen(prefix)) == 0) | |
412 && !gtk_text_iter_get_child_anchor(&start)) { | |
413 GaimCmdStatus status; | |
414 char *error, *cmdline, *markup, *send_history; | |
415 GtkTextIter end; | |
416 | |
417 send_history = gtk_imhtml_get_markup(GTK_IMHTML(gtkconv->entry)); | |
418 send_history_add(conv, send_history); | |
419 g_free(send_history); | |
420 | |
421 cmdline = cmd + strlen(prefix); | |
422 | |
423 gtk_text_iter_forward_chars(&start, g_utf8_strlen(prefix, -1)); | |
424 gtk_text_buffer_get_end_iter(GTK_IMHTML(gtkconv->entry)->text_buffer, &end); | |
425 markup = gtk_imhtml_get_markup_range(GTK_IMHTML(gtkconv->entry), &start, &end); | |
426 status = gaim_cmd_do_command(conv, cmdline, markup, &error); | |
427 g_free(cmd); | |
428 g_free(markup); | |
429 | |
430 switch (status) { | |
431 case GAIM_CMD_STATUS_OK: | |
432 return TRUE; | |
433 case GAIM_CMD_STATUS_NOT_FOUND: | |
434 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/passthrough_unknown_commands")) { | |
435 gaim_conversation_write(conv, "", _("No such command."), | |
436 GAIM_MESSAGE_NO_LOG, time(NULL)); | |
437 | |
438 return TRUE; | |
439 } | |
440 return FALSE; | |
441 case GAIM_CMD_STATUS_WRONG_ARGS: | |
442 gaim_conversation_write(conv, "", _("Syntax Error: You typed the wrong number of arguments " | |
443 "to that command."), | |
444 GAIM_MESSAGE_NO_LOG, time(NULL)); | |
445 return TRUE; | |
446 case GAIM_CMD_STATUS_FAILED: | |
447 gaim_conversation_write(conv, "", error ? error : _("Your command failed for an unknown reason."), | |
448 GAIM_MESSAGE_NO_LOG, time(NULL)); | |
449 if(error) | |
450 g_free(error); | |
451 return TRUE; | |
452 case GAIM_CMD_STATUS_WRONG_TYPE: | |
453 if(gaim_conversation_get_type(conv) == GAIM_CONV_IM) | |
454 gaim_conversation_write(conv, "", _("That command only works in Chats, not IMs."), | |
455 GAIM_MESSAGE_NO_LOG, time(NULL)); | |
456 else | |
457 gaim_conversation_write(conv, "", _("That command only works in IMs, not Chats."), | |
458 GAIM_MESSAGE_NO_LOG, time(NULL)); | |
459 return TRUE; | |
460 case GAIM_CMD_STATUS_WRONG_PRPL: | |
461 gaim_conversation_write(conv, "", _("That command doesn't work on this protocol."), | |
462 GAIM_MESSAGE_NO_LOG, time(NULL)); | |
463 return TRUE; | |
464 } | |
465 } | |
466 | |
467 g_free(cmd); | |
468 return FALSE; | |
469 } | |
470 | |
9374 | 471 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
472 send_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 473 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
474 GaimGtkConversation *gtkconv; |
8655 | 475 GaimAccount *account; |
8677 | 476 GaimConnection *gc; |
8448 | 477 char *buf, *clean; |
4359 | 478 |
479 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
8655 | 480 account = gaim_conversation_get_account(conv); |
9130 | 481 |
9471 | 482 if (!gaim_account_is_connected(account)) |
483 return; | |
484 | |
9474 | 485 if ((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) && |
486 gaim_conv_chat_has_left(GAIM_CONV_CHAT(conv))) | |
9471 | 487 return; |
488 | |
9832 | 489 if (check_for_and_do_command(conv)) { |
490 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); | |
491 default_formatize(conv); | |
492 return; | |
9130 | 493 } |
494 | |
8442 | 495 buf = gtk_imhtml_get_markup(GTK_IMHTML(gtkconv->entry)); |
8962 | 496 clean = gtk_imhtml_get_text(GTK_IMHTML(gtkconv->entry), NULL, NULL); |
8448 | 497 |
4359 | 498 gtk_widget_grab_focus(gtkconv->entry); |
499 | |
8448 | 500 if (strlen(clean) == 0) { |
501 g_free(clean); | |
4359 | 502 return; |
503 } | |
504 | |
8677 | 505 gc = gaim_account_get_connection(account); |
506 if (gc && (gc->flags & GAIM_CONNECTION_NO_NEWLINES)) { | |
507 char **bufs; | |
508 int i; | |
509 | |
510 bufs = gtk_imhtml_get_markup_lines(GTK_IMHTML(gtkconv->entry)); | |
511 for (i = 0; bufs[i]; i++) { | |
9374 | 512 send_history_add(conv, bufs[i]); |
8677 | 513 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
514 gaim_conv_im_send(GAIM_CONV_IM(conv), bufs[i]); | |
515 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
516 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), bufs[i]); | |
517 } | |
518 | |
519 g_strfreev(bufs); | |
520 | |
521 } else { | |
9374 | 522 send_history_add(conv, buf); |
8677 | 523 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
524 gaim_conv_im_send(GAIM_CONV_IM(conv), buf); | |
525 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
526 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), buf); | |
527 } | |
4359 | 528 |
8677 | 529 g_free(clean); |
4359 | 530 g_free(buf); |
531 | |
8061 | 532 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); |
533 default_formatize(conv); | |
4359 | 534 } |
535 | |
536 static void | |
7928 | 537 add_remove_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 538 { |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
539 GaimAccount *account; |
4359 | 540 const char *name; |
541 | |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
542 account = gaim_conversation_get_account(conv); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
543 name = gaim_conversation_get_name(conv); |
7879 | 544 |
545 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
7859 | 546 GaimBuddy *b; |
547 | |
548 b = gaim_find_buddy(account, name); | |
549 if (b != NULL) | |
9730 | 550 gaim_gtkdialogs_remove_buddy(b); |
7859 | 551 else if (account != NULL && gaim_account_is_connected(account)) |
552 gaim_blist_request_add_buddy(account, (char *)name, NULL, NULL); | |
7879 | 553 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
7859 | 554 GaimChat *c; |
555 | |
556 c = gaim_blist_find_chat(account, name); | |
557 if (c != NULL) | |
9730 | 558 gaim_gtkdialogs_remove_chat(c); |
7859 | 559 else if (account != NULL && gaim_account_is_connected(account)) |
9754 | 560 gaim_blist_request_add_chat(account, NULL, NULL, name); |
7859 | 561 } |
4359 | 562 |
563 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
564 } | |
565 | |
7975 | 566 static void chat_do_info(GaimConversation *conv, const char *who) |
567 { | |
568 GaimPluginProtocolInfo *prpl_info = NULL; | |
569 GaimConnection *gc; | |
570 | |
571 if ((gc = gaim_conversation_get_gc(conv))) { | |
572 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | |
573 | |
574 /* | |
575 * If there are special needs for getting info on users in | |
576 * buddy chat "rooms"... | |
577 */ | |
578 if (prpl_info->get_cb_info != NULL) | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
579 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
580 prpl_info->get_cb_info(gc, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
581 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
582 } |
7975 | 583 else |
584 prpl_info->get_info(gc, who); | |
585 } | |
586 } | |
587 | |
588 | |
4359 | 589 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
590 info_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 591 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
592 GaimGtkConversation *gtkconv; |
4359 | 593 |
594 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
595 | |
7879 | 596 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
597 serv_get_info(gaim_conversation_get_gc(conv), | |
598 gaim_conversation_get_name(conv)); | |
599 | |
600 gtk_widget_grab_focus(gtkconv->entry); | |
601 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
602 /* Get info of the person currently selected in the GtkTreeView */ | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
603 GaimGtkChatPane *gtkchat; |
4359 | 604 GtkTreeIter iter; |
605 GtkTreeModel *model; | |
606 GtkTreeSelection *sel; | |
9554 | 607 char *name; |
4359 | 608 |
609 gtkchat = gtkconv->u.chat; | |
610 | |
611 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | |
612 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); | |
613 | |
614 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) | |
9498 | 615 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &name, -1); |
4359 | 616 else |
617 return; | |
618 | |
7975 | 619 chat_do_info(conv, name); |
9554 | 620 g_free(name); |
4359 | 621 } |
622 } | |
623 | |
624 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
625 block_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 626 { |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
627 GaimAccount *account; |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
628 |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
629 account = gaim_conversation_get_account(conv); |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
630 |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
631 if (account != NULL && gaim_account_is_connected(account)) |
6399
d726a36628e8
[gaim-migrate @ 6904]
Christian Hammond <chipx86@chipx86.com>
parents:
6398
diff
changeset
|
632 gaim_gtk_request_add_block(account, gaim_conversation_get_name(conv)); |
4359 | 633 |
634 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
635 } | |
636 | |
637 static void | |
9468 | 638 send_file_cb(GtkWidget *widget, GaimConversation *conv) |
639 { | |
640 serv_send_file(gaim_conversation_get_gc(conv), gaim_conversation_get_name(conv), NULL); | |
641 } | |
642 | |
643 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
644 do_invite(GtkWidget *w, int resp, InviteBuddyInfo *info) |
4359 | 645 { |
646 const char *buddy, *message; | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
647 GaimGtkConversation *gtkconv; |
4359 | 648 |
649 gtkconv = GAIM_GTK_CONVERSATION(info->conv); | |
650 | |
651 if (resp == GTK_RESPONSE_OK) { | |
652 buddy = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(info->entry)->entry)); | |
653 message = gtk_entry_get_text(GTK_ENTRY(info->message)); | |
654 | |
4793 | 655 if (!g_ascii_strcasecmp(buddy, "")) { |
4359 | 656 g_free(info); |
657 | |
658 return; | |
659 } | |
660 | |
661 serv_chat_invite(gaim_conversation_get_gc(info->conv), | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
662 gaim_conv_chat_get_id(GAIM_CONV_CHAT(info->conv)), |
4359 | 663 message, buddy); |
664 } | |
665 | |
666 gtk_widget_destroy(invite_dialog); | |
667 invite_dialog = NULL; | |
668 | |
669 g_free(info); | |
670 } | |
671 | |
672 static void | |
9909 | 673 invite_dnd_recv(GtkWidget *widget, GdkDragContext *dc, gint x, gint y, |
674 GtkSelectionData *sd, guint inf, guint t, gpointer data) | |
675 { | |
676 InviteBuddyInfo *info = (InviteBuddyInfo *)data; | |
677 const char *convprotocol; | |
678 | |
679 convprotocol = gaim_account_get_protocol_id(gaim_conversation_get_account(info->conv)); | |
680 | |
681 if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE)) | |
682 { | |
683 GaimBlistNode *node = NULL; | |
684 GaimBuddy *buddy; | |
685 | |
686 memcpy(&node, sd->data, sizeof(node)); | |
687 | |
688 if (GAIM_BLIST_NODE_IS_CONTACT(node)) | |
689 buddy = gaim_contact_get_priority_buddy((GaimContact *)node); | |
690 else if (GAIM_BLIST_NODE_IS_BUDDY(node)) | |
691 buddy = (GaimBuddy *)node; | |
692 else | |
693 return; | |
694 | |
695 if (strcmp(convprotocol, gaim_account_get_protocol_id(buddy->account))) | |
696 { | |
697 gaim_notify_error(NULL, NULL, | |
698 _("That buddy is not on the same protocol as this " | |
699 "chat"), NULL); | |
700 } | |
701 else | |
702 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(info->entry)->entry), buddy->name); | |
703 | |
704 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); | |
705 } | |
706 else if (sd->target == gdk_atom_intern("application/x-im-contact", FALSE)) | |
707 { | |
708 char *protocol = NULL; | |
709 char *username = NULL; | |
710 GaimAccount *account; | |
711 | |
712 if (gaim_gtk_parse_x_im_contact(sd->data, FALSE, &account, | |
713 &protocol, &username, NULL)) | |
714 { | |
715 if (account == NULL) | |
716 { | |
717 gaim_notify_error(NULL, NULL, | |
718 _("You are not currently signed on with an account that " | |
719 "can invite that buddy."), NULL); | |
720 } | |
721 else if (strcmp(convprotocol, gaim_account_get_protocol_id(account))) | |
722 { | |
723 gaim_notify_error(NULL, NULL, | |
724 _("That buddy is not on the same protocol as this " | |
725 "chat"), NULL); | |
726 } | |
727 else | |
728 { | |
729 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(info->entry)->entry), username); | |
730 } | |
731 } | |
732 | |
733 if (username != NULL) g_free(username); | |
734 if (protocol != NULL) g_free(protocol); | |
735 | |
736 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); | |
737 } | |
738 } | |
739 | |
740 static const GtkTargetEntry dnd_targets[] = | |
741 { | |
742 {"GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, 0}, | |
743 {"application/x-im-contact", 0, 1} | |
744 }; | |
745 | |
746 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
747 invite_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 748 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
749 InviteBuddyInfo *info = NULL; |
4359 | 750 |
751 if (invite_dialog == NULL) { | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
752 GaimConnection *gc; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
753 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
754 GaimGtkWindow *gtkwin; |
4359 | 755 GtkWidget *label; |
756 GtkWidget *vbox, *hbox; | |
757 GtkWidget *table; | |
758 GtkWidget *img; | |
759 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
760 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
761 GTK_ICON_SIZE_DIALOG); |
4359 | 762 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
763 info = g_new0(InviteBuddyInfo, 1); |
4359 | 764 info->conv = conv; |
765 | |
766 gc = gaim_conversation_get_gc(conv); | |
767 win = gaim_conversation_get_window(conv); | |
768 gtkwin = GAIM_GTK_WINDOW(win); | |
769 | |
770 /* Create the new dialog. */ | |
771 invite_dialog = gtk_dialog_new_with_buttons( | |
7859 | 772 _("Invite Buddy Into Chat Room"), |
7879 | 773 GTK_WINDOW(gtkwin->window), 0, |
774 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, | |
9443
3584cdab1d0b
[gaim-migrate @ 10264]
Christian Hammond <chipx86@chipx86.com>
parents:
9374
diff
changeset
|
775 GAIM_STOCK_INVITE, GTK_RESPONSE_OK, NULL); |
4359 | 776 |
777 gtk_dialog_set_default_response(GTK_DIALOG(invite_dialog), | |
778 GTK_RESPONSE_OK); | |
779 gtk_container_set_border_width(GTK_CONTAINER(invite_dialog), 6); | |
780 gtk_window_set_resizable(GTK_WINDOW(invite_dialog), FALSE); | |
781 gtk_dialog_set_has_separator(GTK_DIALOG(invite_dialog), FALSE); | |
782 | |
9909 | 783 info->window = GTK_WIDGET(invite_dialog); |
784 | |
4359 | 785 /* Setup the outside spacing. */ |
786 vbox = GTK_DIALOG(invite_dialog)->vbox; | |
787 | |
788 gtk_box_set_spacing(GTK_BOX(vbox), 12); | |
789 gtk_container_set_border_width(GTK_CONTAINER(vbox), 6); | |
790 | |
791 /* Setup the inner hbox and put the dialog's icon in it. */ | |
792 hbox = gtk_hbox_new(FALSE, 12); | |
793 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
794 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
795 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
796 | |
797 /* Setup the right vbox. */ | |
798 vbox = gtk_vbox_new(FALSE, 0); | |
799 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
800 | |
801 /* Put our happy label in it. */ | |
802 label = gtk_label_new(_("Please enter the name of the user you wish " | |
803 "to invite, along with an optional invite " | |
804 "message.")); | |
805 gtk_widget_set_size_request(label, 350, -1); | |
806 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
807 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
808 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
809 | |
810 /* hbox for the table, and to give it some spacing on the left. */ | |
811 hbox = gtk_hbox_new(FALSE, 6); | |
812 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
813 | |
814 /* Setup the table we're going to use to lay stuff out. */ | |
815 table = gtk_table_new(2, 2, FALSE); | |
816 gtk_table_set_row_spacings(GTK_TABLE(table), 6); | |
817 gtk_table_set_col_spacings(GTK_TABLE(table), 6); | |
818 gtk_container_set_border_width(GTK_CONTAINER(table), 12); | |
819 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); | |
820 | |
821 /* Now the Buddy label */ | |
822 label = gtk_label_new(NULL); | |
823 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Buddy:")); | |
824 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
825 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); | |
826 | |
827 /* Now the Buddy drop-down entry field. */ | |
828 info->entry = gtk_combo_new(); | |
829 gtk_combo_set_case_sensitive(GTK_COMBO(info->entry), FALSE); | |
830 gtk_entry_set_activates_default( | |
831 GTK_ENTRY(GTK_COMBO(info->entry)->entry), TRUE); | |
832 | |
833 gtk_table_attach_defaults(GTK_TABLE(table), info->entry, 1, 2, 0, 1); | |
834 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->entry); | |
835 | |
836 /* Fill in the names. */ | |
837 gtk_combo_set_popdown_strings(GTK_COMBO(info->entry), | |
838 generate_invite_user_names(gc)); | |
839 | |
840 | |
841 /* Now the label for "Message" */ | |
842 label = gtk_label_new(NULL); | |
843 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Message:")); | |
844 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
845 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); | |
846 | |
847 | |
848 /* And finally, the Message entry field. */ | |
849 info->message = gtk_entry_new(); | |
850 gtk_entry_set_activates_default(GTK_ENTRY(info->message), TRUE); | |
851 | |
852 gtk_table_attach_defaults(GTK_TABLE(table), info->message, 1, 2, 1, 2); | |
853 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->message); | |
854 | |
855 /* Connect the signals. */ | |
856 g_signal_connect(G_OBJECT(invite_dialog), "response", | |
857 G_CALLBACK(do_invite), info); | |
9909 | 858 /* Setup drag-and-drop */ |
859 gtk_drag_dest_set(info->window, | |
860 GTK_DEST_DEFAULT_MOTION | | |
861 GTK_DEST_DEFAULT_DROP, | |
862 dnd_targets, | |
863 sizeof(dnd_targets) / sizeof(GtkTargetEntry), | |
864 GDK_ACTION_COPY); | |
865 gtk_drag_dest_set(info->entry, | |
866 GTK_DEST_DEFAULT_MOTION | | |
867 GTK_DEST_DEFAULT_DROP, | |
868 dnd_targets, | |
869 sizeof(dnd_targets) / sizeof(GtkTargetEntry), | |
870 GDK_ACTION_COPY); | |
871 | |
872 g_signal_connect(G_OBJECT(info->window), "drag_data_received", | |
873 G_CALLBACK(invite_dnd_recv), info); | |
874 g_signal_connect(G_OBJECT(info->entry), "drag_data_received", | |
875 G_CALLBACK(invite_dnd_recv), info); | |
876 | |
4359 | 877 } |
878 | |
879 gtk_widget_show_all(invite_dialog); | |
880 | |
881 if (info != NULL) | |
882 gtk_widget_grab_focus(GTK_COMBO(info->entry)->entry); | |
883 } | |
884 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
885 static void |
7748 | 886 menu_new_conv_cb(gpointer data, guint action, GtkWidget *widget) |
887 { | |
9714 | 888 gaim_gtkdialogs_im(); |
7748 | 889 } |
890 | |
891 static void | |
9504 | 892 savelog_writefile_cb(void *user_data, const char *filename) |
9489 | 893 { |
9504 | 894 GaimConversation *conv = (GaimConversation *)user_data; |
9489 | 895 FILE *fp; |
896 const char *name; | |
897 | |
898 if ((fp = fopen(filename, "w+")) == NULL) { | |
9504 | 899 gaim_notify_error(conv, NULL, _("Unable to open file."), NULL); |
9489 | 900 return; |
901 } | |
902 | |
903 name = gaim_conversation_get_name(conv); | |
904 fprintf(fp, _("<h1>Conversation with %s</h1>\n"), name); | |
905 fprintf(fp, "%s", conv->history->str); | |
906 fclose(fp); | |
907 } | |
908 | |
909 static void | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
910 menu_save_as_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
911 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
912 GaimConvWindow *win = (GaimConvWindow *)data; |
9489 | 913 GaimConversation *conv = gaim_conv_window_get_active_conversation(win); |
914 gchar *buf; | |
915 | |
916 buf = g_strdup_printf("%s.html", gaim_normalize(conv->account, conv->name)); | |
9504 | 917 |
918 gaim_request_file(conv, _("Save Conversation"), buf, TRUE, | |
919 G_CALLBACK(savelog_writefile_cb), NULL, conv); | |
9489 | 920 |
921 g_free(buf); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
922 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
923 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
924 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
925 menu_view_log_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
926 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
927 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
928 GaimConversation *conv; |
9917 | 929 GaimLogType type; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
930 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
931 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
932 |
9917 | 933 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
934 type = GAIM_LOG_IM; | |
935 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
936 type = GAIM_LOG_CHAT; | |
937 else | |
938 return; | |
939 | |
940 gaim_gtk_log_show(type, gaim_conversation_get_name(conv), | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
941 gaim_conversation_get_account(conv)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
942 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
943 |
8974 | 944 static void |
945 menu_clear_cb(gpointer data, guint action, GtkWidget *widget) | |
946 { | |
947 GaimConvWindow *win = (GaimConvWindow *)data; | |
948 GaimConversation *conv; | |
949 GaimGtkConversation *gtkconv; | |
950 | |
951 conv = gaim_conv_window_get_active_conversation(win); | |
952 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
953 | |
954 gtk_imhtml_clear(GTK_IMHTML(gtkconv->imhtml)); | |
955 g_string_free(conv->history, TRUE); | |
956 conv->history = g_string_new(""); | |
957 } | |
958 | |
7295 | 959 struct _search { |
960 GaimGtkConversation *gtkconv; | |
961 GtkWidget *entry; | |
962 }; | |
963 | |
7929 | 964 static void do_search_cb(GtkWidget *widget, gint resp, struct _search *s) |
7295 | 965 { |
7929 | 966 switch (resp) { |
967 case GTK_RESPONSE_OK: | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
968 gtk_imhtml_search_find(GTK_IMHTML(s->gtkconv->imhtml), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
969 gtk_entry_get_text(GTK_ENTRY(s->entry))); |
7929 | 970 break; |
971 | |
972 case GTK_RESPONSE_DELETE_EVENT: | |
973 case GTK_RESPONSE_CLOSE: | |
974 gtk_imhtml_search_clear(GTK_IMHTML(s->gtkconv->imhtml)); | |
975 gtk_widget_destroy(s->gtkconv->dialogs.search); | |
976 s->gtkconv->dialogs.search = NULL; | |
977 g_free(s); | |
978 break; | |
979 } | |
7295 | 980 } |
981 | |
982 static void | |
7751 | 983 menu_find_cb(gpointer data, guint action, GtkWidget *widget) |
7295 | 984 { |
985 GaimConvWindow *win = (GaimConvWindow *)data; | |
986 GaimConversation *conv = gaim_conv_window_get_active_conversation(win); | |
987 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); | |
988 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7929 | 989 GtkWidget *hbox; |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
990 GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
991 GTK_ICON_SIZE_DIALOG); |
7929 | 992 GtkWidget *label; |
7295 | 993 struct _search *s; |
994 | |
7798 | 995 if (gtkconv->dialogs.search) { |
996 gtk_window_present(GTK_WINDOW(gtkconv->dialogs.search)); | |
7295 | 997 return; |
7798 | 998 } |
7300
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
999 |
7295 | 1000 s = g_malloc(sizeof(struct _search)); |
1001 s->gtkconv = gtkconv; | |
7929 | 1002 |
1003 gtkconv->dialogs.search = gtk_dialog_new_with_buttons(_("Find"), | |
1004 GTK_WINDOW(gtkwin->window), GTK_DIALOG_DESTROY_WITH_PARENT, | |
1005 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, | |
1006 GTK_STOCK_FIND, GTK_RESPONSE_OK, NULL); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1007 gtk_dialog_set_default_response(GTK_DIALOG(gtkconv->dialogs.search), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1008 GTK_RESPONSE_OK); |
7929 | 1009 g_signal_connect(G_OBJECT(gtkconv->dialogs.search), "response", |
1010 G_CALLBACK(do_search_cb), s); | |
1011 | |
1012 gtk_container_set_border_width(GTK_CONTAINER(gtkconv->dialogs.search), 6); | |
1013 gtk_window_set_resizable(GTK_WINDOW(gtkconv->dialogs.search), FALSE); | |
1014 gtk_dialog_set_has_separator(GTK_DIALOG(gtkconv->dialogs.search), FALSE); | |
1015 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
|
1016 gtk_container_set_border_width( |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1017 GTK_CONTAINER(GTK_DIALOG(gtkconv->dialogs.search)->vbox), 6); |
7929 | 1018 |
1019 hbox = gtk_hbox_new(FALSE, 12); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1020 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(gtkconv->dialogs.search)->vbox), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1021 hbox); |
7929 | 1022 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); |
1023 | |
1024 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1025 gtk_dialog_set_response_sensitive(GTK_DIALOG(gtkconv->dialogs.search), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1026 GTK_RESPONSE_OK, FALSE); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1027 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1028 label = gtk_label_new(NULL); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1029 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Search for:")); |
7929 | 1030 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
1031 | |
1032 s->entry = gtk_entry_new(); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1033 gtk_entry_set_activates_default(GTK_ENTRY(s->entry), TRUE); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1034 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(s->entry)); |
7929 | 1035 g_signal_connect(G_OBJECT(s->entry), "changed", |
1036 G_CALLBACK(gaim_gtk_set_sensitive_if_input), | |
1037 gtkconv->dialogs.search); | |
1038 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
|
1039 |
7295 | 1040 gtk_widget_show_all(gtkconv->dialogs.search); |
7929 | 1041 gtk_widget_grab_focus(s->entry); |
7295 | 1042 } |
1043 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1044 static void |
9468 | 1045 menu_send_file_cb(gpointer data, guint action, GtkWidget *widget) |
1046 { | |
1047 GaimConvWindow *win = (GaimConvWindow *)data; | |
1048 GaimConversation *conv = gaim_conv_window_get_active_conversation(win); | |
1049 | |
1050 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
1051 serv_send_file(gaim_conversation_get_gc(conv), gaim_conversation_get_name(conv), NULL); | |
1052 } | |
1053 | |
1054 } | |
1055 | |
1056 static void | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1057 menu_add_pounce_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1058 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1059 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1060 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1061 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1062 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1063 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1064 gaim_gtkpounce_dialog_show(gaim_conversation_get_account(conv), |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1065 gaim_conversation_get_name(conv), NULL); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1066 } |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1067 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1068 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1069 menu_insert_link_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1070 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1071 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1072 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1073 GaimGtkConversation *gtkconv; |
8756 | 1074 GtkIMHtmlToolbar *toolbar; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1075 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1076 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1077 gtkconv = GAIM_GTK_CONVERSATION(conv); |
8756 | 1078 toolbar = GTK_IMHTMLTOOLBAR(gtkconv->toolbar); |
1079 | |
1080 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->link), | |
1081 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->link))); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1082 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1083 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1084 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1085 menu_insert_image_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1086 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1087 GaimConvWindow *win = (GaimConvWindow *)data; |
8756 | 1088 GaimConversation *conv; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1089 GaimGtkConversation *gtkconv; |
8756 | 1090 GtkIMHtmlToolbar *toolbar; |
1091 | |
1092 conv = gaim_conv_window_get_active_conversation(win); | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1093 gtkconv = GAIM_GTK_CONVERSATION(gaim_conv_window_get_active_conversation(win)); |
8756 | 1094 toolbar = GTK_IMHTMLTOOLBAR(gtkconv->toolbar); |
1095 | |
1096 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->image), | |
1097 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->image))); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1098 } |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1099 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1100 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1101 menu_alias_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1102 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1103 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1104 GaimConversation *conv; |
7879 | 1105 GaimAccount *account; |
1106 const char *name; | |
1107 | |
1108 conv = gaim_conv_window_get_active_conversation(win); | |
1109 account = gaim_conversation_get_account(conv); | |
1110 name = gaim_conversation_get_name(conv); | |
1111 | |
1112 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
1113 GaimBuddy *b; | |
1114 | |
1115 b = gaim_find_buddy(account, name); | |
1116 if (b != NULL) | |
9730 | 1117 gaim_gtkdialogs_alias_buddy(b); |
7879 | 1118 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
1119 GaimChat *c; | |
1120 | |
1121 c = gaim_blist_find_chat(account, name); | |
1122 if (c != NULL) | |
9730 | 1123 gaim_gtkdialogs_alias_chat(c); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1124 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1125 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1126 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1127 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1128 menu_get_info_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1129 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1130 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1131 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1132 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1133 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1134 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1135 info_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1136 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1137 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1138 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1139 menu_invite_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1140 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1141 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1142 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1143 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1144 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1145 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1146 invite_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1147 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1148 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1149 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1150 menu_warn_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1151 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1152 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1153 GaimConversation *conv; |
10025 | 1154 GaimConnection *gc; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1155 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1156 conv = gaim_conv_window_get_active_conversation(win); |
10025 | 1157 gc = gaim_conversation_get_gc(conv); |
1158 | |
1159 gaim_gtkdialogs_warn(gc, gaim_conversation_get_name(conv)); | |
1160 | |
1161 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1162 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1163 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1164 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1165 menu_block_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1166 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1167 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1168 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1169 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1170 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1171 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1172 block_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1173 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1174 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1175 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1176 menu_add_remove_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1177 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1178 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1179 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1180 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1181 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1182 |
7928 | 1183 add_remove_cb(NULL, conv); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1184 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1185 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1186 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1187 menu_close_conv_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1188 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1189 GaimConvWindow *win = (GaimConvWindow *)data; |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1190 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1191 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
|
1192 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1193 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1194 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1195 menu_logging_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1196 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1197 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1198 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1199 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1200 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1201 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1202 if (conv == NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1203 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1204 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1205 gaim_conversation_set_logging(conv, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1206 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))); |
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 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1209 static void |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1210 menu_toolbar_cb(gpointer data, guint action, GtkWidget *widget) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1211 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1212 GaimConvWindow *win = (GaimConvWindow *)data; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1213 GaimConversation *conv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1214 GaimGtkConversation *gtkconv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1215 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1216 conv = gaim_conv_window_get_active_conversation(win); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1217 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1218 if (conv == NULL) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1219 return; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1220 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1221 gtkconv = GAIM_GTK_CONVERSATION(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1222 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1223 gtkconv->show_formatting_toolbar = |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1224 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1225 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1226 if (gtkconv->show_formatting_toolbar) |
8317 | 1227 gtk_widget_show(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1228 else |
8317 | 1229 gtk_widget_hide(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1230 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1231 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1232 static void |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1233 menu_sounds_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1234 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1235 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1236 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1237 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1238 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1239 conv = gaim_conv_window_get_active_conversation(win); |
5908
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 if (!conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1242 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1243 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1244 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1245 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1246 gtkconv->make_sound = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1247 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); |
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 |
7961 | 1250 static void |
9188 | 1251 menu_timestamps_cb(gpointer data, guint action, GtkWidget *widget) |
1252 { | |
1253 GaimConvWindow *win = (GaimConvWindow *)data; | |
1254 GaimConversation *conv; | |
1255 GaimGtkConversation *gtkconv; | |
1256 | |
1257 conv = gaim_conv_window_get_active_conversation(win); | |
1258 | |
1259 if (!conv) | |
1260 return; | |
1261 | |
1262 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1263 | |
1264 gtkconv->show_timestamps = | |
1265 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); | |
1266 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
1267 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))); | |
1268 } | |
1269 | |
1270 static void | |
7961 | 1271 chat_do_im(GaimConversation *conv, const char *who) |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1272 { |
7961 | 1273 GaimPluginProtocolInfo *prpl_info = NULL; |
1274 char *real_who; | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1275 GaimConversation *conv2; |
7961 | 1276 GaimAccount *account; |
1277 | |
1278 account = gaim_conversation_get_account(conv); | |
1279 | |
1280 if(account && account->gc) | |
1281 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl); | |
1282 | |
1283 if(prpl_info && prpl_info->get_cb_real_name) | |
1284 real_who = prpl_info->get_cb_real_name(account->gc, | |
1285 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); | |
1286 else | |
1287 real_who = g_strdup(who); | |
1288 | |
1289 if(!real_who) | |
1290 return; | |
1291 | |
1292 conv2 = gaim_find_conversation_with_account(real_who, account); | |
1293 | |
1294 if (conv2 != NULL) | |
1295 gaim_conv_window_show(gaim_conversation_get_window(conv2)); | |
1296 else | |
1297 conv2 = gaim_conversation_new(GAIM_CONV_IM, account, real_who); | |
1298 | |
1299 g_free(real_who); | |
1300 } | |
1301 | |
1302 | |
1303 static void | |
1304 chat_im_button_cb(GtkWidget *widget, GaimConversation *conv) | |
1305 { | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1306 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1307 GaimGtkChatPane *gtkchat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1308 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1309 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1310 GtkTreeSelection *sel; |
9554 | 1311 char *name; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1312 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1313 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1314 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1315 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1316 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1317 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1318 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1319 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) |
9498 | 1320 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
|
1321 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1322 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1323 |
7961 | 1324 chat_do_im(conv, name); |
9554 | 1325 g_free(name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1326 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1327 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1328 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1329 ignore_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1330 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1331 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1332 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1333 GaimConvChat *chat; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1334 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1335 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1336 GtkTreeSelection *sel; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1337 const char *name; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1338 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1339 chat = GAIM_CONV_CHAT(conv); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1340 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1341 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1342 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1343 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1344 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1345 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1346 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) { |
9498 | 1347 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
|
1348 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1349 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1350 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1351 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1352 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1353 if (gaim_conv_chat_is_user_ignored(chat, name)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1354 gaim_conv_chat_unignore(chat, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1355 else |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1356 gaim_conv_chat_ignore(chat, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1357 |
9554 | 1358 add_chat_buddy_common(conv, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1359 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1360 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1361 static void |
7398 | 1362 menu_chat_im_cb(GtkWidget *w, GaimConversation *conv) |
1363 { | |
1364 const char *who = g_object_get_data(G_OBJECT(w), "user_data"); | |
1365 | |
1366 chat_do_im(conv, who); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1367 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1368 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1369 static void |
9468 | 1370 menu_chat_send_file_cb(GtkWidget *w, GaimConversation *conv) |
1371 { | |
1372 const char *who = g_object_get_data(G_OBJECT(w), "user_data"); | |
1373 GaimConnection *gc = gaim_conversation_get_gc(conv); | |
1374 | |
1375 serv_send_file(gc, who, NULL); | |
1376 } | |
1377 | |
1378 static void | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1379 menu_chat_info_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1380 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1381 char *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1382 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1383 who = g_object_get_data(G_OBJECT(w), "user_data"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1384 |
7975 | 1385 chat_do_info(conv, who); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1386 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1387 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1388 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1389 menu_chat_get_away_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1390 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1391 GaimPluginProtocolInfo *prpl_info = NULL; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1392 GaimConnection *gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1393 char *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1394 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1395 gc = gaim_conversation_get_gc(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1396 who = g_object_get_data(G_OBJECT(w), "user_data"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1397 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1398 if (gc != NULL) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1399 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1400 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1401 /* |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1402 * 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
|
1403 */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1404 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1405 if (prpl_info->get_cb_away != NULL) |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1406 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1407 prpl_info->get_cb_away(gc, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1408 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1409 } |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1410 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1411 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1412 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1413 static void |
7928 | 1414 menu_chat_add_remove_cb(GtkWidget *w, GaimConversation *conv) |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1415 { |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1416 GaimAccount *account; |
6695 | 1417 GaimBuddy *b; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1418 char *name; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1419 |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1420 account = gaim_conversation_get_account(conv); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1421 name = g_object_get_data(G_OBJECT(w), "user_data"); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1422 b = gaim_find_buddy(account, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1423 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1424 if (b != NULL) |
9730 | 1425 gaim_gtkdialogs_remove_buddy(b); |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1426 else if (account != NULL && gaim_account_is_connected(account)) |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1427 gaim_blist_request_add_buddy(account, name, NULL, NULL); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1428 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1429 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1430 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1431 |
8143 | 1432 static GtkWidget * |
1433 create_chat_menu(GaimConversation *conv, gchar *who, | |
1434 GaimPluginProtocolInfo *prpl_info, GaimConnection *gc) | |
1435 { | |
1436 static GtkWidget *menu = NULL; | |
1437 GtkWidget *button; | |
1438 | |
1439 /* | |
1440 * If a menu already exists, destroy it before creating a new one, | |
1441 * thus freeing-up the memory it occupied. | |
1442 */ | |
1443 if (menu) | |
1444 gtk_widget_destroy(menu); | |
1445 | |
1446 menu = gtk_menu_new(); | |
1447 | |
1448 button = gtk_menu_item_new_with_label(_("IM")); | |
1449 g_signal_connect(G_OBJECT(button), "activate", | |
1450 G_CALLBACK(menu_chat_im_cb), conv); | |
1451 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1452 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1453 gtk_widget_show(button); | |
1454 | |
9468 | 1455 if (gc && prpl_info && prpl_info->send_file |
1456 && (!prpl_info->can_receive_file || prpl_info->can_receive_file(gc, who))) { | |
1457 button = gtk_menu_item_new_with_label(_("Send File")); | |
1458 g_signal_connect(G_OBJECT(button), "activate", | |
1459 G_CALLBACK(menu_chat_send_file_cb), conv); | |
1460 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1461 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1462 gtk_widget_show(button); | |
1463 } | |
9498 | 1464 |
8143 | 1465 if (gaim_conv_chat_is_user_ignored(GAIM_CONV_CHAT(conv), who)) |
1466 button = gtk_menu_item_new_with_label(_("Un-Ignore")); | |
1467 else | |
1468 button = gtk_menu_item_new_with_label(_("Ignore")); | |
1469 | |
1470 g_signal_connect(G_OBJECT(button), "activate", | |
1471 G_CALLBACK(ignore_cb), conv); | |
1472 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1473 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1474 gtk_widget_show(button); | |
1475 | |
8170 | 1476 if (gc && (prpl_info->get_info || prpl_info->get_cb_info)) { |
8143 | 1477 button = gtk_menu_item_new_with_label(_("Info")); |
1478 g_signal_connect(G_OBJECT(button), "activate", | |
1479 G_CALLBACK(menu_chat_info_cb), conv); | |
1480 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1481 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1482 gtk_widget_show(button); | |
1483 } | |
1484 | |
1485 if (gc && prpl_info->get_cb_away) { | |
1486 button = gtk_menu_item_new_with_label(_("Get Away Msg")); | |
1487 g_signal_connect(G_OBJECT(button), "activate", | |
1488 G_CALLBACK(menu_chat_get_away_cb), conv); | |
1489 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1490 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1491 gtk_widget_show(button); | |
1492 } | |
1493 | |
8170 | 1494 /* XXX: jabber can only add buddies from here in certain circumstances */ |
8143 | 1495 /* Added by Jonas <jonas@birme.se> */ |
1496 if (gc) { | |
1497 if (gaim_find_buddy(gc->account, who)) | |
1498 button = gtk_menu_item_new_with_label(_("Remove")); | |
1499 else | |
1500 button = gtk_menu_item_new_with_label(_("Add")); | |
1501 | |
1502 g_signal_connect(G_OBJECT(button), "activate", | |
1503 G_CALLBACK(menu_chat_add_remove_cb), conv); | |
1504 | |
1505 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1506 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1507 gtk_widget_show(button); | |
1508 } | |
1509 /* End Jonas */ | |
1510 | |
1511 return menu; | |
1512 } | |
1513 | |
1514 | |
1515 static gint | |
1516 gtkconv_chat_popup_menu_cb(GtkWidget *widget, GaimConversation *conv) | |
1517 { | |
1518 GaimGtkConversation *gtkconv; | |
1519 GaimPluginProtocolInfo *prpl_info = NULL; | |
1520 GaimGtkChatPane *gtkchat; | |
1521 GaimConnection *gc; | |
1522 GaimAccount *account; | |
1523 GtkTreeSelection *sel; | |
1524 GtkTreeIter iter; | |
1525 GtkTreeModel *model; | |
1526 GtkWidget *menu; | |
1527 gchar *who; | |
1528 | |
1529 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1530 gtkchat = gtkconv->u.chat; | |
1531 account = gaim_conversation_get_account(conv); | |
1532 gc = account->gc; | |
1533 | |
1534 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | |
1535 | |
1536 if (gc != NULL) | |
1537 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | |
1538 | |
1539 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); | |
1540 if(!gtk_tree_selection_get_selected(sel, NULL, &iter)) | |
1541 return FALSE; | |
1542 | |
9498 | 1543 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &who, -1); |
8143 | 1544 menu = create_chat_menu (conv, who, prpl_info, gc); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1545 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1546 gaim_gtk_treeview_popup_menu_position_func, widget, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1547 0, GDK_CURRENT_TIME); |
8143 | 1548 |
1549 return TRUE; | |
1550 } | |
1551 | |
1552 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1553 static gint |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1554 right_click_chat_cb(GtkWidget *widget, GdkEventButton *event, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1555 GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1556 { |
8143 | 1557 GaimGtkConversation *gtkconv; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1558 GaimPluginProtocolInfo *prpl_info = NULL; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1559 GaimGtkChatPane *gtkchat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1560 GaimConnection *gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1561 GaimAccount *account; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1562 GtkTreePath *path; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1563 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1564 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1565 GtkTreeViewColumn *column; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1566 gchar *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1567 int x, y; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1568 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1569 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1570 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1571 account = gaim_conversation_get_account(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1572 gc = account->gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1573 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1574 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1575 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1576 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
|
1577 event->x, event->y, &path, &column, &x, &y); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1578 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1579 if (path == NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1580 return FALSE; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1581 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1582 if (gc != NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1583 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1584 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1585 gtk_tree_selection_select_path(GTK_TREE_SELECTION( |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1586 gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list))), path); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1587 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1588 gtk_tree_model_get_iter(GTK_TREE_MODEL(model), &iter, path); |
9498 | 1589 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
|
1590 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1591 if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) { |
7398 | 1592 chat_do_im(conv, who); |
9554 | 1593 g_free(who); |
7398 | 1594 } else if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { |
8143 | 1595 GtkWidget *menu = create_chat_menu (conv, who, prpl_info, gc); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1596 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1597 event->button, event->time); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1598 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1599 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1600 return TRUE; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1601 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1602 |
8133 | 1603 static void |
1604 move_to_next_unread_tab(GaimConversation *conv) | |
1605 { | |
1606 GaimConversation *next_conv = NULL; | |
1607 GaimConvWindow *win; | |
1608 GList *l; | |
1609 int index, i; | |
1610 | |
1611 win = gaim_conversation_get_window(conv); | |
1612 index = gaim_conversation_get_index(conv); | |
1613 | |
1614 /* First check the tabs after this position. */ | |
1615 for (l = g_list_nth(gaim_conv_window_get_conversations(win), index); | |
1616 l != NULL; | |
1617 l = l->next) { | |
1618 | |
1619 next_conv = (GaimConversation *)l->data; | |
1620 | |
1621 if (gaim_conversation_get_unseen(next_conv) > 0) | |
1622 break; | |
1623 | |
1624 next_conv = NULL; | |
1625 } | |
1626 | |
1627 if (next_conv == NULL) { | |
1628 | |
1629 /* Now check before this position. */ | |
1630 for (l = gaim_conv_window_get_conversations(win), i = 0; | |
1631 l != NULL && i < index; | |
1632 l = l->next) { | |
1633 | |
1634 next_conv = (GaimConversation *)l->data; | |
1635 | |
1636 if (gaim_conversation_get_unseen(next_conv) > 0) | |
1637 break; | |
1638 | |
1639 next_conv = NULL; | |
1640 } | |
1641 | |
1642 if (next_conv == NULL) { | |
1643 /* Okay, just grab the next conversation tab. */ | |
1644 if (index == gaim_conv_window_get_conversation_count(win) - 1) | |
1645 next_conv = gaim_conv_window_get_conversation_at(win, 0); | |
1646 else | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1647 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1648 next_conv = gaim_conv_window_get_conversation_at(win, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1649 index + 1); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1650 } |
8133 | 1651 } |
1652 } | |
1653 | |
1654 if (next_conv != NULL && next_conv != conv) { | |
1655 gaim_conv_window_switch_conversation(win, | |
1656 gaim_conversation_get_index(next_conv)); | |
1657 } | |
1658 } | |
1659 | |
4359 | 1660 static gboolean |
8105 | 1661 entry_key_press_cb(GtkWidget *entry, GdkEventKey *event, gpointer data) |
4359 | 1662 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1663 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1664 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1665 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1666 GaimGtkWindow *gtkwin; |
8105 | 1667 int numconvs; |
1668 int curconv; | |
1669 | |
1670 conv = (GaimConversation *)data; | |
1671 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1672 win = gaim_conversation_get_window(conv); | |
1673 gtkwin = GAIM_GTK_WINDOW(win); | |
1674 numconvs = gaim_conv_window_get_conversation_count(win); | |
1675 curconv = gaim_conversation_get_index(conv); | |
1676 | |
1677 /* If CTRL was held down... */ | |
1678 if (event->state & GDK_CONTROL_MASK) { | |
4359 | 1679 switch (event->keyval) { |
8105 | 1680 case GDK_Return: |
1681 case GDK_KP_Enter: | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1682 if (gaim_prefs_get_bool( |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1683 "/gaim/gtk/conversations/ctrl_enter_sends")) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1684 { |
8105 | 1685 send_cb(NULL, conv); |
1686 | |
1687 return TRUE; | |
1688 } | |
1689 break; | |
1690 | |
4359 | 1691 case GDK_Up: |
1692 if (!conv->send_history) | |
1693 break; | |
1694 | |
1695 if (!conv->send_history->prev) { | |
1696 GtkTextIter start, end; | |
1697 | |
1698 if (conv->send_history->data) | |
1699 g_free(conv->send_history->data); | |
1700 | |
1701 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, | |
1702 &start); | |
1703 gtk_text_buffer_get_end_iter(gtkconv->entry_buffer, &end); | |
1704 | |
1705 conv->send_history->data = | |
8506 | 1706 gtk_imhtml_get_markup(GTK_IMHTML(gtkconv->entry)); |
4359 | 1707 } |
8677 | 1708 |
4359 | 1709 if (conv->send_history->next && |
1710 conv->send_history->next->data) { | |
8677 | 1711 GtkTextIter iter; |
1712 GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); | |
4359 | 1713 |
1714 conv->send_history = conv->send_history->next; | |
8061 | 1715 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1716 gtk_imhtml_append_text_with_images( |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1717 GTK_IMHTML(gtkconv->entry), conv->send_history->data, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1718 0, NULL); |
8677 | 1719 /* this is mainly just a hack so the formatting at the |
1720 * cursor gets picked up. */ | |
1721 gtk_text_buffer_get_end_iter(buffer, &iter); | |
1722 gtk_text_buffer_move_mark_by_name(buffer, "insert", &iter); | |
4359 | 1723 } |
1724 | |
8105 | 1725 return TRUE; |
4359 | 1726 break; |
1727 | |
1728 case GDK_Down: | |
1729 if (!conv->send_history) | |
1730 break; | |
1731 | |
8105 | 1732 if (conv->send_history->prev && |
1733 conv->send_history->prev->data) { | |
8677 | 1734 GtkTextIter iter; |
1735 GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); | |
8105 | 1736 |
4359 | 1737 conv->send_history = conv->send_history->prev; |
8105 | 1738 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1739 gtk_imhtml_append_text_with_images( |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1740 GTK_IMHTML(gtkconv->entry), conv->send_history->data, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1741 0, NULL); |
8677 | 1742 /* this is mainly just a hack so the formatting at the |
1743 * cursor gets picked up. */ | |
1744 gtk_text_buffer_get_end_iter(buffer, &iter); | |
1745 gtk_text_buffer_move_mark_by_name(buffer, "insert", &iter); | |
4359 | 1746 } |
1747 | |
8105 | 1748 return TRUE; |
4359 | 1749 break; |
8105 | 1750 |
8108 | 1751 case GDK_Page_Down: |
8143 | 1752 case ']': |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1753 gaim_conv_window_switch_conversation(win, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1754 (curconv + 1) % numconvs); |
8105 | 1755 |
1756 return TRUE; | |
1757 break; | |
1758 | |
8108 | 1759 case GDK_Page_Up: |
8143 | 1760 case '[': |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1761 gaim_conv_window_switch_conversation(win, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1762 (curconv + numconvs - 1) % numconvs); |
8133 | 1763 |
1764 return TRUE; | |
1765 break; | |
1766 | |
8108 | 1767 case GDK_Tab: |
8133 | 1768 move_to_next_unread_tab(conv); |
8108 | 1769 |
1770 return TRUE; | |
1771 break; | |
1772 | |
1773 case 'z': | |
1774 gtk_window_iconify(GTK_WINDOW(gtkwin->window)); | |
8105 | 1775 |
1776 return TRUE; | |
1777 break; | |
1778 | |
1779 } /* End of switch */ | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1780 } |
8758 | 1781 |
8105 | 1782 /* If ALT (or whatever) was held down... */ |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1783 else if (event->state & GDK_MOD1_MASK) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1784 { |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8730
diff
changeset
|
1785 /* XXX - Make sure the conv exists before switching to it */ |
8105 | 1786 if (event->keyval > '0' && event->keyval <= '9') { |
1787 int switchto = event->keyval - '1'; | |
1788 if (switchto < numconvs) | |
1789 gaim_conv_window_switch_conversation(win, switchto); | |
4359 | 1790 |
1791 return TRUE; | |
1792 } | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1793 } |
8758 | 1794 |
8105 | 1795 /* If neither CTRL nor ALT were held down... */ |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1796 else |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1797 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1798 switch (event->keyval) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1799 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1800 case GDK_Return: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1801 case GDK_KP_Enter: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1802 if (!(event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK)) && |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1803 gaim_prefs_get_bool("/gaim/gtk/conversations/enter_sends")) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1804 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1805 send_cb(NULL, conv); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1806 return TRUE; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1807 } |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1808 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1809 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1810 case GDK_Tab: |
9605 | 1811 return tab_complete(conv); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1812 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1813 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1814 case GDK_Page_Up: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1815 gtk_imhtml_page_up(GTK_IMHTML(gtkconv->imhtml)); |
8105 | 1816 return TRUE; |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1817 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1818 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1819 case GDK_Page_Down: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1820 gtk_imhtml_page_down(GTK_IMHTML(gtkconv->imhtml)); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1821 return TRUE; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1822 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1823 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1824 } |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1825 } |
4359 | 1826 |
1827 return FALSE; | |
1828 } | |
1829 | |
1830 /* | |
1831 * NOTE: | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1832 * 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
|
1833 * further. I have no idea *why* we need this, but we do ... It |
4359 | 1834 * 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
|
1835 * going all the way down to the notebook. I suspect a bug in |
4359 | 1836 * GtkTextView, but I'm not ready to point any fingers yet. |
1837 */ | |
1838 static gboolean | |
1839 entry_stop_rclick_cb(GtkWidget *widget, GdkEventButton *event, gpointer data) | |
1840 { | |
1841 if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { | |
1842 /* Right single click */ | |
1843 g_signal_stop_emission_by_name(G_OBJECT(widget), "button_press_event"); | |
1844 | |
1845 return TRUE; | |
1846 } | |
1847 | |
1848 return FALSE; | |
1849 } | |
1850 | |
8173 | 1851 /* |
1852 * If someone tries to type into the conversation backlog of a | |
1853 * conversation window then we yank focus from the conversation backlog | |
1854 * and give it to the text entry box so that people can type | |
1855 * all the live long day and it will get entered into the entry box. | |
1856 */ | |
6057 | 1857 static gboolean |
8105 | 1858 refocus_entry_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) |
6057 | 1859 { |
1860 GaimGtkConversation *gtkconv = data; | |
1861 | |
8237 | 1862 /* If we have a valid key for the conversation display, then exit */ |
8224 | 1863 if ((event->state & GDK_CONTROL_MASK) || |
8237 | 1864 (event->keyval == GDK_F10) || |
1865 (event->keyval == GDK_Shift_L) || | |
1866 (event->keyval == GDK_Shift_R) || | |
1867 (event->keyval == GDK_Escape) || | |
8177 | 1868 (event->keyval == GDK_Up) || |
1869 (event->keyval == GDK_Down) || | |
1870 (event->keyval == GDK_Left) || | |
8191 | 1871 (event->keyval == GDK_Right) || |
1872 (event->keyval == GDK_Home) || | |
9297 | 1873 (event->keyval == GDK_End) || |
1874 (event->keyval == GDK_Tab) || | |
1875 (event->keyval == GDK_ISO_Left_Tab)) | |
8177 | 1876 return FALSE; |
1877 | |
1878 if (event->type == GDK_KEY_RELEASE) | |
1879 gtk_widget_grab_focus(gtkconv->entry); | |
1880 | |
1881 gtk_widget_event(gtkconv->entry, (GdkEvent *)event); | |
1882 | |
1883 return TRUE; | |
6057 | 1884 } |
1885 | |
4359 | 1886 static void |
4673 | 1887 menu_conv_sel_send_cb(GObject *m, gpointer data) |
4359 | 1888 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1889 GaimConvWindow *win = g_object_get_data(m, "user_data"); |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
1890 GaimAccount *account = g_object_get_data(m, "gaim_account"); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1891 GaimConversation *conv; |
8456 | 1892 GaimGtkConversation *gtkconv; |
4359 | 1893 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1894 conv = gaim_conv_window_get_active_conversation(win); |
4359 | 1895 |
4491 | 1896 gaim_conversation_set_account(conv, account); |
8456 | 1897 |
1898 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1899 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), | |
9699 | 1900 gaim_account_get_protocol_name(conv->account)); |
4359 | 1901 } |
1902 | |
1903 static void | |
1904 insert_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *position, | |
1905 gchar *new_text, gint new_text_length, gpointer user_data) | |
1906 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1907 GaimConversation *conv = (GaimConversation *)user_data; |
4359 | 1908 |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1909 g_return_if_fail(conv != NULL); |
4359 | 1910 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1911 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) |
4359 | 1912 return; |
1913 | |
1914 got_typing_keypress(conv, (gtk_text_iter_is_start(position) && | |
1915 gtk_text_iter_is_end(position))); | |
1916 } | |
1917 | |
1918 static void | |
1919 delete_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *start_pos, | |
1920 GtkTextIter *end_pos, gpointer user_data) | |
1921 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1922 GaimConversation *conv = (GaimConversation *)user_data; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1923 GaimConvIm *im; |
4359 | 1924 |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1925 g_return_if_fail(conv != NULL); |
4359 | 1926 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1927 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) |
4359 | 1928 return; |
1929 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1930 im = GAIM_CONV_IM(conv); |
4359 | 1931 |
1932 if (gtk_text_iter_is_start(start_pos) && gtk_text_iter_is_end(end_pos)) { | |
1933 | |
1934 /* We deleted all the text, so turn off typing. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1935 if (gaim_conv_im_get_type_again_timeout(im)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1936 gaim_conv_im_stop_type_again_timeout(im); |
4359 | 1937 |
1938 serv_send_typing(gaim_conversation_get_gc(conv), | |
6695 | 1939 gaim_conversation_get_name(conv), |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
1940 GAIM_NOT_TYPING); |
4359 | 1941 } |
1942 else { | |
1943 /* We're deleting, but not all of it, so it counts as typing. */ | |
1944 got_typing_keypress(conv, FALSE); | |
1945 } | |
1946 } | |
1947 | |
1948 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1949 notebook_init_grab(GaimGtkWindow *gtkwin, GtkWidget *widget) |
4359 | 1950 { |
1951 static GdkCursor *cursor = NULL; | |
1952 | |
1953 gtkwin->in_drag = TRUE; | |
1954 | |
1955 if (gtkwin->drag_leave_signal) { | |
1956 g_signal_handler_disconnect(G_OBJECT(widget), | |
1957 gtkwin->drag_leave_signal); | |
1958 | |
1959 gtkwin->drag_leave_signal = 0; | |
1960 } | |
1961 | |
1962 if (cursor == NULL) | |
1963 cursor = gdk_cursor_new(GDK_FLEUR); | |
1964 | |
1965 /* Grab the pointer */ | |
1966 gtk_grab_add(gtkwin->notebook); | |
5114
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1967 #ifndef _WIN32 |
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1968 /* 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
|
1969 always be true after a button press. */ |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1970 if (!gdk_pointer_is_grabbed()) |
5114
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1971 #endif |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1972 gdk_pointer_grab(gtkwin->notebook->window, FALSE, |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1973 GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1974 NULL, cursor, GDK_CURRENT_TIME); |
4359 | 1975 } |
1976 | |
1977 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1978 notebook_motion_cb(GtkWidget *widget, GdkEventButton *e, GaimConvWindow *win) |
4359 | 1979 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1980 GaimGtkWindow *gtkwin; |
4359 | 1981 |
1982 gtkwin = GAIM_GTK_WINDOW(win); | |
1983 | |
1984 /* | |
1985 * Make sure the user moved the mouse far enough for the | |
1986 * drag to be initiated. | |
1987 */ | |
1988 if (gtkwin->in_predrag) { | |
1989 if (e->x_root < gtkwin->drag_min_x || | |
1990 e->x_root >= gtkwin->drag_max_x || | |
1991 e->y_root < gtkwin->drag_min_y || | |
1992 e->y_root >= gtkwin->drag_max_y) { | |
1993 | |
1994 gtkwin->in_predrag = FALSE; | |
1995 notebook_init_grab(gtkwin, widget); | |
1996 } | |
1997 } | |
1998 else { /* Otherwise, draw the arrows. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1999 GaimConvWindow *dest_win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2000 GaimGtkWindow *dest_gtkwin; |
4359 | 2001 GtkNotebook *dest_notebook; |
2002 GtkWidget *tab, *last_vis_tab = NULL; | |
2003 gint nb_x, nb_y, page_num, i, last_vis_tab_loc = -1; | |
2004 gint arrow1_x, arrow1_y, arrow2_x, arrow2_y; | |
2005 gboolean horiz_tabs = FALSE, tab_found = FALSE; | |
2006 GList *l; | |
2007 | |
2008 /* Get the window that the cursor is over. */ | |
2009 dest_win = gaim_gtkwin_get_at_xy(e->x_root, e->y_root); | |
2010 | |
2011 if (dest_win == NULL) { | |
2012 dnd_hints_hide_all(); | |
2013 | |
2014 return TRUE; | |
2015 } | |
2016 | |
2017 dest_gtkwin = GAIM_GTK_WINDOW(dest_win); | |
2018 | |
2019 dest_notebook = GTK_NOTEBOOK(dest_gtkwin->notebook); | |
2020 | |
2021 gdk_window_get_origin(GTK_WIDGET(dest_notebook)->window, &nb_x, &nb_y); | |
2022 | |
2023 arrow1_x = arrow2_x = nb_x; | |
2024 arrow1_y = arrow2_y = nb_y; | |
2025 | |
2026 page_num = gaim_gtkconv_get_dest_tab_at_xy(dest_win, | |
2027 e->x_root, e->y_root); | |
2028 | |
2029 if (gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_TOP || | |
2030 gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_BOTTOM) { | |
2031 | |
2032 horiz_tabs = TRUE; | |
2033 } | |
2034 | |
2035 /* Find out where to put the arrows. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2036 for (l = gaim_conv_window_get_conversations(dest_win), i = 0; |
4359 | 2037 l != NULL; |
2038 l = l->next, i++) { | |
2039 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2040 GaimConversation *conv = l->data; |
4359 | 2041 |
2042 tab = GAIM_GTK_CONVERSATION(conv)->tabby; | |
2043 | |
2044 /* | |
2045 * If this is the correct tab, record the positions | |
2046 * for the arrows. | |
2047 */ | |
2048 if (i == page_num) { | |
2049 if (horiz_tabs) { | |
2050 arrow1_x = arrow2_x = nb_x + tab->allocation.x; | |
2051 arrow1_y = nb_y + tab->allocation.y; | |
2052 arrow2_y = nb_y + tab->allocation.y + | |
2053 tab->allocation.height; | |
2054 } | |
2055 else { | |
2056 arrow1_x = nb_x + tab->allocation.x; | |
2057 arrow2_x = nb_x + tab->allocation.x + | |
2058 tab->allocation.width; | |
2059 arrow1_y = arrow2_y = nb_y + tab->allocation.y; | |
2060 } | |
2061 | |
2062 tab_found = TRUE; | |
2063 break; | |
2064 } | |
2065 else { /* Keep track of the right-most tab that we see. */ | |
2066 if (horiz_tabs && tab->allocation.x > last_vis_tab_loc) { | |
2067 last_vis_tab = tab; | |
2068 last_vis_tab_loc = tab->allocation.x; | |
2069 } | |
2070 else if (!horiz_tabs && tab->allocation.y > last_vis_tab_loc) { | |
2071 last_vis_tab = tab; | |
2072 last_vis_tab_loc = tab->allocation.y; | |
2073 } | |
2074 } | |
2075 } | |
2076 | |
2077 /* | |
2078 * If we didn't find the tab, then we'll just place the | |
2079 * arrows to the right/bottom of the last visible tab. | |
2080 */ | |
2081 if (!tab_found && last_vis_tab) { | |
2082 if (horiz_tabs) { | |
2083 arrow1_x = arrow2_x = nb_x + last_vis_tab->allocation.x + | |
2084 last_vis_tab->allocation.width; | |
2085 arrow1_y = nb_y + last_vis_tab->allocation.y; | |
2086 arrow2_y = nb_y + last_vis_tab->allocation.y + | |
2087 last_vis_tab->allocation.height; | |
2088 } | |
2089 else { | |
2090 arrow1_x = nb_x + last_vis_tab->allocation.x; | |
2091 arrow2_x = nb_x + last_vis_tab->allocation.x + | |
2092 last_vis_tab->allocation.width; | |
2093 arrow1_y = arrow2_y = nb_y + last_vis_tab->allocation.y + | |
2094 last_vis_tab->allocation.height; | |
2095 } | |
2096 } | |
2097 | |
2098 if (horiz_tabs) { | |
2099 dnd_hints_show(HINT_ARROW_DOWN, arrow1_x, arrow1_y); | |
2100 dnd_hints_show(HINT_ARROW_UP, arrow2_x, arrow2_y); | |
2101 } | |
2102 else { | |
2103 dnd_hints_show(HINT_ARROW_RIGHT, arrow1_x, arrow1_y); | |
2104 dnd_hints_show(HINT_ARROW_LEFT, arrow2_x, arrow2_y); | |
2105 } | |
2106 } | |
2107 | |
2108 return TRUE; | |
2109 } | |
2110 | |
2111 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2112 notebook_leave_cb(GtkWidget *widget, GdkEventCrossing *e, GaimConvWindow *win) |
4359 | 2113 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2114 GaimGtkWindow *gtkwin; |
4359 | 2115 |
2116 gtkwin = GAIM_GTK_WINDOW(win); | |
2117 | |
2118 if (gtkwin->in_drag) | |
2119 return FALSE; | |
2120 | |
2121 if (e->x_root < gtkwin->drag_min_x || | |
2122 e->x_root >= gtkwin->drag_max_x || | |
2123 e->y_root < gtkwin->drag_min_y || | |
2124 e->y_root >= gtkwin->drag_max_y) { | |
2125 | |
2126 gtkwin->in_predrag = FALSE; | |
2127 notebook_init_grab(gtkwin, widget); | |
2128 } | |
2129 | |
2130 return TRUE; | |
2131 } | |
2132 | |
2133 /* | |
2134 * THANK YOU GALEON! | |
2135 */ | |
2136 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2137 notebook_press_cb(GtkWidget *widget, GdkEventButton *e, GaimConvWindow *win) |
4359 | 2138 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2139 GaimGtkWindow *gtkwin; |
4359 | 2140 gint nb_x, nb_y, x_rel, y_rel; |
2141 GList *l; | |
2142 int tab_clicked; | |
2143 | |
2144 if (e->button != 1 || e->type != GDK_BUTTON_PRESS) | |
2145 return FALSE; | |
2146 | |
2147 gtkwin = GAIM_GTK_WINDOW(win); | |
2148 | |
2149 if (gtkwin->in_drag) { | |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
2150 gaim_debug(GAIM_DEBUG_WARNING, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
2151 "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
|
2152 return TRUE; |
4359 | 2153 } |
2154 | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2155 /* |
4359 | 2156 * Make sure a tab was actually clicked. The arrow buttons |
2157 * mess things up. | |
2158 */ | |
2159 tab_clicked = gaim_gtkconv_get_tab_at_xy(win, e->x_root, e->y_root); | |
2160 | |
2161 if (tab_clicked == -1) | |
2162 return FALSE; | |
2163 | |
2164 /* | |
2165 * Get the relative position of the press event, with regards to | |
2166 * the position of the notebook. | |
2167 */ | |
2168 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
2169 | |
2170 x_rel = e->x_root - nb_x; | |
2171 y_rel = e->y_root - nb_y; | |
2172 | |
2173 /* Reset the min/max x/y */ | |
2174 gtkwin->drag_min_x = 0; | |
2175 gtkwin->drag_min_y = 0; | |
2176 gtkwin->drag_max_x = 0; | |
2177 gtkwin->drag_max_y = 0; | |
2178 | |
2179 /* Find out which tab was dragged. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2180 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
|
2181 GaimConversation *conv = l->data; |
4359 | 2182 GtkWidget *tab = GAIM_GTK_CONVERSATION(conv)->tabby; |
2183 | |
2184 if (!GTK_WIDGET_VISIBLE(tab)) | |
2185 continue; | |
2186 | |
2187 if (tab->allocation.x > x_rel || tab->allocation.y > y_rel) | |
2188 break; | |
2189 | |
2190 /* Save the borders of the tab. */ | |
2191 gtkwin->drag_min_x = tab->allocation.x + nb_x; | |
2192 gtkwin->drag_min_y = tab->allocation.y + nb_y; | |
2193 gtkwin->drag_max_x = tab->allocation.width + gtkwin->drag_min_x; | |
2194 gtkwin->drag_max_y = tab->allocation.height + gtkwin->drag_min_y; | |
2195 } | |
2196 | |
2197 /* Make sure the click occurred in the tab. */ | |
2198 if (e->x_root < gtkwin->drag_min_x || | |
2199 e->x_root >= gtkwin->drag_max_x || | |
2200 e->y_root < gtkwin->drag_min_y || | |
2201 e->y_root >= gtkwin->drag_max_y) { | |
2202 | |
2203 return FALSE; | |
2204 } | |
2205 | |
2206 gtkwin->in_predrag = TRUE; | |
2207 | |
2208 /* Connect the new motion signals. */ | |
2209 gtkwin->drag_motion_signal = | |
2210 g_signal_connect(G_OBJECT(widget), "motion_notify_event", | |
2211 G_CALLBACK(notebook_motion_cb), win); | |
2212 | |
2213 gtkwin->drag_leave_signal = | |
2214 g_signal_connect(G_OBJECT(widget), "leave_notify_event", | |
2215 G_CALLBACK(notebook_leave_cb), win); | |
2216 | |
2217 return FALSE; | |
2218 } | |
2219 | |
2220 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2221 notebook_release_cb(GtkWidget *widget, GdkEventButton *e, GaimConvWindow *win) |
4359 | 2222 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2223 GaimConvWindow *dest_win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2224 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2225 GaimGtkWindow *dest_gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2226 GaimConversation *conv; |
4359 | 2227 GtkNotebook *dest_notebook; |
2228 gint dest_page_num; | |
2229 | |
2230 /* | |
2231 * Don't check to make sure that the event's window matches the | |
2232 * widget's, because we may be getting an event passed on from the | |
2233 * close button. | |
2234 */ | |
2235 if (e->button != 1 && e->type != GDK_BUTTON_RELEASE) | |
2236 return FALSE; | |
2237 | |
2238 if (gdk_pointer_is_grabbed()) { | |
2239 gdk_pointer_ungrab(GDK_CURRENT_TIME); | |
2240 gtk_grab_remove(widget); | |
2241 } | |
2242 | |
2243 gtkwin = GAIM_GTK_WINDOW(win); | |
2244 | |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
2245 if (!gtkwin->in_predrag && !gtkwin->in_drag) |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
2246 return FALSE; |
4359 | 2247 |
2248 /* Disconnect the motion signal. */ | |
2249 if (gtkwin->drag_motion_signal) { | |
2250 g_signal_handler_disconnect(G_OBJECT(widget), | |
2251 gtkwin->drag_motion_signal); | |
2252 | |
2253 gtkwin->drag_motion_signal = 0; | |
2254 } | |
2255 | |
2256 /* | |
2257 * If we're in a pre-drag, we'll also need to disconnect the leave | |
2258 * signal. | |
2259 */ | |
2260 if (gtkwin->in_predrag) { | |
2261 gtkwin->in_predrag = FALSE; | |
2262 | |
2263 if (gtkwin->drag_leave_signal) { | |
2264 g_signal_handler_disconnect(G_OBJECT(widget), | |
2265 gtkwin->drag_leave_signal); | |
2266 | |
2267 gtkwin->drag_leave_signal = 0; | |
2268 } | |
2269 } | |
2270 | |
2271 /* If we're not in drag... */ | |
2272 /* We're perfectly normal people! */ | |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
2273 if (!gtkwin->in_drag) |
4359 | 2274 return FALSE; |
2275 | |
2276 gtkwin->in_drag = FALSE; | |
2277 | |
2278 dnd_hints_hide_all(); | |
2279 | |
4369
7e1fb422e5fd
[gaim-migrate @ 4635]
Christian Hammond <chipx86@chipx86.com>
parents:
4368
diff
changeset
|
2280 dest_win = gaim_gtkwin_get_at_xy(e->x_root, e->y_root); |
4359 | 2281 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2282 conv = gaim_conv_window_get_active_conversation(win); |
4359 | 2283 |
2284 if (dest_win == NULL) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2285 if (gaim_conv_window_get_conversation_count(win) < 2) |
4359 | 2286 return FALSE; |
2287 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2288 if (gaim_conv_window_get_conversation_count(win) > 1) { |
4359 | 2289 /* Make a new window to stick this to. */ |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2290 GaimGtkConversation *gtkconv; |
4748
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2291 gint win_width, win_height; |
5121 | 2292 |
2293 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4359 | 2294 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2295 dest_win = gaim_conv_window_new(); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2296 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2297 gaim_conv_window_add_conversation(dest_win, |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2298 gaim_conv_window_remove_conversation(win, |
5139
d0182ae31ab8
[gaim-migrate @ 5503]
Christian Hammond <chipx86@chipx86.com>
parents:
5133
diff
changeset
|
2299 gaim_conversation_get_index(conv))); |
5121 | 2300 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2301 dest_gtkwin = GAIM_GTK_WINDOW(dest_win); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2302 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2303 gtk_window_get_size(GTK_WINDOW(dest_gtkwin->window), |
4748
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2304 &win_width, &win_height); |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2305 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2306 gtk_window_move(GTK_WINDOW(dest_gtkwin->window), |
4748
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2307 e->x_root - (win_width / 2), |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2308 e->y_root - (win_height / 2)); |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2309 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2310 gaim_conv_window_show(dest_win); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2311 } |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2312 } else { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2313 dest_gtkwin = GAIM_GTK_WINDOW(dest_win); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2314 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2315 /* Get the destination notebook. */ |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2316 dest_notebook = GTK_NOTEBOOK(gtkwin->notebook); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2317 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2318 /* Get the destination page number. */ |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2319 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
|
2320 e->x_root, e->y_root); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2321 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2322 if (win == dest_win) { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2323 gaim_conv_window_move_conversation(win, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2324 gaim_conversation_get_index(conv), dest_page_num); |
4359 | 2325 } |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2326 else { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2327 size_t pos; |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2328 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2329 gaim_conv_window_remove_conversation(win, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2330 gaim_conversation_get_index(conv)); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2331 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2332 pos = gaim_conv_window_add_conversation(dest_win, conv); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2333 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2334 if (pos != dest_page_num) |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2335 gaim_conv_window_move_conversation(dest_win, pos, dest_page_num); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2336 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2337 gaim_conv_window_switch_conversation(dest_win, dest_page_num); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2338 } |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2339 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2340 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); |
4359 | 2341 } |
2342 | |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2343 gaim_signal_emit(gaim_gtk_conversations_get_handle(), "conversation-drag-ended", |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2344 win, dest_win); |
4359 | 2345 |
2346 return TRUE; | |
2347 } | |
2348 | |
8189 | 2349 /************************************************************************** |
2350 * A bunch of buddy icon functions | |
2351 **************************************************************************/ | |
2352 static GdkPixbuf * | |
8755
d0364feabf96
[gaim-migrate @ 9510]
Christian Hammond <chipx86@chipx86.com>
parents:
8748
diff
changeset
|
2353 get_tab_icon(GaimConversation *conv, gboolean small_icon) |
7143 | 2354 { |
2355 GaimAccount *account = gaim_conversation_get_account(conv); | |
2356 const char *name = gaim_conversation_get_name(conv); | |
2357 GdkPixbuf *status = NULL; | |
2358 | |
2359 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
2360 GaimBuddy *b = gaim_find_buddy(account, name); | |
2361 if (b != NULL) { | |
2362 status = gaim_gtk_blist_get_status_icon((GaimBlistNode*)b, | |
8755
d0364feabf96
[gaim-migrate @ 9510]
Christian Hammond <chipx86@chipx86.com>
parents:
8748
diff
changeset
|
2363 (small_icon ? GAIM_STATUS_ICON_SMALL : GAIM_STATUS_ICON_LARGE)); |
7143 | 2364 } |
2365 } | |
2366 | |
2367 if (!status) { | |
2368 GdkPixbuf *pixbuf; | |
2369 pixbuf = create_prpl_icon(account); | |
2370 | |
8755
d0364feabf96
[gaim-migrate @ 9510]
Christian Hammond <chipx86@chipx86.com>
parents:
8748
diff
changeset
|
2371 if (small_icon && pixbuf != NULL) |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2372 { |
7143 | 2373 status = gdk_pixbuf_scale_simple(pixbuf, 15, 15, |
2374 GDK_INTERP_BILINEAR); | |
2375 g_object_unref(pixbuf); | |
2376 } | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2377 else |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2378 status = pixbuf; |
7143 | 2379 } |
2380 return status; | |
2381 } | |
2382 | |
8189 | 2383 static void |
2384 update_tab_icon(GaimConversation *conv) | |
2385 { | |
2386 GaimGtkConversation *gtkconv; | |
2387 GaimConvWindow *win = gaim_conversation_get_window(conv); | |
2388 GaimAccount *account; | |
2389 const char *name; | |
2390 GdkPixbuf *status = NULL; | |
2391 | |
2392 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2393 name = gaim_conversation_get_name(conv); | |
2394 account = gaim_conversation_get_account(conv); | |
2395 | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2396 status = get_tab_icon(conv, TRUE); |
8189 | 2397 |
2398 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->icon), status); | |
2399 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->menu_icon), status); | |
2400 | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2401 if (status != NULL) |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2402 g_object_unref(status); |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2403 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2404 if (gaim_conv_window_get_active_conversation(win) == conv && |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2405 gtkconv->u.im->anim == NULL) |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2406 { |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2407 status = get_tab_icon(conv, FALSE); |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2408 |
8189 | 2409 gtk_window_set_icon(GTK_WINDOW(GAIM_GTK_WINDOW(win)->window), status); |
2410 | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2411 if (status != NULL) |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2412 g_object_unref(status); |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2413 } |
8189 | 2414 } |
2415 | |
9318 | 2416 static void |
2417 get_icon_scale_size(GdkPixbufAnimation *icon, GaimBuddyIconSpec *spec, int *width, int *height) | |
2418 { | |
2419 *width = gdk_pixbuf_animation_get_width(icon); | |
2420 *height = gdk_pixbuf_animation_get_height(icon); | |
2421 | |
2422 /* this should eventually get smarter about preserving the aspect | |
2423 * ratio when scaling, but gimmie a break, I just woke up */ | |
2424 if(spec && spec->scale_rules & GAIM_ICON_SCALE_DISPLAY) { | |
2425 if(*width < spec->min_width) | |
2426 *width = spec->min_width; | |
2427 else if(*width > spec->max_width) | |
2428 *width = spec->max_width; | |
2429 | |
2430 if(*height < spec->min_height) | |
2431 *height = spec->min_height; | |
9319 | 2432 else if(*height > spec->max_height) |
9318 | 2433 *height = spec->max_height; |
2434 } | |
2435 | |
2436 /* and now for some arbitrary sanity checks */ | |
2437 if(*width > 100) | |
2438 *width = 100; | |
2439 if(*height > 100) | |
2440 *height = 100; | |
2441 } | |
2442 | |
8189 | 2443 static gboolean |
2444 redraw_icon(gpointer data) | |
2445 { | |
2446 GaimConversation *conv = (GaimConversation *)data; | |
2447 GaimGtkConversation *gtkconv; | |
9318 | 2448 GaimAccount *account; |
2449 GaimPluginProtocolInfo *prpl_info = NULL; | |
8189 | 2450 |
2451 GdkPixbuf *buf; | |
2452 GdkPixbuf *scale; | |
2453 GdkPixmap *pm; | |
2454 GdkBitmap *bm; | |
2455 gint delay; | |
9318 | 2456 int scale_width, scale_height; |
8189 | 2457 |
2458 if (!g_list_find(gaim_get_ims(), conv)) { | |
2459 gaim_debug(GAIM_DEBUG_WARNING, "gtkconv", | |
2460 "Conversation not found in redraw_icon. I think this " | |
2461 "is a bug.\n"); | |
2462 return FALSE; | |
2463 } | |
2464 | |
2465 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
9318 | 2466 account = gaim_conversation_get_account(conv); |
2467 if(account && account->gc) | |
2468 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl); | |
8189 | 2469 |
2470 gdk_pixbuf_animation_iter_advance(gtkconv->u.im->iter, NULL); | |
2471 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); | |
2472 | |
9318 | 2473 get_icon_scale_size(gtkconv->u.im->anim, prpl_info ? &prpl_info->icon_spec : |
2474 NULL, &scale_width, &scale_height); | |
2475 | |
2476 /* this code is ugly, and scares me */ | |
8189 | 2477 scale = gdk_pixbuf_scale_simple(buf, |
9318 | 2478 MAX(gdk_pixbuf_get_width(buf) * scale_width / |
8189 | 2479 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), |
9318 | 2480 MAX(gdk_pixbuf_get_height(buf) * scale_height / |
8189 | 2481 gdk_pixbuf_animation_get_height(gtkconv->u.im->anim), 1), |
2482 GDK_INTERP_NEAREST); | |
2483 | |
2484 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); | |
2485 g_object_unref(G_OBJECT(scale)); | |
2486 gtk_image_set_from_pixmap(GTK_IMAGE(gtkconv->u.im->icon), pm, bm); | |
2487 g_object_unref(G_OBJECT(pm)); | |
2488 gtk_widget_queue_draw(gtkconv->u.im->icon); | |
2489 | |
2490 if (bm) | |
2491 g_object_unref(G_OBJECT(bm)); | |
2492 | |
9131 | 2493 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter); |
2494 if (delay <= 0) | |
2495 delay = 100; | |
2496 | |
2497 gtkconv->u.im->icon_timer = g_timeout_add(delay, redraw_icon, conv); | |
8189 | 2498 |
2499 return FALSE; | |
2500 } | |
2501 | |
2502 static void | |
2503 start_anim(GtkObject *obj, GaimConversation *conv) | |
2504 { | |
2505 GaimGtkConversation *gtkconv; | |
2506 int delay; | |
2507 | |
2508 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
2509 return; | |
2510 | |
2511 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2512 | |
8228 | 2513 if (gtkconv->u.im->anim == NULL) |
2514 return; | |
2515 | |
8202 | 2516 if (gtkconv->u.im->icon_timer != 0) |
2517 return; | |
2518 | |
8189 | 2519 if (gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim)) |
2520 return; | |
2521 | |
2522 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter) / 10; | |
2523 | |
8758 | 2524 gtkconv->u.im->icon_timer = g_timeout_add(delay * 10, redraw_icon, conv); |
8189 | 2525 } |
2526 | |
2527 static void | |
2528 stop_anim(GtkObject *obj, GaimConversation *conv) | |
2529 { | |
2530 GaimGtkConversation *gtkconv; | |
2531 | |
2532 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
2533 return; | |
2534 | |
2535 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2536 | |
2537 if (gtkconv->u.im->icon_timer != 0) | |
2538 g_source_remove(gtkconv->u.im->icon_timer); | |
2539 | |
2540 gtkconv->u.im->icon_timer = 0; | |
2541 } | |
2542 | |
2543 static void | |
2544 toggle_icon_animate_cb(GtkWidget *w, GaimConversation *conv) | |
2545 { | |
2546 GaimGtkConversation *gtkconv; | |
2547 | |
2548 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
2549 return; | |
2550 | |
2551 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2552 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2553 gtkconv->u.im->animate = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2554 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w)); |
8189 | 2555 |
2556 if (gtkconv->u.im->animate) | |
2557 start_anim(NULL, conv); | |
2558 else | |
2559 stop_anim(NULL, conv); | |
2560 } | |
9845 | 2561 |
8189 | 2562 static void |
2563 remove_icon(GaimGtkConversation *gtkconv) | |
2564 { | |
2565 g_return_if_fail(gtkconv != NULL); | |
2566 | |
9887 | 2567 if (gtkconv->u.im->icon_container != NULL) |
2568 gtk_widget_destroy(gtkconv->u.im->icon_container); | |
8189 | 2569 |
2570 if (gtkconv->u.im->anim != NULL) | |
2571 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); | |
2572 | |
2573 if (gtkconv->u.im->icon_timer != 0) | |
2574 g_source_remove(gtkconv->u.im->icon_timer); | |
2575 | |
2576 if (gtkconv->u.im->iter != NULL) | |
2577 g_object_unref(G_OBJECT(gtkconv->u.im->iter)); | |
2578 | |
2579 gtkconv->u.im->icon_timer = 0; | |
2580 gtkconv->u.im->icon = NULL; | |
2581 gtkconv->u.im->anim = NULL; | |
2582 gtkconv->u.im->iter = NULL; | |
9687 | 2583 gtkconv->u.im->show_icon = FALSE; |
8189 | 2584 } |
2585 | |
9497 | 2586 static void |
9504 | 2587 saveicon_writefile_cb(void *user_data, const char *filename) |
9497 | 2588 { |
9504 | 2589 GaimConversation *conv = (GaimConversation *)user_data; |
9497 | 2590 FILE *fp; |
2591 GaimBuddyIcon *icon; | |
2592 const void *data; | |
2593 size_t len; | |
2594 | |
2595 if ((fp = fopen(filename, "wb")) == NULL) { | |
9504 | 2596 gaim_notify_error(conv, NULL, _("Unable to open file."), NULL); |
9497 | 2597 return; |
2598 } | |
2599 | |
2600 icon = gaim_conv_im_get_icon(GAIM_CONV_IM(conv)); | |
2601 data = gaim_buddy_icon_get_data(icon, &len); | |
2602 | |
2603 if ((len <= 0) || (data == NULL)) { | |
9504 | 2604 gaim_notify_error(conv, NULL, _("Unable to save icon file to disk."), NULL); |
9497 | 2605 return; |
2606 } | |
2607 | |
2608 fwrite(data, 1, len, fp); | |
2609 fclose(fp); | |
2610 } | |
2611 | |
2612 static void | |
2613 icon_menu_save_cb(GtkWidget *widget, GaimConversation *conv) | |
2614 { | |
2615 gchar *buf; | |
2616 | |
2617 g_return_if_fail(conv != NULL); | |
9504 | 2618 |
9706 | 2619 /* |
2620 * XXX - The file extension needs to be set to something that doesn't suck... | |
2621 * Maybe do what gtkimhtml.c does when saving an image? | |
2622 */ | |
9497 | 2623 buf = g_strdup_printf("%s.icon", gaim_normalize(conv->account, conv->name)); |
9504 | 2624 |
2625 gaim_request_file(conv, _("Save Icon"), buf, TRUE, | |
2626 G_CALLBACK(saveicon_writefile_cb), NULL, conv); | |
9497 | 2627 |
2628 g_free(buf); | |
2629 } | |
2630 | |
8189 | 2631 static gboolean |
2632 icon_menu(GtkObject *obj, GdkEventButton *e, GaimConversation *conv) | |
2633 { | |
2634 GaimGtkConversation *gtkconv; | |
2635 static GtkWidget *menu = NULL; | |
2636 GtkWidget *button; | |
2637 | |
2638 if (e->button != 3 || e->type != GDK_BUTTON_PRESS) | |
2639 return FALSE; | |
2640 | |
2641 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2642 | |
2643 /* | |
2644 * If a menu already exists, destroy it before creating a new one, | |
2645 * thus freeing-up the memory it occupied. | |
2646 */ | |
2647 if (menu != NULL) | |
2648 gtk_widget_destroy(menu); | |
2649 | |
2650 menu = gtk_menu_new(); | |
2651 | |
2652 if (gtkconv->u.im->anim && | |
2653 !(gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim))) | |
2654 { | |
2655 gaim_new_check_item(menu, _("Animate"), | |
2656 G_CALLBACK(toggle_icon_animate_cb), conv, | |
2657 gtkconv->u.im->icon_timer); | |
2658 } | |
2659 | |
2660 button = gtk_menu_item_new_with_label(_("Hide Icon")); | |
2661 g_signal_connect_swapped(G_OBJECT(button), "activate", | |
2662 G_CALLBACK(remove_icon), gtkconv); | |
2663 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
2664 gtk_widget_show(button); | |
2665 | |
2666 gaim_new_item_from_stock(menu, _("Save Icon As..."), GTK_STOCK_SAVE_AS, | |
9497 | 2667 G_CALLBACK(icon_menu_save_cb), conv, |
8189 | 2668 0, 0, NULL); |
2669 | |
2670 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, e->button, e->time); | |
2671 | |
2672 return TRUE; | |
2673 } | |
2674 /************************************************************************** | |
2675 * End of the bunch of buddy icon functions | |
2676 **************************************************************************/ | |
2677 | |
7887 | 2678 /* |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2679 * 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
|
2680 * sensitive/insensitive. This is called after changing tabs and when an |
7887 | 2681 * account signs on or off. |
2682 */ | |
4359 | 2683 static void |
7887 | 2684 gray_stuff_out(GaimConversation *conv) |
4359 | 2685 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2686 GaimConvWindow *win; |
7887 | 2687 GaimGtkWindow *gtkwin; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2688 GaimGtkConversation *gtkconv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2689 GaimConnection *gc; |
7887 | 2690 GaimPluginProtocolInfo *prpl_info = NULL; |
7222 | 2691 GdkPixbuf *window_icon = NULL; |
8439 | 2692 GtkIMHtmlButtons buttons; |
9812 | 2693 GaimAccount *account; |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2694 |
7887 | 2695 win = gaim_conversation_get_window(conv); |
4359 | 2696 gtkwin = GAIM_GTK_WINDOW(win); |
2697 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7887 | 2698 gc = gaim_conversation_get_gc(conv); |
9909 | 2699 account = gaim_conversation_get_account(conv); |
8439 | 2700 |
7879 | 2701 if (gc != NULL) |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
2702 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2703 |
7887 | 2704 if (gtkwin->menu.send_as != NULL) |
2705 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); | |
2706 | |
2707 /* | |
2708 * 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
|
2709 * 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
|
2710 * conversations. Stuff that Gaim chats support in general should be |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2711 * shown for chat conversations. It doesn't matter whether the PRPL |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2712 * supports it or not--that only affects if the button or menu item |
7929 | 2713 * is sensitive or not. |
7887 | 2714 */ |
4359 | 2715 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
7887 | 2716 /* Show stuff that applies to IMs, hide stuff that applies to chats */ |
2717 | |
2718 /* Deal with buttons */ | |
2719 gtk_widget_show(gtkconv->info); | |
2720 gtk_widget_show(gtkconv->send); | |
2721 gtk_widget_show(gtkconv->u.im->block); | |
9468 | 2722 gtk_widget_show(gtkconv->u.im->send_file); |
7887 | 2723 |
2724 /* Deal with menu items */ | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2725 gtk_widget_show(gtkwin->menu.view_log); |
9468 | 2726 gtk_widget_show(gtkwin->menu.send_file); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2727 gtk_widget_show(gtkwin->menu.add_pounce); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2728 gtk_widget_show(gtkwin->menu.get_info); |
7887 | 2729 gtk_widget_show(gtkwin->menu.warn); |
7859 | 2730 gtk_widget_hide(gtkwin->menu.invite); |
7887 | 2731 gtk_widget_show(gtkwin->menu.alias); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2732 gtk_widget_show(gtkwin->menu.block); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2733 |
9812 | 2734 if (gaim_find_buddy(account, gaim_conversation_get_name(conv)) == NULL) { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2735 gtk_widget_show(gtkwin->menu.add); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2736 gtk_widget_hide(gtkwin->menu.remove); |
7929 | 2737 gtk_widget_show(gtkconv->add); |
2738 gtk_widget_hide(gtkconv->remove); | |
7859 | 2739 } else { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2740 gtk_widget_show(gtkwin->menu.remove); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2741 gtk_widget_hide(gtkwin->menu.add); |
7929 | 2742 gtk_widget_hide(gtkconv->add); |
2743 gtk_widget_show(gtkconv->remove); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2744 } |
7887 | 2745 |
2746 gtk_widget_show(gtkwin->menu.insert_link); | |
9287 | 2747 gtk_widget_show(gtkwin->menu.insert_image); |
7887 | 2748 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
9470 | 2749 /* Show stuff that applies to Chats, hide stuff that applies to IMs */ |
7887 | 2750 |
2751 /* Deal with buttons */ | |
7952 | 2752 gtk_widget_show(gtkconv->info); |
7887 | 2753 gtk_widget_show(gtkconv->send); |
2754 gtk_widget_show(gtkconv->u.chat->invite); | |
2755 | |
2756 /* Deal with menu items */ | |
9917 | 2757 gtk_widget_show(gtkwin->menu.view_log); |
9468 | 2758 gtk_widget_hide(gtkwin->menu.send_file); |
7859 | 2759 gtk_widget_hide(gtkwin->menu.add_pounce); |
2760 gtk_widget_hide(gtkwin->menu.get_info); | |
7887 | 2761 gtk_widget_hide(gtkwin->menu.warn); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2762 gtk_widget_show(gtkwin->menu.invite); |
7887 | 2763 gtk_widget_show(gtkwin->menu.alias); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2764 gtk_widget_hide(gtkwin->menu.block); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2765 |
9812 | 2766 if (gaim_blist_find_chat(account, gaim_conversation_get_name(conv)) == NULL) { |
2767 /* If the chat is NOT in the buddy list */ | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2768 gtk_widget_show(gtkwin->menu.add); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2769 gtk_widget_hide(gtkwin->menu.remove); |
7929 | 2770 gtk_widget_show(gtkconv->add); |
2771 gtk_widget_hide(gtkconv->remove); | |
7859 | 2772 } else { |
9812 | 2773 /* If the chat IS in the buddy list */ |
2774 gtk_widget_hide(gtkwin->menu.add); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2775 gtk_widget_show(gtkwin->menu.remove); |
7929 | 2776 gtk_widget_hide(gtkconv->add); |
2777 gtk_widget_show(gtkconv->remove); | |
7887 | 2778 } |
2779 | |
2780 gtk_widget_show(gtkwin->menu.insert_link); | |
2781 gtk_widget_hide(gtkwin->menu.insert_image); | |
2782 } | |
2783 | |
2784 /* | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2785 * Handle graying stuff out based on whether an account is connected |
7887 | 2786 * and what features that account supports. |
2787 */ | |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
2788 if ((gc != NULL) && |
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
2789 ( (gaim_conversation_get_type(conv) != GAIM_CONV_CHAT) || |
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
2790 !gaim_conv_chat_has_left(GAIM_CONV_CHAT(conv)) )) { |
7887 | 2791 /* Account is online */ |
2792 | |
2793 /* Deal with buttons */ | |
2794 gtk_widget_set_sensitive(gtkconv->info, (prpl_info->get_info != NULL)); | |
7929 | 2795 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2796 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2797 { |
9812 | 2798 gtk_widget_set_sensitive(gtkconv->add, (prpl_info->add_buddy != NULL)); |
2799 gtk_widget_set_sensitive(gtkconv->remove, (prpl_info->remove_buddy != NULL)); | |
2800 gtk_widget_set_sensitive(gtkconv->send, (prpl_info->send_im != NULL)); | |
2801 gtk_widget_set_sensitive(gtkconv->u.im->block, (prpl_info->add_deny != NULL)); | |
9468 | 2802 gtk_widget_set_sensitive(gtkconv->u.im->send_file, |
9812 | 2803 (prpl_info->send_file && (!prpl_info->can_receive_file || |
2804 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
|
2805 } |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2806 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2807 { |
9812 | 2808 /* Only allow adding/removing if this is a chat and not a conference */ |
2809 gtk_widget_set_sensitive(gtkconv->add, (prpl_info->join_chat != NULL)); | |
2810 gtk_widget_set_sensitive(gtkconv->remove, (prpl_info->join_chat != NULL)); | |
2811 gtk_widget_set_sensitive(gtkconv->send, (prpl_info->chat_send != NULL)); | |
2812 gtk_widget_set_sensitive(gtkconv->u.chat->invite, (prpl_info->chat_invite != NULL)); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2813 } |
7887 | 2814 |
2815 /* Deal with the toolbar */ | |
8420 | 2816 if (gc->flags & GAIM_CONNECTION_HTML) { |
8677 | 2817 buttons = GTK_IMHTML_ALL; /* Everything on */ |
8420 | 2818 if (!(prpl_info->options & OPT_PROTO_IM_IMAGE)) |
8422 | 2819 buttons &= ~GTK_IMHTML_IMAGE; |
8420 | 2820 if (gc->flags & GAIM_CONNECTION_NO_BGCOLOR) |
8422 | 2821 buttons &= ~GTK_IMHTML_BACKCOLOR; |
8691
0eb5161ef333
[gaim-migrate @ 9444]
Christian Hammond <chipx86@chipx86.com>
parents:
8690
diff
changeset
|
2822 if (gc->flags & GAIM_CONNECTION_NO_FONTSIZE) { |
0eb5161ef333
[gaim-migrate @ 9444]
Christian Hammond <chipx86@chipx86.com>
parents:
8690
diff
changeset
|
2823 buttons &= ~GTK_IMHTML_GROW; |
0eb5161ef333
[gaim-migrate @ 9444]
Christian Hammond <chipx86@chipx86.com>
parents:
8690
diff
changeset
|
2824 buttons &= ~GTK_IMHTML_SHRINK; |
0eb5161ef333
[gaim-migrate @ 9444]
Christian Hammond <chipx86@chipx86.com>
parents:
8690
diff
changeset
|
2825 } |
9041 | 2826 if (gc->flags & GAIM_CONNECTION_NO_URLDESC) |
2827 buttons &= ~GTK_IMHTML_LINKDESC; | |
8420 | 2828 } else { |
8422 | 2829 buttons = GTK_IMHTML_SMILEY; |
8420 | 2830 } |
2831 gtk_imhtml_set_format_functions(GTK_IMHTML(gtkconv->entry), buttons); | |
9812 | 2832 gtk_imhtmltoolbar_associate_smileys(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), gaim_account_get_protocol_id(account)); |
8422 | 2833 |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
2834 /* Deal with menu items */ |
7887 | 2835 gtk_widget_set_sensitive(gtkwin->menu.view_log, TRUE); |
2836 gtk_widget_set_sensitive(gtkwin->menu.add_pounce, TRUE); | |
2837 gtk_widget_set_sensitive(gtkwin->menu.get_info, (prpl_info->get_info != NULL)); | |
2838 gtk_widget_set_sensitive(gtkwin->menu.warn, (prpl_info->warn != NULL)); | |
9812 | 2839 gtk_widget_set_sensitive(gtkwin->menu.invite, (prpl_info->chat_invite != NULL)); |
2840 gtk_widget_set_sensitive(gtkwin->menu.block, (prpl_info->add_deny != NULL)); | |
2841 gtk_widget_set_sensitive(gtkwin->menu.insert_link, (gc->flags & GAIM_CONNECTION_HTML)); | |
2842 gtk_widget_set_sensitive(gtkwin->menu.insert_image, (prpl_info->options & OPT_PROTO_IM_IMAGE)); | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
2843 |
7887 | 2844 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
9812 | 2845 gtk_widget_set_sensitive(gtkwin->menu.add, (prpl_info->add_buddy != NULL)); |
2846 gtk_widget_set_sensitive(gtkwin->menu.remove, (prpl_info->remove_buddy != NULL)); | |
9468 | 2847 gtk_widget_set_sensitive(gtkwin->menu.send_file, |
9812 | 2848 (prpl_info->send_file != NULL && (!prpl_info->can_receive_file || |
2849 prpl_info->can_receive_file(gc, gaim_conversation_get_name(conv))))); | |
2850 gtk_widget_set_sensitive(gtkwin->menu.alias, | |
2851 (gaim_find_buddy(account, gaim_conversation_get_name(conv)) != NULL)); | |
7887 | 2852 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
9812 | 2853 gtk_widget_set_sensitive(gtkwin->menu.add, (prpl_info->join_chat != NULL)); |
2854 gtk_widget_set_sensitive(gtkwin->menu.remove, (prpl_info->join_chat != NULL)); | |
2855 gtk_widget_set_sensitive(gtkwin->menu.alias, | |
2856 (gaim_blist_find_chat(account, gaim_conversation_get_name(conv)) != NULL)); | |
7887 | 2857 } |
2858 } else { | |
2859 /* Account is offline */ | |
9812 | 2860 /* Or it's a chat that we've left. */ |
7887 | 2861 |
2862 /* Deal with buttons */ | |
7929 | 2863 gtk_widget_set_sensitive(gtkconv->add, FALSE); |
2864 gtk_widget_set_sensitive(gtkconv->remove, FALSE); | |
7887 | 2865 gtk_widget_set_sensitive(gtkconv->info, FALSE); |
2866 gtk_widget_set_sensitive(gtkconv->send, FALSE); | |
2867 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
2868 gtk_widget_set_sensitive(gtkconv->u.im->block, FALSE); | |
9468 | 2869 gtk_widget_set_sensitive(gtkconv->u.im->send_file, FALSE); |
7887 | 2870 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
2871 gtk_widget_set_sensitive(gtkconv->u.chat->invite, FALSE); | |
2872 } | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2873 |
7887 | 2874 /* Then deal with menu items */ |
2875 gtk_widget_set_sensitive(gtkwin->menu.view_log, TRUE); | |
9468 | 2876 gtk_widget_set_sensitive(gtkwin->menu.send_file, FALSE); |
7887 | 2877 gtk_widget_set_sensitive(gtkwin->menu.add_pounce, TRUE); |
2878 gtk_widget_set_sensitive(gtkwin->menu.get_info, FALSE); | |
2879 gtk_widget_set_sensitive(gtkwin->menu.warn, FALSE); | |
2880 gtk_widget_set_sensitive(gtkwin->menu.invite, FALSE); | |
2881 gtk_widget_set_sensitive(gtkwin->menu.alias, FALSE); | |
2882 gtk_widget_set_sensitive(gtkwin->menu.block, FALSE); | |
2883 gtk_widget_set_sensitive(gtkwin->menu.add, FALSE); | |
2884 gtk_widget_set_sensitive(gtkwin->menu.remove, FALSE); | |
7929 | 2885 gtk_widget_set_sensitive(gtkwin->menu.insert_link, TRUE); |
7887 | 2886 gtk_widget_set_sensitive(gtkwin->menu.insert_image, FALSE); |
2887 } | |
2888 | |
2889 /* | |
2890 * Update the window's icon | |
2891 */ | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2892 if ((gaim_conversation_get_type(conv) == GAIM_CONV_IM) && |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2893 (gtkconv->u.im->anim)) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2894 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2895 window_icon = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2896 gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); |
7887 | 2897 g_object_ref(window_icon); |
2898 } else { | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2899 window_icon = get_tab_icon(conv, FALSE); |
4359 | 2900 } |
7887 | 2901 gtk_window_set_icon(GTK_WINDOW(gtkwin->window), window_icon); |
2902 g_object_unref(G_OBJECT(window_icon)); | |
2903 } | |
2904 | |
2905 static void | |
8189 | 2906 before_switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, |
2907 gpointer user_data) | |
2908 { | |
2909 GaimConvWindow *win; | |
2910 GaimConversation *conv; | |
2911 GaimGtkConversation *gtkconv; | |
2912 | |
2913 win = (GaimConvWindow *)user_data; | |
2914 conv = gaim_conv_window_get_active_conversation(win); | |
2915 | |
2916 g_return_if_fail(conv != NULL); | |
2917 | |
8192 | 2918 if (gaim_conversation_get_type(conv) != GAIM_CONV_IM) |
2919 return; | |
2920 | |
8189 | 2921 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2922 | |
2923 stop_anim(NULL, conv); | |
2924 } | |
2925 | |
2926 static void | |
7887 | 2927 switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, |
2928 gpointer user_data) | |
2929 { | |
2930 GaimConvWindow *win; | |
2931 GaimConversation *conv; | |
2932 GaimGtkConversation *gtkconv; | |
2933 GaimGtkWindow *gtkwin; | |
2934 | |
2935 win = (GaimConvWindow *)user_data; | |
2936 conv = gaim_conv_window_get_conversation_at(win, page_num); | |
2937 | |
2938 g_return_if_fail(conv != NULL); | |
2939 | |
2940 gtkwin = GAIM_GTK_WINDOW(win); | |
2941 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2942 | |
2943 gaim_conversation_set_unseen(conv, GAIM_UNSEEN_NONE); | |
2944 | |
2945 /* Update the menubar */ | |
2946 gray_stuff_out(conv); | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2947 |
4736 | 2948 update_typing_icon(conv); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2949 |
4359 | 2950 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.logging), |
7143 | 2951 gaim_conversation_is_logging(conv)); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2952 |
4359 | 2953 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.sounds), |
7143 | 2954 gtkconv->make_sound); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2955 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2956 gtk_check_menu_item_set_active( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2957 GTK_CHECK_MENU_ITEM(gtkwin->menu.show_formatting_toolbar), |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2958 gtkconv->show_formatting_toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2959 |
9188 | 2960 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.show_timestamps), |
2961 gtkconv->show_timestamps); | |
2962 | |
8189 | 2963 /* |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2964 * We pause icons when they are not visible. If this icon should |
9297 | 2965 * be animated then start it back up again. |
8189 | 2966 */ |
8192 | 2967 if ((gaim_conversation_get_type(conv) == GAIM_CONV_IM) && |
2968 (gtkconv->u.im->animate)) | |
8189 | 2969 start_anim(NULL, conv); |
2970 | |
4965 | 2971 gtk_window_set_title(GTK_WINDOW(gtkwin->window), |
7143 | 2972 gtk_label_get_text(GTK_LABEL(gtkconv->tab_label))); |
4359 | 2973 } |
2974 | |
2975 /************************************************************************** | |
2976 * Utility functions | |
2977 **************************************************************************/ | |
2978 | |
2979 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2980 got_typing_keypress(GaimConversation *conv, gboolean first) |
4359 | 2981 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2982 GaimConvIm *im; |
4685 | 2983 |
4359 | 2984 /* |
2985 * We know we got something, so we at least have to make sure we don't | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
2986 * send GAIM_TYPED any time soon. |
4359 | 2987 */ |
2988 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2989 im = GAIM_CONV_IM(conv); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2990 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2991 if (gaim_conv_im_get_type_again_timeout(im)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2992 gaim_conv_im_stop_type_again_timeout(im); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2993 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2994 gaim_conv_im_start_type_again_timeout(im); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2995 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2996 if (first || (gaim_conv_im_get_type_again(im) != 0 && |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2997 time(NULL) > gaim_conv_im_get_type_again(im))) { |
4359 | 2998 |
2999 int timeout = serv_send_typing(gaim_conversation_get_gc(conv), | |
3000 (char *)gaim_conversation_get_name(conv), | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
3001 GAIM_TYPING); |
4359 | 3002 |
3003 if (timeout) | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3004 gaim_conv_im_set_type_again(im, time(NULL) + timeout); |
4359 | 3005 else |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3006 gaim_conv_im_set_type_again(im, 0); |
4359 | 3007 } |
3008 } | |
3009 | |
4736 | 3010 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3011 update_typing_icon(GaimConversation *conv) |
4736 | 3012 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3013 GaimGtkWindow *gtkwin; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3014 GaimConvIm *im = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3015 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); |
4736 | 3016 |
3017 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); | |
3018 | |
3019 if(gaim_conversation_get_type(conv) == GAIM_CONV_IM) | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3020 im = GAIM_CONV_IM(conv); |
4736 | 3021 |
3022 if(gtkwin->menu.typing_icon) { | |
3023 gtk_widget_destroy(gtkwin->menu.typing_icon); | |
3024 gtkwin->menu.typing_icon = NULL; | |
3025 } | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3026 if(im && gaim_conv_im_get_typing_state(im) == GAIM_TYPING) { |
4736 | 3027 gtkwin->menu.typing_icon = gtk_image_menu_item_new(); |
3028 gtk_image_menu_item_set_image( | |
3029 GTK_IMAGE_MENU_ITEM(gtkwin->menu.typing_icon), | |
3030 gtk_image_new_from_stock(GAIM_STOCK_TYPING, | |
3031 GTK_ICON_SIZE_MENU)); | |
4757 | 3032 gtk_tooltips_set_tip(gtkconv->tooltips, gtkwin->menu.typing_icon, |
4736 | 3033 _("User is typing..."), NULL); |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3034 } else if(im && gaim_conv_im_get_typing_state(im) == GAIM_TYPED) { |
4736 | 3035 gtkwin->menu.typing_icon = gtk_image_menu_item_new(); |
3036 gtk_image_menu_item_set_image( | |
3037 GTK_IMAGE_MENU_ITEM(gtkwin->menu.typing_icon), | |
3038 gtk_image_new_from_stock(GAIM_STOCK_TYPED, | |
3039 GTK_ICON_SIZE_MENU)); | |
4757 | 3040 gtk_tooltips_set_tip(gtkconv->tooltips, gtkwin->menu.typing_icon, |
4736 | 3041 _("User has typed something and paused"), NULL); |
3042 } | |
3043 | |
3044 if(gtkwin->menu.typing_icon) { | |
3045 gtk_menu_item_set_right_justified( | |
3046 GTK_MENU_ITEM(gtkwin->menu.typing_icon), TRUE); | |
3047 gtk_widget_show_all(gtkwin->menu.typing_icon); | |
3048 gtk_menu_shell_append(GTK_MENU_SHELL(gtkwin->menu.menubar), | |
3049 gtkwin->menu.typing_icon); | |
3050 } | |
3051 } | |
3052 | |
4685 | 3053 static gboolean |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3054 update_send_as_selection(GaimConvWindow *win) |
4359 | 3055 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3056 GaimAccount *account; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3057 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3058 GaimGtkWindow *gtkwin; |
4359 | 3059 GtkWidget *menu; |
3060 GList *child; | |
3061 | |
7090
04f9f7440bc3
[gaim-migrate @ 7655]
Christian Hammond <chipx86@chipx86.com>
parents:
7089
diff
changeset
|
3062 if (g_list_find(gaim_get_windows(), win) == NULL) |
04f9f7440bc3
[gaim-migrate @ 7655]
Christian Hammond <chipx86@chipx86.com>
parents:
7089
diff
changeset
|
3063 return FALSE; |
4849 | 3064 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3065 conv = gaim_conv_window_get_active_conversation(win); |
4359 | 3066 |
5860
52d5fad43950
[gaim-migrate @ 6291]
Christian Hammond <chipx86@chipx86.com>
parents:
5858
diff
changeset
|
3067 if (conv == NULL) |
52d5fad43950
[gaim-migrate @ 6291]
Christian Hammond <chipx86@chipx86.com>
parents:
5858
diff
changeset
|
3068 return FALSE; |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
3069 |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
3070 account = gaim_conversation_get_account(conv); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
3071 gtkwin = GAIM_GTK_WINDOW(win); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
3072 |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
3073 if (gtkwin->menu.send_as == NULL) |
4685 | 3074 return FALSE; |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
3075 |
4359 | 3076 gtk_widget_show(gtkwin->menu.send_as); |
3077 | |
3078 menu = gtk_menu_item_get_submenu( | |
3079 GTK_MENU_ITEM(gtkwin->menu.send_as)); | |
3080 | |
3081 for (child = gtk_container_get_children(GTK_CONTAINER(menu)); | |
3082 child != NULL; | |
3083 child = child->next) { | |
3084 | |
3085 GtkWidget *item = child->data; | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3086 GaimAccount *item_account = g_object_get_data(G_OBJECT(item), |
4673 | 3087 "gaim_account"); |
3088 | |
3089 if (account == item_account) { | |
4359 | 3090 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE); |
3091 break; | |
3092 } | |
3093 } | |
6030
54c37db13279
[gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents:
6016
diff
changeset
|
3094 |
4685 | 3095 return FALSE; |
4359 | 3096 } |
3097 | |
3098 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3099 generate_send_as_items(GaimConvWindow *win, GaimConversation *deleted_conv) |
4359 | 3100 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3101 GaimGtkWindow *gtkwin; |
4359 | 3102 GtkWidget *menu; |
3103 GtkWidget *menuitem; | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3104 GList *gcs; |
4359 | 3105 GList *convs; |
3106 GSList *group = NULL; | |
3107 gboolean first_offline = TRUE; | |
3108 gboolean found_online = FALSE; | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3109 GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
4359 | 3110 |
3111 gtkwin = GAIM_GTK_WINDOW(win); | |
3112 | |
3113 if (gtkwin->menu.send_as != NULL) | |
3114 gtk_widget_destroy(gtkwin->menu.send_as); | |
3115 | |
3116 /* See if we have > 1 connection active. */ | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3117 if (g_list_length(gaim_connections_get_all()) < 2) { |
4359 | 3118 /* Now make sure we don't have any Offline entries. */ |
3119 gboolean found_offline = FALSE; | |
3120 | |
3121 for (convs = gaim_get_conversations(); | |
3122 convs != NULL; | |
3123 convs = convs->next) { | |
3124 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3125 GaimConversation *conv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3126 GaimAccount *account; |
4491 | 3127 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3128 conv = (GaimConversation *)convs->data; |
4491 | 3129 account = gaim_conversation_get_account(conv); |
3130 | |
6495
8ce66049ce68
[gaim-migrate @ 7010]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
3131 if (account != NULL && account->gc == NULL) { |
4359 | 3132 found_offline = TRUE; |
3133 break; | |
3134 } | |
3135 } | |
3136 | |
3137 if (!found_offline) { | |
3138 gtkwin->menu.send_as = NULL; | |
3139 return; | |
3140 } | |
3141 } | |
3142 | |
3143 /* Build the Send As menu */ | |
3144 gtkwin->menu.send_as = gtk_menu_item_new_with_mnemonic(_("_Send As")); | |
3145 gtk_widget_show(gtkwin->menu.send_as); | |
3146 | |
3147 menu = gtk_menu_new(); | |
7857
43f63ff8a6d8
[gaim-migrate @ 8511]
Christian Hammond <chipx86@chipx86.com>
parents:
7855
diff
changeset
|
3148 gtk_menu_shell_insert(GTK_MENU_SHELL(gtkwin->menu.menubar), |
43f63ff8a6d8
[gaim-migrate @ 8511]
Christian Hammond <chipx86@chipx86.com>
parents:
7855
diff
changeset
|
3149 gtkwin->menu.send_as, 2); |
4359 | 3150 gtk_menu_item_set_submenu(GTK_MENU_ITEM(gtkwin->menu.send_as), menu); |
3151 | |
3152 gtk_widget_show(menu); | |
3153 | |
3154 /* Fill it with entries. */ | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3155 for (gcs = gaim_connections_get_all(); gcs != NULL; gcs = gcs->next) { |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3156 |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3157 GaimConnection *gc; |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3158 GaimAccount *account; |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3159 GtkWidget *box; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3160 GtkWidget *label; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3161 GtkWidget *image; |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3162 GdkPixbuf *pixbuf, *scale; |
4359 | 3163 |
3164 found_online = TRUE; | |
3165 | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3166 gc = (GaimConnection *)gcs->data; |
4359 | 3167 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3168 /* Create a pixmap for the protocol icon. */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3169 pixbuf = create_prpl_icon(gc->account); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3170 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, GDK_INTERP_BILINEAR); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3171 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3172 /* Now convert it to GtkImage */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3173 if (pixbuf == NULL) |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3174 image = gtk_image_new(); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3175 else |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3176 image = gtk_image_new_from_pixbuf(scale); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3177 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3178 gtk_size_group_add_widget(sg, image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3179 |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3180 g_object_unref(G_OBJECT(scale)); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3181 g_object_unref(G_OBJECT(pixbuf)); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3182 |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3183 account = gaim_connection_get_account(gc); |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3184 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3185 /* Make our menu item */ |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3186 menuitem = gtk_radio_menu_item_new_with_label(group, |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3187 gaim_account_get_username(account)); |
4793 | 3188 group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem)); |
4359 | 3189 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3190 /* Do some evil, see some evil, speak some evil. */ |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3191 box = gtk_hbox_new(FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3192 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3193 label = gtk_bin_get_child(GTK_BIN(menuitem)); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3194 g_object_ref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3195 gtk_container_remove(GTK_CONTAINER(menuitem), label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3196 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3197 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3198 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 4); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3199 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3200 g_object_unref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3201 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3202 gtk_container_add(GTK_CONTAINER(menuitem), box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3203 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3204 gtk_widget_show(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3205 gtk_widget_show(image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3206 gtk_widget_show(box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3207 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3208 /* Set our data and callbacks. */ |
4359 | 3209 g_object_set_data(G_OBJECT(menuitem), "user_data", win); |
4673 | 3210 g_object_set_data(G_OBJECT(menuitem), "gaim_account", gc->account); |
4359 | 3211 |
4786 | 3212 g_signal_connect(G_OBJECT(menuitem), "activate", |
4673 | 3213 G_CALLBACK(menu_conv_sel_send_cb), NULL); |
4359 | 3214 |
3215 gtk_widget_show(menuitem); | |
3216 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
3217 } | |
3218 | |
3219 /* | |
3220 * Fill it with any accounts that still has an open (yet disabled) window | |
3221 * (signed off accounts with a window open). | |
3222 */ | |
3223 for (convs = gaim_get_conversations(); | |
3224 convs != NULL; | |
3225 convs = convs->next) { | |
3226 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3227 GaimConversation *conv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3228 GaimAccount *account; |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3229 GtkWidget *box; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3230 GtkWidget *label; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3231 GtkWidget *image; |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3232 GdkPixbuf *pixbuf, *scale; |
4359 | 3233 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3234 conv = (GaimConversation *)convs->data; |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3235 |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3236 if (conv == deleted_conv) |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3237 continue; |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3238 |
4491 | 3239 account = gaim_conversation_get_account(conv); |
3240 | |
6495
8ce66049ce68
[gaim-migrate @ 7010]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
3241 if (account != NULL && account->gc == NULL) { |
4359 | 3242 if (first_offline && found_online) { |
3243 menuitem = gtk_separator_menu_item_new(); | |
3244 gtk_widget_show(menuitem); | |
3245 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
3246 | |
3247 first_offline = FALSE; | |
3248 } | |
3249 | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3250 /* Create a pixmap for the protocol icon. */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3251 pixbuf = create_prpl_icon(account); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3252 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3253 GDK_INTERP_BILINEAR); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3254 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3255 /* Now convert it to GtkImage */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3256 if (pixbuf == NULL) |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3257 image = gtk_image_new(); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3258 else |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3259 image = gtk_image_new_from_pixbuf(scale); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3260 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3261 gtk_size_group_add_widget(sg, image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3262 |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3263 if (scale != NULL) g_object_unref(scale); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3264 if (pixbuf != NULL) g_object_unref(pixbuf); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3265 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3266 /* Make our menu item */ |
4359 | 3267 menuitem = gtk_radio_menu_item_new_with_label(group, |
4491 | 3268 account->username); |
4793 | 3269 group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem)); |
4359 | 3270 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3271 /* Do some evil, see some evil, speak some evil. */ |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3272 box = gtk_hbox_new(FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3273 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3274 label = gtk_bin_get_child(GTK_BIN(menuitem)); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3275 g_object_ref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3276 gtk_container_remove(GTK_CONTAINER(menuitem), label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3277 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3278 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3279 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 4); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3280 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3281 g_object_unref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3282 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3283 gtk_container_add(GTK_CONTAINER(menuitem), box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3284 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3285 gtk_widget_show(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3286 gtk_widget_show(image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3287 gtk_widget_show(box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3288 |
4359 | 3289 gtk_widget_set_sensitive(menuitem, FALSE); |
4786 | 3290 g_object_set_data(G_OBJECT(menuitem), "user_data", win); |
4674 | 3291 g_object_set_data(G_OBJECT(menuitem), "gaim_account", account); |
4359 | 3292 |
4786 | 3293 g_signal_connect(G_OBJECT(menuitem), "activate", |
5902
6889b89cab90
[gaim-migrate @ 6334]
Christian Hammond <chipx86@chipx86.com>
parents:
5901
diff
changeset
|
3294 G_CALLBACK(menu_conv_sel_send_cb), NULL); |
4786 | 3295 |
4359 | 3296 gtk_widget_show(menuitem); |
3297 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
3298 } | |
3299 } | |
3300 | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3301 g_object_unref(sg); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3302 |
4359 | 3303 gtk_widget_show(gtkwin->menu.send_as); |
3304 update_send_as_selection(win); | |
3305 } | |
3306 | |
3307 static GList * | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3308 generate_invite_user_names(GaimConnection *gc) |
4359 | 3309 { |
6695 | 3310 GaimBlistNode *gnode,*cnode,*bnode; |
4359 | 3311 static GList *tmp = NULL; |
3312 | |
3313 if (tmp) | |
3314 g_list_free(tmp); | |
3315 | |
3316 tmp = g_list_append(NULL, ""); | |
3317 | |
3318 if (gc != NULL) { | |
4785 | 3319 for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { |
3320 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) | |
3321 continue; | |
6695 | 3322 for(cnode = gnode->child; cnode; cnode = cnode->next) { |
3323 if(!GAIM_BLIST_NODE_IS_CONTACT(cnode)) | |
4785 | 3324 continue; |
6695 | 3325 for(bnode = cnode->child; bnode; bnode = bnode->next) { |
3326 GaimBuddy *buddy; | |
3327 | |
3328 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) | |
3329 continue; | |
3330 | |
3331 buddy = (GaimBuddy *)bnode; | |
3332 | |
3333 if (buddy->account == gc->account && | |
3334 GAIM_BUDDY_IS_ONLINE(buddy)) | |
3335 tmp = g_list_append(tmp, buddy->name); | |
3336 } | |
4359 | 3337 } |
3338 } | |
3339 } | |
3340 | |
3341 return tmp; | |
3342 } | |
3343 | |
9498 | 3344 static GdkPixbuf * |
9554 | 3345 get_chat_buddy_status_icon(GaimConvChat *chat, const char *name, GaimConvChatBuddyFlags flags) |
9498 | 3346 { |
9554 | 3347 GdkPixbuf *pixbuf, *scale, *scale2; |
9498 | 3348 char *filename; |
9554 | 3349 char *image = NULL; |
3350 | |
3351 if (flags & GAIM_CBFLAGS_FOUNDER) { | |
9588 | 3352 image = g_strdup("founder.png"); |
9554 | 3353 } else if (flags & GAIM_CBFLAGS_OP) { |
9588 | 3354 image = g_strdup("op.png"); |
9554 | 3355 } else if (flags & GAIM_CBFLAGS_HALFOP) { |
9588 | 3356 image = g_strdup("halfop.png"); |
9554 | 3357 } else if (flags & GAIM_CBFLAGS_VOICE) { |
9588 | 3358 image = g_strdup("voice.png"); |
9554 | 3359 } else if ((!flags) && gaim_conv_chat_is_user_ignored(chat, name)) { |
9588 | 3360 image = g_strdup("ignored.png"); |
9554 | 3361 } |
3362 if (image) { | |
3363 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL); | |
3364 g_free(image); | |
9498 | 3365 pixbuf = gdk_pixbuf_new_from_file(filename, NULL); |
3366 g_free(filename); | |
3367 if (!pixbuf) | |
3368 return NULL; | |
3369 scale = gdk_pixbuf_scale_simple(pixbuf, 15, 15, GDK_INTERP_BILINEAR); | |
3370 g_object_unref(pixbuf); | |
9554 | 3371 if (flags && gaim_conv_chat_is_user_ignored(chat, name)) { |
9588 | 3372 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", "ignored.png", NULL); |
9554 | 3373 pixbuf = gdk_pixbuf_new_from_file(filename, NULL); |
3374 g_free(filename); | |
3375 scale2 = gdk_pixbuf_scale_simple(pixbuf, 15, 15, GDK_INTERP_BILINEAR); | |
3376 g_object_unref(pixbuf); | |
3377 gdk_pixbuf_composite(scale2, scale, 0, 0, 15, 15, 0, 0, 1, 1, GDK_INTERP_BILINEAR, 192); | |
3378 g_object_unref(scale2); | |
3379 } | |
9498 | 3380 return scale; |
3381 } | |
3382 | |
3383 return NULL; | |
3384 } | |
3385 | |
4359 | 3386 static void |
9554 | 3387 add_chat_buddy_common(GaimConversation *conv, const char *name) |
4359 | 3388 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3389 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3390 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3391 GaimConvChat *chat; |
9554 | 3392 GaimConvChatBuddyFlags flags; |
4359 | 3393 GtkTreeIter iter; |
3394 GtkListStore *ls; | |
9498 | 3395 GdkPixbuf *pixbuf; |
4359 | 3396 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3397 chat = GAIM_CONV_CHAT(conv); |
4359 | 3398 gtkconv = GAIM_GTK_CONVERSATION(conv); |
3399 gtkchat = gtkconv->u.chat; | |
3400 | |
3401 ls = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list))); | |
3402 | |
9554 | 3403 flags = gaim_conv_chat_user_get_flags(chat, name); |
3404 pixbuf = get_chat_buddy_status_icon(chat, name, flags); | |
9498 | 3405 |
4359 | 3406 gtk_list_store_append(ls, &iter); |
9498 | 3407 gtk_list_store_set(ls, &iter, CHAT_USERS_ICON_COLUMN, pixbuf, |
9554 | 3408 CHAT_USERS_NAME_COLUMN, name, CHAT_USERS_FLAGS_COLUMN, flags, -1); |
9498 | 3409 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), CHAT_USERS_NAME_COLUMN, |
4359 | 3410 GTK_SORT_ASCENDING); |
9554 | 3411 if (pixbuf) |
3412 g_object_unref(pixbuf); | |
4359 | 3413 } |
3414 | |
9605 | 3415 static gboolean |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3416 tab_complete(GaimConversation *conv) |
4359 | 3417 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3418 GaimGtkConversation *gtkconv; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3419 GaimConvChat *chat; |
4359 | 3420 GtkTextIter cursor, word_start, start_buffer; |
3421 int start; | |
3422 int most_matched = -1; | |
3423 char *entered, *partial = NULL; | |
3424 char *text; | |
8021 | 3425 char *nick_partial; |
9605 | 3426 const char *prefix; |
4359 | 3427 GList *matches = NULL; |
9605 | 3428 GList *list = NULL; |
3429 GList *l = NULL; | |
3430 gboolean command = FALSE; | |
4359 | 3431 |
3432 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3433 | |
3434 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_buffer); | |
3435 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, | |
3436 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
3437 | |
3438 word_start = cursor; | |
3439 | |
3440 /* if there's nothing there just return */ | |
3441 if (!gtk_text_iter_compare(&cursor, &start_buffer)) | |
9605 | 3442 return (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) ? TRUE : FALSE; |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
3443 |
4359 | 3444 text = gtk_text_buffer_get_text(gtkconv->entry_buffer, &start_buffer, |
3445 &cursor, FALSE); | |
3446 | |
3447 /* if we're at the end of ": " we need to move back 2 spaces */ | |
3448 start = strlen(text) - 1; | |
3449 | |
8021 | 3450 if (strlen(text) >= 2 && !strncmp(&text[start-1], ": ", 2)) { |
4359 | 3451 gtk_text_iter_backward_chars(&word_start, 2); |
8021 | 3452 start-=2; |
3453 } | |
4359 | 3454 |
3455 /* find the start of the word that we're tabbing */ | |
3456 while (start >= 0 && text[start] != ' ') { | |
3457 gtk_text_iter_backward_char(&word_start); | |
3458 start--; | |
3459 } | |
3460 | |
9605 | 3461 prefix = gaim_gtk_get_cmd_prefix(); |
3462 if (start == -1 && (strlen(text) >= strlen(prefix)) && !strncmp(text, prefix, strlen(prefix))) { | |
3463 command = TRUE; | |
3464 gtk_text_iter_forward_chars(&word_start, strlen(prefix)); | |
3465 } | |
3466 | |
4359 | 3467 g_free(text); |
3468 | |
3469 entered = gtk_text_buffer_get_text(gtkconv->entry_buffer, &word_start, | |
3470 &cursor, FALSE); | |
3471 | |
8021 | 3472 if (!g_utf8_strlen(entered, -1)) { |
4359 | 3473 g_free(entered); |
9605 | 3474 return (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) ? TRUE : FALSE; |
4359 | 3475 } |
3476 | |
8021 | 3477 nick_partial = g_malloc(strlen(entered)+1); |
3478 | |
9605 | 3479 if (command) { |
3480 list = gaim_cmd_list(conv); | |
3481 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
3482 chat = GAIM_CONV_CHAT(conv); | |
3483 list = gaim_conv_chat_get_users(chat); | |
3484 } else { | |
3485 g_free(nick_partial); | |
3486 g_free(entered); | |
3487 return FALSE; | |
3488 } | |
3489 | |
3490 for (l = list; l; l = l->next) { | |
3491 char *name; | |
3492 | |
3493 if (command) | |
3494 name = l->data; | |
3495 else { | |
3496 GaimConvChatBuddy *cb = l->data; | |
3497 name = cb->name; | |
3498 } | |
3499 | |
3500 strncpy(nick_partial, name, strlen(entered)); | |
8172 | 3501 nick_partial[strlen(entered)] = '\0'; |
8021 | 3502 if(gaim_utf8_strcasecmp(nick_partial, entered)) |
3503 continue; | |
4359 | 3504 |
3505 /* if we're here, it's a possible completion */ | |
3506 | |
3507 if (most_matched == -1) { | |
3508 /* | |
3509 * this will only get called once, since from now | |
3510 * on most_matched is >= 0 | |
3511 */ | |
9605 | 3512 most_matched = strlen(name); |
3513 partial = g_strdup(name); | |
4359 | 3514 } |
3515 else if (most_matched) { | |
9605 | 3516 char *tmp = g_strdup(name); |
8021 | 3517 |
3518 while (gaim_utf8_strcasecmp(tmp, partial)) { | |
3519 partial[most_matched] = '\0'; | |
3520 if(most_matched < strlen(tmp)) | |
3521 tmp[most_matched] = '\0'; | |
4359 | 3522 most_matched--; |
8021 | 3523 } |
8079 | 3524 most_matched++; |
8021 | 3525 |
3526 g_free(tmp); | |
4359 | 3527 } |
3528 | |
9605 | 3529 matches = g_list_append(matches, name); |
4359 | 3530 } |
3531 | |
8021 | 3532 g_free(nick_partial); |
3533 | |
4359 | 3534 /* we're only here if we're doing new style */ |
3535 | |
3536 /* if there weren't any matches, return */ | |
3537 if (!matches) { | |
3538 /* if matches isn't set partials won't be either */ | |
3539 g_free(entered); | |
9605 | 3540 if (command) |
3541 g_list_free(list); | |
3542 return (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) ? TRUE : FALSE; | |
4359 | 3543 } |
3544 | |
3545 gtk_text_buffer_delete(gtkconv->entry_buffer, &word_start, &cursor); | |
3546 | |
3547 if (!matches->next) { | |
3548 /* there was only one match. fill it in. */ | |
3549 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_buffer); | |
3550 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, | |
3551 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
3552 | |
3553 if (!gtk_text_iter_compare(&cursor, &start_buffer)) { | |
3554 char *tmp = g_strdup_printf("%s: ", (char *)matches->data); | |
3555 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, tmp, -1); | |
3556 g_free(tmp); | |
3557 } | |
3558 else | |
3559 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, | |
3560 matches->data, -1); | |
3561 | |
3562 matches = g_list_remove(matches, matches->data); | |
3563 } | |
3564 else { | |
3565 /* | |
3566 * there were lots of matches, fill in as much as possible | |
3567 * and display all of them | |
3568 */ | |
3569 char *addthis = g_malloc0(1); | |
3570 | |
3571 while (matches) { | |
3572 char *tmp = addthis; | |
3573 addthis = g_strconcat(tmp, matches->data, " ", NULL); | |
3574 g_free(tmp); | |
3575 matches = g_list_remove(matches, matches->data); | |
3576 } | |
3577 | |
6982 | 3578 gaim_conversation_write(conv, NULL, addthis, GAIM_MESSAGE_NO_LOG, |
4359 | 3579 time(NULL)); |
3580 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, partial, -1); | |
3581 g_free(addthis); | |
3582 } | |
3583 | |
9605 | 3584 if (command) |
3585 g_list_free(list); | |
4359 | 3586 g_free(entered); |
3587 g_free(partial); | |
9605 | 3588 |
3589 return TRUE; | |
4359 | 3590 } |
3591 | |
3592 static GtkItemFactoryEntry menu_items[] = | |
3593 { | |
3594 /* Conversation menu */ | |
4596 | 3595 { N_("/_Conversation"), NULL, NULL, 0, "<Branch>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3596 |
7887 | 3597 { N_("/Conversation/New Instant _Message..."), "<CTL>M", menu_new_conv_cb, |
7859 | 3598 0, "<StockItem>", GAIM_STOCK_IM }, |
3599 | |
3600 { "/Conversation/sep0", NULL, NULL, 0, "<Separator>" }, | |
3601 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3602 { N_("/Conversation/_Find..."), NULL, menu_find_cb, 0, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3603 "<StockItem>", GTK_STOCK_FIND }, |
7859 | 3604 { N_("/Conversation/View _Log"), NULL, menu_view_log_cb, 0, NULL }, |
4596 | 3605 { N_("/Conversation/_Save As..."), NULL, menu_save_as_cb, 0, |
4359 | 3606 "<StockItem>", GTK_STOCK_SAVE_AS }, |
8974 | 3607 { N_("/Conversation/Clear"), "<CTL>L", menu_clear_cb, 0, "<StockItem>", GTK_STOCK_CLEAR }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3608 |
4359 | 3609 { "/Conversation/sep1", NULL, NULL, 0, "<Separator>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3610 |
9468 | 3611 { N_("/Conversation/Se_nd File..."), NULL, menu_send_file_cb, 0, "<StockItem>", GAIM_STOCK_FILE_TRANSFER }, |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
3612 { N_("/Conversation/Add Buddy _Pounce..."), NULL, menu_add_pounce_cb, |
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
3613 0, NULL }, |
7859 | 3614 { N_("/Conversation/_Get Info"), NULL, menu_get_info_cb, 0, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3615 "<StockItem>", GAIM_STOCK_INFO }, |
7859 | 3616 { N_("/Conversation/_Warn..."), NULL, menu_warn_cb, 0, |
3617 "<StockItem>", GAIM_STOCK_WARN }, | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3618 { N_("/Conversation/In_vite..."), NULL, menu_invite_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3619 "<StockItem>", GAIM_STOCK_INVITE }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3620 |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
3621 { "/Conversation/sep2", NULL, NULL, 0, "<Separator>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3622 |
7859 | 3623 { N_("/Conversation/A_lias..."), NULL, menu_alias_cb, 0, |
3624 "<StockItem>", GAIM_STOCK_EDIT }, | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3625 { N_("/Conversation/_Block..."), NULL, menu_block_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3626 "<StockItem>", GAIM_STOCK_BLOCK }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3627 { N_("/Conversation/_Add..."), NULL, menu_add_remove_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3628 "<StockItem>", GTK_STOCK_ADD }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3629 { N_("/Conversation/_Remove..."), NULL, menu_add_remove_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3630 "<StockItem>", GTK_STOCK_REMOVE }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3631 |
7859 | 3632 { "/Conversation/sep3", NULL, NULL, 0, "<Separator>" }, |
3633 | |
8756 | 3634 { N_("/Conversation/Insert Lin_k..."), NULL, menu_insert_link_cb, 0, |
7859 | 3635 "<StockItem>", GAIM_STOCK_LINK }, |
9287 | 3636 { N_("/Conversation/Insert Imag_e..."), NULL, menu_insert_image_cb, 0, |
7859 | 3637 "<StockItem>", GAIM_STOCK_IMAGE }, |
3638 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3639 { "/Conversation/sep4", NULL, NULL, 0, "<Separator>" }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3640 |
4596 | 3641 { N_("/Conversation/_Close"), NULL, menu_close_conv_cb, 0, |
4359 | 3642 "<StockItem>", GTK_STOCK_CLOSE }, |
3643 | |
3644 /* Options */ | |
4596 | 3645 { N_("/_Options"), NULL, NULL, 0, "<Branch>" }, |
3646 { N_("/Options/Enable _Logging"), NULL, menu_logging_cb, 0, "<CheckItem>" }, | |
3647 { N_("/Options/Enable _Sounds"), NULL, menu_sounds_cb, 0, "<CheckItem>" }, | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3648 { N_("/Options/Show Formatting _Toolbar"), NULL, menu_toolbar_cb, 0, "<CheckItem>" }, |
9188 | 3649 { N_("/Options/Show T_imestamps"), "F2", menu_timestamps_cb, 0, "<CheckItem>" }, |
4359 | 3650 }; |
3651 | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
3652 static const int menu_item_count = |
4359 | 3653 sizeof(menu_items) / sizeof(*menu_items); |
3654 | |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3655 static char * |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3656 item_factory_translate_func (const char *path, gpointer func_data) |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3657 { |
7386 | 3658 return _((char *)path); |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3659 } |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3660 |
4359 | 3661 static GtkWidget * |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3662 setup_menubar(GaimConvWindow *win) |
4359 | 3663 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3664 GaimGtkWindow *gtkwin; |
5116 | 3665 GtkAccelGroup *accel_group; |
4359 | 3666 gtkwin = GAIM_GTK_WINDOW(win); |
3667 | |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
3668 accel_group = gtk_accel_group_new (); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
3669 gtk_window_add_accel_group (GTK_WINDOW (gtkwin->window), accel_group); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
3670 g_object_unref (accel_group); |
5116 | 3671 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3672 gtkwin->menu.item_factory = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3673 gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<main>", accel_group); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3674 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3675 gtk_item_factory_set_translate_func(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3676 item_factory_translate_func, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3677 NULL, NULL); |
4630 | 3678 |
3679 gtk_item_factory_create_items(gtkwin->menu.item_factory, menu_item_count, | |
4359 | 3680 menu_items, win); |
7420 | 3681 g_signal_connect(G_OBJECT(accel_group), "accel-changed", |
3682 G_CALLBACK(gaim_gtk_save_accels_cb), NULL); | |
4359 | 3683 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3684 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3685 gtkwin->menu.menubar = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3686 gtk_item_factory_get_widget(gtkwin->menu.item_factory, "<main>"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3687 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3688 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3689 gtkwin->menu.view_log = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3690 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
7295 | 3691 N_("/Conversation/View Log")); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3692 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3693 |
9468 | 3694 gtkwin->menu.send_file = |
3695 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3696 N_("/Conversation/Send File...")); | |
9498 | 3697 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3698 gtkwin->menu.add_pounce = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3699 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3700 N_("/Conversation/Add Buddy Pounce...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3701 |
7879 | 3702 /* --- */ |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3703 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3704 gtkwin->menu.get_info = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3705 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
7859 | 3706 N_("/Conversation/Get Info")); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3707 |
7879 | 3708 gtkwin->menu.warn = |
3709 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3710 N_("/Conversation/Warn...")); | |
3711 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3712 gtkwin->menu.invite = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3713 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3714 N_("/Conversation/Invite...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3715 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3716 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3717 |
7879 | 3718 gtkwin->menu.alias = |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3719 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
7879 | 3720 N_("/Conversation/Alias...")); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3721 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3722 gtkwin->menu.block = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3723 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3724 N_("/Conversation/Block...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3725 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3726 gtkwin->menu.add = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3727 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3728 N_("/Conversation/Add...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3729 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3730 gtkwin->menu.remove = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3731 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3732 N_("/Conversation/Remove...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3733 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3734 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3735 |
7879 | 3736 gtkwin->menu.insert_link = |
3737 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3738 N_("/Conversation/Insert Link...")); | |
3739 | |
3740 gtkwin->menu.insert_image = | |
3741 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3742 N_("/Conversation/Insert Image...")); | |
3743 | |
3744 /* --- */ | |
3745 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3746 gtkwin->menu.logging = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3747 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3748 N_("/Options/Enable Logging")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3749 gtkwin->menu.sounds = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3750 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3751 N_("/Options/Enable Sounds")); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3752 gtkwin->menu.show_formatting_toolbar = |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3753 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3754 N_("/Options/Show Formatting Toolbar")); |
9188 | 3755 gtkwin->menu.show_timestamps = |
3756 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3757 N_("/Options/Show Timestamps")); | |
4359 | 3758 |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3759 generate_send_as_items(win, NULL); |
4359 | 3760 |
3761 gtk_widget_show(gtkwin->menu.menubar); | |
4931 | 3762 |
3763 return gtkwin->menu.menubar; | |
4359 | 3764 } |
3765 | |
9759 | 3766 GtkWidget * |
3767 gaim_gtkconv_button_new(const char *icon, const char *text, const char *tooltip, GtkTooltips *tooltips, void *callback, void *data) | |
9749 | 3768 { |
3769 GtkWidget *button; | |
3770 int buttons; | |
3771 | |
3772 buttons = gaim_prefs_get_int("/gaim/gtk/conversations/button_type"); | |
3773 button = gaim_pixbuf_button_from_stock( | |
3774 (buttons == GAIM_BUTTON_IMAGE ? NULL : text), | |
3775 (buttons == GAIM_BUTTON_TEXT ? NULL : icon), | |
9750 | 3776 GAIM_BUTTON_VERTICAL); |
9766 | 3777 if (tooltip != NULL) |
3778 gtk_tooltips_set_tip(tooltips, button, tooltip, NULL); | |
9749 | 3779 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); |
9766 | 3780 if (callback != NULL) |
3781 g_signal_connect(G_OBJECT(button), "clicked", | |
3782 G_CALLBACK(callback), data); | |
9749 | 3783 |
3784 return button; | |
3785 } | |
3786 | |
4359 | 3787 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3788 setup_im_buttons(GaimConversation *conv, GtkWidget *parent) |
4359 | 3789 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3790 GaimConnection *gc; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3791 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3792 GaimGtkImPane *gtkim; |
8811 | 3793 GaimButtonStyle button_type; |
9749 | 3794 GList *children; |
4359 | 3795 |
3796 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3797 gtkim = gtkconv->u.im; | |
3798 gc = gaim_conversation_get_gc(conv); | |
3799 | |
9749 | 3800 /* Remove anything else in our parent */ |
3801 children = gtk_container_get_children(GTK_CONTAINER(parent)); | |
3802 while (children != NULL) { | |
9885 | 3803 if(children->data != gtkim->icon_container) |
3804 gtk_container_remove(GTK_CONTAINER(parent), children->data); | |
9749 | 3805 children = g_list_remove(children, children->data); |
3806 } | |
3807 | |
9750 | 3808 /* The buttons, from left to right */ |
9749 | 3809 |
3810 /* Block button */ | |
9759 | 3811 gtkim->block = gaim_gtkconv_button_new(GAIM_STOCK_BLOCK, _("Block"), |
9749 | 3812 _("Block the user"), |
3813 gtkconv->tooltips, block_cb, conv); | |
9750 | 3814 gtk_box_pack_start(GTK_BOX(parent), gtkim->block, TRUE, TRUE, 0); |
9749 | 3815 gtk_size_group_add_widget(gtkconv->sg, gtkim->block); |
3816 | |
3817 /* Send File button */ | |
9759 | 3818 gtkim->send_file = gaim_gtkconv_button_new(GAIM_STOCK_FILE_TRANSFER, _("Send File"), |
9749 | 3819 _("Send a file to the user"), |
3820 gtkconv->tooltips, send_file_cb, conv); | |
9750 | 3821 gtk_box_pack_start(GTK_BOX(parent), gtkim->send_file, TRUE, TRUE, 0); |
9749 | 3822 gtk_size_group_add_widget(gtkconv->sg, gtkim->send_file); |
3823 | |
3824 /* Add button */ | |
9759 | 3825 gtkconv->add = gaim_gtkconv_button_new(GTK_STOCK_ADD, _("Add"), |
9749 | 3826 _("Add the user to your buddy list"), |
3827 gtkconv->tooltips, add_remove_cb, conv); | |
9750 | 3828 gtk_box_pack_start(GTK_BOX(parent), gtkconv->add, TRUE, TRUE, 0); |
9749 | 3829 gtk_size_group_add_widget(gtkconv->sg, gtkconv->add); |
3830 | |
3831 /* Remove button */ | |
9759 | 3832 gtkconv->remove = gaim_gtkconv_button_new(GTK_STOCK_REMOVE, _("Remove"), |
9749 | 3833 _("Remove the user from your buddy list"), |
3834 gtkconv->tooltips, add_remove_cb, conv); | |
9750 | 3835 gtk_box_pack_start(GTK_BOX(parent), gtkconv->remove, TRUE, TRUE, 0); |
9749 | 3836 gtk_size_group_add_widget(gtkconv->sg, gtkconv->remove); |
3837 | |
3838 /* Info button */ | |
9759 | 3839 gtkconv->info = gaim_gtkconv_button_new(GAIM_STOCK_INFO, _("Info"), |
9749 | 3840 _("Get the user's information"), |
3841 gtkconv->tooltips, info_cb, conv); | |
9750 | 3842 gtk_box_pack_start(GTK_BOX(parent), gtkconv->info, TRUE, TRUE, 0); |
9749 | 3843 gtk_size_group_add_widget(gtkconv->sg, gtkconv->info); |
4359 | 3844 |
3845 /* Send button */ | |
9759 | 3846 gtkconv->send = gaim_gtkconv_button_new(GAIM_STOCK_SEND, _("Send"), |
9749 | 3847 _("Send message"), |
3848 gtkconv->tooltips, send_cb, conv); | |
4359 | 3849 gtk_box_pack_end(GTK_BOX(parent), gtkconv->send, FALSE, FALSE, 0); |
3850 | |
3851 /* Separator */ | |
3852 gtkim->sep2 = gtk_vseparator_new(); | |
3853 gtk_box_pack_end(GTK_BOX(parent), gtkim->sep2, FALSE, TRUE, 0); | |
3854 gtk_widget_show(gtkim->sep2); | |
3855 | |
3856 gaim_gtkconv_update_buttons_by_protocol(conv); | |
3857 | |
8811 | 3858 /* Check if the buttons should be visible or not */ |
9150 | 3859 button_type = gaim_prefs_get_int("/gaim/gtk/conversations/button_type"); |
8811 | 3860 if (button_type == GAIM_BUTTON_NONE) |
9749 | 3861 gtk_widget_hide(parent); |
8811 | 3862 else |
9749 | 3863 gtk_widget_show(parent); |
4359 | 3864 } |
3865 | |
3866 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3867 setup_chat_buttons(GaimConversation *conv, GtkWidget *parent) |
4359 | 3868 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3869 GaimConnection *gc; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3870 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3871 GaimGtkChatPane *gtkchat; |
8811 | 3872 GaimButtonStyle button_type; |
9750 | 3873 GList *children; |
4359 | 3874 |
3875 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3876 gtkchat = gtkconv->u.chat; | |
3877 gc = gaim_conversation_get_gc(conv); | |
3878 | |
9750 | 3879 /* Remove anything else in our parent */ |
3880 children = gtk_container_get_children(GTK_CONTAINER(parent)); | |
3881 while (children != NULL) { | |
3882 gtk_container_remove(GTK_CONTAINER(parent), children->data); | |
3883 children = g_list_remove(children, children->data); | |
3884 } | |
3885 | |
3886 /* The buttons, from left to right */ | |
3887 | |
3888 /* Invite */ | |
9759 | 3889 gtkchat->invite = gaim_gtkconv_button_new(GAIM_STOCK_INVITE, _("Invite"), |
9817 | 3890 _("Invite a user"), |
9750 | 3891 gtkconv->tooltips, invite_cb, conv); |
3892 gtk_box_pack_start(GTK_BOX(parent), gtkchat->invite, TRUE, TRUE, 0); | |
3893 gtk_size_group_add_widget(gtkconv->sg, gtkchat->invite); | |
3894 | |
3895 /* Add button */ | |
9759 | 3896 gtkconv->add = gaim_gtkconv_button_new(GTK_STOCK_ADD, _("Add"), |
9750 | 3897 _("Add the chat to your buddy list"), |
3898 gtkconv->tooltips, add_remove_cb, conv); | |
3899 gtk_box_pack_start(GTK_BOX(parent), gtkconv->add, TRUE, TRUE, 0); | |
3900 gtk_size_group_add_widget(gtkconv->sg, gtkconv->add); | |
3901 | |
3902 /* Remove button */ | |
9759 | 3903 gtkconv->remove = gaim_gtkconv_button_new(GTK_STOCK_REMOVE, _("Remove"), |
9750 | 3904 _("Remove the chat from your buddy list"), |
3905 gtkconv->tooltips, add_remove_cb, conv); | |
3906 gtk_box_pack_start(GTK_BOX(parent), gtkconv->remove, TRUE, TRUE, 0); | |
3907 gtk_size_group_add_widget(gtkconv->sg, gtkconv->remove); | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3908 |
4359 | 3909 /* Send button */ |
9759 | 3910 gtkconv->send = gaim_gtkconv_button_new(GAIM_STOCK_SEND, _("Send"), |
9750 | 3911 _("Send message"), |
3912 gtkconv->tooltips, send_cb, conv); | |
4359 | 3913 gtk_box_pack_end(GTK_BOX(parent), gtkconv->send, FALSE, FALSE, 0); |
9750 | 3914 gtk_size_group_add_widget(gtkconv->sg, gtkconv->send); |
4359 | 3915 |
3916 /* Separator */ | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3917 gtkchat->sep = gtk_vseparator_new(); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3918 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
|
3919 gtk_widget_show(gtkchat->sep); |
4359 | 3920 |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3921 gaim_gtkconv_update_buttons_by_protocol(conv); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3922 |
8811 | 3923 /* Check if the buttons should be visible or not */ |
9150 | 3924 button_type = gaim_prefs_get_int("/gaim/gtk/conversations/button_type"); |
8811 | 3925 if (button_type == GAIM_BUTTON_NONE) |
3926 gtk_widget_hide(gtkconv->bbox); | |
3927 else | |
3928 gtk_widget_show(gtkconv->bbox); | |
4359 | 3929 } |
3930 | |
3931 | |
7971 | 3932 static void topic_callback(GtkWidget *w, GaimConversation *conv) |
3933 { | |
3934 GaimPluginProtocolInfo *prpl_info = NULL; | |
3935 GaimConnection *gc; | |
3936 GaimGtkConversation *gtkconv; | |
3937 GaimGtkChatPane *gtkchat; | |
8858 | 3938 const char *new_topic; |
3939 const char *current_topic; | |
7971 | 3940 |
3941 gc = gaim_conversation_get_gc(conv); | |
3942 | |
3943 if(!gc || !(prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl))) | |
3944 return; | |
3945 | |
3946 if(prpl_info->set_chat_topic == NULL) | |
3947 return; | |
3948 | |
3949 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3950 gtkchat = gtkconv->u.chat; | |
8858 | 3951 new_topic = gtk_entry_get_text(GTK_ENTRY(gtkchat->topic_text)); |
3952 current_topic = gaim_conv_chat_get_topic(GAIM_CONV_CHAT(conv)); | |
3953 | |
3954 if(current_topic && !g_utf8_collate(new_topic, current_topic)) | |
7971 | 3955 return; |
3956 | |
8858 | 3957 prpl_info->set_chat_topic(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), |
3958 new_topic); | |
7971 | 3959 } |
3960 | |
9554 | 3961 static gint |
3962 sort_chat_users(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer userdata) | |
3963 { | |
3964 GaimConvChatBuddyFlags f1 = 0, f2 = 0; | |
3965 char *user1 = NULL, *user2 = NULL; | |
3966 gint ret = 0; | |
3967 | |
3968 gtk_tree_model_get(model, a, CHAT_USERS_NAME_COLUMN, &user1, CHAT_USERS_FLAGS_COLUMN, &f1, -1); | |
3969 gtk_tree_model_get(model, b, CHAT_USERS_NAME_COLUMN, &user2, CHAT_USERS_FLAGS_COLUMN, &f2, -1); | |
3970 | |
3971 if (user1 == NULL || user2 == NULL) { | |
3972 if (!(user1 == NULL && user2 == NULL)) | |
3973 ret = (user1 == NULL) ? -1: 1; | |
3974 } else if (f1 != f2) { | |
3975 /* sort more important users first */ | |
3976 ret = (f1 > f2) ? -1 : 1; | |
3977 } else { | |
3978 ret = g_utf8_collate(user1, user2); | |
3979 } | |
3980 | |
3981 g_free(user1); | |
3982 g_free(user2); | |
3983 | |
3984 return ret; | |
3985 } | |
3986 | |
4359 | 3987 static GtkWidget * |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3988 setup_chat_pane(GaimConversation *conv) |
4359 | 3989 { |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3990 GaimPluginProtocolInfo *prpl_info = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3991 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3992 GaimGtkChatPane *gtkchat; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3993 GaimConnection *gc; |
4359 | 3994 GtkWidget *vpaned, *hpaned; |
3995 GtkWidget *vbox, *hbox; | |
3996 GtkWidget *lbox, *bbox; | |
3997 GtkWidget *label; | |
3998 GtkWidget *list; | |
3999 GtkWidget *button; | |
7949 | 4000 GtkWidget *sw; |
4359 | 4001 GtkListStore *ls; |
4002 GtkCellRenderer *rend; | |
4003 GtkTreeViewColumn *col; | |
9080 | 4004 GList *focus_chain = NULL; |
4359 | 4005 |
4006 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4007 gtkchat = gtkconv->u.chat; | |
4008 gc = gaim_conversation_get_gc(conv); | |
4009 | |
4010 /* Setup the outer pane. */ | |
4011 vpaned = gtk_vpaned_new(); | |
4012 gtk_widget_show(vpaned); | |
4013 | |
4014 /* Setup the top part of the pane. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4015 vbox = gtk_vbox_new(FALSE, 6); |
8914 | 4016 gtk_paned_pack1(GTK_PANED(vpaned), vbox, TRUE, TRUE); |
4359 | 4017 gtk_widget_show(vbox); |
4018 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4019 if (gc != NULL) |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4020 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4021 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4022 if (prpl_info->options & OPT_PROTO_CHAT_TOPIC) |
4359 | 4023 { |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4024 hbox = gtk_hbox_new(FALSE, 6); |
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4025 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
4359 | 4026 gtk_widget_show(hbox); |
4027 | |
4028 label = gtk_label_new(_("Topic:")); | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4029 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
4359 | 4030 gtk_widget_show(label); |
4031 | |
4032 gtkchat->topic_text = gtk_entry_new(); | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4033 |
7971 | 4034 if(prpl_info->set_chat_topic == NULL) { |
4035 gtk_editable_set_editable(GTK_EDITABLE(gtkchat->topic_text), FALSE); | |
4036 } else { | |
4037 g_signal_connect(GTK_OBJECT(gtkchat->topic_text), "activate", | |
4038 G_CALLBACK(topic_callback), conv); | |
4039 } | |
4040 | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4041 gtk_box_pack_start(GTK_BOX(hbox), gtkchat->topic_text, TRUE, TRUE, 0); |
4359 | 4042 gtk_widget_show(gtkchat->topic_text); |
4043 } | |
4044 | |
4045 /* Setup the horizontal pane. */ | |
4046 hpaned = gtk_hpaned_new(); | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4047 gtk_box_pack_start(GTK_BOX(vbox), hpaned, TRUE, TRUE, 0); |
4359 | 4048 gtk_widget_show(hpaned); |
4049 | |
4050 /* Setup the scrolled window to put gtkimhtml in. */ | |
4051 gtkconv->sw = gtk_scrolled_window_new(NULL, NULL); | |
4052 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
8076 | 4053 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
4359 | 4054 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(gtkconv->sw), |
4055 GTK_SHADOW_IN); | |
4056 gtk_paned_pack1(GTK_PANED(hpaned), gtkconv->sw, TRUE, TRUE); | |
4057 | |
4058 gtk_widget_set_size_request(gtkconv->sw, | |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
4059 gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_width"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
4060 gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_height")); |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
4061 |
8914 | 4062 g_signal_connect(G_OBJECT(gtkconv->sw), "size-allocate", |
4063 G_CALLBACK(size_allocate_cb), conv); | |
4064 | |
4359 | 4065 gtk_widget_show(gtkconv->sw); |
4066 | |
4067 /* Setup gtkihmtml. */ | |
4068 gtkconv->imhtml = gtk_imhtml_new(NULL, NULL); | |
9005 | 4069 gtk_widget_set_name(gtkconv->imhtml, "gaim_gtkconv_imhtml"); |
4359 | 4070 gtk_container_add(GTK_CONTAINER(gtkconv->sw), gtkconv->imhtml); |
4071 | |
4072 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4073 gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); |
4359 | 4074 |
4075 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", | |
4076 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
8105 | 4077 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_press_event", |
6057 | 4078 G_CALLBACK(refocus_entry_cb), gtkconv); |
8109 | 4079 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_release_event", |
4080 G_CALLBACK(refocus_entry_cb), gtkconv); | |
4359 | 4081 |
4082 gaim_setup_imhtml(gtkconv->imhtml); | |
4083 gtk_widget_show(gtkconv->imhtml); | |
4084 | |
4085 /* Build the right pane. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4086 lbox = gtk_vbox_new(FALSE, 6); |
4409
0521eec12c33
[gaim-migrate @ 4682]
Christian Hammond <chipx86@chipx86.com>
parents:
4398
diff
changeset
|
4087 gtk_paned_pack2(GTK_PANED(hpaned), lbox, FALSE, TRUE); |
4359 | 4088 gtk_widget_show(lbox); |
4089 | |
4090 /* Setup the label telling how many people are in the room. */ | |
4091 gtkchat->count = gtk_label_new(_("0 people in room")); | |
4092 gtk_box_pack_start(GTK_BOX(lbox), gtkchat->count, FALSE, FALSE, 0); | |
4093 gtk_widget_show(gtkchat->count); | |
4094 | |
4095 /* Setup the list of users. */ | |
7949 | 4096 sw = gtk_scrolled_window_new(NULL, NULL); |
4097 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
8076 | 4098 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
7949 | 4099 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); |
4100 gtk_box_pack_start(GTK_BOX(lbox), sw, TRUE, TRUE, 0); | |
4101 gtk_widget_show(sw); | |
4359 | 4102 |
9554 | 4103 ls = gtk_list_store_new(CHAT_USERS_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING, |
4104 G_TYPE_INT); | |
4105 gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(ls), CHAT_USERS_NAME_COLUMN, | |
4106 sort_chat_users, NULL, NULL); | |
9498 | 4107 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), CHAT_USERS_NAME_COLUMN, |
4359 | 4108 GTK_SORT_ASCENDING); |
4109 | |
4110 list = gtk_tree_view_new_with_model(GTK_TREE_MODEL(ls)); | |
4111 | |
9498 | 4112 rend = gtk_cell_renderer_pixbuf_new(); |
4113 | |
4359 | 4114 col = gtk_tree_view_column_new_with_attributes(NULL, rend, |
9498 | 4115 "pixbuf", CHAT_USERS_ICON_COLUMN, NULL); |
9554 | 4116 gtk_tree_view_column_set_clickable(GTK_TREE_VIEW_COLUMN(col), TRUE); |
4117 | |
9498 | 4118 gtk_tree_view_append_column(GTK_TREE_VIEW(list), col); |
4359 | 4119 |
4120 g_signal_connect(G_OBJECT(list), "button_press_event", | |
4121 G_CALLBACK(right_click_chat_cb), conv); | |
8143 | 4122 g_signal_connect(G_OBJECT(list), "popup-menu", |
4123 G_CALLBACK(gtkconv_chat_popup_menu_cb), conv); | |
4359 | 4124 |
9498 | 4125 rend = gtk_cell_renderer_text_new(); |
4126 | |
4359 | 4127 col = gtk_tree_view_column_new_with_attributes(NULL, rend, |
9498 | 4128 "text", CHAT_USERS_NAME_COLUMN, NULL); |
4359 | 4129 gtk_tree_view_column_set_clickable(GTK_TREE_VIEW_COLUMN(col), TRUE); |
4130 | |
4131 gtk_tree_view_append_column(GTK_TREE_VIEW(list), col); | |
4132 | |
4133 gtk_widget_set_size_request(list, 150, -1); | |
4134 | |
4135 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(list), FALSE); | |
4136 gtk_widget_show(list); | |
4137 | |
4138 gtkchat->list = list; | |
4139 | |
7949 | 4140 gtk_container_add(GTK_CONTAINER(sw), list); |
4359 | 4141 |
4142 /* Setup the user list toolbar. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4143 bbox = gtk_hbox_new(TRUE, 6); |
4359 | 4144 gtk_box_pack_start(GTK_BOX(lbox), bbox, FALSE, FALSE, 0); |
4145 gtk_widget_show(bbox); | |
4146 | |
4147 /* IM */ | |
4148 button = gaim_pixbuf_button_from_stock(NULL, GTK_STOCK_REDO, | |
4149 GAIM_BUTTON_VERTICAL); | |
4150 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
4151 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
|
4152 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("IM the user"), NULL); |
4359 | 4153 g_signal_connect(G_OBJECT(button), "clicked", |
7961 | 4154 G_CALLBACK(chat_im_button_cb), conv); |
4359 | 4155 |
4156 gtk_widget_show(button); | |
4157 | |
4158 /* Ignore */ | |
4159 button = gaim_pixbuf_button_from_stock(NULL, GAIM_STOCK_IGNORE, | |
4160 GAIM_BUTTON_VERTICAL); | |
4161 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
4162 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
|
4163 gtk_tooltips_set_tip(gtkconv->tooltips, button, |
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
4164 _("Ignore the user"), NULL); |
4359 | 4165 g_signal_connect(G_OBJECT(button), "clicked", |
4166 G_CALLBACK(ignore_cb), conv); | |
4167 gtk_widget_show(button); | |
4168 | |
4169 /* Info */ | |
4170 button = gaim_pixbuf_button_from_stock(NULL, GAIM_STOCK_INFO, | |
4171 GAIM_BUTTON_VERTICAL); | |
4172 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
4173 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
4174 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
4175 _("Get the user's information"), NULL); |
4359 | 4176 g_signal_connect(G_OBJECT(button), "clicked", |
4177 G_CALLBACK(info_cb), conv); | |
4178 | |
4179 gtk_widget_show(button); | |
4180 | |
4181 gtkconv->info = button; | |
4182 | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4183 /* Build the toolbar. */ |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4184 vbox = gtk_vbox_new(FALSE, 6); |
8914 | 4185 gtk_paned_pack2(GTK_PANED(vpaned), vbox, FALSE, TRUE); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4186 gtk_widget_show(vbox); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4187 |
8317 | 4188 gtkconv->toolbar = gtk_imhtmltoolbar_new(); |
4189 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
|
4190 |
9332 | 4191 gtkconv->lower_hbox = gtk_hbox_new(FALSE, 6); |
4192 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->lower_hbox, TRUE, TRUE, 0); | |
4193 gtk_widget_show(gtkconv->lower_hbox); | |
4194 | |
4195 vbox = gtk_vbox_new(FALSE, 6); | |
4196 gtk_box_pack_end(GTK_BOX(gtkconv->lower_hbox), vbox, TRUE, TRUE, 0); | |
4197 gtk_widget_show(vbox); | |
4198 | |
8123 | 4199 /* Setup the entry widget. |
4200 * We never show the horizontal scrollbar because it was causing weird | |
4201 * lockups when typing text just as you type the character that would | |
4202 * cause both scrollbars to appear. Definitely seems like a gtk bug. | |
4203 */ | |
7949 | 4204 sw = gtk_scrolled_window_new(NULL, NULL); |
4205 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
8112 | 4206 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); |
8061 | 4207 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), |
4208 GTK_SHADOW_IN); | |
9332 | 4209 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); |
7949 | 4210 gtk_widget_show(sw); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4211 |
8061 | 4212 gtkconv->entry = gtk_imhtml_new(NULL, NULL); |
9005 | 4213 gtk_widget_set_name(gtkconv->entry, "gaim_gtkconv_entry"); |
8456 | 4214 gtk_imhtml_smiley_shortcuts(GTK_IMHTML(gtkconv->entry), |
4215 gaim_prefs_get_bool("/gaim/gtk/conversations/smiley_shortcuts")); | |
4216 gtk_imhtml_html_shortcuts(GTK_IMHTML(gtkconv->entry), | |
4217 gaim_prefs_get_bool("/gaim/gtk/conversations/html_shortcuts")); | |
4218 | |
4219 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), | |
9699 | 4220 gaim_account_get_protocol_name(conv->account)); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4221 gtkconv->entry_buffer = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4222 gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); |
8061 | 4223 gaim_setup_imhtml(gtkconv->entry); |
4224 gtk_imhtml_set_editable(GTK_IMHTML(gtkconv->entry), TRUE); | |
4225 default_formatize(conv); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4226 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(gtkconv->entry), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4227 GTK_WRAP_WORD_CHAR); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4228 gtk_widget_set_size_request(gtkconv->entry, -1, |
8106 | 4229 gaim_prefs_get_int("/gaim/gtk/conversations/chat/entry_height")); |
7949 | 4230 g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", conv); |
4231 | |
4232 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", | |
8105 | 4233 G_CALLBACK(entry_key_press_cb), conv); |
4359 | 4234 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", |
4235 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
8914 | 4236 g_signal_connect(G_OBJECT(gtkconv->entry), "size-allocate", |
4237 G_CALLBACK(size_allocate_cb), conv); | |
4359 | 4238 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4239 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
4240 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4241 gtk_imhtmltoolbar_attach(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4242 gtkconv->entry); |
4359 | 4243 |
7949 | 4244 gtk_container_add(GTK_CONTAINER(sw), GTK_WIDGET(gtkconv->entry)); |
4359 | 4245 gtk_widget_show(gtkconv->entry); |
4246 | |
4247 /* Setup the bottom button box. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4248 gtkconv->bbox = gtk_hbox_new(FALSE, 6); |
4359 | 4249 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->bbox, FALSE, FALSE, 0); |
4250 setup_chat_buttons(conv, gtkconv->bbox); | |
4251 | |
9080 | 4252 /* |
4253 * Focus for chat windows should be as follows: | |
4254 * Tab title -> chat topic -> conversation scrollback -> user list -> | |
4255 * user list buttons -> entry -> buttons at bottom | |
4256 */ | |
4257 focus_chain = g_list_prepend(focus_chain, gtkconv->bbox); | |
9332 | 4258 focus_chain = g_list_prepend(focus_chain, gtkconv->entry); |
9080 | 4259 gtk_container_set_focus_chain(GTK_CONTAINER(vbox), focus_chain); |
4260 | |
4359 | 4261 return vpaned; |
4262 } | |
4263 | |
4264 static GtkWidget * | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4265 setup_im_pane(GaimConversation *conv) |
4359 | 4266 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4267 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4268 GaimGtkImPane *gtkim; |
4359 | 4269 GtkWidget *paned; |
4270 GtkWidget *vbox; | |
4271 GtkWidget *vbox2; | |
7949 | 4272 GtkWidget *sw; |
9080 | 4273 GList *focus_chain = NULL; |
4359 | 4274 |
4275 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4276 gtkim = gtkconv->u.im; | |
4277 | |
4278 /* Setup the outer pane. */ | |
4279 paned = gtk_vpaned_new(); | |
4280 gtk_widget_show(paned); | |
4281 | |
4282 /* Setup the top part of the pane. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4283 vbox = gtk_vbox_new(FALSE, 6); |
4409
0521eec12c33
[gaim-migrate @ 4682]
Christian Hammond <chipx86@chipx86.com>
parents:
4398
diff
changeset
|
4284 gtk_paned_pack1(GTK_PANED(paned), vbox, TRUE, TRUE); |
4359 | 4285 gtk_widget_show(vbox); |
4286 | |
4287 /* Setup the gtkimhtml widget. */ | |
4288 gtkconv->sw = gtk_scrolled_window_new(NULL, NULL); | |
4289 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
8076 | 4290 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
4359 | 4291 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(gtkconv->sw), |
4292 GTK_SHADOW_IN); | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4293 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->sw, TRUE, TRUE, 0); |
4851 | 4294 |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
4295 gtk_widget_set_size_request(gtkconv->sw, |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
4296 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_width"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
4297 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_height")); |
8914 | 4298 g_signal_connect(G_OBJECT(gtkconv->sw), "size-allocate", |
4299 G_CALLBACK(size_allocate_cb), conv); | |
4359 | 4300 gtk_widget_show(gtkconv->sw); |
4301 | |
4302 gtkconv->imhtml = gtk_imhtml_new(NULL, NULL); | |
9005 | 4303 gtk_widget_set_name(gtkconv->imhtml, "gaim_gtkconv_imhtml"); |
4359 | 4304 gtk_container_add(GTK_CONTAINER(gtkconv->sw), gtkconv->imhtml); |
4305 | |
4306 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", | |
4307 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
8105 | 4308 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_press_event", |
6057 | 4309 G_CALLBACK(refocus_entry_cb), gtkconv); |
8109 | 4310 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_release_event", |
4311 G_CALLBACK(refocus_entry_cb), gtkconv); | |
4359 | 4312 |
4313 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4314 gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); |
4359 | 4315 gaim_setup_imhtml(gtkconv->imhtml); |
4316 gtk_widget_show(gtkconv->imhtml); | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4317 vbox2 = gtk_vbox_new(FALSE, 6); |
8914 | 4318 gtk_paned_pack2(GTK_PANED(paned), vbox2, FALSE, TRUE); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4319 gtk_widget_show(vbox2); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4320 |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4321 /* Build the toolbar. */ |
8317 | 4322 gtkconv->toolbar = gtk_imhtmltoolbar_new(); |
4323 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
|
4324 |
8123 | 4325 /* Setup the entry widget. |
4326 * 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
|
4327 * lockups when typing text just as you type the character that would |
8123 | 4328 * cause both scrollbars to appear. Definitely seems like a gtk bug. |
4329 */ | |
9332 | 4330 gtkconv->lower_hbox = gtk_hbox_new(FALSE, 6); |
4331 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->lower_hbox, TRUE, TRUE, 0); | |
4332 gtk_widget_show(gtkconv->lower_hbox); | |
4333 | |
4334 vbox2 = gtk_vbox_new(FALSE, 6); | |
4335 gtk_box_pack_end(GTK_BOX(gtkconv->lower_hbox), vbox2, TRUE, TRUE, 0); | |
4336 gtk_widget_show(vbox2); | |
8821 | 4337 |
7949 | 4338 sw = gtk_scrolled_window_new(NULL, NULL); |
4339 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
8112 | 4340 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); |
8061 | 4341 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), |
4342 GTK_SHADOW_IN); | |
9332 | 4343 gtk_box_pack_start(GTK_BOX(vbox2), sw, TRUE, TRUE, 0); |
7949 | 4344 gtk_widget_show(sw); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4345 |
8061 | 4346 gtkconv->entry = gtk_imhtml_new(NULL, NULL); |
9005 | 4347 gtk_widget_set_name(gtkconv->entry, "gaim_gtkconv_entry"); |
8456 | 4348 |
4349 gtk_imhtml_smiley_shortcuts(GTK_IMHTML(gtkconv->entry), | |
4350 gaim_prefs_get_bool("/gaim/gtk/conversations/smiley_shortcuts")); | |
4351 gtk_imhtml_html_shortcuts(GTK_IMHTML(gtkconv->entry), | |
4352 gaim_prefs_get_bool("/gaim/gtk/conversations/html_shortcuts")); | |
4353 | |
4354 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), | |
9699 | 4355 gaim_account_get_protocol_name(conv->account)); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4356 gtkconv->entry_buffer = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4357 gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); |
8061 | 4358 gaim_setup_imhtml(gtkconv->entry); |
4359 gtk_imhtml_set_editable(GTK_IMHTML(gtkconv->entry), TRUE); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4360 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(gtkconv->entry), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4361 GTK_WRAP_WORD_CHAR); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4362 gtk_widget_set_size_request(gtkconv->entry, -1, |
8106 | 4363 gaim_prefs_get_int("/gaim/gtk/conversations/im/entry_height")); |
7949 | 4364 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
|
4365 |
4359 | 4366 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", |
8105 | 4367 G_CALLBACK(entry_key_press_cb), conv); |
4359 | 4368 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", |
4369 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
8914 | 4370 g_signal_connect(G_OBJECT(gtkconv->entry), "size-allocate", |
4371 G_CALLBACK(size_allocate_cb), conv); | |
4359 | 4372 |
4373 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "insert_text", | |
4374 G_CALLBACK(insert_text_cb), conv); | |
4375 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "delete_range", | |
4376 G_CALLBACK(delete_text_cb), conv); | |
4377 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4378 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
4379 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
4359 | 4380 |
7949 | 4381 gtk_container_add(GTK_CONTAINER(sw), GTK_WIDGET(gtkconv->entry)); |
4359 | 4382 gtk_widget_show(gtkconv->entry); |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
4383 gtk_imhtmltoolbar_attach(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), |
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
4384 gtkconv->entry); |
8481 | 4385 /* had to move this after the imtoolbar is attached so that the |
4386 * signals get fired to toggle the buttons on the toolbar as well. | |
4387 */ | |
4388 default_formatize(conv); | |
4359 | 4389 |
9749 | 4390 /* Setup the bottom button box. */ |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4391 gtkconv->bbox = gtk_hbox_new(FALSE, 6); |
4359 | 4392 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->bbox, FALSE, FALSE, 0); |
4393 setup_im_buttons(conv, gtkconv->bbox); | |
9749 | 4394 |
8758 | 4395 gtkconv->u.im->animate = gaim_prefs_get_bool("/gaim/gtk/conversations/im/animate_buddy_icons"); |
9687 | 4396 gtkconv->u.im->show_icon = TRUE; |
4359 | 4397 |
9080 | 4398 /* |
4399 * Focus for IM windows should be as follows: | |
4400 * Tab title -> conversation scrollback -> entry -> buttons at bottom | |
4401 */ | |
4402 focus_chain = g_list_prepend(focus_chain, gtkconv->bbox); | |
9332 | 4403 focus_chain = g_list_prepend(focus_chain, gtkconv->entry); |
9080 | 4404 gtk_container_set_focus_chain(GTK_CONTAINER(vbox2), focus_chain); |
8143 | 4405 |
4359 | 4406 return paned; |
4407 } | |
4408 | |
4409 static void | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4410 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
|
4411 GtkSelectionData *sd, guint info, guint t, |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4412 GaimConversation *conv) |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4413 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4414 GaimConvWindow *win = conv->window; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4415 GaimConversation *c; |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4416 if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE)) |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4417 { |
4781 | 4418 GaimBlistNode *n = NULL; |
6695 | 4419 GaimBuddy *b; |
9622 | 4420 unsigned int index; |
4421 | |
4781 | 4422 memcpy(&n, sd->data, sizeof(n)); |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
4423 |
6695 | 4424 if (GAIM_BLIST_NODE_IS_CONTACT(n)) |
4425 b = gaim_contact_get_priority_buddy((GaimContact*)n); | |
4426 else if (GAIM_BLIST_NODE_IS_BUDDY(n)) | |
4427 b = (GaimBuddy*)n; | |
4428 else | |
4781 | 4429 return; |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
4430 |
9622 | 4431 /* |
4432 * If we already have an open conversation with this buddy, then | |
4433 * just move the conv to this window. Otherwise, create a new | |
4434 * conv and add it to this window. | |
4435 */ | |
4436 c = gaim_find_conversation(b->name); | |
4437 if (c != NULL) { | |
4438 GaimConvWindow *oldwin; | |
4439 oldwin = gaim_conversation_get_window(c); | |
4440 index = gaim_conversation_get_index(c); | |
4441 if (oldwin != win) { | |
4442 gaim_conv_window_remove_conversation(oldwin, index); | |
4443 gaim_conv_window_add_conversation(win, c); | |
4444 } | |
4445 } else { | |
4446 c = gaim_conversation_new(GAIM_CONV_IM, b->account, b->name); | |
4447 gaim_conv_window_add_conversation(win, c); | |
4448 } | |
4449 | |
4450 /* Make this conversation the active conversation */ | |
4451 index = gaim_conversation_get_index(c); | |
4452 gaim_conv_window_switch_conversation(win, index); | |
8802
1076cd8579ea
[gaim-migrate @ 9564]
Christian Hammond <chipx86@chipx86.com>
parents:
8758
diff
changeset
|
4453 |
1076cd8579ea
[gaim-migrate @ 9564]
Christian Hammond <chipx86@chipx86.com>
parents:
8758
diff
changeset
|
4454 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); |
4702 | 4455 } |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4456 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
|
4457 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4458 char *protocol = NULL; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4459 char *username = NULL; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4460 GaimAccount *account; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4461 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4462 if (gaim_gtk_parse_x_im_contact(sd->data, FALSE, &account, |
7718 | 4463 &protocol, &username, NULL)) |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4464 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4465 if (account == NULL) |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4466 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4467 gaim_notify_error(NULL, NULL, |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4468 _("You are not currently signed on with an account that " |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4469 "can add that buddy."), NULL); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4470 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4471 else |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4472 { |
7718 | 4473 c = gaim_conversation_new(GAIM_CONV_IM, account, username); |
4474 gaim_conv_window_add_conversation(win, c); | |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4475 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4476 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4477 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4478 if (username != NULL) g_free(username); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4479 if (protocol != NULL) g_free(protocol); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4480 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4481 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4482 } |
9525 | 4483 else if (sd->target == gdk_atom_intern("text/uri-list", FALSE)) { |
9673 | 4484 GList *tmp; |
4485 GList *files = gaim_uri_list_extract_filenames(sd->data); | |
4486 for(tmp = files; tmp != NULL ; tmp = g_list_next(tmp)) { | |
4487 gchar *filename = tmp->data; | |
4488 /* XXX - Make ft API support creating a transfer with more than one file */ | |
4489 if (g_file_test(filename, G_FILE_TEST_EXISTS) | |
4490 && !g_file_test(filename, G_FILE_TEST_IS_DIR) | |
4491 && gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
4492 serv_send_file(gaim_conversation_get_gc(conv), | |
4493 gaim_conversation_get_name(conv), filename); | |
4494 } | |
4495 g_free(filename); | |
9495 | 4496 } |
9673 | 4497 g_list_free(files); |
4498 /* XXX - Attempt to load this file into gdk_pixbuf, or otherwise determine if it is an image. If it is, offer | |
4499 * the choice of a) sending this file b) inserting this file as an IM image or c) setting this file as a custom | |
4500 * buddy icon for this buddy */ | |
9495 | 4501 } |
4502 gtk_drag_finish(dc, FALSE, FALSE, t); | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4503 } |
4359 | 4504 |
4505 /************************************************************************** | |
4506 * GTK+ window ops | |
4507 **************************************************************************/ | |
4508 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4509 gaim_gtk_new_window(GaimConvWindow *win) |
4359 | 4510 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4511 GaimGtkWindow *gtkwin; |
4359 | 4512 GtkPositionType pos; |
4513 GtkWidget *testidea; | |
4514 GtkWidget *menubar; | |
4515 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4516 gtkwin = g_malloc0(sizeof(GaimGtkWindow)); |
4359 | 4517 |
4518 win->ui_data = gtkwin; | |
4519 | |
4520 /* Create the window. */ | |
4521 gtkwin->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
4522 gtk_window_set_role(GTK_WINDOW(gtkwin->window), "conversation"); | |
9614 | 4523 gtk_window_set_resizable(GTK_WINDOW(gtkwin->window), TRUE); |
4510
4c394222c732
[gaim-migrate @ 4786]
Christian Hammond <chipx86@chipx86.com>
parents:
4505
diff
changeset
|
4524 gtk_container_set_border_width(GTK_CONTAINER(gtkwin->window), 0); |
9614 | 4525 GTK_WINDOW(gtkwin->window)->allow_shrink = TRUE; |
4359 | 4526 |
4527 g_signal_connect(G_OBJECT(gtkwin->window), "delete_event", | |
4528 G_CALLBACK(close_win_cb), win); | |
4529 | |
4530 /* Create the notebook. */ | |
4531 gtkwin->notebook = gtk_notebook_new(); | |
4532 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4533 pos = gaim_prefs_get_int("/gaim/gtk/conversations/tab_side"); |
4359 | 4534 |
4535 #if 0 | |
4536 gtk_notebook_set_tab_hborder(GTK_NOTEBOOK(gtkwin->notebook), 0); | |
4537 gtk_notebook_set_tab_vborder(GTK_NOTEBOOK(gtkwin->notebook), 0); | |
4538 #endif | |
4539 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos); | |
4540 gtk_notebook_set_scrollable(GTK_NOTEBOOK(gtkwin->notebook), TRUE); | |
4541 gtk_notebook_popup_enable(GTK_NOTEBOOK(gtkwin->notebook)); | |
4818 | 4542 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), FALSE); |
4543 | |
4359 | 4544 gtk_widget_show(gtkwin->notebook); |
4545 | |
8189 | 4546 g_signal_connect(G_OBJECT(gtkwin->notebook), "switch_page", |
4547 G_CALLBACK(before_switch_conv_cb), win); | |
4359 | 4548 g_signal_connect_after(G_OBJECT(gtkwin->notebook), "switch_page", |
4549 G_CALLBACK(switch_conv_cb), win); | |
4550 | |
4551 /* Setup the tab drag and drop signals. */ | |
4486 | 4552 gtk_widget_add_events(gtkwin->notebook, |
4553 GDK_BUTTON1_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK); | |
4554 g_signal_connect(G_OBJECT(gtkwin->notebook), "button_press_event", | |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4555 G_CALLBACK(notebook_press_cb), win); |
4486 | 4556 g_signal_connect(G_OBJECT(gtkwin->notebook), "button_release_event", |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4557 G_CALLBACK(notebook_release_cb), win); |
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4558 |
4359 | 4559 testidea = gtk_vbox_new(FALSE, 0); |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4560 |
4359 | 4561 /* Setup the menubar. */ |
4562 menubar = setup_menubar(win); | |
4563 gtk_box_pack_start(GTK_BOX(testidea), menubar, FALSE, TRUE, 0); | |
4564 | |
4565 gtk_box_pack_start(GTK_BOX(testidea), gtkwin->notebook, TRUE, TRUE, 0); | |
4566 | |
4567 gtk_container_add(GTK_CONTAINER(gtkwin->window), testidea); | |
4568 | |
4569 gtk_widget_show(testidea); | |
4570 } | |
4571 | |
4572 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4573 gaim_gtk_destroy_window(GaimConvWindow *win) |
4359 | 4574 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4575 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4576 |
4577 gtk_widget_destroy(gtkwin->window); | |
4578 | |
4630 | 4579 g_object_unref(G_OBJECT(gtkwin->menu.item_factory)); |
4580 | |
4359 | 4581 g_free(gtkwin); |
4582 win->ui_data = NULL; | |
4583 } | |
4584 | |
4585 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4586 gaim_gtk_show(GaimConvWindow *win) |
4359 | 4587 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4588 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4589 |
4590 gtk_widget_show(gtkwin->window); | |
4591 } | |
4592 | |
4593 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4594 gaim_gtk_hide(GaimConvWindow *win) |
4359 | 4595 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4596 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4597 |
4598 gtk_widget_hide(gtkwin->window); | |
4599 } | |
4600 | |
4601 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4602 gaim_gtk_raise(GaimConvWindow *win) |
4359 | 4603 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4604 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4605 |
9728 | 4606 gtk_widget_show(gtkwin->window); |
4607 gtk_window_deiconify(GTK_WINDOW(gtkwin->window)); | |
4608 gdk_window_raise(gtkwin->window->window); | |
4359 | 4609 } |
4610 | |
4611 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4612 gaim_gtk_flash(GaimConvWindow *win) |
4359 | 4613 { |
4614 #ifdef _WIN32 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4615 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4616 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4617 wgaim_conv_im_blink(gtkwin->window); |
4359 | 4618 #endif |
4619 } | |
4620 | |
4621 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4622 gaim_gtk_switch_conversation(GaimConvWindow *win, unsigned int index) |
4359 | 4623 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4624 GaimGtkWindow *gtkwin; |
4359 | 4625 |
4626 gtkwin = GAIM_GTK_WINDOW(win); | |
4627 | |
4628 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), index); | |
4629 } | |
4630 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4631 static const GtkTargetEntry te[] = |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4632 { |
9525 | 4633 {"text/uri-list", 0, 0}, |
4634 {"GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, 1}, | |
4635 {"text/plain", 0, 2}, | |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4636 {"STRING", 0, 3}, |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4637 {"application/x-im-contact", 0, 4} |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4638 }; |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4639 |
4359 | 4640 static void |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4641 gaim_gtk_add_conversation(GaimConvWindow *win, GaimConversation *conv) |
4359 | 4642 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4643 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4644 GaimGtkConversation *gtkconv, *focus_gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4645 GaimConversation *focus_conv; |
4359 | 4646 GtkWidget *pane = NULL; |
4647 GtkWidget *tab_cont; | |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4648 GtkWidget *tabby, *menu_tabby; |
4359 | 4649 gboolean new_ui; |
4383
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4650 GaimConversationType conv_type; |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4651 const char *name; |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4652 |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4653 name = gaim_conversation_get_name(conv); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4654 conv_type = gaim_conversation_get_type(conv); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4655 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4656 |
4657 if (conv->ui_data != NULL) { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4658 gtkconv = (GaimGtkConversation *)conv->ui_data; |
4359 | 4659 |
4660 tab_cont = gtkconv->tab_cont; | |
4661 | |
4662 new_ui = FALSE; | |
4663 } | |
4664 else { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4665 gtkconv = g_malloc0(sizeof(GaimGtkConversation)); |
4359 | 4666 conv->ui_data = gtkconv; |
4667 | |
4668 /* Setup some initial variables. */ | |
9749 | 4669 gtkconv->sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); |
4359 | 4670 gtkconv->tooltips = gtk_tooltips_new(); |
4671 | |
7879 | 4672 if (conv_type == GAIM_CONV_IM) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4673 gtkconv->u.im = g_malloc0(sizeof(GaimGtkImPane)); |
4359 | 4674 gtkconv->u.im->a_virgin = TRUE; |
4675 | |
4676 pane = setup_im_pane(conv); | |
4677 } | |
7879 | 4678 else if (conv_type == GAIM_CONV_CHAT) { |
4679 gtkconv->u.chat = g_malloc0(sizeof(GaimGtkChatPane)); | |
4680 | |
4681 pane = setup_chat_pane(conv); | |
4682 } | |
4359 | 4683 |
4684 if (pane == NULL) { | |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4685 if (conv_type == GAIM_CONV_CHAT) g_free(gtkconv->u.chat); |
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4686 else if (conv_type == GAIM_CONV_IM) g_free(gtkconv->u.im); |
4359 | 4687 |
4688 g_free(gtkconv); | |
4689 conv->ui_data = NULL; | |
4690 | |
4691 return; | |
4692 } | |
4693 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4694 /* Setup drag-and-drop */ |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4695 gtk_drag_dest_set(pane, |
9300 | 4696 GTK_DEST_DEFAULT_MOTION | |
4697 GTK_DEST_DEFAULT_DROP, | |
4698 te, sizeof(te) / sizeof(GtkTargetEntry), | |
4699 GDK_ACTION_COPY); | |
4700 gtk_drag_dest_set(pane, | |
4701 GTK_DEST_DEFAULT_MOTION | | |
4702 GTK_DEST_DEFAULT_DROP, | |
4703 te, sizeof(te) / sizeof(GtkTargetEntry), | |
4704 GDK_ACTION_COPY); | |
4705 gtk_drag_dest_set(gtkconv->imhtml, 0, | |
4706 te, sizeof(te) / sizeof(GtkTargetEntry), | |
4707 GDK_ACTION_COPY); | |
4708 | |
4709 gtk_drag_dest_set(gtkconv->entry, 0, | |
4710 te, sizeof(te) / sizeof(GtkTargetEntry), | |
4711 GDK_ACTION_COPY); | |
4712 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4713 g_signal_connect(G_OBJECT(pane), "drag_data_received", |
9300 | 4714 G_CALLBACK(conv_dnd_recv), conv); |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4715 g_signal_connect(G_OBJECT(gtkconv->imhtml), "drag_data_received", |
9300 | 4716 G_CALLBACK(conv_dnd_recv), conv); |
8105 | 4717 g_signal_connect(G_OBJECT(gtkconv->entry), "drag_data_received", |
9300 | 4718 G_CALLBACK(conv_dnd_recv), conv); |
4719 | |
4359 | 4720 /* Setup the container for the tab. */ |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4721 gtkconv->tab_cont = tab_cont = gtk_vbox_new(FALSE, 6); |
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4722 gtk_container_set_border_width(GTK_CONTAINER(tab_cont), 6); |
4359 | 4723 gtk_container_add(GTK_CONTAINER(tab_cont), pane); |
4724 gtk_widget_show(pane); | |
4725 | |
4726 new_ui = TRUE; | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
4727 |
4359 | 4728 gtkconv->make_sound = TRUE; |
5902
6889b89cab90
[gaim-migrate @ 6334]
Christian Hammond <chipx86@chipx86.com>
parents:
5901
diff
changeset
|
4729 |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4730 gtkconv->show_formatting_toolbar = gaim_prefs_get_bool( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4731 "/gaim/gtk/conversations/show_formatting_toolbar"); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4732 |
8329
9dd7c75ed433
[gaim-migrate @ 9053]
Christian Hammond <chipx86@chipx86.com>
parents:
8319
diff
changeset
|
4733 if (gtkconv->show_formatting_toolbar) |
9dd7c75ed433
[gaim-migrate @ 9053]
Christian Hammond <chipx86@chipx86.com>
parents:
8319
diff
changeset
|
4734 gtk_widget_show(gtkconv->toolbar); |
9dd7c75ed433
[gaim-migrate @ 9053]
Christian Hammond <chipx86@chipx86.com>
parents:
8319
diff
changeset
|
4735 |
9188 | 4736 gtkconv->show_timestamps = gaim_prefs_get_bool( |
4737 "/gaim/gtk/conversations/show_timestamps"); | |
4738 | |
4739 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
4740 gtkconv->show_timestamps); | |
4741 | |
8176 | 4742 g_signal_connect_swapped(G_OBJECT(pane), "focus", |
9080 | 4743 G_CALLBACK(gtk_widget_grab_focus), |
4744 gtkconv->entry); | |
4359 | 4745 } |
4746 | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4747 gtkconv->tabby = tabby = gtk_hbox_new(FALSE, 6); |
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4748 gtkconv->menu_tabby = menu_tabby = gtk_hbox_new(FALSE, 6); |
4359 | 4749 |
4750 /* Close button. */ | |
4751 gtkconv->close = gtk_button_new(); | |
4752 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
|
4753 gtk_button_set_relief(GTK_BUTTON(gtkconv->close), GTK_RELIEF_NONE); |
4359 | 4754 gtk_container_add(GTK_CONTAINER(gtkconv->close), |
4445 | 4755 gtk_image_new_from_stock(GTK_STOCK_CLOSE, |
4756 GTK_ICON_SIZE_MENU)); | |
4359 | 4757 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->close, |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4758 _("Close conversation"), NULL); |
4359 | 4759 |
4760 g_signal_connect(G_OBJECT(gtkconv->close), "clicked", | |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4761 G_CALLBACK(close_conv_cb), conv); |
4359 | 4762 |
7446
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4763 /* |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4764 * 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
|
4765 * border bug. I love you guys! -- ChipX86 |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4766 */ |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4767 g_signal_connect(G_OBJECT(gtkconv->close), "state_changed", |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4768 G_CALLBACK(tab_close_button_state_changed_cb), NULL); |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4769 |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4770 /* Status icon. */ |
6440 | 4771 gtkconv->icon = gtk_image_new(); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4772 gtkconv->menu_icon = gtk_image_new(); |
6440 | 4773 update_tab_icon(conv); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4774 |
4359 | 4775 /* Tab label. */ |
4776 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
|
4777 gtkconv->menu_label = gtk_label_new(gaim_conversation_get_title(conv)); |
4359 | 4778 #if 0 |
4779 gtk_misc_set_alignment(GTK_MISC(gtkconv->tab_label), 0.00, 0.5); | |
4780 gtk_misc_set_padding(GTK_MISC(gtkconv->tab_label), 4, 0); | |
4781 #endif | |
4782 | |
4783 /* Pack it all together. */ | |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4784 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
|
4785 gtk_box_pack_start(GTK_BOX(menu_tabby), gtkconv->menu_icon, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4786 FALSE, FALSE, 0); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4787 |
8946 | 4788 gtk_widget_show_all(gtkconv->icon); |
4789 gtk_widget_show_all(gtkconv->menu_icon); | |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4790 |
4359 | 4791 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
|
4792 gtk_box_pack_start(GTK_BOX(menu_tabby), gtkconv->menu_label, TRUE, TRUE, 0); |
4445 | 4793 gtk_widget_show(gtkconv->tab_label); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4794 gtk_widget_show(gtkconv->menu_label); |
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4795 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
|
4796 |
4445 | 4797 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
|
4798 if (gaim_prefs_get_bool("/gaim/gtk/conversations/close_on_tabs")) |
4445 | 4799 gtk_widget_show_all(gtkconv->close); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4800 |
4445 | 4801 gtk_widget_show(tabby); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4802 gtk_widget_show(menu_tabby); |
4359 | 4803 |
7143 | 4804 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
4805 gaim_gtkconv_update_buddy_icon(conv); | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4806 |
9297 | 4807 /* Add this pane to the conversation's notebook. */ |
9606 | 4808 gtk_notebook_append_page_menu(GTK_NOTEBOOK(gtkwin->notebook), tab_cont, tabby, menu_tabby); |
4359 | 4809 |
4810 gtk_widget_show(tab_cont); | |
4811 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4812 if (gaim_conv_window_get_conversation_count(win) == 1) { |
4818 | 4813 /* Er, bug in notebooks? Switch to the page manually. */ |
4359 | 4814 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), 0); |
4851 | 4815 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4816 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4817 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4818 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4819 else |
4818 | 4820 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), TRUE); |
4359 | 4821 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4822 focus_conv = g_list_nth_data(gaim_conv_window_get_conversations(win), |
5204 | 4823 gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook))); |
4824 focus_gtkconv = GAIM_GTK_CONVERSATION(focus_conv); | |
4825 gtk_widget_grab_focus(focus_gtkconv->entry); | |
4359 | 4826 |
4827 if (!new_ui) | |
4828 g_object_unref(gtkconv->tab_cont); | |
4829 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4830 if (gaim_conv_window_get_conversation_count(win) == 1) |
4685 | 4831 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); |
4359 | 4832 } |
4833 | |
4834 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4835 gaim_gtk_remove_conversation(GaimConvWindow *win, GaimConversation *conv) |
4359 | 4836 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4837 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4838 GaimGtkConversation *gtkconv; |
4359 | 4839 unsigned int index; |
4818 | 4840 GaimConversationType conv_type; |
4841 | |
4842 conv_type = gaim_conversation_get_type(conv); | |
4359 | 4843 index = gaim_conversation_get_index(conv); |
4844 | |
4845 gtkwin = GAIM_GTK_WINDOW(win); | |
4846 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4847 | |
4848 g_object_ref(gtkconv->tab_cont); | |
4849 gtk_object_sink(GTK_OBJECT(gtkconv->tab_cont)); | |
4850 | |
4851 gtk_notebook_remove_page(GTK_NOTEBOOK(gtkwin->notebook), index); | |
4852 | |
4818 | 4853 /* go back to tabless if need be */ |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4854 if (gaim_conv_window_get_conversation_count(win) <= 2) { |
4818 | 4855 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4856 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); |
4818 | 4857 } |
4858 | |
4859 | |
4359 | 4860 /* If this window is setup with an inactive gc, regenerate the menu. */ |
4818 | 4861 if (conv_type == GAIM_CONV_IM && |
4359 | 4862 gaim_conversation_get_gc(conv) == NULL) { |
4863 | |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
4864 generate_send_as_items(win, conv); |
4359 | 4865 } |
4866 } | |
4867 | |
4868 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4869 gaim_gtk_move_conversation(GaimConvWindow *win, GaimConversation *conv, |
4359 | 4870 unsigned int new_index) |
4871 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4872 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4873 GaimGtkConversation *gtkconv; |
4359 | 4874 |
4875 gtkwin = GAIM_GTK_WINDOW(win); | |
4876 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4877 | |
4415
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4878 if (new_index > gaim_conversation_get_index(conv)) |
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4879 new_index--; |
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4880 |
4359 | 4881 gtk_notebook_reorder_child(GTK_NOTEBOOK(gtkwin->notebook), |
4882 gtkconv->tab_cont, new_index); | |
4883 } | |
4884 | |
4885 static int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4886 gaim_gtk_get_active_index(const GaimConvWindow *win) |
4359 | 4887 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4888 GaimGtkWindow *gtkwin; |
5680
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4889 int index; |
4359 | 4890 |
4891 gtkwin = GAIM_GTK_WINDOW(win); | |
4892 | |
5680
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4893 index = gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook)); |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4894 |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4895 /* |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4896 * A fix, because the first conversation may be active, but not |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4897 * appear in the notebook just yet. -- ChipX86 |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4898 */ |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4899 return (index == -1 ? 0 : index); |
4359 | 4900 } |
4901 | |
9260
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4902 static gboolean |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4903 gaim_gtk_has_focus(GaimConvWindow *win) |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4904 { |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4905 GaimGtkWindow *gtkwin; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4906 gboolean has_focus = FALSE; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4907 |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4908 gtkwin = GAIM_GTK_WINDOW(win); |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4909 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
|
4910 |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4911 return has_focus; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4912 } |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4913 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4914 static GaimConvWindowUiOps window_ui_ops = |
4359 | 4915 { |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
4916 gaim_gtk_conversations_get_conv_ui_ops, |
4359 | 4917 gaim_gtk_new_window, |
4918 gaim_gtk_destroy_window, | |
4919 gaim_gtk_show, | |
4920 gaim_gtk_hide, | |
4921 gaim_gtk_raise, | |
4922 gaim_gtk_flash, | |
4923 gaim_gtk_switch_conversation, | |
4924 gaim_gtk_add_conversation, | |
4925 gaim_gtk_remove_conversation, | |
4926 gaim_gtk_move_conversation, | |
9260
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4927 gaim_gtk_get_active_index, |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4928 gaim_gtk_has_focus |
4359 | 4929 }; |
4930 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4931 GaimConvWindowUiOps * |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
4932 gaim_gtk_conversations_get_win_ui_ops(void) |
4359 | 4933 { |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4934 return &window_ui_ops; |
4359 | 4935 } |
4936 | |
4937 /************************************************************************** | |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4938 * Conversation UI operations |
4359 | 4939 **************************************************************************/ |
4940 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4941 gaim_gtkconv_destroy(GaimConversation *conv) |
4359 | 4942 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4943 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); |
4359 | 4944 |
9504 | 4945 /* If the "Save Conversation" or "Save Icon" dialogs are open then close them */ |
4946 gaim_request_close_with_handle(conv); | |
4359 | 4947 |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4948 gtk_widget_destroy(gtkconv->tab_cont); |
4892 | 4949 g_object_unref(gtkconv->tab_cont); |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4950 |
4359 | 4951 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
4755 | 4952 if (gtkconv->u.im->icon_timer != 0) |
4953 g_source_remove(gtkconv->u.im->icon_timer); | |
4954 | |
4359 | 4955 if (gtkconv->u.im->anim != NULL) |
4793 | 4956 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); |
4359 | 4957 |
4958 g_free(gtkconv->u.im); | |
4959 } | |
4960 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
4961 g_free(gtkconv->u.chat); | |
4962 } | |
4963 | |
4633 | 4964 gtk_object_sink(GTK_OBJECT(gtkconv->tooltips)); |
4965 | |
4359 | 4966 g_free(gtkconv); |
4967 } | |
4968 | |
4969 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4970 gaim_gtkconv_write_im(GaimConversation *conv, const char *who, |
6982 | 4971 const char *message, GaimMessageFlags flags, |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4972 time_t mtime) |
4359 | 4973 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4974 GaimGtkConversation *gtkconv; |
8630 | 4975 GaimConvWindow *gaimwin; |
4976 GaimGtkWindow *gtkwin; | |
4977 gboolean has_focus; | |
4359 | 4978 |
4979 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
8630 | 4980 gaimwin = gaim_conversation_get_window(conv); |
4981 gtkwin = GAIM_GTK_WINDOW(gaimwin); | |
4982 | |
4983 g_object_get(G_OBJECT(gtkwin->window), "has-toplevel-focus", &has_focus, NULL); | |
4359 | 4984 |
6621 | 4985 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
9301 | 4986 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
|
4987 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4988 gaim_conv_window_raise(gaim_conversation_get_window(conv)); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4989 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4990 |
4382
76223649765b
[gaim-migrate @ 4648]
Christian Hammond <chipx86@chipx86.com>
parents:
4378
diff
changeset
|
4991 /* Play a sound, if specified in prefs. */ |
8630 | 4992 if (gtkconv->make_sound && !((gaim_conv_window_get_active_conversation(gaimwin) == conv) && |
8633 | 4993 !gaim_prefs_get_bool("/gaim/gtk/sound/conv_focus") && has_focus)) { |
6621 | 4994 if (flags & GAIM_MESSAGE_RECV) { |
4359 | 4995 if (gtkconv->u.im->a_virgin && |
5820 | 4996 gaim_prefs_get_bool("/gaim/gtk/sound/enabled/first_im_recv")) { |
4359 | 4997 |
4561 | 4998 gaim_sound_play_event(GAIM_SOUND_FIRST_RECEIVE); |
4359 | 4999 } |
5000 else | |
4561 | 5001 gaim_sound_play_event(GAIM_SOUND_RECEIVE); |
4359 | 5002 } |
5003 else { | |
4561 | 5004 gaim_sound_play_event(GAIM_SOUND_SEND); |
4359 | 5005 } |
5006 } | |
5007 | |
5008 gtkconv->u.im->a_virgin = FALSE; | |
5009 | |
6982 | 5010 gaim_conversation_write(conv, who, message, flags, mtime); |
4359 | 5011 } |
5012 | |
5013 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5014 gaim_gtkconv_write_chat(GaimConversation *conv, const char *who, |
6621 | 5015 const char *message, GaimMessageFlags flags, time_t mtime) |
4359 | 5016 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5017 GaimGtkConversation *gtkconv; |
8630 | 5018 GaimConvWindow *gaimwin; |
5019 GaimGtkWindow *gtkwin; | |
5020 gboolean has_focus; | |
4359 | 5021 |
5022 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
8630 | 5023 gaimwin = gaim_conversation_get_window(conv); |
5024 gtkwin = GAIM_GTK_WINDOW(gaimwin); | |
5025 | |
5026 g_object_get(G_OBJECT(gtkwin->window), "has-toplevel-focus", &has_focus, NULL); | |
4359 | 5027 |
4382
76223649765b
[gaim-migrate @ 4648]
Christian Hammond <chipx86@chipx86.com>
parents:
4378
diff
changeset
|
5028 /* Play a sound, if specified in prefs. */ |
8630 | 5029 if (gtkconv->make_sound && !((gaim_conv_window_get_active_conversation(gaimwin) == conv) && |
9704 | 5030 !gaim_prefs_get_bool("/gaim/gtk/sound/conv_focus") && has_focus) && |
5031 !(flags & GAIM_MESSAGE_DELAYED) && | |
5032 !(flags & GAIM_MESSAGE_SYSTEM)) { | |
5033 | |
6621 | 5034 if (!(flags & GAIM_MESSAGE_WHISPER) && (flags & GAIM_MESSAGE_SEND)) |
4561 | 5035 gaim_sound_play_event(GAIM_SOUND_CHAT_YOU_SAY); |
9704 | 5036 else if (flags & GAIM_MESSAGE_RECV) { |
6621 | 5037 if ((flags & GAIM_MESSAGE_NICK) && |
9584 | 5038 gaim_prefs_get_bool("/gaim/gtk/sound/enabled/nick_said")) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5039 |
4561 | 5040 gaim_sound_play_event(GAIM_SOUND_CHAT_NICK); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5041 } |
4359 | 5042 else |
4561 | 5043 gaim_sound_play_event(GAIM_SOUND_CHAT_SAY); |
4359 | 5044 } |
5045 } | |
5046 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5047 if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/color_nicks")) |
6621 | 5048 flags |= GAIM_MESSAGE_COLORIZE; |
4359 | 5049 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5050 /* Raise the window, if specified in prefs. */ |
6621 | 5051 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
9150 | 5052 /* we may want to change this */ |
9301 | 5053 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
|
5054 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5055 gaim_conv_window_raise(gaim_conversation_get_window(conv)); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5056 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5057 |
6982 | 5058 gaim_conversation_write(conv, who, message, flags, mtime); |
4359 | 5059 } |
5060 | |
5061 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5062 gaim_gtkconv_write_conv(GaimConversation *conv, const char *who, |
6982 | 5063 const char *message, GaimMessageFlags flags, |
4359 | 5064 time_t mtime) |
5065 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5066 GaimGtkConversation *gtkconv; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5067 GaimConvWindow *win; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
5068 GaimConnection *gc; |
4359 | 5069 int gtk_font_options = 0; |
7440 | 5070 char buf[BUF_LONG]; |
4359 | 5071 char buf2[BUF_LONG]; |
5072 char mdate[64]; | |
5073 char color[10]; | |
5074 char *str; | |
5075 char *with_font_tag; | |
4896 | 5076 char *sml_attrib = NULL; |
6982 | 5077 size_t length = strlen(message) + 1; |
4895 | 5078 |
4359 | 5079 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5080 gc = gaim_conversation_get_gc(conv); | |
5081 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5082 win = gaim_conversation_get_window(conv); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5083 |
9301 | 5084 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
5085 ((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT && | |
5086 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) || | |
5087 (gaim_conversation_get_type(conv) == GAIM_CONV_IM && | |
5088 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
|
5089 gaim_conv_window_show(win); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5090 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5091 |
8677 | 5092 if (gtk_text_buffer_get_char_count(gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)))) |
5093 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", 0); | |
5094 | |
5133 | 5095 if(time(NULL) > mtime + 20*60) /* show date if older than 20 minutes */ |
5096 strftime(mdate, sizeof(mdate), "%Y-%m-%d %H:%M:%S", localtime(&mtime)); | |
5097 else | |
5098 strftime(mdate, sizeof(mdate), "%H:%M:%S", localtime(&mtime)); | |
4359 | 5099 |
4896 | 5100 if(gc) |
9699 | 5101 sml_attrib = g_strdup_printf("sml=\"%s\"", |
5102 gaim_account_get_protocol_name(conv->account)); | |
7440 | 5103 |
4359 | 5104 gtk_font_options ^= GTK_IMHTML_NO_COMMENTS; |
5105 | |
9049 | 5106 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_colors")) |
5107 gtk_font_options ^= GTK_IMHTML_NO_COLOURS; | |
5108 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_fonts")) | |
5109 gtk_font_options ^= GTK_IMHTML_NO_FONTS; | |
5110 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_font_sizes")) | |
5111 gtk_font_options ^= GTK_IMHTML_NO_SIZES; | |
4359 | 5112 |
7956 | 5113 /* this is gonna crash one day, I can feel it. */ |
5114 if (GAIM_PLUGIN_PROTOCOL_INFO(gaim_find_prpl(gaim_account_get_protocol_id(conv->account)))->options & | |
7431 | 5115 OPT_PROTO_USE_POINTSIZE) { |
5367 | 5116 gtk_font_options ^= GTK_IMHTML_USE_POINTSIZE; |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5117 } |
4359 | 5118 |
6621 | 5119 if (flags & GAIM_MESSAGE_SYSTEM) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5120 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) |
8380 | 5121 g_snprintf(buf, BUF_LONG, "<FONT SIZE=\"2\">(%s)</FONT> <B>%s</B>", |
7431 | 5122 mdate, message); |
4359 | 5123 else |
5124 g_snprintf(buf, BUF_LONG, "<B>%s</B>", message); | |
7440 | 5125 |
4359 | 5126 g_snprintf(buf2, sizeof(buf2), |
8690 | 5127 "<FONT %s><FONT SIZE=\"2\"><!--(%s) --></FONT><B>%s</B></FONT>", |
7850 | 5128 sml_attrib, mdate, message); |
7440 | 5129 |
8962 | 5130 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, 0); |
7440 | 5131 |
7583 | 5132 /* Add the message to a conversations scrollback buffer */ |
5133 conv->history = g_string_append(conv->history, buf); | |
5134 conv->history = g_string_append(conv->history, "<BR>\n"); | |
7440 | 5135 |
8722 | 5136 } else if (flags & GAIM_MESSAGE_ERROR) { |
5137 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) | |
9627 | 5138 g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"#ff0000\"><FONT SIZE=\"2\">(%s)</FONT> <B>%s</B></FONT>", |
8722 | 5139 mdate, message); |
5140 else | |
5141 g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"#ff0000\"><B>%s</B></FONT>", message); | |
9554 | 5142 |
8722 | 5143 g_snprintf(buf2, sizeof(buf2), |
9627 | 5144 "<FONT COLOR=\"#ff0000\"><FONT %s><FONT SIZE=\"2\"><!--(%s) --></FONT><B>%s</B></FONT></FONT>", |
8722 | 5145 sml_attrib, mdate, message); |
9554 | 5146 |
8962 | 5147 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, 0); |
5148 | |
8722 | 5149 /* Add the message to a conversations scrollback buffer */ |
5150 conv->history = g_string_append(conv->history, buf); | |
5151 conv->history = g_string_append(conv->history, "<BR>\n"); | |
7431 | 5152 } else if (flags & GAIM_MESSAGE_NO_LOG) { |
4359 | 5153 g_snprintf(buf, BUF_LONG, |
8690 | 5154 "<B><FONT %s COLOR=\"#777777\">%s</FONT></B>", |
7850 | 5155 sml_attrib, message); |
7440 | 5156 |
8962 | 5157 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf, 0); |
4359 | 5158 } |
5159 else { | |
4895 | 5160 char *new_message = g_memdup(message, length); |
9613 | 5161 char *who_escaped = (who ? g_markup_escape_text(who, strlen(who)) : g_strdup("")); |
7440 | 5162 |
6621 | 5163 if (flags & GAIM_MESSAGE_WHISPER) { |
4359 | 5164 str = g_malloc(1024); |
7440 | 5165 |
4359 | 5166 /* If we're whispering, it's not an autoresponse. */ |
7564 | 5167 if (gaim_message_meify(new_message, length)) { |
8908 | 5168 g_snprintf(str, 1024, "***%s", who_escaped); |
4359 | 5169 strcpy(color, "#6C2585"); |
5170 } | |
5171 else { | |
8908 | 5172 g_snprintf(str, 1024, "*%s*:", who_escaped); |
4359 | 5173 strcpy(color, "#00FF00"); |
5174 } | |
7440 | 5175 } |
4359 | 5176 else { |
7564 | 5177 if (gaim_message_meify(new_message, length)) { |
4359 | 5178 str = g_malloc(1024); |
7440 | 5179 |
6621 | 5180 if (flags & GAIM_MESSAGE_AUTO_RESP) |
8908 | 5181 g_snprintf(str, 1024, "%s ***%s", AUTO_RESPONSE, who_escaped); |
4359 | 5182 else |
8908 | 5183 g_snprintf(str, 1024, "***%s", who_escaped); |
7440 | 5184 |
6621 | 5185 if (flags & GAIM_MESSAGE_NICK) |
4359 | 5186 strcpy(color, "#AF7F00"); |
5187 else | |
5188 strcpy(color, "#062585"); | |
5189 } | |
5190 else { | |
5191 str = g_malloc(1024); | |
6621 | 5192 if (flags & GAIM_MESSAGE_AUTO_RESP) |
8908 | 5193 g_snprintf(str, 1024, "%s %s", who_escaped, AUTO_RESPONSE); |
4359 | 5194 else |
8908 | 5195 g_snprintf(str, 1024, "%s:", who_escaped); |
6621 | 5196 if (flags & GAIM_MESSAGE_NICK) |
4359 | 5197 strcpy(color, "#AF7F00"); |
6621 | 5198 else if (flags & GAIM_MESSAGE_RECV) { |
5199 if (flags & GAIM_MESSAGE_COLORIZE) { | |
4359 | 5200 const char *u; |
5201 int m = 0; | |
7440 | 5202 |
4359 | 5203 for (u = who; *u != '\0'; u++) |
5204 m += *u; | |
7440 | 5205 |
4359 | 5206 m = m % NUM_NICK_COLORS; |
7440 | 5207 |
4359 | 5208 strcpy(color, nick_colors[m]); |
5209 } | |
5210 else | |
7854 | 5211 strcpy(color, RECV_COLOR); |
4359 | 5212 } |
6621 | 5213 else if (flags & GAIM_MESSAGE_SEND) |
7854 | 5214 strcpy(color, SEND_COLOR); |
4359 | 5215 } |
8908 | 5216 |
5217 if(who_escaped) | |
5218 g_free(who_escaped); | |
4359 | 5219 } |
7440 | 5220 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5221 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) |
4359 | 5222 g_snprintf(buf, BUF_LONG, |
8380 | 5223 "<FONT COLOR=\"%s\" %s><FONT SIZE=\"2\">(%s)</FONT> " |
7431 | 5224 "<B>%s</B></FONT> ", color, |
5225 sml_attrib ? sml_attrib : "", mdate, str); | |
4359 | 5226 else |
5227 g_snprintf(buf, BUF_LONG, | |
7431 | 5228 "<FONT COLOR=\"%s\" %s><B>%s</B></FONT> ", color, |
5229 sml_attrib ? sml_attrib : "", str); | |
7440 | 5230 |
4359 | 5231 g_snprintf(buf2, BUF_LONG, |
8380 | 5232 "<FONT COLOR=\"%s\" %s><FONT SIZE=\"2\"><!--(%s) --></FONT>" |
7431 | 5233 "<B>%s</B></FONT> ", |
5234 color, sml_attrib ? sml_attrib : "", mdate, str); | |
7440 | 5235 |
4359 | 5236 g_free(str); |
5237 | |
8962 | 5238 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), |
5239 buf2, 0); | |
4359 | 5240 |
4895 | 5241 if(gc){ |
4896 | 5242 char *pre = g_strdup_printf("<font %s>", sml_attrib ? sml_attrib : ""); |
4895 | 5243 char *post = "</font>"; |
5244 int pre_len = strlen(pre); | |
5245 int post_len = strlen(post); | |
7440 | 5246 |
4895 | 5247 with_font_tag = g_malloc(length + pre_len + post_len + 1); |
7440 | 5248 |
4895 | 5249 strcpy(with_font_tag, pre); |
5250 memcpy(with_font_tag + pre_len, new_message, length); | |
5251 strcpy(with_font_tag + pre_len + length, post); | |
7440 | 5252 |
4895 | 5253 length += pre_len + post_len; |
5254 g_free(pre); | |
5255 } | |
4608 | 5256 else |
4895 | 5257 with_font_tag = g_memdup(new_message, length); |
7440 | 5258 |
8962 | 5259 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), |
5260 with_font_tag, gtk_font_options); | |
7440 | 5261 |
8557 | 5262 conv->history = g_string_append(conv->history, buf); |
5263 conv->history = g_string_append(conv->history, new_message); | |
5264 conv->history = g_string_append(conv->history, "<BR>\n"); | |
7440 | 5265 |
5266 g_free(with_font_tag); | |
7447 | 5267 g_free(new_message); |
7440 | 5268 } |
5269 | |
6062 | 5270 |
5012 | 5271 if(sml_attrib) |
5272 g_free(sml_attrib); | |
4359 | 5273 } |
5274 | |
5275 static void | |
9846 | 5276 gaim_gtkconv_chat_add_user(GaimConversation *conv, const char *user, gboolean new_arrival) |
4359 | 5277 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5278 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5279 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5280 GaimGtkChatPane *gtkchat; |
4359 | 5281 char tmp[BUF_LONG]; |
5282 int num_users; | |
5283 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5284 chat = GAIM_CONV_CHAT(conv); |
4359 | 5285 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5286 gtkchat = gtkconv->u.chat; | |
5287 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5288 num_users = g_list_length(gaim_conv_chat_get_users(chat)); |
4359 | 5289 |
5290 g_snprintf(tmp, sizeof(tmp), | |
5291 ngettext("%d person in room", "%d people in room", | |
5292 num_users), | |
5293 num_users); | |
5294 | |
5295 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); | |
5296 | |
9846 | 5297 if (gtkconv->make_sound && new_arrival) |
4561 | 5298 gaim_sound_play_event(GAIM_SOUND_CHAT_JOIN); |
4359 | 5299 |
9554 | 5300 add_chat_buddy_common(conv, user); |
4359 | 5301 } |
5302 | |
5303 static void | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5304 gaim_gtkconv_chat_add_users(GaimConversation *conv, GList *users) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5305 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5306 GaimConvChat *chat; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5307 GaimGtkConversation *gtkconv; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5308 GaimGtkChatPane *gtkchat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5309 GList *l; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5310 char tmp[BUF_LONG]; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5311 int num_users; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5312 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5313 chat = GAIM_CONV_CHAT(conv); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5314 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5315 gtkchat = gtkconv->u.chat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5316 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5317 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
|
5318 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5319 g_snprintf(tmp, sizeof(tmp), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5320 ngettext("%d person in room", "%d people in room", |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5321 num_users), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5322 num_users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5323 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5324 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5325 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5326 for (l = users; l != NULL; l = l->next) { |
9554 | 5327 add_chat_buddy_common(conv, (char *)l->data); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5328 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5329 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5330 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5331 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5332 gaim_gtkconv_chat_rename_user(GaimConversation *conv, const char *old_name, |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5333 const char *new_name) |
4359 | 5334 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5335 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5336 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5337 GaimGtkChatPane *gtkchat; |
4359 | 5338 GtkTreeIter iter; |
5339 GtkTreeModel *model; | |
5340 int f = 1; | |
5341 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5342 chat = GAIM_CONV_CHAT(conv); |
4359 | 5343 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5344 gtkchat = gtkconv->u.chat; | |
5345 | |
9554 | 5346 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
5347 | |
5348 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
5349 return; | |
5350 | |
5351 while (f != 0) { | |
5352 char *val; | |
5353 | |
5354 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &val, -1); | |
5355 | |
5356 if (!gaim_utf8_strcasecmp(old_name, val)) { | |
5357 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); | |
5358 g_free(val); | |
4359 | 5359 break; |
5360 } | |
9554 | 5361 |
5362 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
5363 | |
5364 g_free(val); | |
4359 | 5365 } |
5366 | |
9554 | 5367 if (!gaim_conv_chat_find_user(chat, old_name)) |
4359 | 5368 return; |
5369 | |
9554 | 5370 add_chat_buddy_common(conv, new_name); |
4359 | 5371 } |
5372 | |
5373 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5374 gaim_gtkconv_chat_remove_user(GaimConversation *conv, const char *user) |
4359 | 5375 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5376 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5377 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5378 GaimGtkChatPane *gtkchat; |
4359 | 5379 GtkTreeIter iter; |
5380 GtkTreeModel *model; | |
5381 char tmp[BUF_LONG]; | |
5382 int num_users; | |
5383 int f = 1; | |
5384 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5385 chat = GAIM_CONV_CHAT(conv); |
4359 | 5386 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5387 gtkchat = gtkconv->u.chat; | |
5388 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5389 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
|
5390 |
9554 | 5391 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
5392 | |
5393 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
5394 return; | |
5395 | |
5396 while (f != 0) { | |
5397 char *val; | |
5398 | |
5399 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &val, -1); | |
5400 | |
5401 if (!gaim_utf8_strcasecmp(user, val)) { | |
5402 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); | |
5403 g_free(val); | |
4359 | 5404 break; |
5405 } | |
9554 | 5406 |
5407 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
5408 | |
5409 g_free(val); | |
4359 | 5410 } |
5411 | |
9554 | 5412 if (!gaim_conv_chat_find_user(chat, user)) |
4359 | 5413 return; |
5414 | |
5415 g_snprintf(tmp, sizeof(tmp), | |
9554 | 5416 ngettext("%d person in room", "%d people in room", |
5417 num_users), num_users); | |
4359 | 5418 |
5419 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); | |
5420 | |
5421 if (gtkconv->make_sound) | |
4561 | 5422 gaim_sound_play_event(GAIM_SOUND_CHAT_LEAVE); |
4359 | 5423 } |
5424 | |
5425 static void | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5426 gaim_gtkconv_chat_remove_users(GaimConversation *conv, GList *users) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5427 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5428 GaimConvChat *chat; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5429 GaimGtkConversation *gtkconv; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5430 GaimGtkChatPane *gtkchat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5431 GtkTreeIter iter; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5432 GtkTreeModel *model; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5433 GList *l; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5434 char tmp[BUF_LONG]; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5435 int num_users; |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
5436 gboolean f; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5437 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5438 chat = GAIM_CONV_CHAT(conv); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5439 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5440 gtkchat = gtkconv->u.chat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5441 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5442 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
|
5443 g_list_length(users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5444 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5445 for (l = users; l != NULL; l = l->next) { |
9554 | 5446 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
5447 | |
5448 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), | |
5449 &iter)) | |
5450 continue; | |
5451 | |
5452 do { | |
5453 char *val; | |
5454 | |
5455 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, | |
5456 CHAT_USERS_NAME_COLUMN, &val, -1); | |
5457 | |
9696 | 5458 if (!gaim_utf8_strcasecmp((char *)l->data, val)) { |
5459 #if GTK_CHECK_VERSION(2,2,0) | |
9554 | 5460 f = gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
9696 | 5461 #else |
5462 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); | |
5463 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
5464 #endif | |
5465 } | |
9554 | 5466 else |
5467 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
5468 | |
5469 g_free(val); | |
5470 } while (f); | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5471 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5472 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5473 g_snprintf(tmp, sizeof(tmp), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5474 ngettext("%d person in room", "%d people in room", |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5475 num_users), num_users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5476 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5477 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5478 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5479 |
9554 | 5480 static void |
5481 gaim_gtkconv_chat_update_user(GaimConversation *conv, const char *user) | |
5482 { | |
5483 GaimConvChat *chat; | |
5484 GaimGtkConversation *gtkconv; | |
5485 GaimGtkChatPane *gtkchat; | |
5486 GtkTreeIter iter; | |
5487 GtkTreeModel *model; | |
5488 int f = 1; | |
5489 | |
5490 chat = GAIM_CONV_CHAT(conv); | |
5491 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5492 gtkchat = gtkconv->u.chat; | |
5493 | |
5494 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | |
5495 | |
5496 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
5497 return; | |
5498 | |
5499 while (f != 0) { | |
5500 char *val; | |
5501 | |
5502 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &val, -1); | |
5503 | |
5504 if (!gaim_utf8_strcasecmp(user, val)) { | |
5505 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); | |
5506 g_free(val); | |
5507 break; | |
5508 } | |
5509 | |
5510 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
5511 | |
5512 g_free(val); | |
5513 } | |
5514 | |
5515 if (!gaim_conv_chat_find_user(chat, user)) | |
5516 return; | |
5517 | |
5518 add_chat_buddy_common(conv, user); | |
5519 } | |
5520 | |
9260
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5521 static gboolean |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5522 gaim_gtkconv_has_focus(GaimConversation *conv) |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5523 { |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5524 GaimConvWindow *win; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5525 GaimGtkWindow *gtkwin; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5526 gboolean has_focus; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5527 |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5528 win = gaim_conversation_get_window(conv); |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5529 gtkwin = GAIM_GTK_WINDOW(win); |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5530 |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5531 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
|
5532 |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5533 return has_focus; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5534 } |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5535 |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5536 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5537 gaim_gtkconv_updated(GaimConversation *conv, GaimConvUpdateType type) |
4359 | 5538 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5539 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5540 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5541 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5542 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5543 GaimConvChat *chat; |
4359 | 5544 |
5545 win = gaim_conversation_get_window(conv); | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5546 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 5547 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5548 | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5549 if (type == GAIM_CONV_UPDATE_ACCOUNT) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5550 { |
4359 | 5551 gaim_conversation_autoset_title(conv); |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5552 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5553 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5554 gaim_gtkconv_update_buddy_icon(conv); |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5555 |
4359 | 5556 gaim_gtkconv_update_buttons_by_protocol(conv); |
5557 | |
4685 | 5558 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); |
4359 | 5559 |
5560 smiley_themeize(gtkconv->imhtml); | |
6394 | 5561 |
6395 | 5562 update_tab_icon(conv); |
4359 | 5563 } |
5564 else if (type == GAIM_CONV_UPDATE_TYPING || | |
8155
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5565 type == GAIM_CONV_UPDATE_UNSEEN || |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5566 type == GAIM_CONV_UPDATE_TITLE) |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5567 { |
9472 | 5568 char *title; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5569 GaimConvIm *im = NULL; |
9472 | 5570 GaimConnection *gc = gaim_conversation_get_gc(conv); |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5571 char color[8]; |
4736 | 5572 |
4359 | 5573 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5574 im = GAIM_CONV_IM(conv); |
4359 | 5575 |
9472 | 5576 if (!gc || ((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) |
5577 && gaim_conv_chat_has_left(GAIM_CONV_CHAT(conv)))) | |
5578 title = g_strdup_printf("(%s)", gaim_conversation_get_title(conv)); | |
5579 | |
5580 else | |
5581 title = g_strdup(gaim_conversation_get_title(conv)); | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5582 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5583 *color = '\0'; |
4359 | 5584 |
5585 if (!GTK_WIDGET_REALIZED(gtkconv->tab_label)) | |
5586 gtk_widget_realize(gtkconv->tab_label); | |
5587 | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5588 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
|
5589 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5590 strcpy(color, "#47A046"); |
4359 | 5591 } |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5592 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
|
5593 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5594 strcpy(color, "#D1940C"); |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5595 } |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5596 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_NICK) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5597 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5598 strcpy(color, "#314E6C"); |
4359 | 5599 } |
8252 | 5600 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_TEXT) |
5601 { | |
5602 strcpy(color, "#DF421E"); | |
5603 } | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5604 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_EVENT) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5605 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5606 strcpy(color, "#868272"); |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5607 } |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5608 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5609 if (*color != '\0') |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5610 { |
8536 | 5611 char *html_title,*label; |
5612 | |
5613 html_title = gaim_escape_html(title); | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5614 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5615 label = g_strdup_printf("<span color=\"%s\">%s</span>", |
8536 | 5616 color, html_title); |
5617 g_free(html_title); | |
7995
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
5618 gtk_label_set_markup(GTK_LABEL(gtkconv->tab_label), label); |
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
5619 g_free(label); |
4359 | 5620 } |
7995
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
5621 else |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5622 gtk_label_set_text(GTK_LABEL(gtkconv->tab_label), title); |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5623 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5624 if (conv == gaim_conv_window_get_active_conversation(win)) |
4736 | 5625 update_typing_icon(conv); |
8155
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5626 |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5627 if (type == GAIM_CONV_UPDATE_TITLE) { |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5628 gtk_label_set_text(GTK_LABEL(gtkconv->menu_label), title); |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5629 if (conv == gaim_conv_window_get_active_conversation(win)) |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5630 gtk_window_set_title(GTK_WINDOW(gtkwin->window), title); |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5631 } |
9472 | 5632 |
5633 g_free(title); | |
4359 | 5634 } |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5635 else if (type == GAIM_CONV_UPDATE_TOPIC) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5636 { |
7154 | 5637 const char *topic; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5638 chat = GAIM_CONV_CHAT(conv); |
4359 | 5639 gtkchat = gtkconv->u.chat; |
5640 | |
7154 | 5641 topic = gaim_conv_chat_get_topic(chat); |
5642 | |
9554 | 5643 gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), topic ? topic : ""); |
7154 | 5644 gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->topic_text, |
9554 | 5645 topic ? topic : "", NULL); |
4359 | 5646 } |
5647 else if (type == GAIM_CONV_ACCOUNT_ONLINE || | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5648 type == GAIM_CONV_ACCOUNT_OFFLINE) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5649 { |
7929 | 5650 gray_stuff_out(gaim_conv_window_get_active_conversation(win)); |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
5651 generate_send_as_items(win, NULL); |
8946 | 5652 update_tab_icon(conv); |
9472 | 5653 gaim_conversation_autoset_title(conv); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5654 } |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5655 else if (type == GAIM_CONV_UPDATE_AWAY) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5656 { |
8946 | 5657 update_tab_icon(conv); |
4359 | 5658 } |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
5659 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
|
5660 type == GAIM_CONV_UPDATE_CHATLEFT) |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5661 { |
9472 | 5662 gaim_conversation_autoset_title(conv); |
7929 | 5663 gray_stuff_out(conv); |
4397
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
5664 } |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5665 else if (type == GAIM_CONV_UPDATE_ICON) |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5666 { |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5667 gaim_gtkconv_update_buddy_icon(conv); |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5668 } |
4359 | 5669 } |
5670 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5671 static GaimConversationUiOps conversation_ui_ops = |
4359 | 5672 { |
5673 gaim_gtkconv_destroy, /* destroy_conversation */ | |
5674 gaim_gtkconv_write_chat, /* write_chat */ | |
5675 gaim_gtkconv_write_im, /* write_im */ | |
5676 gaim_gtkconv_write_conv, /* write_conv */ | |
5677 gaim_gtkconv_chat_add_user, /* chat_add_user */ | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5678 gaim_gtkconv_chat_add_users, /* chat_add_users */ |
4359 | 5679 gaim_gtkconv_chat_rename_user, /* chat_rename_user */ |
5680 gaim_gtkconv_chat_remove_user, /* chat_remove_user */ | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5681 gaim_gtkconv_chat_remove_users, /* chat_remove_users */ |
9554 | 5682 gaim_gtkconv_chat_update_user, /* chat_update_user */ |
4359 | 5683 NULL, /* update_progress */ |
9260
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5684 gaim_gtkconv_has_focus, /* has_focus */ |
4359 | 5685 gaim_gtkconv_updated /* updated */ |
5686 }; | |
5687 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5688 GaimConversationUiOps * |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
5689 gaim_gtk_conversations_get_conv_ui_ops(void) |
4359 | 5690 { |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
5691 return &conversation_ui_ops; |
4359 | 5692 } |
5693 | |
5694 /************************************************************************** | |
5695 * Public conversation utility functions | |
5696 **************************************************************************/ | |
5697 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5698 gaim_gtkconv_update_buddy_icon(GaimConversation *conv) |
4359 | 5699 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5700 GaimGtkConversation *gtkconv; |
7143 | 5701 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); |
4359 | 5702 |
5703 char filename[256]; | |
5704 FILE *file; | |
5705 GError *err = NULL; | |
5706 | |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5707 const void *data; |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5708 size_t len; |
4359 | 5709 |
5710 GdkPixbuf *buf; | |
5711 | |
5712 GtkWidget *event; | |
5713 GtkWidget *frame; | |
5714 GdkPixbuf *scale; | |
5715 GdkPixmap *pm; | |
5716 GdkBitmap *bm; | |
9318 | 5717 int scale_width, scale_height; |
9332 | 5718 GtkRequisition requisition; |
9318 | 5719 |
5720 GaimAccount *account; | |
5721 GaimPluginProtocolInfo *prpl_info = NULL; | |
4359 | 5722 |
8821 | 5723 GaimButtonStyle button_type; |
5724 | |
9324 | 5725 GaimBuddyIcon *icon; |
5726 | |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5727 g_return_if_fail(conv != NULL); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5728 g_return_if_fail(GAIM_IS_GTK_CONVERSATION(conv)); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5729 g_return_if_fail(gaim_conversation_get_type(conv) == GAIM_CONV_IM); |
4359 | 5730 |
5731 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
9687 | 5732 |
5733 if (!gtkconv->u.im->show_icon) | |
5734 return; | |
5735 | |
9318 | 5736 account = gaim_conversation_get_account(conv); |
5737 if(account && account->gc) | |
5738 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl); | |
4359 | 5739 |
9845 | 5740 /* Remove the current icon stuff */ |
9885 | 5741 if (gtkconv->u.im->icon_container != NULL) |
5742 gtk_widget_destroy(gtkconv->u.im->icon_container); | |
5743 gtkconv->u.im->icon_container = NULL; | |
9845 | 5744 |
5745 if (gtkconv->u.im->anim != NULL) | |
5746 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); | |
5747 | |
9887 | 5748 gtkconv->u.im->anim = NULL; |
5749 | |
9845 | 5750 if (gtkconv->u.im->icon_timer != 0) |
5751 g_source_remove(gtkconv->u.im->icon_timer); | |
5752 | |
5753 gtkconv->u.im->icon_timer = 0; | |
5754 | |
5755 if (gtkconv->u.im->iter != NULL) | |
5756 g_object_unref(G_OBJECT(gtkconv->u.im->iter)); | |
4359 | 5757 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5758 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/im/show_buddy_icons")) |
4359 | 5759 return; |
5760 | |
5761 if (gaim_conversation_get_gc(conv) == NULL) | |
5762 return; | |
5763 | |
9324 | 5764 icon = gaim_conv_im_get_icon(GAIM_CONV_IM(conv)); |
5765 | |
5766 if (icon == NULL) | |
5767 return; | |
5768 | |
5769 data = gaim_buddy_icon_get_data(icon, &len); | |
5770 | |
5771 /* this is such an evil hack, i don't know why i'm even considering it. | |
5772 * we'll do it differently when gdk-pixbuf-loader isn't leaky anymore. */ | |
5773 /* gdk-pixbuf-loader was leaky? is it still? */ | |
5774 g_snprintf(filename, sizeof(filename), | |
5775 "%s" G_DIR_SEPARATOR_S "gaimicon-%s.%d", | |
5776 g_get_tmp_dir(), gaim_conversation_get_name(conv), getpid()); | |
5777 | |
5778 if (!(file = fopen(filename, "wb"))) | |
5779 return; | |
5780 | |
5781 fwrite(data, 1, len, file); | |
5782 fclose(file); | |
5783 | |
5784 gtkconv->u.im->anim = gdk_pixbuf_animation_new_from_file(filename, &err); | |
5785 /* make sure we remove the file as soon as possible */ | |
5786 unlink(filename); | |
5787 | |
4359 | 5788 if (err) { |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5789 gaim_debug(GAIM_DEBUG_ERROR, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5790 "Buddy icon error: %s\n", err->message); |
4359 | 5791 g_error_free(err); |
5792 } | |
5793 | |
5794 if (!gtkconv->u.im->anim) | |
5795 return; | |
5796 | |
5797 if (gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim)) { | |
5798 gtkconv->u.im->iter = NULL; | |
5799 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); | |
5800 } else { | |
5801 gtkconv->u.im->iter = | |
8496 | 5802 gdk_pixbuf_animation_get_iter(gtkconv->u.im->anim, NULL); /* LEAK */ |
4359 | 5803 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); |
8189 | 5804 if (gtkconv->u.im->animate) |
5805 start_anim(NULL, conv); | |
4359 | 5806 } |
5807 | |
9318 | 5808 get_icon_scale_size(gtkconv->u.im->anim, prpl_info ? &prpl_info->icon_spec : |
5809 NULL, &scale_width, &scale_height); | |
4359 | 5810 scale = gdk_pixbuf_scale_simple(buf, |
9318 | 5811 MAX(gdk_pixbuf_get_width(buf) * scale_width / |
4359 | 5812 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), |
9318 | 5813 MAX(gdk_pixbuf_get_height(buf) * scale_height / |
4359 | 5814 gdk_pixbuf_animation_get_height(gtkconv->u.im->anim), 1), |
5815 GDK_INTERP_NEAREST); | |
5816 | |
5817 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); | |
4793 | 5818 g_object_unref(G_OBJECT(scale)); |
4359 | 5819 |
8821 | 5820 |
9885 | 5821 gtkconv->u.im->icon_container = gtk_vbox_new(FALSE, 0); |
8821 | 5822 |
4359 | 5823 frame = gtk_frame_new(NULL); |
5824 gtk_frame_set_shadow_type(GTK_FRAME(frame), | |
5825 (bm ? GTK_SHADOW_NONE : GTK_SHADOW_IN)); | |
9885 | 5826 gtk_box_pack_start(GTK_BOX(gtkconv->u.im->icon_container), frame, |
5827 FALSE, FALSE, 0); | |
8821 | 5828 |
4359 | 5829 event = gtk_event_box_new(); |
5830 gtk_container_add(GTK_CONTAINER(frame), event); | |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
5831 g_signal_connect(G_OBJECT(event), "button-press-event", |
4359 | 5832 G_CALLBACK(icon_menu), conv); |
5833 gtk_widget_show(event); | |
5834 | |
4635 | 5835 gtkconv->u.im->icon = gtk_image_new_from_pixmap(pm, bm); |
9318 | 5836 gtk_widget_set_size_request(gtkconv->u.im->icon, scale_width, scale_height); |
4359 | 5837 gtk_container_add(GTK_CONTAINER(event), gtkconv->u.im->icon); |
5838 gtk_widget_show(gtkconv->u.im->icon); | |
5839 | |
4793 | 5840 g_object_unref(G_OBJECT(pm)); |
4359 | 5841 |
5842 if (bm) | |
4793 | 5843 g_object_unref(G_OBJECT(bm)); |
7143 | 5844 |
9332 | 5845 button_type = gaim_prefs_get_int("/gaim/gtk/conversations/button_type"); |
9876 | 5846 /* the button seems to get its size before the box, so... */ |
5847 gtk_widget_size_request(gtkconv->send, &requisition); | |
9683 | 5848 if (button_type == GAIM_BUTTON_NONE || requisition.height * 1.5 < scale_height) { |
9885 | 5849 gtk_box_pack_start(GTK_BOX(gtkconv->lower_hbox), |
5850 gtkconv->u.im->icon_container, FALSE, FALSE, 0); | |
9332 | 5851 /* gtk_box_reorder_child(GTK_BOX(gtkconv->lower_hbox), vbox, 0); */ |
5852 } else { | |
9885 | 5853 gtk_box_pack_start(GTK_BOX(gtkconv->bbox), |
5854 gtkconv->u.im->icon_container, FALSE, FALSE, 0); | |
5855 gtk_box_reorder_child(GTK_BOX(gtkconv->bbox), | |
5856 gtkconv->u.im->icon_container, 0); | |
9332 | 5857 } |
5858 | |
9885 | 5859 gtk_widget_show(gtkconv->u.im->icon_container); |
9332 | 5860 gtk_widget_show(frame); |
5861 | |
7143 | 5862 /* The buddy icon code needs badly to be fixed. */ |
5863 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); | |
8068 | 5864 if(conv == gaim_conv_window_get_active_conversation(gaim_conversation_get_window(conv))) |
5865 gtk_window_set_icon(GTK_WINDOW(gtkwin->window), buf); | |
4359 | 5866 } |
5867 | |
5868 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5869 gaim_gtkconv_update_buttons_by_protocol(GaimConversation *conv) |
4359 | 5870 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5871 GaimConvWindow *win; |
4359 | 5872 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5873 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
4359 | 5874 return; |
5875 | |
7887 | 5876 win = gaim_conversation_get_window(conv); |
5877 | |
5878 if (win != NULL && gaim_conv_window_get_active_conversation(win) == conv) | |
5879 gray_stuff_out(conv); | |
4359 | 5880 } |
5881 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5882 GaimConvWindow * |
4359 | 5883 gaim_gtkwin_get_at_xy(int x, int y) |
5884 { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5885 GaimConvWindow *win = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5886 GaimGtkWindow *gtkwin; |
4359 | 5887 GdkWindow *gdkwin; |
5888 GList *l; | |
5889 | |
5890 gdkwin = gdk_window_at_pointer(&x, &y); | |
5891 | |
5892 if (gdkwin) | |
5893 gdkwin = gdk_window_get_toplevel(gdkwin); | |
5894 | |
5895 for (l = gaim_get_windows(); l != NULL; l = l->next) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5896 win = (GaimConvWindow *)l->data; |
4359 | 5897 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5898 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5899 continue; |
5900 | |
5901 gtkwin = GAIM_GTK_WINDOW(win); | |
5902 | |
5903 if (gdkwin == gtkwin->window->window) | |
5904 return win; | |
5905 } | |
5906 | |
5907 return NULL; | |
5908 } | |
5909 | |
5910 int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5911 gaim_gtkconv_get_tab_at_xy(GaimConvWindow *win, int x, int y) |
4359 | 5912 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5913 GaimGtkWindow *gtkwin; |
4359 | 5914 GList *l; |
5915 gint nb_x, nb_y, x_rel, y_rel; | |
5916 GtkNotebook *notebook; | |
5917 GtkWidget *tab; | |
5918 gint i, page_num = 0; | |
5919 gboolean first_visible = TRUE; | |
5920 | |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5921 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5922 return -1; |
5923 | |
5924 gtkwin = GAIM_GTK_WINDOW(win); | |
5925 notebook = GTK_NOTEBOOK(gtkwin->notebook); | |
5926 | |
5927 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
5928 x_rel = x - nb_x; | |
5929 y_rel = y - nb_y; | |
5930 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5931 for (l = gaim_conv_window_get_conversations(win), i = 0; |
4359 | 5932 l != NULL; |
5933 l = l->next, i++) { | |
5934 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5935 GaimConversation *conv = l->data; |
4359 | 5936 tab = GAIM_GTK_CONVERSATION(conv)->tab_label; |
5937 | |
5938 if (!GTK_WIDGET_MAPPED(tab)) | |
5939 continue; | |
5940 | |
5941 if (first_visible) { | |
5942 first_visible = FALSE; | |
5943 | |
5944 if (x_rel < tab->allocation.x) x_rel = tab->allocation.x; | |
5945 if (y_rel < tab->allocation.y) y_rel = tab->allocation.y; | |
5946 } | |
5947 | |
5948 if (gtk_notebook_get_tab_pos(notebook) == GTK_POS_TOP || | |
5949 gtk_notebook_get_tab_pos(notebook) == GTK_POS_BOTTOM) { | |
5950 | |
5951 if (tab->allocation.x <= x_rel) { | |
5952 if (tab->allocation.x + tab->allocation.width <= x_rel) | |
5953 page_num = i + 1; | |
5954 else | |
5955 page_num = i; | |
5956 } | |
5957 else | |
5958 break; | |
5959 } | |
5960 else { | |
5961 if (tab->allocation.y <= y_rel) { | |
5962 if (tab->allocation.y + tab->allocation.height <= y_rel) | |
5963 page_num = i + 1; | |
5964 else | |
5965 page_num = i; | |
5966 } | |
5967 else | |
5968 break; | |
5969 } | |
5970 } | |
5971 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5972 if (i == gaim_conv_window_get_conversation_count(win) + 1) |
4359 | 5973 return -1; |
5974 | |
5975 return page_num; | |
5976 } | |
5977 | |
5978 int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5979 gaim_gtkconv_get_dest_tab_at_xy(GaimConvWindow *win, int x, int y) |
4359 | 5980 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5981 GaimGtkWindow *gtkwin; |
4359 | 5982 GList *l; |
5983 gint nb_x, nb_y, x_rel, y_rel; | |
5984 GtkNotebook *notebook; | |
5985 GtkWidget *tab; | |
5986 gint i, page_num = 0; | |
5987 | |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5988 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5989 return -1; |
5990 | |
5991 gtkwin = GAIM_GTK_WINDOW(win); | |
5992 notebook = GTK_NOTEBOOK(gtkwin->notebook); | |
5993 | |
5994 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
5995 x_rel = x - nb_x; | |
5996 y_rel = y - nb_y; | |
5997 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5998 for (l = gaim_conv_window_get_conversations(win), i = 0; |
4359 | 5999 l != NULL; |
6000 l = l->next, i++) { | |
6001 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6002 GaimConversation *conv = l->data; |
4359 | 6003 tab = GAIM_GTK_CONVERSATION(conv)->tab_label; |
6004 | |
6005 if (!GTK_WIDGET_MAPPED(tab)) | |
6006 continue; | |
6007 | |
6008 if (gtk_notebook_get_tab_pos(notebook) == GTK_POS_TOP || | |
6009 gtk_notebook_get_tab_pos(notebook) == GTK_POS_BOTTOM) { | |
6010 | |
6011 if (tab->allocation.x <= x_rel) { | |
6012 if (tab->allocation.x + (tab->allocation.width / 2) <= x_rel) | |
6013 page_num = i + 1; | |
6014 else | |
6015 page_num = i; | |
6016 } | |
6017 else | |
6018 break; | |
6019 } | |
6020 else { | |
6021 if (tab->allocation.y <= y_rel) { | |
6022 if (tab->allocation.y + (tab->allocation.height / 2) <= y_rel) | |
6023 page_num = i + 1; | |
6024 else | |
6025 page_num = i; | |
6026 } | |
6027 else | |
6028 break; | |
6029 } | |
6030 } | |
6031 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
6032 if (i == gaim_conv_window_get_conversation_count(win) + 1) |
4359 | 6033 return -1; |
6034 | |
6035 return page_num; | |
6036 } | |
4940
3708545afe42
[gaim-migrate @ 5274]
Christian Hammond <chipx86@chipx86.com>
parents:
4939
diff
changeset
|
6037 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6038 static void |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6039 escape_closes_pref_cb(const char *name, GaimPrefType type, gpointer value, |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6040 gpointer data) |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6041 { |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6042 if (value) |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6043 gtk_accel_map_change_entry(N_("<main>/Conversation/Close"), |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6044 GDK_Escape, 0, TRUE); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6045 else |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6046 gtk_accel_map_change_entry(N_("<main>/Conversation/Close"), |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6047 GDK_W, GDK_CONTROL_MASK, TRUE); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6048 } |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6049 |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6050 static void |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6051 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
|
6052 gpointer data) |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6053 { |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6054 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6055 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6056 GaimGtkConversation *gtkconv; |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6057 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6058 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6059 conv = (GaimConversation *)l->data; |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6060 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6061 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6062 continue; |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6063 |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6064 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6065 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6066 if (value) |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6067 gtk_widget_show(gtkconv->close); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6068 else |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6069 gtk_widget_hide(gtkconv->close); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6070 } |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6071 } |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6072 |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6073 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6074 show_timestamps_pref_cb(const char *name, GaimPrefType type, gpointer value, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6075 gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6076 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6077 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6078 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6079 GaimGtkConversation *gtkconv; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6080 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6081 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6082 conv = (GaimConversation *)l->data; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6083 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6084 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6085 continue; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6086 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6087 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6088 |
7386 | 6089 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
|
6090 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6091 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6092 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6093 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6094 spellcheck_pref_cb(const char *name, GaimPrefType type, gpointer value, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6095 gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6096 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6097 #ifdef USE_GTKSPELL |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6098 GList *cl; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6099 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6100 GaimGtkConversation *gtkconv; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6101 GtkSpell *spell; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6102 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6103 for (cl = gaim_get_conversations(); cl != NULL; cl = cl->next) { |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
6104 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6105 conv = (GaimConversation *)cl->data; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6106 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6107 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6108 continue; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6109 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6110 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6111 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6112 if (value) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
6113 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6114 else { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6115 spell = gtkspell_get_from_text_view(GTK_TEXT_VIEW(gtkconv->entry)); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6116 gtkspell_detach(spell); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6117 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6118 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6119 #endif |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6120 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6121 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6122 static void |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6123 tab_side_pref_cb(const char *name, GaimPrefType type, gpointer value, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6124 gpointer data) |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6125 { |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6126 GList *l; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6127 GtkPositionType pos; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
6128 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6129 GaimGtkWindow *gtkwin; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6130 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6131 pos = GPOINTER_TO_INT(value); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6132 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6133 for (l = gaim_get_windows(); l != NULL; l = l->next) { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
6134 win = (GaimConvWindow *)l->data; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6135 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6136 if (!GAIM_IS_GTK_WINDOW(win)) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6137 continue; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6138 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6139 gtkwin = GAIM_GTK_WINDOW(win); |
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 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6142 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6143 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6144 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6145 static void |
8456 | 6146 html_shortcuts_pref_cb(const char *name, GaimPrefType type, |
6147 gpointer value, gpointer data) | |
6148 { | |
6149 GList *l; | |
6150 GaimConversation *conv; | |
6151 GaimGtkConversation *gtkconv; | |
9487 | 6152 |
8456 | 6153 for(l = gaim_get_conversations(); l != NULL; l = l->next) { |
6154 conv = (GaimConversation *)l->data; | |
9487 | 6155 |
8456 | 6156 if(!GAIM_IS_GTK_CONVERSATION(conv)) |
6157 continue; | |
9487 | 6158 |
8456 | 6159 gtkconv = GAIM_GTK_CONVERSATION(conv); |
9487 | 6160 |
8456 | 6161 gtk_imhtml_html_shortcuts(GTK_IMHTML(gtkconv->entry), |
6162 (gboolean)GPOINTER_TO_INT(value)); | |
6163 } | |
6164 } | |
6165 | |
6166 static void | |
6167 smiley_shortcuts_pref_cb(const char *name, GaimPrefType type, | |
6168 gpointer value, gpointer data) | |
6169 { | |
6170 GList *l; | |
6171 GaimConversation *conv; | |
6172 GaimGtkConversation *gtkconv; | |
9487 | 6173 |
8456 | 6174 for(l = gaim_get_conversations(); l != NULL; l = l->next) { |
6175 conv = (GaimConversation *)l->data; | |
9487 | 6176 |
8456 | 6177 if(!GAIM_IS_GTK_CONVERSATION(conv)) |
6178 continue; | |
9487 | 6179 |
8456 | 6180 gtkconv = GAIM_GTK_CONVERSATION(conv); |
9487 | 6181 |
6182 gtk_imhtml_smiley_shortcuts(GTK_IMHTML(gtkconv->entry), | |
8456 | 6183 (gboolean)GPOINTER_TO_INT(value)); |
6184 } | |
6185 } | |
6186 | |
6187 static void | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6188 show_formatting_toolbar_pref_cb(const char *name, GaimPrefType type, |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6189 gpointer value, gpointer data) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6190 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6191 GList *l; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6192 GaimConversation *conv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6193 GaimGtkConversation *gtkconv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6194 GaimConvWindow *win; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6195 GaimGtkWindow *gtkwin; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6196 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6197 for (l = gaim_get_conversations(); l != NULL; l = l->next) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6198 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6199 conv = (GaimConversation *)l->data; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6200 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6201 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6202 continue; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6203 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6204 gtkconv = GAIM_GTK_CONVERSATION(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6205 win = gaim_conversation_get_window(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6206 gtkwin = GAIM_GTK_WINDOW(win); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6207 |
7386 | 6208 gtkconv->show_formatting_toolbar = (gboolean)GPOINTER_TO_INT(value); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6209 gtk_check_menu_item_set_active( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6210 GTK_CHECK_MENU_ITEM(gtkwin->menu.show_formatting_toolbar), |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6211 gtkconv->show_formatting_toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6212 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6213 if (gtkconv->show_formatting_toolbar) |
8317 | 6214 gtk_widget_show(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6215 else |
8317 | 6216 gtk_widget_hide(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6217 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6218 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6219 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6220 static void |
9150 | 6221 button_type_pref_cb(const char *name, GaimPrefType type, |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6222 gpointer value, gpointer data) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6223 { |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6224 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6225 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6226 GaimGtkConversation *gtkconv; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6227 |
9150 | 6228 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6229 conv = (GaimConversation *)l->data; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6230 gtkconv = GAIM_GTK_CONVERSATION(conv); |
9150 | 6231 switch (conv->type) { |
6232 case GAIM_CONV_IM: | |
9749 | 6233 setup_im_buttons(conv, gtkconv->bbox); |
9150 | 6234 gaim_gtkconv_update_buddy_icon(conv); |
6235 break; | |
6236 case GAIM_CONV_CHAT: | |
9749 | 6237 setup_chat_buttons(conv, gtkconv->bbox); |
9150 | 6238 break; |
6239 default: | |
6240 break; | |
6241 } | |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6242 } |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6243 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6244 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6245 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6246 animate_buddy_icons_pref_cb(const char *name, GaimPrefType type, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6247 gpointer value, gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6248 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6249 GList *l; |
8189 | 6250 GaimConversation *conv; |
6251 GaimGtkConversation *gtkconv; | |
6252 GaimConvWindow *win; | |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6253 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6254 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
|
6255 return; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6256 |
8189 | 6257 /* Set the "animate" flag for each icon based on the new preference */ |
6258 for (l = gaim_get_ims(); l != NULL; l = l->next) { | |
6259 conv = (GaimConversation *)l->data; | |
6260 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
6261 gtkconv->u.im->animate = (gboolean)value; | |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6262 } |
8189 | 6263 |
6264 /* Now either stop or start animation for the active conversation in each window */ | |
6265 for (l = gaim_get_windows(); l != NULL; l = l->next) { | |
6266 win = (GaimConvWindow *)l->data; | |
6267 conv = gaim_conv_window_get_active_conversation(win); | |
6268 gaim_gtkconv_update_buddy_icon(conv); | |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6269 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6270 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6271 |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6272 static void |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6273 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
|
6274 gpointer data) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6275 { |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6276 GList *l; |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6277 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6278 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6279 GaimConversation *conv = l->data; |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6280 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6281 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6282 gaim_conversation_foreach(gaim_gtkconv_update_buddy_icon); |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6283 } |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6284 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6285 |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5680
diff
changeset
|
6286 static void |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6287 conv_placement_pref_cb(const char *name, GaimPrefType type, |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6288 gpointer value, gpointer data) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6289 { |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6290 GaimConvPlacementFunc func; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6291 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6292 if (strcmp(name, "/gaim/gtk/conversations/placement")) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6293 return; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6294 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6295 func = gaim_conv_placement_get_fnc(value); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6296 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6297 if (func == NULL) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6298 return; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6299 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6300 gaim_conv_placement_set_current_func(func); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6301 } |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6302 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6303 void * |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6304 gaim_gtk_conversations_get_handle(void) |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6305 { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6306 static int handle; |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6307 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6308 return &handle; |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6309 } |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6310 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6311 void |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
6312 gaim_gtk_conversations_init(void) |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6313 { |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6314 void *handle = gaim_gtk_conversations_get_handle(); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6315 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6316 /* Conversations */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6317 gaim_prefs_add_none("/gaim/gtk/conversations"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6318 gaim_prefs_add_bool("/gaim/gtk/conversations/close_on_tabs", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6319 gaim_prefs_add_bool("/gaim/gtk/conversations/ctrl_enter_sends", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6320 gaim_prefs_add_bool("/gaim/gtk/conversations/enter_sends", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6321 gaim_prefs_add_bool("/gaim/gtk/conversations/escape_closes", FALSE); |
9025 | 6322 gaim_prefs_add_bool("/gaim/gtk/conversations/send_formatting", FALSE); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6323 gaim_prefs_add_bool("/gaim/gtk/conversations/send_bold", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6324 gaim_prefs_add_bool("/gaim/gtk/conversations/send_italic", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6325 gaim_prefs_add_bool("/gaim/gtk/conversations/send_underline", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6326 gaim_prefs_add_bool("/gaim/gtk/conversations/show_timestamps", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6327 gaim_prefs_add_bool("/gaim/gtk/conversations/spellcheck", TRUE); |
9049 | 6328 #if 1 |
6329 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_colors", FALSE); | |
6330 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_fonts", FALSE); | |
6331 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_font_sizes", FALSE); | |
6332 #else | |
8944 | 6333 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_formatting", FALSE); |
9049 | 6334 #endif |
9572 | 6335 gaim_prefs_add_bool("/gaim/gtk/conversations/html_shortcuts", TRUE); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6336 gaim_prefs_add_bool("/gaim/gtk/conversations/smiley_shortcuts", FALSE); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6337 gaim_prefs_add_bool("/gaim/gtk/conversations/show_formatting_toolbar", TRUE); |
9832 | 6338 gaim_prefs_add_bool("/gaim/gtk/conversations/passthrough_unknown_commands", FALSE); |
9130 | 6339 |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6340 gaim_prefs_add_string("/gaim/gtk/conversations/placement", "last"); |
8998 | 6341 gaim_prefs_add_int("/gaim/gtk/conversations/placement_number", 1); |
9025 | 6342 gaim_prefs_add_string("/gaim/gtk/conversations/bgcolor", ""); |
6343 gaim_prefs_add_string("/gaim/gtk/conversations/fgcolor", ""); | |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6344 gaim_prefs_add_string("/gaim/gtk/conversations/font_face", ""); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6345 gaim_prefs_add_int("/gaim/gtk/conversations/font_size", 3); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6346 gaim_prefs_add_bool("/gaim/gtk/conversations/tabs", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6347 gaim_prefs_add_int("/gaim/gtk/conversations/tab_side", GTK_POS_TOP); |
9150 | 6348 gaim_prefs_add_int("/gaim/gtk/conversations/button_type", |
6349 GAIM_BUTTON_TEXT_IMAGE); | |
6350 | |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6351 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6352 /* Conversations -> Chat */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6353 gaim_prefs_add_none("/gaim/gtk/conversations/chat"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6354 gaim_prefs_add_bool("/gaim/gtk/conversations/chat/color_nicks", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6355 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_width", 410); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6356 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_height", 160); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6357 gaim_prefs_add_int("/gaim/gtk/conversations/chat/entry_height", 50); |
9319 | 6358 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
|
6359 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6360 /* Conversations -> IM */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6361 gaim_prefs_add_none("/gaim/gtk/conversations/im"); |
9150 | 6362 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6363 gaim_prefs_add_bool("/gaim/gtk/conversations/im/animate_buddy_icons", TRUE); |
9150 | 6364 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6365 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_width", 410); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6366 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_height", 160); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6367 gaim_prefs_add_int("/gaim/gtk/conversations/im/entry_height", 50); |
9319 | 6368 gaim_prefs_add_bool("/gaim/gtk/conversations/im/raise_on_events", FALSE); |
6369 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
|
6370 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6371 /* Connect callbacks. */ |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6372 gaim_prefs_connect_callback("/gaim/gtk/conversations/escape_closes", |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6373 escape_closes_pref_cb, NULL); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6374 gaim_prefs_connect_callback("/gaim/gtk/conversations/close_on_tabs", |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6375 close_on_tabs_pref_cb, NULL); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6376 gaim_prefs_connect_callback("/gaim/gtk/conversations/show_timestamps", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6377 show_timestamps_pref_cb, NULL); |
8456 | 6378 gaim_prefs_connect_callback("/gaim/gtk/conversations/html_shortcuts", |
6379 html_shortcuts_pref_cb, NULL); | |
6380 gaim_prefs_connect_callback("/gaim/gtk/conversations/smiley_shortcuts", | |
6381 smiley_shortcuts_pref_cb, NULL); | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6382 gaim_prefs_connect_callback("/gaim/gtk/conversations/show_formatting_toolbar", |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6383 show_formatting_toolbar_pref_cb, NULL); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6384 gaim_prefs_connect_callback("/gaim/gtk/conversations/spellcheck", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6385 spellcheck_pref_cb, NULL); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6386 gaim_prefs_connect_callback("/gaim/gtk/conversations/tab_side", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6387 tab_side_pref_cb, NULL); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6388 |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6389 gaim_prefs_connect_callback("/gaim/gtk/conversations/placement", |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6390 conv_placement_pref_cb, NULL); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6391 gaim_prefs_trigger_callback("/gaim/gtk/conversations/placement"); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6392 |
9150 | 6393 gaim_prefs_connect_callback("/gaim/gtk/conversations/button_type", |
6394 button_type_pref_cb, NULL); | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
6395 |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6396 /* IM callbacks */ |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6397 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/animate_buddy_icons", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6398 animate_buddy_icons_pref_cb, NULL); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6399 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/show_buddy_icons", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6400 show_buddy_icons_pref_cb, NULL); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6401 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6402 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6403 /********************************************************************** |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6404 * Register signals |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6405 **********************************************************************/ |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6406 gaim_signal_register(handle, "conversation-drag-ended", |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6407 gaim_marshal_VOID__POINTER_POINTER, NULL, 2, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6408 gaim_value_new(GAIM_TYPE_SUBTYPE, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6409 GAIM_SUBTYPE_CONV_WINDOW), |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6410 gaim_value_new(GAIM_TYPE_SUBTYPE, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6411 GAIM_SUBTYPE_CONV_WINDOW)); |
9167 | 6412 |
6413 /********************************************************************** | |
6414 * Register commands | |
6415 **********************************************************************/ | |
9829 | 6416 gaim_cmd_register("say", "S", GAIM_CMD_P_DEFAULT, |
6417 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, | |
6418 say_command_cb, _("say <message>: Send a message normally as if you weren't using a command."), NULL); | |
9213 | 6419 gaim_cmd_register("me", "S", GAIM_CMD_P_DEFAULT, |
6420 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, | |
9597 | 6421 me_command_cb, _("me <action>: Send an IRC style action to a buddy or chat."), NULL); |
9213 | 6422 gaim_cmd_register("debug", "w", GAIM_CMD_P_DEFAULT, |
6423 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, | |
9597 | 6424 debug_command_cb, _("debug <option>: Send various debug information to the current conversation."), NULL); |
9213 | 6425 |
6426 gaim_cmd_register("help", "w", GAIM_CMD_P_DEFAULT, | |
9597 | 6427 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, NULL, |
6428 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
|
6429 } |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6430 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6431 void |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6432 gaim_gtk_conversations_uninit(void) |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6433 { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6434 gaim_signals_unregister_by_instance(gaim_gtk_conversations_get_handle()); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6435 } |