Mercurial > pidgin
annotate src/gtkconv.c @ 9582:fec83fb0b6a9
[gaim-migrate @ 10425]
It seems that nspr defines HAVE_LONG_LONG, just like we do, which is, you
know, a problem. Let's just undefine it before including their stuff. *sigh*
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Fri, 23 Jul 2004 19:56:27 +0000 |
parents | d066c21dcbef |
children | fe35f55ee984 |
rev | line source |
---|---|
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
1 /** |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
2 * @file gtkconv.h GTK+ Conversation API |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
3 * @ingroup gtkui |
4359 | 4 * |
8046 | 5 * Gaim is the legal property of its developers, whose names are too numerous |
6 * to list here. Please refer to the COPYRIGHT file distributed with this | |
7 * source distribution. | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
8 * |
4359 | 9 * This program is free software; you can redistribute it and/or modify |
10 * it under the terms of the GNU General Public License as published by | |
11 * the Free Software Foundation; either version 2 of the License, or | |
12 * (at your option) any later version. | |
13 * | |
14 * This program is distributed in the hope that it will be useful, | |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 * GNU General Public License for more details. | |
18 * | |
19 * You should have received a copy of the GNU General Public License | |
20 * along with this program; if not, write to the Free Software | |
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
22 * | |
23 */ | |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
24 #include "gtkinternal.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
25 |
4359 | 26 #ifndef _WIN32 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
27 # include <X11/Xlib.h> |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
28 #endif |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
29 |
4359 | 30 #ifdef USE_GTKSPELL |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
31 # include <gtkspell/gtkspell.h> |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
32 # ifdef _WIN32 |
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
33 # include "wspell.h" |
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
34 # endif |
4359 | 35 #endif |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
36 |
4359 | 37 #include <gdk/gdkkeysyms.h> |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
38 |
9130 | 39 #include "cmds.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
40 #include "debug.h" |
6982 | 41 #include "imgstore.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
42 #include "log.h" |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5402
diff
changeset
|
43 #include "notify.h" |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
44 #include "prefs.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
45 #include "prpl.h" |
6038 | 46 #include "request.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
47 #include "sound.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
48 #include "util.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
49 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
50 #include "dnd-hints.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
51 #include "gtkblist.h" |
5717 | 52 #include "gtkconv.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
53 #include "gtkimhtml.h" |
8317 | 54 #include "gtkimhtmltoolbar.h" |
7431 | 55 #include "gtklog.h" |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
56 #include "gtkpounce.h" |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
57 #include "gtkprivacy.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
58 #include "gtkutils.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
59 #include "stock.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
60 |
5717 | 61 #include "ui.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
62 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
63 /* XXX */ |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
64 #include "gaim.h" |
4359 | 65 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
66 #define AUTO_RESPONSE "<AUTO-REPLY> : " |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
67 |
7990 | 68 #define SEND_COLOR "#16569E" |
7855 | 69 #define RECV_COLOR "#A82F2F" |
7854 | 70 |
4359 | 71 static char nick_colors[][8] = { |
72 "#ba55d3", /* Medium Orchid */ | |
73 "#ee82ee", /* Violet */ | |
74 "#c715b4", /* Medium Violet Red */ | |
75 "#ff69b4", /* Hot Pink */ | |
76 "#ff6347", /* Tomato */ | |
77 "#fa8c00", /* Dark Orange */ | |
78 "#fa8072", /* Salmon */ | |
79 "#b22222", /* Fire Brick */ | |
80 "#f4a460", /* Sandy Brown */ | |
81 "#cd5c5c", /* Indian Red */ | |
82 "#bc8f8f", /* Rosy Brown */ | |
83 "#f0e68c", /* Khaki */ | |
84 "#bdb76b", /* Dark Khaki */ | |
85 "#228b22", /* Forest Green */ | |
86 "#9acd32", /* Yellow Green */ | |
87 "#32cd32", /* Lime Green */ | |
7755 | 88 "#3cb371", /* Medium Sea Green (Medium Sea Green?! What are we women?!) */ |
4359 | 89 "#2e8b57", /* Sea Green */ |
90 "#8fbc8f", /* Dark Sea Green */ | |
91 "#66cdaa", /* Medium Aquamarine */ | |
92 "#5f9ea0", /* Cadet Blue */ | |
93 "#48d1cc", /* Medium Turquoise */ | |
94 "#00ced1", /* Dark Turquoise */ | |
95 "#4682b4", /* Stell Blue */ | |
96 "#00bfff", /* Deep Sky Blue */ | |
97 "#1690ff", /* Dodger Blue */ | |
98 "#4169ff", /* Royal Blue */ | |
99 "#6a5acd", /* Slate Blue */ | |
100 "#6495ed", /* Cornflower Blue */ | |
101 "#708090", /* Slate gray */ | |
7995
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
102 "#2f4f4f", /* Dark Slate Gray */ |
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
103 "#ff8c00", /* Dark Orange */ |
8535 | 104 "#006400", /* DarkGreen */ |
105 "#8b4513", /* SaddleBrown */ | |
106 "#8b8989", /* snow4 */ | |
107 "#7d26cd", /* purple3 */ | |
4359 | 108 }; |
6291 | 109 |
4359 | 110 #define NUM_NICK_COLORS (sizeof(nick_colors) / sizeof(*nick_colors)) |
111 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
112 typedef struct |
4359 | 113 { |
114 GtkWidget *window; | |
115 | |
116 GtkWidget *entry; | |
117 GtkWidget *message; | |
118 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
119 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
120 |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
121 } InviteBuddyInfo; |
4359 | 122 |
123 static GtkWidget *invite_dialog = NULL; | |
124 | |
125 /* Prototypes. <-- because Paco-Paco hates this comment. */ | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
126 static void got_typing_keypress(GaimConversation *conv, gboolean first); |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
127 static GList *generate_invite_user_names(GaimConnection *gc); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
128 static void add_chat_buddy_common(GaimConversation *conv, |
9554 | 129 const char *name); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
130 static void tab_complete(GaimConversation *conv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
131 static void update_typing_icon(GaimConversation *conv); |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
132 static gboolean update_send_as_selection(GaimConvWindow *win); |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
133 static char *item_factory_translate_func (const char *path, gpointer func_data); |
4359 | 134 |
135 /************************************************************************** | |
136 * Callbacks | |
137 **************************************************************************/ | |
138 static gint | |
139 close_win_cb(GtkWidget *w, GdkEventAny *e, gpointer d) | |
140 { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
141 GaimConvWindow *win = (GaimConvWindow *)d; |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
142 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
143 gaim_conv_window_destroy(win); |
4361
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
144 |
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
145 return TRUE; |
4359 | 146 } |
147 | |
148 static gint | |
149 close_conv_cb(GtkWidget *w, gpointer d) | |
150 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
151 GaimConversation *conv = (GaimConversation *)d; |
4359 | 152 |
153 gaim_conversation_destroy(conv); | |
4361
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
154 |
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
155 return TRUE; |
4359 | 156 } |
157 | |
8914 | 158 static gboolean |
159 size_allocate_cb(GtkWidget *w, GtkAllocation *allocation, GaimConversation *conv) | |
160 { | |
161 GaimGtkConversation *gtkconv; | |
9048 | 162 GaimConvWindow *win = gaim_conversation_get_window(conv); |
9459 | 163 gboolean saveheight; |
8914 | 164 |
165 if (!GTK_WIDGET_VISIBLE(w)) | |
166 return FALSE; | |
167 | |
168 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
169 return FALSE; | |
170 | |
171 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
172 | |
9459 | 173 /* we only save the new height if the formatting toolbar visibility matches the pref */ |
174 saveheight = (gtkconv->show_formatting_toolbar == gaim_prefs_get_bool("/gaim/gtk/conversations/show_formatting_toolbar")); | |
175 | |
9048 | 176 /* I find that I resize the window when it has a bunch of conversations in it, mostly so that the tab bar |
177 * will fit, but then I don't want new windows taking up the entire screen. I check to see if there is only one | |
178 * conversation in the window. This way we'll be setting new windows to the size of the last resized new window. */ | |
179 | |
8914 | 180 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
181 { | |
9048 | 182 if (w == gtkconv->sw && (gaim_conv_window_get_conversation_count(win) == 1)) |
8914 | 183 { |
184 gaim_prefs_set_int("/gaim/gtk/conversations/im/default_width", allocation->width); | |
9459 | 185 if (saveheight) |
186 gaim_prefs_set_int("/gaim/gtk/conversations/im/default_height", allocation->height); | |
8914 | 187 } |
188 if (w == gtkconv->entry) | |
189 gaim_prefs_set_int("/gaim/gtk/conversations/im/entry_height", allocation->height); | |
190 } | |
191 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
192 { | |
9048 | 193 if (w == gtkconv->sw && (gaim_conv_window_get_conversation_count(win) == 1)) |
8914 | 194 { |
195 gaim_prefs_set_int("/gaim/gtk/conversations/chat/default_width", allocation->width); | |
9459 | 196 if (saveheight) |
197 gaim_prefs_set_int("/gaim/gtk/conversations/chat/default_height", allocation->height); | |
8914 | 198 } |
199 if (w == gtkconv->entry) | |
200 gaim_prefs_set_int("/gaim/gtk/conversations/chat/entry_height", allocation->height); | |
201 } | |
202 | |
203 return FALSE; | |
204 } | |
205 | |
7446
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
206 /* Courtesy of Galeon! */ |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
207 static void |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
208 tab_close_button_state_changed_cb(GtkWidget *widget, GtkStateType prev_state) |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
209 { |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
210 if (GTK_WIDGET_STATE(widget) == GTK_STATE_ACTIVE) |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
211 gtk_widget_set_state(widget, GTK_STATE_NORMAL); |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
212 } |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
213 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
214 static void |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
215 default_formatize(GaimConversation *conv) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
216 { |
8061 | 217 GaimGtkConversation *c = GAIM_GTK_CONVERSATION(conv); |
218 GaimConnection *gc = gaim_conversation_get_gc(conv); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
219 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
220 if (gc && gc->flags & GAIM_CONNECTION_HTML) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
221 { |
9025 | 222 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_formatting")) |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
223 { |
9025 | 224 char *color; |
225 GdkColor fg_color, bg_color; | |
226 | |
227 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold")) | |
228 gtk_imhtml_toggle_bold(GTK_IMHTML(c->entry)); | |
229 | |
230 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic")) | |
231 gtk_imhtml_toggle_italic(GTK_IMHTML(c->entry)); | |
232 | |
233 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline")) | |
234 gtk_imhtml_toggle_underline(GTK_IMHTML(c->entry)); | |
235 | |
236 gtk_imhtml_toggle_fontface(GTK_IMHTML(c->entry), | |
237 gaim_prefs_get_string("/gaim/gtk/conversations/font_face")); | |
238 | |
239 if (!(gc->flags & GAIM_CONNECTION_NO_FONTSIZE)) | |
240 gtk_imhtml_font_set_size(GTK_IMHTML(c->entry), | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
241 gaim_prefs_get_int("/gaim/gtk/conversations/font_size")); |
9025 | 242 |
243 if(strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"), "") != 0) | |
244 { | |
245 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"), | |
246 &fg_color); | |
247 color = g_strdup_printf("#%02x%02x%02x", | |
248 fg_color.red / 256, | |
249 fg_color.green / 256, | |
250 fg_color.blue / 256); | |
251 } | |
252 else | |
253 color = g_strdup(""); | |
254 | |
8061 | 255 gtk_imhtml_toggle_forecolor(GTK_IMHTML(c->entry), color); |
256 g_free(color); | |
9025 | 257 |
258 if(!(gc->flags & GAIM_CONNECTION_NO_BGCOLOR) && | |
259 strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), "") != 0) | |
260 { | |
261 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), | |
262 &bg_color); | |
263 color = g_strdup_printf("#%02x%02x%02x", | |
264 bg_color.red / 256, | |
265 bg_color.green / 256, | |
266 bg_color.blue / 256); | |
267 } | |
268 else | |
269 color = g_strdup(""); | |
270 | |
8061 | 271 gtk_imhtml_toggle_backcolor(GTK_IMHTML(c->entry), color); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
272 g_free(color); |
8061 | 273 } |
8677 | 274 |
9025 | 275 |
8677 | 276 if (gc->flags & GAIM_CONNECTION_FORMATTING_WBFO) |
277 gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(c->entry), TRUE); | |
278 else | |
279 gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(c->entry), FALSE); | |
8061 | 280 } |
281 } | |
9130 | 282 |
283 static const char * | |
284 gaim_gtk_get_cmd_prefix(void) | |
285 { | |
286 return "/"; | |
287 } | |
288 | |
9167 | 289 static GaimCmdRet |
290 me_command_cb(GaimConversation *conv, | |
291 const char *cmd, char **args, char **error) | |
292 { | |
293 char *tmp; | |
294 | |
295 tmp = g_strdup_printf("/me %s", args[0]); | |
9175 | 296 |
9167 | 297 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
298 gaim_conv_im_send(GAIM_CONV_IM(conv), tmp); | |
299 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
300 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), tmp); | |
301 | |
302 g_free(tmp); | |
303 return GAIM_CMD_RET_OK; | |
304 } | |
305 | |
9212 | 306 static GaimCmdRet |
307 debug_command_cb(GaimConversation *conv, | |
308 const char *cmd, char **args, char **error) | |
309 { | |
310 char *tmp, *markup; | |
311 GaimCmdStatus status; | |
312 | |
313 if (!g_ascii_strcasecmp(args[0], "version")) { | |
314 tmp = g_strdup_printf(_("me is using Gaim v%s."), VERSION); | |
315 markup = gaim_escape_html(tmp); | |
316 | |
317 status = gaim_cmd_do_command(conv, tmp, markup, error); | |
318 | |
319 g_free(tmp); | |
320 g_free(markup); | |
321 return status; | |
322 } else { | |
323 gaim_conversation_write(conv, NULL, _("Supported debug options are: version"), | |
324 GAIM_MESSAGE_NO_LOG|GAIM_MESSAGE_ERROR, time(NULL)); | |
325 return GAIM_CMD_STATUS_OK; | |
326 } | |
327 } | |
328 | |
9213 | 329 static GaimCmdRet |
330 help_command_cb(GaimConversation *conv, | |
331 const char *cmd, char **args, char **error) | |
332 { | |
333 GString *s; | |
334 GList *cmds, *l; | |
335 | |
336 s = g_string_new(_("Use \"/help <command>\" for help on a specific command.\n" | |
337 "The following commands are available in this context:\n")); | |
338 | |
339 cmds = gaim_cmd_list(conv); | |
340 for (l = cmds; l; l = l->next) | |
341 if (l->next) | |
342 g_string_append_printf(s, "%s, ", (char *)l->data); | |
343 else | |
344 g_string_append_printf(s, "%s.", (char *)l->data); | |
345 | |
346 gaim_conversation_write(conv, NULL, s->str, GAIM_MESSAGE_NO_LOG, time(NULL)); | |
347 g_string_free(s, TRUE); | |
348 g_list_free(cmds); | |
349 | |
350 return GAIM_CMD_STATUS_OK; | |
351 } | |
352 | |
353 static GaimCmdRet | |
354 help_arg_command_cb(GaimConversation *conv, | |
355 const char *cmd, char **args, char **error) | |
356 { | |
357 GList *help, *l; | |
358 GString *s; | |
359 | |
360 s = g_string_new(""); | |
361 help = gaim_cmd_help(conv, args[0]); | |
362 | |
363 if (help) { | |
364 for (l = help; l; l = l->next) | |
365 if (l->next) | |
9247 | 366 g_string_append_printf(s, "/%s\n", (char *)l->data); |
9213 | 367 else |
9247 | 368 g_string_append_printf(s, "/%s", (char *)l->data); |
9213 | 369 } else { |
370 g_string_append(s, _("No such command (in this context).")); | |
371 } | |
372 | |
373 gaim_conversation_write(conv, NULL, s->str, GAIM_MESSAGE_NO_LOG, time(NULL)); | |
374 g_string_free(s, TRUE); | |
375 g_list_free(help); | |
376 | |
377 return GAIM_CMD_STATUS_OK; | |
378 } | |
379 | |
4359 | 380 static void |
9374 | 381 send_history_add(GaimConversation *conv, const char *message) |
382 { | |
383 GList *first; | |
384 | |
385 first = g_list_first(conv->send_history); | |
386 | |
387 if (first->data) | |
388 g_free(first->data); | |
389 | |
390 first->data = g_strdup(message); | |
391 | |
392 conv->send_history = g_list_prepend(first, NULL); | |
393 } | |
394 | |
395 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
396 send_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 397 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
398 GaimGtkConversation *gtkconv; |
9130 | 399 char *cmd; |
400 const char *prefix; | |
8655 | 401 GaimAccount *account; |
8677 | 402 GaimConnection *gc; |
8448 | 403 char *buf, *clean; |
4359 | 404 |
405 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
8655 | 406 account = gaim_conversation_get_account(conv); |
9130 | 407 prefix = gaim_gtk_get_cmd_prefix(); |
408 | |
9471 | 409 if (!gaim_account_is_connected(account)) |
410 return; | |
411 | |
9474 | 412 if ((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) && |
413 gaim_conv_chat_has_left(GAIM_CONV_CHAT(conv))) | |
9471 | 414 return; |
415 | |
9130 | 416 if(gaim_prefs_get_bool("/gaim/gtk/conversations/enable_commands")) { |
417 cmd = gtk_imhtml_get_text(GTK_IMHTML(gtkconv->entry), NULL, NULL); | |
418 if(cmd && (strncmp(cmd, prefix, strlen(prefix)) == 0)) { | |
419 GaimCmdStatus status; | |
9374 | 420 char *error, *cmdline, *markup, *send_history; |
9175 | 421 GtkTextIter start, end; |
9130 | 422 |
9374 | 423 send_history = gtk_imhtml_get_markup(GTK_IMHTML(gtkconv->entry)); |
424 send_history_add(conv, send_history); | |
425 g_free(send_history); | |
426 | |
9130 | 427 cmdline = cmd + strlen(prefix); |
9175 | 428 gtk_text_buffer_get_start_iter(GTK_IMHTML(gtkconv->entry)->text_buffer, &start); |
429 gtk_text_iter_forward_chars(&start, g_utf8_strlen(prefix, -1)); | |
430 gtk_text_buffer_get_end_iter(GTK_IMHTML(gtkconv->entry)->text_buffer, &end); | |
431 markup = gtk_imhtml_get_markup_range(GTK_IMHTML(gtkconv->entry), &start, &end); | |
432 status = gaim_cmd_do_command(conv, cmdline, markup, &error); | |
9130 | 433 g_free(cmd); |
9175 | 434 g_free(markup); |
9130 | 435 |
436 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); | |
437 default_formatize(conv); | |
438 | |
439 switch(status) { | |
440 case GAIM_CMD_STATUS_OK: | |
441 return; | |
442 case GAIM_CMD_STATUS_NOT_FOUND: | |
9212 | 443 gaim_conversation_write(conv, "", _("No such command. If you didn't mean " |
444 "to type a command, you can turn " | |
445 "commands off from Tools->" | |
446 "Preferences->Interface->Conversation" | |
447 "->Enable \"slash\" commands."), | |
9213 | 448 GAIM_MESSAGE_NO_LOG, time(NULL)); |
9130 | 449 return; |
450 case GAIM_CMD_STATUS_WRONG_ARGS: | |
9212 | 451 gaim_conversation_write(conv, "", _("Syntax Error: You typed the wrong number of arguments " |
452 "to that command. If you didn't mean to type a command, " | |
453 "you can turn commands off from Tools->Preferences->" | |
454 "Interface->Conversation->Enable \"slash\" commands."), | |
9213 | 455 GAIM_MESSAGE_NO_LOG, time(NULL)); |
9130 | 456 return; |
457 case GAIM_CMD_STATUS_FAILED: | |
9212 | 458 gaim_conversation_write(conv, "", error ? error : _("Your command failed for an unknown reason."), |
9213 | 459 GAIM_MESSAGE_NO_LOG, time(NULL)); |
9130 | 460 if(error) |
461 g_free(error); | |
462 return; | |
463 case GAIM_CMD_STATUS_WRONG_TYPE: | |
464 if(gaim_conversation_get_type(conv) == GAIM_CONV_IM) | |
465 gaim_conversation_write(conv, "", _("That command only works in Chats, not IMs."), | |
9213 | 466 GAIM_MESSAGE_NO_LOG, time(NULL)); |
9130 | 467 else |
468 gaim_conversation_write(conv, "", _("That command only works in IMs, not Chats."), | |
9213 | 469 GAIM_MESSAGE_NO_LOG, time(NULL)); |
9130 | 470 return; |
471 case GAIM_CMD_STATUS_WRONG_PRPL: | |
472 gaim_conversation_write(conv, "", _("That command doesn't work on this protocol."), | |
9213 | 473 GAIM_MESSAGE_NO_LOG, time(NULL)); |
9130 | 474 return; |
475 } | |
476 } | |
477 | |
478 g_free(cmd); | |
479 } | |
480 | |
8655 | 481 |
8442 | 482 buf = gtk_imhtml_get_markup(GTK_IMHTML(gtkconv->entry)); |
8962 | 483 clean = gtk_imhtml_get_text(GTK_IMHTML(gtkconv->entry), NULL, NULL); |
8448 | 484 |
4359 | 485 gtk_widget_grab_focus(gtkconv->entry); |
486 | |
8448 | 487 if (strlen(clean) == 0) { |
488 g_free(clean); | |
4359 | 489 return; |
490 } | |
491 | |
8677 | 492 gc = gaim_account_get_connection(account); |
493 if (gc && (gc->flags & GAIM_CONNECTION_NO_NEWLINES)) { | |
494 char **bufs; | |
495 int i; | |
496 | |
497 bufs = gtk_imhtml_get_markup_lines(GTK_IMHTML(gtkconv->entry)); | |
498 for (i = 0; bufs[i]; i++) { | |
9374 | 499 send_history_add(conv, bufs[i]); |
8677 | 500 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
501 gaim_conv_im_send(GAIM_CONV_IM(conv), bufs[i]); | |
502 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
503 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), bufs[i]); | |
504 } | |
505 | |
506 g_strfreev(bufs); | |
507 | |
508 } else { | |
9374 | 509 send_history_add(conv, buf); |
8677 | 510 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
511 gaim_conv_im_send(GAIM_CONV_IM(conv), buf); | |
512 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
513 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), buf); | |
514 } | |
4359 | 515 |
8677 | 516 g_free(clean); |
4359 | 517 g_free(buf); |
518 | |
8061 | 519 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); |
520 default_formatize(conv); | |
4359 | 521 } |
522 | |
523 static void | |
7928 | 524 add_remove_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 525 { |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
526 GaimAccount *account; |
4359 | 527 const char *name; |
528 | |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
529 account = gaim_conversation_get_account(conv); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
530 name = gaim_conversation_get_name(conv); |
7879 | 531 |
532 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
7859 | 533 GaimBuddy *b; |
534 | |
535 b = gaim_find_buddy(account, name); | |
536 if (b != NULL) | |
537 show_confirm_del(b); | |
538 else if (account != NULL && gaim_account_is_connected(account)) | |
539 gaim_blist_request_add_buddy(account, (char *)name, NULL, NULL); | |
7879 | 540 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
7859 | 541 GaimChat *c; |
542 | |
543 c = gaim_blist_find_chat(account, name); | |
544 if (c != NULL) | |
545 show_confirm_del_blist_chat(c); | |
546 else if (account != NULL && gaim_account_is_connected(account)) | |
547 gaim_blist_request_add_chat(account, NULL, NULL); | |
548 } | |
4359 | 549 |
550 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
551 } | |
552 | |
7975 | 553 static void chat_do_info(GaimConversation *conv, const char *who) |
554 { | |
555 GaimPluginProtocolInfo *prpl_info = NULL; | |
556 GaimConnection *gc; | |
557 | |
558 if ((gc = gaim_conversation_get_gc(conv))) { | |
559 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | |
560 | |
561 /* | |
562 * If there are special needs for getting info on users in | |
563 * buddy chat "rooms"... | |
564 */ | |
565 if (prpl_info->get_cb_info != NULL) | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
566 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
567 prpl_info->get_cb_info(gc, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
568 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
569 } |
7975 | 570 else |
571 prpl_info->get_info(gc, who); | |
572 } | |
573 } | |
574 | |
575 | |
4359 | 576 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
577 info_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 578 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
579 GaimGtkConversation *gtkconv; |
4359 | 580 |
581 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
582 | |
7879 | 583 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
584 serv_get_info(gaim_conversation_get_gc(conv), | |
585 gaim_conversation_get_name(conv)); | |
586 | |
587 gtk_widget_grab_focus(gtkconv->entry); | |
588 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
589 /* Get info of the person currently selected in the GtkTreeView */ | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
590 GaimGtkChatPane *gtkchat; |
4359 | 591 GtkTreeIter iter; |
592 GtkTreeModel *model; | |
593 GtkTreeSelection *sel; | |
9554 | 594 char *name; |
4359 | 595 |
596 gtkchat = gtkconv->u.chat; | |
597 | |
598 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | |
599 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); | |
600 | |
601 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) | |
9498 | 602 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &name, -1); |
4359 | 603 else |
604 return; | |
605 | |
7975 | 606 chat_do_info(conv, name); |
9554 | 607 g_free(name); |
4359 | 608 } |
609 } | |
610 | |
611 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
612 warn_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 613 { |
614 show_warn_dialog(gaim_conversation_get_gc(conv), | |
7879 | 615 gaim_conversation_get_name(conv)); |
4359 | 616 |
617 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
618 } | |
619 | |
620 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
621 block_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 622 { |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
623 GaimAccount *account; |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
624 |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
625 account = gaim_conversation_get_account(conv); |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
626 |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
627 if (account != NULL && gaim_account_is_connected(account)) |
6399
d726a36628e8
[gaim-migrate @ 6904]
Christian Hammond <chipx86@chipx86.com>
parents:
6398
diff
changeset
|
628 gaim_gtk_request_add_block(account, gaim_conversation_get_name(conv)); |
4359 | 629 |
630 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
631 } | |
632 | |
633 static void | |
9468 | 634 send_file_cb(GtkWidget *widget, GaimConversation *conv) |
635 { | |
636 serv_send_file(gaim_conversation_get_gc(conv), gaim_conversation_get_name(conv), NULL); | |
637 } | |
638 | |
639 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
640 do_invite(GtkWidget *w, int resp, InviteBuddyInfo *info) |
4359 | 641 { |
642 const char *buddy, *message; | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
643 GaimGtkConversation *gtkconv; |
4359 | 644 |
645 gtkconv = GAIM_GTK_CONVERSATION(info->conv); | |
646 | |
647 if (resp == GTK_RESPONSE_OK) { | |
648 buddy = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(info->entry)->entry)); | |
649 message = gtk_entry_get_text(GTK_ENTRY(info->message)); | |
650 | |
4793 | 651 if (!g_ascii_strcasecmp(buddy, "")) { |
4359 | 652 g_free(info); |
653 | |
654 return; | |
655 } | |
656 | |
657 serv_chat_invite(gaim_conversation_get_gc(info->conv), | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
658 gaim_conv_chat_get_id(GAIM_CONV_CHAT(info->conv)), |
4359 | 659 message, buddy); |
660 } | |
661 | |
662 gtk_widget_destroy(invite_dialog); | |
663 invite_dialog = NULL; | |
664 | |
665 g_free(info); | |
666 } | |
667 | |
668 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
669 invite_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 670 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
671 InviteBuddyInfo *info = NULL; |
4359 | 672 |
673 if (invite_dialog == NULL) { | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
674 GaimConnection *gc; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
675 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
676 GaimGtkWindow *gtkwin; |
4359 | 677 GtkWidget *label; |
678 GtkWidget *vbox, *hbox; | |
679 GtkWidget *table; | |
680 GtkWidget *img; | |
681 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
682 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
683 GTK_ICON_SIZE_DIALOG); |
4359 | 684 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
685 info = g_new0(InviteBuddyInfo, 1); |
4359 | 686 info->conv = conv; |
687 | |
688 gc = gaim_conversation_get_gc(conv); | |
689 win = gaim_conversation_get_window(conv); | |
690 gtkwin = GAIM_GTK_WINDOW(win); | |
691 | |
692 /* Create the new dialog. */ | |
693 invite_dialog = gtk_dialog_new_with_buttons( | |
7859 | 694 _("Invite Buddy Into Chat Room"), |
7879 | 695 GTK_WINDOW(gtkwin->window), 0, |
696 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, | |
9443
3584cdab1d0b
[gaim-migrate @ 10264]
Christian Hammond <chipx86@chipx86.com>
parents:
9374
diff
changeset
|
697 GAIM_STOCK_INVITE, GTK_RESPONSE_OK, NULL); |
4359 | 698 |
699 gtk_dialog_set_default_response(GTK_DIALOG(invite_dialog), | |
700 GTK_RESPONSE_OK); | |
701 gtk_container_set_border_width(GTK_CONTAINER(invite_dialog), 6); | |
702 gtk_window_set_resizable(GTK_WINDOW(invite_dialog), FALSE); | |
703 gtk_dialog_set_has_separator(GTK_DIALOG(invite_dialog), FALSE); | |
704 | |
705 /* Setup the outside spacing. */ | |
706 vbox = GTK_DIALOG(invite_dialog)->vbox; | |
707 | |
708 gtk_box_set_spacing(GTK_BOX(vbox), 12); | |
709 gtk_container_set_border_width(GTK_CONTAINER(vbox), 6); | |
710 | |
711 /* Setup the inner hbox and put the dialog's icon in it. */ | |
712 hbox = gtk_hbox_new(FALSE, 12); | |
713 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
714 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
715 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
716 | |
717 /* Setup the right vbox. */ | |
718 vbox = gtk_vbox_new(FALSE, 0); | |
719 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
720 | |
721 /* Put our happy label in it. */ | |
722 label = gtk_label_new(_("Please enter the name of the user you wish " | |
723 "to invite, along with an optional invite " | |
724 "message.")); | |
725 gtk_widget_set_size_request(label, 350, -1); | |
726 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
727 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
728 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
729 | |
730 /* hbox for the table, and to give it some spacing on the left. */ | |
731 hbox = gtk_hbox_new(FALSE, 6); | |
732 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
733 | |
734 /* Setup the table we're going to use to lay stuff out. */ | |
735 table = gtk_table_new(2, 2, FALSE); | |
736 gtk_table_set_row_spacings(GTK_TABLE(table), 6); | |
737 gtk_table_set_col_spacings(GTK_TABLE(table), 6); | |
738 gtk_container_set_border_width(GTK_CONTAINER(table), 12); | |
739 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); | |
740 | |
741 /* Now the Buddy label */ | |
742 label = gtk_label_new(NULL); | |
743 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Buddy:")); | |
744 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
745 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); | |
746 | |
747 /* Now the Buddy drop-down entry field. */ | |
748 info->entry = gtk_combo_new(); | |
749 gtk_combo_set_case_sensitive(GTK_COMBO(info->entry), FALSE); | |
750 gtk_entry_set_activates_default( | |
751 GTK_ENTRY(GTK_COMBO(info->entry)->entry), TRUE); | |
752 | |
753 gtk_table_attach_defaults(GTK_TABLE(table), info->entry, 1, 2, 0, 1); | |
754 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->entry); | |
755 | |
756 /* Fill in the names. */ | |
757 gtk_combo_set_popdown_strings(GTK_COMBO(info->entry), | |
758 generate_invite_user_names(gc)); | |
759 | |
760 | |
761 /* Now the label for "Message" */ | |
762 label = gtk_label_new(NULL); | |
763 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Message:")); | |
764 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
765 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); | |
766 | |
767 | |
768 /* And finally, the Message entry field. */ | |
769 info->message = gtk_entry_new(); | |
770 gtk_entry_set_activates_default(GTK_ENTRY(info->message), TRUE); | |
771 | |
772 gtk_table_attach_defaults(GTK_TABLE(table), info->message, 1, 2, 1, 2); | |
773 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->message); | |
774 | |
775 /* Connect the signals. */ | |
776 g_signal_connect(G_OBJECT(invite_dialog), "response", | |
777 G_CALLBACK(do_invite), info); | |
778 } | |
779 | |
780 gtk_widget_show_all(invite_dialog); | |
781 | |
782 if (info != NULL) | |
783 gtk_widget_grab_focus(GTK_COMBO(info->entry)->entry); | |
784 } | |
785 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
786 static void |
7748 | 787 menu_new_conv_cb(gpointer data, guint action, GtkWidget *widget) |
788 { | |
789 show_im_dialog(); | |
790 } | |
791 | |
792 static void | |
9504 | 793 savelog_writefile_cb(void *user_data, const char *filename) |
9489 | 794 { |
9504 | 795 GaimConversation *conv = (GaimConversation *)user_data; |
9489 | 796 FILE *fp; |
797 const char *name; | |
798 | |
799 if ((fp = fopen(filename, "w+")) == NULL) { | |
9504 | 800 gaim_notify_error(conv, NULL, _("Unable to open file."), NULL); |
9489 | 801 return; |
802 } | |
803 | |
804 name = gaim_conversation_get_name(conv); | |
805 fprintf(fp, _("<h1>Conversation with %s</h1>\n"), name); | |
806 fprintf(fp, "%s", conv->history->str); | |
807 fclose(fp); | |
808 } | |
809 | |
810 static void | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
811 menu_save_as_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
812 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
813 GaimConvWindow *win = (GaimConvWindow *)data; |
9489 | 814 GaimConversation *conv = gaim_conv_window_get_active_conversation(win); |
815 gchar *buf; | |
816 | |
817 buf = g_strdup_printf("%s.html", gaim_normalize(conv->account, conv->name)); | |
9504 | 818 |
819 gaim_request_file(conv, _("Save Conversation"), buf, TRUE, | |
820 G_CALLBACK(savelog_writefile_cb), NULL, conv); | |
9489 | 821 |
822 g_free(buf); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
823 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
824 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
825 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
826 menu_view_log_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
827 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
828 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
829 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
830 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
831 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
832 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
833 gaim_gtk_log_show((char *)gaim_conversation_get_name(conv), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
834 gaim_conversation_get_account(conv)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
835 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
836 |
8974 | 837 static void |
838 menu_clear_cb(gpointer data, guint action, GtkWidget *widget) | |
839 { | |
840 GaimConvWindow *win = (GaimConvWindow *)data; | |
841 GaimConversation *conv; | |
842 GaimGtkConversation *gtkconv; | |
843 | |
844 conv = gaim_conv_window_get_active_conversation(win); | |
845 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
846 | |
847 gtk_imhtml_clear(GTK_IMHTML(gtkconv->imhtml)); | |
848 g_string_free(conv->history, TRUE); | |
849 conv->history = g_string_new(""); | |
850 } | |
851 | |
7295 | 852 struct _search { |
853 GaimGtkConversation *gtkconv; | |
854 GtkWidget *entry; | |
855 }; | |
856 | |
7929 | 857 static void do_search_cb(GtkWidget *widget, gint resp, struct _search *s) |
7295 | 858 { |
7929 | 859 switch (resp) { |
860 case GTK_RESPONSE_OK: | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
861 gtk_imhtml_search_find(GTK_IMHTML(s->gtkconv->imhtml), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
862 gtk_entry_get_text(GTK_ENTRY(s->entry))); |
7929 | 863 break; |
864 | |
865 case GTK_RESPONSE_DELETE_EVENT: | |
866 case GTK_RESPONSE_CLOSE: | |
867 gtk_imhtml_search_clear(GTK_IMHTML(s->gtkconv->imhtml)); | |
868 gtk_widget_destroy(s->gtkconv->dialogs.search); | |
869 s->gtkconv->dialogs.search = NULL; | |
870 g_free(s); | |
871 break; | |
872 } | |
7295 | 873 } |
874 | |
875 static void | |
7751 | 876 menu_find_cb(gpointer data, guint action, GtkWidget *widget) |
7295 | 877 { |
878 GaimConvWindow *win = (GaimConvWindow *)data; | |
879 GaimConversation *conv = gaim_conv_window_get_active_conversation(win); | |
880 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); | |
881 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7929 | 882 GtkWidget *hbox; |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
883 GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
884 GTK_ICON_SIZE_DIALOG); |
7929 | 885 GtkWidget *label; |
7295 | 886 struct _search *s; |
887 | |
7798 | 888 if (gtkconv->dialogs.search) { |
889 gtk_window_present(GTK_WINDOW(gtkconv->dialogs.search)); | |
7295 | 890 return; |
7798 | 891 } |
7300
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
892 |
7295 | 893 s = g_malloc(sizeof(struct _search)); |
894 s->gtkconv = gtkconv; | |
7929 | 895 |
896 gtkconv->dialogs.search = gtk_dialog_new_with_buttons(_("Find"), | |
897 GTK_WINDOW(gtkwin->window), GTK_DIALOG_DESTROY_WITH_PARENT, | |
898 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, | |
899 GTK_STOCK_FIND, GTK_RESPONSE_OK, NULL); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
900 gtk_dialog_set_default_response(GTK_DIALOG(gtkconv->dialogs.search), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
901 GTK_RESPONSE_OK); |
7929 | 902 g_signal_connect(G_OBJECT(gtkconv->dialogs.search), "response", |
903 G_CALLBACK(do_search_cb), s); | |
904 | |
905 gtk_container_set_border_width(GTK_CONTAINER(gtkconv->dialogs.search), 6); | |
906 gtk_window_set_resizable(GTK_WINDOW(gtkconv->dialogs.search), FALSE); | |
907 gtk_dialog_set_has_separator(GTK_DIALOG(gtkconv->dialogs.search), FALSE); | |
908 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
|
909 gtk_container_set_border_width( |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
910 GTK_CONTAINER(GTK_DIALOG(gtkconv->dialogs.search)->vbox), 6); |
7929 | 911 |
912 hbox = gtk_hbox_new(FALSE, 12); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
913 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(gtkconv->dialogs.search)->vbox), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
914 hbox); |
7929 | 915 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); |
916 | |
917 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
918 gtk_dialog_set_response_sensitive(GTK_DIALOG(gtkconv->dialogs.search), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
919 GTK_RESPONSE_OK, FALSE); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
920 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
921 label = gtk_label_new(NULL); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
922 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Search for:")); |
7929 | 923 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
924 | |
925 s->entry = gtk_entry_new(); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
926 gtk_entry_set_activates_default(GTK_ENTRY(s->entry), TRUE); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
927 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(s->entry)); |
7929 | 928 g_signal_connect(G_OBJECT(s->entry), "changed", |
929 G_CALLBACK(gaim_gtk_set_sensitive_if_input), | |
930 gtkconv->dialogs.search); | |
931 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
|
932 |
7295 | 933 gtk_widget_show_all(gtkconv->dialogs.search); |
7929 | 934 gtk_widget_grab_focus(s->entry); |
7295 | 935 } |
936 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
937 static void |
9468 | 938 menu_send_file_cb(gpointer data, guint action, GtkWidget *widget) |
939 { | |
940 GaimConvWindow *win = (GaimConvWindow *)data; | |
941 GaimConversation *conv = gaim_conv_window_get_active_conversation(win); | |
942 | |
943 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
944 serv_send_file(gaim_conversation_get_gc(conv), gaim_conversation_get_name(conv), NULL); | |
945 } | |
946 | |
947 } | |
948 | |
949 static void | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
950 menu_add_pounce_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
951 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
952 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
953 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
954 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
955 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
956 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
957 gaim_gtkpounce_dialog_show(gaim_conversation_get_account(conv), |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
958 gaim_conversation_get_name(conv), NULL); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
959 } |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
960 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
961 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
962 menu_insert_link_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
963 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
964 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
965 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
966 GaimGtkConversation *gtkconv; |
8756 | 967 GtkIMHtmlToolbar *toolbar; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
968 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
969 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
970 gtkconv = GAIM_GTK_CONVERSATION(conv); |
8756 | 971 toolbar = GTK_IMHTMLTOOLBAR(gtkconv->toolbar); |
972 | |
973 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->link), | |
974 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->link))); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
975 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
976 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
977 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
978 menu_insert_image_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
979 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
980 GaimConvWindow *win = (GaimConvWindow *)data; |
8756 | 981 GaimConversation *conv; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
982 GaimGtkConversation *gtkconv; |
8756 | 983 GtkIMHtmlToolbar *toolbar; |
984 | |
985 conv = gaim_conv_window_get_active_conversation(win); | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
986 gtkconv = GAIM_GTK_CONVERSATION(gaim_conv_window_get_active_conversation(win)); |
8756 | 987 toolbar = GTK_IMHTMLTOOLBAR(gtkconv->toolbar); |
988 | |
989 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->image), | |
990 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->image))); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
991 } |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
992 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
993 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
994 menu_alias_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
995 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
996 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
997 GaimConversation *conv; |
7879 | 998 GaimAccount *account; |
999 const char *name; | |
1000 | |
1001 conv = gaim_conv_window_get_active_conversation(win); | |
1002 account = gaim_conversation_get_account(conv); | |
1003 name = gaim_conversation_get_name(conv); | |
1004 | |
1005 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
1006 GaimBuddy *b; | |
1007 | |
1008 b = gaim_find_buddy(account, name); | |
1009 if (b != NULL) | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1010 alias_dialog_bud(b); |
7879 | 1011 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
1012 GaimChat *c; | |
1013 | |
1014 c = gaim_blist_find_chat(account, name); | |
1015 if (c != NULL) | |
1016 alias_dialog_blist_chat(c); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1017 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1018 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1019 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1020 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1021 menu_get_info_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1022 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1023 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1024 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1025 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1026 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1027 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1028 info_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1029 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1030 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1031 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1032 menu_invite_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1033 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1034 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1035 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1036 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1037 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1038 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1039 invite_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1040 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1041 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1042 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1043 menu_warn_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1044 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1045 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1046 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1047 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1048 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1049 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1050 warn_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1051 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1052 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1053 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1054 menu_block_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1055 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1056 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1057 GaimConversation *conv; |
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 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1060 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1061 block_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1062 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1063 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1064 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1065 menu_add_remove_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1066 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1067 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1068 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1069 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1070 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1071 |
7928 | 1072 add_remove_cb(NULL, conv); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1073 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1074 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1075 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1076 menu_close_conv_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1077 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1078 GaimConvWindow *win = (GaimConvWindow *)data; |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1079 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1080 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
|
1081 } |
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 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1084 menu_logging_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1085 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1086 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1087 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1088 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1089 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1090 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1091 if (conv == NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1092 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1093 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1094 gaim_conversation_set_logging(conv, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1095 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1096 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1097 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1098 static void |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1099 menu_toolbar_cb(gpointer data, guint action, GtkWidget *widget) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1100 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1101 GaimConvWindow *win = (GaimConvWindow *)data; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1102 GaimConversation *conv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1103 GaimGtkConversation *gtkconv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1104 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1105 conv = gaim_conv_window_get_active_conversation(win); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1106 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1107 if (conv == NULL) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1108 return; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1109 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1110 gtkconv = GAIM_GTK_CONVERSATION(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1111 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1112 gtkconv->show_formatting_toolbar = |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1113 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1114 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1115 if (gtkconv->show_formatting_toolbar) |
8317 | 1116 gtk_widget_show(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1117 else |
8317 | 1118 gtk_widget_hide(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1119 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1120 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1121 static void |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1122 menu_sounds_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1123 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1124 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1125 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1126 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1127 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1128 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1129 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1130 if (!conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1131 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1132 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1133 gtkconv = GAIM_GTK_CONVERSATION(conv); |
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 gtkconv->make_sound = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1136 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); |
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 |
7961 | 1139 static void |
9188 | 1140 menu_timestamps_cb(gpointer data, guint action, GtkWidget *widget) |
1141 { | |
1142 GaimConvWindow *win = (GaimConvWindow *)data; | |
1143 GaimConversation *conv; | |
1144 GaimGtkConversation *gtkconv; | |
1145 | |
1146 conv = gaim_conv_window_get_active_conversation(win); | |
1147 | |
1148 if (!conv) | |
1149 return; | |
1150 | |
1151 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1152 | |
1153 gtkconv->show_timestamps = | |
1154 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); | |
1155 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
1156 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))); | |
1157 } | |
1158 | |
1159 static void | |
7961 | 1160 chat_do_im(GaimConversation *conv, const char *who) |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1161 { |
7961 | 1162 GaimPluginProtocolInfo *prpl_info = NULL; |
1163 char *real_who; | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1164 GaimConversation *conv2; |
7961 | 1165 GaimAccount *account; |
1166 | |
1167 account = gaim_conversation_get_account(conv); | |
1168 | |
1169 if(account && account->gc) | |
1170 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl); | |
1171 | |
1172 if(prpl_info && prpl_info->get_cb_real_name) | |
1173 real_who = prpl_info->get_cb_real_name(account->gc, | |
1174 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); | |
1175 else | |
1176 real_who = g_strdup(who); | |
1177 | |
1178 if(!real_who) | |
1179 return; | |
1180 | |
1181 conv2 = gaim_find_conversation_with_account(real_who, account); | |
1182 | |
1183 if (conv2 != NULL) | |
1184 gaim_conv_window_show(gaim_conversation_get_window(conv2)); | |
1185 else | |
1186 conv2 = gaim_conversation_new(GAIM_CONV_IM, account, real_who); | |
1187 | |
1188 g_free(real_who); | |
1189 } | |
1190 | |
1191 | |
1192 static void | |
1193 chat_im_button_cb(GtkWidget *widget, GaimConversation *conv) | |
1194 { | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1195 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1196 GaimGtkChatPane *gtkchat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1197 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1198 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1199 GtkTreeSelection *sel; |
9554 | 1200 char *name; |
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 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1203 gtkchat = gtkconv->u.chat; |
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 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1206 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); |
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 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) |
9498 | 1209 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
|
1210 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1211 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1212 |
7961 | 1213 chat_do_im(conv, name); |
9554 | 1214 g_free(name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1215 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1216 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1217 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1218 ignore_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1219 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1220 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1221 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1222 GaimConvChat *chat; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1223 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1224 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1225 GtkTreeSelection *sel; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1226 const char *name; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1227 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1228 chat = GAIM_CONV_CHAT(conv); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1229 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1230 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1231 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1232 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1233 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1234 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1235 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) { |
9498 | 1236 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
|
1237 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1238 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1239 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1240 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1241 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1242 if (gaim_conv_chat_is_user_ignored(chat, name)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1243 gaim_conv_chat_unignore(chat, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1244 else |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1245 gaim_conv_chat_ignore(chat, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1246 |
9554 | 1247 add_chat_buddy_common(conv, name); |
5908
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 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1250 static void |
7398 | 1251 menu_chat_im_cb(GtkWidget *w, GaimConversation *conv) |
1252 { | |
1253 const char *who = g_object_get_data(G_OBJECT(w), "user_data"); | |
1254 | |
1255 chat_do_im(conv, who); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1256 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1257 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1258 static void |
9468 | 1259 menu_chat_send_file_cb(GtkWidget *w, GaimConversation *conv) |
1260 { | |
1261 const char *who = g_object_get_data(G_OBJECT(w), "user_data"); | |
1262 GaimConnection *gc = gaim_conversation_get_gc(conv); | |
1263 | |
1264 serv_send_file(gc, who, NULL); | |
1265 } | |
1266 | |
1267 static void | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1268 menu_chat_info_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1269 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1270 char *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1271 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1272 who = g_object_get_data(G_OBJECT(w), "user_data"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1273 |
7975 | 1274 chat_do_info(conv, who); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1275 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1276 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1277 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1278 menu_chat_get_away_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1279 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1280 GaimPluginProtocolInfo *prpl_info = NULL; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1281 GaimConnection *gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1282 char *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1283 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1284 gc = gaim_conversation_get_gc(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1285 who = g_object_get_data(G_OBJECT(w), "user_data"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1286 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1287 if (gc != NULL) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1288 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1289 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1290 /* |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1291 * 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
|
1292 */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1293 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1294 if (prpl_info->get_cb_away != NULL) |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1295 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1296 prpl_info->get_cb_away(gc, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1297 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1298 } |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1299 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1300 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1301 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1302 static void |
7928 | 1303 menu_chat_add_remove_cb(GtkWidget *w, GaimConversation *conv) |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1304 { |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1305 GaimAccount *account; |
6695 | 1306 GaimBuddy *b; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1307 char *name; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1308 |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1309 account = gaim_conversation_get_account(conv); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1310 name = g_object_get_data(G_OBJECT(w), "user_data"); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1311 b = gaim_find_buddy(account, 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 if (b != NULL) |
5975 | 1314 show_confirm_del(b); |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1315 else if (account != NULL && gaim_account_is_connected(account)) |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1316 gaim_blist_request_add_buddy(account, name, NULL, NULL); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1317 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1318 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1319 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1320 |
8143 | 1321 static GtkWidget * |
1322 create_chat_menu(GaimConversation *conv, gchar *who, | |
1323 GaimPluginProtocolInfo *prpl_info, GaimConnection *gc) | |
1324 { | |
1325 static GtkWidget *menu = NULL; | |
1326 GtkWidget *button; | |
1327 | |
1328 /* | |
1329 * If a menu already exists, destroy it before creating a new one, | |
1330 * thus freeing-up the memory it occupied. | |
1331 */ | |
1332 if (menu) | |
1333 gtk_widget_destroy(menu); | |
1334 | |
1335 menu = gtk_menu_new(); | |
1336 | |
1337 button = gtk_menu_item_new_with_label(_("IM")); | |
1338 g_signal_connect(G_OBJECT(button), "activate", | |
1339 G_CALLBACK(menu_chat_im_cb), conv); | |
1340 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1341 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1342 gtk_widget_show(button); | |
1343 | |
9468 | 1344 if (gc && prpl_info && prpl_info->send_file |
1345 && (!prpl_info->can_receive_file || prpl_info->can_receive_file(gc, who))) { | |
1346 button = gtk_menu_item_new_with_label(_("Send File")); | |
1347 g_signal_connect(G_OBJECT(button), "activate", | |
1348 G_CALLBACK(menu_chat_send_file_cb), conv); | |
1349 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1350 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1351 gtk_widget_show(button); | |
1352 } | |
9498 | 1353 |
8143 | 1354 if (gaim_conv_chat_is_user_ignored(GAIM_CONV_CHAT(conv), who)) |
1355 button = gtk_menu_item_new_with_label(_("Un-Ignore")); | |
1356 else | |
1357 button = gtk_menu_item_new_with_label(_("Ignore")); | |
1358 | |
1359 g_signal_connect(G_OBJECT(button), "activate", | |
1360 G_CALLBACK(ignore_cb), conv); | |
1361 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1362 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1363 gtk_widget_show(button); | |
1364 | |
8170 | 1365 if (gc && (prpl_info->get_info || prpl_info->get_cb_info)) { |
8143 | 1366 button = gtk_menu_item_new_with_label(_("Info")); |
1367 g_signal_connect(G_OBJECT(button), "activate", | |
1368 G_CALLBACK(menu_chat_info_cb), conv); | |
1369 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1370 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1371 gtk_widget_show(button); | |
1372 } | |
1373 | |
1374 if (gc && prpl_info->get_cb_away) { | |
1375 button = gtk_menu_item_new_with_label(_("Get Away Msg")); | |
1376 g_signal_connect(G_OBJECT(button), "activate", | |
1377 G_CALLBACK(menu_chat_get_away_cb), conv); | |
1378 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1379 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1380 gtk_widget_show(button); | |
1381 } | |
1382 | |
8170 | 1383 /* XXX: jabber can only add buddies from here in certain circumstances */ |
8143 | 1384 /* Added by Jonas <jonas@birme.se> */ |
1385 if (gc) { | |
1386 if (gaim_find_buddy(gc->account, who)) | |
1387 button = gtk_menu_item_new_with_label(_("Remove")); | |
1388 else | |
1389 button = gtk_menu_item_new_with_label(_("Add")); | |
1390 | |
1391 g_signal_connect(G_OBJECT(button), "activate", | |
1392 G_CALLBACK(menu_chat_add_remove_cb), conv); | |
1393 | |
1394 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1395 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1396 gtk_widget_show(button); | |
1397 } | |
1398 /* End Jonas */ | |
1399 | |
1400 return menu; | |
1401 } | |
1402 | |
1403 | |
1404 static gint | |
1405 gtkconv_chat_popup_menu_cb(GtkWidget *widget, GaimConversation *conv) | |
1406 { | |
1407 GaimGtkConversation *gtkconv; | |
1408 GaimPluginProtocolInfo *prpl_info = NULL; | |
1409 GaimGtkChatPane *gtkchat; | |
1410 GaimConnection *gc; | |
1411 GaimAccount *account; | |
1412 GtkTreeSelection *sel; | |
1413 GtkTreeIter iter; | |
1414 GtkTreeModel *model; | |
1415 GtkWidget *menu; | |
1416 gchar *who; | |
1417 | |
1418 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1419 gtkchat = gtkconv->u.chat; | |
1420 account = gaim_conversation_get_account(conv); | |
1421 gc = account->gc; | |
1422 | |
1423 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | |
1424 | |
1425 if (gc != NULL) | |
1426 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | |
1427 | |
1428 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); | |
1429 if(!gtk_tree_selection_get_selected(sel, NULL, &iter)) | |
1430 return FALSE; | |
1431 | |
9498 | 1432 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &who, -1); |
8143 | 1433 menu = create_chat_menu (conv, who, prpl_info, gc); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1434 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1435 gaim_gtk_treeview_popup_menu_position_func, widget, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1436 0, GDK_CURRENT_TIME); |
8143 | 1437 |
1438 return TRUE; | |
1439 } | |
1440 | |
1441 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1442 static gint |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1443 right_click_chat_cb(GtkWidget *widget, GdkEventButton *event, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1444 GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1445 { |
8143 | 1446 GaimGtkConversation *gtkconv; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1447 GaimPluginProtocolInfo *prpl_info = NULL; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1448 GaimGtkChatPane *gtkchat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1449 GaimConnection *gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1450 GaimAccount *account; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1451 GtkTreePath *path; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1452 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1453 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1454 GtkTreeViewColumn *column; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1455 gchar *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1456 int x, y; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1457 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1458 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1459 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1460 account = gaim_conversation_get_account(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1461 gc = account->gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1462 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1463 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1464 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1465 gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(gtkchat->list), |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1466 event->x, event->y, &path, &column, &x, &y); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1467 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1468 if (path == NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1469 return FALSE; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1470 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1471 if (gc != NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1472 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1473 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1474 gtk_tree_selection_select_path(GTK_TREE_SELECTION( |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1475 gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list))), path); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1476 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1477 gtk_tree_model_get_iter(GTK_TREE_MODEL(model), &iter, path); |
9498 | 1478 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
|
1479 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1480 if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) { |
7398 | 1481 chat_do_im(conv, who); |
9554 | 1482 g_free(who); |
7398 | 1483 } else if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { |
8143 | 1484 GtkWidget *menu = create_chat_menu (conv, who, prpl_info, gc); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1485 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1486 event->button, event->time); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1487 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1488 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1489 return TRUE; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1490 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1491 |
8133 | 1492 static void |
1493 move_to_next_unread_tab(GaimConversation *conv) | |
1494 { | |
1495 GaimConversation *next_conv = NULL; | |
1496 GaimConvWindow *win; | |
1497 GList *l; | |
1498 int index, i; | |
1499 | |
1500 win = gaim_conversation_get_window(conv); | |
1501 index = gaim_conversation_get_index(conv); | |
1502 | |
1503 /* First check the tabs after this position. */ | |
1504 for (l = g_list_nth(gaim_conv_window_get_conversations(win), index); | |
1505 l != NULL; | |
1506 l = l->next) { | |
1507 | |
1508 next_conv = (GaimConversation *)l->data; | |
1509 | |
1510 if (gaim_conversation_get_unseen(next_conv) > 0) | |
1511 break; | |
1512 | |
1513 next_conv = NULL; | |
1514 } | |
1515 | |
1516 if (next_conv == NULL) { | |
1517 | |
1518 /* Now check before this position. */ | |
1519 for (l = gaim_conv_window_get_conversations(win), i = 0; | |
1520 l != NULL && i < index; | |
1521 l = l->next) { | |
1522 | |
1523 next_conv = (GaimConversation *)l->data; | |
1524 | |
1525 if (gaim_conversation_get_unseen(next_conv) > 0) | |
1526 break; | |
1527 | |
1528 next_conv = NULL; | |
1529 } | |
1530 | |
1531 if (next_conv == NULL) { | |
1532 /* Okay, just grab the next conversation tab. */ | |
1533 if (index == gaim_conv_window_get_conversation_count(win) - 1) | |
1534 next_conv = gaim_conv_window_get_conversation_at(win, 0); | |
1535 else | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1536 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1537 next_conv = gaim_conv_window_get_conversation_at(win, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1538 index + 1); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1539 } |
8133 | 1540 } |
1541 } | |
1542 | |
1543 if (next_conv != NULL && next_conv != conv) { | |
1544 gaim_conv_window_switch_conversation(win, | |
1545 gaim_conversation_get_index(next_conv)); | |
1546 } | |
1547 } | |
1548 | |
4359 | 1549 static gboolean |
8105 | 1550 entry_key_press_cb(GtkWidget *entry, GdkEventKey *event, gpointer data) |
4359 | 1551 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1552 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1553 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1554 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1555 GaimGtkWindow *gtkwin; |
8105 | 1556 int numconvs; |
1557 int curconv; | |
1558 | |
1559 conv = (GaimConversation *)data; | |
1560 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1561 win = gaim_conversation_get_window(conv); | |
1562 gtkwin = GAIM_GTK_WINDOW(win); | |
1563 numconvs = gaim_conv_window_get_conversation_count(win); | |
1564 curconv = gaim_conversation_get_index(conv); | |
1565 | |
1566 /* If CTRL was held down... */ | |
1567 if (event->state & GDK_CONTROL_MASK) { | |
4359 | 1568 switch (event->keyval) { |
8105 | 1569 case GDK_Return: |
1570 case GDK_KP_Enter: | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1571 if (gaim_prefs_get_bool( |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1572 "/gaim/gtk/conversations/ctrl_enter_sends")) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1573 { |
8105 | 1574 send_cb(NULL, conv); |
1575 | |
1576 return TRUE; | |
1577 } | |
1578 break; | |
1579 | |
4359 | 1580 case GDK_Up: |
1581 if (!conv->send_history) | |
1582 break; | |
1583 | |
1584 if (!conv->send_history->prev) { | |
1585 GtkTextIter start, end; | |
1586 | |
1587 if (conv->send_history->data) | |
1588 g_free(conv->send_history->data); | |
1589 | |
1590 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, | |
1591 &start); | |
1592 gtk_text_buffer_get_end_iter(gtkconv->entry_buffer, &end); | |
1593 | |
1594 conv->send_history->data = | |
8506 | 1595 gtk_imhtml_get_markup(GTK_IMHTML(gtkconv->entry)); |
4359 | 1596 } |
8677 | 1597 |
4359 | 1598 if (conv->send_history->next && |
1599 conv->send_history->next->data) { | |
8677 | 1600 GtkTextIter iter; |
1601 GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); | |
4359 | 1602 |
1603 conv->send_history = conv->send_history->next; | |
8061 | 1604 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1605 gtk_imhtml_append_text_with_images( |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1606 GTK_IMHTML(gtkconv->entry), conv->send_history->data, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1607 0, NULL); |
8677 | 1608 /* this is mainly just a hack so the formatting at the |
1609 * cursor gets picked up. */ | |
1610 gtk_text_buffer_get_end_iter(buffer, &iter); | |
1611 gtk_text_buffer_move_mark_by_name(buffer, "insert", &iter); | |
4359 | 1612 } |
1613 | |
8105 | 1614 return TRUE; |
4359 | 1615 break; |
1616 | |
1617 case GDK_Down: | |
1618 if (!conv->send_history) | |
1619 break; | |
1620 | |
8105 | 1621 if (conv->send_history->prev && |
1622 conv->send_history->prev->data) { | |
8677 | 1623 GtkTextIter iter; |
1624 GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); | |
8105 | 1625 |
4359 | 1626 conv->send_history = conv->send_history->prev; |
8105 | 1627 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1628 gtk_imhtml_append_text_with_images( |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1629 GTK_IMHTML(gtkconv->entry), conv->send_history->data, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1630 0, NULL); |
8677 | 1631 /* this is mainly just a hack so the formatting at the |
1632 * cursor gets picked up. */ | |
1633 gtk_text_buffer_get_end_iter(buffer, &iter); | |
1634 gtk_text_buffer_move_mark_by_name(buffer, "insert", &iter); | |
4359 | 1635 } |
1636 | |
8105 | 1637 return TRUE; |
4359 | 1638 break; |
8105 | 1639 |
8108 | 1640 case GDK_Page_Down: |
8143 | 1641 case ']': |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1642 gaim_conv_window_switch_conversation(win, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1643 (curconv + 1) % numconvs); |
8105 | 1644 |
1645 return TRUE; | |
1646 break; | |
1647 | |
8108 | 1648 case GDK_Page_Up: |
8143 | 1649 case '[': |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1650 gaim_conv_window_switch_conversation(win, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1651 (curconv + numconvs - 1) % numconvs); |
8133 | 1652 |
1653 return TRUE; | |
1654 break; | |
1655 | |
8108 | 1656 case GDK_Tab: |
8133 | 1657 move_to_next_unread_tab(conv); |
8108 | 1658 |
1659 return TRUE; | |
1660 break; | |
1661 | |
1662 case 'z': | |
1663 gtk_window_iconify(GTK_WINDOW(gtkwin->window)); | |
8105 | 1664 |
1665 return TRUE; | |
1666 break; | |
1667 | |
1668 } /* End of switch */ | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1669 } |
8758 | 1670 |
8105 | 1671 /* If ALT (or whatever) was held down... */ |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1672 else if (event->state & GDK_MOD1_MASK) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1673 { |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8730
diff
changeset
|
1674 /* XXX - Make sure the conv exists before switching to it */ |
8105 | 1675 if (event->keyval > '0' && event->keyval <= '9') { |
1676 int switchto = event->keyval - '1'; | |
1677 if (switchto < numconvs) | |
1678 gaim_conv_window_switch_conversation(win, switchto); | |
4359 | 1679 |
1680 return TRUE; | |
1681 } | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1682 } |
8758 | 1683 |
8105 | 1684 /* If neither CTRL nor ALT were held down... */ |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1685 else |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1686 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1687 switch (event->keyval) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1688 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1689 case GDK_Return: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1690 case GDK_KP_Enter: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1691 if (!(event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK)) && |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1692 gaim_prefs_get_bool("/gaim/gtk/conversations/enter_sends")) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1693 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1694 send_cb(NULL, conv); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1695 return TRUE; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1696 } |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1697 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1698 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1699 case GDK_Tab: |
8941 | 1700 if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1701 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1702 tab_complete(conv); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1703 return TRUE; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1704 } |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1705 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1706 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1707 case GDK_Page_Up: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1708 gtk_imhtml_page_up(GTK_IMHTML(gtkconv->imhtml)); |
8105 | 1709 return TRUE; |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1710 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1711 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1712 case GDK_Page_Down: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1713 gtk_imhtml_page_down(GTK_IMHTML(gtkconv->imhtml)); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1714 return TRUE; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1715 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1716 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1717 } |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1718 } |
4359 | 1719 |
1720 return FALSE; | |
1721 } | |
1722 | |
1723 /* | |
1724 * NOTE: | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1725 * This guy just kills a single right click from being propagated any |
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1726 * further. I have no idea *why* we need this, but we do ... It |
4359 | 1727 * prevents right clicks on the GtkTextView in a convo dialog from |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1728 * going all the way down to the notebook. I suspect a bug in |
4359 | 1729 * GtkTextView, but I'm not ready to point any fingers yet. |
1730 */ | |
1731 static gboolean | |
1732 entry_stop_rclick_cb(GtkWidget *widget, GdkEventButton *event, gpointer data) | |
1733 { | |
1734 if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { | |
1735 /* Right single click */ | |
1736 g_signal_stop_emission_by_name(G_OBJECT(widget), "button_press_event"); | |
1737 | |
1738 return TRUE; | |
1739 } | |
1740 | |
1741 return FALSE; | |
1742 } | |
1743 | |
8173 | 1744 /* |
1745 * If someone tries to type into the conversation backlog of a | |
1746 * conversation window then we yank focus from the conversation backlog | |
1747 * and give it to the text entry box so that people can type | |
1748 * all the live long day and it will get entered into the entry box. | |
1749 */ | |
6057 | 1750 static gboolean |
8105 | 1751 refocus_entry_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) |
6057 | 1752 { |
1753 GaimGtkConversation *gtkconv = data; | |
1754 | |
8237 | 1755 /* If we have a valid key for the conversation display, then exit */ |
8224 | 1756 if ((event->state & GDK_CONTROL_MASK) || |
8237 | 1757 (event->keyval == GDK_F10) || |
1758 (event->keyval == GDK_Shift_L) || | |
1759 (event->keyval == GDK_Shift_R) || | |
1760 (event->keyval == GDK_Escape) || | |
8177 | 1761 (event->keyval == GDK_Up) || |
1762 (event->keyval == GDK_Down) || | |
1763 (event->keyval == GDK_Left) || | |
8191 | 1764 (event->keyval == GDK_Right) || |
1765 (event->keyval == GDK_Home) || | |
9297 | 1766 (event->keyval == GDK_End) || |
1767 (event->keyval == GDK_Tab) || | |
1768 (event->keyval == GDK_ISO_Left_Tab)) | |
8177 | 1769 return FALSE; |
1770 | |
1771 if (event->type == GDK_KEY_RELEASE) | |
1772 gtk_widget_grab_focus(gtkconv->entry); | |
1773 | |
1774 gtk_widget_event(gtkconv->entry, (GdkEvent *)event); | |
1775 | |
1776 return TRUE; | |
6057 | 1777 } |
1778 | |
4359 | 1779 static void |
4673 | 1780 menu_conv_sel_send_cb(GObject *m, gpointer data) |
4359 | 1781 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1782 GaimConvWindow *win = g_object_get_data(m, "user_data"); |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
1783 GaimAccount *account = g_object_get_data(m, "gaim_account"); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1784 GaimConversation *conv; |
8456 | 1785 GaimGtkConversation *gtkconv; |
1786 GaimPlugin *protocol; | |
4359 | 1787 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1788 conv = gaim_conv_window_get_active_conversation(win); |
4359 | 1789 |
4491 | 1790 gaim_conversation_set_account(conv, account); |
8456 | 1791 |
1792 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1793 protocol = gaim_find_prpl(conv->account->protocol_id); | |
1794 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), | |
1795 protocol->info->name); | |
4359 | 1796 } |
1797 | |
1798 static void | |
1799 insert_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *position, | |
1800 gchar *new_text, gint new_text_length, gpointer user_data) | |
1801 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1802 GaimConversation *conv = (GaimConversation *)user_data; |
4359 | 1803 |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1804 g_return_if_fail(conv != NULL); |
4359 | 1805 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1806 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) |
4359 | 1807 return; |
1808 | |
1809 got_typing_keypress(conv, (gtk_text_iter_is_start(position) && | |
1810 gtk_text_iter_is_end(position))); | |
1811 } | |
1812 | |
1813 static void | |
1814 delete_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *start_pos, | |
1815 GtkTextIter *end_pos, gpointer user_data) | |
1816 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1817 GaimConversation *conv = (GaimConversation *)user_data; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1818 GaimConvIm *im; |
4359 | 1819 |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1820 g_return_if_fail(conv != NULL); |
4359 | 1821 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1822 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) |
4359 | 1823 return; |
1824 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1825 im = GAIM_CONV_IM(conv); |
4359 | 1826 |
1827 if (gtk_text_iter_is_start(start_pos) && gtk_text_iter_is_end(end_pos)) { | |
1828 | |
1829 /* We deleted all the text, so turn off typing. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1830 if (gaim_conv_im_get_type_again_timeout(im)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1831 gaim_conv_im_stop_type_again_timeout(im); |
4359 | 1832 |
1833 serv_send_typing(gaim_conversation_get_gc(conv), | |
6695 | 1834 gaim_conversation_get_name(conv), |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
1835 GAIM_NOT_TYPING); |
4359 | 1836 } |
1837 else { | |
1838 /* We're deleting, but not all of it, so it counts as typing. */ | |
1839 got_typing_keypress(conv, FALSE); | |
1840 } | |
1841 } | |
1842 | |
1843 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1844 notebook_init_grab(GaimGtkWindow *gtkwin, GtkWidget *widget) |
4359 | 1845 { |
1846 static GdkCursor *cursor = NULL; | |
1847 | |
1848 gtkwin->in_drag = TRUE; | |
1849 | |
1850 if (gtkwin->drag_leave_signal) { | |
1851 g_signal_handler_disconnect(G_OBJECT(widget), | |
1852 gtkwin->drag_leave_signal); | |
1853 | |
1854 gtkwin->drag_leave_signal = 0; | |
1855 } | |
1856 | |
1857 if (cursor == NULL) | |
1858 cursor = gdk_cursor_new(GDK_FLEUR); | |
1859 | |
1860 /* Grab the pointer */ | |
1861 gtk_grab_add(gtkwin->notebook); | |
5114
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1862 #ifndef _WIN32 |
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1863 /* Currently for win32 GTK+ (as of 2.2.1), gdk_pointer_is_grabbed will |
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1864 always be true after a button press. */ |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1865 if (!gdk_pointer_is_grabbed()) |
5114
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1866 #endif |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1867 gdk_pointer_grab(gtkwin->notebook->window, FALSE, |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1868 GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1869 NULL, cursor, GDK_CURRENT_TIME); |
4359 | 1870 } |
1871 | |
1872 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1873 notebook_motion_cb(GtkWidget *widget, GdkEventButton *e, GaimConvWindow *win) |
4359 | 1874 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1875 GaimGtkWindow *gtkwin; |
4359 | 1876 |
1877 gtkwin = GAIM_GTK_WINDOW(win); | |
1878 | |
1879 /* | |
1880 * Make sure the user moved the mouse far enough for the | |
1881 * drag to be initiated. | |
1882 */ | |
1883 if (gtkwin->in_predrag) { | |
1884 if (e->x_root < gtkwin->drag_min_x || | |
1885 e->x_root >= gtkwin->drag_max_x || | |
1886 e->y_root < gtkwin->drag_min_y || | |
1887 e->y_root >= gtkwin->drag_max_y) { | |
1888 | |
1889 gtkwin->in_predrag = FALSE; | |
1890 notebook_init_grab(gtkwin, widget); | |
1891 } | |
1892 } | |
1893 else { /* Otherwise, draw the arrows. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1894 GaimConvWindow *dest_win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1895 GaimGtkWindow *dest_gtkwin; |
4359 | 1896 GtkNotebook *dest_notebook; |
1897 GtkWidget *tab, *last_vis_tab = NULL; | |
1898 gint nb_x, nb_y, page_num, i, last_vis_tab_loc = -1; | |
1899 gint arrow1_x, arrow1_y, arrow2_x, arrow2_y; | |
1900 gboolean horiz_tabs = FALSE, tab_found = FALSE; | |
1901 GList *l; | |
1902 | |
1903 /* Get the window that the cursor is over. */ | |
1904 dest_win = gaim_gtkwin_get_at_xy(e->x_root, e->y_root); | |
1905 | |
1906 if (dest_win == NULL) { | |
1907 dnd_hints_hide_all(); | |
1908 | |
1909 return TRUE; | |
1910 } | |
1911 | |
1912 dest_gtkwin = GAIM_GTK_WINDOW(dest_win); | |
1913 | |
1914 dest_notebook = GTK_NOTEBOOK(dest_gtkwin->notebook); | |
1915 | |
1916 gdk_window_get_origin(GTK_WIDGET(dest_notebook)->window, &nb_x, &nb_y); | |
1917 | |
1918 arrow1_x = arrow2_x = nb_x; | |
1919 arrow1_y = arrow2_y = nb_y; | |
1920 | |
1921 page_num = gaim_gtkconv_get_dest_tab_at_xy(dest_win, | |
1922 e->x_root, e->y_root); | |
1923 | |
1924 if (gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_TOP || | |
1925 gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_BOTTOM) { | |
1926 | |
1927 horiz_tabs = TRUE; | |
1928 } | |
1929 | |
1930 /* Find out where to put the arrows. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1931 for (l = gaim_conv_window_get_conversations(dest_win), i = 0; |
4359 | 1932 l != NULL; |
1933 l = l->next, i++) { | |
1934 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1935 GaimConversation *conv = l->data; |
4359 | 1936 |
1937 tab = GAIM_GTK_CONVERSATION(conv)->tabby; | |
1938 | |
1939 /* | |
1940 * If this is the correct tab, record the positions | |
1941 * for the arrows. | |
1942 */ | |
1943 if (i == page_num) { | |
1944 if (horiz_tabs) { | |
1945 arrow1_x = arrow2_x = nb_x + tab->allocation.x; | |
1946 arrow1_y = nb_y + tab->allocation.y; | |
1947 arrow2_y = nb_y + tab->allocation.y + | |
1948 tab->allocation.height; | |
1949 } | |
1950 else { | |
1951 arrow1_x = nb_x + tab->allocation.x; | |
1952 arrow2_x = nb_x + tab->allocation.x + | |
1953 tab->allocation.width; | |
1954 arrow1_y = arrow2_y = nb_y + tab->allocation.y; | |
1955 } | |
1956 | |
1957 tab_found = TRUE; | |
1958 break; | |
1959 } | |
1960 else { /* Keep track of the right-most tab that we see. */ | |
1961 if (horiz_tabs && tab->allocation.x > last_vis_tab_loc) { | |
1962 last_vis_tab = tab; | |
1963 last_vis_tab_loc = tab->allocation.x; | |
1964 } | |
1965 else if (!horiz_tabs && tab->allocation.y > last_vis_tab_loc) { | |
1966 last_vis_tab = tab; | |
1967 last_vis_tab_loc = tab->allocation.y; | |
1968 } | |
1969 } | |
1970 } | |
1971 | |
1972 /* | |
1973 * If we didn't find the tab, then we'll just place the | |
1974 * arrows to the right/bottom of the last visible tab. | |
1975 */ | |
1976 if (!tab_found && last_vis_tab) { | |
1977 if (horiz_tabs) { | |
1978 arrow1_x = arrow2_x = nb_x + last_vis_tab->allocation.x + | |
1979 last_vis_tab->allocation.width; | |
1980 arrow1_y = nb_y + last_vis_tab->allocation.y; | |
1981 arrow2_y = nb_y + last_vis_tab->allocation.y + | |
1982 last_vis_tab->allocation.height; | |
1983 } | |
1984 else { | |
1985 arrow1_x = nb_x + last_vis_tab->allocation.x; | |
1986 arrow2_x = nb_x + last_vis_tab->allocation.x + | |
1987 last_vis_tab->allocation.width; | |
1988 arrow1_y = arrow2_y = nb_y + last_vis_tab->allocation.y + | |
1989 last_vis_tab->allocation.height; | |
1990 } | |
1991 } | |
1992 | |
1993 if (horiz_tabs) { | |
1994 dnd_hints_show(HINT_ARROW_DOWN, arrow1_x, arrow1_y); | |
1995 dnd_hints_show(HINT_ARROW_UP, arrow2_x, arrow2_y); | |
1996 } | |
1997 else { | |
1998 dnd_hints_show(HINT_ARROW_RIGHT, arrow1_x, arrow1_y); | |
1999 dnd_hints_show(HINT_ARROW_LEFT, arrow2_x, arrow2_y); | |
2000 } | |
2001 } | |
2002 | |
2003 return TRUE; | |
2004 } | |
2005 | |
2006 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2007 notebook_leave_cb(GtkWidget *widget, GdkEventCrossing *e, GaimConvWindow *win) |
4359 | 2008 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2009 GaimGtkWindow *gtkwin; |
4359 | 2010 |
2011 gtkwin = GAIM_GTK_WINDOW(win); | |
2012 | |
2013 if (gtkwin->in_drag) | |
2014 return FALSE; | |
2015 | |
2016 if (e->x_root < gtkwin->drag_min_x || | |
2017 e->x_root >= gtkwin->drag_max_x || | |
2018 e->y_root < gtkwin->drag_min_y || | |
2019 e->y_root >= gtkwin->drag_max_y) { | |
2020 | |
2021 gtkwin->in_predrag = FALSE; | |
2022 notebook_init_grab(gtkwin, widget); | |
2023 } | |
2024 | |
2025 return TRUE; | |
2026 } | |
2027 | |
2028 /* | |
2029 * THANK YOU GALEON! | |
2030 */ | |
2031 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2032 notebook_press_cb(GtkWidget *widget, GdkEventButton *e, GaimConvWindow *win) |
4359 | 2033 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2034 GaimGtkWindow *gtkwin; |
4359 | 2035 gint nb_x, nb_y, x_rel, y_rel; |
2036 GList *l; | |
2037 int tab_clicked; | |
2038 | |
2039 if (e->button != 1 || e->type != GDK_BUTTON_PRESS) | |
2040 return FALSE; | |
2041 | |
2042 gtkwin = GAIM_GTK_WINDOW(win); | |
2043 | |
2044 if (gtkwin->in_drag) { | |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
2045 gaim_debug(GAIM_DEBUG_WARNING, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
2046 "Already in the middle of a window drag at tab_press_cb\n"); |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
2047 return TRUE; |
4359 | 2048 } |
2049 | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2050 /* |
4359 | 2051 * Make sure a tab was actually clicked. The arrow buttons |
2052 * mess things up. | |
2053 */ | |
2054 tab_clicked = gaim_gtkconv_get_tab_at_xy(win, e->x_root, e->y_root); | |
2055 | |
2056 if (tab_clicked == -1) | |
2057 return FALSE; | |
2058 | |
2059 /* | |
2060 * Get the relative position of the press event, with regards to | |
2061 * the position of the notebook. | |
2062 */ | |
2063 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
2064 | |
2065 x_rel = e->x_root - nb_x; | |
2066 y_rel = e->y_root - nb_y; | |
2067 | |
2068 /* Reset the min/max x/y */ | |
2069 gtkwin->drag_min_x = 0; | |
2070 gtkwin->drag_min_y = 0; | |
2071 gtkwin->drag_max_x = 0; | |
2072 gtkwin->drag_max_y = 0; | |
2073 | |
2074 /* Find out which tab was dragged. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2075 for (l = gaim_conv_window_get_conversations(win); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2076 GaimConversation *conv = l->data; |
4359 | 2077 GtkWidget *tab = GAIM_GTK_CONVERSATION(conv)->tabby; |
2078 | |
2079 if (!GTK_WIDGET_VISIBLE(tab)) | |
2080 continue; | |
2081 | |
2082 if (tab->allocation.x > x_rel || tab->allocation.y > y_rel) | |
2083 break; | |
2084 | |
2085 /* Save the borders of the tab. */ | |
2086 gtkwin->drag_min_x = tab->allocation.x + nb_x; | |
2087 gtkwin->drag_min_y = tab->allocation.y + nb_y; | |
2088 gtkwin->drag_max_x = tab->allocation.width + gtkwin->drag_min_x; | |
2089 gtkwin->drag_max_y = tab->allocation.height + gtkwin->drag_min_y; | |
2090 } | |
2091 | |
2092 /* Make sure the click occurred in the tab. */ | |
2093 if (e->x_root < gtkwin->drag_min_x || | |
2094 e->x_root >= gtkwin->drag_max_x || | |
2095 e->y_root < gtkwin->drag_min_y || | |
2096 e->y_root >= gtkwin->drag_max_y) { | |
2097 | |
2098 return FALSE; | |
2099 } | |
2100 | |
2101 gtkwin->in_predrag = TRUE; | |
2102 | |
2103 /* Connect the new motion signals. */ | |
2104 gtkwin->drag_motion_signal = | |
2105 g_signal_connect(G_OBJECT(widget), "motion_notify_event", | |
2106 G_CALLBACK(notebook_motion_cb), win); | |
2107 | |
2108 gtkwin->drag_leave_signal = | |
2109 g_signal_connect(G_OBJECT(widget), "leave_notify_event", | |
2110 G_CALLBACK(notebook_leave_cb), win); | |
2111 | |
2112 return FALSE; | |
2113 } | |
2114 | |
2115 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2116 notebook_release_cb(GtkWidget *widget, GdkEventButton *e, GaimConvWindow *win) |
4359 | 2117 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2118 GaimConvWindow *dest_win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2119 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2120 GaimGtkWindow *dest_gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2121 GaimConversation *conv; |
4359 | 2122 GtkNotebook *dest_notebook; |
2123 gint dest_page_num; | |
2124 | |
2125 /* | |
2126 * Don't check to make sure that the event's window matches the | |
2127 * widget's, because we may be getting an event passed on from the | |
2128 * close button. | |
2129 */ | |
2130 if (e->button != 1 && e->type != GDK_BUTTON_RELEASE) | |
2131 return FALSE; | |
2132 | |
2133 if (gdk_pointer_is_grabbed()) { | |
2134 gdk_pointer_ungrab(GDK_CURRENT_TIME); | |
2135 gtk_grab_remove(widget); | |
2136 } | |
2137 | |
2138 gtkwin = GAIM_GTK_WINDOW(win); | |
2139 | |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
2140 if (!gtkwin->in_predrag && !gtkwin->in_drag) |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
2141 return FALSE; |
4359 | 2142 |
2143 /* Disconnect the motion signal. */ | |
2144 if (gtkwin->drag_motion_signal) { | |
2145 g_signal_handler_disconnect(G_OBJECT(widget), | |
2146 gtkwin->drag_motion_signal); | |
2147 | |
2148 gtkwin->drag_motion_signal = 0; | |
2149 } | |
2150 | |
2151 /* | |
2152 * If we're in a pre-drag, we'll also need to disconnect the leave | |
2153 * signal. | |
2154 */ | |
2155 if (gtkwin->in_predrag) { | |
2156 gtkwin->in_predrag = FALSE; | |
2157 | |
2158 if (gtkwin->drag_leave_signal) { | |
2159 g_signal_handler_disconnect(G_OBJECT(widget), | |
2160 gtkwin->drag_leave_signal); | |
2161 | |
2162 gtkwin->drag_leave_signal = 0; | |
2163 } | |
2164 } | |
2165 | |
2166 /* If we're not in drag... */ | |
2167 /* We're perfectly normal people! */ | |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
2168 if (!gtkwin->in_drag) |
4359 | 2169 return FALSE; |
2170 | |
2171 gtkwin->in_drag = FALSE; | |
2172 | |
2173 dnd_hints_hide_all(); | |
2174 | |
4369
7e1fb422e5fd
[gaim-migrate @ 4635]
Christian Hammond <chipx86@chipx86.com>
parents:
4368
diff
changeset
|
2175 dest_win = gaim_gtkwin_get_at_xy(e->x_root, e->y_root); |
4359 | 2176 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2177 conv = gaim_conv_window_get_active_conversation(win); |
4359 | 2178 |
2179 if (dest_win == NULL) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2180 if (gaim_conv_window_get_conversation_count(win) < 2) |
4359 | 2181 return FALSE; |
2182 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2183 if (gaim_conv_window_get_conversation_count(win) > 1) { |
4359 | 2184 /* Make a new window to stick this to. */ |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2185 GaimGtkConversation *gtkconv; |
4748
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2186 gint win_width, win_height; |
5121 | 2187 |
2188 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4359 | 2189 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2190 dest_win = gaim_conv_window_new(); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2191 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2192 gaim_conv_window_add_conversation(dest_win, |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2193 gaim_conv_window_remove_conversation(win, |
5139
d0182ae31ab8
[gaim-migrate @ 5503]
Christian Hammond <chipx86@chipx86.com>
parents:
5133
diff
changeset
|
2194 gaim_conversation_get_index(conv))); |
5121 | 2195 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2196 dest_gtkwin = GAIM_GTK_WINDOW(dest_win); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2197 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2198 gtk_window_get_size(GTK_WINDOW(dest_gtkwin->window), |
4748
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2199 &win_width, &win_height); |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2200 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2201 gtk_window_move(GTK_WINDOW(dest_gtkwin->window), |
4748
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2202 e->x_root - (win_width / 2), |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2203 e->y_root - (win_height / 2)); |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2204 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2205 gaim_conv_window_show(dest_win); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2206 } |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2207 } else { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2208 dest_gtkwin = GAIM_GTK_WINDOW(dest_win); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2209 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2210 /* Get the destination notebook. */ |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2211 dest_notebook = GTK_NOTEBOOK(gtkwin->notebook); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2212 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2213 /* Get the destination page number. */ |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2214 dest_page_num = gaim_gtkconv_get_dest_tab_at_xy(dest_win, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2215 e->x_root, e->y_root); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2216 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2217 if (win == dest_win) { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2218 gaim_conv_window_move_conversation(win, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2219 gaim_conversation_get_index(conv), dest_page_num); |
4359 | 2220 } |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2221 else { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2222 size_t pos; |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2223 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2224 gaim_conv_window_remove_conversation(win, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2225 gaim_conversation_get_index(conv)); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2226 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2227 pos = gaim_conv_window_add_conversation(dest_win, conv); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2228 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2229 if (pos != dest_page_num) |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2230 gaim_conv_window_move_conversation(dest_win, pos, dest_page_num); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2231 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2232 gaim_conv_window_switch_conversation(dest_win, dest_page_num); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2233 } |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2234 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2235 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); |
4359 | 2236 } |
2237 | |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2238 gaim_signal_emit(gaim_gtk_conversations_get_handle(), "conversation-drag-ended", |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2239 win, dest_win); |
4359 | 2240 |
2241 return TRUE; | |
2242 } | |
2243 | |
8189 | 2244 /************************************************************************** |
2245 * A bunch of buddy icon functions | |
2246 **************************************************************************/ | |
2247 static GdkPixbuf * | |
8755
d0364feabf96
[gaim-migrate @ 9510]
Christian Hammond <chipx86@chipx86.com>
parents:
8748
diff
changeset
|
2248 get_tab_icon(GaimConversation *conv, gboolean small_icon) |
7143 | 2249 { |
2250 GaimAccount *account = gaim_conversation_get_account(conv); | |
2251 const char *name = gaim_conversation_get_name(conv); | |
2252 GdkPixbuf *status = NULL; | |
2253 | |
2254 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
2255 GaimBuddy *b = gaim_find_buddy(account, name); | |
2256 if (b != NULL) { | |
2257 status = gaim_gtk_blist_get_status_icon((GaimBlistNode*)b, | |
8755
d0364feabf96
[gaim-migrate @ 9510]
Christian Hammond <chipx86@chipx86.com>
parents:
8748
diff
changeset
|
2258 (small_icon ? GAIM_STATUS_ICON_SMALL : GAIM_STATUS_ICON_LARGE)); |
7143 | 2259 } |
2260 } | |
2261 | |
2262 if (!status) { | |
2263 GdkPixbuf *pixbuf; | |
2264 pixbuf = create_prpl_icon(account); | |
2265 | |
8755
d0364feabf96
[gaim-migrate @ 9510]
Christian Hammond <chipx86@chipx86.com>
parents:
8748
diff
changeset
|
2266 if (small_icon && pixbuf != NULL) |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2267 { |
7143 | 2268 status = gdk_pixbuf_scale_simple(pixbuf, 15, 15, |
2269 GDK_INTERP_BILINEAR); | |
2270 g_object_unref(pixbuf); | |
2271 } | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2272 else |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2273 status = pixbuf; |
7143 | 2274 } |
2275 return status; | |
2276 } | |
2277 | |
8189 | 2278 static void |
2279 update_tab_icon(GaimConversation *conv) | |
2280 { | |
2281 GaimGtkConversation *gtkconv; | |
2282 GaimConvWindow *win = gaim_conversation_get_window(conv); | |
2283 GaimAccount *account; | |
2284 const char *name; | |
2285 GdkPixbuf *status = NULL; | |
2286 | |
2287 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2288 name = gaim_conversation_get_name(conv); | |
2289 account = gaim_conversation_get_account(conv); | |
2290 | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2291 status = get_tab_icon(conv, TRUE); |
8189 | 2292 |
2293 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->icon), status); | |
2294 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->menu_icon), status); | |
2295 | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2296 if (status != NULL) |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2297 g_object_unref(status); |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2298 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2299 if (gaim_conv_window_get_active_conversation(win) == conv && |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2300 gtkconv->u.im->anim == NULL) |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2301 { |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2302 status = get_tab_icon(conv, FALSE); |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2303 |
8189 | 2304 gtk_window_set_icon(GTK_WINDOW(GAIM_GTK_WINDOW(win)->window), status); |
2305 | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2306 if (status != NULL) |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2307 g_object_unref(status); |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2308 } |
8189 | 2309 } |
2310 | |
9318 | 2311 static void |
2312 get_icon_scale_size(GdkPixbufAnimation *icon, GaimBuddyIconSpec *spec, int *width, int *height) | |
2313 { | |
2314 *width = gdk_pixbuf_animation_get_width(icon); | |
2315 *height = gdk_pixbuf_animation_get_height(icon); | |
2316 | |
2317 /* this should eventually get smarter about preserving the aspect | |
2318 * ratio when scaling, but gimmie a break, I just woke up */ | |
2319 if(spec && spec->scale_rules & GAIM_ICON_SCALE_DISPLAY) { | |
2320 if(*width < spec->min_width) | |
2321 *width = spec->min_width; | |
2322 else if(*width > spec->max_width) | |
2323 *width = spec->max_width; | |
2324 | |
2325 if(*height < spec->min_height) | |
2326 *height = spec->min_height; | |
9319 | 2327 else if(*height > spec->max_height) |
9318 | 2328 *height = spec->max_height; |
2329 } | |
2330 | |
2331 /* and now for some arbitrary sanity checks */ | |
2332 if(*width > 100) | |
2333 *width = 100; | |
2334 if(*height > 100) | |
2335 *height = 100; | |
2336 } | |
2337 | |
8189 | 2338 static gboolean |
2339 redraw_icon(gpointer data) | |
2340 { | |
2341 GaimConversation *conv = (GaimConversation *)data; | |
2342 GaimGtkConversation *gtkconv; | |
9318 | 2343 GaimAccount *account; |
2344 GaimPluginProtocolInfo *prpl_info = NULL; | |
8189 | 2345 |
2346 GdkPixbuf *buf; | |
2347 GdkPixbuf *scale; | |
2348 GdkPixmap *pm; | |
2349 GdkBitmap *bm; | |
2350 gint delay; | |
9318 | 2351 int scale_width, scale_height; |
8189 | 2352 |
2353 if (!g_list_find(gaim_get_ims(), conv)) { | |
2354 gaim_debug(GAIM_DEBUG_WARNING, "gtkconv", | |
2355 "Conversation not found in redraw_icon. I think this " | |
2356 "is a bug.\n"); | |
2357 return FALSE; | |
2358 } | |
2359 | |
2360 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
9318 | 2361 account = gaim_conversation_get_account(conv); |
2362 if(account && account->gc) | |
2363 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl); | |
8189 | 2364 |
2365 gdk_pixbuf_animation_iter_advance(gtkconv->u.im->iter, NULL); | |
2366 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); | |
2367 | |
9318 | 2368 get_icon_scale_size(gtkconv->u.im->anim, prpl_info ? &prpl_info->icon_spec : |
2369 NULL, &scale_width, &scale_height); | |
2370 | |
2371 /* this code is ugly, and scares me */ | |
8189 | 2372 scale = gdk_pixbuf_scale_simple(buf, |
9318 | 2373 MAX(gdk_pixbuf_get_width(buf) * scale_width / |
8189 | 2374 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), |
9318 | 2375 MAX(gdk_pixbuf_get_height(buf) * scale_height / |
8189 | 2376 gdk_pixbuf_animation_get_height(gtkconv->u.im->anim), 1), |
2377 GDK_INTERP_NEAREST); | |
2378 | |
2379 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); | |
2380 g_object_unref(G_OBJECT(scale)); | |
2381 gtk_image_set_from_pixmap(GTK_IMAGE(gtkconv->u.im->icon), pm, bm); | |
2382 g_object_unref(G_OBJECT(pm)); | |
2383 gtk_widget_queue_draw(gtkconv->u.im->icon); | |
2384 | |
2385 if (bm) | |
2386 g_object_unref(G_OBJECT(bm)); | |
2387 | |
9131 | 2388 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter); |
2389 if (delay <= 0) | |
2390 delay = 100; | |
2391 | |
2392 gtkconv->u.im->icon_timer = g_timeout_add(delay, redraw_icon, conv); | |
8189 | 2393 |
2394 return FALSE; | |
2395 } | |
2396 | |
2397 static void | |
2398 start_anim(GtkObject *obj, GaimConversation *conv) | |
2399 { | |
2400 GaimGtkConversation *gtkconv; | |
2401 int delay; | |
2402 | |
2403 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
2404 return; | |
2405 | |
2406 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2407 | |
8228 | 2408 if (gtkconv->u.im->anim == NULL) |
2409 return; | |
2410 | |
8202 | 2411 if (gtkconv->u.im->icon_timer != 0) |
2412 return; | |
2413 | |
8189 | 2414 if (gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim)) |
2415 return; | |
2416 | |
2417 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter) / 10; | |
2418 | |
8758 | 2419 gtkconv->u.im->icon_timer = g_timeout_add(delay * 10, redraw_icon, conv); |
8189 | 2420 } |
2421 | |
2422 static void | |
2423 stop_anim(GtkObject *obj, GaimConversation *conv) | |
2424 { | |
2425 GaimGtkConversation *gtkconv; | |
2426 | |
2427 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
2428 return; | |
2429 | |
2430 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2431 | |
2432 if (gtkconv->u.im->icon_timer != 0) | |
2433 g_source_remove(gtkconv->u.im->icon_timer); | |
2434 | |
2435 gtkconv->u.im->icon_timer = 0; | |
2436 } | |
2437 | |
2438 static void | |
2439 toggle_icon_animate_cb(GtkWidget *w, GaimConversation *conv) | |
2440 { | |
2441 GaimGtkConversation *gtkconv; | |
2442 | |
2443 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
2444 return; | |
2445 | |
2446 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2447 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2448 gtkconv->u.im->animate = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2449 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w)); |
8189 | 2450 |
2451 if (gtkconv->u.im->animate) | |
2452 start_anim(NULL, conv); | |
2453 else | |
2454 stop_anim(NULL, conv); | |
2455 } | |
2456 static void | |
2457 remove_icon(GaimGtkConversation *gtkconv) | |
2458 { | |
2459 g_return_if_fail(gtkconv != NULL); | |
2460 | |
2461 if (gtkconv->u.im->icon != NULL) | |
8821 | 2462 gtk_widget_destroy(gtkconv->u.im->icon->parent->parent->parent); |
8189 | 2463 |
2464 if (gtkconv->u.im->anim != NULL) | |
2465 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); | |
2466 | |
2467 if (gtkconv->u.im->icon_timer != 0) | |
2468 g_source_remove(gtkconv->u.im->icon_timer); | |
2469 | |
2470 if (gtkconv->u.im->iter != NULL) | |
2471 g_object_unref(G_OBJECT(gtkconv->u.im->iter)); | |
2472 | |
2473 gtkconv->u.im->icon_timer = 0; | |
2474 gtkconv->u.im->icon = NULL; | |
2475 gtkconv->u.im->anim = NULL; | |
2476 gtkconv->u.im->iter = NULL; | |
2477 } | |
2478 | |
9497 | 2479 static void |
9504 | 2480 saveicon_writefile_cb(void *user_data, const char *filename) |
9497 | 2481 { |
9504 | 2482 GaimConversation *conv = (GaimConversation *)user_data; |
9497 | 2483 FILE *fp; |
2484 GaimBuddyIcon *icon; | |
2485 const void *data; | |
2486 size_t len; | |
2487 | |
2488 if ((fp = fopen(filename, "wb")) == NULL) { | |
9504 | 2489 gaim_notify_error(conv, NULL, _("Unable to open file."), NULL); |
9497 | 2490 return; |
2491 } | |
2492 | |
2493 icon = gaim_conv_im_get_icon(GAIM_CONV_IM(conv)); | |
2494 data = gaim_buddy_icon_get_data(icon, &len); | |
2495 | |
2496 if ((len <= 0) || (data == NULL)) { | |
9504 | 2497 gaim_notify_error(conv, NULL, _("Unable to save icon file to disk."), NULL); |
9497 | 2498 return; |
2499 } | |
2500 | |
2501 fwrite(data, 1, len, fp); | |
2502 fclose(fp); | |
2503 } | |
2504 | |
2505 static void | |
2506 icon_menu_save_cb(GtkWidget *widget, GaimConversation *conv) | |
2507 { | |
2508 gchar *buf; | |
2509 | |
2510 g_return_if_fail(conv != NULL); | |
9504 | 2511 |
9497 | 2512 buf = g_strdup_printf("%s.icon", gaim_normalize(conv->account, conv->name)); |
9504 | 2513 |
2514 gaim_request_file(conv, _("Save Icon"), buf, TRUE, | |
2515 G_CALLBACK(saveicon_writefile_cb), NULL, conv); | |
9497 | 2516 |
2517 g_free(buf); | |
2518 } | |
2519 | |
8189 | 2520 static gboolean |
2521 icon_menu(GtkObject *obj, GdkEventButton *e, GaimConversation *conv) | |
2522 { | |
2523 GaimGtkConversation *gtkconv; | |
2524 static GtkWidget *menu = NULL; | |
2525 GtkWidget *button; | |
2526 | |
2527 if (e->button != 3 || e->type != GDK_BUTTON_PRESS) | |
2528 return FALSE; | |
2529 | |
2530 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2531 | |
2532 /* | |
2533 * If a menu already exists, destroy it before creating a new one, | |
2534 * thus freeing-up the memory it occupied. | |
2535 */ | |
2536 if (menu != NULL) | |
2537 gtk_widget_destroy(menu); | |
2538 | |
2539 menu = gtk_menu_new(); | |
2540 | |
2541 if (gtkconv->u.im->anim && | |
2542 !(gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim))) | |
2543 { | |
2544 gaim_new_check_item(menu, _("Animate"), | |
2545 G_CALLBACK(toggle_icon_animate_cb), conv, | |
2546 gtkconv->u.im->icon_timer); | |
2547 } | |
2548 | |
2549 button = gtk_menu_item_new_with_label(_("Hide Icon")); | |
2550 g_signal_connect_swapped(G_OBJECT(button), "activate", | |
2551 G_CALLBACK(remove_icon), gtkconv); | |
2552 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
2553 gtk_widget_show(button); | |
2554 | |
2555 gaim_new_item_from_stock(menu, _("Save Icon As..."), GTK_STOCK_SAVE_AS, | |
9497 | 2556 G_CALLBACK(icon_menu_save_cb), conv, |
8189 | 2557 0, 0, NULL); |
2558 | |
2559 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, e->button, e->time); | |
2560 | |
2561 return TRUE; | |
2562 } | |
2563 /************************************************************************** | |
2564 * End of the bunch of buddy icon functions | |
2565 **************************************************************************/ | |
2566 | |
7887 | 2567 /* |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2568 * Makes sure all the menu items and all the buttons are hidden/shown and |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8730
diff
changeset
|
2569 * sensitive/insensitive. This is called after changing tabs and when an |
7887 | 2570 * account signs on or off. |
2571 */ | |
4359 | 2572 static void |
7887 | 2573 gray_stuff_out(GaimConversation *conv) |
4359 | 2574 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2575 GaimConvWindow *win; |
7887 | 2576 GaimGtkWindow *gtkwin; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2577 GaimGtkConversation *gtkconv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2578 GaimConnection *gc; |
7887 | 2579 GaimPluginProtocolInfo *prpl_info = NULL; |
7222 | 2580 GdkPixbuf *window_icon = NULL; |
8439 | 2581 GtkIMHtmlButtons buttons; |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2582 |
7887 | 2583 win = gaim_conversation_get_window(conv); |
4359 | 2584 gtkwin = GAIM_GTK_WINDOW(win); |
2585 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7887 | 2586 gc = gaim_conversation_get_gc(conv); |
8439 | 2587 |
7879 | 2588 if (gc != NULL) |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
2589 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2590 |
7887 | 2591 if (gtkwin->menu.send_as != NULL) |
2592 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); | |
2593 | |
2594 /* | |
2595 * Handle hiding and showing stuff based on what type of conv this is. | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2596 * Stuff that Gaim IMs support in general should be shown for IM |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8730
diff
changeset
|
2597 * conversations. Stuff that Gaim chats support in general should be |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2598 * shown for chat conversations. It doesn't matter whether the PRPL |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2599 * supports it or not--that only affects if the button or menu item |
7929 | 2600 * is sensitive or not. |
7887 | 2601 */ |
4359 | 2602 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
7887 | 2603 /* Show stuff that applies to IMs, hide stuff that applies to chats */ |
2604 | |
2605 /* Deal with buttons */ | |
2606 gtk_widget_show(gtkconv->info); | |
2607 gtk_widget_show(gtkconv->send); | |
2608 gtk_widget_show(gtkconv->u.im->warn); | |
2609 gtk_widget_show(gtkconv->u.im->block); | |
9468 | 2610 gtk_widget_show(gtkconv->u.im->send_file); |
7887 | 2611 |
2612 /* Deal with menu items */ | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2613 gtk_widget_show(gtkwin->menu.view_log); |
9468 | 2614 gtk_widget_show(gtkwin->menu.send_file); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2615 gtk_widget_show(gtkwin->menu.add_pounce); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2616 gtk_widget_show(gtkwin->menu.get_info); |
7887 | 2617 gtk_widget_show(gtkwin->menu.warn); |
7859 | 2618 gtk_widget_hide(gtkwin->menu.invite); |
7887 | 2619 gtk_widget_show(gtkwin->menu.alias); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2620 gtk_widget_show(gtkwin->menu.block); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2621 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2622 if (gaim_find_buddy(gaim_conversation_get_account(conv), |
7143 | 2623 gaim_conversation_get_name(conv)) == NULL) { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2624 gtk_widget_show(gtkwin->menu.add); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2625 gtk_widget_hide(gtkwin->menu.remove); |
7929 | 2626 gtk_widget_show(gtkconv->add); |
2627 gtk_widget_hide(gtkconv->remove); | |
7859 | 2628 } else { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2629 gtk_widget_show(gtkwin->menu.remove); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2630 gtk_widget_hide(gtkwin->menu.add); |
7929 | 2631 gtk_widget_hide(gtkconv->add); |
2632 gtk_widget_show(gtkconv->remove); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2633 } |
7887 | 2634 |
2635 gtk_widget_show(gtkwin->menu.insert_link); | |
9287 | 2636 gtk_widget_show(gtkwin->menu.insert_image); |
7887 | 2637 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
9470 | 2638 /* Show stuff that applies to Chats, hide stuff that applies to IMs */ |
7887 | 2639 |
2640 /* Deal with buttons */ | |
7952 | 2641 gtk_widget_show(gtkconv->info); |
7887 | 2642 gtk_widget_show(gtkconv->send); |
2643 gtk_widget_show(gtkconv->u.chat->invite); | |
2644 | |
2645 /* Deal with menu items */ | |
7859 | 2646 gtk_widget_hide(gtkwin->menu.view_log); |
9468 | 2647 gtk_widget_hide(gtkwin->menu.send_file); |
7859 | 2648 gtk_widget_hide(gtkwin->menu.add_pounce); |
2649 gtk_widget_hide(gtkwin->menu.get_info); | |
7887 | 2650 gtk_widget_hide(gtkwin->menu.warn); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2651 gtk_widget_show(gtkwin->menu.invite); |
7887 | 2652 gtk_widget_show(gtkwin->menu.alias); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2653 gtk_widget_hide(gtkwin->menu.block); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2654 |
7879 | 2655 if (gaim_blist_find_chat(gaim_conversation_get_account(conv), |
2656 gaim_conversation_get_name(conv)) == NULL) { | |
9470 | 2657 /* If the chat is NOT in the buddy list */ |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2658 gtk_widget_show(gtkwin->menu.add); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2659 gtk_widget_hide(gtkwin->menu.remove); |
7929 | 2660 gtk_widget_show(gtkconv->add); |
2661 gtk_widget_hide(gtkconv->remove); | |
7859 | 2662 } else { |
9470 | 2663 /* If the chat IS in the buddy list */ |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2664 gtk_widget_show(gtkwin->menu.remove); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2665 gtk_widget_hide(gtkwin->menu.add); |
7929 | 2666 gtk_widget_hide(gtkconv->add); |
2667 gtk_widget_show(gtkconv->remove); | |
7887 | 2668 } |
2669 | |
2670 gtk_widget_show(gtkwin->menu.insert_link); | |
2671 gtk_widget_hide(gtkwin->menu.insert_image); | |
2672 } | |
2673 | |
2674 /* | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2675 * Handle graying stuff out based on whether an account is connected |
7887 | 2676 * and what features that account supports. |
2677 */ | |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
2678 if ((gc != NULL) && |
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
2679 ( (gaim_conversation_get_type(conv) != GAIM_CONV_CHAT) || |
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
2680 !gaim_conv_chat_has_left(GAIM_CONV_CHAT(conv)) )) { |
7887 | 2681 /* Account is online */ |
2682 | |
2683 /* Deal with buttons */ | |
7929 | 2684 gtk_widget_set_sensitive(gtkconv->add, TRUE); |
2685 gtk_widget_set_sensitive(gtkconv->remove, TRUE); | |
7887 | 2686 gtk_widget_set_sensitive(gtkconv->info, (prpl_info->get_info != NULL)); |
7929 | 2687 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2688 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2689 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2690 gtk_widget_set_sensitive(gtkconv->send, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2691 (prpl_info->send_im != NULL)); |
7887 | 2692 gtk_widget_set_sensitive(gtkconv->u.im->warn, |
2693 (prpl_info->warn != NULL)); | |
2694 gtk_widget_set_sensitive(gtkconv->u.im->block, | |
2695 (prpl_info->add_deny != NULL)); | |
9468 | 2696 gtk_widget_set_sensitive(gtkconv->u.im->send_file, |
2697 (prpl_info->send_file | |
2698 && (!prpl_info->can_receive_file | |
2699 || prpl_info->can_receive_file(gc, gaim_conversation_get_name(conv))))); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2700 } |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2701 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2702 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2703 gtk_widget_set_sensitive(gtkconv->send, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2704 (prpl_info->chat_send != NULL)); |
7887 | 2705 gtk_widget_set_sensitive(gtkconv->u.chat->invite, |
2706 (prpl_info->chat_invite != NULL)); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2707 } |
7887 | 2708 |
2709 /* Deal with the toolbar */ | |
8422 | 2710 |
8420 | 2711 if (gc->flags & GAIM_CONNECTION_HTML) { |
8677 | 2712 buttons = GTK_IMHTML_ALL; /* Everything on */ |
8420 | 2713 if (!(prpl_info->options & OPT_PROTO_IM_IMAGE)) |
8422 | 2714 buttons &= ~GTK_IMHTML_IMAGE; |
8420 | 2715 if (gc->flags & GAIM_CONNECTION_NO_BGCOLOR) |
8422 | 2716 buttons &= ~GTK_IMHTML_BACKCOLOR; |
8691
0eb5161ef333
[gaim-migrate @ 9444]
Christian Hammond <chipx86@chipx86.com>
parents:
8690
diff
changeset
|
2717 if (gc->flags & GAIM_CONNECTION_NO_FONTSIZE) { |
0eb5161ef333
[gaim-migrate @ 9444]
Christian Hammond <chipx86@chipx86.com>
parents:
8690
diff
changeset
|
2718 buttons &= ~GTK_IMHTML_GROW; |
0eb5161ef333
[gaim-migrate @ 9444]
Christian Hammond <chipx86@chipx86.com>
parents:
8690
diff
changeset
|
2719 buttons &= ~GTK_IMHTML_SHRINK; |
0eb5161ef333
[gaim-migrate @ 9444]
Christian Hammond <chipx86@chipx86.com>
parents:
8690
diff
changeset
|
2720 } |
9041 | 2721 if (gc->flags & GAIM_CONNECTION_NO_URLDESC) |
2722 buttons &= ~GTK_IMHTML_LINKDESC; | |
8420 | 2723 } else { |
8422 | 2724 buttons = GTK_IMHTML_SMILEY; |
8420 | 2725 } |
2726 gtk_imhtml_set_format_functions(GTK_IMHTML(gtkconv->entry), buttons); | |
8427 | 2727 gtk_imhtmltoolbar_associate_smileys (GTK_IMHTMLTOOLBAR(gtkconv->toolbar), gaim_account_get_protocol_id(gaim_conversation_get_account(conv))); |
8422 | 2728 |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
2729 /* Deal with menu items */ |
7887 | 2730 gtk_widget_set_sensitive(gtkwin->menu.view_log, TRUE); |
2731 gtk_widget_set_sensitive(gtkwin->menu.add_pounce, TRUE); | |
2732 gtk_widget_set_sensitive(gtkwin->menu.get_info, (prpl_info->get_info != NULL)); | |
2733 gtk_widget_set_sensitive(gtkwin->menu.warn, (prpl_info->warn != NULL)); | |
2734 gtk_widget_set_sensitive(gtkwin->menu.invite, | |
2735 (prpl_info->chat_invite != NULL)); | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
2736 |
7887 | 2737 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
9468 | 2738 gtk_widget_set_sensitive(gtkwin->menu.send_file, |
9470 | 2739 (gc && prpl_info->send_file != NULL |
9468 | 2740 && (!prpl_info->can_receive_file |
2741 || prpl_info->can_receive_file(gc, gaim_conversation_get_name(conv))))); | |
7887 | 2742 if (gaim_find_buddy(gaim_conversation_get_account(conv), |
2743 gaim_conversation_get_name(conv)) == NULL) | |
2744 gtk_widget_set_sensitive(gtkwin->menu.alias, FALSE); | |
2745 else | |
2746 gtk_widget_set_sensitive(gtkwin->menu.alias, TRUE); | |
2747 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
2748 if (gaim_blist_find_chat(gaim_conversation_get_account(conv), | |
2749 gaim_conversation_get_name(conv)) == NULL) | |
2750 gtk_widget_set_sensitive(gtkwin->menu.alias, FALSE); | |
2751 else | |
2752 gtk_widget_set_sensitive(gtkwin->menu.alias, TRUE); | |
2753 } | |
2754 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2755 gtk_widget_set_sensitive(gtkwin->menu.block, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2756 (prpl_info->add_deny != NULL)); |
7887 | 2757 gtk_widget_set_sensitive(gtkwin->menu.add, TRUE); |
7859 | 2758 gtk_widget_set_sensitive(gtkwin->menu.remove, TRUE); |
8758 | 2759 gtk_widget_set_sensitive(gtkwin->menu.insert_link, |
2760 gc->flags & GAIM_CONNECTION_HTML); | |
7887 | 2761 gtk_widget_set_sensitive(gtkwin->menu.insert_image, |
2762 (prpl_info->options & OPT_PROTO_IM_IMAGE)); | |
2763 } else { | |
2764 /* Account is offline */ | |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
2765 /* Or it's a chat where we left. */ |
7887 | 2766 |
2767 /* Deal with buttons */ | |
7929 | 2768 gtk_widget_set_sensitive(gtkconv->add, FALSE); |
2769 gtk_widget_set_sensitive(gtkconv->remove, FALSE); | |
7887 | 2770 gtk_widget_set_sensitive(gtkconv->info, FALSE); |
2771 gtk_widget_set_sensitive(gtkconv->send, FALSE); | |
2772 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
2773 gtk_widget_set_sensitive(gtkconv->u.im->warn, FALSE); | |
2774 gtk_widget_set_sensitive(gtkconv->u.im->block, FALSE); | |
9468 | 2775 gtk_widget_set_sensitive(gtkconv->u.im->send_file, FALSE); |
7887 | 2776 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
2777 gtk_widget_set_sensitive(gtkconv->u.chat->invite, FALSE); | |
2778 } | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2779 |
7887 | 2780 /* Then deal with menu items */ |
2781 gtk_widget_set_sensitive(gtkwin->menu.view_log, TRUE); | |
9468 | 2782 gtk_widget_set_sensitive(gtkwin->menu.send_file, FALSE); |
7887 | 2783 gtk_widget_set_sensitive(gtkwin->menu.add_pounce, TRUE); |
2784 gtk_widget_set_sensitive(gtkwin->menu.get_info, FALSE); | |
2785 gtk_widget_set_sensitive(gtkwin->menu.warn, FALSE); | |
2786 gtk_widget_set_sensitive(gtkwin->menu.invite, FALSE); | |
2787 gtk_widget_set_sensitive(gtkwin->menu.alias, FALSE); | |
2788 gtk_widget_set_sensitive(gtkwin->menu.block, FALSE); | |
2789 gtk_widget_set_sensitive(gtkwin->menu.add, FALSE); | |
2790 gtk_widget_set_sensitive(gtkwin->menu.remove, FALSE); | |
7929 | 2791 gtk_widget_set_sensitive(gtkwin->menu.insert_link, TRUE); |
7887 | 2792 gtk_widget_set_sensitive(gtkwin->menu.insert_image, FALSE); |
2793 } | |
2794 | |
2795 /* | |
2796 * Update the window's icon | |
2797 */ | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2798 if ((gaim_conversation_get_type(conv) == GAIM_CONV_IM) && |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2799 (gtkconv->u.im->anim)) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2800 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2801 window_icon = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2802 gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); |
7887 | 2803 g_object_ref(window_icon); |
2804 } else { | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2805 window_icon = get_tab_icon(conv, FALSE); |
4359 | 2806 } |
7887 | 2807 gtk_window_set_icon(GTK_WINDOW(gtkwin->window), window_icon); |
2808 g_object_unref(G_OBJECT(window_icon)); | |
2809 } | |
2810 | |
2811 static void | |
8189 | 2812 before_switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, |
2813 gpointer user_data) | |
2814 { | |
2815 GaimConvWindow *win; | |
2816 GaimConversation *conv; | |
2817 GaimGtkConversation *gtkconv; | |
2818 | |
2819 win = (GaimConvWindow *)user_data; | |
2820 conv = gaim_conv_window_get_active_conversation(win); | |
2821 | |
2822 g_return_if_fail(conv != NULL); | |
2823 | |
8192 | 2824 if (gaim_conversation_get_type(conv) != GAIM_CONV_IM) |
2825 return; | |
2826 | |
8189 | 2827 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2828 | |
2829 stop_anim(NULL, conv); | |
2830 } | |
2831 | |
2832 static void | |
7887 | 2833 switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, |
2834 gpointer user_data) | |
2835 { | |
2836 GaimConvWindow *win; | |
2837 GaimConversation *conv; | |
2838 GaimGtkConversation *gtkconv; | |
2839 GaimGtkWindow *gtkwin; | |
2840 | |
2841 win = (GaimConvWindow *)user_data; | |
2842 conv = gaim_conv_window_get_conversation_at(win, page_num); | |
2843 | |
2844 g_return_if_fail(conv != NULL); | |
2845 | |
2846 gtkwin = GAIM_GTK_WINDOW(win); | |
2847 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2848 | |
2849 gaim_conversation_set_unseen(conv, GAIM_UNSEEN_NONE); | |
2850 | |
2851 /* Update the menubar */ | |
2852 gray_stuff_out(conv); | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2853 |
4736 | 2854 update_typing_icon(conv); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2855 |
4359 | 2856 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.logging), |
7143 | 2857 gaim_conversation_is_logging(conv)); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2858 |
4359 | 2859 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.sounds), |
7143 | 2860 gtkconv->make_sound); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2861 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2862 gtk_check_menu_item_set_active( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2863 GTK_CHECK_MENU_ITEM(gtkwin->menu.show_formatting_toolbar), |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2864 gtkconv->show_formatting_toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2865 |
9188 | 2866 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.show_timestamps), |
2867 gtkconv->show_timestamps); | |
2868 | |
8189 | 2869 /* |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2870 * We pause icons when they are not visible. If this icon should |
9297 | 2871 * be animated then start it back up again. |
8189 | 2872 */ |
8192 | 2873 if ((gaim_conversation_get_type(conv) == GAIM_CONV_IM) && |
2874 (gtkconv->u.im->animate)) | |
8189 | 2875 start_anim(NULL, conv); |
2876 | |
4965 | 2877 gtk_window_set_title(GTK_WINDOW(gtkwin->window), |
7143 | 2878 gtk_label_get_text(GTK_LABEL(gtkconv->tab_label))); |
4359 | 2879 } |
2880 | |
2881 /************************************************************************** | |
2882 * Utility functions | |
2883 **************************************************************************/ | |
2884 | |
2885 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2886 got_typing_keypress(GaimConversation *conv, gboolean first) |
4359 | 2887 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2888 GaimConvIm *im; |
4685 | 2889 |
4359 | 2890 /* |
2891 * We know we got something, so we at least have to make sure we don't | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
2892 * send GAIM_TYPED any time soon. |
4359 | 2893 */ |
2894 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2895 im = GAIM_CONV_IM(conv); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2896 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2897 if (gaim_conv_im_get_type_again_timeout(im)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2898 gaim_conv_im_stop_type_again_timeout(im); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2899 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2900 gaim_conv_im_start_type_again_timeout(im); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2901 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2902 if (first || (gaim_conv_im_get_type_again(im) != 0 && |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2903 time(NULL) > gaim_conv_im_get_type_again(im))) { |
4359 | 2904 |
2905 int timeout = serv_send_typing(gaim_conversation_get_gc(conv), | |
2906 (char *)gaim_conversation_get_name(conv), | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
2907 GAIM_TYPING); |
4359 | 2908 |
2909 if (timeout) | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2910 gaim_conv_im_set_type_again(im, time(NULL) + timeout); |
4359 | 2911 else |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2912 gaim_conv_im_set_type_again(im, 0); |
4359 | 2913 } |
2914 } | |
2915 | |
4736 | 2916 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2917 update_typing_icon(GaimConversation *conv) |
4736 | 2918 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2919 GaimGtkWindow *gtkwin; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2920 GaimConvIm *im = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2921 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); |
4736 | 2922 |
2923 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); | |
2924 | |
2925 if(gaim_conversation_get_type(conv) == GAIM_CONV_IM) | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2926 im = GAIM_CONV_IM(conv); |
4736 | 2927 |
2928 if(gtkwin->menu.typing_icon) { | |
2929 gtk_widget_destroy(gtkwin->menu.typing_icon); | |
2930 gtkwin->menu.typing_icon = NULL; | |
2931 } | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2932 if(im && gaim_conv_im_get_typing_state(im) == GAIM_TYPING) { |
4736 | 2933 gtkwin->menu.typing_icon = gtk_image_menu_item_new(); |
2934 gtk_image_menu_item_set_image( | |
2935 GTK_IMAGE_MENU_ITEM(gtkwin->menu.typing_icon), | |
2936 gtk_image_new_from_stock(GAIM_STOCK_TYPING, | |
2937 GTK_ICON_SIZE_MENU)); | |
4757 | 2938 gtk_tooltips_set_tip(gtkconv->tooltips, gtkwin->menu.typing_icon, |
4736 | 2939 _("User is typing..."), NULL); |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2940 } else if(im && gaim_conv_im_get_typing_state(im) == GAIM_TYPED) { |
4736 | 2941 gtkwin->menu.typing_icon = gtk_image_menu_item_new(); |
2942 gtk_image_menu_item_set_image( | |
2943 GTK_IMAGE_MENU_ITEM(gtkwin->menu.typing_icon), | |
2944 gtk_image_new_from_stock(GAIM_STOCK_TYPED, | |
2945 GTK_ICON_SIZE_MENU)); | |
4757 | 2946 gtk_tooltips_set_tip(gtkconv->tooltips, gtkwin->menu.typing_icon, |
4736 | 2947 _("User has typed something and paused"), NULL); |
2948 } | |
2949 | |
2950 if(gtkwin->menu.typing_icon) { | |
2951 gtk_menu_item_set_right_justified( | |
2952 GTK_MENU_ITEM(gtkwin->menu.typing_icon), TRUE); | |
2953 gtk_widget_show_all(gtkwin->menu.typing_icon); | |
2954 gtk_menu_shell_append(GTK_MENU_SHELL(gtkwin->menu.menubar), | |
2955 gtkwin->menu.typing_icon); | |
2956 } | |
2957 } | |
2958 | |
4685 | 2959 static gboolean |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2960 update_send_as_selection(GaimConvWindow *win) |
4359 | 2961 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2962 GaimAccount *account; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2963 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2964 GaimGtkWindow *gtkwin; |
4359 | 2965 GtkWidget *menu; |
2966 GList *child; | |
2967 | |
7090
04f9f7440bc3
[gaim-migrate @ 7655]
Christian Hammond <chipx86@chipx86.com>
parents:
7089
diff
changeset
|
2968 if (g_list_find(gaim_get_windows(), win) == NULL) |
04f9f7440bc3
[gaim-migrate @ 7655]
Christian Hammond <chipx86@chipx86.com>
parents:
7089
diff
changeset
|
2969 return FALSE; |
4849 | 2970 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2971 conv = gaim_conv_window_get_active_conversation(win); |
4359 | 2972 |
5860
52d5fad43950
[gaim-migrate @ 6291]
Christian Hammond <chipx86@chipx86.com>
parents:
5858
diff
changeset
|
2973 if (conv == NULL) |
52d5fad43950
[gaim-migrate @ 6291]
Christian Hammond <chipx86@chipx86.com>
parents:
5858
diff
changeset
|
2974 return FALSE; |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2975 |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2976 account = gaim_conversation_get_account(conv); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2977 gtkwin = GAIM_GTK_WINDOW(win); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2978 |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2979 if (gtkwin->menu.send_as == NULL) |
4685 | 2980 return FALSE; |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2981 |
4359 | 2982 gtk_widget_show(gtkwin->menu.send_as); |
2983 | |
2984 menu = gtk_menu_item_get_submenu( | |
2985 GTK_MENU_ITEM(gtkwin->menu.send_as)); | |
2986 | |
2987 for (child = gtk_container_get_children(GTK_CONTAINER(menu)); | |
2988 child != NULL; | |
2989 child = child->next) { | |
2990 | |
2991 GtkWidget *item = child->data; | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2992 GaimAccount *item_account = g_object_get_data(G_OBJECT(item), |
4673 | 2993 "gaim_account"); |
2994 | |
2995 if (account == item_account) { | |
4359 | 2996 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE); |
2997 break; | |
2998 } | |
2999 } | |
6030
54c37db13279
[gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents:
6016
diff
changeset
|
3000 |
4685 | 3001 return FALSE; |
4359 | 3002 } |
3003 | |
3004 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3005 generate_send_as_items(GaimConvWindow *win, GaimConversation *deleted_conv) |
4359 | 3006 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3007 GaimGtkWindow *gtkwin; |
4359 | 3008 GtkWidget *menu; |
3009 GtkWidget *menuitem; | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3010 GList *gcs; |
4359 | 3011 GList *convs; |
3012 GSList *group = NULL; | |
3013 gboolean first_offline = TRUE; | |
3014 gboolean found_online = FALSE; | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3015 GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
4359 | 3016 |
3017 gtkwin = GAIM_GTK_WINDOW(win); | |
3018 | |
3019 if (gtkwin->menu.send_as != NULL) | |
3020 gtk_widget_destroy(gtkwin->menu.send_as); | |
3021 | |
3022 /* See if we have > 1 connection active. */ | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3023 if (g_list_length(gaim_connections_get_all()) < 2) { |
4359 | 3024 /* Now make sure we don't have any Offline entries. */ |
3025 gboolean found_offline = FALSE; | |
3026 | |
3027 for (convs = gaim_get_conversations(); | |
3028 convs != NULL; | |
3029 convs = convs->next) { | |
3030 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3031 GaimConversation *conv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3032 GaimAccount *account; |
4491 | 3033 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3034 conv = (GaimConversation *)convs->data; |
4491 | 3035 account = gaim_conversation_get_account(conv); |
3036 | |
6495
8ce66049ce68
[gaim-migrate @ 7010]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
3037 if (account != NULL && account->gc == NULL) { |
4359 | 3038 found_offline = TRUE; |
3039 break; | |
3040 } | |
3041 } | |
3042 | |
3043 if (!found_offline) { | |
3044 gtkwin->menu.send_as = NULL; | |
3045 return; | |
3046 } | |
3047 } | |
3048 | |
3049 /* Build the Send As menu */ | |
3050 gtkwin->menu.send_as = gtk_menu_item_new_with_mnemonic(_("_Send As")); | |
3051 gtk_widget_show(gtkwin->menu.send_as); | |
3052 | |
3053 menu = gtk_menu_new(); | |
7857
43f63ff8a6d8
[gaim-migrate @ 8511]
Christian Hammond <chipx86@chipx86.com>
parents:
7855
diff
changeset
|
3054 gtk_menu_shell_insert(GTK_MENU_SHELL(gtkwin->menu.menubar), |
43f63ff8a6d8
[gaim-migrate @ 8511]
Christian Hammond <chipx86@chipx86.com>
parents:
7855
diff
changeset
|
3055 gtkwin->menu.send_as, 2); |
4359 | 3056 gtk_menu_item_set_submenu(GTK_MENU_ITEM(gtkwin->menu.send_as), menu); |
3057 | |
3058 gtk_widget_show(menu); | |
3059 | |
3060 /* Fill it with entries. */ | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3061 for (gcs = gaim_connections_get_all(); gcs != NULL; gcs = gcs->next) { |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3062 |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3063 GaimConnection *gc; |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3064 GaimAccount *account; |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3065 GtkWidget *box; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3066 GtkWidget *label; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3067 GtkWidget *image; |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3068 GdkPixbuf *pixbuf, *scale; |
4359 | 3069 |
3070 found_online = TRUE; | |
3071 | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3072 gc = (GaimConnection *)gcs->data; |
4359 | 3073 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3074 /* Create a pixmap for the protocol icon. */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3075 pixbuf = create_prpl_icon(gc->account); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3076 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, GDK_INTERP_BILINEAR); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3077 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3078 /* Now convert it to GtkImage */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3079 if (pixbuf == NULL) |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3080 image = gtk_image_new(); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3081 else |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3082 image = gtk_image_new_from_pixbuf(scale); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3083 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3084 gtk_size_group_add_widget(sg, image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3085 |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3086 g_object_unref(G_OBJECT(scale)); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3087 g_object_unref(G_OBJECT(pixbuf)); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3088 |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3089 account = gaim_connection_get_account(gc); |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3090 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3091 /* Make our menu item */ |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3092 menuitem = gtk_radio_menu_item_new_with_label(group, |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3093 gaim_account_get_username(account)); |
4793 | 3094 group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem)); |
4359 | 3095 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3096 /* Do some evil, see some evil, speak some evil. */ |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3097 box = gtk_hbox_new(FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3098 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3099 label = gtk_bin_get_child(GTK_BIN(menuitem)); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3100 g_object_ref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3101 gtk_container_remove(GTK_CONTAINER(menuitem), label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3102 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3103 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3104 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 4); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3105 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3106 g_object_unref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3107 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3108 gtk_container_add(GTK_CONTAINER(menuitem), box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3109 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3110 gtk_widget_show(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3111 gtk_widget_show(image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3112 gtk_widget_show(box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3113 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3114 /* Set our data and callbacks. */ |
4359 | 3115 g_object_set_data(G_OBJECT(menuitem), "user_data", win); |
4673 | 3116 g_object_set_data(G_OBJECT(menuitem), "gaim_account", gc->account); |
4359 | 3117 |
4786 | 3118 g_signal_connect(G_OBJECT(menuitem), "activate", |
4673 | 3119 G_CALLBACK(menu_conv_sel_send_cb), NULL); |
4359 | 3120 |
3121 gtk_widget_show(menuitem); | |
3122 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
3123 } | |
3124 | |
3125 /* | |
3126 * Fill it with any accounts that still has an open (yet disabled) window | |
3127 * (signed off accounts with a window open). | |
3128 */ | |
3129 for (convs = gaim_get_conversations(); | |
3130 convs != NULL; | |
3131 convs = convs->next) { | |
3132 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3133 GaimConversation *conv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3134 GaimAccount *account; |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3135 GtkWidget *box; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3136 GtkWidget *label; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3137 GtkWidget *image; |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3138 GdkPixbuf *pixbuf, *scale; |
4359 | 3139 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3140 conv = (GaimConversation *)convs->data; |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3141 |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3142 if (conv == deleted_conv) |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3143 continue; |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3144 |
4491 | 3145 account = gaim_conversation_get_account(conv); |
3146 | |
6495
8ce66049ce68
[gaim-migrate @ 7010]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
3147 if (account != NULL && account->gc == NULL) { |
4359 | 3148 if (first_offline && found_online) { |
3149 menuitem = gtk_separator_menu_item_new(); | |
3150 gtk_widget_show(menuitem); | |
3151 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
3152 | |
3153 first_offline = FALSE; | |
3154 } | |
3155 | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3156 /* Create a pixmap for the protocol icon. */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3157 pixbuf = create_prpl_icon(account); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3158 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3159 GDK_INTERP_BILINEAR); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3160 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3161 /* Now convert it to GtkImage */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3162 if (pixbuf == NULL) |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3163 image = gtk_image_new(); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3164 else |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3165 image = gtk_image_new_from_pixbuf(scale); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3166 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3167 gtk_size_group_add_widget(sg, image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3168 |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3169 if (scale != NULL) g_object_unref(scale); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3170 if (pixbuf != NULL) g_object_unref(pixbuf); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3171 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3172 /* Make our menu item */ |
4359 | 3173 menuitem = gtk_radio_menu_item_new_with_label(group, |
4491 | 3174 account->username); |
4793 | 3175 group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem)); |
4359 | 3176 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3177 /* Do some evil, see some evil, speak some evil. */ |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3178 box = gtk_hbox_new(FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3179 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3180 label = gtk_bin_get_child(GTK_BIN(menuitem)); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3181 g_object_ref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3182 gtk_container_remove(GTK_CONTAINER(menuitem), label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3183 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3184 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3185 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 4); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3186 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3187 g_object_unref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3188 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3189 gtk_container_add(GTK_CONTAINER(menuitem), box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3190 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3191 gtk_widget_show(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3192 gtk_widget_show(image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3193 gtk_widget_show(box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3194 |
4359 | 3195 gtk_widget_set_sensitive(menuitem, FALSE); |
4786 | 3196 g_object_set_data(G_OBJECT(menuitem), "user_data", win); |
4674 | 3197 g_object_set_data(G_OBJECT(menuitem), "gaim_account", account); |
4359 | 3198 |
4786 | 3199 g_signal_connect(G_OBJECT(menuitem), "activate", |
5902
6889b89cab90
[gaim-migrate @ 6334]
Christian Hammond <chipx86@chipx86.com>
parents:
5901
diff
changeset
|
3200 G_CALLBACK(menu_conv_sel_send_cb), NULL); |
4786 | 3201 |
4359 | 3202 gtk_widget_show(menuitem); |
3203 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
3204 } | |
3205 } | |
3206 | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3207 g_object_unref(sg); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3208 |
4359 | 3209 gtk_widget_show(gtkwin->menu.send_as); |
3210 update_send_as_selection(win); | |
3211 } | |
3212 | |
3213 static GList * | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3214 generate_invite_user_names(GaimConnection *gc) |
4359 | 3215 { |
6695 | 3216 GaimBlistNode *gnode,*cnode,*bnode; |
4359 | 3217 static GList *tmp = NULL; |
3218 | |
3219 if (tmp) | |
3220 g_list_free(tmp); | |
3221 | |
3222 tmp = g_list_append(NULL, ""); | |
3223 | |
3224 if (gc != NULL) { | |
4785 | 3225 for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { |
3226 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) | |
3227 continue; | |
6695 | 3228 for(cnode = gnode->child; cnode; cnode = cnode->next) { |
3229 if(!GAIM_BLIST_NODE_IS_CONTACT(cnode)) | |
4785 | 3230 continue; |
6695 | 3231 for(bnode = cnode->child; bnode; bnode = bnode->next) { |
3232 GaimBuddy *buddy; | |
3233 | |
3234 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) | |
3235 continue; | |
3236 | |
3237 buddy = (GaimBuddy *)bnode; | |
3238 | |
3239 if (buddy->account == gc->account && | |
3240 GAIM_BUDDY_IS_ONLINE(buddy)) | |
3241 tmp = g_list_append(tmp, buddy->name); | |
3242 } | |
4359 | 3243 } |
3244 } | |
3245 } | |
3246 | |
3247 return tmp; | |
3248 } | |
3249 | |
9498 | 3250 static GdkPixbuf * |
9554 | 3251 get_chat_buddy_status_icon(GaimConvChat *chat, const char *name, GaimConvChatBuddyFlags flags) |
9498 | 3252 { |
9554 | 3253 GdkPixbuf *pixbuf, *scale, *scale2; |
9498 | 3254 char *filename; |
9554 | 3255 char *image = NULL; |
3256 | |
3257 if (flags & GAIM_CBFLAGS_FOUNDER) { | |
3258 image = g_strdup("founder.svg"); | |
3259 } else if (flags & GAIM_CBFLAGS_OP) { | |
3260 image = g_strdup("op.svg"); | |
3261 } else if (flags & GAIM_CBFLAGS_HALFOP) { | |
3262 image = g_strdup("halfop.svg"); | |
3263 } else if (flags & GAIM_CBFLAGS_VOICE) { | |
3264 image = g_strdup("voice.svg"); | |
3265 } else if ((!flags) && gaim_conv_chat_is_user_ignored(chat, name)) { | |
3266 image = g_strdup("ignored.svg"); | |
3267 } | |
3268 if (image) { | |
3269 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL); | |
3270 g_free(image); | |
9498 | 3271 pixbuf = gdk_pixbuf_new_from_file(filename, NULL); |
3272 g_free(filename); | |
3273 if (!pixbuf) | |
3274 return NULL; | |
3275 scale = gdk_pixbuf_scale_simple(pixbuf, 15, 15, GDK_INTERP_BILINEAR); | |
3276 g_object_unref(pixbuf); | |
9554 | 3277 if (flags && gaim_conv_chat_is_user_ignored(chat, name)) { |
3278 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", "ignored.svg", NULL); | |
3279 pixbuf = gdk_pixbuf_new_from_file(filename, NULL); | |
3280 g_free(filename); | |
3281 scale2 = gdk_pixbuf_scale_simple(pixbuf, 15, 15, GDK_INTERP_BILINEAR); | |
3282 g_object_unref(pixbuf); | |
3283 gdk_pixbuf_composite(scale2, scale, 0, 0, 15, 15, 0, 0, 1, 1, GDK_INTERP_BILINEAR, 192); | |
3284 g_object_unref(scale2); | |
3285 } | |
9498 | 3286 return scale; |
3287 } | |
3288 | |
3289 return NULL; | |
3290 } | |
3291 | |
4359 | 3292 static void |
9554 | 3293 add_chat_buddy_common(GaimConversation *conv, const char *name) |
4359 | 3294 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3295 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3296 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3297 GaimConvChat *chat; |
9554 | 3298 GaimConvChatBuddyFlags flags; |
4359 | 3299 GtkTreeIter iter; |
3300 GtkListStore *ls; | |
9498 | 3301 GdkPixbuf *pixbuf; |
4359 | 3302 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3303 chat = GAIM_CONV_CHAT(conv); |
4359 | 3304 gtkconv = GAIM_GTK_CONVERSATION(conv); |
3305 gtkchat = gtkconv->u.chat; | |
3306 | |
3307 ls = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list))); | |
3308 | |
9554 | 3309 flags = gaim_conv_chat_user_get_flags(chat, name); |
3310 pixbuf = get_chat_buddy_status_icon(chat, name, flags); | |
9498 | 3311 |
4359 | 3312 gtk_list_store_append(ls, &iter); |
9498 | 3313 gtk_list_store_set(ls, &iter, CHAT_USERS_ICON_COLUMN, pixbuf, |
9554 | 3314 CHAT_USERS_NAME_COLUMN, name, CHAT_USERS_FLAGS_COLUMN, flags, -1); |
9498 | 3315 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), CHAT_USERS_NAME_COLUMN, |
4359 | 3316 GTK_SORT_ASCENDING); |
9554 | 3317 if (pixbuf) |
3318 g_object_unref(pixbuf); | |
4359 | 3319 } |
3320 | |
3321 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3322 tab_complete(GaimConversation *conv) |
4359 | 3323 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3324 GaimGtkConversation *gtkconv; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3325 GaimConvChat *chat; |
4359 | 3326 GtkTextIter cursor, word_start, start_buffer; |
3327 int start; | |
3328 int most_matched = -1; | |
3329 char *entered, *partial = NULL; | |
3330 char *text; | |
8021 | 3331 char *nick_partial; |
4359 | 3332 GList *matches = NULL; |
3333 GList *nicks = NULL; | |
3334 | |
3335 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3336 chat = GAIM_CONV_CHAT(conv); |
4359 | 3337 |
3338 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_buffer); | |
3339 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, | |
3340 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
3341 | |
3342 word_start = cursor; | |
3343 | |
3344 /* if there's nothing there just return */ | |
3345 if (!gtk_text_iter_compare(&cursor, &start_buffer)) | |
3346 return; | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
3347 |
4359 | 3348 text = gtk_text_buffer_get_text(gtkconv->entry_buffer, &start_buffer, |
3349 &cursor, FALSE); | |
3350 | |
3351 /* if we're at the end of ": " we need to move back 2 spaces */ | |
3352 start = strlen(text) - 1; | |
3353 | |
8021 | 3354 if (strlen(text) >= 2 && !strncmp(&text[start-1], ": ", 2)) { |
4359 | 3355 gtk_text_iter_backward_chars(&word_start, 2); |
8021 | 3356 start-=2; |
3357 } | |
4359 | 3358 |
3359 /* find the start of the word that we're tabbing */ | |
3360 while (start >= 0 && text[start] != ' ') { | |
3361 gtk_text_iter_backward_char(&word_start); | |
3362 start--; | |
3363 } | |
3364 | |
3365 g_free(text); | |
3366 | |
3367 entered = gtk_text_buffer_get_text(gtkconv->entry_buffer, &word_start, | |
3368 &cursor, FALSE); | |
3369 | |
8021 | 3370 if (!g_utf8_strlen(entered, -1)) { |
4359 | 3371 g_free(entered); |
3372 return; | |
3373 } | |
3374 | |
8021 | 3375 nick_partial = g_malloc(strlen(entered)+1); |
3376 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3377 for (nicks = gaim_conv_chat_get_users(chat); |
4359 | 3378 nicks != NULL; |
3379 nicks = nicks->next) { | |
3380 | |
9554 | 3381 GaimConvChatBuddy *cb = nicks->data; |
3382 | |
3383 strncpy(nick_partial, cb->name, strlen(entered)); | |
8172 | 3384 nick_partial[strlen(entered)] = '\0'; |
8021 | 3385 if(gaim_utf8_strcasecmp(nick_partial, entered)) |
3386 continue; | |
4359 | 3387 |
3388 /* if we're here, it's a possible completion */ | |
3389 | |
3390 if (most_matched == -1) { | |
3391 /* | |
3392 * this will only get called once, since from now | |
3393 * on most_matched is >= 0 | |
3394 */ | |
9554 | 3395 most_matched = strlen(cb->name); |
3396 partial = g_strdup(cb->name); | |
4359 | 3397 } |
3398 else if (most_matched) { | |
9554 | 3399 char *tmp = g_strdup(cb->name); |
8021 | 3400 |
3401 while (gaim_utf8_strcasecmp(tmp, partial)) { | |
3402 partial[most_matched] = '\0'; | |
3403 if(most_matched < strlen(tmp)) | |
3404 tmp[most_matched] = '\0'; | |
4359 | 3405 most_matched--; |
8021 | 3406 } |
8079 | 3407 most_matched++; |
8021 | 3408 |
3409 g_free(tmp); | |
4359 | 3410 } |
3411 | |
9554 | 3412 matches = g_list_append(matches, cb->name); |
4359 | 3413 } |
3414 | |
8021 | 3415 g_free(nick_partial); |
3416 | |
4359 | 3417 /* we're only here if we're doing new style */ |
3418 | |
3419 /* if there weren't any matches, return */ | |
3420 if (!matches) { | |
3421 /* if matches isn't set partials won't be either */ | |
3422 g_free(entered); | |
3423 return; | |
3424 } | |
3425 | |
3426 gtk_text_buffer_delete(gtkconv->entry_buffer, &word_start, &cursor); | |
3427 | |
3428 if (!matches->next) { | |
3429 /* there was only one match. fill it in. */ | |
3430 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_buffer); | |
3431 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, | |
3432 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
3433 | |
3434 if (!gtk_text_iter_compare(&cursor, &start_buffer)) { | |
3435 char *tmp = g_strdup_printf("%s: ", (char *)matches->data); | |
3436 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, tmp, -1); | |
3437 g_free(tmp); | |
3438 } | |
3439 else | |
3440 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, | |
3441 matches->data, -1); | |
3442 | |
3443 matches = g_list_remove(matches, matches->data); | |
3444 } | |
3445 else { | |
3446 /* | |
3447 * there were lots of matches, fill in as much as possible | |
3448 * and display all of them | |
3449 */ | |
3450 char *addthis = g_malloc0(1); | |
3451 | |
3452 while (matches) { | |
3453 char *tmp = addthis; | |
3454 addthis = g_strconcat(tmp, matches->data, " ", NULL); | |
3455 g_free(tmp); | |
3456 matches = g_list_remove(matches, matches->data); | |
3457 } | |
3458 | |
6982 | 3459 gaim_conversation_write(conv, NULL, addthis, GAIM_MESSAGE_NO_LOG, |
4359 | 3460 time(NULL)); |
3461 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, partial, -1); | |
3462 g_free(addthis); | |
3463 } | |
3464 | |
3465 g_free(entered); | |
3466 g_free(partial); | |
3467 } | |
3468 | |
3469 static GtkItemFactoryEntry menu_items[] = | |
3470 { | |
3471 /* Conversation menu */ | |
4596 | 3472 { N_("/_Conversation"), NULL, NULL, 0, "<Branch>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3473 |
7887 | 3474 { N_("/Conversation/New Instant _Message..."), "<CTL>M", menu_new_conv_cb, |
7859 | 3475 0, "<StockItem>", GAIM_STOCK_IM }, |
3476 | |
3477 { "/Conversation/sep0", NULL, NULL, 0, "<Separator>" }, | |
3478 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3479 { N_("/Conversation/_Find..."), NULL, menu_find_cb, 0, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3480 "<StockItem>", GTK_STOCK_FIND }, |
7859 | 3481 { N_("/Conversation/View _Log"), NULL, menu_view_log_cb, 0, NULL }, |
4596 | 3482 { N_("/Conversation/_Save As..."), NULL, menu_save_as_cb, 0, |
4359 | 3483 "<StockItem>", GTK_STOCK_SAVE_AS }, |
8974 | 3484 { 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
|
3485 |
4359 | 3486 { "/Conversation/sep1", NULL, NULL, 0, "<Separator>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3487 |
9468 | 3488 { 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
|
3489 { N_("/Conversation/Add Buddy _Pounce..."), NULL, menu_add_pounce_cb, |
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
3490 0, NULL }, |
7859 | 3491 { N_("/Conversation/_Get Info"), NULL, menu_get_info_cb, 0, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3492 "<StockItem>", GAIM_STOCK_INFO }, |
7859 | 3493 { N_("/Conversation/_Warn..."), NULL, menu_warn_cb, 0, |
3494 "<StockItem>", GAIM_STOCK_WARN }, | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3495 { N_("/Conversation/In_vite..."), NULL, menu_invite_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3496 "<StockItem>", GAIM_STOCK_INVITE }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3497 |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
3498 { "/Conversation/sep2", NULL, NULL, 0, "<Separator>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3499 |
7859 | 3500 { N_("/Conversation/A_lias..."), NULL, menu_alias_cb, 0, |
3501 "<StockItem>", GAIM_STOCK_EDIT }, | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3502 { N_("/Conversation/_Block..."), NULL, menu_block_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3503 "<StockItem>", GAIM_STOCK_BLOCK }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3504 { N_("/Conversation/_Add..."), NULL, menu_add_remove_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3505 "<StockItem>", GTK_STOCK_ADD }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3506 { N_("/Conversation/_Remove..."), NULL, menu_add_remove_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3507 "<StockItem>", GTK_STOCK_REMOVE }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3508 |
7859 | 3509 { "/Conversation/sep3", NULL, NULL, 0, "<Separator>" }, |
3510 | |
8756 | 3511 { N_("/Conversation/Insert Lin_k..."), NULL, menu_insert_link_cb, 0, |
7859 | 3512 "<StockItem>", GAIM_STOCK_LINK }, |
9287 | 3513 { N_("/Conversation/Insert Imag_e..."), NULL, menu_insert_image_cb, 0, |
7859 | 3514 "<StockItem>", GAIM_STOCK_IMAGE }, |
3515 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3516 { "/Conversation/sep4", NULL, NULL, 0, "<Separator>" }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3517 |
4596 | 3518 { N_("/Conversation/_Close"), NULL, menu_close_conv_cb, 0, |
4359 | 3519 "<StockItem>", GTK_STOCK_CLOSE }, |
3520 | |
3521 /* Options */ | |
4596 | 3522 { N_("/_Options"), NULL, NULL, 0, "<Branch>" }, |
3523 { N_("/Options/Enable _Logging"), NULL, menu_logging_cb, 0, "<CheckItem>" }, | |
3524 { N_("/Options/Enable _Sounds"), NULL, menu_sounds_cb, 0, "<CheckItem>" }, | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3525 { N_("/Options/Show Formatting _Toolbar"), NULL, menu_toolbar_cb, 0, "<CheckItem>" }, |
9188 | 3526 { N_("/Options/Show T_imestamps"), "F2", menu_timestamps_cb, 0, "<CheckItem>" }, |
4359 | 3527 }; |
3528 | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
3529 static const int menu_item_count = |
4359 | 3530 sizeof(menu_items) / sizeof(*menu_items); |
3531 | |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3532 static char * |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3533 item_factory_translate_func (const char *path, gpointer func_data) |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3534 { |
7386 | 3535 return _((char *)path); |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3536 } |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3537 |
4359 | 3538 static GtkWidget * |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3539 setup_menubar(GaimConvWindow *win) |
4359 | 3540 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3541 GaimGtkWindow *gtkwin; |
5116 | 3542 GtkAccelGroup *accel_group; |
4359 | 3543 gtkwin = GAIM_GTK_WINDOW(win); |
3544 | |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
3545 accel_group = gtk_accel_group_new (); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
3546 gtk_window_add_accel_group (GTK_WINDOW (gtkwin->window), accel_group); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
3547 g_object_unref (accel_group); |
5116 | 3548 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3549 gtkwin->menu.item_factory = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3550 gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<main>", accel_group); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3551 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3552 gtk_item_factory_set_translate_func(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3553 item_factory_translate_func, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3554 NULL, NULL); |
4630 | 3555 |
3556 gtk_item_factory_create_items(gtkwin->menu.item_factory, menu_item_count, | |
4359 | 3557 menu_items, win); |
7420 | 3558 g_signal_connect(G_OBJECT(accel_group), "accel-changed", |
3559 G_CALLBACK(gaim_gtk_save_accels_cb), NULL); | |
4359 | 3560 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3561 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3562 gtkwin->menu.menubar = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3563 gtk_item_factory_get_widget(gtkwin->menu.item_factory, "<main>"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3564 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3565 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3566 gtkwin->menu.view_log = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3567 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
7295 | 3568 N_("/Conversation/View Log")); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3569 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3570 |
9468 | 3571 gtkwin->menu.send_file = |
3572 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3573 N_("/Conversation/Send File...")); | |
9498 | 3574 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3575 gtkwin->menu.add_pounce = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3576 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3577 N_("/Conversation/Add Buddy Pounce...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3578 |
7879 | 3579 /* --- */ |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3580 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3581 gtkwin->menu.get_info = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3582 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
7859 | 3583 N_("/Conversation/Get Info")); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3584 |
7879 | 3585 gtkwin->menu.warn = |
3586 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3587 N_("/Conversation/Warn...")); | |
3588 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3589 gtkwin->menu.invite = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3590 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3591 N_("/Conversation/Invite...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3592 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3593 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3594 |
7879 | 3595 gtkwin->menu.alias = |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3596 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
7879 | 3597 N_("/Conversation/Alias...")); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3598 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3599 gtkwin->menu.block = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3600 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3601 N_("/Conversation/Block...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3602 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3603 gtkwin->menu.add = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3604 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3605 N_("/Conversation/Add...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3606 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3607 gtkwin->menu.remove = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3608 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3609 N_("/Conversation/Remove...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3610 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3611 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3612 |
7879 | 3613 gtkwin->menu.insert_link = |
3614 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3615 N_("/Conversation/Insert Link...")); | |
3616 | |
3617 gtkwin->menu.insert_image = | |
3618 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3619 N_("/Conversation/Insert Image...")); | |
3620 | |
3621 /* --- */ | |
3622 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3623 gtkwin->menu.logging = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3624 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3625 N_("/Options/Enable Logging")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3626 gtkwin->menu.sounds = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3627 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3628 N_("/Options/Enable Sounds")); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3629 gtkwin->menu.show_formatting_toolbar = |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3630 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3631 N_("/Options/Show Formatting Toolbar")); |
9188 | 3632 gtkwin->menu.show_timestamps = |
3633 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3634 N_("/Options/Show Timestamps")); | |
4359 | 3635 |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3636 generate_send_as_items(win, NULL); |
4359 | 3637 |
3638 gtk_widget_show(gtkwin->menu.menubar); | |
4931 | 3639 |
3640 return gtkwin->menu.menubar; | |
4359 | 3641 } |
3642 | |
3643 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3644 setup_im_buttons(GaimConversation *conv, GtkWidget *parent) |
4359 | 3645 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3646 GaimConnection *gc; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3647 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3648 GaimGtkImPane *gtkim; |
8811 | 3649 GaimButtonStyle button_type; |
4359 | 3650 |
3651 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3652 gtkim = gtkconv->u.im; | |
3653 gc = gaim_conversation_get_gc(conv); | |
3654 | |
3655 /* From right to left... */ | |
3656 | |
3657 /* Send button */ | |
3658 gtkconv->send = gaim_gtk_change_text(_("Send"), gtkconv->send, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3659 GAIM_STOCK_SEND, GAIM_CONV_IM); |
4359 | 3660 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->send, _("Send"), NULL); |
3661 gtk_box_pack_end(GTK_BOX(parent), gtkconv->send, FALSE, FALSE, 0); | |
3662 | |
3663 /* Separator */ | |
3664 if (gtkim->sep2 != NULL) | |
3665 gtk_widget_destroy(gtkim->sep2); | |
3666 | |
3667 gtkim->sep2 = gtk_vseparator_new(); | |
3668 gtk_box_pack_end(GTK_BOX(parent), gtkim->sep2, FALSE, TRUE, 0); | |
3669 gtk_widget_show(gtkim->sep2); | |
3670 | |
3671 /* Now, um, just kind of all over the place. Huh? */ | |
3672 | |
3673 /* Warn button */ | |
3674 gtkim->warn = gaim_gtk_change_text(_("Warn"), gtkim->warn, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3675 GAIM_STOCK_WARN, GAIM_CONV_IM); |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3676 gtk_tooltips_set_tip(gtkconv->tooltips, gtkim->warn, |
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3677 _("Warn the user"), NULL); |
7929 | 3678 gtk_box_pack_start(GTK_BOX(parent), gtkim->warn, FALSE, FALSE, 0); |
3679 | |
3680 /* Block button */ | |
3681 gtkim->block = gaim_gtk_change_text(_("Block"), gtkim->block, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3682 GAIM_STOCK_BLOCK, GAIM_CONV_IM); |
7929 | 3683 gtk_tooltips_set_tip(gtkconv->tooltips, gtkim->block, |
3684 _("Block the user"), NULL); | |
3685 gtk_box_pack_start(GTK_BOX(parent), gtkim->block, FALSE, FALSE, 0); | |
3686 | |
9554 | 3687 /* Send File button */ |
9468 | 3688 gtkim->send_file = gaim_gtk_change_text(_("Send File"), gtkim->send_file, |
3689 GAIM_STOCK_FILE_TRANSFER, GAIM_CONV_IM); | |
3690 gtk_tooltips_set_tip(gtkconv->tooltips, gtkim->send_file, | |
3691 _("Send a file to the user"), NULL); | |
3692 gtk_box_pack_start(GTK_BOX(parent), gtkim->send_file, FALSE, FALSE, 0); | |
3693 | |
7929 | 3694 /* Add button */ |
3695 gtkconv->add = gaim_gtk_change_text(_("Add"), gtkconv->add, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3696 GTK_STOCK_ADD, GAIM_CONV_IM); |
7929 | 3697 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->add, |
3698 _("Add the user to your buddy list"), NULL); | |
3699 gtk_box_pack_start(GTK_BOX(parent), gtkconv->add, FALSE, FALSE, 0); | |
3700 | |
3701 /* Remove button */ | |
3702 gtkconv->remove = gaim_gtk_change_text(_("Remove"), gtkconv->remove, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3703 GTK_STOCK_REMOVE, GAIM_CONV_IM); |
7929 | 3704 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->remove, |
3705 _("Remove the user from your buddy list"), NULL); | |
3706 gtk_box_pack_start(GTK_BOX(parent), gtkconv->remove, FALSE, FALSE, 0); | |
4359 | 3707 |
3708 /* Info button */ | |
3709 gtkconv->info = gaim_gtk_change_text(_("Info"), gtkconv->info, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3710 GAIM_STOCK_INFO, GAIM_CONV_IM); |
4359 | 3711 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->info, |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3712 _("Get the user's information"), NULL); |
7929 | 3713 gtk_box_pack_start(GTK_BOX(parent), gtkconv->info, FALSE, FALSE, 0); |
3714 | |
3715 gtk_button_set_relief(GTK_BUTTON(gtkim->warn), GTK_RELIEF_NONE); | |
3716 gtk_button_set_relief(GTK_BUTTON(gtkim->block), GTK_RELIEF_NONE); | |
9468 | 3717 gtk_button_set_relief(GTK_BUTTON(gtkim->send_file), GTK_RELIEF_NONE); |
7929 | 3718 gtk_button_set_relief(GTK_BUTTON(gtkconv->add), GTK_RELIEF_NONE); |
3719 gtk_button_set_relief(GTK_BUTTON(gtkconv->remove), GTK_RELIEF_NONE); | |
4359 | 3720 gtk_button_set_relief(GTK_BUTTON(gtkconv->info), GTK_RELIEF_NONE); |
3721 gtk_button_set_relief(GTK_BUTTON(gtkconv->send), GTK_RELIEF_NONE); | |
7929 | 3722 |
3723 gtk_size_group_add_widget(gtkconv->sg, gtkim->warn); | |
3724 gtk_size_group_add_widget(gtkconv->sg, gtkim->block); | |
9468 | 3725 gtk_size_group_add_widget(gtkconv->sg, gtkim->send_file); |
7929 | 3726 gtk_size_group_add_widget(gtkconv->sg, gtkconv->add); |
3727 gtk_size_group_add_widget(gtkconv->sg, gtkconv->remove); | |
4359 | 3728 gtk_size_group_add_widget(gtkconv->sg, gtkconv->info); |
3729 gtk_size_group_add_widget(gtkconv->sg, gtkconv->send); | |
7929 | 3730 |
3731 gtk_box_reorder_child(GTK_BOX(parent), gtkim->warn, 1); | |
3732 gtk_box_reorder_child(GTK_BOX(parent), gtkim->block, 2); | |
9468 | 3733 gtk_box_reorder_child(GTK_BOX(parent), gtkim->send_file,3); |
3734 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->add, 4); | |
3735 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->remove, 5); | |
3736 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->info, 6); | |
4359 | 3737 |
3738 gaim_gtkconv_update_buttons_by_protocol(conv); | |
3739 | |
8811 | 3740 /* Check if the buttons should be visible or not */ |
9150 | 3741 button_type = gaim_prefs_get_int("/gaim/gtk/conversations/button_type"); |
8811 | 3742 if (button_type == GAIM_BUTTON_NONE) |
3743 gtk_widget_hide(gtkconv->bbox); | |
3744 else | |
3745 gtk_widget_show(gtkconv->bbox); | |
3746 | |
4359 | 3747 g_signal_connect(G_OBJECT(gtkim->warn), "clicked", |
3748 G_CALLBACK(warn_cb), conv); | |
3749 g_signal_connect(G_OBJECT(gtkim->block), "clicked", | |
3750 G_CALLBACK(block_cb), conv); | |
9468 | 3751 g_signal_connect(G_OBJECT(gtkim->send_file), "clicked", |
3752 G_CALLBACK(send_file_cb), conv); | |
7929 | 3753 g_signal_connect(G_OBJECT(gtkconv->add), "clicked", |
3754 G_CALLBACK(add_remove_cb), conv); | |
3755 g_signal_connect(G_OBJECT(gtkconv->remove), "clicked", | |
3756 G_CALLBACK(add_remove_cb), conv); | |
3757 g_signal_connect(G_OBJECT(gtkconv->info), "clicked", | |
3758 G_CALLBACK(info_cb), conv); | |
3759 g_signal_connect(G_OBJECT(gtkconv->send), "clicked", | |
3760 G_CALLBACK(send_cb), conv); | |
4359 | 3761 } |
3762 | |
3763 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3764 setup_chat_buttons(GaimConversation *conv, GtkWidget *parent) |
4359 | 3765 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3766 GaimConnection *gc; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3767 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3768 GaimGtkChatPane *gtkchat; |
8811 | 3769 GaimButtonStyle button_type; |
4359 | 3770 |
3771 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3772 gtkchat = gtkconv->u.chat; | |
3773 gc = gaim_conversation_get_gc(conv); | |
3774 | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3775 /* From right to left... */ |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3776 |
4359 | 3777 /* Send button */ |
3778 gtkconv->send = gaim_gtk_change_text(_("Send"), gtkconv->send, | |
3779 GAIM_STOCK_SEND, GAIM_CONV_CHAT); | |
3780 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->send, _("Send"), NULL); | |
3781 gtk_box_pack_end(GTK_BOX(parent), gtkconv->send, FALSE, FALSE, 0); | |
3782 | |
3783 /* Separator */ | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3784 if (gtkchat->sep != NULL) |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3785 gtk_widget_destroy(gtkchat->sep); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3786 |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3787 gtkchat->sep = gtk_vseparator_new(); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3788 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
|
3789 gtk_widget_show(gtkchat->sep); |
4359 | 3790 |
3791 /* Invite */ | |
3792 gtkchat->invite = gaim_gtk_change_text(_("Invite"), gtkchat->invite, | |
3793 GAIM_STOCK_INVITE, GAIM_CONV_CHAT); | |
3794 gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->invite, | |
3795 _("Invite a user"), NULL); | |
7931 | 3796 gtk_box_pack_start(GTK_BOX(parent), gtkchat->invite, FALSE, FALSE, 0); |
4359 | 3797 |
7929 | 3798 /* Add button */ |
3799 gtkconv->add = gaim_gtk_change_text(_("Add"), gtkconv->add, | |
3800 GTK_STOCK_ADD, GAIM_CONV_CHAT); | |
3801 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->add, | |
3802 _("Add the chat to your buddy list"), NULL); | |
3803 gtk_box_pack_start(GTK_BOX(parent), gtkconv->add, FALSE, FALSE, 0); | |
3804 | |
3805 /* Remove button */ | |
3806 gtkconv->remove = gaim_gtk_change_text(_("Remove"), gtkconv->remove, | |
3807 GTK_STOCK_REMOVE, GAIM_CONV_CHAT); | |
3808 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->remove, | |
3809 _("Remove the chat from your buddy list"), NULL); | |
3810 gtk_box_pack_start(GTK_BOX(parent), gtkconv->remove, FALSE, FALSE, 0); | |
3811 | |
4359 | 3812 /* Set the relief on these. */ |
3813 gtk_button_set_relief(GTK_BUTTON(gtkchat->invite), GTK_RELIEF_NONE); | |
7929 | 3814 gtk_button_set_relief(GTK_BUTTON(gtkconv->add), GTK_RELIEF_NONE); |
3815 gtk_button_set_relief(GTK_BUTTON(gtkconv->remove), GTK_RELIEF_NONE); | |
4359 | 3816 gtk_button_set_relief(GTK_BUTTON(gtkconv->send), GTK_RELIEF_NONE); |
3817 | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3818 gtk_size_group_add_widget(gtkconv->sg, gtkchat->invite); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3819 gtk_size_group_add_widget(gtkconv->sg, gtkconv->add); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3820 gtk_size_group_add_widget(gtkconv->sg, gtkconv->remove); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3821 gtk_size_group_add_widget(gtkconv->sg, gtkconv->send); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3822 |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3823 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->add, 1); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3824 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->remove, 3); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3825 gtk_box_reorder_child(GTK_BOX(parent), gtkchat->invite, 3); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3826 |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3827 gaim_gtkconv_update_buttons_by_protocol(conv); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3828 |
8811 | 3829 /* Check if the buttons should be visible or not */ |
9150 | 3830 button_type = gaim_prefs_get_int("/gaim/gtk/conversations/button_type"); |
8811 | 3831 if (button_type == GAIM_BUTTON_NONE) |
3832 gtk_widget_hide(gtkconv->bbox); | |
3833 else | |
3834 gtk_widget_show(gtkconv->bbox); | |
3835 | |
4359 | 3836 /* Callbacks */ |
7929 | 3837 g_signal_connect(G_OBJECT(gtkchat->invite), "clicked", |
3838 G_CALLBACK(invite_cb), conv); | |
3839 g_signal_connect(G_OBJECT(gtkconv->add), "clicked", | |
3840 G_CALLBACK(add_remove_cb), conv); | |
3841 g_signal_connect(G_OBJECT(gtkconv->remove), "clicked", | |
3842 G_CALLBACK(add_remove_cb), conv); | |
4359 | 3843 g_signal_connect(G_OBJECT(gtkconv->send), "clicked", |
3844 G_CALLBACK(send_cb), conv); | |
3845 } | |
3846 | |
3847 | |
7971 | 3848 static void topic_callback(GtkWidget *w, GaimConversation *conv) |
3849 { | |
3850 GaimPluginProtocolInfo *prpl_info = NULL; | |
3851 GaimConnection *gc; | |
3852 GaimGtkConversation *gtkconv; | |
3853 GaimGtkChatPane *gtkchat; | |
8858 | 3854 const char *new_topic; |
3855 const char *current_topic; | |
7971 | 3856 |
3857 gc = gaim_conversation_get_gc(conv); | |
3858 | |
3859 if(!gc || !(prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl))) | |
3860 return; | |
3861 | |
3862 if(prpl_info->set_chat_topic == NULL) | |
3863 return; | |
3864 | |
3865 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3866 gtkchat = gtkconv->u.chat; | |
8858 | 3867 new_topic = gtk_entry_get_text(GTK_ENTRY(gtkchat->topic_text)); |
3868 current_topic = gaim_conv_chat_get_topic(GAIM_CONV_CHAT(conv)); | |
3869 | |
3870 if(current_topic && !g_utf8_collate(new_topic, current_topic)) | |
7971 | 3871 return; |
3872 | |
8858 | 3873 prpl_info->set_chat_topic(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), |
3874 new_topic); | |
7971 | 3875 } |
3876 | |
9554 | 3877 static gint |
3878 sort_chat_users(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer userdata) | |
3879 { | |
3880 GaimConvChatBuddyFlags f1 = 0, f2 = 0; | |
3881 char *user1 = NULL, *user2 = NULL; | |
3882 gint ret = 0; | |
3883 | |
3884 gtk_tree_model_get(model, a, CHAT_USERS_NAME_COLUMN, &user1, CHAT_USERS_FLAGS_COLUMN, &f1, -1); | |
3885 gtk_tree_model_get(model, b, CHAT_USERS_NAME_COLUMN, &user2, CHAT_USERS_FLAGS_COLUMN, &f2, -1); | |
3886 | |
3887 if (user1 == NULL || user2 == NULL) { | |
3888 if (!(user1 == NULL && user2 == NULL)) | |
3889 ret = (user1 == NULL) ? -1: 1; | |
3890 } else if (f1 != f2) { | |
3891 /* sort more important users first */ | |
3892 ret = (f1 > f2) ? -1 : 1; | |
3893 } else { | |
3894 ret = g_utf8_collate(user1, user2); | |
3895 } | |
3896 | |
3897 g_free(user1); | |
3898 g_free(user2); | |
3899 | |
3900 return ret; | |
3901 } | |
3902 | |
4359 | 3903 static GtkWidget * |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3904 setup_chat_pane(GaimConversation *conv) |
4359 | 3905 { |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3906 GaimPluginProtocolInfo *prpl_info = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3907 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3908 GaimGtkChatPane *gtkchat; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3909 GaimConnection *gc; |
8456 | 3910 GaimPlugin *protocol; |
4359 | 3911 GtkWidget *vpaned, *hpaned; |
3912 GtkWidget *vbox, *hbox; | |
3913 GtkWidget *lbox, *bbox; | |
3914 GtkWidget *label; | |
3915 GtkWidget *list; | |
3916 GtkWidget *button; | |
7949 | 3917 GtkWidget *sw; |
4359 | 3918 GtkListStore *ls; |
3919 GtkCellRenderer *rend; | |
3920 GtkTreeViewColumn *col; | |
9080 | 3921 GList *focus_chain = NULL; |
4359 | 3922 |
3923 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3924 gtkchat = gtkconv->u.chat; | |
3925 gc = gaim_conversation_get_gc(conv); | |
3926 | |
3927 /* Setup the outer pane. */ | |
3928 vpaned = gtk_vpaned_new(); | |
3929 gtk_widget_show(vpaned); | |
3930 | |
3931 /* Setup the top part of the pane. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3932 vbox = gtk_vbox_new(FALSE, 6); |
8914 | 3933 gtk_paned_pack1(GTK_PANED(vpaned), vbox, TRUE, TRUE); |
4359 | 3934 gtk_widget_show(vbox); |
3935 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3936 if (gc != NULL) |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3937 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3938 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3939 if (prpl_info->options & OPT_PROTO_CHAT_TOPIC) |
4359 | 3940 { |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3941 hbox = gtk_hbox_new(FALSE, 6); |
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3942 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
4359 | 3943 gtk_widget_show(hbox); |
3944 | |
3945 label = gtk_label_new(_("Topic:")); | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3946 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
4359 | 3947 gtk_widget_show(label); |
3948 | |
3949 gtkchat->topic_text = gtk_entry_new(); | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3950 |
7971 | 3951 if(prpl_info->set_chat_topic == NULL) { |
3952 gtk_editable_set_editable(GTK_EDITABLE(gtkchat->topic_text), FALSE); | |
3953 } else { | |
3954 g_signal_connect(GTK_OBJECT(gtkchat->topic_text), "activate", | |
3955 G_CALLBACK(topic_callback), conv); | |
3956 } | |
3957 | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3958 gtk_box_pack_start(GTK_BOX(hbox), gtkchat->topic_text, TRUE, TRUE, 0); |
4359 | 3959 gtk_widget_show(gtkchat->topic_text); |
3960 } | |
3961 | |
3962 /* Setup the horizontal pane. */ | |
3963 hpaned = gtk_hpaned_new(); | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3964 gtk_box_pack_start(GTK_BOX(vbox), hpaned, TRUE, TRUE, 0); |
4359 | 3965 gtk_widget_show(hpaned); |
3966 | |
3967 /* Setup the scrolled window to put gtkimhtml in. */ | |
3968 gtkconv->sw = gtk_scrolled_window_new(NULL, NULL); | |
3969 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
8076 | 3970 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
4359 | 3971 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(gtkconv->sw), |
3972 GTK_SHADOW_IN); | |
3973 gtk_paned_pack1(GTK_PANED(hpaned), gtkconv->sw, TRUE, TRUE); | |
3974 | |
3975 gtk_widget_set_size_request(gtkconv->sw, | |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3976 gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_width"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3977 gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_height")); |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3978 |
8914 | 3979 g_signal_connect(G_OBJECT(gtkconv->sw), "size-allocate", |
3980 G_CALLBACK(size_allocate_cb), conv); | |
3981 | |
4359 | 3982 gtk_widget_show(gtkconv->sw); |
3983 | |
3984 /* Setup gtkihmtml. */ | |
3985 gtkconv->imhtml = gtk_imhtml_new(NULL, NULL); | |
9005 | 3986 gtk_widget_set_name(gtkconv->imhtml, "gaim_gtkconv_imhtml"); |
4359 | 3987 gtk_container_add(GTK_CONTAINER(gtkconv->sw), gtkconv->imhtml); |
3988 | |
3989 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3990 gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); |
4359 | 3991 |
3992 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", | |
3993 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
8105 | 3994 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_press_event", |
6057 | 3995 G_CALLBACK(refocus_entry_cb), gtkconv); |
8109 | 3996 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_release_event", |
3997 G_CALLBACK(refocus_entry_cb), gtkconv); | |
4359 | 3998 |
3999 gaim_setup_imhtml(gtkconv->imhtml); | |
4000 gtk_widget_show(gtkconv->imhtml); | |
4001 | |
4002 /* Build the right pane. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4003 lbox = gtk_vbox_new(FALSE, 6); |
4409
0521eec12c33
[gaim-migrate @ 4682]
Christian Hammond <chipx86@chipx86.com>
parents:
4398
diff
changeset
|
4004 gtk_paned_pack2(GTK_PANED(hpaned), lbox, FALSE, TRUE); |
4359 | 4005 gtk_widget_show(lbox); |
4006 | |
4007 /* Setup the label telling how many people are in the room. */ | |
4008 gtkchat->count = gtk_label_new(_("0 people in room")); | |
4009 gtk_box_pack_start(GTK_BOX(lbox), gtkchat->count, FALSE, FALSE, 0); | |
4010 gtk_widget_show(gtkchat->count); | |
4011 | |
4012 /* Setup the list of users. */ | |
7949 | 4013 sw = gtk_scrolled_window_new(NULL, NULL); |
4014 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
8076 | 4015 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
7949 | 4016 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); |
4017 gtk_box_pack_start(GTK_BOX(lbox), sw, TRUE, TRUE, 0); | |
4018 gtk_widget_show(sw); | |
4359 | 4019 |
9554 | 4020 ls = gtk_list_store_new(CHAT_USERS_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING, |
4021 G_TYPE_INT); | |
4022 gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(ls), CHAT_USERS_NAME_COLUMN, | |
4023 sort_chat_users, NULL, NULL); | |
9498 | 4024 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), CHAT_USERS_NAME_COLUMN, |
4359 | 4025 GTK_SORT_ASCENDING); |
4026 | |
4027 list = gtk_tree_view_new_with_model(GTK_TREE_MODEL(ls)); | |
4028 | |
9498 | 4029 rend = gtk_cell_renderer_pixbuf_new(); |
4030 | |
4359 | 4031 col = gtk_tree_view_column_new_with_attributes(NULL, rend, |
9498 | 4032 "pixbuf", CHAT_USERS_ICON_COLUMN, NULL); |
9554 | 4033 gtk_tree_view_column_set_clickable(GTK_TREE_VIEW_COLUMN(col), TRUE); |
4034 | |
9498 | 4035 gtk_tree_view_append_column(GTK_TREE_VIEW(list), col); |
4359 | 4036 |
4037 g_signal_connect(G_OBJECT(list), "button_press_event", | |
4038 G_CALLBACK(right_click_chat_cb), conv); | |
8143 | 4039 g_signal_connect(G_OBJECT(list), "popup-menu", |
4040 G_CALLBACK(gtkconv_chat_popup_menu_cb), conv); | |
4359 | 4041 |
9498 | 4042 rend = gtk_cell_renderer_text_new(); |
4043 | |
4359 | 4044 col = gtk_tree_view_column_new_with_attributes(NULL, rend, |
9498 | 4045 "text", CHAT_USERS_NAME_COLUMN, NULL); |
4359 | 4046 gtk_tree_view_column_set_clickable(GTK_TREE_VIEW_COLUMN(col), TRUE); |
4047 | |
4048 gtk_tree_view_append_column(GTK_TREE_VIEW(list), col); | |
4049 | |
4050 gtk_widget_set_size_request(list, 150, -1); | |
4051 | |
4052 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(list), FALSE); | |
4053 gtk_widget_show(list); | |
4054 | |
4055 gtkchat->list = list; | |
4056 | |
7949 | 4057 gtk_container_add(GTK_CONTAINER(sw), list); |
4359 | 4058 |
4059 /* Setup the user list toolbar. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4060 bbox = gtk_hbox_new(TRUE, 6); |
4359 | 4061 gtk_box_pack_start(GTK_BOX(lbox), bbox, FALSE, FALSE, 0); |
4062 gtk_widget_show(bbox); | |
4063 | |
4064 /* IM */ | |
4065 button = gaim_pixbuf_button_from_stock(NULL, GTK_STOCK_REDO, | |
4066 GAIM_BUTTON_VERTICAL); | |
4067 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
4068 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
|
4069 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("IM the user"), NULL); |
4359 | 4070 g_signal_connect(G_OBJECT(button), "clicked", |
7961 | 4071 G_CALLBACK(chat_im_button_cb), conv); |
4359 | 4072 |
4073 gtk_widget_show(button); | |
4074 | |
4075 /* Ignore */ | |
4076 button = gaim_pixbuf_button_from_stock(NULL, GAIM_STOCK_IGNORE, | |
4077 GAIM_BUTTON_VERTICAL); | |
4078 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
4079 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
|
4080 gtk_tooltips_set_tip(gtkconv->tooltips, button, |
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
4081 _("Ignore the user"), NULL); |
4359 | 4082 g_signal_connect(G_OBJECT(button), "clicked", |
4083 G_CALLBACK(ignore_cb), conv); | |
4084 gtk_widget_show(button); | |
4085 | |
4086 /* Info */ | |
4087 button = gaim_pixbuf_button_from_stock(NULL, GAIM_STOCK_INFO, | |
4088 GAIM_BUTTON_VERTICAL); | |
4089 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
4090 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
4091 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
4092 _("Get the user's information"), NULL); |
4359 | 4093 g_signal_connect(G_OBJECT(button), "clicked", |
4094 G_CALLBACK(info_cb), conv); | |
4095 | |
4096 gtk_widget_show(button); | |
4097 | |
4098 gtkconv->info = button; | |
4099 | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4100 /* Build the toolbar. */ |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4101 vbox = gtk_vbox_new(FALSE, 6); |
8914 | 4102 gtk_paned_pack2(GTK_PANED(vpaned), vbox, FALSE, TRUE); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4103 gtk_widget_show(vbox); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4104 |
8317 | 4105 gtkconv->toolbar = gtk_imhtmltoolbar_new(); |
4106 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
|
4107 |
9332 | 4108 gtkconv->lower_hbox = gtk_hbox_new(FALSE, 6); |
4109 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->lower_hbox, TRUE, TRUE, 0); | |
4110 gtk_widget_show(gtkconv->lower_hbox); | |
4111 | |
4112 vbox = gtk_vbox_new(FALSE, 6); | |
4113 gtk_box_pack_end(GTK_BOX(gtkconv->lower_hbox), vbox, TRUE, TRUE, 0); | |
4114 gtk_widget_show(vbox); | |
4115 | |
8123 | 4116 /* Setup the entry widget. |
4117 * We never show the horizontal scrollbar because it was causing weird | |
4118 * lockups when typing text just as you type the character that would | |
4119 * cause both scrollbars to appear. Definitely seems like a gtk bug. | |
4120 */ | |
7949 | 4121 sw = gtk_scrolled_window_new(NULL, NULL); |
4122 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
8112 | 4123 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); |
8061 | 4124 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), |
4125 GTK_SHADOW_IN); | |
9332 | 4126 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); |
7949 | 4127 gtk_widget_show(sw); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4128 |
8061 | 4129 gtkconv->entry = gtk_imhtml_new(NULL, NULL); |
9005 | 4130 gtk_widget_set_name(gtkconv->entry, "gaim_gtkconv_entry"); |
8456 | 4131 gtk_imhtml_smiley_shortcuts(GTK_IMHTML(gtkconv->entry), |
4132 gaim_prefs_get_bool("/gaim/gtk/conversations/smiley_shortcuts")); | |
4133 gtk_imhtml_html_shortcuts(GTK_IMHTML(gtkconv->entry), | |
4134 gaim_prefs_get_bool("/gaim/gtk/conversations/html_shortcuts")); | |
4135 | |
4136 protocol = gaim_find_prpl(conv->account->protocol_id); | |
4137 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), | |
4138 protocol->info->name); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4139 gtkconv->entry_buffer = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4140 gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); |
8061 | 4141 gaim_setup_imhtml(gtkconv->entry); |
4142 gtk_imhtml_set_editable(GTK_IMHTML(gtkconv->entry), TRUE); | |
4143 default_formatize(conv); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4144 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(gtkconv->entry), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4145 GTK_WRAP_WORD_CHAR); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4146 gtk_widget_set_size_request(gtkconv->entry, -1, |
8106 | 4147 gaim_prefs_get_int("/gaim/gtk/conversations/chat/entry_height")); |
7949 | 4148 g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", conv); |
4149 | |
4150 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", | |
8105 | 4151 G_CALLBACK(entry_key_press_cb), conv); |
4359 | 4152 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", |
4153 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
8914 | 4154 g_signal_connect(G_OBJECT(gtkconv->entry), "size-allocate", |
4155 G_CALLBACK(size_allocate_cb), conv); | |
4359 | 4156 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4157 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
4158 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4159 gtk_imhtmltoolbar_attach(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4160 gtkconv->entry); |
4359 | 4161 |
7949 | 4162 gtk_container_add(GTK_CONTAINER(sw), GTK_WIDGET(gtkconv->entry)); |
4359 | 4163 gtk_widget_show(gtkconv->entry); |
4164 | |
4165 /* Setup the bottom button box. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4166 gtkconv->bbox = gtk_hbox_new(FALSE, 6); |
4359 | 4167 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->bbox, FALSE, FALSE, 0); |
4168 gtk_widget_show(gtkconv->bbox); | |
4169 | |
4170 setup_chat_buttons(conv, gtkconv->bbox); | |
4171 | |
9080 | 4172 /* |
4173 * Focus for chat windows should be as follows: | |
4174 * Tab title -> chat topic -> conversation scrollback -> user list -> | |
4175 * user list buttons -> entry -> buttons at bottom | |
4176 */ | |
4177 focus_chain = g_list_prepend(focus_chain, gtkconv->bbox); | |
9332 | 4178 focus_chain = g_list_prepend(focus_chain, gtkconv->entry); |
9080 | 4179 gtk_container_set_focus_chain(GTK_CONTAINER(vbox), focus_chain); |
4180 | |
4359 | 4181 return vpaned; |
4182 } | |
4183 | |
4184 static GtkWidget * | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4185 setup_im_pane(GaimConversation *conv) |
4359 | 4186 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4187 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4188 GaimGtkImPane *gtkim; |
8456 | 4189 GaimPlugin *protocol; |
4359 | 4190 GtkWidget *paned; |
4191 GtkWidget *vbox; | |
4192 GtkWidget *vbox2; | |
7949 | 4193 GtkWidget *sw; |
9080 | 4194 GList *focus_chain = NULL; |
4359 | 4195 |
4196 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4197 gtkim = gtkconv->u.im; | |
4198 | |
4199 /* Setup the outer pane. */ | |
4200 paned = gtk_vpaned_new(); | |
4201 gtk_widget_show(paned); | |
4202 | |
4203 /* Setup the top part of the pane. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4204 vbox = gtk_vbox_new(FALSE, 6); |
4409
0521eec12c33
[gaim-migrate @ 4682]
Christian Hammond <chipx86@chipx86.com>
parents:
4398
diff
changeset
|
4205 gtk_paned_pack1(GTK_PANED(paned), vbox, TRUE, TRUE); |
4359 | 4206 gtk_widget_show(vbox); |
4207 | |
4208 /* Setup the gtkimhtml widget. */ | |
4209 gtkconv->sw = gtk_scrolled_window_new(NULL, NULL); | |
4210 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
8076 | 4211 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
4359 | 4212 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(gtkconv->sw), |
4213 GTK_SHADOW_IN); | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4214 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->sw, TRUE, TRUE, 0); |
4851 | 4215 |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
4216 gtk_widget_set_size_request(gtkconv->sw, |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
4217 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_width"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
4218 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_height")); |
8914 | 4219 g_signal_connect(G_OBJECT(gtkconv->sw), "size-allocate", |
4220 G_CALLBACK(size_allocate_cb), conv); | |
4359 | 4221 gtk_widget_show(gtkconv->sw); |
4222 | |
4223 gtkconv->imhtml = gtk_imhtml_new(NULL, NULL); | |
9005 | 4224 gtk_widget_set_name(gtkconv->imhtml, "gaim_gtkconv_imhtml"); |
4359 | 4225 gtk_container_add(GTK_CONTAINER(gtkconv->sw), gtkconv->imhtml); |
4226 | |
4227 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", | |
4228 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
8105 | 4229 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_press_event", |
6057 | 4230 G_CALLBACK(refocus_entry_cb), gtkconv); |
8109 | 4231 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_release_event", |
4232 G_CALLBACK(refocus_entry_cb), gtkconv); | |
4359 | 4233 |
4234 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4235 gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); |
4359 | 4236 gaim_setup_imhtml(gtkconv->imhtml); |
4237 gtk_widget_show(gtkconv->imhtml); | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4238 vbox2 = gtk_vbox_new(FALSE, 6); |
8914 | 4239 gtk_paned_pack2(GTK_PANED(paned), vbox2, FALSE, TRUE); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4240 gtk_widget_show(vbox2); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4241 |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4242 /* Build the toolbar. */ |
8317 | 4243 gtkconv->toolbar = gtk_imhtmltoolbar_new(); |
4244 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
|
4245 |
8123 | 4246 /* Setup the entry widget. |
4247 * 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
|
4248 * lockups when typing text just as you type the character that would |
8123 | 4249 * cause both scrollbars to appear. Definitely seems like a gtk bug. |
4250 */ | |
9332 | 4251 gtkconv->lower_hbox = gtk_hbox_new(FALSE, 6); |
4252 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->lower_hbox, TRUE, TRUE, 0); | |
4253 gtk_widget_show(gtkconv->lower_hbox); | |
4254 | |
4255 vbox2 = gtk_vbox_new(FALSE, 6); | |
4256 gtk_box_pack_end(GTK_BOX(gtkconv->lower_hbox), vbox2, TRUE, TRUE, 0); | |
4257 gtk_widget_show(vbox2); | |
8821 | 4258 |
7949 | 4259 sw = gtk_scrolled_window_new(NULL, NULL); |
4260 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
8112 | 4261 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); |
8061 | 4262 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), |
4263 GTK_SHADOW_IN); | |
9332 | 4264 gtk_box_pack_start(GTK_BOX(vbox2), sw, TRUE, TRUE, 0); |
7949 | 4265 gtk_widget_show(sw); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4266 |
8061 | 4267 gtkconv->entry = gtk_imhtml_new(NULL, NULL); |
9005 | 4268 gtk_widget_set_name(gtkconv->entry, "gaim_gtkconv_entry"); |
8456 | 4269 |
4270 gtk_imhtml_smiley_shortcuts(GTK_IMHTML(gtkconv->entry), | |
4271 gaim_prefs_get_bool("/gaim/gtk/conversations/smiley_shortcuts")); | |
4272 gtk_imhtml_html_shortcuts(GTK_IMHTML(gtkconv->entry), | |
4273 gaim_prefs_get_bool("/gaim/gtk/conversations/html_shortcuts")); | |
4274 | |
4275 protocol = gaim_find_prpl(conv->account->protocol_id); | |
4276 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), | |
4277 protocol->info->name); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4278 gtkconv->entry_buffer = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4279 gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); |
8061 | 4280 gaim_setup_imhtml(gtkconv->entry); |
4281 gtk_imhtml_set_editable(GTK_IMHTML(gtkconv->entry), TRUE); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4282 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(gtkconv->entry), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4283 GTK_WRAP_WORD_CHAR); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4284 gtk_widget_set_size_request(gtkconv->entry, -1, |
8106 | 4285 gaim_prefs_get_int("/gaim/gtk/conversations/im/entry_height")); |
7949 | 4286 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
|
4287 |
4359 | 4288 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", |
8105 | 4289 G_CALLBACK(entry_key_press_cb), conv); |
4359 | 4290 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", |
4291 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
8914 | 4292 g_signal_connect(G_OBJECT(gtkconv->entry), "size-allocate", |
4293 G_CALLBACK(size_allocate_cb), conv); | |
4359 | 4294 |
4295 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "insert_text", | |
4296 G_CALLBACK(insert_text_cb), conv); | |
4297 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "delete_range", | |
4298 G_CALLBACK(delete_text_cb), conv); | |
4299 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4300 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
4301 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
4359 | 4302 |
7949 | 4303 gtk_container_add(GTK_CONTAINER(sw), GTK_WIDGET(gtkconv->entry)); |
4359 | 4304 gtk_widget_show(gtkconv->entry); |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
4305 gtk_imhtmltoolbar_attach(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), |
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
4306 gtkconv->entry); |
8481 | 4307 /* had to move this after the imtoolbar is attached so that the |
4308 * signals get fired to toggle the buttons on the toolbar as well. | |
4309 */ | |
4310 default_formatize(conv); | |
4359 | 4311 |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4312 gtkconv->bbox = gtk_hbox_new(FALSE, 6); |
4359 | 4313 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->bbox, FALSE, FALSE, 0); |
4314 gtk_widget_show(gtkconv->bbox); | |
4315 | |
4316 setup_im_buttons(conv, gtkconv->bbox); | |
8758 | 4317 gtkconv->u.im->animate = gaim_prefs_get_bool("/gaim/gtk/conversations/im/animate_buddy_icons"); |
4359 | 4318 |
9080 | 4319 /* |
4320 * Focus for IM windows should be as follows: | |
4321 * Tab title -> conversation scrollback -> entry -> buttons at bottom | |
4322 */ | |
4323 focus_chain = g_list_prepend(focus_chain, gtkconv->bbox); | |
9332 | 4324 focus_chain = g_list_prepend(focus_chain, gtkconv->entry); |
9080 | 4325 gtk_container_set_focus_chain(GTK_CONTAINER(vbox2), focus_chain); |
8143 | 4326 |
4359 | 4327 return paned; |
4328 } | |
4329 | |
4330 static void | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4331 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
|
4332 GtkSelectionData *sd, guint info, guint t, |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4333 GaimConversation *conv) |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4334 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4335 GaimConvWindow *win = conv->window; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4336 GaimConversation *c; |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4337 if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE)) |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4338 { |
4781 | 4339 GaimBlistNode *n = NULL; |
6695 | 4340 GaimBuddy *b; |
4781 | 4341 memcpy(&n, sd->data, sizeof(n)); |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
4342 |
6695 | 4343 if (GAIM_BLIST_NODE_IS_CONTACT(n)) |
4344 b = gaim_contact_get_priority_buddy((GaimContact*)n); | |
4345 else if (GAIM_BLIST_NODE_IS_BUDDY(n)) | |
4346 b = (GaimBuddy*)n; | |
4347 else | |
4781 | 4348 return; |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
4349 |
7089
2cd3756a637b
[gaim-migrate @ 7654]
Christian Hammond <chipx86@chipx86.com>
parents:
7078
diff
changeset
|
4350 c = gaim_conversation_new(GAIM_CONV_IM, b->account, b->name); |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
4351 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4352 gaim_conv_window_add_conversation(win, c); |
8802
1076cd8579ea
[gaim-migrate @ 9564]
Christian Hammond <chipx86@chipx86.com>
parents:
8758
diff
changeset
|
4353 |
1076cd8579ea
[gaim-migrate @ 9564]
Christian Hammond <chipx86@chipx86.com>
parents:
8758
diff
changeset
|
4354 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); |
4702 | 4355 } |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4356 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
|
4357 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4358 char *protocol = NULL; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4359 char *username = NULL; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4360 GaimAccount *account; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4361 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4362 if (gaim_gtk_parse_x_im_contact(sd->data, FALSE, &account, |
7718 | 4363 &protocol, &username, NULL)) |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4364 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4365 if (account == NULL) |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4366 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4367 gaim_notify_error(NULL, NULL, |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4368 _("You are not currently signed on with an account that " |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4369 "can add that buddy."), NULL); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4370 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4371 else |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4372 { |
7718 | 4373 c = gaim_conversation_new(GAIM_CONV_IM, account, username); |
4374 gaim_conv_window_add_conversation(win, c); | |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4375 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4376 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4377 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4378 if (username != NULL) g_free(username); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4379 if (protocol != NULL) g_free(protocol); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4380 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4381 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4382 } |
9525 | 4383 else if (sd->target == gdk_atom_intern("text/uri-list", FALSE)) { |
9495 | 4384 if (!g_ascii_strncasecmp(sd->data, "file://", 7)) { |
4385 GError *converr = NULL; | |
4386 gchar *file; | |
4387 if(!(file = g_filename_from_uri(sd->data, NULL, &converr))) { | |
4388 gaim_debug(GAIM_DEBUG_ERROR, "conv dnd", "%s\n", | |
4389 (converr ? converr->message : | |
4390 "g_filename_from_uri error")); | |
9498 | 4391 g_error_free(converr); |
9495 | 4392 return; |
4393 } | |
4394 file = g_strchomp(file); | |
4395 /* XXX - Handle dragging more than one file. Make ft API support creating a transfer with more than one file */ | |
4396 /* XXX - Attempt to load this file into gdk_pixbuf, or otherwise determine if it is an image. If it is, offer | |
4397 * the choice of a) sending this file b) inserting this file as an IM image or c) setting this file as a custom | |
4398 * buddy icon for this buddy */ | |
4399 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) | |
4400 serv_send_file(gaim_conversation_get_gc(conv), gaim_conversation_get_name(conv), file); | |
4401 g_free(file); | |
4402 } | |
4403 } | |
4404 gtk_drag_finish(dc, FALSE, FALSE, t); | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4405 } |
4359 | 4406 |
4407 /************************************************************************** | |
4408 * GTK+ window ops | |
4409 **************************************************************************/ | |
4410 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4411 gaim_gtk_new_window(GaimConvWindow *win) |
4359 | 4412 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4413 GaimGtkWindow *gtkwin; |
4359 | 4414 GtkPositionType pos; |
4415 GtkWidget *testidea; | |
4416 GtkWidget *menubar; | |
4417 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4418 gtkwin = g_malloc0(sizeof(GaimGtkWindow)); |
4359 | 4419 |
4420 win->ui_data = gtkwin; | |
4421 | |
4422 /* Create the window. */ | |
4423 gtkwin->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
4424 gtk_window_set_role(GTK_WINDOW(gtkwin->window), "conversation"); | |
4635 | 4425 gtk_window_set_resizable(GTK_WINDOW(gtkwin->window), TRUE); |
4510
4c394222c732
[gaim-migrate @ 4786]
Christian Hammond <chipx86@chipx86.com>
parents:
4505
diff
changeset
|
4426 gtk_container_set_border_width(GTK_CONTAINER(gtkwin->window), 0); |
5173 | 4427 GTK_WINDOW(gtkwin->window)->allow_shrink = TRUE; |
4359 | 4428 gtk_widget_realize(gtkwin->window); |
4429 | |
4430 g_signal_connect(G_OBJECT(gtkwin->window), "delete_event", | |
4431 G_CALLBACK(close_win_cb), win); | |
4432 | |
4433 /* Create the notebook. */ | |
4434 gtkwin->notebook = gtk_notebook_new(); | |
4435 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4436 pos = gaim_prefs_get_int("/gaim/gtk/conversations/tab_side"); |
4359 | 4437 |
4438 #if 0 | |
4439 gtk_notebook_set_tab_hborder(GTK_NOTEBOOK(gtkwin->notebook), 0); | |
4440 gtk_notebook_set_tab_vborder(GTK_NOTEBOOK(gtkwin->notebook), 0); | |
4441 #endif | |
4442 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos); | |
4443 gtk_notebook_set_scrollable(GTK_NOTEBOOK(gtkwin->notebook), TRUE); | |
4444 gtk_notebook_popup_enable(GTK_NOTEBOOK(gtkwin->notebook)); | |
4818 | 4445 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), FALSE); |
4446 | |
4359 | 4447 gtk_widget_show(gtkwin->notebook); |
4448 | |
8189 | 4449 g_signal_connect(G_OBJECT(gtkwin->notebook), "switch_page", |
4450 G_CALLBACK(before_switch_conv_cb), win); | |
4359 | 4451 g_signal_connect_after(G_OBJECT(gtkwin->notebook), "switch_page", |
4452 G_CALLBACK(switch_conv_cb), win); | |
4453 | |
4454 /* Setup the tab drag and drop signals. */ | |
4486 | 4455 gtk_widget_add_events(gtkwin->notebook, |
4456 GDK_BUTTON1_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK); | |
4457 g_signal_connect(G_OBJECT(gtkwin->notebook), "button_press_event", | |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4458 G_CALLBACK(notebook_press_cb), win); |
4486 | 4459 g_signal_connect(G_OBJECT(gtkwin->notebook), "button_release_event", |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4460 G_CALLBACK(notebook_release_cb), win); |
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4461 |
4359 | 4462 testidea = gtk_vbox_new(FALSE, 0); |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4463 |
4359 | 4464 /* Setup the menubar. */ |
4465 menubar = setup_menubar(win); | |
4466 gtk_box_pack_start(GTK_BOX(testidea), menubar, FALSE, TRUE, 0); | |
4467 | |
4468 gtk_box_pack_start(GTK_BOX(testidea), gtkwin->notebook, TRUE, TRUE, 0); | |
4469 | |
4470 gtk_container_add(GTK_CONTAINER(gtkwin->window), testidea); | |
4471 | |
4472 gtk_widget_show(testidea); | |
4473 } | |
4474 | |
4475 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4476 gaim_gtk_destroy_window(GaimConvWindow *win) |
4359 | 4477 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4478 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4479 |
4480 gtk_widget_destroy(gtkwin->window); | |
4481 | |
4630 | 4482 g_object_unref(G_OBJECT(gtkwin->menu.item_factory)); |
4483 | |
4359 | 4484 g_free(gtkwin); |
4485 win->ui_data = NULL; | |
4486 } | |
4487 | |
4488 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4489 gaim_gtk_show(GaimConvWindow *win) |
4359 | 4490 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4491 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4492 |
4493 gtk_widget_show(gtkwin->window); | |
7413 | 4494 |
4495 #ifdef _WIN32 | |
7415 | 4496 /* This works around a win32 gtk+ bug, where it can't handle |
4497 * creating the button correctly before the window is shown. | |
4498 * That's why we get the appearance of a button, without all | |
4499 * the normal button-like properties, like being able to click | |
7413 | 4500 * it. ;-) --Nathan */ |
7414 | 4501 if (gaim_prefs_get_bool("/gaim/gtk/conversations/close_on_tabs")) { |
4502 GaimConversation *conv; | |
4503 GaimGtkConversation *gtkconv; | |
4504 | |
4505 conv = gaim_conv_window_get_conversation_at(win, 0); | |
4506 if(conv) { | |
4507 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7415 | 4508 gtk_widget_hide(gtkconv->close); |
7414 | 4509 gtk_widget_show_all(gtkconv->close); |
4510 } | |
4511 } | |
7413 | 4512 #endif |
4359 | 4513 } |
4514 | |
4515 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4516 gaim_gtk_hide(GaimConvWindow *win) |
4359 | 4517 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4518 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4519 |
4520 gtk_widget_hide(gtkwin->window); | |
4521 } | |
4522 | |
4523 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4524 gaim_gtk_raise(GaimConvWindow *win) |
4359 | 4525 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4526 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4527 |
5484 | 4528 gtk_widget_show(gtkwin->window); |
5103 | 4529 gtk_window_deiconify(GTK_WINDOW(gtkwin->window)); |
4526 | 4530 gdk_window_raise(gtkwin->window->window); |
4359 | 4531 } |
4532 | |
4533 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4534 gaim_gtk_flash(GaimConvWindow *win) |
4359 | 4535 { |
4536 #ifdef _WIN32 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4537 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4538 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4539 wgaim_conv_im_blink(gtkwin->window); |
4359 | 4540 #endif |
4541 } | |
4542 | |
4543 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4544 gaim_gtk_switch_conversation(GaimConvWindow *win, unsigned int index) |
4359 | 4545 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4546 GaimGtkWindow *gtkwin; |
4359 | 4547 |
4548 gtkwin = GAIM_GTK_WINDOW(win); | |
4549 | |
4550 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), index); | |
4551 } | |
4552 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4553 static const GtkTargetEntry te[] = |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4554 { |
9525 | 4555 {"text/uri-list", 0, 0}, |
4556 {"GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, 1}, | |
4557 {"text/plain", 0, 2}, | |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4558 {"STRING", 0, 3}, |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4559 {"application/x-im-contact", 0, 4} |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4560 }; |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4561 |
4359 | 4562 static void |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4563 gaim_gtk_add_conversation(GaimConvWindow *win, GaimConversation *conv) |
4359 | 4564 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4565 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4566 GaimGtkConversation *gtkconv, *focus_gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4567 GaimConversation *focus_conv; |
4359 | 4568 GtkWidget *pane = NULL; |
4569 GtkWidget *tab_cont; | |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4570 GtkWidget *tabby, *menu_tabby; |
4359 | 4571 gboolean new_ui; |
4383
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4572 GaimConversationType conv_type; |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4573 const char *name; |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4574 |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4575 name = gaim_conversation_get_name(conv); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4576 conv_type = gaim_conversation_get_type(conv); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4577 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4578 |
4579 if (conv->ui_data != NULL) { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4580 gtkconv = (GaimGtkConversation *)conv->ui_data; |
4359 | 4581 |
4582 tab_cont = gtkconv->tab_cont; | |
4583 | |
4584 new_ui = FALSE; | |
4585 } | |
4586 else { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4587 gtkconv = g_malloc0(sizeof(GaimGtkConversation)); |
4359 | 4588 conv->ui_data = gtkconv; |
4589 | |
4590 /* Setup some initial variables. */ | |
4591 gtkconv->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
4592 gtkconv->tooltips = gtk_tooltips_new(); | |
4593 | |
7879 | 4594 if (conv_type == GAIM_CONV_IM) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4595 gtkconv->u.im = g_malloc0(sizeof(GaimGtkImPane)); |
4359 | 4596 gtkconv->u.im->a_virgin = TRUE; |
4597 | |
4598 pane = setup_im_pane(conv); | |
4599 } | |
7879 | 4600 else if (conv_type == GAIM_CONV_CHAT) { |
4601 gtkconv->u.chat = g_malloc0(sizeof(GaimGtkChatPane)); | |
4602 | |
4603 pane = setup_chat_pane(conv); | |
4604 } | |
4359 | 4605 |
4606 if (pane == NULL) { | |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4607 if (conv_type == GAIM_CONV_CHAT) g_free(gtkconv->u.chat); |
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4608 else if (conv_type == GAIM_CONV_IM) g_free(gtkconv->u.im); |
4359 | 4609 |
4610 g_free(gtkconv); | |
4611 conv->ui_data = NULL; | |
4612 | |
4613 return; | |
4614 } | |
4615 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4616 /* Setup drag-and-drop */ |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4617 gtk_drag_dest_set(pane, |
9300 | 4618 GTK_DEST_DEFAULT_MOTION | |
4619 GTK_DEST_DEFAULT_DROP, | |
4620 te, sizeof(te) / sizeof(GtkTargetEntry), | |
4621 GDK_ACTION_COPY); | |
4622 gtk_drag_dest_set(pane, | |
4623 GTK_DEST_DEFAULT_MOTION | | |
4624 GTK_DEST_DEFAULT_DROP, | |
4625 te, sizeof(te) / sizeof(GtkTargetEntry), | |
4626 GDK_ACTION_COPY); | |
4627 gtk_drag_dest_set(gtkconv->imhtml, 0, | |
4628 te, sizeof(te) / sizeof(GtkTargetEntry), | |
4629 GDK_ACTION_COPY); | |
4630 | |
4631 gtk_drag_dest_set(gtkconv->entry, 0, | |
4632 te, sizeof(te) / sizeof(GtkTargetEntry), | |
4633 GDK_ACTION_COPY); | |
4634 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4635 g_signal_connect(G_OBJECT(pane), "drag_data_received", |
9300 | 4636 G_CALLBACK(conv_dnd_recv), conv); |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4637 g_signal_connect(G_OBJECT(gtkconv->imhtml), "drag_data_received", |
9300 | 4638 G_CALLBACK(conv_dnd_recv), conv); |
8105 | 4639 g_signal_connect(G_OBJECT(gtkconv->entry), "drag_data_received", |
9300 | 4640 G_CALLBACK(conv_dnd_recv), conv); |
4641 | |
4359 | 4642 /* Setup the container for the tab. */ |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4643 gtkconv->tab_cont = tab_cont = gtk_vbox_new(FALSE, 6); |
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4644 gtk_container_set_border_width(GTK_CONTAINER(tab_cont), 6); |
4359 | 4645 gtk_container_add(GTK_CONTAINER(tab_cont), pane); |
4646 gtk_widget_show(pane); | |
4647 | |
4648 new_ui = TRUE; | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
4649 |
4359 | 4650 gtkconv->make_sound = TRUE; |
5902
6889b89cab90
[gaim-migrate @ 6334]
Christian Hammond <chipx86@chipx86.com>
parents:
5901
diff
changeset
|
4651 |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4652 gtkconv->show_formatting_toolbar = gaim_prefs_get_bool( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4653 "/gaim/gtk/conversations/show_formatting_toolbar"); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4654 |
8329
9dd7c75ed433
[gaim-migrate @ 9053]
Christian Hammond <chipx86@chipx86.com>
parents:
8319
diff
changeset
|
4655 if (gtkconv->show_formatting_toolbar) |
9dd7c75ed433
[gaim-migrate @ 9053]
Christian Hammond <chipx86@chipx86.com>
parents:
8319
diff
changeset
|
4656 gtk_widget_show(gtkconv->toolbar); |
9dd7c75ed433
[gaim-migrate @ 9053]
Christian Hammond <chipx86@chipx86.com>
parents:
8319
diff
changeset
|
4657 |
9188 | 4658 gtkconv->show_timestamps = gaim_prefs_get_bool( |
4659 "/gaim/gtk/conversations/show_timestamps"); | |
4660 | |
4661 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
4662 gtkconv->show_timestamps); | |
4663 | |
8176 | 4664 g_signal_connect_swapped(G_OBJECT(pane), "focus", |
9080 | 4665 G_CALLBACK(gtk_widget_grab_focus), |
4666 gtkconv->entry); | |
4359 | 4667 } |
4668 | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4669 gtkconv->tabby = tabby = gtk_hbox_new(FALSE, 6); |
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4670 gtkconv->menu_tabby = menu_tabby = gtk_hbox_new(FALSE, 6); |
4359 | 4671 |
4672 /* Close button. */ | |
4673 gtkconv->close = gtk_button_new(); | |
4674 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
|
4675 gtk_button_set_relief(GTK_BUTTON(gtkconv->close), GTK_RELIEF_NONE); |
4359 | 4676 gtk_container_add(GTK_CONTAINER(gtkconv->close), |
4445 | 4677 gtk_image_new_from_stock(GTK_STOCK_CLOSE, |
4678 GTK_ICON_SIZE_MENU)); | |
4359 | 4679 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->close, |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4680 _("Close conversation"), NULL); |
4359 | 4681 |
4682 g_signal_connect(G_OBJECT(gtkconv->close), "clicked", | |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4683 G_CALLBACK(close_conv_cb), conv); |
4359 | 4684 |
7446
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4685 /* |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4686 * 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
|
4687 * border bug. I love you guys! -- ChipX86 |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4688 */ |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4689 g_signal_connect(G_OBJECT(gtkconv->close), "state_changed", |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4690 G_CALLBACK(tab_close_button_state_changed_cb), NULL); |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4691 |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4692 /* Status icon. */ |
6440 | 4693 gtkconv->icon = gtk_image_new(); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4694 gtkconv->menu_icon = gtk_image_new(); |
6440 | 4695 update_tab_icon(conv); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4696 |
4359 | 4697 /* Tab label. */ |
4698 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
|
4699 gtkconv->menu_label = gtk_label_new(gaim_conversation_get_title(conv)); |
4359 | 4700 #if 0 |
4701 gtk_misc_set_alignment(GTK_MISC(gtkconv->tab_label), 0.00, 0.5); | |
4702 gtk_misc_set_padding(GTK_MISC(gtkconv->tab_label), 4, 0); | |
4703 #endif | |
4704 | |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
4705 |
4359 | 4706 /* Pack it all together. */ |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4707 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
|
4708 gtk_box_pack_start(GTK_BOX(menu_tabby), gtkconv->menu_icon, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4709 FALSE, FALSE, 0); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4710 |
8946 | 4711 gtk_widget_show_all(gtkconv->icon); |
4712 gtk_widget_show_all(gtkconv->menu_icon); | |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4713 |
4359 | 4714 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
|
4715 gtk_box_pack_start(GTK_BOX(menu_tabby), gtkconv->menu_label, TRUE, TRUE, 0); |
4445 | 4716 gtk_widget_show(gtkconv->tab_label); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4717 gtk_widget_show(gtkconv->menu_label); |
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4718 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
|
4719 |
4445 | 4720 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
|
4721 if (gaim_prefs_get_bool("/gaim/gtk/conversations/close_on_tabs")) |
4445 | 4722 gtk_widget_show_all(gtkconv->close); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4723 |
4445 | 4724 gtk_widget_show(tabby); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4725 gtk_widget_show(menu_tabby); |
4359 | 4726 |
7143 | 4727 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
4728 gaim_gtkconv_update_buddy_icon(conv); | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4729 |
9297 | 4730 /* Add this pane to the conversation's notebook. */ |
4359 | 4731 gtk_notebook_append_page(GTK_NOTEBOOK(gtkwin->notebook), tab_cont, tabby); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4732 gtk_notebook_set_menu_label(GTK_NOTEBOOK(gtkwin->notebook), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4733 tab_cont, menu_tabby); |
4359 | 4734 |
4735 gtk_widget_show(tab_cont); | |
4736 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4737 if (gaim_conv_window_get_conversation_count(win) == 1) { |
4818 | 4738 /* Er, bug in notebooks? Switch to the page manually. */ |
4359 | 4739 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), 0); |
4851 | 4740 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4741 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4742 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4743 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4744 else |
4818 | 4745 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), TRUE); |
4359 | 4746 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4747 focus_conv = g_list_nth_data(gaim_conv_window_get_conversations(win), |
5204 | 4748 gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook))); |
4749 focus_gtkconv = GAIM_GTK_CONVERSATION(focus_conv); | |
4750 gtk_widget_grab_focus(focus_gtkconv->entry); | |
4359 | 4751 |
4752 if (!new_ui) | |
4753 g_object_unref(gtkconv->tab_cont); | |
4754 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4755 if (gaim_conv_window_get_conversation_count(win) == 1) |
4685 | 4756 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); |
4359 | 4757 } |
4758 | |
4759 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4760 gaim_gtk_remove_conversation(GaimConvWindow *win, GaimConversation *conv) |
4359 | 4761 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4762 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4763 GaimGtkConversation *gtkconv; |
4359 | 4764 unsigned int index; |
4818 | 4765 GaimConversationType conv_type; |
4766 | |
4767 conv_type = gaim_conversation_get_type(conv); | |
4359 | 4768 index = gaim_conversation_get_index(conv); |
4769 | |
4770 gtkwin = GAIM_GTK_WINDOW(win); | |
4771 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4772 | |
4773 g_object_ref(gtkconv->tab_cont); | |
4774 gtk_object_sink(GTK_OBJECT(gtkconv->tab_cont)); | |
4775 | |
4776 gtk_notebook_remove_page(GTK_NOTEBOOK(gtkwin->notebook), index); | |
4777 | |
4818 | 4778 /* go back to tabless if need be */ |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4779 if (gaim_conv_window_get_conversation_count(win) <= 2) { |
4818 | 4780 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4781 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); |
4818 | 4782 } |
4783 | |
4784 | |
4359 | 4785 /* If this window is setup with an inactive gc, regenerate the menu. */ |
4818 | 4786 if (conv_type == GAIM_CONV_IM && |
4359 | 4787 gaim_conversation_get_gc(conv) == NULL) { |
4788 | |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
4789 generate_send_as_items(win, conv); |
4359 | 4790 } |
4791 } | |
4792 | |
4793 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4794 gaim_gtk_move_conversation(GaimConvWindow *win, GaimConversation *conv, |
4359 | 4795 unsigned int new_index) |
4796 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4797 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4798 GaimGtkConversation *gtkconv; |
4359 | 4799 |
4800 gtkwin = GAIM_GTK_WINDOW(win); | |
4801 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4802 | |
4415
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4803 if (new_index > gaim_conversation_get_index(conv)) |
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4804 new_index--; |
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4805 |
4359 | 4806 gtk_notebook_reorder_child(GTK_NOTEBOOK(gtkwin->notebook), |
4807 gtkconv->tab_cont, new_index); | |
4808 } | |
4809 | |
4810 static int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4811 gaim_gtk_get_active_index(const GaimConvWindow *win) |
4359 | 4812 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4813 GaimGtkWindow *gtkwin; |
5680
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4814 int index; |
4359 | 4815 |
4816 gtkwin = GAIM_GTK_WINDOW(win); | |
4817 | |
5680
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4818 index = gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook)); |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4819 |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4820 /* |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4821 * A fix, because the first conversation may be active, but not |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4822 * appear in the notebook just yet. -- ChipX86 |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4823 */ |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4824 return (index == -1 ? 0 : index); |
4359 | 4825 } |
4826 | |
9260
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4827 static gboolean |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4828 gaim_gtk_has_focus(GaimConvWindow *win) |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4829 { |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4830 GaimGtkWindow *gtkwin; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4831 gboolean has_focus = FALSE; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4832 |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4833 gtkwin = GAIM_GTK_WINDOW(win); |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4834 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
|
4835 |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4836 return has_focus; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4837 } |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4838 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4839 static GaimConvWindowUiOps window_ui_ops = |
4359 | 4840 { |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
4841 gaim_gtk_conversations_get_conv_ui_ops, |
4359 | 4842 gaim_gtk_new_window, |
4843 gaim_gtk_destroy_window, | |
4844 gaim_gtk_show, | |
4845 gaim_gtk_hide, | |
4846 gaim_gtk_raise, | |
4847 gaim_gtk_flash, | |
4848 gaim_gtk_switch_conversation, | |
4849 gaim_gtk_add_conversation, | |
4850 gaim_gtk_remove_conversation, | |
4851 gaim_gtk_move_conversation, | |
9260
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4852 gaim_gtk_get_active_index, |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4853 gaim_gtk_has_focus |
4359 | 4854 }; |
4855 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4856 GaimConvWindowUiOps * |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
4857 gaim_gtk_conversations_get_win_ui_ops(void) |
4359 | 4858 { |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4859 return &window_ui_ops; |
4359 | 4860 } |
4861 | |
4862 /************************************************************************** | |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4863 * Conversation UI operations |
4359 | 4864 **************************************************************************/ |
4865 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4866 gaim_gtkconv_destroy(GaimConversation *conv) |
4359 | 4867 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4868 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); |
4359 | 4869 |
9504 | 4870 /* If the "Save Conversation" or "Save Icon" dialogs are open then close them */ |
4871 gaim_request_close_with_handle(conv); | |
4359 | 4872 |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4873 gtk_widget_destroy(gtkconv->tab_cont); |
4892 | 4874 g_object_unref(gtkconv->tab_cont); |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4875 |
4359 | 4876 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
4755 | 4877 if (gtkconv->u.im->icon_timer != 0) |
4878 g_source_remove(gtkconv->u.im->icon_timer); | |
4879 | |
4359 | 4880 if (gtkconv->u.im->anim != NULL) |
4793 | 4881 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); |
4359 | 4882 |
4883 g_free(gtkconv->u.im); | |
4884 } | |
4885 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
4886 g_free(gtkconv->u.chat); | |
4887 } | |
4888 | |
4633 | 4889 gtk_object_sink(GTK_OBJECT(gtkconv->tooltips)); |
4890 | |
4359 | 4891 g_free(gtkconv); |
4892 } | |
4893 | |
4894 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4895 gaim_gtkconv_write_im(GaimConversation *conv, const char *who, |
6982 | 4896 const char *message, GaimMessageFlags flags, |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4897 time_t mtime) |
4359 | 4898 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4899 GaimGtkConversation *gtkconv; |
8630 | 4900 GaimConvWindow *gaimwin; |
4901 GaimGtkWindow *gtkwin; | |
4902 gboolean has_focus; | |
4359 | 4903 |
4904 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
8630 | 4905 gaimwin = gaim_conversation_get_window(conv); |
4906 gtkwin = GAIM_GTK_WINDOW(gaimwin); | |
4907 | |
4908 g_object_get(G_OBJECT(gtkwin->window), "has-toplevel-focus", &has_focus, NULL); | |
4359 | 4909 |
6621 | 4910 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
9301 | 4911 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
|
4912 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4913 gaim_conv_window_raise(gaim_conversation_get_window(conv)); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4914 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4915 |
4382
76223649765b
[gaim-migrate @ 4648]
Christian Hammond <chipx86@chipx86.com>
parents:
4378
diff
changeset
|
4916 /* Play a sound, if specified in prefs. */ |
8630 | 4917 if (gtkconv->make_sound && !((gaim_conv_window_get_active_conversation(gaimwin) == conv) && |
8633 | 4918 !gaim_prefs_get_bool("/gaim/gtk/sound/conv_focus") && has_focus)) { |
6621 | 4919 if (flags & GAIM_MESSAGE_RECV) { |
4359 | 4920 if (gtkconv->u.im->a_virgin && |
5820 | 4921 gaim_prefs_get_bool("/gaim/gtk/sound/enabled/first_im_recv")) { |
4359 | 4922 |
4561 | 4923 gaim_sound_play_event(GAIM_SOUND_FIRST_RECEIVE); |
4359 | 4924 } |
4925 else | |
4561 | 4926 gaim_sound_play_event(GAIM_SOUND_RECEIVE); |
4359 | 4927 } |
4928 else { | |
4561 | 4929 gaim_sound_play_event(GAIM_SOUND_SEND); |
4359 | 4930 } |
4931 } | |
4932 | |
4933 gtkconv->u.im->a_virgin = FALSE; | |
4934 | |
6982 | 4935 gaim_conversation_write(conv, who, message, flags, mtime); |
4359 | 4936 } |
4937 | |
4938 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4939 gaim_gtkconv_write_chat(GaimConversation *conv, const char *who, |
6621 | 4940 const char *message, GaimMessageFlags flags, time_t mtime) |
4359 | 4941 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4942 GaimGtkConversation *gtkconv; |
8630 | 4943 GaimConvWindow *gaimwin; |
4944 GaimGtkWindow *gtkwin; | |
4945 gboolean has_focus; | |
4359 | 4946 |
4947 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
8630 | 4948 gaimwin = gaim_conversation_get_window(conv); |
4949 gtkwin = GAIM_GTK_WINDOW(gaimwin); | |
4950 | |
4951 g_object_get(G_OBJECT(gtkwin->window), "has-toplevel-focus", &has_focus, NULL); | |
4359 | 4952 |
4382
76223649765b
[gaim-migrate @ 4648]
Christian Hammond <chipx86@chipx86.com>
parents:
4378
diff
changeset
|
4953 /* Play a sound, if specified in prefs. */ |
8630 | 4954 if (gtkconv->make_sound && !((gaim_conv_window_get_active_conversation(gaimwin) == conv) && |
8633 | 4955 !gaim_prefs_get_bool("/gaim/gtk/sound/conv_focus") && has_focus)) { |
6621 | 4956 if (!(flags & GAIM_MESSAGE_WHISPER) && (flags & GAIM_MESSAGE_SEND)) |
4561 | 4957 gaim_sound_play_event(GAIM_SOUND_CHAT_YOU_SAY); |
6621 | 4958 else if (flags & GAIM_MESSAGE_RECV) { |
4959 if ((flags & GAIM_MESSAGE_NICK) && | |
8573 | 4960 gaim_prefs_get_bool("/gaim/gtk/sound/enabled/nick_said") && |
4961 !(flags & GAIM_MESSAGE_SYSTEM)) { | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4962 |
4561 | 4963 gaim_sound_play_event(GAIM_SOUND_CHAT_NICK); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4964 } |
4359 | 4965 else |
4561 | 4966 gaim_sound_play_event(GAIM_SOUND_CHAT_SAY); |
4359 | 4967 } |
4968 } | |
4969 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4970 if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/color_nicks")) |
6621 | 4971 flags |= GAIM_MESSAGE_COLORIZE; |
4359 | 4972 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4973 /* Raise the window, if specified in prefs. */ |
6621 | 4974 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
9150 | 4975 /* we may want to change this */ |
9301 | 4976 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
|
4977 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4978 gaim_conv_window_raise(gaim_conversation_get_window(conv)); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4979 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4980 |
6982 | 4981 gaim_conversation_write(conv, who, message, flags, mtime); |
4359 | 4982 } |
4983 | |
4984 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4985 gaim_gtkconv_write_conv(GaimConversation *conv, const char *who, |
6982 | 4986 const char *message, GaimMessageFlags flags, |
4359 | 4987 time_t mtime) |
4988 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4989 GaimGtkConversation *gtkconv; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4990 GaimConvWindow *win; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
4991 GaimConnection *gc; |
4359 | 4992 int gtk_font_options = 0; |
7440 | 4993 char buf[BUF_LONG]; |
4359 | 4994 char buf2[BUF_LONG]; |
4995 char mdate[64]; | |
4996 char color[10]; | |
4997 char *str; | |
4998 char *with_font_tag; | |
4896 | 4999 char *sml_attrib = NULL; |
6982 | 5000 size_t length = strlen(message) + 1; |
4895 | 5001 |
4359 | 5002 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5003 gc = gaim_conversation_get_gc(conv); | |
5004 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5005 win = gaim_conversation_get_window(conv); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5006 |
9301 | 5007 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
5008 ((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT && | |
5009 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) || | |
5010 (gaim_conversation_get_type(conv) == GAIM_CONV_IM && | |
5011 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
|
5012 gaim_conv_window_show(win); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5013 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5014 |
8677 | 5015 if (gtk_text_buffer_get_char_count(gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)))) |
5016 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", 0); | |
5017 | |
5133 | 5018 if(time(NULL) > mtime + 20*60) /* show date if older than 20 minutes */ |
5019 strftime(mdate, sizeof(mdate), "%Y-%m-%d %H:%M:%S", localtime(&mtime)); | |
5020 else | |
5021 strftime(mdate, sizeof(mdate), "%H:%M:%S", localtime(&mtime)); | |
4359 | 5022 |
4896 | 5023 if(gc) |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
5024 sml_attrib = g_strdup_printf("sml=\"%s\"", gc->prpl->info->name); |
7440 | 5025 |
4359 | 5026 gtk_font_options ^= GTK_IMHTML_NO_COMMENTS; |
5027 | |
9049 | 5028 #if 1 /* PREFSLASH04 */ |
5029 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_colors")) | |
5030 gtk_font_options ^= GTK_IMHTML_NO_COLOURS; | |
5031 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_fonts")) | |
5032 gtk_font_options ^= GTK_IMHTML_NO_FONTS; | |
5033 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_font_sizes")) | |
5034 gtk_font_options ^= GTK_IMHTML_NO_SIZES; | |
5035 #else | |
8944 | 5036 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_formatting")) { |
4359 | 5037 gtk_font_options ^= GTK_IMHTML_NO_COLOURS; |
5038 gtk_font_options ^= GTK_IMHTML_NO_FONTS; | |
5039 gtk_font_options ^= GTK_IMHTML_NO_SIZES; | |
8944 | 5040 } |
9049 | 5041 #endif |
4359 | 5042 |
7956 | 5043 /* this is gonna crash one day, I can feel it. */ |
5044 if (GAIM_PLUGIN_PROTOCOL_INFO(gaim_find_prpl(gaim_account_get_protocol_id(conv->account)))->options & | |
7431 | 5045 OPT_PROTO_USE_POINTSIZE) { |
5367 | 5046 gtk_font_options ^= GTK_IMHTML_USE_POINTSIZE; |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5047 } |
4359 | 5048 |
6621 | 5049 if (flags & GAIM_MESSAGE_SYSTEM) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5050 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) |
8380 | 5051 g_snprintf(buf, BUF_LONG, "<FONT SIZE=\"2\">(%s)</FONT> <B>%s</B>", |
7431 | 5052 mdate, message); |
4359 | 5053 else |
5054 g_snprintf(buf, BUF_LONG, "<B>%s</B>", message); | |
7440 | 5055 |
4359 | 5056 g_snprintf(buf2, sizeof(buf2), |
8690 | 5057 "<FONT %s><FONT SIZE=\"2\"><!--(%s) --></FONT><B>%s</B></FONT>", |
7850 | 5058 sml_attrib, mdate, message); |
7440 | 5059 |
8962 | 5060 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, 0); |
7440 | 5061 |
7583 | 5062 /* Add the message to a conversations scrollback buffer */ |
5063 conv->history = g_string_append(conv->history, buf); | |
5064 conv->history = g_string_append(conv->history, "<BR>\n"); | |
7440 | 5065 |
8722 | 5066 } else if (flags & GAIM_MESSAGE_ERROR) { |
5067 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) | |
5068 g_snprintf(buf, BUF_LONG, "<FONT SIZE=\"2\">(%s)</FONT> <B>%s</B>", | |
5069 mdate, message); | |
5070 else | |
5071 g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"#ff0000\"><B>%s</B></FONT>", message); | |
9554 | 5072 |
8722 | 5073 g_snprintf(buf2, sizeof(buf2), |
5074 "<FONT %s><FONT SIZE=\"2\"><!--(%s) --></FONT><B>%s</B></FONT>", | |
5075 sml_attrib, mdate, message); | |
9554 | 5076 |
8962 | 5077 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, 0); |
5078 | |
8722 | 5079 /* Add the message to a conversations scrollback buffer */ |
5080 conv->history = g_string_append(conv->history, buf); | |
5081 conv->history = g_string_append(conv->history, "<BR>\n"); | |
7431 | 5082 } else if (flags & GAIM_MESSAGE_NO_LOG) { |
4359 | 5083 g_snprintf(buf, BUF_LONG, |
8690 | 5084 "<B><FONT %s COLOR=\"#777777\">%s</FONT></B>", |
7850 | 5085 sml_attrib, message); |
7440 | 5086 |
8962 | 5087 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf, 0); |
4359 | 5088 } |
5089 else { | |
4895 | 5090 char *new_message = g_memdup(message, length); |
8908 | 5091 char *who_escaped = g_markup_escape_text(who, strlen(who)); |
7440 | 5092 |
6621 | 5093 if (flags & GAIM_MESSAGE_WHISPER) { |
4359 | 5094 str = g_malloc(1024); |
7440 | 5095 |
4359 | 5096 /* If we're whispering, it's not an autoresponse. */ |
7564 | 5097 if (gaim_message_meify(new_message, length)) { |
8908 | 5098 g_snprintf(str, 1024, "***%s", who_escaped); |
4359 | 5099 strcpy(color, "#6C2585"); |
5100 } | |
5101 else { | |
8908 | 5102 g_snprintf(str, 1024, "*%s*:", who_escaped); |
4359 | 5103 strcpy(color, "#00FF00"); |
5104 } | |
7440 | 5105 } |
4359 | 5106 else { |
7564 | 5107 if (gaim_message_meify(new_message, length)) { |
4359 | 5108 str = g_malloc(1024); |
7440 | 5109 |
6621 | 5110 if (flags & GAIM_MESSAGE_AUTO_RESP) |
8908 | 5111 g_snprintf(str, 1024, "%s ***%s", AUTO_RESPONSE, who_escaped); |
4359 | 5112 else |
8908 | 5113 g_snprintf(str, 1024, "***%s", who_escaped); |
7440 | 5114 |
6621 | 5115 if (flags & GAIM_MESSAGE_NICK) |
4359 | 5116 strcpy(color, "#AF7F00"); |
5117 else | |
5118 strcpy(color, "#062585"); | |
5119 } | |
5120 else { | |
5121 str = g_malloc(1024); | |
6621 | 5122 if (flags & GAIM_MESSAGE_AUTO_RESP) |
8908 | 5123 g_snprintf(str, 1024, "%s %s", who_escaped, AUTO_RESPONSE); |
4359 | 5124 else |
8908 | 5125 g_snprintf(str, 1024, "%s:", who_escaped); |
6621 | 5126 if (flags & GAIM_MESSAGE_NICK) |
4359 | 5127 strcpy(color, "#AF7F00"); |
6621 | 5128 else if (flags & GAIM_MESSAGE_RECV) { |
5129 if (flags & GAIM_MESSAGE_COLORIZE) { | |
4359 | 5130 const char *u; |
5131 int m = 0; | |
7440 | 5132 |
4359 | 5133 for (u = who; *u != '\0'; u++) |
5134 m += *u; | |
7440 | 5135 |
4359 | 5136 m = m % NUM_NICK_COLORS; |
7440 | 5137 |
4359 | 5138 strcpy(color, nick_colors[m]); |
5139 } | |
5140 else | |
7854 | 5141 strcpy(color, RECV_COLOR); |
4359 | 5142 } |
6621 | 5143 else if (flags & GAIM_MESSAGE_SEND) |
7854 | 5144 strcpy(color, SEND_COLOR); |
4359 | 5145 } |
8908 | 5146 |
5147 if(who_escaped) | |
5148 g_free(who_escaped); | |
4359 | 5149 } |
7440 | 5150 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5151 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) |
4359 | 5152 g_snprintf(buf, BUF_LONG, |
8380 | 5153 "<FONT COLOR=\"%s\" %s><FONT SIZE=\"2\">(%s)</FONT> " |
7431 | 5154 "<B>%s</B></FONT> ", color, |
5155 sml_attrib ? sml_attrib : "", mdate, str); | |
4359 | 5156 else |
5157 g_snprintf(buf, BUF_LONG, | |
7431 | 5158 "<FONT COLOR=\"%s\" %s><B>%s</B></FONT> ", color, |
5159 sml_attrib ? sml_attrib : "", str); | |
7440 | 5160 |
4359 | 5161 g_snprintf(buf2, BUF_LONG, |
8380 | 5162 "<FONT COLOR=\"%s\" %s><FONT SIZE=\"2\"><!--(%s) --></FONT>" |
7431 | 5163 "<B>%s</B></FONT> ", |
5164 color, sml_attrib ? sml_attrib : "", mdate, str); | |
7440 | 5165 |
4359 | 5166 g_free(str); |
5167 | |
8962 | 5168 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), |
5169 buf2, 0); | |
4359 | 5170 |
4895 | 5171 if(gc){ |
4896 | 5172 char *pre = g_strdup_printf("<font %s>", sml_attrib ? sml_attrib : ""); |
4895 | 5173 char *post = "</font>"; |
5174 int pre_len = strlen(pre); | |
5175 int post_len = strlen(post); | |
7440 | 5176 |
4895 | 5177 with_font_tag = g_malloc(length + pre_len + post_len + 1); |
7440 | 5178 |
4895 | 5179 strcpy(with_font_tag, pre); |
5180 memcpy(with_font_tag + pre_len, new_message, length); | |
5181 strcpy(with_font_tag + pre_len + length, post); | |
7440 | 5182 |
4895 | 5183 length += pre_len + post_len; |
5184 g_free(pre); | |
5185 } | |
4608 | 5186 else |
4895 | 5187 with_font_tag = g_memdup(new_message, length); |
7440 | 5188 |
8962 | 5189 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), |
5190 with_font_tag, gtk_font_options); | |
7440 | 5191 |
8557 | 5192 conv->history = g_string_append(conv->history, buf); |
5193 conv->history = g_string_append(conv->history, new_message); | |
5194 conv->history = g_string_append(conv->history, "<BR>\n"); | |
7440 | 5195 |
5196 g_free(with_font_tag); | |
7447 | 5197 g_free(new_message); |
7440 | 5198 } |
5199 | |
6062 | 5200 |
5012 | 5201 if(sml_attrib) |
5202 g_free(sml_attrib); | |
4359 | 5203 } |
5204 | |
5205 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5206 gaim_gtkconv_chat_add_user(GaimConversation *conv, const char *user) |
4359 | 5207 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5208 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5209 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5210 GaimGtkChatPane *gtkchat; |
4359 | 5211 char tmp[BUF_LONG]; |
5212 int num_users; | |
5213 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5214 chat = GAIM_CONV_CHAT(conv); |
4359 | 5215 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5216 gtkchat = gtkconv->u.chat; | |
5217 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5218 num_users = g_list_length(gaim_conv_chat_get_users(chat)); |
4359 | 5219 |
5220 g_snprintf(tmp, sizeof(tmp), | |
5221 ngettext("%d person in room", "%d people in room", | |
5222 num_users), | |
5223 num_users); | |
5224 | |
5225 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); | |
5226 | |
5227 if (gtkconv->make_sound) | |
4561 | 5228 gaim_sound_play_event(GAIM_SOUND_CHAT_JOIN); |
4359 | 5229 |
9554 | 5230 add_chat_buddy_common(conv, user); |
4359 | 5231 } |
5232 | |
5233 static void | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5234 gaim_gtkconv_chat_add_users(GaimConversation *conv, GList *users) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5235 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5236 GaimConvChat *chat; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5237 GaimGtkConversation *gtkconv; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5238 GaimGtkChatPane *gtkchat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5239 GList *l; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5240 char tmp[BUF_LONG]; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5241 int num_users; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5242 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5243 chat = GAIM_CONV_CHAT(conv); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5244 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5245 gtkchat = gtkconv->u.chat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5246 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5247 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
|
5248 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5249 g_snprintf(tmp, sizeof(tmp), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5250 ngettext("%d person in room", "%d people in room", |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5251 num_users), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5252 num_users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5253 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5254 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5255 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5256 for (l = users; l != NULL; l = l->next) { |
9554 | 5257 add_chat_buddy_common(conv, (char *)l->data); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5258 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5259 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5260 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5261 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5262 gaim_gtkconv_chat_rename_user(GaimConversation *conv, const char *old_name, |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5263 const char *new_name) |
4359 | 5264 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5265 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5266 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5267 GaimGtkChatPane *gtkchat; |
4359 | 5268 GtkTreeIter iter; |
5269 GtkTreeModel *model; | |
5270 int f = 1; | |
5271 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5272 chat = GAIM_CONV_CHAT(conv); |
4359 | 5273 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5274 gtkchat = gtkconv->u.chat; | |
5275 | |
9554 | 5276 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
5277 | |
5278 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
5279 return; | |
5280 | |
5281 while (f != 0) { | |
5282 char *val; | |
5283 | |
5284 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &val, -1); | |
5285 | |
5286 if (!gaim_utf8_strcasecmp(old_name, val)) { | |
5287 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); | |
5288 g_free(val); | |
4359 | 5289 break; |
5290 } | |
9554 | 5291 |
5292 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
5293 | |
5294 g_free(val); | |
4359 | 5295 } |
5296 | |
9554 | 5297 if (!gaim_conv_chat_find_user(chat, old_name)) |
4359 | 5298 return; |
5299 | |
9554 | 5300 add_chat_buddy_common(conv, new_name); |
4359 | 5301 } |
5302 | |
5303 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5304 gaim_gtkconv_chat_remove_user(GaimConversation *conv, const char *user) |
4359 | 5305 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5306 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5307 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5308 GaimGtkChatPane *gtkchat; |
4359 | 5309 GtkTreeIter iter; |
5310 GtkTreeModel *model; | |
5311 char tmp[BUF_LONG]; | |
5312 int num_users; | |
5313 int f = 1; | |
5314 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5315 chat = GAIM_CONV_CHAT(conv); |
4359 | 5316 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5317 gtkchat = gtkconv->u.chat; | |
5318 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5319 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
|
5320 |
9554 | 5321 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
5322 | |
5323 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
5324 return; | |
5325 | |
5326 while (f != 0) { | |
5327 char *val; | |
5328 | |
5329 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &val, -1); | |
5330 | |
5331 if (!gaim_utf8_strcasecmp(user, val)) { | |
5332 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); | |
5333 g_free(val); | |
4359 | 5334 break; |
5335 } | |
9554 | 5336 |
5337 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
5338 | |
5339 g_free(val); | |
4359 | 5340 } |
5341 | |
9554 | 5342 if (!gaim_conv_chat_find_user(chat, user)) |
4359 | 5343 return; |
5344 | |
5345 g_snprintf(tmp, sizeof(tmp), | |
9554 | 5346 ngettext("%d person in room", "%d people in room", |
5347 num_users), num_users); | |
4359 | 5348 |
5349 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); | |
5350 | |
5351 if (gtkconv->make_sound) | |
4561 | 5352 gaim_sound_play_event(GAIM_SOUND_CHAT_LEAVE); |
4359 | 5353 } |
5354 | |
5355 static void | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5356 gaim_gtkconv_chat_remove_users(GaimConversation *conv, GList *users) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5357 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5358 GaimConvChat *chat; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5359 GaimGtkConversation *gtkconv; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5360 GaimGtkChatPane *gtkchat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5361 GtkTreeIter iter; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5362 GtkTreeModel *model; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5363 GList *l; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5364 char tmp[BUF_LONG]; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5365 int num_users; |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
5366 gboolean f; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5367 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5368 chat = GAIM_CONV_CHAT(conv); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5369 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5370 gtkchat = gtkconv->u.chat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5371 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5372 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
|
5373 g_list_length(users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5374 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5375 for (l = users; l != NULL; l = l->next) { |
9554 | 5376 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
5377 | |
5378 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), | |
5379 &iter)) | |
5380 continue; | |
5381 | |
5382 do { | |
5383 char *val; | |
5384 | |
5385 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, | |
5386 CHAT_USERS_NAME_COLUMN, &val, -1); | |
5387 | |
5388 if (!gaim_utf8_strcasecmp((char *)l->data, val)) | |
5389 f = gtk_list_store_remove(GTK_LIST_STORE(model), &iter); | |
5390 else | |
5391 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
5392 | |
5393 g_free(val); | |
5394 } while (f); | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5395 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5396 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5397 g_snprintf(tmp, sizeof(tmp), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5398 ngettext("%d person in room", "%d people in room", |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5399 num_users), num_users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5400 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5401 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5402 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5403 |
9554 | 5404 static void |
5405 gaim_gtkconv_chat_update_user(GaimConversation *conv, const char *user) | |
5406 { | |
5407 GaimConvChat *chat; | |
5408 GaimGtkConversation *gtkconv; | |
5409 GaimGtkChatPane *gtkchat; | |
5410 GtkTreeIter iter; | |
5411 GtkTreeModel *model; | |
5412 int f = 1; | |
5413 | |
5414 chat = GAIM_CONV_CHAT(conv); | |
5415 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5416 gtkchat = gtkconv->u.chat; | |
5417 | |
5418 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | |
5419 | |
5420 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
5421 return; | |
5422 | |
5423 while (f != 0) { | |
5424 char *val; | |
5425 | |
5426 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &val, -1); | |
5427 | |
5428 if (!gaim_utf8_strcasecmp(user, val)) { | |
5429 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); | |
5430 g_free(val); | |
5431 break; | |
5432 } | |
5433 | |
5434 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
5435 | |
5436 g_free(val); | |
5437 } | |
5438 | |
5439 if (!gaim_conv_chat_find_user(chat, user)) | |
5440 return; | |
5441 | |
5442 add_chat_buddy_common(conv, user); | |
5443 } | |
5444 | |
9260
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5445 static gboolean |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5446 gaim_gtkconv_has_focus(GaimConversation *conv) |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5447 { |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5448 GaimConvWindow *win; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5449 GaimGtkWindow *gtkwin; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5450 gboolean has_focus; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5451 |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5452 win = gaim_conversation_get_window(conv); |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5453 gtkwin = GAIM_GTK_WINDOW(win); |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5454 |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5455 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
|
5456 |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5457 return has_focus; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5458 } |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5459 |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5460 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5461 gaim_gtkconv_updated(GaimConversation *conv, GaimConvUpdateType type) |
4359 | 5462 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5463 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5464 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5465 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5466 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5467 GaimConvChat *chat; |
4359 | 5468 |
5469 win = gaim_conversation_get_window(conv); | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5470 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 5471 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5472 | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5473 if (type == GAIM_CONV_UPDATE_ACCOUNT) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5474 { |
4359 | 5475 gaim_conversation_autoset_title(conv); |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5476 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5477 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5478 gaim_gtkconv_update_buddy_icon(conv); |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5479 |
4359 | 5480 gaim_gtkconv_update_buttons_by_protocol(conv); |
5481 | |
4685 | 5482 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); |
4359 | 5483 |
5484 smiley_themeize(gtkconv->imhtml); | |
6394 | 5485 |
6395 | 5486 update_tab_icon(conv); |
4359 | 5487 } |
5488 else if (type == GAIM_CONV_UPDATE_TYPING || | |
8155
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5489 type == GAIM_CONV_UPDATE_UNSEEN || |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5490 type == GAIM_CONV_UPDATE_TITLE) |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5491 { |
9472 | 5492 char *title; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5493 GaimConvIm *im = NULL; |
9472 | 5494 GaimConnection *gc = gaim_conversation_get_gc(conv); |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5495 char color[8]; |
4736 | 5496 |
4359 | 5497 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5498 im = GAIM_CONV_IM(conv); |
4359 | 5499 |
9472 | 5500 if (!gc || ((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) |
5501 && gaim_conv_chat_has_left(GAIM_CONV_CHAT(conv)))) | |
5502 title = g_strdup_printf("(%s)", gaim_conversation_get_title(conv)); | |
5503 | |
5504 else | |
5505 title = g_strdup(gaim_conversation_get_title(conv)); | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5506 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5507 *color = '\0'; |
4359 | 5508 |
5509 if (!GTK_WIDGET_REALIZED(gtkconv->tab_label)) | |
5510 gtk_widget_realize(gtkconv->tab_label); | |
5511 | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5512 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
|
5513 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5514 strcpy(color, "#47A046"); |
4359 | 5515 } |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5516 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
|
5517 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5518 strcpy(color, "#D1940C"); |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5519 } |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5520 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_NICK) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5521 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5522 strcpy(color, "#314E6C"); |
4359 | 5523 } |
8252 | 5524 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_TEXT) |
5525 { | |
5526 strcpy(color, "#DF421E"); | |
5527 } | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5528 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_EVENT) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5529 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5530 strcpy(color, "#868272"); |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5531 } |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5532 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5533 if (*color != '\0') |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5534 { |
8536 | 5535 char *html_title,*label; |
5536 | |
5537 html_title = gaim_escape_html(title); | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5538 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5539 label = g_strdup_printf("<span color=\"%s\">%s</span>", |
8536 | 5540 color, html_title); |
5541 g_free(html_title); | |
7995
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
5542 gtk_label_set_markup(GTK_LABEL(gtkconv->tab_label), label); |
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
5543 g_free(label); |
4359 | 5544 } |
7995
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
5545 else |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5546 gtk_label_set_text(GTK_LABEL(gtkconv->tab_label), title); |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5547 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5548 if (conv == gaim_conv_window_get_active_conversation(win)) |
4736 | 5549 update_typing_icon(conv); |
8155
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5550 |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5551 if (type == GAIM_CONV_UPDATE_TITLE) { |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5552 gtk_label_set_text(GTK_LABEL(gtkconv->menu_label), title); |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5553 if (conv == gaim_conv_window_get_active_conversation(win)) |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5554 gtk_window_set_title(GTK_WINDOW(gtkwin->window), title); |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5555 } |
9472 | 5556 |
5557 g_free(title); | |
4359 | 5558 } |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5559 else if (type == GAIM_CONV_UPDATE_TOPIC) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5560 { |
7154 | 5561 const char *topic; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5562 chat = GAIM_CONV_CHAT(conv); |
4359 | 5563 gtkchat = gtkconv->u.chat; |
5564 | |
7154 | 5565 topic = gaim_conv_chat_get_topic(chat); |
5566 | |
9554 | 5567 gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), topic ? topic : ""); |
7154 | 5568 gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->topic_text, |
9554 | 5569 topic ? topic : "", NULL); |
4359 | 5570 } |
5571 else if (type == GAIM_CONV_ACCOUNT_ONLINE || | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5572 type == GAIM_CONV_ACCOUNT_OFFLINE) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5573 { |
7929 | 5574 gray_stuff_out(gaim_conv_window_get_active_conversation(win)); |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
5575 generate_send_as_items(win, NULL); |
8946 | 5576 update_tab_icon(conv); |
9472 | 5577 gaim_conversation_autoset_title(conv); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5578 } |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5579 else if (type == GAIM_CONV_UPDATE_AWAY) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5580 { |
8946 | 5581 update_tab_icon(conv); |
4359 | 5582 } |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
5583 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
|
5584 type == GAIM_CONV_UPDATE_CHATLEFT) |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5585 { |
9472 | 5586 gaim_conversation_autoset_title(conv); |
7929 | 5587 gray_stuff_out(conv); |
4397
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
5588 } |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5589 else if (type == GAIM_CONV_UPDATE_ICON) |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5590 { |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5591 gaim_gtkconv_update_buddy_icon(conv); |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5592 } |
4359 | 5593 } |
5594 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5595 static GaimConversationUiOps conversation_ui_ops = |
4359 | 5596 { |
5597 gaim_gtkconv_destroy, /* destroy_conversation */ | |
5598 gaim_gtkconv_write_chat, /* write_chat */ | |
5599 gaim_gtkconv_write_im, /* write_im */ | |
5600 gaim_gtkconv_write_conv, /* write_conv */ | |
5601 gaim_gtkconv_chat_add_user, /* chat_add_user */ | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5602 gaim_gtkconv_chat_add_users, /* chat_add_users */ |
4359 | 5603 gaim_gtkconv_chat_rename_user, /* chat_rename_user */ |
5604 gaim_gtkconv_chat_remove_user, /* chat_remove_user */ | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5605 gaim_gtkconv_chat_remove_users, /* chat_remove_users */ |
9554 | 5606 gaim_gtkconv_chat_update_user, /* chat_update_user */ |
4359 | 5607 NULL, /* update_progress */ |
9260
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5608 gaim_gtkconv_has_focus, /* has_focus */ |
4359 | 5609 gaim_gtkconv_updated /* updated */ |
5610 }; | |
5611 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5612 GaimConversationUiOps * |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
5613 gaim_gtk_conversations_get_conv_ui_ops(void) |
4359 | 5614 { |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
5615 return &conversation_ui_ops; |
4359 | 5616 } |
5617 | |
5618 /************************************************************************** | |
5619 * Public conversation utility functions | |
5620 **************************************************************************/ | |
5621 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5622 gaim_gtkconv_update_buddy_icon(GaimConversation *conv) |
4359 | 5623 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5624 GaimGtkConversation *gtkconv; |
7143 | 5625 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); |
4359 | 5626 |
5627 char filename[256]; | |
5628 FILE *file; | |
5629 GError *err = NULL; | |
5630 | |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5631 const void *data; |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5632 size_t len; |
4359 | 5633 |
5634 GdkPixbuf *buf; | |
5635 | |
8821 | 5636 GtkWidget *vbox; |
4359 | 5637 GtkWidget *event; |
5638 GtkWidget *frame; | |
5639 GdkPixbuf *scale; | |
5640 GdkPixmap *pm; | |
5641 GdkBitmap *bm; | |
9318 | 5642 int scale_width, scale_height; |
9332 | 5643 GtkRequisition requisition; |
9318 | 5644 |
5645 GaimAccount *account; | |
5646 GaimPluginProtocolInfo *prpl_info = NULL; | |
4359 | 5647 |
8821 | 5648 GaimButtonStyle button_type; |
5649 | |
9324 | 5650 GaimBuddyIcon *icon; |
5651 | |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5652 g_return_if_fail(conv != NULL); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5653 g_return_if_fail(GAIM_IS_GTK_CONVERSATION(conv)); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5654 g_return_if_fail(gaim_conversation_get_type(conv) == GAIM_CONV_IM); |
4359 | 5655 |
5656 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
9318 | 5657 account = gaim_conversation_get_account(conv); |
5658 if(account && account->gc) | |
5659 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl); | |
4359 | 5660 |
5661 remove_icon(gtkconv); | |
5662 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5663 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/im/show_buddy_icons")) |
4359 | 5664 return; |
5665 | |
5666 if (gaim_conversation_get_gc(conv) == NULL) | |
5667 return; | |
5668 | |
8189 | 5669 if (gtkconv->u.im->anim) |
4793 | 5670 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); |
5671 | |
9324 | 5672 |
5673 | |
5674 icon = gaim_conv_im_get_icon(GAIM_CONV_IM(conv)); | |
5675 | |
5676 if (icon == NULL) | |
5677 return; | |
5678 | |
5679 data = gaim_buddy_icon_get_data(icon, &len); | |
5680 | |
5681 /* this is such an evil hack, i don't know why i'm even considering it. | |
5682 * we'll do it differently when gdk-pixbuf-loader isn't leaky anymore. */ | |
5683 /* gdk-pixbuf-loader was leaky? is it still? */ | |
5684 g_snprintf(filename, sizeof(filename), | |
5685 "%s" G_DIR_SEPARATOR_S "gaimicon-%s.%d", | |
5686 g_get_tmp_dir(), gaim_conversation_get_name(conv), getpid()); | |
5687 | |
5688 if (!(file = fopen(filename, "wb"))) | |
5689 return; | |
5690 | |
5691 fwrite(data, 1, len, file); | |
5692 fclose(file); | |
5693 | |
5694 gtkconv->u.im->anim = gdk_pixbuf_animation_new_from_file(filename, &err); | |
5695 /* make sure we remove the file as soon as possible */ | |
5696 unlink(filename); | |
5697 | |
4359 | 5698 |
5699 if (err) { | |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5700 gaim_debug(GAIM_DEBUG_ERROR, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5701 "Buddy icon error: %s\n", err->message); |
4359 | 5702 g_error_free(err); |
5703 } | |
5704 | |
5705 if (!gtkconv->u.im->anim) | |
5706 return; | |
5707 | |
4793 | 5708 if(gtkconv->u.im->iter) |
5709 g_object_unref(G_OBJECT(gtkconv->u.im->iter)); | |
5710 | |
4359 | 5711 if (gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim)) { |
5712 gtkconv->u.im->iter = NULL; | |
5713 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); | |
5714 } else { | |
5715 gtkconv->u.im->iter = | |
8496 | 5716 gdk_pixbuf_animation_get_iter(gtkconv->u.im->anim, NULL); /* LEAK */ |
4359 | 5717 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); |
8189 | 5718 if (gtkconv->u.im->animate) |
5719 start_anim(NULL, conv); | |
4359 | 5720 } |
5721 | |
9318 | 5722 get_icon_scale_size(gtkconv->u.im->anim, prpl_info ? &prpl_info->icon_spec : |
5723 NULL, &scale_width, &scale_height); | |
4359 | 5724 scale = gdk_pixbuf_scale_simple(buf, |
9318 | 5725 MAX(gdk_pixbuf_get_width(buf) * scale_width / |
4359 | 5726 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), |
9318 | 5727 MAX(gdk_pixbuf_get_height(buf) * scale_height / |
4359 | 5728 gdk_pixbuf_animation_get_height(gtkconv->u.im->anim), 1), |
5729 GDK_INTERP_NEAREST); | |
5730 | |
5731 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); | |
4793 | 5732 g_object_unref(G_OBJECT(scale)); |
4359 | 5733 |
8821 | 5734 |
5735 vbox = gtk_vbox_new(FALSE, 0); | |
5736 | |
4359 | 5737 frame = gtk_frame_new(NULL); |
5738 gtk_frame_set_shadow_type(GTK_FRAME(frame), | |
5739 (bm ? GTK_SHADOW_NONE : GTK_SHADOW_IN)); | |
8821 | 5740 gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); |
5741 | |
4359 | 5742 event = gtk_event_box_new(); |
5743 gtk_container_add(GTK_CONTAINER(frame), event); | |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
5744 g_signal_connect(G_OBJECT(event), "button-press-event", |
4359 | 5745 G_CALLBACK(icon_menu), conv); |
5746 gtk_widget_show(event); | |
5747 | |
4635 | 5748 gtkconv->u.im->icon = gtk_image_new_from_pixmap(pm, bm); |
9318 | 5749 gtk_widget_set_size_request(gtkconv->u.im->icon, scale_width, scale_height); |
4359 | 5750 gtk_container_add(GTK_CONTAINER(event), gtkconv->u.im->icon); |
5751 gtk_widget_show(gtkconv->u.im->icon); | |
5752 | |
4793 | 5753 g_object_unref(G_OBJECT(pm)); |
4359 | 5754 |
5755 if (bm) | |
4793 | 5756 g_object_unref(G_OBJECT(bm)); |
7143 | 5757 |
9332 | 5758 button_type = gaim_prefs_get_int("/gaim/gtk/conversations/button_type"); |
5759 gtk_widget_size_request(gtkconv->bbox, &requisition); | |
5760 if(button_type == GAIM_BUTTON_NONE || requisition.height < scale_height) { | |
5761 gtk_box_pack_start(GTK_BOX(gtkconv->lower_hbox), vbox, FALSE, FALSE, 0); | |
5762 /* gtk_box_reorder_child(GTK_BOX(gtkconv->lower_hbox), vbox, 0); */ | |
5763 } else { | |
5764 gtk_box_pack_start(GTK_BOX(gtkconv->bbox), vbox, FALSE, FALSE, 0); | |
5765 gtk_box_reorder_child(GTK_BOX(gtkconv->bbox), vbox, 0); | |
5766 } | |
5767 | |
5768 gtk_widget_show(vbox); | |
5769 gtk_widget_show(frame); | |
5770 | |
7143 | 5771 /* The buddy icon code needs badly to be fixed. */ |
5772 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); | |
8068 | 5773 if(conv == gaim_conv_window_get_active_conversation(gaim_conversation_get_window(conv))) |
5774 gtk_window_set_icon(GTK_WINDOW(gtkwin->window), buf); | |
4359 | 5775 } |
5776 | |
5777 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5778 gaim_gtkconv_update_buttons_by_protocol(GaimConversation *conv) |
4359 | 5779 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5780 GaimConvWindow *win; |
4359 | 5781 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5782 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
4359 | 5783 return; |
5784 | |
7887 | 5785 win = gaim_conversation_get_window(conv); |
5786 | |
5787 if (win != NULL && gaim_conv_window_get_active_conversation(win) == conv) | |
5788 gray_stuff_out(conv); | |
4359 | 5789 } |
5790 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5791 GaimConvWindow * |
4359 | 5792 gaim_gtkwin_get_at_xy(int x, int y) |
5793 { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5794 GaimConvWindow *win = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5795 GaimGtkWindow *gtkwin; |
4359 | 5796 GdkWindow *gdkwin; |
5797 GList *l; | |
5798 | |
5799 gdkwin = gdk_window_at_pointer(&x, &y); | |
5800 | |
5801 if (gdkwin) | |
5802 gdkwin = gdk_window_get_toplevel(gdkwin); | |
5803 | |
5804 for (l = gaim_get_windows(); l != NULL; l = l->next) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5805 win = (GaimConvWindow *)l->data; |
4359 | 5806 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5807 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5808 continue; |
5809 | |
5810 gtkwin = GAIM_GTK_WINDOW(win); | |
5811 | |
5812 if (gdkwin == gtkwin->window->window) | |
5813 return win; | |
5814 } | |
5815 | |
5816 return NULL; | |
5817 } | |
5818 | |
5819 int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5820 gaim_gtkconv_get_tab_at_xy(GaimConvWindow *win, int x, int y) |
4359 | 5821 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5822 GaimGtkWindow *gtkwin; |
4359 | 5823 GList *l; |
5824 gint nb_x, nb_y, x_rel, y_rel; | |
5825 GtkNotebook *notebook; | |
5826 GtkWidget *tab; | |
5827 gint i, page_num = 0; | |
5828 gboolean first_visible = TRUE; | |
5829 | |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5830 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5831 return -1; |
5832 | |
5833 gtkwin = GAIM_GTK_WINDOW(win); | |
5834 notebook = GTK_NOTEBOOK(gtkwin->notebook); | |
5835 | |
5836 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
5837 x_rel = x - nb_x; | |
5838 y_rel = y - nb_y; | |
5839 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5840 for (l = gaim_conv_window_get_conversations(win), i = 0; |
4359 | 5841 l != NULL; |
5842 l = l->next, i++) { | |
5843 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5844 GaimConversation *conv = l->data; |
4359 | 5845 tab = GAIM_GTK_CONVERSATION(conv)->tab_label; |
5846 | |
5847 if (!GTK_WIDGET_MAPPED(tab)) | |
5848 continue; | |
5849 | |
5850 if (first_visible) { | |
5851 first_visible = FALSE; | |
5852 | |
5853 if (x_rel < tab->allocation.x) x_rel = tab->allocation.x; | |
5854 if (y_rel < tab->allocation.y) y_rel = tab->allocation.y; | |
5855 } | |
5856 | |
5857 if (gtk_notebook_get_tab_pos(notebook) == GTK_POS_TOP || | |
5858 gtk_notebook_get_tab_pos(notebook) == GTK_POS_BOTTOM) { | |
5859 | |
5860 if (tab->allocation.x <= x_rel) { | |
5861 if (tab->allocation.x + tab->allocation.width <= x_rel) | |
5862 page_num = i + 1; | |
5863 else | |
5864 page_num = i; | |
5865 } | |
5866 else | |
5867 break; | |
5868 } | |
5869 else { | |
5870 if (tab->allocation.y <= y_rel) { | |
5871 if (tab->allocation.y + tab->allocation.height <= y_rel) | |
5872 page_num = i + 1; | |
5873 else | |
5874 page_num = i; | |
5875 } | |
5876 else | |
5877 break; | |
5878 } | |
5879 } | |
5880 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5881 if (i == gaim_conv_window_get_conversation_count(win) + 1) |
4359 | 5882 return -1; |
5883 | |
5884 return page_num; | |
5885 } | |
5886 | |
5887 int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5888 gaim_gtkconv_get_dest_tab_at_xy(GaimConvWindow *win, int x, int y) |
4359 | 5889 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5890 GaimGtkWindow *gtkwin; |
4359 | 5891 GList *l; |
5892 gint nb_x, nb_y, x_rel, y_rel; | |
5893 GtkNotebook *notebook; | |
5894 GtkWidget *tab; | |
5895 gint i, page_num = 0; | |
5896 | |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5897 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5898 return -1; |
5899 | |
5900 gtkwin = GAIM_GTK_WINDOW(win); | |
5901 notebook = GTK_NOTEBOOK(gtkwin->notebook); | |
5902 | |
5903 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
5904 x_rel = x - nb_x; | |
5905 y_rel = y - nb_y; | |
5906 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5907 for (l = gaim_conv_window_get_conversations(win), i = 0; |
4359 | 5908 l != NULL; |
5909 l = l->next, i++) { | |
5910 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5911 GaimConversation *conv = l->data; |
4359 | 5912 tab = GAIM_GTK_CONVERSATION(conv)->tab_label; |
5913 | |
5914 if (!GTK_WIDGET_MAPPED(tab)) | |
5915 continue; | |
5916 | |
5917 if (gtk_notebook_get_tab_pos(notebook) == GTK_POS_TOP || | |
5918 gtk_notebook_get_tab_pos(notebook) == GTK_POS_BOTTOM) { | |
5919 | |
5920 if (tab->allocation.x <= x_rel) { | |
5921 if (tab->allocation.x + (tab->allocation.width / 2) <= x_rel) | |
5922 page_num = i + 1; | |
5923 else | |
5924 page_num = i; | |
5925 } | |
5926 else | |
5927 break; | |
5928 } | |
5929 else { | |
5930 if (tab->allocation.y <= y_rel) { | |
5931 if (tab->allocation.y + (tab->allocation.height / 2) <= y_rel) | |
5932 page_num = i + 1; | |
5933 else | |
5934 page_num = i; | |
5935 } | |
5936 else | |
5937 break; | |
5938 } | |
5939 } | |
5940 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5941 if (i == gaim_conv_window_get_conversation_count(win) + 1) |
4359 | 5942 return -1; |
5943 | |
5944 return page_num; | |
5945 } | |
4940
3708545afe42
[gaim-migrate @ 5274]
Christian Hammond <chipx86@chipx86.com>
parents:
4939
diff
changeset
|
5946 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5947 static void |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5948 escape_closes_pref_cb(const char *name, GaimPrefType type, gpointer value, |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5949 gpointer data) |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5950 { |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5951 if (value) |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5952 gtk_accel_map_change_entry(N_("<main>/Conversation/Close"), |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5953 GDK_Escape, 0, TRUE); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5954 else |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5955 gtk_accel_map_change_entry(N_("<main>/Conversation/Close"), |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5956 GDK_W, GDK_CONTROL_MASK, TRUE); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5957 } |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5958 |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5959 static void |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5960 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
|
5961 gpointer data) |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5962 { |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5963 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5964 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5965 GaimGtkConversation *gtkconv; |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5966 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5967 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5968 conv = (GaimConversation *)l->data; |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5969 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5970 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5971 continue; |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5972 |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5973 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5974 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5975 if (value) |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5976 gtk_widget_show(gtkconv->close); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5977 else |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5978 gtk_widget_hide(gtkconv->close); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5979 } |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5980 } |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5981 |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5982 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5983 show_timestamps_pref_cb(const char *name, GaimPrefType type, gpointer value, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5984 gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5985 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5986 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5987 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5988 GaimGtkConversation *gtkconv; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5989 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5990 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5991 conv = (GaimConversation *)l->data; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5992 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5993 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5994 continue; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5995 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5996 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5997 |
7386 | 5998 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
|
5999 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6000 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6001 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6002 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6003 spellcheck_pref_cb(const char *name, GaimPrefType type, gpointer value, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6004 gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6005 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6006 #ifdef USE_GTKSPELL |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6007 GList *cl; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6008 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6009 GaimGtkConversation *gtkconv; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6010 GtkSpell *spell; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6011 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6012 for (cl = gaim_get_conversations(); cl != NULL; cl = cl->next) { |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
6013 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6014 conv = (GaimConversation *)cl->data; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6015 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6016 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6017 continue; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6018 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6019 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6020 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6021 if (value) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
6022 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6023 else { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6024 spell = gtkspell_get_from_text_view(GTK_TEXT_VIEW(gtkconv->entry)); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6025 gtkspell_detach(spell); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6026 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6027 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6028 #endif |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6029 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6030 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6031 static void |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6032 tab_side_pref_cb(const char *name, GaimPrefType type, gpointer value, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6033 gpointer data) |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6034 { |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6035 GList *l; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6036 GtkPositionType pos; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
6037 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6038 GaimGtkWindow *gtkwin; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6039 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6040 pos = GPOINTER_TO_INT(value); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6041 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6042 for (l = gaim_get_windows(); l != NULL; l = l->next) { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
6043 win = (GaimConvWindow *)l->data; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6044 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6045 if (!GAIM_IS_GTK_WINDOW(win)) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6046 continue; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6047 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6048 gtkwin = GAIM_GTK_WINDOW(win); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6049 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6050 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6051 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6052 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6053 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6054 static void |
8456 | 6055 html_shortcuts_pref_cb(const char *name, GaimPrefType type, |
6056 gpointer value, gpointer data) | |
6057 { | |
6058 GList *l; | |
6059 GaimConversation *conv; | |
6060 GaimGtkConversation *gtkconv; | |
9487 | 6061 |
8456 | 6062 for(l = gaim_get_conversations(); l != NULL; l = l->next) { |
6063 conv = (GaimConversation *)l->data; | |
9487 | 6064 |
8456 | 6065 if(!GAIM_IS_GTK_CONVERSATION(conv)) |
6066 continue; | |
9487 | 6067 |
8456 | 6068 gtkconv = GAIM_GTK_CONVERSATION(conv); |
9487 | 6069 |
8456 | 6070 gtk_imhtml_html_shortcuts(GTK_IMHTML(gtkconv->entry), |
6071 (gboolean)GPOINTER_TO_INT(value)); | |
6072 } | |
6073 } | |
6074 | |
6075 static void | |
6076 smiley_shortcuts_pref_cb(const char *name, GaimPrefType type, | |
6077 gpointer value, gpointer data) | |
6078 { | |
6079 GList *l; | |
6080 GaimConversation *conv; | |
6081 GaimGtkConversation *gtkconv; | |
9487 | 6082 |
8456 | 6083 for(l = gaim_get_conversations(); l != NULL; l = l->next) { |
6084 conv = (GaimConversation *)l->data; | |
9487 | 6085 |
8456 | 6086 if(!GAIM_IS_GTK_CONVERSATION(conv)) |
6087 continue; | |
9487 | 6088 |
8456 | 6089 gtkconv = GAIM_GTK_CONVERSATION(conv); |
9487 | 6090 |
6091 gtk_imhtml_smiley_shortcuts(GTK_IMHTML(gtkconv->entry), | |
8456 | 6092 (gboolean)GPOINTER_TO_INT(value)); |
6093 } | |
6094 } | |
6095 | |
6096 static void | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6097 show_formatting_toolbar_pref_cb(const char *name, GaimPrefType type, |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6098 gpointer value, gpointer data) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6099 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6100 GList *l; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6101 GaimConversation *conv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6102 GaimGtkConversation *gtkconv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6103 GaimConvWindow *win; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6104 GaimGtkWindow *gtkwin; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6105 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6106 for (l = gaim_get_conversations(); l != NULL; l = l->next) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6107 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6108 conv = (GaimConversation *)l->data; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6109 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6110 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6111 continue; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6112 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6113 gtkconv = GAIM_GTK_CONVERSATION(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6114 win = gaim_conversation_get_window(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6115 gtkwin = GAIM_GTK_WINDOW(win); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6116 |
7386 | 6117 gtkconv->show_formatting_toolbar = (gboolean)GPOINTER_TO_INT(value); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6118 gtk_check_menu_item_set_active( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6119 GTK_CHECK_MENU_ITEM(gtkwin->menu.show_formatting_toolbar), |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6120 gtkconv->show_formatting_toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6121 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6122 if (gtkconv->show_formatting_toolbar) |
8317 | 6123 gtk_widget_show(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6124 else |
8317 | 6125 gtk_widget_hide(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6126 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6127 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6128 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6129 static void |
9150 | 6130 button_type_pref_cb(const char *name, GaimPrefType type, |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6131 gpointer value, gpointer data) |
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 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6134 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6135 GaimGtkConversation *gtkconv; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6136 |
9150 | 6137 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6138 conv = (GaimConversation *)l->data; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6139 gtkconv = GAIM_GTK_CONVERSATION(conv); |
9150 | 6140 switch (conv->type) { |
6141 case GAIM_CONV_IM: | |
6142 setup_im_buttons(conv, gtk_widget_get_parent(gtkconv->send)); | |
6143 gaim_gtkconv_update_buddy_icon(conv); | |
6144 break; | |
6145 case GAIM_CONV_CHAT: | |
6146 setup_chat_buttons(conv, gtk_widget_get_parent(gtkconv->send)); | |
6147 break; | |
6148 default: | |
6149 break; | |
6150 } | |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6151 } |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6152 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6153 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6154 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6155 animate_buddy_icons_pref_cb(const char *name, GaimPrefType type, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6156 gpointer value, gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6157 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6158 GList *l; |
8189 | 6159 GaimConversation *conv; |
6160 GaimGtkConversation *gtkconv; | |
6161 GaimConvWindow *win; | |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6162 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6163 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
|
6164 return; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6165 |
8189 | 6166 /* Set the "animate" flag for each icon based on the new preference */ |
6167 for (l = gaim_get_ims(); l != NULL; l = l->next) { | |
6168 conv = (GaimConversation *)l->data; | |
6169 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
6170 gtkconv->u.im->animate = (gboolean)value; | |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6171 } |
8189 | 6172 |
6173 /* Now either stop or start animation for the active conversation in each window */ | |
6174 for (l = gaim_get_windows(); l != NULL; l = l->next) { | |
6175 win = (GaimConvWindow *)l->data; | |
6176 conv = gaim_conv_window_get_active_conversation(win); | |
6177 gaim_gtkconv_update_buddy_icon(conv); | |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6178 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6179 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6180 |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6181 static void |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6182 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
|
6183 gpointer data) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6184 { |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6185 GList *l; |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6186 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6187 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6188 GaimConversation *conv = l->data; |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6189 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6190 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6191 gaim_conversation_foreach(gaim_gtkconv_update_buddy_icon); |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6192 } |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6193 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6194 |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5680
diff
changeset
|
6195 static void |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6196 conv_placement_pref_cb(const char *name, GaimPrefType type, |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6197 gpointer value, gpointer data) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6198 { |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6199 GaimConvPlacementFunc func; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6200 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6201 if (strcmp(name, "/gaim/gtk/conversations/placement")) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6202 return; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6203 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6204 func = gaim_conv_placement_get_fnc(value); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6205 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6206 if (func == NULL) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6207 return; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6208 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6209 gaim_conv_placement_set_current_func(func); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6210 } |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6211 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6212 void * |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6213 gaim_gtk_conversations_get_handle(void) |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6214 { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6215 static int handle; |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6216 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6217 return &handle; |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6218 } |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6219 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6220 void |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
6221 gaim_gtk_conversations_init(void) |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6222 { |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6223 void *handle = gaim_gtk_conversations_get_handle(); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6224 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6225 /* Conversations */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6226 gaim_prefs_add_none("/gaim/gtk/conversations"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6227 gaim_prefs_add_bool("/gaim/gtk/conversations/close_on_tabs", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6228 gaim_prefs_add_bool("/gaim/gtk/conversations/ctrl_enter_sends", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6229 gaim_prefs_add_bool("/gaim/gtk/conversations/enter_sends", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6230 gaim_prefs_add_bool("/gaim/gtk/conversations/escape_closes", FALSE); |
9025 | 6231 gaim_prefs_add_bool("/gaim/gtk/conversations/send_formatting", FALSE); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6232 gaim_prefs_add_bool("/gaim/gtk/conversations/send_bold", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6233 gaim_prefs_add_bool("/gaim/gtk/conversations/send_italic", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6234 gaim_prefs_add_bool("/gaim/gtk/conversations/send_underline", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6235 gaim_prefs_add_bool("/gaim/gtk/conversations/show_timestamps", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6236 gaim_prefs_add_bool("/gaim/gtk/conversations/spellcheck", TRUE); |
9049 | 6237 #if 1 |
6238 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_colors", FALSE); | |
6239 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_fonts", FALSE); | |
6240 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_font_sizes", FALSE); | |
6241 #else | |
8944 | 6242 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_formatting", FALSE); |
9049 | 6243 #endif |
9572 | 6244 gaim_prefs_add_bool("/gaim/gtk/conversations/html_shortcuts", TRUE); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6245 gaim_prefs_add_bool("/gaim/gtk/conversations/smiley_shortcuts", FALSE); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6246 gaim_prefs_add_bool("/gaim/gtk/conversations/show_formatting_toolbar", TRUE); |
9130 | 6247 gaim_prefs_add_bool("/gaim/gtk/conversations/enable_commands", TRUE); |
6248 | |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6249 gaim_prefs_add_string("/gaim/gtk/conversations/placement", "last"); |
8998 | 6250 gaim_prefs_add_int("/gaim/gtk/conversations/placement_number", 1); |
9025 | 6251 gaim_prefs_add_string("/gaim/gtk/conversations/bgcolor", ""); |
6252 gaim_prefs_add_string("/gaim/gtk/conversations/fgcolor", ""); | |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6253 gaim_prefs_add_string("/gaim/gtk/conversations/font_face", ""); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6254 gaim_prefs_add_int("/gaim/gtk/conversations/font_size", 3); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6255 gaim_prefs_add_bool("/gaim/gtk/conversations/tabs", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6256 gaim_prefs_add_int("/gaim/gtk/conversations/tab_side", GTK_POS_TOP); |
9150 | 6257 gaim_prefs_add_int("/gaim/gtk/conversations/button_type", |
6258 GAIM_BUTTON_TEXT_IMAGE); | |
6259 | |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6260 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6261 /* Conversations -> Chat */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6262 gaim_prefs_add_none("/gaim/gtk/conversations/chat"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6263 gaim_prefs_add_bool("/gaim/gtk/conversations/chat/color_nicks", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6264 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_width", 410); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6265 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_height", 160); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6266 gaim_prefs_add_int("/gaim/gtk/conversations/chat/entry_height", 50); |
9319 | 6267 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
|
6268 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6269 /* Conversations -> IM */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6270 gaim_prefs_add_none("/gaim/gtk/conversations/im"); |
9150 | 6271 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6272 gaim_prefs_add_bool("/gaim/gtk/conversations/im/animate_buddy_icons", TRUE); |
9150 | 6273 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6274 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_width", 410); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6275 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_height", 160); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6276 gaim_prefs_add_int("/gaim/gtk/conversations/im/entry_height", 50); |
9319 | 6277 gaim_prefs_add_bool("/gaim/gtk/conversations/im/raise_on_events", FALSE); |
6278 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
|
6279 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6280 /* Connect callbacks. */ |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6281 gaim_prefs_connect_callback("/gaim/gtk/conversations/escape_closes", |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6282 escape_closes_pref_cb, NULL); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6283 gaim_prefs_connect_callback("/gaim/gtk/conversations/close_on_tabs", |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6284 close_on_tabs_pref_cb, NULL); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6285 gaim_prefs_connect_callback("/gaim/gtk/conversations/show_timestamps", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6286 show_timestamps_pref_cb, NULL); |
8456 | 6287 gaim_prefs_connect_callback("/gaim/gtk/conversations/html_shortcuts", |
6288 html_shortcuts_pref_cb, NULL); | |
6289 gaim_prefs_connect_callback("/gaim/gtk/conversations/smiley_shortcuts", | |
6290 smiley_shortcuts_pref_cb, NULL); | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6291 gaim_prefs_connect_callback("/gaim/gtk/conversations/show_formatting_toolbar", |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6292 show_formatting_toolbar_pref_cb, NULL); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6293 gaim_prefs_connect_callback("/gaim/gtk/conversations/spellcheck", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6294 spellcheck_pref_cb, NULL); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6295 gaim_prefs_connect_callback("/gaim/gtk/conversations/tab_side", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6296 tab_side_pref_cb, NULL); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6297 |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6298 gaim_prefs_connect_callback("/gaim/gtk/conversations/placement", |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6299 conv_placement_pref_cb, NULL); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6300 gaim_prefs_trigger_callback("/gaim/gtk/conversations/placement"); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6301 |
9150 | 6302 gaim_prefs_connect_callback("/gaim/gtk/conversations/button_type", |
6303 button_type_pref_cb, NULL); | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
6304 |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6305 /* IM callbacks */ |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6306 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/animate_buddy_icons", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6307 animate_buddy_icons_pref_cb, NULL); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6308 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/show_buddy_icons", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6309 show_buddy_icons_pref_cb, NULL); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6310 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6311 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6312 /********************************************************************** |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6313 * Register signals |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6314 **********************************************************************/ |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6315 gaim_signal_register(handle, "conversation-drag-ended", |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6316 gaim_marshal_VOID__POINTER_POINTER, NULL, 2, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6317 gaim_value_new(GAIM_TYPE_SUBTYPE, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6318 GAIM_SUBTYPE_CONV_WINDOW), |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6319 gaim_value_new(GAIM_TYPE_SUBTYPE, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6320 GAIM_SUBTYPE_CONV_WINDOW)); |
9167 | 6321 |
6322 /********************************************************************** | |
6323 * Register commands | |
6324 **********************************************************************/ | |
9213 | 6325 gaim_cmd_register("me", "S", GAIM_CMD_P_DEFAULT, |
6326 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, | |
9247 | 6327 me_command_cb, _("me <action>: Send an IRC style action to a buddy or chat.")); |
9213 | 6328 gaim_cmd_register("debug", "w", GAIM_CMD_P_DEFAULT, |
6329 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, | |
9247 | 6330 debug_command_cb, _("debug <option>: Send various debug information to the current conversation.")); |
9213 | 6331 |
6332 gaim_cmd_register("help", "", GAIM_CMD_P_DEFAULT, | |
6333 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, | |
9247 | 6334 help_command_cb, _("help: List available commands.")); |
9213 | 6335 |
6336 gaim_cmd_register("help", "w", GAIM_CMD_P_DEFAULT, | |
6337 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, | |
9247 | 6338 help_arg_command_cb, _("help <command>: Help on a specific command.")); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6339 } |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6340 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6341 void |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6342 gaim_gtk_conversations_uninit(void) |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6343 { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6344 gaim_signals_unregister_by_instance(gaim_gtk_conversations_get_handle()); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6345 } |