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