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