Mercurial > pidgin.yaz
annotate src/gtkconv.c @ 5681:46d7ad0dfa26
[gaim-migrate @ 6100]
Rewrote the proxy code. It should now work with the new prefs, and it has a
namespace and API too!
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Tue, 03 Jun 2003 02:00:33 +0000 |
parents | 71cc0d5376c2 |
children | 1d140b31d4b3 |
rev | line source |
---|---|
4359 | 1 /* |
2 * gaim | |
3 * | |
4 * Copyright (C) 2002-2003, Christian Hammond <chipx86@gnupdate.org> | |
5 * | |
6 * This program is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * This program is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License | |
17 * along with this program; if not, write to the Free Software | |
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
19 * | |
20 */ | |
21 #ifdef HAVE_CONFIG_H | |
22 #include <config.h> | |
23 #endif | |
24 #include <string.h> | |
25 #ifndef _WIN32 | |
26 #include <sys/time.h> | |
27 #include <unistd.h> | |
28 #include <gdk/gdkx.h> | |
29 #include <X11/Xlib.h> | |
30 #endif /*_WIN32*/ | |
31 #include <sys/types.h> | |
32 #include <sys/stat.h> | |
33 #include <stdio.h> | |
34 #include <stdlib.h> | |
35 #include <errno.h> | |
36 #include <ctype.h> | |
37 #include <gtk/gtk.h> | |
38 #ifdef USE_GTKSPELL | |
39 #include <gtkspell/gtkspell.h> | |
40 #endif | |
41 #include <gdk/gdkkeysyms.h> | |
42 #include "prpl.h" | |
43 #include "gtkimhtml.h" | |
44 #include "dnd-hints.h" | |
4561 | 45 #include "sound.h" |
5228
1a53330dfd34
[gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
46 #include "gtkblist.h" |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5402
diff
changeset
|
47 #include "notify.h" |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
48 #include "prefs.h" |
4359 | 49 |
4373
dcc6c130c6d9
[gaim-migrate @ 4639]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4370
diff
changeset
|
50 #ifdef _WIN32 |
dcc6c130c6d9
[gaim-migrate @ 4639]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4370
diff
changeset
|
51 #include "win32dep.h" |
4859
a9a831508b43
[gaim-migrate @ 5186]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4851
diff
changeset
|
52 #include "wspell.h" |
4373
dcc6c130c6d9
[gaim-migrate @ 4639]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4370
diff
changeset
|
53 #endif |
dcc6c130c6d9
[gaim-migrate @ 4639]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4370
diff
changeset
|
54 |
4359 | 55 static char nick_colors[][8] = { |
56 "#ba55d3", /* Medium Orchid */ | |
57 "#ee82ee", /* Violet */ | |
58 "#c715b4", /* Medium Violet Red */ | |
59 "#ff69b4", /* Hot Pink */ | |
60 "#ff6347", /* Tomato */ | |
61 "#fa8c00", /* Dark Orange */ | |
62 "#fa8072", /* Salmon */ | |
63 "#b22222", /* Fire Brick */ | |
64 "#f4a460", /* Sandy Brown */ | |
65 "#cd5c5c", /* Indian Red */ | |
66 "#bc8f8f", /* Rosy Brown */ | |
67 "#f0e68c", /* Khaki */ | |
68 "#bdb76b", /* Dark Khaki */ | |
69 "#228b22", /* Forest Green */ | |
70 "#9acd32", /* Yellow Green */ | |
71 "#32cd32", /* Lime Green */ | |
72 "#3cb371", /* Medium Sea Green */ | |
73 "#2e8b57", /* Sea Green */ | |
74 "#8fbc8f", /* Dark Sea Green */ | |
75 "#66cdaa", /* Medium Aquamarine */ | |
76 "#5f9ea0", /* Cadet Blue */ | |
77 "#48d1cc", /* Medium Turquoise */ | |
78 "#00ced1", /* Dark Turquoise */ | |
79 "#4682b4", /* Stell Blue */ | |
80 "#00bfff", /* Deep Sky Blue */ | |
81 "#1690ff", /* Dodger Blue */ | |
82 "#4169ff", /* Royal Blue */ | |
83 "#6a5acd", /* Slate Blue */ | |
84 "#6495ed", /* Cornflower Blue */ | |
85 "#708090", /* Slate gray */ | |
86 "#ffdead", /* Navajo White */ | |
87 }; | |
88 #define NUM_NICK_COLORS (sizeof(nick_colors) / sizeof(*nick_colors)) | |
89 | |
90 #define SCALE(x) \ | |
91 ((gdk_pixbuf_animation_get_width(x) <= 48 && \ | |
92 gdk_pixbuf_animation_get_height(x) <= 48) ? 48 : 50) | |
93 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
94 typedef struct |
4359 | 95 { |
96 GtkWidget *window; | |
97 | |
98 GtkWidget *entry; | |
99 GtkWidget *message; | |
100 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
101 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
102 |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
103 } InviteBuddyInfo; |
4359 | 104 |
105 char fontface[128] = { 0 }; | |
106 int fontsize = 3; | |
107 | |
108 static GtkWidget *invite_dialog = NULL; | |
109 | |
110 /* Prototypes. <-- because Paco-Paco hates this comment. */ | |
111 static void check_everything(GtkTextBuffer *buffer); | |
4685 | 112 static void set_toggle(GtkWidget *tb, gboolean active); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
113 static void move_next_tab(GaimConversation *conv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
114 static void do_bold(GtkWidget *bold, GaimGtkConversation *gtkconv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
115 static void do_italic(GtkWidget *italic, GaimGtkConversation *gtkconv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
116 static void do_underline(GtkWidget *underline, GaimGtkConversation *gtkconv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
117 static void do_small(GtkWidget *small, GaimGtkConversation *gtkconv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
118 static void do_normal(GtkWidget *small, GaimGtkConversation *gtkconv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
119 static void do_big(GtkWidget *small, GaimGtkConversation *gtkconv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
120 static void toggle_font(GtkWidget *font, GaimConversation *conv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
121 static void toggle_fg_color(GtkWidget *color, GaimConversation *conv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
122 static void toggle_bg_color(GtkWidget *color, GaimConversation *conv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
123 static void got_typing_keypress(GaimConversation *conv, gboolean first); |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
124 static GList *generate_invite_user_names(GaimConnection *gc); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
125 static void add_chat_buddy_common(GaimConversation *conv, |
4359 | 126 const char *name, int pos); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
127 static void tab_complete(GaimConversation *conv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
128 static void update_typing_icon(GaimConversation *conv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
129 static gboolean update_send_as_selection(GaimWindow *win); |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
130 static char *item_factory_translate_func (const char *path, gpointer func_data); |
4359 | 131 |
132 /************************************************************************** | |
133 * Callbacks | |
134 **************************************************************************/ | |
135 static void | |
136 do_insert_image_cb(GObject *obj, GtkWidget *wid) | |
137 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
138 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
139 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
140 GaimIm *im; |
4359 | 141 const char *name; |
142 const char *filename; | |
143 char *buf; | |
144 struct stat st; | |
145 int id; | |
146 | |
5106 | 147 conv = g_object_get_data(G_OBJECT(wid), "user_data"); |
4359 | 148 gtkconv = GAIM_GTK_CONVERSATION(conv); |
149 im = GAIM_IM(conv); | |
150 name = gtk_file_selection_get_filename(GTK_FILE_SELECTION(wid)); | |
151 id = g_slist_length(im->images) + 1; | |
152 | |
153 if (file_is_dir(name, wid)) | |
154 return; | |
155 | |
156 gtk_widget_destroy(wid); | |
157 | |
158 if (!name) | |
159 return; | |
160 | |
161 if (stat(name, &st) != 0) { | |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
162 gaim_debug(GAIM_DEBUG_ERROR, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
163 "Could not stat image %s\n", name); |
4359 | 164 return; |
165 } | |
166 | |
167 filename = name; | |
168 while (strchr(filename, '/')) | |
169 filename = strchr(filename, '/') + 1; | |
170 | |
171 buf = g_strdup_printf("<IMG SRC=\"file://%s\" ID=\"%d\" DATASIZE=\"%d\">", | |
172 filename, id, (int)st.st_size); | |
173 im->images = g_slist_append(im->images, g_strdup(name)); | |
174 gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(gtkconv->entry_buffer), | |
175 buf, -1); | |
176 g_free(buf); | |
5046 | 177 |
178 set_toggle(gtkconv->toolbar.image, FALSE); | |
4359 | 179 } |
180 | |
181 static gint | |
182 close_win_cb(GtkWidget *w, GdkEventAny *e, gpointer d) | |
183 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
184 GaimWindow *win = (GaimWindow *)d; |
4359 | 185 |
186 gaim_window_destroy(win); | |
4361
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
187 |
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
188 return TRUE; |
4359 | 189 } |
190 | |
191 static gint | |
192 close_conv_cb(GtkWidget *w, gpointer d) | |
193 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
194 GaimConversation *conv = (GaimConversation *)d; |
4359 | 195 |
196 gaim_conversation_destroy(conv); | |
4361
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
197 |
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
198 return TRUE; |
4359 | 199 } |
200 | |
201 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
202 cancel_insert_image_cb(GtkWidget *unused, GaimGtkConversation *gtkconv) |
5106 | 203 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
204 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.image), |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
205 FALSE); |
5106 | 206 |
207 if (gtkconv->dialogs.image) | |
208 gtk_widget_destroy(gtkconv->dialogs.image); | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
209 |
5106 | 210 gtkconv->dialogs.image = NULL; |
211 } | |
212 | |
213 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
214 insert_image_cb(GtkWidget *save, GaimConversation *conv) |
4359 | 215 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
216 GaimGtkConversation *gtkconv; |
4359 | 217 char buf[BUF_LONG]; |
218 GtkWidget *window; | |
219 | |
220 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
221 | |
5046 | 222 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.image))) { |
223 window = gtk_file_selection_new(_("Gaim - Insert Image")); | |
224 g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S, gaim_home_dir()); | |
225 gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf); | |
226 | |
5106 | 227 g_object_set_data(G_OBJECT(window), "user_data", conv); |
5046 | 228 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(window)->ok_button), |
229 "clicked", G_CALLBACK(do_insert_image_cb), window); | |
5106 | 230 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(window)->cancel_button), |
231 "clicked", G_CALLBACK(cancel_insert_image_cb), gtkconv); | |
5046 | 232 |
233 gtk_widget_show(window); | |
5106 | 234 gtkconv->dialogs.image = window; |
5046 | 235 } else { |
236 gtk_widget_grab_focus(gtkconv->entry); | |
5106 | 237 if(gtkconv->dialogs.image) |
238 gtk_widget_destroy(gtkconv->dialogs.image); | |
239 gtkconv->dialogs.image = NULL; | |
5046 | 240 } |
4359 | 241 } |
242 | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5402
diff
changeset
|
243 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
244 insert_link_cb(GtkWidget *w, GaimConversation *conv) |
4359 | 245 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
246 GaimGtkConversation *gtkconv; |
4359 | 247 |
248 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
249 | |
250 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.link))) | |
251 show_insert_link(gtkconv->toolbar.link, conv); | |
252 else if (gtkconv->dialogs.link) | |
253 cancel_link(gtkconv->toolbar.link, conv); | |
254 else | |
255 gaim_gtk_advance_past(gtkconv, "<A HREF>", "</A>"); | |
256 | |
257 gtk_widget_grab_focus(gtkconv->entry); | |
258 } | |
259 | |
260 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
261 insert_smiley_cb(GtkWidget *smiley, GaimConversation *conv) |
4359 | 262 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
263 GaimGtkConversation *gtkconv; |
4359 | 264 |
265 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
266 | |
267 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(smiley))) | |
268 show_smiley_dialog(conv, smiley); | |
269 else if (gtkconv->dialogs.smiley) | |
270 close_smiley_dialog(smiley, conv); | |
271 | |
272 gtk_widget_grab_focus(gtkconv->entry); | |
273 } | |
274 | |
275 static void | |
276 menu_save_as_cb(gpointer data, guint action, GtkWidget *widget) | |
277 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
278 GaimWindow *win = (GaimWindow *)data; |
4359 | 279 |
280 save_convo(NULL, gaim_window_get_active_conversation(win)); | |
281 } | |
282 | |
283 static void | |
5167 | 284 menu_view_log_cb(gpointer data, guint action, GtkWidget *widget) |
4359 | 285 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
286 GaimWindow *win = (GaimWindow *)data; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
287 GaimConversation *conv; |
4387
a3fd5fe57a0b
[gaim-migrate @ 4653]
Christian Hammond <chipx86@chipx86.com>
parents:
4383
diff
changeset
|
288 |
a3fd5fe57a0b
[gaim-migrate @ 4653]
Christian Hammond <chipx86@chipx86.com>
parents:
4383
diff
changeset
|
289 conv = gaim_window_get_active_conversation(win); |
a3fd5fe57a0b
[gaim-migrate @ 4653]
Christian Hammond <chipx86@chipx86.com>
parents:
4383
diff
changeset
|
290 |
a3fd5fe57a0b
[gaim-migrate @ 4653]
Christian Hammond <chipx86@chipx86.com>
parents:
4383
diff
changeset
|
291 conv_show_log(NULL, (char *)gaim_conversation_get_name(conv)); |
4359 | 292 } |
293 static void | |
294 menu_insert_link_cb(gpointer data, guint action, GtkWidget *widget) | |
295 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
296 GaimWindow *win = (GaimWindow *)data; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
297 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
298 GaimGtkConversation *gtkconv; |
4359 | 299 |
300 conv = gaim_window_get_active_conversation(win); | |
301 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
302 | |
303 show_insert_link(gtkconv->toolbar.link, conv); | |
304 } | |
305 | |
306 static void | |
307 menu_insert_image_cb(gpointer data, guint action, GtkWidget *widget) | |
308 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
309 GaimWindow *win = (GaimWindow *)data; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
310 GaimGtkConversation *gtkconv; |
5106 | 311 |
312 gtkconv = GAIM_GTK_CONVERSATION(gaim_window_get_active_conversation(win)); | |
313 | |
314 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.image), | |
315 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.image))); | |
4359 | 316 } |
317 | |
318 static void | |
319 menu_close_conv_cb(gpointer data, guint action, GtkWidget *widget) | |
320 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
321 GaimWindow *win = (GaimWindow *)data; |
4359 | 322 |
323 close_conv_cb(NULL, gaim_window_get_active_conversation(win)); | |
324 } | |
325 | |
326 static void | |
327 menu_logging_cb(gpointer data, guint action, GtkWidget *widget) | |
328 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
329 GaimWindow *win = (GaimWindow *)data; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
330 GaimConversation *conv; |
4359 | 331 |
332 conv = gaim_window_get_active_conversation(win); | |
333 | |
5680
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
334 if (conv == NULL) |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
335 return; |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
336 |
5139
d0182ae31ab8
[gaim-migrate @ 5503]
Christian Hammond <chipx86@chipx86.com>
parents:
5133
diff
changeset
|
337 gaim_conversation_set_logging(conv, |
d0182ae31ab8
[gaim-migrate @ 5503]
Christian Hammond <chipx86@chipx86.com>
parents:
5133
diff
changeset
|
338 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))); |
4359 | 339 } |
340 | |
341 static void | |
342 menu_sounds_cb(gpointer data, guint action, GtkWidget *widget) | |
343 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
344 GaimWindow *win = (GaimWindow *)data; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
345 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
346 GaimGtkConversation *gtkconv; |
4359 | 347 |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
348 conv = gaim_window_get_active_conversation(win); |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
349 |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
350 if (!conv) |
4359 | 351 return; |
352 | |
353 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
354 | |
5139
d0182ae31ab8
[gaim-migrate @ 5503]
Christian Hammond <chipx86@chipx86.com>
parents:
5133
diff
changeset
|
355 gtkconv->make_sound = |
d0182ae31ab8
[gaim-migrate @ 5503]
Christian Hammond <chipx86@chipx86.com>
parents:
5133
diff
changeset
|
356 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); |
4359 | 357 } |
358 | |
359 static gboolean | |
360 entry_key_pressed_cb_1(GtkTextBuffer *buffer) | |
361 { | |
362 check_everything(buffer); | |
363 | |
364 return FALSE; | |
365 } | |
366 | |
367 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
368 send_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 369 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
370 GaimGtkConversation *gtkconv; |
4359 | 371 char *buf, *buf2; |
372 GtkTextIter start_iter, end_iter; | |
373 int limit; | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
374 GaimConnection *gc = gaim_conversation_get_gc(conv); |
4359 | 375 |
376 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
377 | |
378 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_iter); | |
379 gtk_text_buffer_get_end_iter(gtkconv->entry_buffer, &end_iter); | |
380 buf2 = gtk_text_buffer_get_text(gtkconv->entry_buffer, | |
381 &start_iter, &end_iter, FALSE); | |
382 | |
4685 | 383 set_toggle(gtkconv->toolbar.bold, FALSE); |
384 set_toggle(gtkconv->toolbar.italic, FALSE); | |
385 set_toggle(gtkconv->toolbar.underline, FALSE); | |
5049 | 386 set_toggle(gtkconv->toolbar.larger_size, FALSE); |
4685 | 387 set_toggle(gtkconv->toolbar.normal_size, FALSE); |
5049 | 388 set_toggle(gtkconv->toolbar.smaller_size,FALSE); |
4685 | 389 set_toggle(gtkconv->toolbar.font, FALSE); |
390 set_toggle(gtkconv->toolbar.fgcolor, FALSE); | |
391 set_toggle(gtkconv->toolbar.bgcolor, FALSE); | |
392 set_toggle(gtkconv->toolbar.link, FALSE); | |
4359 | 393 |
394 gtk_widget_grab_focus(gtkconv->entry); | |
395 | |
396 limit = 32 * 1024; /* This will be done again in gaim_im_send. *shrug* */ | |
397 | |
398 buf = g_malloc(limit); | |
399 strncpy(buf, buf2, limit); | |
400 | |
401 g_free(buf2); | |
402 | |
403 if (strlen(buf) == 0) { | |
404 g_free(buf); | |
405 | |
406 return; | |
407 } | |
408 | |
409 buf2 = g_malloc(limit); | |
410 | |
4505 | 411 if (gc && gc->flags & OPT_CONN_HTML) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
412 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold")) { |
4359 | 413 g_snprintf(buf2, limit, "<B>%s</B>", buf); |
414 strcpy(buf, buf2); | |
415 } | |
416 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
417 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic")) { |
4359 | 418 g_snprintf(buf2, limit, "<I>%s</I>", buf); |
419 strcpy(buf, buf2); | |
420 } | |
421 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
422 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline")) { |
4359 | 423 g_snprintf(buf2, limit, "<U>%s</U>", buf); |
424 strcpy(buf, buf2); | |
425 } | |
426 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
427 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_strikethrough")) { |
4359 | 428 g_snprintf(buf2, limit, "<STRIKE>%s</STRIKE>", buf); |
429 strcpy(buf, buf2); | |
430 } | |
431 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
432 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_font") || |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
433 gtkconv->has_font) { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
434 |
4359 | 435 g_snprintf(buf2, limit, |
436 "<FONT FACE=\"%s\">%s</FONT>", gtkconv->fontface, buf); | |
437 strcpy(buf, buf2); | |
438 } | |
439 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
440 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_size")) { |
4359 | 441 g_snprintf(buf2, limit, |
442 "<FONT SIZE=\"%d\">%s</FONT>", fontsize, buf); | |
443 strcpy(buf, buf2); | |
444 } | |
445 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
446 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_fgcolor")) { |
4359 | 447 g_snprintf(buf2, limit, |
448 "<FONT COLOR=\"#%02X%02X%02X\">%s</FONT>", | |
449 gtkconv->fg_color.red / 256, | |
450 gtkconv->fg_color.green / 256, | |
451 gtkconv->fg_color.blue / 256, buf); | |
452 strcpy(buf, buf2); | |
453 } | |
454 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
455 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_bgcolor")) { |
4359 | 456 g_snprintf(buf2, limit, |
457 "<BODY BGCOLOR=\"#%02X%02X%02X\">%s</BODY>", | |
4421 | 458 gtkconv->bg_color.red / 256, |
459 gtkconv->bg_color.green / 256, | |
460 gtkconv->bg_color.blue / 256, buf); | |
4359 | 461 strcpy(buf, buf2); |
462 } | |
463 } | |
464 | |
465 g_free(buf2); | |
466 | |
467 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) | |
468 gaim_im_send(GAIM_IM(conv), buf); | |
469 else | |
470 gaim_chat_send(GAIM_CHAT(conv), buf); | |
471 | |
5629 | 472 if (gaim_prefs_get_bool("/gaim/gtk/conversations/im/hide_on_send")) |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
473 gaim_window_hide(gaim_conversation_get_window(conv)); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
474 |
4359 | 475 g_free(buf); |
476 | |
477 gtk_text_buffer_set_text(gtkconv->entry_buffer, "", -1); | |
478 } | |
479 | |
480 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
481 add_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 482 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
483 GaimConnection *gc; |
4359 | 484 struct buddy *b; |
485 const char *name; | |
486 | |
487 gc = gaim_conversation_get_gc(conv); | |
488 name = gaim_conversation_get_name(conv); | |
4687 | 489 b = gaim_find_buddy(gc->account, name); |
4359 | 490 |
491 if (b != NULL) | |
492 show_confirm_del(gc, (char *)name); | |
493 else if (gc != NULL) | |
494 show_add_buddy(gc, (char *)name, NULL, NULL); | |
495 | |
496 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
497 } | |
498 | |
499 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
500 info_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 501 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
502 GaimGtkConversation *gtkconv; |
4359 | 503 |
504 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
505 | |
506 if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
507 GaimGtkChatPane *gtkchat; |
4359 | 508 GtkTreeIter iter; |
509 GtkTreeModel *model; | |
510 GtkTreeSelection *sel; | |
511 const char *name; | |
512 | |
513 gtkchat = gtkconv->u.chat; | |
514 | |
515 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | |
516 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); | |
517 | |
518 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) | |
519 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &name, -1); | |
520 else | |
521 return; | |
522 | |
523 serv_get_info(gaim_conversation_get_gc(conv), (char *)name); | |
524 } | |
525 else { | |
526 serv_get_info(gaim_conversation_get_gc(conv), | |
527 (char *)gaim_conversation_get_name(conv)); | |
528 | |
529 gtk_widget_grab_focus(gtkconv->entry); | |
530 } | |
531 } | |
532 | |
533 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
534 warn_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 535 { |
536 show_warn_dialog(gaim_conversation_get_gc(conv), | |
537 (char *)gaim_conversation_get_name(conv)); | |
538 | |
539 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
540 } | |
541 | |
542 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
543 block_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 544 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
545 GaimConnection *gc; |
4359 | 546 |
547 gc = gaim_conversation_get_gc(conv); | |
548 | |
549 if (gc != NULL) | |
550 show_add_perm(gc, (char *)gaim_conversation_get_name(conv), FALSE); | |
551 | |
552 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
553 } | |
554 | |
555 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
556 im_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 557 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
558 GaimConversation *conv2; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
559 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
560 GaimGtkChatPane *gtkchat; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
561 GaimAccount *account; |
4359 | 562 GtkTreeIter iter; |
563 GtkTreeModel *model; | |
564 GtkTreeSelection *sel; | |
565 const char *name; | |
566 | |
567 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
568 gtkchat = gtkconv->u.chat; | |
569 | |
570 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | |
571 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); | |
572 | |
573 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) | |
574 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &name, -1); | |
575 else | |
576 return; | |
577 | |
578 if (*name == '@') name++; | |
4621
69f028a6f357
[gaim-migrate @ 4912]
Christian Hammond <chipx86@chipx86.com>
parents:
4608
diff
changeset
|
579 if (*name == '%') name++; |
4359 | 580 if (*name == '+') name++; |
581 | |
4491 | 582 account = gaim_conversation_get_account(conv); |
4476
62c1e5e656d0
[gaim-migrate @ 4751]
Christian Hammond <chipx86@chipx86.com>
parents:
4466
diff
changeset
|
583 |
4359 | 584 conv2 = gaim_find_conversation(name); |
585 | |
4476
62c1e5e656d0
[gaim-migrate @ 4751]
Christian Hammond <chipx86@chipx86.com>
parents:
4466
diff
changeset
|
586 if (conv2 != NULL) { |
4359 | 587 gaim_window_raise(gaim_conversation_get_window(conv2)); |
4491 | 588 gaim_conversation_set_account(conv2, account); |
4476
62c1e5e656d0
[gaim-migrate @ 4751]
Christian Hammond <chipx86@chipx86.com>
parents:
4466
diff
changeset
|
589 } |
4359 | 590 else |
4491 | 591 conv2 = gaim_conversation_new(GAIM_CONV_IM, account, name); |
4359 | 592 } |
593 | |
594 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
595 ignore_cb(GtkWidget *w, GaimConversation *conv) |
4359 | 596 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
597 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
598 GaimGtkChatPane *gtkchat; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
599 GaimChat *chat; |
4359 | 600 GtkTreeIter iter; |
601 GtkTreeModel *model; | |
602 GtkTreeSelection *sel; | |
603 const char *name; | |
604 int pos; | |
605 | |
606 chat = GAIM_CHAT(conv); | |
607 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
608 gtkchat = gtkconv->u.chat; | |
609 | |
610 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | |
611 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); | |
612 | |
613 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) { | |
614 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &name, -1); | |
615 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); | |
616 } | |
617 else | |
618 return; | |
619 | |
620 pos = g_list_index(gaim_chat_get_users(chat), name); | |
621 | |
622 if (gaim_chat_is_user_ignored(chat, name)) | |
623 gaim_chat_unignore(chat, name); | |
624 else | |
625 gaim_chat_ignore(chat, name); | |
626 | |
627 add_chat_buddy_common(conv, name, pos); | |
628 } | |
629 | |
630 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
631 menu_im_cb(GtkWidget *w, GaimConversation *conv) |
4359 | 632 { |
633 const char *who; | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
634 GaimConversation *conv2; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
635 GaimAccount *account; |
4359 | 636 |
637 who = g_object_get_data(G_OBJECT(w), "user_data"); | |
638 | |
4491 | 639 account = gaim_conversation_get_account(conv); |
4476
62c1e5e656d0
[gaim-migrate @ 4751]
Christian Hammond <chipx86@chipx86.com>
parents:
4466
diff
changeset
|
640 |
4359 | 641 conv2 = gaim_find_conversation(who); |
642 | |
643 if (conv2 != NULL) | |
644 gaim_window_show(gaim_conversation_get_window(conv2)); | |
4476
62c1e5e656d0
[gaim-migrate @ 4751]
Christian Hammond <chipx86@chipx86.com>
parents:
4466
diff
changeset
|
645 else |
4491 | 646 conv2 = gaim_conversation_new(GAIM_CONV_IM, account, who); |
4359 | 647 } |
648 | |
649 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
650 menu_info_cb(GtkWidget *w, GaimConversation *conv) |
4359 | 651 { |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
652 GaimPluginProtocolInfo *prpl_info = NULL; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
653 GaimConnection *gc; |
4359 | 654 char *who; |
655 | |
656 gc = gaim_conversation_get_gc(conv); | |
657 who = g_object_get_data(G_OBJECT(w), "user_data"); | |
658 | |
659 if (gc != NULL) { | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
660 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
661 |
4359 | 662 /* |
663 * If there are special needs for getting info on users in | |
664 * buddy chat "rooms"... | |
665 */ | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
666 if (prpl_info->get_cb_info != NULL) |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
667 prpl_info->get_cb_info(gc, gaim_chat_get_id(GAIM_CHAT(conv)), who); |
4359 | 668 else |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
669 prpl_info->get_info(gc, who); |
4359 | 670 } |
671 } | |
672 | |
673 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
674 menu_away_cb(GtkWidget *w, GaimConversation *conv) |
4359 | 675 { |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
676 GaimPluginProtocolInfo *prpl_info = NULL; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
677 GaimConnection *gc; |
4359 | 678 char *who; |
679 | |
680 gc = gaim_conversation_get_gc(conv); | |
681 who = g_object_get_data(G_OBJECT(w), "user_data"); | |
682 | |
683 if (gc != NULL) { | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
684 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
685 |
4359 | 686 /* |
687 * May want to expand this to work similarly to menu_info_cb? | |
688 */ | |
689 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
690 if (prpl_info->get_cb_away != NULL) |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
691 prpl_info->get_cb_away(gc, gaim_chat_get_id(GAIM_CHAT(conv)), who); |
4359 | 692 } |
693 } | |
694 | |
695 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
696 menu_add_cb(GtkWidget *w, GaimConversation *conv) |
4359 | 697 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
698 GaimConnection *gc; |
4359 | 699 struct buddy *b; |
700 char *name; | |
701 | |
702 gc = gaim_conversation_get_gc(conv); | |
703 name = g_object_get_data(G_OBJECT(w), "user_data"); | |
4687 | 704 b = gaim_find_buddy(gc->account, name); |
4359 | 705 |
706 if (b != NULL) | |
707 show_confirm_del(gc, name); | |
708 else if (gc != NULL) | |
709 show_add_buddy(gc, name, NULL, NULL); | |
710 | |
711 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
712 } | |
713 | |
714 static gint | |
715 right_click_chat_cb(GtkWidget *widget, GdkEventButton *event, | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
716 GaimConversation *conv) |
4359 | 717 { |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
718 GaimPluginProtocolInfo *prpl_info = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
719 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
720 GaimGtkChatPane *gtkchat; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
721 GaimConnection *gc; |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
722 GaimAccount *account; |
4359 | 723 GtkTreePath *path; |
724 GtkTreeIter iter; | |
725 GtkTreeModel *model; | |
726 GtkTreeViewColumn *column; | |
727 gchar *who; | |
728 int x, y; | |
729 | |
730 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
731 gtkchat = gtkconv->u.chat; | |
4491 | 732 account = gaim_conversation_get_account(conv); |
733 gc = account->gc; | |
4359 | 734 |
735 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | |
4685 | 736 |
4359 | 737 gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(gtkchat->list), |
738 event->x, event->y, &path, &column, &x, &y); | |
739 | |
740 if (path == NULL) | |
741 return FALSE; | |
742 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
743 if (gc != NULL) |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
744 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
745 |
4359 | 746 gtk_tree_selection_select_path(GTK_TREE_SELECTION( |
747 gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list))), path); | |
748 | |
749 gtk_tree_model_get_iter(GTK_TREE_MODEL(model), &iter, path); | |
750 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &who, -1); | |
751 | |
4621
69f028a6f357
[gaim-migrate @ 4912]
Christian Hammond <chipx86@chipx86.com>
parents:
4608
diff
changeset
|
752 if (*who == '@') who++; |
69f028a6f357
[gaim-migrate @ 4912]
Christian Hammond <chipx86@chipx86.com>
parents:
4608
diff
changeset
|
753 if (*who == '%') who++; |
69f028a6f357
[gaim-migrate @ 4912]
Christian Hammond <chipx86@chipx86.com>
parents:
4608
diff
changeset
|
754 if (*who == '+') who++; |
69f028a6f357
[gaim-migrate @ 4912]
Christian Hammond <chipx86@chipx86.com>
parents:
4608
diff
changeset
|
755 |
4359 | 756 if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
757 GaimConversation *c; |
4359 | 758 |
759 if ((c = gaim_find_conversation(who)) == NULL) | |
4491 | 760 c = gaim_conversation_new(GAIM_CONV_IM, account, who); |
4476
62c1e5e656d0
[gaim-migrate @ 4751]
Christian Hammond <chipx86@chipx86.com>
parents:
4466
diff
changeset
|
761 else |
4491 | 762 gaim_conversation_set_account(c, account); |
4359 | 763 } |
764 else if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { | |
765 static GtkWidget *menu = NULL; | |
766 GtkWidget *button; | |
767 | |
768 /* | |
769 * If a menu already exists, destroy it before creating a new one, | |
770 * thus freeing-up the memory it occupied. | |
771 */ | |
772 | |
773 if (menu) | |
774 gtk_widget_destroy(menu); | |
775 | |
776 menu = gtk_menu_new(); | |
777 | |
778 button = gtk_menu_item_new_with_label(_("IM")); | |
779 g_signal_connect(G_OBJECT(button), "activate", | |
780 G_CALLBACK(menu_im_cb), conv); | |
781 g_object_set_data(G_OBJECT(button), "user_data", who); | |
4635 | 782 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); |
4359 | 783 gtk_widget_show(button); |
784 | |
785 if (gaim_chat_is_user_ignored(GAIM_CHAT(conv), who)) | |
786 button = gtk_menu_item_new_with_label(_("Un-Ignore")); | |
787 else | |
788 button = gtk_menu_item_new_with_label(_("Ignore")); | |
789 | |
790 g_signal_connect(G_OBJECT(button), "activate", | |
791 G_CALLBACK(ignore_cb), conv); | |
792 g_object_set_data(G_OBJECT(button), "user_data", who); | |
4635 | 793 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); |
4359 | 794 gtk_widget_show(button); |
795 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
796 if (gc && prpl_info->get_info) { |
4359 | 797 button = gtk_menu_item_new_with_label(_("Info")); |
798 g_signal_connect(G_OBJECT(button), "activate", | |
799 G_CALLBACK(menu_info_cb), conv); | |
800 g_object_set_data(G_OBJECT(button), "user_data", who); | |
4635 | 801 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); |
4359 | 802 gtk_widget_show(button); |
803 } | |
804 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
805 if (gc && prpl_info->get_cb_away) { |
4359 | 806 button = gtk_menu_item_new_with_label(_("Get Away Msg")); |
807 g_signal_connect(G_OBJECT(button), "activate", | |
808 G_CALLBACK(menu_away_cb), conv); | |
809 g_object_set_data(G_OBJECT(button), "user_data", who); | |
4635 | 810 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); |
4359 | 811 gtk_widget_show(button); |
812 } | |
813 | |
814 /* Added by Jonas <jonas@birme.se> */ | |
815 if (gc) { | |
4687 | 816 if (gaim_find_buddy(gc->account, who)) |
4359 | 817 button = gtk_menu_item_new_with_label(_("Remove")); |
818 else | |
819 button = gtk_menu_item_new_with_label(_("Add")); | |
820 | |
821 g_signal_connect(G_OBJECT(button), "activate", | |
822 G_CALLBACK(menu_add_cb), conv); | |
823 | |
824 g_object_set_data(G_OBJECT(button), "user_data", who); | |
4635 | 825 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); |
4359 | 826 gtk_widget_show(button); |
827 } | |
828 /* End Jonas */ | |
4635 | 829 |
4359 | 830 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, |
831 event->button, event->time); | |
832 } | |
833 | |
834 return TRUE; | |
835 } | |
836 | |
837 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
838 do_invite(GtkWidget *w, int resp, InviteBuddyInfo *info) |
4359 | 839 { |
840 const char *buddy, *message; | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
841 GaimGtkConversation *gtkconv; |
4359 | 842 |
843 gtkconv = GAIM_GTK_CONVERSATION(info->conv); | |
844 | |
845 if (resp == GTK_RESPONSE_OK) { | |
846 buddy = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(info->entry)->entry)); | |
847 message = gtk_entry_get_text(GTK_ENTRY(info->message)); | |
848 | |
4793 | 849 if (!g_ascii_strcasecmp(buddy, "")) { |
4359 | 850 g_free(info); |
851 | |
852 return; | |
853 } | |
854 | |
855 serv_chat_invite(gaim_conversation_get_gc(info->conv), | |
856 gaim_chat_get_id(GAIM_CHAT(info->conv)), | |
857 message, buddy); | |
858 } | |
859 | |
860 gtk_widget_destroy(invite_dialog); | |
861 invite_dialog = NULL; | |
862 | |
863 g_free(info); | |
864 } | |
865 | |
866 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
867 invite_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 868 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
869 InviteBuddyInfo *info = NULL; |
4359 | 870 |
871 if (invite_dialog == NULL) { | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
872 GaimConnection *gc; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
873 GaimWindow *win; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
874 GaimGtkWindow *gtkwin; |
4359 | 875 GtkWidget *label; |
876 GtkWidget *vbox, *hbox; | |
877 GtkWidget *table; | |
878 GtkWidget *img; | |
879 | |
5024 | 880 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG); |
4359 | 881 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
882 info = g_new0(InviteBuddyInfo, 1); |
4359 | 883 info->conv = conv; |
884 | |
885 gc = gaim_conversation_get_gc(conv); | |
886 win = gaim_conversation_get_window(conv); | |
887 gtkwin = GAIM_GTK_WINDOW(win); | |
888 | |
889 /* Create the new dialog. */ | |
890 invite_dialog = gtk_dialog_new_with_buttons( | |
891 _("Gaim - Invite Buddy Into Chat Room"), | |
892 GTK_WINDOW(gtkwin->window), | |
893 GTK_DIALOG_MODAL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, | |
894 GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); | |
895 | |
896 gtk_dialog_set_default_response(GTK_DIALOG(invite_dialog), | |
897 GTK_RESPONSE_OK); | |
898 gtk_container_set_border_width(GTK_CONTAINER(invite_dialog), 6); | |
899 gtk_window_set_resizable(GTK_WINDOW(invite_dialog), FALSE); | |
900 gtk_dialog_set_has_separator(GTK_DIALOG(invite_dialog), FALSE); | |
901 | |
902 /* Setup the outside spacing. */ | |
903 vbox = GTK_DIALOG(invite_dialog)->vbox; | |
904 | |
905 gtk_box_set_spacing(GTK_BOX(vbox), 12); | |
906 gtk_container_set_border_width(GTK_CONTAINER(vbox), 6); | |
907 | |
908 /* Setup the inner hbox and put the dialog's icon in it. */ | |
909 hbox = gtk_hbox_new(FALSE, 12); | |
910 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
911 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
912 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
913 | |
914 /* Setup the right vbox. */ | |
915 vbox = gtk_vbox_new(FALSE, 0); | |
916 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
917 | |
918 /* Put our happy label in it. */ | |
919 label = gtk_label_new(_("Please enter the name of the user you wish " | |
920 "to invite, along with an optional invite " | |
921 "message.")); | |
922 gtk_widget_set_size_request(label, 350, -1); | |
923 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
924 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
925 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
926 | |
927 /* hbox for the table, and to give it some spacing on the left. */ | |
928 hbox = gtk_hbox_new(FALSE, 6); | |
929 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
930 | |
931 /* Setup the table we're going to use to lay stuff out. */ | |
932 table = gtk_table_new(2, 2, FALSE); | |
933 gtk_table_set_row_spacings(GTK_TABLE(table), 6); | |
934 gtk_table_set_col_spacings(GTK_TABLE(table), 6); | |
935 gtk_container_set_border_width(GTK_CONTAINER(table), 12); | |
936 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); | |
937 | |
938 /* Now the Buddy label */ | |
939 label = gtk_label_new(NULL); | |
940 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Buddy:")); | |
941 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
942 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); | |
943 | |
944 /* Now the Buddy drop-down entry field. */ | |
945 info->entry = gtk_combo_new(); | |
946 gtk_combo_set_case_sensitive(GTK_COMBO(info->entry), FALSE); | |
947 gtk_entry_set_activates_default( | |
948 GTK_ENTRY(GTK_COMBO(info->entry)->entry), TRUE); | |
949 | |
950 gtk_table_attach_defaults(GTK_TABLE(table), info->entry, 1, 2, 0, 1); | |
951 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->entry); | |
952 | |
953 /* Fill in the names. */ | |
954 gtk_combo_set_popdown_strings(GTK_COMBO(info->entry), | |
955 generate_invite_user_names(gc)); | |
956 | |
957 | |
958 /* Now the label for "Message" */ | |
959 label = gtk_label_new(NULL); | |
960 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Message:")); | |
961 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
962 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); | |
963 | |
964 | |
965 /* And finally, the Message entry field. */ | |
966 info->message = gtk_entry_new(); | |
967 gtk_entry_set_activates_default(GTK_ENTRY(info->message), TRUE); | |
968 | |
969 gtk_table_attach_defaults(GTK_TABLE(table), info->message, 1, 2, 1, 2); | |
970 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->message); | |
971 | |
972 /* Connect the signals. */ | |
973 g_signal_connect(G_OBJECT(invite_dialog), "response", | |
974 G_CALLBACK(do_invite), info); | |
975 } | |
976 | |
977 gtk_widget_show_all(invite_dialog); | |
978 | |
979 if (info != NULL) | |
980 gtk_widget_grab_focus(GTK_COMBO(info->entry)->entry); | |
981 } | |
982 | |
983 static gboolean | |
984 entry_key_pressed_cb_2(GtkWidget *entry, GdkEventKey *event, gpointer data) | |
985 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
986 GaimWindow *win; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
987 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
988 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
989 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
990 |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
991 conv = (GaimConversation *)data; |
4359 | 992 gtkconv = GAIM_GTK_CONVERSATION(conv); |
993 win = gaim_conversation_get_window(conv); | |
4362 | 994 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 995 |
996 if (event->keyval == GDK_Escape) { | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
997 if (gaim_prefs_get_bool("/gaim/gtk/conversations/escape_closes")) { |
4359 | 998 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); |
999 gaim_conversation_destroy(conv); | |
1000 } | |
1001 } | |
1002 else if (event->keyval == GDK_Page_Up) { | |
1003 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1004 | |
1005 if (!(event->state & GDK_CONTROL_MASK)) | |
1006 gtk_imhtml_page_up(GTK_IMHTML(gtkconv->imhtml)); | |
1007 } | |
1008 else if (event->keyval == GDK_Page_Down) { | |
1009 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1010 | |
1011 if (!(event->state & GDK_CONTROL_MASK)) | |
1012 gtk_imhtml_page_down(GTK_IMHTML(gtkconv->imhtml)); | |
1013 } | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1014 else if (event->keyval == GDK_F2 && |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1015 gaim_prefs_get_bool("/gaim/gtk/conversations/f2_toggles_timestamps")) { |
4359 | 1016 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), |
1017 !GTK_IMHTML(gtkconv->imhtml)->comments); | |
1018 } | |
1019 else if (event->keyval == GDK_Return || event->keyval == GDK_KP_Enter) { | |
1020 if ((event->state & GDK_CONTROL_MASK) && | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1021 gaim_prefs_get_bool("/gaim/gtk/conversations/ctrl_enter_sends")) { |
4359 | 1022 |
1023 send_cb(NULL, conv); | |
1024 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1025 | |
1026 return TRUE; | |
1027 } | |
1028 else if (!(event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK)) && | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1029 gaim_prefs_get_bool("/gaim/gtk/conversations/enter_sends")) { |
4359 | 1030 |
1031 send_cb(NULL, conv); | |
1032 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1033 | |
1034 return TRUE; | |
1035 } | |
1036 | |
1037 return FALSE; | |
1038 } | |
1039 else if ((event->state & GDK_CONTROL_MASK) && (event->keyval == 'm')) { | |
1040 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1041 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, "\n", 1); | |
1042 } | |
1043 else if (event->state & GDK_CONTROL_MASK) { | |
1044 switch (event->keyval) { | |
1045 case GDK_Up: | |
1046 if (!conv->send_history) | |
1047 break; | |
1048 | |
1049 if (!conv->send_history->prev) { | |
1050 GtkTextIter start, end; | |
1051 | |
1052 if (conv->send_history->data) | |
1053 g_free(conv->send_history->data); | |
1054 | |
1055 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, | |
1056 &start); | |
1057 gtk_text_buffer_get_end_iter(gtkconv->entry_buffer, &end); | |
1058 | |
1059 conv->send_history->data = | |
1060 gtk_text_buffer_get_text(gtkconv->entry_buffer, | |
1061 &start, &end, FALSE); | |
1062 } | |
1063 | |
1064 if (conv->send_history->next && | |
1065 conv->send_history->next->data) { | |
1066 | |
1067 conv->send_history = conv->send_history->next; | |
1068 gtk_text_buffer_set_text(gtkconv->entry_buffer, | |
1069 conv->send_history->data, -1); | |
1070 } | |
1071 | |
1072 break; | |
1073 | |
1074 case GDK_Down: | |
1075 if (!conv->send_history) | |
1076 break; | |
1077 | |
1078 if (conv->send_history->prev) { | |
1079 conv->send_history = conv->send_history->prev; | |
1080 | |
1081 if (conv->send_history->data) | |
1082 gtk_text_buffer_set_text(gtkconv->entry_buffer, | |
1083 conv->send_history->data, -1); | |
1084 } | |
1085 | |
1086 break; | |
1087 } | |
1088 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1089 if (gaim_prefs_get_bool("/gaim/gtk/conversations/html_shortcuts")) { |
4359 | 1090 switch (event->keyval) { |
1091 case 'i': | |
1092 case 'I': | |
4685 | 1093 set_toggle(gtkconv->toolbar.italic, |
4359 | 1094 !gtk_toggle_button_get_active( |
1095 GTK_TOGGLE_BUTTON(gtkconv->toolbar.italic))); | |
1096 | |
1097 g_signal_stop_emission_by_name(G_OBJECT(entry), | |
1098 "key_press_event"); | |
1099 break; | |
1100 | |
1101 case 'u': /* ctrl-u is GDK_Clear, which clears the line. */ | |
1102 case 'U': | |
4685 | 1103 set_toggle(gtkconv->toolbar.underline, |
4359 | 1104 !gtk_toggle_button_get_active( |
1105 GTK_TOGGLE_BUTTON(gtkconv->toolbar.underline))); | |
1106 | |
1107 g_signal_stop_emission_by_name(G_OBJECT(entry), | |
1108 "key_press_event"); | |
1109 break; | |
1110 | |
1111 case 'b': /* ctrl-b is GDK_Left, which moves backwards. */ | |
1112 case 'B': | |
4685 | 1113 set_toggle(gtkconv->toolbar.bold, |
4359 | 1114 !gtk_toggle_button_get_active( |
1115 GTK_TOGGLE_BUTTON(gtkconv->toolbar.bold))); | |
1116 | |
1117 g_signal_stop_emission_by_name(G_OBJECT(entry), | |
1118 "key_press_event"); | |
1119 break; | |
1120 | |
1121 case '-': | |
1122 do_small(NULL, gtkconv); | |
1123 | |
1124 g_signal_stop_emission_by_name(G_OBJECT(entry), | |
1125 "key_press_event"); | |
1126 break; | |
1127 | |
1128 case '=': | |
1129 case '+': | |
1130 do_big(NULL, gtkconv); | |
1131 | |
1132 g_signal_stop_emission_by_name(G_OBJECT(entry), | |
1133 "key_press_event"); | |
1134 break; | |
1135 | |
1136 case '0': | |
4685 | 1137 set_toggle(gtkconv->toolbar.normal_size, |
1138 !gtk_toggle_button_get_active( | |
1139 GTK_TOGGLE_BUTTON(gtkconv->toolbar.normal_size))); | |
4359 | 1140 |
1141 g_signal_stop_emission_by_name(G_OBJECT(entry), | |
1142 "key_press_event"); | |
1143 break; | |
1144 | |
1145 case 'f': | |
1146 case 'F': | |
4685 | 1147 set_toggle(gtkconv->toolbar.font, |
4359 | 1148 !gtk_toggle_button_get_active( |
4685 | 1149 GTK_TOGGLE_BUTTON(gtkconv->toolbar.font))); |
4359 | 1150 |
1151 g_signal_stop_emission_by_name(G_OBJECT(entry), | |
1152 "key_press_event"); | |
1153 break; | |
1154 } | |
1155 } | |
1156 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1157 if (gaim_prefs_get_bool("/gaim/gtk/conversations/smiley_shortcuts")) { |
4359 | 1158 char buf[7]; |
1159 | |
1160 *buf = '\0'; | |
1161 | |
1162 switch (event->keyval) { | |
1163 case '1': strcpy(buf, ":-)"); break; | |
1164 case '2': strcpy(buf, ":-("); break; | |
1165 case '3': strcpy(buf, ";-)"); break; | |
1166 case '4': strcpy(buf, ":-P"); break; | |
1167 case '5': strcpy(buf, "=-O"); break; | |
1168 case '6': strcpy(buf, ":-*"); break; | |
1169 case '7': strcpy(buf, ">:o"); break; | |
1170 case '8': strcpy(buf, "8-)"); break; | |
1171 case '!': strcpy(buf, ":-$"); break; | |
1172 case '@': strcpy(buf, ":-!"); break; | |
1173 case '#': strcpy(buf, ":-["); break; | |
1174 case '$': strcpy(buf, "O:-)"); break; | |
1175 case '%': strcpy(buf, ":-/"); break; | |
1176 case '^': strcpy(buf, ":'("); break; | |
1177 case '&': strcpy(buf, ":-X"); break; | |
1178 case '*': strcpy(buf, ":-D"); break; | |
1179 default: break; | |
1180 } | |
1181 | |
1182 if (*buf) { | |
1183 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, | |
1184 buf, -1); | |
1185 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1186 } | |
1187 } | |
1188 | |
1189 if (event->keyval == 'l') { | |
1190 gtk_imhtml_clear(GTK_IMHTML(gtkconv->imhtml)); | |
1191 g_string_free(conv->history, TRUE); | |
1192 conv->history = g_string_new(""); | |
1193 } | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1194 else if (event->keyval == 'w' && |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1195 gaim_prefs_get_bool("/gaim/gtk/conversations/ctrl_w_closes")) { |
4359 | 1196 |
1197 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1198 gaim_conversation_destroy(conv); | |
1199 return TRUE; | |
1200 } | |
1201 else if (event->keyval == 'n') { | |
1202 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1203 | |
1204 show_im_dialog(); | |
1205 } | |
1206 else if (event->keyval == 'z') { | |
1207 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
5133 | 1208 |
1209 gtk_window_iconify(GTK_WINDOW(gtkwin->window)); | |
4359 | 1210 } |
1211 else if (event->keyval == '[') { | |
1212 gaim_window_switch_conversation(win, | |
1213 gaim_conversation_get_index(conv) - 1); | |
1214 | |
1215 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1216 } | |
1217 else if (event->keyval == ']') { | |
1218 gaim_window_switch_conversation(win, | |
1219 gaim_conversation_get_index(conv) + 1); | |
1220 | |
1221 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1222 } | |
1223 else if (event->keyval == GDK_Tab) { | |
1224 move_next_tab(conv); | |
1225 | |
1226 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1227 | |
1228 return TRUE; | |
1229 } | |
1230 } | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1231 else if (event->keyval == GDK_Tab && |
4359 | 1232 gaim_conversation_get_type(conv) == GAIM_CONV_CHAT && |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1233 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/tab_completion")) { |
4359 | 1234 |
1235 tab_complete(conv); | |
1236 | |
1237 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1238 | |
1239 return TRUE; | |
1240 } | |
1241 else if ((event->state & GDK_MOD1_MASK) && | |
1242 event->keyval > '0' && event->keyval <= '9') { | |
1243 | |
1244 gaim_window_switch_conversation(win, event->keyval - '1'); | |
1245 | |
1246 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1247 } | |
1248 | |
1249 return FALSE; | |
1250 } | |
1251 | |
1252 /* | |
1253 * NOTE: | |
1254 * This guy just kills a single right click from being propagated any | |
1255 * further. I have no idea *why* we need this, but we do ... It | |
1256 * prevents right clicks on the GtkTextView in a convo dialog from | |
1257 * going all the way down to the notebook. I suspect a bug in | |
1258 * GtkTextView, but I'm not ready to point any fingers yet. | |
1259 */ | |
1260 static gboolean | |
1261 entry_stop_rclick_cb(GtkWidget *widget, GdkEventButton *event, gpointer data) | |
1262 { | |
1263 if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { | |
1264 /* Right single click */ | |
1265 g_signal_stop_emission_by_name(G_OBJECT(widget), "button_press_event"); | |
1266 | |
1267 return TRUE; | |
1268 } | |
1269 | |
1270 return FALSE; | |
1271 } | |
1272 | |
1273 static void | |
4673 | 1274 menu_conv_sel_send_cb(GObject *m, gpointer data) |
4359 | 1275 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1276 GaimWindow *win = g_object_get_data(m, "user_data"); |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
1277 GaimAccount *account = g_object_get_data(m, "gaim_account"); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1278 GaimConversation *conv; |
4359 | 1279 |
1280 conv = gaim_window_get_active_conversation(win); | |
1281 | |
4491 | 1282 gaim_conversation_set_account(conv, account); |
4359 | 1283 } |
1284 | |
1285 static void | |
1286 insert_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *position, | |
1287 gchar *new_text, gint new_text_length, gpointer user_data) | |
1288 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1289 GaimConversation *conv = (GaimConversation *)user_data; |
4359 | 1290 |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1291 g_return_if_fail(conv != NULL); |
4359 | 1292 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1293 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) |
4359 | 1294 return; |
1295 | |
1296 got_typing_keypress(conv, (gtk_text_iter_is_start(position) && | |
1297 gtk_text_iter_is_end(position))); | |
1298 } | |
1299 | |
1300 static void | |
1301 delete_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *start_pos, | |
1302 GtkTextIter *end_pos, gpointer user_data) | |
1303 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1304 GaimConversation *conv = (GaimConversation *)user_data; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1305 GaimIm *im; |
4359 | 1306 |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1307 g_return_if_fail(conv != NULL); |
4359 | 1308 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1309 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) |
4359 | 1310 return; |
1311 | |
1312 im = GAIM_IM(conv); | |
1313 | |
1314 if (gtk_text_iter_is_start(start_pos) && gtk_text_iter_is_end(end_pos)) { | |
1315 | |
1316 /* We deleted all the text, so turn off typing. */ | |
1317 if (gaim_im_get_type_again_timeout(im)) | |
1318 gaim_im_stop_type_again_timeout(im); | |
1319 | |
1320 /* XXX The (char *) should go away! Somebody add consts to stuff! */ | |
1321 serv_send_typing(gaim_conversation_get_gc(conv), | |
1322 (char *)gaim_conversation_get_name(conv), | |
1323 NOT_TYPING); | |
1324 } | |
1325 else { | |
1326 /* We're deleting, but not all of it, so it counts as typing. */ | |
1327 got_typing_keypress(conv, FALSE); | |
1328 } | |
1329 } | |
1330 | |
1331 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1332 notebook_init_grab(GaimGtkWindow *gtkwin, GtkWidget *widget) |
4359 | 1333 { |
1334 static GdkCursor *cursor = NULL; | |
1335 | |
1336 gtkwin->in_drag = TRUE; | |
1337 | |
1338 if (gtkwin->drag_leave_signal) { | |
1339 g_signal_handler_disconnect(G_OBJECT(widget), | |
1340 gtkwin->drag_leave_signal); | |
1341 | |
1342 gtkwin->drag_leave_signal = 0; | |
1343 } | |
1344 | |
1345 if (cursor == NULL) | |
1346 cursor = gdk_cursor_new(GDK_FLEUR); | |
1347 | |
1348 /* Grab the pointer */ | |
1349 gtk_grab_add(gtkwin->notebook); | |
5114
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1350 #ifndef _WIN32 |
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1351 /* 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
|
1352 always be true after a button press. */ |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1353 if (!gdk_pointer_is_grabbed()) |
5114
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1354 #endif |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1355 gdk_pointer_grab(gtkwin->notebook->window, FALSE, |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1356 GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1357 NULL, cursor, GDK_CURRENT_TIME); |
4359 | 1358 } |
1359 | |
1360 static gboolean | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1361 notebook_motion_cb(GtkWidget *widget, GdkEventButton *e, GaimWindow *win) |
4359 | 1362 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1363 GaimGtkWindow *gtkwin; |
4359 | 1364 |
1365 gtkwin = GAIM_GTK_WINDOW(win); | |
1366 | |
1367 /* | |
1368 * Make sure the user moved the mouse far enough for the | |
1369 * drag to be initiated. | |
1370 */ | |
1371 if (gtkwin->in_predrag) { | |
1372 if (e->x_root < gtkwin->drag_min_x || | |
1373 e->x_root >= gtkwin->drag_max_x || | |
1374 e->y_root < gtkwin->drag_min_y || | |
1375 e->y_root >= gtkwin->drag_max_y) { | |
1376 | |
1377 gtkwin->in_predrag = FALSE; | |
1378 notebook_init_grab(gtkwin, widget); | |
1379 } | |
1380 } | |
1381 else { /* Otherwise, draw the arrows. */ | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1382 GaimWindow *dest_win; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1383 GaimGtkWindow *dest_gtkwin; |
4359 | 1384 GtkNotebook *dest_notebook; |
1385 GtkWidget *tab, *last_vis_tab = NULL; | |
1386 gint nb_x, nb_y, page_num, i, last_vis_tab_loc = -1; | |
1387 gint arrow1_x, arrow1_y, arrow2_x, arrow2_y; | |
1388 gboolean horiz_tabs = FALSE, tab_found = FALSE; | |
1389 GList *l; | |
1390 | |
1391 /* Get the window that the cursor is over. */ | |
1392 dest_win = gaim_gtkwin_get_at_xy(e->x_root, e->y_root); | |
1393 | |
1394 if (dest_win == NULL) { | |
1395 dnd_hints_hide_all(); | |
1396 | |
1397 return TRUE; | |
1398 } | |
1399 | |
1400 dest_gtkwin = GAIM_GTK_WINDOW(dest_win); | |
1401 | |
1402 dest_notebook = GTK_NOTEBOOK(dest_gtkwin->notebook); | |
1403 | |
1404 gdk_window_get_origin(GTK_WIDGET(dest_notebook)->window, &nb_x, &nb_y); | |
1405 | |
1406 arrow1_x = arrow2_x = nb_x; | |
1407 arrow1_y = arrow2_y = nb_y; | |
1408 | |
1409 page_num = gaim_gtkconv_get_dest_tab_at_xy(dest_win, | |
1410 e->x_root, e->y_root); | |
1411 | |
1412 if (gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_TOP || | |
1413 gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_BOTTOM) { | |
1414 | |
1415 horiz_tabs = TRUE; | |
1416 } | |
1417 | |
1418 /* Find out where to put the arrows. */ | |
1419 for (l = gaim_window_get_conversations(dest_win), i = 0; | |
1420 l != NULL; | |
1421 l = l->next, i++) { | |
1422 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1423 GaimConversation *conv = l->data; |
4359 | 1424 |
1425 tab = GAIM_GTK_CONVERSATION(conv)->tabby; | |
1426 | |
1427 /* | |
1428 * If this is the correct tab, record the positions | |
1429 * for the arrows. | |
1430 */ | |
1431 if (i == page_num) { | |
1432 if (horiz_tabs) { | |
1433 arrow1_x = arrow2_x = nb_x + tab->allocation.x; | |
1434 arrow1_y = nb_y + tab->allocation.y; | |
1435 arrow2_y = nb_y + tab->allocation.y + | |
1436 tab->allocation.height; | |
1437 } | |
1438 else { | |
1439 arrow1_x = nb_x + tab->allocation.x; | |
1440 arrow2_x = nb_x + tab->allocation.x + | |
1441 tab->allocation.width; | |
1442 arrow1_y = arrow2_y = nb_y + tab->allocation.y; | |
1443 } | |
1444 | |
1445 tab_found = TRUE; | |
1446 break; | |
1447 } | |
1448 else { /* Keep track of the right-most tab that we see. */ | |
1449 if (horiz_tabs && tab->allocation.x > last_vis_tab_loc) { | |
1450 last_vis_tab = tab; | |
1451 last_vis_tab_loc = tab->allocation.x; | |
1452 } | |
1453 else if (!horiz_tabs && tab->allocation.y > last_vis_tab_loc) { | |
1454 last_vis_tab = tab; | |
1455 last_vis_tab_loc = tab->allocation.y; | |
1456 } | |
1457 } | |
1458 } | |
1459 | |
1460 /* | |
1461 * If we didn't find the tab, then we'll just place the | |
1462 * arrows to the right/bottom of the last visible tab. | |
1463 */ | |
1464 if (!tab_found && last_vis_tab) { | |
1465 if (horiz_tabs) { | |
1466 arrow1_x = arrow2_x = nb_x + last_vis_tab->allocation.x + | |
1467 last_vis_tab->allocation.width; | |
1468 arrow1_y = nb_y + last_vis_tab->allocation.y; | |
1469 arrow2_y = nb_y + last_vis_tab->allocation.y + | |
1470 last_vis_tab->allocation.height; | |
1471 } | |
1472 else { | |
1473 arrow1_x = nb_x + last_vis_tab->allocation.x; | |
1474 arrow2_x = nb_x + last_vis_tab->allocation.x + | |
1475 last_vis_tab->allocation.width; | |
1476 arrow1_y = arrow2_y = nb_y + last_vis_tab->allocation.y + | |
1477 last_vis_tab->allocation.height; | |
1478 } | |
1479 } | |
1480 | |
1481 if (horiz_tabs) { | |
1482 dnd_hints_show(HINT_ARROW_DOWN, arrow1_x, arrow1_y); | |
1483 dnd_hints_show(HINT_ARROW_UP, arrow2_x, arrow2_y); | |
1484 } | |
1485 else { | |
1486 dnd_hints_show(HINT_ARROW_RIGHT, arrow1_x, arrow1_y); | |
1487 dnd_hints_show(HINT_ARROW_LEFT, arrow2_x, arrow2_y); | |
1488 } | |
1489 } | |
1490 | |
1491 return TRUE; | |
1492 } | |
1493 | |
1494 static gboolean | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1495 notebook_leave_cb(GtkWidget *widget, GdkEventCrossing *e, GaimWindow *win) |
4359 | 1496 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1497 GaimGtkWindow *gtkwin; |
4359 | 1498 |
1499 gtkwin = GAIM_GTK_WINDOW(win); | |
1500 | |
1501 if (gtkwin->in_drag) | |
1502 return FALSE; | |
1503 | |
1504 if (e->x_root < gtkwin->drag_min_x || | |
1505 e->x_root >= gtkwin->drag_max_x || | |
1506 e->y_root < gtkwin->drag_min_y || | |
1507 e->y_root >= gtkwin->drag_max_y) { | |
1508 | |
1509 gtkwin->in_predrag = FALSE; | |
1510 notebook_init_grab(gtkwin, widget); | |
1511 } | |
1512 | |
1513 return TRUE; | |
1514 } | |
1515 | |
1516 /* | |
1517 * THANK YOU GALEON! | |
1518 */ | |
1519 static gboolean | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1520 notebook_press_cb(GtkWidget *widget, GdkEventButton *e, GaimWindow *win) |
4359 | 1521 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1522 GaimGtkWindow *gtkwin; |
4359 | 1523 gint nb_x, nb_y, x_rel, y_rel; |
1524 GList *l; | |
1525 int tab_clicked; | |
1526 | |
1527 if (e->button != 1 || e->type != GDK_BUTTON_PRESS) | |
1528 return FALSE; | |
1529 | |
1530 gtkwin = GAIM_GTK_WINDOW(win); | |
1531 | |
1532 if (gtkwin->in_drag) { | |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1533 gaim_debug(GAIM_DEBUG_WARNING, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1534 "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
|
1535 return TRUE; |
4359 | 1536 } |
1537 | |
1538 /* | |
1539 * Make sure a tab was actually clicked. The arrow buttons | |
1540 * mess things up. | |
1541 */ | |
1542 tab_clicked = gaim_gtkconv_get_tab_at_xy(win, e->x_root, e->y_root); | |
1543 | |
1544 if (tab_clicked == -1) | |
1545 return FALSE; | |
1546 | |
1547 /* | |
1548 * Get the relative position of the press event, with regards to | |
1549 * the position of the notebook. | |
1550 */ | |
1551 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
1552 | |
1553 x_rel = e->x_root - nb_x; | |
1554 y_rel = e->y_root - nb_y; | |
1555 | |
1556 /* Reset the min/max x/y */ | |
1557 gtkwin->drag_min_x = 0; | |
1558 gtkwin->drag_min_y = 0; | |
1559 gtkwin->drag_max_x = 0; | |
1560 gtkwin->drag_max_y = 0; | |
1561 | |
1562 /* Find out which tab was dragged. */ | |
1563 for (l = gaim_window_get_conversations(win); l != NULL; l = l->next) { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1564 GaimConversation *conv = l->data; |
4359 | 1565 GtkWidget *tab = GAIM_GTK_CONVERSATION(conv)->tabby; |
1566 | |
1567 if (!GTK_WIDGET_VISIBLE(tab)) | |
1568 continue; | |
1569 | |
1570 if (tab->allocation.x > x_rel || tab->allocation.y > y_rel) | |
1571 break; | |
1572 | |
1573 /* Save the borders of the tab. */ | |
1574 gtkwin->drag_min_x = tab->allocation.x + nb_x; | |
1575 gtkwin->drag_min_y = tab->allocation.y + nb_y; | |
1576 gtkwin->drag_max_x = tab->allocation.width + gtkwin->drag_min_x; | |
1577 gtkwin->drag_max_y = tab->allocation.height + gtkwin->drag_min_y; | |
1578 } | |
1579 | |
1580 /* Make sure the click occurred in the tab. */ | |
1581 if (e->x_root < gtkwin->drag_min_x || | |
1582 e->x_root >= gtkwin->drag_max_x || | |
1583 e->y_root < gtkwin->drag_min_y || | |
1584 e->y_root >= gtkwin->drag_max_y) { | |
1585 | |
1586 return FALSE; | |
1587 } | |
1588 | |
1589 gtkwin->in_predrag = TRUE; | |
1590 | |
1591 /* Connect the new motion signals. */ | |
1592 gtkwin->drag_motion_signal = | |
1593 g_signal_connect(G_OBJECT(widget), "motion_notify_event", | |
1594 G_CALLBACK(notebook_motion_cb), win); | |
1595 | |
1596 gtkwin->drag_leave_signal = | |
1597 g_signal_connect(G_OBJECT(widget), "leave_notify_event", | |
1598 G_CALLBACK(notebook_leave_cb), win); | |
1599 | |
1600 return FALSE; | |
1601 } | |
1602 | |
1603 static gboolean | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1604 notebook_release_cb(GtkWidget *widget, GdkEventButton *e, GaimWindow *win) |
4359 | 1605 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1606 GaimWindow *dest_win; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1607 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1608 GaimGtkWindow *dest_gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1609 GaimConversation *conv; |
4359 | 1610 GtkNotebook *dest_notebook; |
1611 gint dest_page_num; | |
1612 | |
1613 /* | |
1614 * Don't check to make sure that the event's window matches the | |
1615 * widget's, because we may be getting an event passed on from the | |
1616 * close button. | |
1617 */ | |
1618 if (e->button != 1 && e->type != GDK_BUTTON_RELEASE) | |
1619 return FALSE; | |
1620 | |
1621 if (gdk_pointer_is_grabbed()) { | |
1622 gdk_pointer_ungrab(GDK_CURRENT_TIME); | |
1623 gtk_grab_remove(widget); | |
1624 } | |
1625 | |
1626 gtkwin = GAIM_GTK_WINDOW(win); | |
1627 | |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1628 if (!gtkwin->in_predrag && !gtkwin->in_drag) |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1629 return FALSE; |
4359 | 1630 |
1631 /* Disconnect the motion signal. */ | |
1632 if (gtkwin->drag_motion_signal) { | |
1633 g_signal_handler_disconnect(G_OBJECT(widget), | |
1634 gtkwin->drag_motion_signal); | |
1635 | |
1636 gtkwin->drag_motion_signal = 0; | |
1637 } | |
1638 | |
1639 /* | |
1640 * If we're in a pre-drag, we'll also need to disconnect the leave | |
1641 * signal. | |
1642 */ | |
1643 if (gtkwin->in_predrag) { | |
1644 gtkwin->in_predrag = FALSE; | |
1645 | |
1646 if (gtkwin->drag_leave_signal) { | |
1647 g_signal_handler_disconnect(G_OBJECT(widget), | |
1648 gtkwin->drag_leave_signal); | |
1649 | |
1650 gtkwin->drag_leave_signal = 0; | |
1651 } | |
1652 } | |
1653 | |
1654 /* If we're not in drag... */ | |
1655 /* We're perfectly normal people! */ | |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1656 if (!gtkwin->in_drag) |
4359 | 1657 return FALSE; |
1658 | |
1659 gtkwin->in_drag = FALSE; | |
1660 | |
1661 dnd_hints_hide_all(); | |
1662 | |
4369
7e1fb422e5fd
[gaim-migrate @ 4635]
Christian Hammond <chipx86@chipx86.com>
parents:
4368
diff
changeset
|
1663 dest_win = gaim_gtkwin_get_at_xy(e->x_root, e->y_root); |
4359 | 1664 |
1665 conv = gaim_window_get_active_conversation(win); | |
1666 | |
1667 if (dest_win == NULL) { | |
1668 if (gaim_window_get_conversation_count(win) < 2) | |
1669 return FALSE; | |
1670 | |
1671 if (gaim_window_get_conversation_count(win) > 1) { | |
1672 /* Make a new window to stick this to. */ | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1673 GaimWindow *new_win; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1674 GaimGtkWindow *new_gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1675 GaimGtkConversation *gtkconv; |
4748
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1676 gint win_width, win_height; |
5121 | 1677 |
1678 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4359 | 1679 |
1680 new_win = gaim_window_new(); | |
5121 | 1681 |
5139
d0182ae31ab8
[gaim-migrate @ 5503]
Christian Hammond <chipx86@chipx86.com>
parents:
5133
diff
changeset
|
1682 gaim_window_add_conversation(new_win, |
d0182ae31ab8
[gaim-migrate @ 5503]
Christian Hammond <chipx86@chipx86.com>
parents:
5133
diff
changeset
|
1683 gaim_window_remove_conversation(win, |
d0182ae31ab8
[gaim-migrate @ 5503]
Christian Hammond <chipx86@chipx86.com>
parents:
5133
diff
changeset
|
1684 gaim_conversation_get_index(conv))); |
5121 | 1685 |
4748
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1686 new_gtkwin = GAIM_GTK_WINDOW(new_win); |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1687 |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1688 gtk_window_get_size(GTK_WINDOW(new_gtkwin->window), |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1689 &win_width, &win_height); |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1690 |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1691 gtk_window_move(GTK_WINDOW(new_gtkwin->window), |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1692 e->x_root - (win_width / 2), |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1693 e->y_root - (win_height / 2)); |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1694 |
4359 | 1695 gaim_window_show(new_win); |
1696 } | |
1697 | |
1698 return TRUE; | |
1699 } | |
1700 | |
4369
7e1fb422e5fd
[gaim-migrate @ 4635]
Christian Hammond <chipx86@chipx86.com>
parents:
4368
diff
changeset
|
1701 dest_gtkwin = GAIM_GTK_WINDOW(dest_win); |
7e1fb422e5fd
[gaim-migrate @ 4635]
Christian Hammond <chipx86@chipx86.com>
parents:
4368
diff
changeset
|
1702 |
4359 | 1703 /* Get the destination notebook. */ |
1704 dest_notebook = GTK_NOTEBOOK(gtkwin->notebook); | |
1705 | |
1706 /* Get the destination page number. */ | |
1707 dest_page_num = gaim_gtkconv_get_dest_tab_at_xy(dest_win, | |
1708 e->x_root, e->y_root); | |
1709 | |
1710 if (win == dest_win) { | |
1711 gaim_window_move_conversation(win, | |
1712 gaim_conversation_get_index(conv), dest_page_num); | |
1713 } | |
1714 else { | |
1715 size_t pos; | |
1716 | |
1717 gaim_window_remove_conversation(win, | |
1718 gaim_conversation_get_index(conv)); | |
1719 | |
1720 pos = gaim_window_add_conversation(dest_win, conv); | |
1721 | |
1722 gaim_window_move_conversation(dest_win, pos, dest_page_num); | |
1723 | |
1724 gaim_window_switch_conversation(dest_win, dest_page_num); | |
1725 } | |
1726 | |
1727 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
1728 | |
1729 return TRUE; | |
1730 } | |
1731 | |
1732 static void | |
1733 switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, | |
1734 gpointer user_data) | |
1735 { | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
1736 GaimPluginProtocolInfo *prpl_info = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1737 GaimWindow *win; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1738 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1739 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1740 GaimGtkWindow *gtkwin; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
1741 GaimConnection *gc; |
4359 | 1742 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1743 win = (GaimWindow *)user_data; |
4359 | 1744 |
4598
a064e437d5eb
[gaim-migrate @ 4883]
Christian Hammond <chipx86@chipx86.com>
parents:
4596
diff
changeset
|
1745 conv = gaim_window_get_conversation_at(win, page_num); |
a064e437d5eb
[gaim-migrate @ 4883]
Christian Hammond <chipx86@chipx86.com>
parents:
4596
diff
changeset
|
1746 |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1747 g_return_if_fail(conv != NULL); |
4598
a064e437d5eb
[gaim-migrate @ 4883]
Christian Hammond <chipx86@chipx86.com>
parents:
4596
diff
changeset
|
1748 |
4359 | 1749 gc = gaim_conversation_get_gc(conv); |
1750 gtkwin = GAIM_GTK_WINDOW(win); | |
1751 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1752 | |
1753 gaim_conversation_set_unseen(conv, GAIM_UNSEEN_NONE); | |
1754 | |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
1755 if (gc != NULL) { |
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
1756 gtk_widget_set_sensitive(gtkwin->menu.insert_link, TRUE); |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
1757 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
1758 } |
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
1759 |
4359 | 1760 /* Update the menubar */ |
1761 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
5167 | 1762 gtk_widget_set_sensitive(gtkwin->menu.view_log, TRUE); |
4359 | 1763 gtk_widget_set_sensitive(gtkwin->menu.insert_image, |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
1764 (gc && prpl_info->options & OPT_PROTO_IM_IMAGE)); |
4359 | 1765 |
1766 if (gtkwin->menu.send_as != NULL) | |
4685 | 1767 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); |
4359 | 1768 } |
1769 else { | |
5167 | 1770 gtk_widget_set_sensitive(gtkwin->menu.view_log, FALSE); |
4359 | 1771 gtk_widget_set_sensitive(gtkwin->menu.insert_image, FALSE); |
1772 | |
1773 if (gtkwin->menu.send_as != NULL) | |
1774 gtk_widget_hide(gtkwin->menu.send_as); | |
1775 } | |
1776 | |
4736 | 1777 update_typing_icon(conv); |
1778 | |
4359 | 1779 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.logging), |
1780 gaim_conversation_is_logging(conv)); | |
1781 | |
1782 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.sounds), | |
1783 gtkconv->make_sound); | |
1784 | |
1785 gtk_widget_grab_focus(gtkconv->entry); | |
4681 | 1786 |
4965 | 1787 gtk_window_set_title(GTK_WINDOW(gtkwin->window), |
5462
8355eeeb52a3
[gaim-migrate @ 5853]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
1788 gtk_label_get_text(GTK_LABEL(gtkconv->tab_label))); |
4359 | 1789 } |
1790 | |
1791 /************************************************************************** | |
1792 * Utility functions | |
1793 **************************************************************************/ | |
1794 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1795 do_bold(GtkWidget *bold, GaimGtkConversation *gtkconv) |
4359 | 1796 { |
1797 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(bold))) | |
1798 gaim_gtk_surround(gtkconv, "<B>", "</B>"); | |
1799 else | |
1800 gaim_gtk_advance_past(gtkconv, "<B>", "</B>"); | |
1801 | |
1802 gtk_widget_grab_focus(gtkconv->entry); | |
1803 } | |
1804 | |
1805 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1806 do_italic(GtkWidget *italic, GaimGtkConversation *gtkconv) |
4359 | 1807 { |
1808 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(italic))) | |
1809 gaim_gtk_surround(gtkconv, "<I>", "</I>"); | |
1810 else | |
1811 gaim_gtk_advance_past(gtkconv, "<I>", "</I>"); | |
1812 | |
1813 gtk_widget_grab_focus(gtkconv->entry); | |
1814 } | |
1815 | |
1816 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1817 do_underline(GtkWidget *underline, GaimGtkConversation *gtkconv) |
4359 | 1818 { |
1819 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(underline))) | |
1820 gaim_gtk_surround(gtkconv, "<U>", "</U>"); | |
1821 else | |
1822 gaim_gtk_advance_past(gtkconv, "<U>", "</U>"); | |
1823 | |
1824 gtk_widget_grab_focus(gtkconv->entry); | |
1825 } | |
1826 | |
1827 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1828 do_small(GtkWidget *small, GaimGtkConversation *gtkconv) |
4359 | 1829 { |
5049 | 1830 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(small))) |
1831 gaim_gtk_surround(gtkconv, "<FONT SIZE=\"1\">", "</FONT>"); | |
1832 else | |
1833 gaim_gtk_advance_past(gtkconv, "<FONT SIZE=\"1\">", "</FONT>"); | |
4359 | 1834 |
1835 gtk_widget_grab_focus(gtkconv->entry); | |
1836 } | |
1837 | |
1838 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1839 do_normal(GtkWidget *normal, GaimGtkConversation *gtkconv) |
4359 | 1840 { |
5049 | 1841 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(normal))) |
1842 gaim_gtk_surround(gtkconv, "<FONT SIZE=\"3\">", "</FONT>"); | |
1843 else | |
1844 gaim_gtk_advance_past(gtkconv, "<FONT SIZE=\"3\">", "</FONT>"); | |
4359 | 1845 |
1846 gtk_widget_grab_focus(gtkconv->entry); | |
1847 } | |
1848 | |
1849 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1850 do_big(GtkWidget *large, GaimGtkConversation *gtkconv) |
4359 | 1851 { |
5049 | 1852 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(large))) |
1853 gaim_gtk_surround(gtkconv, "<FONT SIZE=\"5\">", "</FONT>"); | |
1854 else | |
1855 gaim_gtk_advance_past(gtkconv, "<FONT SIZE=\"5\">", "</FONT>"); | |
4359 | 1856 |
1857 gtk_widget_grab_focus(gtkconv->entry); | |
1858 } | |
1859 | |
1860 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1861 toggle_font(GtkWidget *font, GaimConversation *conv) |
4359 | 1862 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1863 GaimGtkConversation *gtkconv; |
4359 | 1864 |
1865 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1866 | |
1867 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(font))) | |
1868 show_font_dialog(conv, font); | |
5582 | 1869 else if (gtkconv->dialogs.font != NULL) |
4359 | 1870 cancel_font(font, conv); |
1871 else | |
1872 gaim_gtk_advance_past(gtkconv, "<FONT FACE>", "</FONT>"); | |
1873 } | |
1874 | |
1875 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1876 toggle_fg_color(GtkWidget *color, GaimConversation *conv) |
4359 | 1877 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1878 GaimGtkConversation *gtkconv; |
4359 | 1879 |
1880 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1881 | |
1882 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(color))) | |
1883 show_fgcolor_dialog(conv, color); | |
1884 else if (gtkconv->dialogs.fg_color != NULL) | |
1885 cancel_fgcolor(color, conv); | |
1886 else | |
1887 gaim_gtk_advance_past(gtkconv, "<FONT COLOR>", "</FONT>"); | |
1888 } | |
1889 | |
1890 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1891 toggle_bg_color(GtkWidget *color, GaimConversation *conv) |
4359 | 1892 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1893 GaimGtkConversation *gtkconv; |
4359 | 1894 |
1895 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1896 | |
1897 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(color))) | |
1898 show_bgcolor_dialog(conv, color); | |
1899 else if (gtkconv->dialogs.bg_color != NULL) | |
1900 cancel_bgcolor(color, conv); | |
1901 else | |
1902 gaim_gtk_advance_past(gtkconv, "<BODY BGCOLOR>", "</BODY>"); | |
1903 } | |
1904 | |
1905 static void | |
1906 check_everything(GtkTextBuffer *buffer) | |
1907 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1908 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1909 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1910 |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1911 conv = (GaimConversation *)g_object_get_data(G_OBJECT(buffer), |
4359 | 1912 "user_data"); |
1913 | |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1914 g_return_if_fail(conv != NULL); |
4359 | 1915 |
1916 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1917 | |
1918 /* CONV TODO */ | |
1919 } | |
1920 | |
1921 static void | |
4685 | 1922 set_toggle(GtkWidget *tb, gboolean active) |
4359 | 1923 { |
1924 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(tb), active); | |
1925 } | |
1926 | |
1927 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1928 got_typing_keypress(GaimConversation *conv, gboolean first) |
4359 | 1929 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1930 GaimIm *im; |
4685 | 1931 |
4359 | 1932 /* |
1933 * We know we got something, so we at least have to make sure we don't | |
1934 * send TYPED any time soon. | |
1935 */ | |
1936 | |
1937 im = GAIM_IM(conv); | |
1938 | |
1939 if (gaim_im_get_type_again_timeout(im)) | |
1940 gaim_im_stop_type_again_timeout(im); | |
1941 | |
1942 gaim_im_start_type_again_timeout(im); | |
1943 | |
1944 if (first || (gaim_im_get_type_again(im) != 0 && | |
1945 time(NULL) > gaim_im_get_type_again(im))) { | |
1946 | |
1947 int timeout = serv_send_typing(gaim_conversation_get_gc(conv), | |
1948 (char *)gaim_conversation_get_name(conv), | |
1949 TYPING); | |
1950 | |
1951 if (timeout) | |
1952 gaim_im_set_type_again(im, time(NULL) + timeout); | |
1953 else | |
1954 gaim_im_set_type_again(im, 0); | |
1955 } | |
1956 } | |
1957 | |
4736 | 1958 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1959 update_typing_icon(GaimConversation *conv) |
4736 | 1960 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1961 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1962 GaimIm *im = NULL; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1963 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); |
4736 | 1964 |
1965 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); | |
1966 | |
1967 if(gaim_conversation_get_type(conv) == GAIM_CONV_IM) | |
1968 im = GAIM_IM(conv); | |
1969 | |
1970 if(gtkwin->menu.typing_icon) { | |
1971 gtk_widget_destroy(gtkwin->menu.typing_icon); | |
1972 gtkwin->menu.typing_icon = NULL; | |
1973 } | |
1974 if(im && gaim_im_get_typing_state(im) == TYPING) { | |
1975 gtkwin->menu.typing_icon = gtk_image_menu_item_new(); | |
1976 gtk_image_menu_item_set_image( | |
1977 GTK_IMAGE_MENU_ITEM(gtkwin->menu.typing_icon), | |
1978 gtk_image_new_from_stock(GAIM_STOCK_TYPING, | |
1979 GTK_ICON_SIZE_MENU)); | |
4757 | 1980 gtk_tooltips_set_tip(gtkconv->tooltips, gtkwin->menu.typing_icon, |
4736 | 1981 _("User is typing..."), NULL); |
1982 } else if(im && gaim_im_get_typing_state(im) == TYPED) { | |
1983 gtkwin->menu.typing_icon = gtk_image_menu_item_new(); | |
1984 gtk_image_menu_item_set_image( | |
1985 GTK_IMAGE_MENU_ITEM(gtkwin->menu.typing_icon), | |
1986 gtk_image_new_from_stock(GAIM_STOCK_TYPED, | |
1987 GTK_ICON_SIZE_MENU)); | |
4757 | 1988 gtk_tooltips_set_tip(gtkconv->tooltips, gtkwin->menu.typing_icon, |
4736 | 1989 _("User has typed something and paused"), NULL); |
1990 } | |
1991 | |
1992 if(gtkwin->menu.typing_icon) { | |
1993 gtk_menu_item_set_right_justified( | |
1994 GTK_MENU_ITEM(gtkwin->menu.typing_icon), TRUE); | |
1995 gtk_widget_show_all(gtkwin->menu.typing_icon); | |
1996 gtk_menu_shell_append(GTK_MENU_SHELL(gtkwin->menu.menubar), | |
1997 gtkwin->menu.typing_icon); | |
1998 } | |
1999 } | |
2000 | |
4685 | 2001 static gboolean |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2002 update_send_as_selection(GaimWindow *win) |
4359 | 2003 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2004 GaimAccount *account; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2005 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2006 GaimGtkWindow *gtkwin; |
4359 | 2007 GtkWidget *menu; |
2008 GList *child; | |
2009 | |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2010 g_return_val_if_fail(g_list_find(gaim_get_windows(), win) != NULL, FALSE); |
4849 | 2011 |
4359 | 2012 conv = gaim_window_get_active_conversation(win); |
2013 | |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2014 g_return_val_if_fail(conv != NULL, FALSE); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2015 |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2016 account = gaim_conversation_get_account(conv); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2017 gtkwin = GAIM_GTK_WINDOW(win); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2018 |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2019 g_return_val_if_fail(account != NULL, FALSE); |
4466
473de7371a97
[gaim-migrate @ 4741]
Christian Hammond <chipx86@chipx86.com>
parents:
4465
diff
changeset
|
2020 |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2021 if (gtkwin->menu.send_as == NULL) |
4685 | 2022 return FALSE; |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2023 |
4359 | 2024 gtk_widget_show(gtkwin->menu.send_as); |
2025 | |
2026 menu = gtk_menu_item_get_submenu( | |
2027 GTK_MENU_ITEM(gtkwin->menu.send_as)); | |
2028 | |
2029 for (child = gtk_container_get_children(GTK_CONTAINER(menu)); | |
2030 child != NULL; | |
2031 child = child->next) { | |
2032 | |
2033 GtkWidget *item = child->data; | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2034 GaimAccount *item_account = g_object_get_data(G_OBJECT(item), |
4673 | 2035 "gaim_account"); |
2036 | |
2037 if (account == item_account) { | |
4359 | 2038 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE); |
2039 break; | |
2040 } | |
2041 } | |
4685 | 2042 return FALSE; |
4359 | 2043 } |
2044 | |
2045 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2046 generate_send_as_items(GaimWindow *win, GaimConversation *deleted_conv) |
4359 | 2047 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2048 GaimGtkWindow *gtkwin; |
4359 | 2049 GtkWidget *menu; |
2050 GtkWidget *menuitem; | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2051 GList *gcs; |
4359 | 2052 GList *convs; |
2053 GSList *group = NULL; | |
2054 gboolean first_offline = TRUE; | |
2055 gboolean found_online = FALSE; | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2056 GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
4359 | 2057 |
2058 gtkwin = GAIM_GTK_WINDOW(win); | |
2059 | |
2060 if (gtkwin->menu.send_as != NULL) | |
2061 gtk_widget_destroy(gtkwin->menu.send_as); | |
2062 | |
2063 /* See if we have > 1 connection active. */ | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2064 if (g_list_length(gaim_connections_get_all()) < 2) { |
4359 | 2065 /* Now make sure we don't have any Offline entries. */ |
2066 gboolean found_offline = FALSE; | |
2067 | |
2068 for (convs = gaim_get_conversations(); | |
2069 convs != NULL; | |
2070 convs = convs->next) { | |
2071 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2072 GaimConversation *conv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2073 GaimAccount *account; |
4491 | 2074 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2075 conv = (GaimConversation *)convs->data; |
4491 | 2076 account = gaim_conversation_get_account(conv); |
2077 | |
2078 if (account->gc == NULL) { | |
4359 | 2079 found_offline = TRUE; |
2080 break; | |
2081 } | |
2082 } | |
2083 | |
2084 if (!found_offline) { | |
2085 gtkwin->menu.send_as = NULL; | |
2086 return; | |
2087 } | |
2088 } | |
2089 | |
2090 /* Build the Send As menu */ | |
2091 gtkwin->menu.send_as = gtk_menu_item_new_with_mnemonic(_("_Send As")); | |
2092 gtk_widget_show(gtkwin->menu.send_as); | |
2093 | |
2094 menu = gtk_menu_new(); | |
2095 | |
2096 gtk_menu_shell_append(GTK_MENU_SHELL(gtkwin->menu.menubar), | |
2097 gtkwin->menu.send_as); | |
2098 gtk_menu_item_set_submenu(GTK_MENU_ITEM(gtkwin->menu.send_as), menu); | |
2099 | |
2100 gtk_widget_show(menu); | |
2101 | |
2102 /* Fill it with entries. */ | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2103 for (gcs = gaim_connections_get_all(); gcs != NULL; gcs = gcs->next) { |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2104 |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2105 GaimConnection *gc; |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2106 GaimAccount *account; |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2107 GtkWidget *box; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2108 GtkWidget *label; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2109 GtkWidget *image; |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2110 GdkPixbuf *pixbuf, *scale; |
4359 | 2111 |
2112 found_online = TRUE; | |
2113 | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2114 gc = (GaimConnection *)gcs->data; |
4359 | 2115 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2116 /* Create a pixmap for the protocol icon. */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2117 pixbuf = create_prpl_icon(gc->account); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2118 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
|
2119 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2120 /* Now convert it to GtkImage */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2121 if (pixbuf == NULL) |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2122 image = gtk_image_new(); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2123 else |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2124 image = gtk_image_new_from_pixbuf(scale); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2125 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2126 gtk_size_group_add_widget(sg, image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2127 |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2128 g_object_unref(G_OBJECT(scale)); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2129 g_object_unref(G_OBJECT(pixbuf)); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2130 |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2131 account = gaim_connection_get_account(gc); |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2132 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2133 /* Make our menu item */ |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2134 menuitem = gtk_radio_menu_item_new_with_label(group, |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2135 gaim_account_get_username(account)); |
4793 | 2136 group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem)); |
4359 | 2137 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2138 /* Do some evil, see some evil, speak some evil. */ |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2139 box = gtk_hbox_new(FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2140 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2141 label = gtk_bin_get_child(GTK_BIN(menuitem)); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2142 g_object_ref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2143 gtk_container_remove(GTK_CONTAINER(menuitem), label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2144 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2145 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2146 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 4); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2147 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2148 g_object_unref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2149 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2150 gtk_container_add(GTK_CONTAINER(menuitem), box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2151 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2152 gtk_widget_show(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2153 gtk_widget_show(image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2154 gtk_widget_show(box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2155 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2156 /* Set our data and callbacks. */ |
4359 | 2157 g_object_set_data(G_OBJECT(menuitem), "user_data", win); |
4673 | 2158 g_object_set_data(G_OBJECT(menuitem), "gaim_account", gc->account); |
4359 | 2159 |
4786 | 2160 g_signal_connect(G_OBJECT(menuitem), "activate", |
4673 | 2161 G_CALLBACK(menu_conv_sel_send_cb), NULL); |
4359 | 2162 |
2163 gtk_widget_show(menuitem); | |
2164 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
2165 } | |
2166 | |
2167 /* | |
2168 * Fill it with any accounts that still has an open (yet disabled) window | |
2169 * (signed off accounts with a window open). | |
2170 */ | |
2171 for (convs = gaim_get_conversations(); | |
2172 convs != NULL; | |
2173 convs = convs->next) { | |
2174 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2175 GaimConversation *conv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2176 GaimAccount *account; |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2177 GtkWidget *box; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2178 GtkWidget *label; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2179 GtkWidget *image; |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2180 GdkPixbuf *pixbuf, *scale; |
4359 | 2181 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2182 conv = (GaimConversation *)convs->data; |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
2183 |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
2184 if (conv == deleted_conv) |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
2185 continue; |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
2186 |
4491 | 2187 account = gaim_conversation_get_account(conv); |
2188 | |
4786 | 2189 |
5402 | 2190 if (account && (account->gc == NULL)) { |
4359 | 2191 if (first_offline && found_online) { |
2192 menuitem = gtk_separator_menu_item_new(); | |
2193 gtk_widget_show(menuitem); | |
2194 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
2195 | |
2196 first_offline = FALSE; | |
2197 } | |
2198 | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2199 /* Create a pixmap for the protocol icon. */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2200 pixbuf = create_prpl_icon(account); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2201 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2202 GDK_INTERP_BILINEAR); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2203 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2204 /* Now convert it to GtkImage */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2205 if (pixbuf == NULL) |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2206 image = gtk_image_new(); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2207 else |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2208 image = gtk_image_new_from_pixbuf(scale); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2209 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2210 gtk_size_group_add_widget(sg, image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2211 |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2212 if (scale != NULL) g_object_unref(scale); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2213 if (pixbuf != NULL) g_object_unref(pixbuf); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2214 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2215 /* Make our menu item */ |
4359 | 2216 menuitem = gtk_radio_menu_item_new_with_label(group, |
4491 | 2217 account->username); |
4793 | 2218 group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem)); |
4359 | 2219 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2220 /* Do some evil, see some evil, speak some evil. */ |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2221 box = gtk_hbox_new(FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2222 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2223 label = gtk_bin_get_child(GTK_BIN(menuitem)); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2224 g_object_ref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2225 gtk_container_remove(GTK_CONTAINER(menuitem), label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2226 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2227 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2228 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 4); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2229 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2230 g_object_unref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2231 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2232 gtk_container_add(GTK_CONTAINER(menuitem), box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2233 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2234 gtk_widget_show(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2235 gtk_widget_show(image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2236 gtk_widget_show(box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2237 |
4359 | 2238 gtk_widget_set_sensitive(menuitem, FALSE); |
4786 | 2239 g_object_set_data(G_OBJECT(menuitem), "user_data", win); |
4674 | 2240 g_object_set_data(G_OBJECT(menuitem), "gaim_account", account); |
4359 | 2241 |
4786 | 2242 g_signal_connect(G_OBJECT(menuitem), "activate", |
2243 G_CALLBACK(menu_conv_sel_send_cb), NULL); | |
2244 | |
4359 | 2245 gtk_widget_show(menuitem); |
2246 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
2247 } | |
2248 } | |
2249 | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2250 g_object_unref(sg); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2251 |
4359 | 2252 gtk_widget_show(gtkwin->menu.send_as); |
2253 update_send_as_selection(win); | |
2254 } | |
2255 | |
2256 static GList * | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2257 generate_invite_user_names(GaimConnection *gc) |
4359 | 2258 { |
4785 | 2259 GaimBlistNode *gnode,*bnode; |
4359 | 2260 struct group *g; |
2261 struct buddy *buddy; | |
2262 static GList *tmp = NULL; | |
2263 | |
2264 if (tmp) | |
2265 g_list_free(tmp); | |
2266 | |
2267 tmp = g_list_append(NULL, ""); | |
2268 | |
2269 if (gc != NULL) { | |
4785 | 2270 for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { |
2271 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) | |
2272 continue; | |
2273 g = (struct group *)gnode; | |
2274 for(bnode = gnode->child; bnode; bnode = bnode->next) { | |
2275 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) | |
2276 continue; | |
2277 buddy = (struct buddy *)bnode; | |
2278 | |
5068 | 2279 if (buddy->account == gc->account && GAIM_BUDDY_IS_ONLINE(buddy)) |
4359 | 2280 tmp = g_list_append(tmp, buddy->name); |
2281 } | |
2282 } | |
2283 } | |
2284 | |
2285 return tmp; | |
2286 } | |
2287 | |
2288 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2289 add_chat_buddy_common(GaimConversation *conv, const char *name, int pos) |
4359 | 2290 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2291 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2292 GaimGtkChatPane *gtkchat; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2293 GaimChat *chat; |
4359 | 2294 GtkTreeIter iter; |
2295 GtkListStore *ls; | |
2296 | |
2297 chat = GAIM_CHAT(conv); | |
2298 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2299 gtkchat = gtkconv->u.chat; | |
2300 | |
2301 ls = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list))); | |
2302 | |
2303 gtk_list_store_append(ls, &iter); | |
2304 gtk_list_store_set(ls, &iter, 0, | |
2305 (gaim_chat_is_user_ignored(chat, name) ? "X" : " "), | |
2306 1, name, -1); | |
2307 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), 1, | |
2308 GTK_SORT_ASCENDING); | |
2309 } | |
2310 | |
2311 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2312 tab_complete(GaimConversation *conv) |
4359 | 2313 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2314 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2315 GaimChat *chat; |
4359 | 2316 GtkTextIter cursor, word_start, start_buffer; |
2317 int start; | |
2318 int most_matched = -1; | |
2319 char *entered, *partial = NULL; | |
2320 char *text; | |
2321 GList *matches = NULL; | |
2322 GList *nicks = NULL; | |
2323 | |
2324 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2325 chat = GAIM_CHAT(conv); | |
2326 | |
2327 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_buffer); | |
2328 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, | |
2329 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
2330 | |
2331 word_start = cursor; | |
2332 | |
2333 /* if there's nothing there just return */ | |
2334 if (!gtk_text_iter_compare(&cursor, &start_buffer)) | |
2335 return; | |
2336 | |
2337 text = gtk_text_buffer_get_text(gtkconv->entry_buffer, &start_buffer, | |
2338 &cursor, FALSE); | |
2339 | |
2340 /* if we're at the end of ": " we need to move back 2 spaces */ | |
2341 start = strlen(text) - 1; | |
2342 | |
2343 if (strlen(text) >= 2 && !strncmp(&text[start-1], ": ", 2)) | |
2344 gtk_text_iter_backward_chars(&word_start, 2); | |
2345 | |
2346 /* find the start of the word that we're tabbing */ | |
2347 while (start >= 0 && text[start] != ' ') { | |
2348 gtk_text_iter_backward_char(&word_start); | |
2349 start--; | |
2350 } | |
2351 | |
2352 g_free(text); | |
2353 | |
2354 entered = gtk_text_buffer_get_text(gtkconv->entry_buffer, &word_start, | |
2355 &cursor, FALSE); | |
2356 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
2357 if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/old_tab_complete")) { |
4359 | 2358 if (strlen(entered) >= 2 && |
2359 !strncmp(": ", entered + strlen(entered) - 2, 2)) { | |
2360 | |
2361 entered[strlen(entered) - 2] = 0; | |
2362 } | |
2363 } | |
2364 | |
2365 if (!strlen(entered)) { | |
2366 g_free(entered); | |
2367 return; | |
2368 } | |
2369 | |
2370 for (nicks = gaim_chat_get_users(chat); | |
2371 nicks != NULL; | |
2372 nicks = nicks->next) { | |
2373 | |
2374 char *nick = nicks->data; | |
2375 /* this checks to see if the current nick could be a completion */ | |
4793 | 2376 if (g_ascii_strncasecmp(nick, entered, strlen(entered))) { |
4621
69f028a6f357
[gaim-migrate @ 4912]
Christian Hammond <chipx86@chipx86.com>
parents:
4608
diff
changeset
|
2377 if (*nick != '+' && *nick != '@' && *nick != '%') |
4359 | 2378 continue; |
2379 | |
4793 | 2380 if (g_ascii_strncasecmp(nick + 1, entered, strlen(entered))) { |
4359 | 2381 if (nick[0] != '@' || nick[1] != '+') |
2382 continue; | |
2383 | |
4793 | 2384 if (g_ascii_strncasecmp(nick + 2, entered, strlen(entered))) |
4359 | 2385 continue; |
2386 else | |
2387 nick += 2; | |
2388 } | |
2389 else | |
2390 nick++; | |
2391 } | |
2392 | |
2393 /* if we're here, it's a possible completion */ | |
2394 | |
2395 /* if we're doing old-style, just fill in the completion */ | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
2396 if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/old_tab_complete")) { |
4359 | 2397 gtk_text_buffer_delete(gtkconv->entry_buffer, |
2398 &word_start, &cursor); | |
2399 | |
2400 if (strlen(nick) == strlen(entered)) { | |
2401 nicks = (nicks->next | |
2402 ? nicks->next | |
2403 : gaim_chat_get_users(chat)); | |
2404 | |
2405 nick = nicks->data; | |
2406 | |
2407 if (*nick == '@') nick++; | |
4621
69f028a6f357
[gaim-migrate @ 4912]
Christian Hammond <chipx86@chipx86.com>
parents:
4608
diff
changeset
|
2408 if (*nick == '%') nick++; |
4359 | 2409 if (*nick == '+') nick++; |
2410 } | |
2411 | |
2412 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, | |
2413 &start_buffer); | |
2414 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, | |
2415 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
2416 | |
2417 if (!gtk_text_iter_compare(&cursor, &start_buffer)) { | |
2418 char *tmp = g_strdup_printf("%s: ", nick); | |
2419 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, | |
2420 tmp, -1); | |
2421 g_free(tmp); | |
2422 } | |
2423 else | |
2424 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, | |
2425 nick, -1); | |
2426 | |
2427 g_free(entered); | |
2428 | |
2429 return; | |
2430 } | |
2431 | |
2432 /* we're only here if we're doing new style */ | |
2433 if (most_matched == -1) { | |
2434 /* | |
2435 * this will only get called once, since from now | |
2436 * on most_matched is >= 0 | |
2437 */ | |
2438 most_matched = strlen(nick); | |
2439 partial = g_strdup(nick); | |
2440 } | |
2441 else if (most_matched) { | |
4793 | 2442 while (g_ascii_strncasecmp(nick, partial, most_matched)) |
4359 | 2443 most_matched--; |
2444 | |
2445 partial[most_matched] = 0; | |
2446 } | |
2447 | |
2448 matches = g_list_append(matches, nick); | |
2449 } | |
2450 | |
2451 /* we're only here if we're doing new style */ | |
2452 | |
2453 /* if there weren't any matches, return */ | |
2454 if (!matches) { | |
2455 /* if matches isn't set partials won't be either */ | |
2456 g_free(entered); | |
2457 return; | |
2458 } | |
2459 | |
2460 gtk_text_buffer_delete(gtkconv->entry_buffer, &word_start, &cursor); | |
2461 | |
2462 if (!matches->next) { | |
2463 /* there was only one match. fill it in. */ | |
2464 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_buffer); | |
2465 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, | |
2466 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
2467 | |
2468 if (!gtk_text_iter_compare(&cursor, &start_buffer)) { | |
2469 char *tmp = g_strdup_printf("%s: ", (char *)matches->data); | |
2470 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, tmp, -1); | |
2471 g_free(tmp); | |
2472 } | |
2473 else | |
2474 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, | |
2475 matches->data, -1); | |
2476 | |
2477 matches = g_list_remove(matches, matches->data); | |
2478 } | |
2479 else { | |
2480 /* | |
2481 * there were lots of matches, fill in as much as possible | |
2482 * and display all of them | |
2483 */ | |
2484 char *addthis = g_malloc0(1); | |
2485 | |
2486 while (matches) { | |
2487 char *tmp = addthis; | |
2488 addthis = g_strconcat(tmp, matches->data, " ", NULL); | |
2489 g_free(tmp); | |
2490 matches = g_list_remove(matches, matches->data); | |
2491 } | |
2492 | |
2493 gaim_conversation_write(conv, NULL, addthis, -1, WFLAG_NOLOG, | |
2494 time(NULL)); | |
2495 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, partial, -1); | |
2496 g_free(addthis); | |
2497 } | |
2498 | |
2499 g_free(entered); | |
2500 g_free(partial); | |
2501 } | |
2502 | |
2503 static gboolean | |
2504 meify(char *message, size_t len) | |
2505 { | |
2506 /* | |
2507 * Read /me-ify: If the message (post-HTML) starts with /me, | |
2508 * remove the "/me " part of it (including that space) and return TRUE. | |
2509 */ | |
2510 char *c; | |
2511 gboolean inside_html = 0; | |
2512 | |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2513 /* Umm.. this would be very bad if this happens. */ |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2514 g_return_val_if_fail(message != NULL, FALSE); |
4359 | 2515 |
2516 if (len == -1) | |
2517 len = strlen(message); | |
2518 | |
2519 for (c = message; *c != '\0'; c++, len--) { | |
2520 if (inside_html) { | |
2521 if (*c == '>') | |
2522 inside_html = FALSE; | |
2523 } | |
2524 else { | |
2525 if (*c == '<') | |
2526 inside_html = TRUE; | |
2527 else | |
2528 break; | |
2529 } | |
2530 } | |
2531 | |
4793 | 2532 if (*c != '\0' && !g_ascii_strncasecmp(c, "/me ", 4)) { |
4359 | 2533 memmove(c, c + 4, len - 3); |
2534 | |
2535 return TRUE; | |
2536 } | |
2537 | |
2538 return FALSE; | |
2539 } | |
2540 | |
2541 static GtkItemFactoryEntry menu_items[] = | |
2542 { | |
2543 /* Conversation menu */ | |
4596 | 2544 { N_("/_Conversation"), NULL, NULL, 0, "<Branch>" }, |
2545 { N_("/Conversation/_Save As..."), NULL, menu_save_as_cb, 0, | |
4359 | 2546 "<StockItem>", GTK_STOCK_SAVE_AS }, |
5167 | 2547 { N_("/Conversation/View _Log..."), NULL, menu_view_log_cb, 0, NULL }, |
4359 | 2548 { "/Conversation/sep1", NULL, NULL, 0, "<Separator>" }, |
4596 | 2549 { N_("/Conversation/Insert _URL..."), NULL, menu_insert_link_cb, 0, |
4359 | 2550 "<StockItem>", GAIM_STOCK_LINK }, |
4596 | 2551 { N_("/Conversation/Insert _Image..."), NULL, menu_insert_image_cb, 0, |
4359 | 2552 "<StockItem>", GAIM_STOCK_IMAGE }, |
2553 { "/Conversation/sep2", NULL, NULL, 0, "<Separator>" }, | |
4596 | 2554 { N_("/Conversation/_Close"), NULL, menu_close_conv_cb, 0, |
4359 | 2555 "<StockItem>", GTK_STOCK_CLOSE }, |
2556 | |
2557 /* Options */ | |
4596 | 2558 { N_("/_Options"), NULL, NULL, 0, "<Branch>" }, |
2559 { N_("/Options/Enable _Logging"), NULL, menu_logging_cb, 0, "<CheckItem>" }, | |
2560 { N_("/Options/Enable _Sounds"), NULL, menu_sounds_cb, 0, "<CheckItem>" }, | |
4359 | 2561 }; |
2562 | |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
2563 static const int menu_item_count = |
4359 | 2564 sizeof(menu_items) / sizeof(*menu_items); |
2565 | |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
2566 static char * |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
2567 item_factory_translate_func (const char *path, gpointer func_data) |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
2568 { |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
2569 return _(path); |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
2570 } |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
2571 |
4359 | 2572 static GtkWidget * |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2573 setup_menubar(GaimWindow *win) |
4359 | 2574 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2575 GaimGtkWindow *gtkwin; |
5116 | 2576 GtkAccelGroup *accel_group; |
4359 | 2577 gtkwin = GAIM_GTK_WINDOW(win); |
2578 | |
5116 | 2579 accel_group = gtk_accel_group_new (); |
2580 gtk_window_add_accel_group (GTK_WINDOW (gtkwin->window), accel_group); | |
2581 g_object_unref (accel_group); | |
2582 | |
4630 | 2583 gtkwin->menu.item_factory = gtk_item_factory_new(GTK_TYPE_MENU_BAR, |
5116 | 2584 "<main>", accel_group); |
4630 | 2585 |
2586 gtk_item_factory_set_translate_func (gtkwin->menu.item_factory, | |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
2587 item_factory_translate_func, |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
2588 NULL, NULL); |
4630 | 2589 |
2590 gtk_item_factory_create_items(gtkwin->menu.item_factory, menu_item_count, | |
4359 | 2591 menu_items, win); |
2592 | |
4630 | 2593 gtkwin->menu.menubar = gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
2594 "<main>"); | |
5167 | 2595 gtkwin->menu.view_log = gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
2596 N_("/Conversation/View Log...")); | |
4630 | 2597 gtkwin->menu.insert_link = gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
4834 | 2598 N_("/Conversation/Insert URL...")); |
4630 | 2599 gtkwin->menu.insert_image = gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
4834 | 2600 N_("/Conversation/Insert Image...")); |
4630 | 2601 gtkwin->menu.logging = gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
4834 | 2602 N_("/Options/Enable Logging")); |
4630 | 2603 gtkwin->menu.sounds = gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
4834 | 2604 N_("/Options/Enable Sounds")); |
4359 | 2605 |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
2606 generate_send_as_items(win, NULL); |
4359 | 2607 |
2608 gtk_widget_show(gtkwin->menu.menubar); | |
4931 | 2609 |
2610 return gtkwin->menu.menubar; | |
4359 | 2611 } |
2612 | |
2613 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2614 setup_im_buttons(GaimConversation *conv, GtkWidget *parent) |
4359 | 2615 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2616 GaimConnection *gc; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2617 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2618 GaimGtkImPane *gtkim; |
4359 | 2619 GaimConversationType type = GAIM_CONV_IM; |
2620 | |
2621 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2622 gtkim = gtkconv->u.im; | |
2623 gc = gaim_conversation_get_gc(conv); | |
2624 | |
2625 /* From right to left... */ | |
2626 | |
2627 /* Send button */ | |
2628 gtkconv->send = gaim_gtk_change_text(_("Send"), gtkconv->send, | |
2629 GAIM_STOCK_SEND, type); | |
2630 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->send, _("Send"), NULL); | |
2631 | |
2632 gtk_box_pack_end(GTK_BOX(parent), gtkconv->send, FALSE, FALSE, 0); | |
2633 | |
2634 /* Separator */ | |
2635 if (gtkim->sep2 != NULL) | |
2636 gtk_widget_destroy(gtkim->sep2); | |
2637 | |
2638 gtkim->sep2 = gtk_vseparator_new(); | |
2639 gtk_box_pack_end(GTK_BOX(parent), gtkim->sep2, FALSE, TRUE, 0); | |
2640 gtk_widget_show(gtkim->sep2); | |
2641 | |
2642 /* Now, um, just kind of all over the place. Huh? */ | |
2643 | |
2644 /* Add button */ | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2645 if (gaim_find_buddy(gaim_conversation_get_account(conv), |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2646 gaim_conversation_get_name(conv)) == NULL) { |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2647 |
4359 | 2648 gtkim->add = gaim_gtk_change_text(_("Add"), gtkim->add, |
2649 GTK_STOCK_ADD, type); | |
2650 gtk_tooltips_set_tip(gtkconv->tooltips, gtkim->add, | |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
2651 _("Add the user to your buddy list"), NULL); |
4359 | 2652 } |
2653 else { | |
2654 gtkim->add = gaim_gtk_change_text(_("Remove"), gtkim->add, | |
2655 GTK_STOCK_REMOVE, type); | |
2656 gtk_tooltips_set_tip(gtkconv->tooltips, gtkim->add, | |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
2657 _("Remove the user from your buddy list"), NULL); |
4359 | 2658 } |
2659 | |
2660 gtk_box_pack_start(GTK_BOX(parent), gtkim->add, | |
2661 FALSE, FALSE, 0); | |
2662 | |
2663 /* Warn button */ | |
2664 gtkim->warn = gaim_gtk_change_text(_("Warn"), gtkim->warn, | |
2665 GAIM_STOCK_WARN, type); | |
2666 gtk_box_pack_start(GTK_BOX(parent), gtkim->warn, FALSE, FALSE, 0); | |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
2667 gtk_tooltips_set_tip(gtkconv->tooltips, gtkim->warn, |
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
2668 _("Warn the user"), NULL); |
4359 | 2669 |
2670 /* Info button */ | |
2671 gtkconv->info = gaim_gtk_change_text(_("Info"), gtkconv->info, | |
2672 GAIM_STOCK_INFO, type); | |
2673 gtk_box_pack_start(GTK_BOX(parent), gtkconv->info, FALSE, FALSE, 0); | |
2674 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->info, | |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
2675 _("Get the user's information"), NULL); |
4359 | 2676 |
2677 /* Block button */ | |
2678 gtkim->block = gaim_gtk_change_text(_("Block"), gtkim->block, | |
2679 GAIM_STOCK_BLOCK, type); | |
2680 gtk_box_pack_start(GTK_BOX(parent), gtkim->block, FALSE, FALSE, 0); | |
2681 gtk_tooltips_set_tip(gtkconv->tooltips, gtkim->block, | |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
2682 _("Block the user"), NULL); |
4359 | 2683 |
2684 gtk_button_set_relief(GTK_BUTTON(gtkconv->info), GTK_RELIEF_NONE); | |
2685 gtk_button_set_relief(GTK_BUTTON(gtkim->add), GTK_RELIEF_NONE); | |
2686 gtk_button_set_relief(GTK_BUTTON(gtkim->warn), GTK_RELIEF_NONE); | |
2687 gtk_button_set_relief(GTK_BUTTON(gtkconv->send), GTK_RELIEF_NONE); | |
2688 gtk_button_set_relief(GTK_BUTTON(gtkim->block), GTK_RELIEF_NONE); | |
2689 | |
2690 gtk_size_group_add_widget(gtkconv->sg, gtkconv->info); | |
2691 gtk_size_group_add_widget(gtkconv->sg, gtkim->add); | |
2692 gtk_size_group_add_widget(gtkconv->sg, gtkim->warn); | |
2693 gtk_size_group_add_widget(gtkconv->sg, gtkconv->send); | |
2694 gtk_size_group_add_widget(gtkconv->sg, gtkim->block); | |
2695 | |
2696 gtk_box_reorder_child(GTK_BOX(parent), gtkim->warn, 1); | |
2697 gtk_box_reorder_child(GTK_BOX(parent), gtkim->block, 2); | |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
2698 gtk_box_reorder_child(GTK_BOX(parent), gtkim->add, 3); |
4359 | 2699 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->info, 4); |
2700 | |
2701 gaim_gtkconv_update_buttons_by_protocol(conv); | |
2702 | |
2703 g_signal_connect(G_OBJECT(gtkconv->send), "clicked", | |
2704 G_CALLBACK(send_cb), conv); | |
2705 g_signal_connect(G_OBJECT(gtkconv->info), "clicked", | |
2706 G_CALLBACK(info_cb), conv); | |
2707 g_signal_connect(G_OBJECT(gtkim->warn), "clicked", | |
2708 G_CALLBACK(warn_cb), conv); | |
2709 g_signal_connect(G_OBJECT(gtkim->block), "clicked", | |
2710 G_CALLBACK(block_cb), conv); | |
2711 } | |
2712 | |
2713 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2714 setup_chat_buttons(GaimConversation *conv, GtkWidget *parent) |
4359 | 2715 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2716 GaimConnection *gc; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2717 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2718 GaimGtkChatPane *gtkchat; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2719 GaimGtkWindow *gtkwin; |
4359 | 2720 GtkWidget *sep; |
2721 | |
2722 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2723 gtkchat = gtkconv->u.chat; | |
2724 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); | |
2725 gc = gaim_conversation_get_gc(conv); | |
2726 | |
2727 /* Send button */ | |
2728 gtkconv->send = gaim_gtk_change_text(_("Send"), gtkconv->send, | |
2729 GAIM_STOCK_SEND, GAIM_CONV_CHAT); | |
2730 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->send, _("Send"), NULL); | |
2731 | |
2732 gtk_box_pack_end(GTK_BOX(parent), gtkconv->send, FALSE, FALSE, 0); | |
2733 | |
2734 /* Separator */ | |
2735 sep = gtk_vseparator_new(); | |
2736 gtk_box_pack_end(GTK_BOX(parent), sep, FALSE, TRUE, 0); | |
2737 gtk_widget_show(sep); | |
2738 | |
2739 /* Invite */ | |
2740 gtkchat->invite = gaim_gtk_change_text(_("Invite"), gtkchat->invite, | |
2741 GAIM_STOCK_INVITE, GAIM_CONV_CHAT); | |
2742 gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->invite, | |
2743 _("Invite a user"), NULL); | |
2744 gtk_box_pack_end(GTK_BOX(parent), gtkchat->invite, FALSE, FALSE, 0); | |
2745 | |
2746 /* Set the relief on these. */ | |
2747 gtk_button_set_relief(GTK_BUTTON(gtkchat->invite), GTK_RELIEF_NONE); | |
2748 gtk_button_set_relief(GTK_BUTTON(gtkconv->send), GTK_RELIEF_NONE); | |
2749 | |
2750 /* Callbacks */ | |
2751 g_signal_connect(G_OBJECT(gtkconv->send), "clicked", | |
2752 G_CALLBACK(send_cb), conv); | |
2753 g_signal_connect(G_OBJECT(gtkchat->invite), "clicked", | |
2754 G_CALLBACK(invite_cb), conv); | |
2755 } | |
2756 | |
2757 static GtkWidget * | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2758 build_conv_toolbar(GaimConversation *conv) |
4359 | 2759 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2760 GaimGtkConversation *gtkconv; |
4359 | 2761 GtkWidget *vbox; |
2762 GtkWidget *hbox; | |
2763 GtkWidget *button; | |
2764 GtkWidget *sep; | |
2765 GtkSizeGroup *sg; | |
2766 | |
2767 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2768 | |
2769 sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); | |
2770 | |
2771 vbox = gtk_vbox_new(FALSE, 0); | |
2772 sep = gtk_hseparator_new(); | |
2773 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); | |
2774 | |
2775 hbox = gtk_hbox_new(FALSE, 5); | |
2776 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
2777 | |
2778 /* Bold */ | |
2779 button = gaim_pixbuf_toolbar_button_from_stock(GTK_STOCK_BOLD); | |
2780 gtk_size_group_add_widget(sg, button); | |
2781 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
2782 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("Bold"), NULL); | |
2783 | |
2784 g_signal_connect(G_OBJECT(button), "clicked", | |
2785 G_CALLBACK(do_bold), gtkconv); | |
2786 | |
2787 gtkconv->toolbar.bold = button; | |
2788 | |
2789 /* Italic */ | |
2790 button = gaim_pixbuf_toolbar_button_from_stock(GTK_STOCK_ITALIC); | |
2791 gtk_size_group_add_widget(sg, button); | |
2792 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
2793 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("Italic"), NULL); | |
2794 | |
2795 g_signal_connect(G_OBJECT(button), "clicked", | |
2796 G_CALLBACK(do_italic), gtkconv); | |
2797 | |
2798 gtkconv->toolbar.italic = button; | |
2799 | |
2800 /* Underline */ | |
2801 button = gaim_pixbuf_toolbar_button_from_stock(GTK_STOCK_UNDERLINE); | |
2802 gtk_size_group_add_widget(sg, button); | |
2803 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
2804 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("Underline"), NULL); | |
2805 | |
2806 g_signal_connect(G_OBJECT(button), "clicked", | |
2807 G_CALLBACK(do_underline), gtkconv); | |
2808 | |
2809 gtkconv->toolbar.underline = button; | |
2810 | |
2811 /* Sep */ | |
2812 sep = gtk_vseparator_new(); | |
2813 gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 0); | |
2814 | |
2815 /* Increase font size */ | |
2816 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_TEXT_BIGGER); | |
2817 gtk_size_group_add_widget(sg, button); | |
2818 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
2819 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
2820 _("Larger font size"), NULL); | |
2821 | |
2822 g_signal_connect(G_OBJECT(button), "clicked", | |
2823 G_CALLBACK(do_big), gtkconv); | |
2824 | |
5049 | 2825 gtkconv->toolbar.larger_size = button; |
2826 | |
4359 | 2827 /* Normal font size */ |
2828 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_TEXT_NORMAL); | |
2829 gtk_size_group_add_widget(sg, button); | |
2830 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
2831 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
2832 _("Normal font size"), NULL); | |
2833 | |
2834 g_signal_connect(G_OBJECT(button), "clicked", | |
2835 G_CALLBACK(do_normal), gtkconv); | |
2836 | |
2837 gtkconv->toolbar.normal_size = button; | |
2838 | |
2839 /* Decrease font size */ | |
2840 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_TEXT_SMALLER); | |
2841 gtk_size_group_add_widget(sg, button); | |
2842 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
2843 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
2844 _("Smaller font size"), NULL); | |
2845 | |
2846 g_signal_connect(G_OBJECT(button), "clicked", | |
2847 G_CALLBACK(do_small), gtkconv); | |
2848 | |
5049 | 2849 gtkconv->toolbar.smaller_size = button; |
2850 | |
4359 | 2851 /* Sep */ |
2852 sep = gtk_vseparator_new(); | |
2853 gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 0); | |
2854 | |
4685 | 2855 /* Font Face */ |
2856 | |
2857 button = gaim_pixbuf_toolbar_button_from_stock(GTK_STOCK_SELECT_FONT); | |
2858 gtk_size_group_add_widget(sg, button); | |
2859 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
2860 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
2861 _("Font Face"), NULL); | |
2862 | |
2863 g_signal_connect(G_OBJECT(button), "clicked", | |
2864 G_CALLBACK(toggle_font), conv); | |
2865 | |
2866 gtkconv->toolbar.font = button; | |
2867 | |
4359 | 2868 /* Foreground Color */ |
2869 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_FGCOLOR); | |
2870 gtk_size_group_add_widget(sg, button); | |
2871 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
2872 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
2873 _("Foreground font color"), NULL); | |
2874 | |
2875 g_signal_connect(G_OBJECT(button), "clicked", | |
2876 G_CALLBACK(toggle_fg_color), conv); | |
2877 | |
2878 gtkconv->toolbar.fgcolor = button; | |
2879 | |
2880 /* Background Color */ | |
2881 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_BGCOLOR); | |
2882 gtk_size_group_add_widget(sg, button); | |
2883 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
2884 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
2885 _("Background color"), NULL); | |
2886 | |
2887 g_signal_connect(G_OBJECT(button), "clicked", | |
2888 G_CALLBACK(toggle_bg_color), conv); | |
2889 | |
2890 gtkconv->toolbar.bgcolor = button; | |
2891 | |
2892 /* Sep */ | |
2893 sep = gtk_vseparator_new(); | |
2894 gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 0); | |
2895 | |
2896 /* Insert IM Image */ | |
2897 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_IMAGE); | |
2898 gtk_size_group_add_widget(sg, button); | |
2899 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
2900 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("Insert image"), NULL); | |
2901 | |
2902 g_signal_connect(G_OBJECT(button), "clicked", | |
2903 G_CALLBACK(insert_image_cb), conv); | |
2904 | |
2905 gtkconv->toolbar.image = button; | |
2906 | |
2907 /* Insert Link */ | |
2908 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_LINK); | |
2909 gtk_size_group_add_widget(sg, button); | |
2910 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
2911 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("Insert link"), NULL); | |
2912 | |
2913 g_signal_connect(G_OBJECT(button), "clicked", | |
2914 G_CALLBACK(insert_link_cb), conv); | |
2915 | |
2916 gtkconv->toolbar.link = button; | |
2917 | |
2918 /* Insert Smiley */ | |
2919 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_SMILEY); | |
2920 gtk_size_group_add_widget(sg, button); | |
2921 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
2922 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("Insert smiley"), NULL); | |
2923 | |
2924 g_signal_connect(G_OBJECT(button), "clicked", | |
2925 G_CALLBACK(insert_smiley_cb), conv); | |
2926 | |
2927 gtkconv->toolbar.smiley = button; | |
2928 | |
2929 | |
2930 sep = gtk_hseparator_new(); | |
2931 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); | |
2932 | |
2933 gtk_widget_show_all(vbox); | |
2934 | |
2935 return vbox; | |
2936 } | |
2937 | |
2938 static GtkWidget * | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2939 setup_chat_pane(GaimConversation *conv) |
4359 | 2940 { |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
2941 GaimPluginProtocolInfo *prpl_info = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2942 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2943 GaimGtkChatPane *gtkchat; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2944 GaimConnection *gc; |
4359 | 2945 GtkWidget *vpaned, *hpaned; |
2946 GtkWidget *vbox, *hbox; | |
2947 GtkWidget *lbox, *bbox; | |
2948 GtkWidget *label; | |
2949 GtkWidget *sw2; | |
2950 GtkWidget *list; | |
2951 GtkWidget *button; | |
2952 GtkWidget *frame; | |
2953 GtkListStore *ls; | |
2954 GtkCellRenderer *rend; | |
2955 GtkTreeViewColumn *col; | |
2956 | |
2957 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2958 gtkchat = gtkconv->u.chat; | |
2959 gc = gaim_conversation_get_gc(conv); | |
2960 | |
2961 /* Setup the outer pane. */ | |
2962 vpaned = gtk_vpaned_new(); | |
2963 gtk_widget_show(vpaned); | |
2964 | |
2965 /* Setup the top part of the pane. */ | |
2966 vbox = gtk_vbox_new(FALSE, 5); | |
2967 gtk_paned_pack1(GTK_PANED(vpaned), vbox, TRUE, FALSE); | |
2968 gtk_widget_show(vbox); | |
2969 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
2970 if (gc != NULL) |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
2971 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
2972 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
2973 if (prpl_info->options & OPT_PROTO_CHAT_TOPIC) |
4359 | 2974 { |
2975 hbox = gtk_hbox_new(FALSE, 0); | |
2976 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
2977 gtk_widget_show(hbox); | |
2978 | |
2979 label = gtk_label_new(_("Topic:")); | |
2980 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
2981 gtk_widget_show(label); | |
2982 | |
2983 gtkchat->topic_text = gtk_entry_new(); | |
4635 | 2984 gtk_editable_set_editable(GTK_EDITABLE(gtkchat->topic_text), FALSE); |
4359 | 2985 gtk_box_pack_start(GTK_BOX(hbox), gtkchat->topic_text, TRUE, TRUE, 5); |
2986 gtk_widget_show(gtkchat->topic_text); | |
2987 } | |
2988 | |
2989 /* Setup the horizontal pane. */ | |
2990 hpaned = gtk_hpaned_new(); | |
2991 gtk_box_pack_start(GTK_BOX(vbox), hpaned, TRUE, TRUE, 5); | |
2992 gtk_widget_show(hpaned); | |
2993 | |
2994 /* Setup the scrolled window to put gtkimhtml in. */ | |
2995 gtkconv->sw = gtk_scrolled_window_new(NULL, NULL); | |
2996 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
2997 GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); | |
2998 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
2999 GTK_SHADOW_IN); | |
3000 gtk_paned_pack1(GTK_PANED(hpaned), gtkconv->sw, TRUE, TRUE); | |
3001 | |
3002 gtk_widget_set_size_request(gtkconv->sw, | |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3003 gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_width"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3004 gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_height")); |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3005 |
4359 | 3006 gtk_widget_show(gtkconv->sw); |
3007 | |
3008 /* Setup gtkihmtml. */ | |
3009 gtkconv->imhtml = gtk_imhtml_new(NULL, NULL); | |
3010 gtk_container_add(GTK_CONTAINER(gtkconv->sw), gtkconv->imhtml); | |
3011 | |
3012 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3013 gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); |
4359 | 3014 |
3015 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", | |
3016 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
3017 | |
3018 gaim_setup_imhtml(gtkconv->imhtml); | |
3019 | |
3020 gtk_widget_show(gtkconv->imhtml); | |
3021 | |
3022 /* Build the right pane. */ | |
3023 lbox = gtk_vbox_new(FALSE, 5); | |
4409
0521eec12c33
[gaim-migrate @ 4682]
Christian Hammond <chipx86@chipx86.com>
parents:
4398
diff
changeset
|
3024 gtk_paned_pack2(GTK_PANED(hpaned), lbox, FALSE, TRUE); |
4359 | 3025 gtk_widget_show(lbox); |
3026 | |
3027 /* Setup the label telling how many people are in the room. */ | |
3028 gtkchat->count = gtk_label_new(_("0 people in room")); | |
3029 gtk_box_pack_start(GTK_BOX(lbox), gtkchat->count, FALSE, FALSE, 0); | |
3030 gtk_widget_show(gtkchat->count); | |
3031 | |
3032 /* Setup the list of users. */ | |
3033 sw2 = gtk_scrolled_window_new(NULL, NULL); | |
3034 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw2), | |
3035 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); | |
3036 gtk_box_pack_start(GTK_BOX(lbox), sw2, TRUE, TRUE, 0); | |
3037 gtk_widget_show(sw2); | |
3038 | |
3039 ls = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING); | |
3040 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), 1, | |
3041 GTK_SORT_ASCENDING); | |
3042 | |
3043 list = gtk_tree_view_new_with_model(GTK_TREE_MODEL(ls)); | |
3044 | |
3045 rend = gtk_cell_renderer_text_new(); | |
3046 col = gtk_tree_view_column_new_with_attributes(NULL, rend, | |
3047 "text", 0, NULL); | |
3048 gtk_tree_view_column_set_clickable(GTK_TREE_VIEW_COLUMN(col), TRUE); | |
3049 | |
3050 g_signal_connect(G_OBJECT(list), "button_press_event", | |
3051 G_CALLBACK(right_click_chat_cb), conv); | |
3052 | |
3053 gtk_tree_view_append_column(GTK_TREE_VIEW(list), col); | |
3054 | |
3055 col = gtk_tree_view_column_new_with_attributes(NULL, rend, | |
3056 "text", 1, NULL); | |
3057 gtk_tree_view_column_set_clickable(GTK_TREE_VIEW_COLUMN(col), TRUE); | |
3058 | |
3059 #if 0 | |
3060 g_signal_connect(G_OBJECT(list), "button_press_event", | |
3061 G_CALLBACK(right_click_chat), conv); | |
3062 #endif | |
3063 | |
3064 gtk_tree_view_append_column(GTK_TREE_VIEW(list), col); | |
3065 | |
3066 gtk_widget_set_size_request(list, 150, -1); | |
3067 | |
3068 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(list), FALSE); | |
3069 gtk_widget_show(list); | |
3070 | |
3071 gtkchat->list = list; | |
3072 | |
3073 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw2), list); | |
3074 | |
3075 /* Setup the user list toolbar. */ | |
3076 bbox = gtk_hbox_new(TRUE, 5); | |
3077 gtk_box_pack_start(GTK_BOX(lbox), bbox, FALSE, FALSE, 0); | |
3078 gtk_widget_show(bbox); | |
3079 | |
3080 /* IM */ | |
3081 button = gaim_pixbuf_button_from_stock(NULL, GTK_STOCK_REDO, | |
3082 GAIM_BUTTON_VERTICAL); | |
3083 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
3084 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
|
3085 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("IM the user"), NULL); |
4359 | 3086 g_signal_connect(G_OBJECT(button), "clicked", |
3087 G_CALLBACK(im_cb), conv); | |
3088 | |
3089 gtk_widget_show(button); | |
3090 | |
3091 /* Ignore */ | |
3092 button = gaim_pixbuf_button_from_stock(NULL, GAIM_STOCK_IGNORE, | |
3093 GAIM_BUTTON_VERTICAL); | |
3094 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
3095 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
|
3096 gtk_tooltips_set_tip(gtkconv->tooltips, button, |
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3097 _("Ignore the user"), NULL); |
4359 | 3098 g_signal_connect(G_OBJECT(button), "clicked", |
3099 G_CALLBACK(ignore_cb), conv); | |
3100 gtk_widget_show(button); | |
3101 | |
3102 /* Info */ | |
3103 button = gaim_pixbuf_button_from_stock(NULL, GAIM_STOCK_INFO, | |
3104 GAIM_BUTTON_VERTICAL); | |
3105 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
3106 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
3107 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3108 _("Get the user's information"), NULL); |
4359 | 3109 g_signal_connect(G_OBJECT(button), "clicked", |
3110 G_CALLBACK(info_cb), conv); | |
3111 | |
3112 gtk_widget_show(button); | |
3113 | |
3114 gtkconv->info = button; | |
3115 | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3116 /* Build the toolbar. */ |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3117 vbox = gtk_vbox_new(FALSE, 5); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3118 gtk_paned_pack2(GTK_PANED(vpaned), vbox, FALSE, FALSE); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3119 gtk_widget_show(vbox); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3120 |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3121 gtkconv->toolbar.toolbar = build_conv_toolbar(conv); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3122 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->toolbar.toolbar, |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3123 FALSE, FALSE, 0); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3124 |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3125 /* Setup the entry widget. */ |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3126 frame = gtk_frame_new(NULL); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3127 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3128 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3129 gtk_widget_show(frame); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3130 |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3131 gtkconv->entry_buffer = gtk_text_buffer_new(NULL); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3132 g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", conv); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3133 gtkconv->entry = gtk_text_view_new_with_buffer(gtkconv->entry_buffer); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3134 |
5105 | 3135 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(gtkconv->entry), GTK_WRAP_WORD_CHAR); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3136 gtk_widget_set_size_request(gtkconv->entry, -1, |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3137 MAX(gaim_prefs_get_int("/gaim/gtk/conversations/chat/entry_height"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3138 25)); |
4359 | 3139 |
3140 /* Connect the signal handlers. */ | |
3141 g_signal_connect_swapped(G_OBJECT(gtkconv->entry), "key_press_event", | |
3142 G_CALLBACK(entry_key_pressed_cb_1), | |
3143 gtkconv->entry_buffer); | |
3144 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", | |
3145 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
3146 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", | |
3147 G_CALLBACK(entry_key_pressed_cb_2), conv); | |
3148 | |
3149 #ifdef USE_GTKSPELL | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3150 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) |
4359 | 3151 gtkspell_new_attach(GTK_TEXT_VIEW(gtkconv->entry), NULL, NULL); |
3152 #endif | |
3153 | |
3154 gtk_container_add(GTK_CONTAINER(frame), GTK_WIDGET(gtkconv->entry)); | |
3155 gtk_widget_show(gtkconv->entry); | |
3156 | |
3157 /* Setup the bottom button box. */ | |
3158 gtkconv->bbox = gtk_hbox_new(FALSE, 5); | |
3159 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->bbox, FALSE, FALSE, 0); | |
3160 gtk_widget_show(gtkconv->bbox); | |
3161 | |
3162 setup_chat_buttons(conv, gtkconv->bbox); | |
3163 | |
3164 return vpaned; | |
3165 } | |
3166 | |
3167 static GtkWidget * | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3168 setup_im_pane(GaimConversation *conv) |
4359 | 3169 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3170 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3171 GaimGtkImPane *gtkim; |
4359 | 3172 GtkWidget *paned; |
3173 GtkWidget *vbox; | |
3174 GtkWidget *vbox2; | |
3175 GtkWidget *frame; | |
3176 | |
3177 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3178 gtkim = gtkconv->u.im; | |
3179 | |
3180 /* Setup the outer pane. */ | |
3181 paned = gtk_vpaned_new(); | |
3182 gtk_widget_show(paned); | |
3183 | |
3184 /* Setup the top part of the pane. */ | |
3185 vbox = gtk_vbox_new(FALSE, 5); | |
4409
0521eec12c33
[gaim-migrate @ 4682]
Christian Hammond <chipx86@chipx86.com>
parents:
4398
diff
changeset
|
3186 gtk_paned_pack1(GTK_PANED(paned), vbox, TRUE, TRUE); |
4359 | 3187 gtk_widget_show(vbox); |
3188 | |
3189 /* Setup the gtkimhtml widget. */ | |
3190 gtkconv->sw = gtk_scrolled_window_new(NULL, NULL); | |
3191 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
3192 GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); | |
3193 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
3194 GTK_SHADOW_IN); | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3195 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->sw, TRUE, TRUE, 0); |
4851 | 3196 |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3197 gtk_widget_set_size_request(gtkconv->sw, |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3198 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_width"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3199 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_height")); |
4359 | 3200 gtk_widget_show(gtkconv->sw); |
3201 | |
3202 gtkconv->imhtml = gtk_imhtml_new(NULL, NULL); | |
3203 gtk_container_add(GTK_CONTAINER(gtkconv->sw), gtkconv->imhtml); | |
3204 | |
3205 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", | |
3206 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
3207 | |
3208 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3209 gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); |
4359 | 3210 |
3211 gaim_setup_imhtml(gtkconv->imhtml); | |
3212 | |
3213 gtk_widget_show(gtkconv->imhtml); | |
3214 | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3215 vbox2 = gtk_vbox_new(FALSE, 5); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3216 gtk_paned_pack2(GTK_PANED(paned), vbox2, FALSE, FALSE); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3217 gtk_widget_show(vbox2); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3218 |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3219 /* Build the toolbar. */ |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3220 gtkconv->toolbar.toolbar = build_conv_toolbar(conv); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3221 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->toolbar.toolbar, |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3222 FALSE, FALSE, 0); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3223 |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3224 /* Setup the entry widget. */ |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3225 frame = gtk_frame_new(NULL); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3226 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3227 gtk_box_pack_start(GTK_BOX(vbox2), frame, TRUE, TRUE, 0); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3228 gtk_widget_show(frame); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3229 |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3230 gtkconv->entry_buffer = gtk_text_buffer_new(NULL); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3231 g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", conv); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3232 gtkconv->entry = gtk_text_view_new_with_buffer(gtkconv->entry_buffer); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3233 |
5105 | 3234 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(gtkconv->entry), GTK_WRAP_WORD_CHAR); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3235 gtk_widget_set_size_request(gtkconv->entry, -1, |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3236 MAX(gaim_prefs_get_int("/gaim/gtk/conversations/im/entry_height"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3237 25)); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3238 |
4359 | 3239 /* Connect the signal handlers. */ |
3240 g_signal_connect_swapped(G_OBJECT(gtkconv->entry), "key_press_event", | |
3241 G_CALLBACK(entry_key_pressed_cb_1), | |
3242 gtkconv->entry_buffer); | |
3243 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", | |
3244 G_CALLBACK(entry_key_pressed_cb_2), conv); | |
3245 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", | |
3246 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
3247 | |
3248 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "insert_text", | |
3249 G_CALLBACK(insert_text_cb), conv); | |
3250 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "delete_range", | |
3251 G_CALLBACK(delete_text_cb), conv); | |
3252 | |
3253 #ifdef USE_GTKSPELL | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3254 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) |
4359 | 3255 gtkspell_new_attach(GTK_TEXT_VIEW(gtkconv->entry), NULL, NULL); |
3256 #endif | |
3257 | |
3258 gtk_container_add(GTK_CONTAINER(frame), GTK_WIDGET(gtkconv->entry)); | |
3259 gtk_widget_show(gtkconv->entry); | |
3260 | |
3261 gtkconv->bbox = gtk_hbox_new(FALSE, 5); | |
3262 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->bbox, FALSE, FALSE, 0); | |
3263 gtk_widget_show(gtkconv->bbox); | |
3264 | |
3265 setup_im_buttons(conv, gtkconv->bbox); | |
3266 | |
3267 return paned; | |
3268 } | |
3269 | |
3270 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3271 move_next_tab(GaimConversation *conv) |
4359 | 3272 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3273 GaimConversation *next_conv = NULL; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3274 GaimWindow *win; |
4359 | 3275 GList *l; |
3276 int index, i; | |
3277 | |
3278 win = gaim_conversation_get_window(conv); | |
3279 index = gaim_conversation_get_index(conv); | |
3280 | |
3281 /* First check the tabs after this position. */ | |
3282 for (l = g_list_nth(gaim_window_get_conversations(win), index); | |
3283 l != NULL; | |
3284 l = l->next) { | |
3285 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3286 next_conv = (GaimConversation *)l->data; |
4359 | 3287 |
3288 if (gaim_conversation_get_unseen(next_conv) > 0) | |
3289 break; | |
3290 | |
3291 next_conv = NULL; | |
3292 } | |
3293 | |
3294 if (next_conv == NULL) { | |
3295 | |
3296 /* Now check before this position. */ | |
3297 for (l = gaim_window_get_conversations(win), i = 0; | |
3298 l != NULL && i < index; | |
3299 l = l->next) { | |
3300 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3301 next_conv = (GaimConversation *)l->data; |
4359 | 3302 |
3303 if (gaim_conversation_get_unseen(next_conv) > 0) | |
3304 break; | |
3305 | |
3306 next_conv = NULL; | |
3307 } | |
3308 | |
3309 if (next_conv == NULL) { | |
3310 /* Okay, just grab the next conversation tab. */ | |
3311 if (index == gaim_window_get_conversation_count(win) - 1) | |
3312 next_conv = gaim_window_get_conversation_at(win, 0); | |
3313 else | |
3314 next_conv = gaim_window_get_conversation_at(win, index + 1); | |
3315 } | |
3316 } | |
3317 | |
3318 if (next_conv != NULL && next_conv != conv) { | |
3319 gaim_window_switch_conversation(win, | |
3320 gaim_conversation_get_index(next_conv)); | |
3321 } | |
3322 } | |
3323 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3324 static void |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3325 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
|
3326 GtkSelectionData *sd, guint info, guint t, |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3327 GaimConversation *conv) |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3328 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3329 GaimWindow *win = conv->window; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3330 GaimConversation *c; |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3331 |
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3332 if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE)) { |
4781 | 3333 GaimBlistNode *n = NULL; |
3334 memcpy(&n, sd->data, sizeof(n)); | |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3335 |
4781 | 3336 if (!GAIM_BLIST_NODE_IS_BUDDY(n)) |
3337 return; | |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3338 |
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3339 c = gaim_conversation_new(GAIM_CONV_IM, |
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3340 ((struct buddy *)n)->account, |
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3341 ((struct buddy *)n)->name); |
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3342 |
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3343 gaim_window_add_conversation(win, c); |
4702 | 3344 } |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3345 } |
4359 | 3346 |
3347 /************************************************************************** | |
3348 * GTK+ window ops | |
3349 **************************************************************************/ | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3350 static GaimConversationUiOps * |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
3351 gaim_gtk_get_conversation_ui_ops(void) |
4359 | 3352 { |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
3353 return gaim_get_gtk_conversation_ui_ops(); |
4359 | 3354 } |
3355 | |
3356 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3357 gaim_gtk_new_window(GaimWindow *win) |
4359 | 3358 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3359 GaimGtkWindow *gtkwin; |
4359 | 3360 GtkPositionType pos; |
3361 GtkWidget *testidea; | |
3362 GtkWidget *menubar; | |
3363 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3364 gtkwin = g_malloc0(sizeof(GaimGtkWindow)); |
4359 | 3365 |
3366 win->ui_data = gtkwin; | |
3367 | |
3368 /* Create the window. */ | |
3369 gtkwin->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
3370 gtk_window_set_role(GTK_WINDOW(gtkwin->window), "conversation"); | |
4635 | 3371 gtk_window_set_resizable(GTK_WINDOW(gtkwin->window), TRUE); |
4510
4c394222c732
[gaim-migrate @ 4786]
Christian Hammond <chipx86@chipx86.com>
parents:
4505
diff
changeset
|
3372 gtk_container_set_border_width(GTK_CONTAINER(gtkwin->window), 0); |
5173 | 3373 GTK_WINDOW(gtkwin->window)->allow_shrink = TRUE; |
4359 | 3374 gtk_widget_realize(gtkwin->window); |
3375 | |
3376 g_signal_connect(G_OBJECT(gtkwin->window), "delete_event", | |
3377 G_CALLBACK(close_win_cb), win); | |
3378 | |
3379 /* Create the notebook. */ | |
3380 gtkwin->notebook = gtk_notebook_new(); | |
3381 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3382 pos = gaim_prefs_get_int("/gaim/gtk/conversations/tab_side"); |
4359 | 3383 |
3384 #if 0 | |
3385 gtk_notebook_set_tab_hborder(GTK_NOTEBOOK(gtkwin->notebook), 0); | |
3386 gtk_notebook_set_tab_vborder(GTK_NOTEBOOK(gtkwin->notebook), 0); | |
3387 #endif | |
3388 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos); | |
3389 gtk_notebook_set_scrollable(GTK_NOTEBOOK(gtkwin->notebook), TRUE); | |
3390 gtk_notebook_popup_enable(GTK_NOTEBOOK(gtkwin->notebook)); | |
4818 | 3391 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), FALSE); |
3392 | |
4359 | 3393 gtk_widget_show(gtkwin->notebook); |
3394 | |
3395 g_signal_connect_after(G_OBJECT(gtkwin->notebook), "switch_page", | |
3396 G_CALLBACK(switch_conv_cb), win); | |
3397 | |
3398 /* Setup the tab drag and drop signals. */ | |
4486 | 3399 gtk_widget_add_events(gtkwin->notebook, |
3400 GDK_BUTTON1_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK); | |
3401 g_signal_connect(G_OBJECT(gtkwin->notebook), "button_press_event", | |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
3402 G_CALLBACK(notebook_press_cb), win); |
4486 | 3403 g_signal_connect(G_OBJECT(gtkwin->notebook), "button_release_event", |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
3404 G_CALLBACK(notebook_release_cb), win); |
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
3405 |
4359 | 3406 testidea = gtk_vbox_new(FALSE, 0); |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
3407 |
4359 | 3408 /* Setup the menubar. */ |
3409 menubar = setup_menubar(win); | |
3410 gtk_box_pack_start(GTK_BOX(testidea), menubar, FALSE, TRUE, 0); | |
3411 | |
3412 gtk_box_pack_start(GTK_BOX(testidea), gtkwin->notebook, TRUE, TRUE, 0); | |
3413 | |
3414 gtk_container_add(GTK_CONTAINER(gtkwin->window), testidea); | |
3415 | |
3416 gtk_widget_show(testidea); | |
3417 } | |
3418 | |
3419 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3420 gaim_gtk_destroy_window(GaimWindow *win) |
4359 | 3421 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3422 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 3423 |
3424 gtk_widget_destroy(gtkwin->window); | |
3425 | |
4630 | 3426 g_object_unref(G_OBJECT(gtkwin->menu.item_factory)); |
3427 | |
4359 | 3428 g_free(gtkwin); |
3429 win->ui_data = NULL; | |
3430 } | |
3431 | |
3432 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3433 gaim_gtk_show(GaimWindow *win) |
4359 | 3434 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3435 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 3436 |
3437 gtk_widget_show(gtkwin->window); | |
3438 } | |
3439 | |
3440 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3441 gaim_gtk_hide(GaimWindow *win) |
4359 | 3442 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3443 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 3444 |
3445 gtk_widget_hide(gtkwin->window); | |
3446 } | |
3447 | |
3448 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3449 gaim_gtk_raise(GaimWindow *win) |
4359 | 3450 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3451 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 3452 |
5484 | 3453 gtk_widget_show(gtkwin->window); |
5103 | 3454 gtk_window_deiconify(GTK_WINDOW(gtkwin->window)); |
4526 | 3455 gdk_window_raise(gtkwin->window->window); |
4359 | 3456 } |
3457 | |
3458 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3459 gaim_gtk_flash(GaimWindow *win) |
4359 | 3460 { |
3461 #ifdef _WIN32 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3462 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 3463 |
3464 wgaim_im_blink(gtkwin->window); | |
3465 #endif | |
3466 } | |
3467 | |
3468 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3469 gaim_gtk_switch_conversation(GaimWindow *win, unsigned int index) |
4359 | 3470 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3471 GaimGtkWindow *gtkwin; |
4359 | 3472 |
3473 gtkwin = GAIM_GTK_WINDOW(win); | |
3474 | |
3475 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), index); | |
3476 } | |
3477 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3478 static const GtkTargetEntry te[] = |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3479 { |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3480 {"text/plain", 0, 0}, |
4702 | 3481 {"text/uri-list", 0, 1}, |
4781 | 3482 {"GAIM_BLIST_NODE", 0, 2}, |
4702 | 3483 {"STRING", 0, 3} |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3484 }; |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3485 |
4359 | 3486 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3487 gaim_gtk_add_conversation(GaimWindow *win, GaimConversation *conv) |
4359 | 3488 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3489 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3490 GaimGtkConversation *gtkconv, *focus_gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3491 GaimConversation *focus_conv; |
4359 | 3492 GtkWidget *pane = NULL; |
3493 GtkWidget *tab_cont; | |
3494 GtkWidget *tabby; | |
3495 gboolean new_ui; | |
4383
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3496 GaimConversationType conv_type; |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3497 const char *name; |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3498 |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3499 name = gaim_conversation_get_name(conv); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3500 conv_type = gaim_conversation_get_type(conv); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3501 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 3502 |
3503 if (conv->ui_data != NULL) { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3504 gtkconv = (GaimGtkConversation *)conv->ui_data; |
4359 | 3505 |
3506 tab_cont = gtkconv->tab_cont; | |
3507 | |
3508 new_ui = FALSE; | |
3509 } | |
3510 else { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3511 gtkconv = g_malloc0(sizeof(GaimGtkConversation)); |
4359 | 3512 conv->ui_data = gtkconv; |
3513 | |
3514 /* Setup some initial variables. */ | |
3515 gtkconv->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
3516 gtkconv->tooltips = gtk_tooltips_new(); | |
3517 | |
4421 | 3518 /* Setup the foreground and background colors */ |
3519 gaim_gtkconv_update_font_colors(conv); | |
3520 | |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
3521 /* Setup the font face */ |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
3522 gaim_gtkconv_update_font_face(conv); |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
3523 |
4383
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3524 if (conv_type == GAIM_CONV_CHAT) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3525 gtkconv->u.chat = g_malloc0(sizeof(GaimGtkChatPane)); |
4359 | 3526 |
3527 pane = setup_chat_pane(conv); | |
3528 } | |
4383
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3529 else if (conv_type == GAIM_CONV_IM) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3530 gtkconv->u.im = g_malloc0(sizeof(GaimGtkImPane)); |
4359 | 3531 gtkconv->u.im->a_virgin = TRUE; |
3532 | |
3533 pane = setup_im_pane(conv); | |
3534 } | |
3535 | |
3536 if (pane == NULL) { | |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
3537 if (conv_type == GAIM_CONV_CHAT) g_free(gtkconv->u.chat); |
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
3538 else if (conv_type == GAIM_CONV_IM) g_free(gtkconv->u.im); |
4359 | 3539 |
3540 g_free(gtkconv); | |
3541 conv->ui_data = NULL; | |
3542 | |
3543 return; | |
3544 } | |
3545 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3546 /* Setup drag-and-drop */ |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3547 gtk_drag_dest_set(pane, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3548 GTK_DEST_DEFAULT_MOTION | |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3549 GTK_DEST_DEFAULT_DROP, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3550 te, sizeof(te) / sizeof(GtkTargetEntry), |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3551 GDK_ACTION_COPY); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3552 gtk_drag_dest_set(gtkconv->imhtml, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3553 GTK_DEST_DEFAULT_MOTION | |
4702 | 3554 GTK_DEST_DEFAULT_DROP, |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3555 te, sizeof(te) / sizeof(GtkTargetEntry), |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3556 GDK_ACTION_DEFAULT | GDK_ACTION_COPY | GDK_ACTION_MOVE); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3557 gtk_drag_dest_set(gtkconv->entry, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3558 GTK_DEST_DEFAULT_MOTION | |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3559 GTK_DEST_DEFAULT_DROP, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3560 te, sizeof(te) / sizeof(GtkTargetEntry), |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3561 GDK_ACTION_COPY); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3562 |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3563 g_signal_connect(G_OBJECT(pane), "drag_data_received", |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3564 G_CALLBACK(conv_dnd_recv), conv); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3565 g_signal_connect(G_OBJECT(gtkconv->imhtml), "drag_data_received", |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3566 G_CALLBACK(conv_dnd_recv), conv); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3567 #if 0 |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3568 g_signal_connect(G_OBJECT(gtkconv->entry), "drag_data_received", |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3569 G_CALLBACK(conv_dnd_recv), conv); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3570 #endif |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3571 |
4383
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3572 /* |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3573 * Write the New Conversation log string. |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3574 * |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3575 * This should probably be elsewhere, but then, logging should |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3576 * be moved out in some way, either via plugin or via a new API. |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3577 */ |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3578 if (gaim_conversation_is_logging(conv) && |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3579 conv_type != GAIM_CONV_MISC) { |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3580 |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3581 FILE *fd; |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3582 char filename[256]; |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3583 |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3584 g_snprintf(filename, sizeof(filename), "%s%s", name, |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3585 (conv_type == GAIM_CONV_CHAT ? ".chat" : "")); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3586 |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3587 fd = open_log_file(filename, (conv_type == GAIM_CONV_CHAT)); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3588 |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3589 if (fd) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3590 if (!gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) |
4383
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3591 fprintf(fd, |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3592 "<HR><BR><H3 Align=Center> " |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3593 "---- New Conversation @ %s ----</H3><BR>\n", |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3594 full_date()); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3595 else |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3596 fprintf(fd, "---- New Conversation @ %s ----\n", |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3597 full_date()); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3598 |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3599 fclose(fd); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3600 } |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3601 } |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3602 |
4359 | 3603 /* Setup the container for the tab. */ |
3604 gtkconv->tab_cont = tab_cont = gtk_vbox_new(FALSE, 5); | |
3605 gtk_container_set_border_width(GTK_CONTAINER(tab_cont), 5); | |
3606 gtk_container_add(GTK_CONTAINER(tab_cont), pane); | |
3607 gtk_widget_show(pane); | |
3608 | |
3609 new_ui = TRUE; | |
4636 | 3610 |
4359 | 3611 gtkconv->make_sound = TRUE; |
3612 } | |
3613 | |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3614 g_signal_connect_swapped(G_OBJECT(pane), "focus", |
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3615 G_CALLBACK(gtk_widget_grab_focus), gtkconv->entry); |
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3616 |
4359 | 3617 gtkconv->tabby = tabby = gtk_hbox_new(FALSE, 5); |
3618 | |
3619 /* Close button. */ | |
3620 gtkconv->close = gtk_button_new(); | |
3621 gtk_widget_set_size_request(GTK_WIDGET(gtkconv->close), 16, 16); | |
3622 gtk_container_add(GTK_CONTAINER(gtkconv->close), | |
4445 | 3623 gtk_image_new_from_stock(GTK_STOCK_CLOSE, |
3624 GTK_ICON_SIZE_MENU)); | |
4359 | 3625 gtk_button_set_relief(GTK_BUTTON(gtkconv->close), GTK_RELIEF_NONE); |
3626 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->close, | |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
3627 _("Close conversation"), NULL); |
4359 | 3628 |
3629 g_signal_connect(G_OBJECT(gtkconv->close), "clicked", | |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
3630 G_CALLBACK(close_conv_cb), conv); |
4359 | 3631 |
3632 /* Tab label. */ | |
3633 gtkconv->tab_label = gtk_label_new(gaim_conversation_get_title(conv)); | |
3634 #if 0 | |
3635 gtk_misc_set_alignment(GTK_MISC(gtkconv->tab_label), 0.00, 0.5); | |
3636 gtk_misc_set_padding(GTK_MISC(gtkconv->tab_label), 4, 0); | |
3637 #endif | |
3638 | |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3639 |
4359 | 3640 /* Pack it all together. */ |
3641 gtk_box_pack_start(GTK_BOX(tabby), gtkconv->tab_label, TRUE, TRUE, 0); | |
4445 | 3642 gtk_widget_show(gtkconv->tab_label); |
3643 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
|
3644 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3645 if (gaim_prefs_get_bool("/gaim/gtk/conversations/close_on_tabs")) |
4445 | 3646 gtk_widget_show_all(gtkconv->close); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3647 |
4445 | 3648 gtk_widget_show(tabby); |
4359 | 3649 |
3650 | |
3651 /* Add this pane to the conversations notebook. */ | |
3652 gtk_notebook_append_page(GTK_NOTEBOOK(gtkwin->notebook), tab_cont, tabby); | |
3653 gtk_notebook_set_menu_label_text(GTK_NOTEBOOK(gtkwin->notebook), tab_cont, | |
3654 gaim_conversation_get_title(conv)); | |
3655 | |
3656 gtk_widget_show(tab_cont); | |
3657 | |
4818 | 3658 if (gaim_window_get_conversation_count(win) == 1) { |
3659 /* Er, bug in notebooks? Switch to the page manually. */ | |
4359 | 3660 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), 0); |
4851 | 3661 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3662 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3663 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3664 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3665 else |
4818 | 3666 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), TRUE); |
4359 | 3667 |
5204 | 3668 focus_conv = g_list_nth_data(gaim_window_get_conversations(win), |
3669 gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook))); | |
3670 focus_gtkconv = GAIM_GTK_CONVERSATION(focus_conv); | |
3671 gtk_widget_grab_focus(focus_gtkconv->entry); | |
4359 | 3672 |
3673 gaim_gtkconv_update_buddy_icon(conv); | |
3674 | |
3675 if (!new_ui) | |
3676 g_object_unref(gtkconv->tab_cont); | |
3677 | |
3678 if (gaim_window_get_conversation_count(win) == 1) | |
4685 | 3679 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); |
5367 | 3680 |
4359 | 3681 } |
3682 | |
3683 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3684 gaim_gtk_remove_conversation(GaimWindow *win, GaimConversation *conv) |
4359 | 3685 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3686 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3687 GaimGtkConversation *gtkconv; |
4359 | 3688 unsigned int index; |
4818 | 3689 GaimConversationType conv_type; |
3690 | |
3691 conv_type = gaim_conversation_get_type(conv); | |
4359 | 3692 index = gaim_conversation_get_index(conv); |
3693 | |
3694 gtkwin = GAIM_GTK_WINDOW(win); | |
3695 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3696 | |
3697 g_object_ref(gtkconv->tab_cont); | |
3698 gtk_object_sink(GTK_OBJECT(gtkconv->tab_cont)); | |
3699 | |
3700 gtk_notebook_remove_page(GTK_NOTEBOOK(gtkwin->notebook), index); | |
3701 | |
4818 | 3702 /* go back to tabless if need be */ |
3703 if (gaim_window_get_conversation_count(win) <= 2) { | |
3704 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3705 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); |
4818 | 3706 } |
3707 | |
3708 | |
4359 | 3709 /* If this window is setup with an inactive gc, regenerate the menu. */ |
4818 | 3710 if (conv_type == GAIM_CONV_IM && |
4359 | 3711 gaim_conversation_get_gc(conv) == NULL) { |
3712 | |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3713 generate_send_as_items(win, conv); |
4359 | 3714 } |
3715 } | |
3716 | |
3717 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3718 gaim_gtk_move_conversation(GaimWindow *win, GaimConversation *conv, |
4359 | 3719 unsigned int new_index) |
3720 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3721 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3722 GaimGtkConversation *gtkconv; |
4359 | 3723 |
3724 gtkwin = GAIM_GTK_WINDOW(win); | |
3725 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3726 | |
4415
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
3727 if (new_index > gaim_conversation_get_index(conv)) |
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
3728 new_index--; |
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
3729 |
4359 | 3730 gtk_notebook_reorder_child(GTK_NOTEBOOK(gtkwin->notebook), |
3731 gtkconv->tab_cont, new_index); | |
3732 } | |
3733 | |
3734 static int | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3735 gaim_gtk_get_active_index(const GaimWindow *win) |
4359 | 3736 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3737 GaimGtkWindow *gtkwin; |
5680
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
3738 int index; |
4359 | 3739 |
3740 gtkwin = GAIM_GTK_WINDOW(win); | |
3741 | |
5680
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
3742 index = gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook)); |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
3743 |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
3744 /* |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
3745 * A fix, because the first conversation may be active, but not |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
3746 * appear in the notebook just yet. -- ChipX86 |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
3747 */ |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
3748 return (index == -1 ? 0 : index); |
4359 | 3749 } |
3750 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3751 static GaimWindowUiOps window_ui_ops = |
4359 | 3752 { |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
3753 gaim_gtk_get_conversation_ui_ops, |
4359 | 3754 gaim_gtk_new_window, |
3755 gaim_gtk_destroy_window, | |
3756 gaim_gtk_show, | |
3757 gaim_gtk_hide, | |
3758 gaim_gtk_raise, | |
3759 gaim_gtk_flash, | |
3760 gaim_gtk_switch_conversation, | |
3761 gaim_gtk_add_conversation, | |
3762 gaim_gtk_remove_conversation, | |
3763 gaim_gtk_move_conversation, | |
3764 gaim_gtk_get_active_index | |
3765 }; | |
3766 | |
3767 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3768 update_convo_add_button(GaimConversation *conv) |
4359 | 3769 { |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3770 GaimPluginProtocolInfo *prpl_info = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3771 GaimGtkConversation *gtkconv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3772 GaimConnection *gc; |
4359 | 3773 GaimConversationType type; |
3774 GtkWidget *parent; | |
3775 | |
3776 type = gaim_conversation_get_type(conv); | |
3777 gc = gaim_conversation_get_gc(conv); | |
3778 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3779 parent = gtk_widget_get_parent(gtkconv->u.im->add); | |
3780 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3781 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3782 |
4687 | 3783 if (gaim_find_buddy(gc->account, gaim_conversation_get_name(conv))) { |
4397
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
3784 gtkconv->u.im->add = |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
3785 gaim_gtk_change_text(_("Remove"), gtkconv->u.im->add, |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
3786 GTK_STOCK_REMOVE, type); |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
3787 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->u.im->add, |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
3788 _("Remove the user from your buddy list"), NULL); |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
3789 |
4359 | 3790 gtk_widget_set_sensitive(gtkconv->u.im->add, |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3791 (gc != NULL && prpl_info->remove_buddy != NULL)); |
4359 | 3792 } else { |
4397
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
3793 gtkconv->u.im->add = |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
3794 gaim_gtk_change_text(_("Add"), gtkconv->u.im->add, |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
3795 GTK_STOCK_ADD, type); |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
3796 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->u.im->add, |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
3797 _("Add the user to your buddy list"), NULL); |
4359 | 3798 |
3799 gtk_widget_set_sensitive(gtkconv->u.im->add, | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3800 (gc != NULL && prpl_info->add_buddy != NULL)); |
4359 | 3801 } |
3802 | |
4397
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
3803 g_signal_connect(G_OBJECT(gtkconv->u.im->add), "clicked", |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
3804 G_CALLBACK(add_cb), conv); |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
3805 |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
3806 gtk_box_pack_start(GTK_BOX(parent), gtkconv->u.im->add, |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
3807 FALSE, FALSE, 0); |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
3808 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->u.im->add, 3); |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
3809 gtk_button_set_relief(GTK_BUTTON(gtkconv->u.im->add), GTK_RELIEF_NONE); |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
3810 gtk_size_group_add_widget(gtkconv->sg, gtkconv->u.im->add); |
4359 | 3811 } |
3812 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3813 GaimWindowUiOps * |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
3814 gaim_get_gtk_window_ui_ops(void) |
4359 | 3815 { |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
3816 return &window_ui_ops; |
4359 | 3817 } |
3818 | |
3819 /************************************************************************** | |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
3820 * Conversation UI operations |
4359 | 3821 **************************************************************************/ |
3822 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3823 gaim_gtkconv_destroy(GaimConversation *conv) |
4359 | 3824 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3825 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); |
4359 | 3826 |
3827 if (gtkconv->dialogs.fg_color != NULL) | |
3828 gtk_widget_destroy(gtkconv->dialogs.fg_color); | |
3829 | |
3830 if (gtkconv->dialogs.bg_color != NULL) | |
3831 gtk_widget_destroy(gtkconv->dialogs.bg_color); | |
3832 | |
3833 if (gtkconv->dialogs.font != NULL) | |
3834 gtk_widget_destroy(gtkconv->dialogs.font); | |
3835 | |
3836 if (gtkconv->dialogs.smiley != NULL) | |
3837 gtk_widget_destroy(gtkconv->dialogs.smiley); | |
3838 | |
3839 if (gtkconv->dialogs.link != NULL) | |
3840 gtk_widget_destroy(gtkconv->dialogs.link); | |
3841 | |
3842 if (gtkconv->dialogs.log != NULL) | |
3843 gtk_widget_destroy(gtkconv->dialogs.log); | |
3844 | |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
3845 gtk_widget_destroy(gtkconv->tab_cont); |
4892 | 3846 g_object_unref(gtkconv->tab_cont); |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
3847 |
4359 | 3848 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
4755 | 3849 if (gtkconv->u.im->icon_timer != 0) |
3850 g_source_remove(gtkconv->u.im->icon_timer); | |
3851 | |
4359 | 3852 if (gtkconv->u.im->save_icon != NULL) |
3853 gtk_widget_destroy(gtkconv->u.im->save_icon); | |
3854 | |
3855 if (gtkconv->u.im->anim != NULL) | |
4793 | 3856 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); |
4359 | 3857 |
3858 g_free(gtkconv->u.im); | |
3859 } | |
3860 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
3861 g_free(gtkconv->u.chat); | |
3862 } | |
3863 | |
4633 | 3864 gtk_object_sink(GTK_OBJECT(gtkconv->tooltips)); |
3865 | |
4359 | 3866 g_free(gtkconv); |
3867 } | |
3868 | |
3869 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3870 gaim_gtkconv_write_im(GaimConversation *conv, const char *who, |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3871 const char *message, size_t len, int flags, |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3872 time_t mtime) |
4359 | 3873 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3874 GaimGtkConversation *gtkconv; |
4359 | 3875 |
3876 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3877 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3878 if (!(flags & WFLAG_NOLOG) && |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3879 gaim_prefs_get_bool("/gaim/gtk/conversations/im/raise_on_events")) { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3880 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3881 gaim_window_raise(gaim_conversation_get_window(conv)); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3882 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3883 |
4382
76223649765b
[gaim-migrate @ 4648]
Christian Hammond <chipx86@chipx86.com>
parents:
4378
diff
changeset
|
3884 /* Play a sound, if specified in prefs. */ |
4359 | 3885 if (gtkconv->make_sound) { |
3886 if (flags & WFLAG_RECV) { | |
3887 if (gtkconv->u.im->a_virgin && | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3888 gaim_prefs_get_bool("/gaim/gtk/sound/first_im_recv")) { |
4359 | 3889 |
4561 | 3890 gaim_sound_play_event(GAIM_SOUND_FIRST_RECEIVE); |
4359 | 3891 } |
3892 else | |
4561 | 3893 gaim_sound_play_event(GAIM_SOUND_RECEIVE); |
4359 | 3894 } |
3895 else { | |
4561 | 3896 gaim_sound_play_event(GAIM_SOUND_SEND); |
4359 | 3897 } |
3898 } | |
3899 | |
3900 gtkconv->u.im->a_virgin = FALSE; | |
3901 | |
3902 gaim_conversation_write(conv, who, message, len, flags, mtime); | |
3903 } | |
3904 | |
3905 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3906 gaim_gtkconv_write_chat(GaimConversation *conv, const char *who, |
4359 | 3907 const char *message, int flags, time_t mtime) |
3908 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3909 GaimGtkConversation *gtkconv; |
4359 | 3910 |
3911 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3912 | |
4382
76223649765b
[gaim-migrate @ 4648]
Christian Hammond <chipx86@chipx86.com>
parents:
4378
diff
changeset
|
3913 /* Play a sound, if specified in prefs. */ |
4359 | 3914 if (gtkconv->make_sound) { |
3915 if (!(flags & WFLAG_WHISPER) && (flags & WFLAG_SEND)) | |
4561 | 3916 gaim_sound_play_event(GAIM_SOUND_CHAT_YOU_SAY); |
4359 | 3917 else if (flags & WFLAG_RECV) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3918 if ((flags & WFLAG_NICK) && |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3919 gaim_prefs_get_bool("/gaim/gtk/sound/nick_said")) { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3920 |
4561 | 3921 gaim_sound_play_event(GAIM_SOUND_CHAT_NICK); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3922 } |
4359 | 3923 else |
4561 | 3924 gaim_sound_play_event(GAIM_SOUND_CHAT_SAY); |
4359 | 3925 } |
3926 } | |
3927 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3928 if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/color_nicks")) |
4359 | 3929 flags |= WFLAG_COLORIZE; |
3930 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3931 /* Raise the window, if specified in prefs. */ |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3932 if (!(flags & WFLAG_NOLOG) && |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3933 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3934 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3935 gaim_window_raise(gaim_conversation_get_window(conv)); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3936 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3937 |
4359 | 3938 gaim_conversation_write(conv, who, message, -1, flags, mtime); |
3939 } | |
3940 | |
3941 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3942 gaim_gtkconv_write_conv(GaimConversation *conv, const char *who, |
4359 | 3943 const char *message, size_t length, int flags, |
3944 time_t mtime) | |
3945 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3946 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3947 GaimWindow *win; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3948 GaimConnection *gc; |
4359 | 3949 int gtk_font_options = 0; |
3950 GString *log_str; | |
3951 FILE *fd; | |
3952 char buf[BUF_LONG]; | |
3953 char buf2[BUF_LONG]; | |
3954 char mdate[64]; | |
3955 char color[10]; | |
3956 char *str; | |
3957 char *with_font_tag; | |
4896 | 3958 char *sml_attrib = NULL; |
4895 | 3959 |
3960 if(length == -1) | |
3961 length = strlen(message) + 1; | |
3962 | |
4359 | 3963 gtkconv = GAIM_GTK_CONVERSATION(conv); |
3964 gc = gaim_conversation_get_gc(conv); | |
3965 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3966 win = gaim_conversation_get_window(conv); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3967 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3968 if (!(flags & WFLAG_NOLOG) && |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3969 ((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT && |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3970 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) || |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3971 (gaim_conversation_get_type(conv) == GAIM_CONV_IM && |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3972 (gaim_prefs_get_bool("/gaim/gtk/conversations/im/raise_on_events") || |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3973 gaim_prefs_get_bool("/gaim/gtk/conversations/im/hide_on_send"))))) { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3974 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3975 gaim_window_show(win); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3976 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3977 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3978 |
5133 | 3979 if(time(NULL) > mtime + 20*60) /* show date if older than 20 minutes */ |
3980 strftime(mdate, sizeof(mdate), "%Y-%m-%d %H:%M:%S", localtime(&mtime)); | |
3981 else | |
3982 strftime(mdate, sizeof(mdate), "%H:%M:%S", localtime(&mtime)); | |
4359 | 3983 |
4896 | 3984 if(gc) |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3985 sml_attrib = g_strdup_printf("sml=\"%s\"", gc->prpl->info->name); |
4896 | 3986 |
4359 | 3987 gtk_font_options ^= GTK_IMHTML_NO_COMMENTS; |
3988 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3989 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_colors")) |
4359 | 3990 gtk_font_options ^= GTK_IMHTML_NO_COLOURS; |
3991 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3992 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_fonts")) |
4359 | 3993 gtk_font_options ^= GTK_IMHTML_NO_FONTS; |
3994 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3995 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_font_sizes")) |
4359 | 3996 gtk_font_options ^= GTK_IMHTML_NO_SIZES; |
3997 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3998 if (!gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) |
4359 | 3999 gtk_font_options ^= GTK_IMHTML_RETURN_LOG; |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4000 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4001 if (GAIM_PLUGIN_PROTOCOL_INFO(conv->account->gc->prpl)->options & |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4002 OPT_PROTO_USE_POINTSIZE) { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4003 |
5367 | 4004 gtk_font_options ^= GTK_IMHTML_USE_POINTSIZE; |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4005 } |
4359 | 4006 |
4007 if (flags & WFLAG_SYSTEM) { | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4008 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) |
5329 | 4009 g_snprintf(buf, BUF_LONG, "(%s) <B>%s</B>", |
4359 | 4010 mdate, message); |
4011 else | |
4012 g_snprintf(buf, BUF_LONG, "<B>%s</B>", message); | |
4013 | |
4014 g_snprintf(buf2, sizeof(buf2), | |
5329 | 4015 "<!--(%s) --><B>%s</B><BR>", |
4359 | 4016 mdate, message); |
4017 | |
4018 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, -1, 0); | |
4019 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4020 if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) { |
4359 | 4021 char *t1 = strip_html(buf); |
4022 | |
4023 conv->history = g_string_append(conv->history, t1); | |
4024 conv->history = g_string_append(conv->history, "\n"); | |
4025 | |
4026 g_free(t1); | |
4027 } | |
4028 else { | |
4029 conv->history = g_string_append(conv->history, buf); | |
4030 conv->history = g_string_append(conv->history, "<BR>\n"); | |
4031 } | |
4032 | |
4033 if (!(flags & WFLAG_NOLOG) && gaim_conversation_is_logging(conv)) { | |
4034 | |
4035 char *t1; | |
4036 char nm[256]; | |
4037 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4038 if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) |
4359 | 4039 t1 = strip_html(buf); |
4040 else | |
4041 t1 = buf; | |
4042 | |
4043 if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
4044 g_snprintf(nm, sizeof(nm), "%s.chat", | |
4045 gaim_conversation_get_name(conv)); | |
4046 else | |
4047 strncpy(nm, gaim_conversation_get_name(conv), sizeof(nm)); | |
4048 | |
4049 fd = open_log_file(nm, | |
4050 (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT)); | |
4051 | |
4052 if (fd) { | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4053 if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) |
4359 | 4054 fprintf(fd, "%s\n", t1); |
4055 else | |
4056 fprintf(fd, "%s<BR>\n", t1); | |
4057 | |
4058 fclose(fd); | |
4059 } | |
4060 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4061 if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) |
4359 | 4062 g_free(t1); |
4063 } | |
4064 } | |
4065 else if (flags & WFLAG_NOLOG) { | |
4066 g_snprintf(buf, BUF_LONG, | |
4067 "<B><FONT COLOR=\"#777777\">%s</FONT></B><BR>", | |
4068 message); | |
4069 | |
4070 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf, -1, 0); | |
4071 } | |
4072 else { | |
4895 | 4073 char *new_message = g_memdup(message, length); |
4074 | |
4359 | 4075 if (flags & WFLAG_WHISPER) { |
4076 str = g_malloc(1024); | |
4077 | |
4078 /* If we're whispering, it's not an autoresponse. */ | |
4079 if (meify(new_message, length)) { | |
4080 g_snprintf(str, 1024, "***%s", who); | |
4081 strcpy(color, "#6C2585"); | |
4082 } | |
4083 else { | |
4084 g_snprintf(str, 1024, "*%s*:", who); | |
4085 strcpy(color, "#00FF00"); | |
4086 } | |
4087 } | |
4088 else { | |
4089 if (meify(new_message, length)) { | |
4090 str = g_malloc(1024); | |
4091 | |
4092 if (flags & WFLAG_AUTO) | |
4093 g_snprintf(str, 1024, "%s ***%s", AUTO_RESPONSE, who); | |
4094 else | |
4095 g_snprintf(str, 1024, "***%s", who); | |
4096 | |
4097 if (flags & WFLAG_NICK) | |
4098 strcpy(color, "#AF7F00"); | |
4099 else | |
4100 strcpy(color, "#062585"); | |
4101 } | |
4102 else { | |
4103 str = g_malloc(1024); | |
4104 | |
4105 if (flags & WFLAG_AUTO) | |
4106 g_snprintf(str, 1024, "%s %s", who, AUTO_RESPONSE); | |
4107 else | |
4108 g_snprintf(str, 1024, "%s:", who); | |
4109 | |
4110 if (flags & WFLAG_NICK) | |
4111 strcpy(color, "#AF7F00"); | |
4112 else if (flags & WFLAG_RECV) { | |
4113 if (flags & WFLAG_COLORIZE) { | |
4114 const char *u; | |
4115 int m = 0; | |
4116 | |
4117 for (u = who; *u != '\0'; u++) | |
4118 m += *u; | |
4119 | |
4120 m = m % NUM_NICK_COLORS; | |
4121 | |
4122 strcpy(color, nick_colors[m]); | |
4123 } | |
4124 else | |
4125 strcpy(color, "#A82F2F"); | |
4126 } | |
4127 else if (flags & WFLAG_SEND) | |
4128 strcpy(color, "#16569E"); | |
4129 } | |
4130 } | |
4131 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4132 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) |
4359 | 4133 g_snprintf(buf, BUF_LONG, |
5329 | 4134 "<FONT COLOR=\"%s\" %s>(%s) " |
4896 | 4135 "<B>%s</B></FONT> ", color, |
4136 sml_attrib ? sml_attrib : "", mdate, str); | |
4359 | 4137 else |
4138 g_snprintf(buf, BUF_LONG, | |
4896 | 4139 "<FONT COLOR=\"%s\" %s><B>%s</B></FONT> ", color, |
4140 sml_attrib ? sml_attrib : "", str); | |
4359 | 4141 |
4142 g_snprintf(buf2, BUF_LONG, | |
5329 | 4143 "<FONT COLOR=\"%s\" %s><!--(%s) -->" |
4359 | 4144 "<B>%s</B></FONT> ", |
4896 | 4145 color, sml_attrib ? sml_attrib : "", mdate, str); |
4359 | 4146 |
4147 g_free(str); | |
4148 | |
4149 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, -1, 0); | |
4150 | |
4895 | 4151 if(gc){ |
4896 | 4152 char *pre = g_strdup_printf("<font %s>", sml_attrib ? sml_attrib : ""); |
4895 | 4153 char *post = "</font>"; |
4154 int pre_len = strlen(pre); | |
4155 int post_len = strlen(post); | |
4156 | |
4157 with_font_tag = g_malloc(length + pre_len + post_len + 1); | |
4158 | |
4159 strcpy(with_font_tag, pre); | |
4160 memcpy(with_font_tag + pre_len, new_message, length); | |
4161 strcpy(with_font_tag + pre_len + length, post); | |
4162 | |
4163 length += pre_len + post_len; | |
4164 g_free(pre); | |
4165 } | |
4608 | 4166 else |
4895 | 4167 with_font_tag = g_memdup(new_message, length); |
4359 | 4168 |
4169 log_str = gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), | |
4895 | 4170 with_font_tag, length, gtk_font_options); |
4359 | 4171 |
4172 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", -1, 0); | |
4173 | |
4174 /* XXX This needs to be updated for the new length argument. */ | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4175 if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) { |
4359 | 4176 char *t1, *t2; |
4177 | |
4178 t1 = strip_html(buf); | |
4179 t2 = strip_html(new_message); | |
4180 | |
4181 conv->history = g_string_append(conv->history, t1); | |
4182 conv->history = g_string_append(conv->history, t2); | |
4183 conv->history = g_string_append(conv->history, "\n"); | |
4184 | |
4185 g_free(t1); | |
4186 g_free(t2); | |
4187 } | |
4188 else { | |
4189 char *t1, *t2; | |
4190 | |
4191 t1 = html_logize(buf); | |
4192 t2 = html_logize(new_message); | |
4193 | |
4194 conv->history = g_string_append(conv->history, t1); | |
4195 conv->history = g_string_append(conv->history, t2); | |
4196 conv->history = g_string_append(conv->history, "\n"); | |
4197 conv->history = g_string_append(conv->history, log_str->str); | |
4198 conv->history = g_string_append(conv->history, "<BR>\n"); | |
4199 | |
4200 g_free(t1); | |
4201 g_free(t2); | |
4202 } | |
4203 | |
4204 /* XXX This needs to be updated for the new length argument. */ | |
4205 if (gaim_conversation_is_logging(conv)) { | |
4206 char *t1, *t2; | |
4207 char nm[256]; | |
4208 | |
4209 if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
4210 g_snprintf(nm, sizeof(nm), "%s.chat", | |
4211 gaim_conversation_get_name(conv)); | |
4212 else | |
4213 strncpy(nm, gaim_conversation_get_name(conv), sizeof(nm)); | |
4214 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4215 if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) { |
4359 | 4216 t1 = strip_html(buf); |
4217 t2 = strip_html(with_font_tag); | |
4218 } | |
4219 else { | |
4220 t1 = html_logize(buf); | |
4221 t2 = html_logize(with_font_tag); | |
4222 } | |
4223 | |
4224 fd = open_log_file(nm, | |
4225 (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT)); | |
4226 | |
4227 if (fd) { | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4228 if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) |
4359 | 4229 fprintf(fd, "%s%s\n", t1, t2); |
4230 else { | |
4231 fprintf(fd, "%s%s%s<BR>\n", t1, t2, log_str->str); | |
4232 g_string_free(log_str, TRUE); | |
4233 } | |
4234 | |
4235 fclose(fd); | |
4236 } | |
4237 | |
4238 g_free(t1); | |
4239 g_free(t2); | |
4240 } | |
4241 | |
4242 g_free(with_font_tag); | |
4243 g_free(new_message); | |
4244 } | |
5012 | 4245 if(sml_attrib) |
4246 g_free(sml_attrib); | |
4359 | 4247 } |
4248 | |
4249 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4250 gaim_gtkconv_chat_add_user(GaimConversation *conv, const char *user) |
4359 | 4251 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4252 GaimChat *chat; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4253 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4254 GaimGtkChatPane *gtkchat; |
4359 | 4255 char tmp[BUF_LONG]; |
4256 int num_users; | |
4257 int pos; | |
4258 | |
4259 chat = GAIM_CHAT(conv); | |
4260 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4261 gtkchat = gtkconv->u.chat; | |
4262 | |
4263 num_users = g_list_length(gaim_chat_get_users(chat)); | |
4264 | |
4265 g_snprintf(tmp, sizeof(tmp), | |
4266 ngettext("%d person in room", "%d people in room", | |
4267 num_users), | |
4268 num_users); | |
4269 | |
4270 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); | |
4271 | |
4272 if (gtkconv->make_sound) | |
4561 | 4273 gaim_sound_play_event(GAIM_SOUND_CHAT_JOIN); |
4359 | 4274 |
4275 pos = g_list_index(gaim_chat_get_users(chat), user); | |
4276 | |
4277 add_chat_buddy_common(conv, user, pos); | |
4278 } | |
4279 | |
4280 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4281 gaim_gtkconv_chat_rename_user(GaimConversation *conv, const char *old_name, |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4282 const char *new_name) |
4359 | 4283 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4284 GaimChat *chat; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4285 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4286 GaimGtkChatPane *gtkchat; |
4359 | 4287 GtkTreeIter iter; |
4288 GtkTreeModel *model; | |
4289 GList *names; | |
4290 int pos; | |
4291 int f = 1; | |
4292 | |
4293 chat = GAIM_CHAT(conv); | |
4294 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4295 gtkchat = gtkconv->u.chat; | |
4296 | |
4297 for (names = gaim_chat_get_users(chat); | |
4298 names != NULL; | |
4299 names = names->next) { | |
4300 | |
4301 char *u = (char *)names->data; | |
4302 | |
4793 | 4303 if (!gaim_utf8_strcasecmp(u, old_name)) { |
4359 | 4304 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
4305 | |
4306 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
4307 break; | |
4308 | |
4309 while (f != 0) { | |
4310 char *val; | |
4311 | |
4312 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &val, -1); | |
4313 | |
4793 | 4314 if (!gaim_utf8_strcasecmp(old_name, val)) { |
4359 | 4315 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
4640 | 4316 break; |
4317 } | |
4359 | 4318 |
4319 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
4320 | |
4321 g_free(val); | |
4322 } | |
4323 | |
4324 break; | |
4325 } | |
4326 } | |
4327 | |
4328 if (!names) | |
4329 return; | |
4330 | |
4331 pos = g_list_index(gaim_chat_get_users(chat), new_name); | |
4332 | |
4333 add_chat_buddy_common(conv, new_name, pos); | |
4334 } | |
4335 | |
4336 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4337 gaim_gtkconv_chat_remove_user(GaimConversation *conv, const char *user) |
4359 | 4338 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4339 GaimChat *chat; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4340 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4341 GaimGtkChatPane *gtkchat; |
4359 | 4342 GtkTreeIter iter; |
4343 GtkTreeModel *model; | |
4344 GList *names; | |
4345 char tmp[BUF_LONG]; | |
4346 int num_users; | |
4347 int f = 1; | |
4348 | |
4349 chat = GAIM_CHAT(conv); | |
4350 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4351 gtkchat = gtkconv->u.chat; | |
4352 | |
4353 num_users = g_list_length(gaim_chat_get_users(chat)) - 1; | |
4354 | |
4355 for (names = gaim_chat_get_users(chat); | |
4356 names != NULL; | |
4357 names = names->next) { | |
4358 | |
4359 char *u = (char *)names->data; | |
4360 | |
4793 | 4361 if (!gaim_utf8_strcasecmp(u, user)) { |
4359 | 4362 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
4363 | |
4364 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
4365 break; | |
4366 | |
4367 while (f != 0) { | |
4368 char *val; | |
4369 | |
4370 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &val, -1); | |
4371 | |
4793 | 4372 if (!gaim_utf8_strcasecmp(user, val)) |
4359 | 4373 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
4374 | |
4375 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
4376 | |
4377 g_free(val); | |
4378 } | |
4379 | |
4380 break; | |
4381 } | |
4382 } | |
4383 | |
4384 if (names == NULL) | |
4385 return; | |
4386 | |
4387 g_snprintf(tmp, sizeof(tmp), | |
4388 ngettext("%d person in room", "%d people in room", | |
4389 num_users), num_users); | |
4390 | |
4391 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); | |
4392 | |
4393 if (gtkconv->make_sound) | |
4561 | 4394 gaim_sound_play_event(GAIM_SOUND_CHAT_LEAVE); |
4359 | 4395 } |
4396 | |
4397 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4398 gaim_gtkconv_set_title(GaimConversation *conv, const char *title) |
4359 | 4399 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4400 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4401 GaimWindow *win; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4402 GaimGtkWindow *gtkwin; |
4681 | 4403 |
4404 win = gaim_conversation_get_window(conv); | |
4405 gtkwin = GAIM_GTK_WINDOW(win); | |
4359 | 4406 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4407 | |
4408 gtk_label_set_text(GTK_LABEL(gtkconv->tab_label), title); | |
4681 | 4409 |
4410 if(conv == gaim_window_get_active_conversation(win)) | |
4411 gtk_window_set_title(GTK_WINDOW(gtkwin->window), title); | |
4359 | 4412 } |
4413 | |
4414 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4415 gaim_gtkconv_updated(GaimConversation *conv, GaimConvUpdateType type) |
4359 | 4416 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4417 GaimWindow *win; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4418 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4419 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4420 GaimGtkChatPane *gtkchat; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4421 GaimChat *chat; |
4359 | 4422 |
4423 win = gaim_conversation_get_window(conv); | |
4736 | 4424 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4425 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4426 | |
4491 | 4427 if (type == GAIM_CONV_UPDATE_ACCOUNT) { |
4359 | 4428 gaim_conversation_autoset_title(conv); |
4429 gaim_gtkconv_update_buddy_icon(conv); | |
4430 gaim_gtkconv_update_buttons_by_protocol(conv); | |
4431 | |
4685 | 4432 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); |
4359 | 4433 |
4434 smiley_themeize(gtkconv->imhtml); | |
4435 } | |
4436 else if (type == GAIM_CONV_UPDATE_TYPING || | |
4437 type == GAIM_CONV_UPDATE_UNSEEN) { | |
4438 GtkStyle *style; | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4439 GaimIm *im = NULL; |
4359 | 4440 |
4736 | 4441 |
4359 | 4442 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
4443 im = GAIM_IM(conv); | |
4444 | |
4445 style = gtk_style_new(); | |
4446 | |
4447 if (!GTK_WIDGET_REALIZED(gtkconv->tab_label)) | |
4448 gtk_widget_realize(gtkconv->tab_label); | |
4449 | |
4757 | 4450 pango_font_description_free(style->font_desc); |
4635 | 4451 style->font_desc = pango_font_description_copy( |
4452 gtk_widget_get_style(gtkconv->tab_label)->font_desc); | |
4359 | 4453 |
4454 if (im != NULL && gaim_im_get_typing_state(im) == TYPING) { | |
4577 | 4455 style->fg[GTK_STATE_NORMAL].red = 0x4646; |
4456 style->fg[GTK_STATE_NORMAL].green = 0xA0A0; | |
4457 style->fg[GTK_STATE_NORMAL].blue = 0x4646; | |
4458 style->fg[GTK_STATE_ACTIVE] = style->fg[GTK_STATE_NORMAL]; | |
4359 | 4459 } |
4460 else if (im != NULL && gaim_im_get_typing_state(im) == TYPED) { | |
4577 | 4461 style->fg[GTK_STATE_NORMAL].red = 0xD1D1; |
4462 style->fg[GTK_STATE_NORMAL].green = 0x9494; | |
4463 style->fg[GTK_STATE_NORMAL].blue = 0x0C0C; | |
4464 style->fg[GTK_STATE_ACTIVE] = style->fg[GTK_STATE_NORMAL]; | |
4359 | 4465 } |
4466 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_NICK) { | |
4577 | 4467 style->fg[GTK_STATE_ACTIVE].red = 0x3131; |
4468 style->fg[GTK_STATE_ACTIVE].green = 0x4E4E; | |
4469 style->fg[GTK_STATE_ACTIVE].blue = 0x6C6C; | |
4578 | 4470 style->fg[GTK_STATE_NORMAL] = style->fg[GTK_STATE_ACTIVE]; |
4359 | 4471 } |
4472 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_TEXT) { | |
4577 | 4473 style->fg[GTK_STATE_ACTIVE].red = 0xDFDF; |
4474 style->fg[GTK_STATE_ACTIVE].green = 0x4242; | |
4475 style->fg[GTK_STATE_ACTIVE].blue = 0x1E1E; | |
4578 | 4476 style->fg[GTK_STATE_NORMAL] = style->fg[GTK_STATE_ACTIVE]; |
4359 | 4477 } |
4478 | |
4479 gtk_widget_set_style(gtkconv->tab_label, style); | |
4635 | 4480 g_object_unref(G_OBJECT(style)); |
4736 | 4481 |
4812 | 4482 if(conv == gaim_window_get_active_conversation(win)) { |
4736 | 4483 update_typing_icon(conv); |
4484 } | |
4485 | |
4359 | 4486 } |
4487 else if (type == GAIM_CONV_UPDATE_TOPIC) { | |
4488 chat = GAIM_CHAT(conv); | |
4489 gtkchat = gtkconv->u.chat; | |
4490 | |
4491 gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), | |
4492 gaim_chat_get_topic(chat)); | |
4493 } | |
4494 else if (type == GAIM_CONV_ACCOUNT_ONLINE || | |
4495 type == GAIM_CONV_ACCOUNT_OFFLINE) { | |
4496 | |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
4497 generate_send_as_items(win, NULL); |
4359 | 4498 } |
4397
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4499 else if(type == GAIM_CONV_UPDATE_ADD || |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4500 type == GAIM_CONV_UPDATE_REMOVE) { |
4736 | 4501 |
4397
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4502 update_convo_add_button(conv); |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4503 } |
4359 | 4504 } |
4505 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4506 static GaimConversationUiOps conversation_ui_ops = |
4359 | 4507 { |
4508 gaim_gtkconv_destroy, /* destroy_conversation */ | |
4509 gaim_gtkconv_write_chat, /* write_chat */ | |
4510 gaim_gtkconv_write_im, /* write_im */ | |
4511 gaim_gtkconv_write_conv, /* write_conv */ | |
4512 gaim_gtkconv_chat_add_user, /* chat_add_user */ | |
4513 gaim_gtkconv_chat_rename_user, /* chat_rename_user */ | |
4514 gaim_gtkconv_chat_remove_user, /* chat_remove_user */ | |
4515 gaim_gtkconv_set_title, /* set_title */ | |
4516 NULL, /* update_progress */ | |
4517 gaim_gtkconv_updated /* updated */ | |
4518 }; | |
4519 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4520 GaimConversationUiOps * |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4521 gaim_get_gtk_conversation_ui_ops(void) |
4359 | 4522 { |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4523 return &conversation_ui_ops; |
4359 | 4524 } |
4525 | |
4526 /************************************************************************** | |
4527 * Public conversation utility functions | |
4528 **************************************************************************/ | |
4529 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4530 remove_icon(GaimGtkConversation *gtkconv) |
4359 | 4531 { |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
4532 g_return_if_fail(gtkconv != NULL); |
4359 | 4533 |
4534 if (gtkconv->u.im->icon != NULL) | |
4535 gtk_container_remove(GTK_CONTAINER(gtkconv->bbox), | |
4536 gtkconv->u.im->icon->parent->parent); | |
4537 | |
4538 if (gtkconv->u.im->anim != NULL) | |
4793 | 4539 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); |
4359 | 4540 |
4541 if (gtkconv->u.im->icon_timer != 0) | |
4542 g_source_remove(gtkconv->u.im->icon_timer); | |
4543 | |
4544 if (gtkconv->u.im->iter != NULL) | |
4545 g_object_unref(G_OBJECT(gtkconv->u.im->iter)); | |
4546 | |
4547 gtkconv->u.im->icon_timer = 0; | |
4548 gtkconv->u.im->icon = NULL; | |
4549 gtkconv->u.im->anim = NULL; | |
4550 gtkconv->u.im->iter = NULL; | |
4551 } | |
4552 | |
4553 static gboolean | |
4554 redraw_icon(gpointer data) | |
4555 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4556 GaimConversation *conv = (GaimConversation *)data; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4557 GaimGtkConversation *gtkconv; |
4359 | 4558 |
4559 GdkPixbuf *buf; | |
4560 GdkPixbuf *scale; | |
4561 GdkPixmap *pm; | |
4562 GdkBitmap *bm; | |
4563 gint delay; | |
4564 | |
4565 if (!g_list_find(gaim_get_ims(), conv)) { | |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
4566 gaim_debug(GAIM_DEBUG_WARNING, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
4567 "Conversation not found in redraw_icon. I think this " |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
4568 "is a bug.\n"); |
4359 | 4569 return FALSE; |
4570 } | |
4571 | |
4572 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4573 | |
4574 gdk_pixbuf_animation_iter_advance(gtkconv->u.im->iter, NULL); | |
4575 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); | |
4576 | |
4577 scale = gdk_pixbuf_scale_simple(buf, | |
4578 MAX(gdk_pixbuf_get_width(buf) * SCALE(gtkconv->u.im->anim) / | |
4579 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), | |
4580 MAX(gdk_pixbuf_get_height(buf) * SCALE(gtkconv->u.im->anim) / | |
4581 gdk_pixbuf_animation_get_height(gtkconv->u.im->anim), 1), | |
4582 GDK_INTERP_NEAREST); | |
4583 | |
4584 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); | |
4793 | 4585 g_object_unref(G_OBJECT(scale)); |
4635 | 4586 gtk_image_set_from_pixmap(GTK_IMAGE(gtkconv->u.im->icon), pm, bm); |
4793 | 4587 g_object_unref(G_OBJECT(pm)); |
4359 | 4588 gtk_widget_queue_draw(gtkconv->u.im->icon); |
4589 | |
4590 if (bm) | |
4793 | 4591 g_object_unref(G_OBJECT(bm)); |
4359 | 4592 |
4593 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter) / 10; | |
4594 | |
4595 gtkconv->u.im->icon_timer = g_timeout_add(delay * 10, redraw_icon, conv); | |
4596 | |
4597 return FALSE; | |
4598 } | |
4599 | |
4600 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4601 start_anim(GtkObject *obj, GaimConversation *conv) |
4359 | 4602 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4603 GaimGtkConversation *gtkconv; |
4359 | 4604 int delay; |
4605 | |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
4606 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
4359 | 4607 return; |
4608 | |
4609 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4610 | |
4611 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter) / 10; | |
4612 | |
4613 if (gtkconv->u.im->anim) | |
4614 gtkconv->u.im->icon_timer = g_timeout_add(delay * 10, redraw_icon, | |
4615 conv); | |
4616 } | |
4617 | |
4618 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4619 stop_anim(GtkObject *obj, GaimConversation *conv) |
4359 | 4620 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4621 GaimGtkConversation *gtkconv; |
4359 | 4622 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
4623 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
4359 | 4624 return; |
4625 | |
4626 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4627 | |
4628 if (gtkconv->u.im->icon_timer != 0) | |
4629 g_source_remove(gtkconv->u.im->icon_timer); | |
4630 | |
4631 gtkconv->u.im->icon_timer = 0; | |
4632 } | |
4633 | |
4634 static gboolean | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4635 icon_menu(GtkObject *obj, GdkEventButton *e, GaimConversation *conv) |
4359 | 4636 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4637 GaimGtkConversation *gtkconv; |
4359 | 4638 static GtkWidget *menu = NULL; |
4639 GtkWidget *button; | |
4640 | |
4641 if (e->button != 3 || e->type != GDK_BUTTON_PRESS) | |
4642 return FALSE; | |
4643 | |
4644 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4645 | |
4646 /* | |
4647 * If a menu already exists, destroy it before creating a new one, | |
4648 * thus freeing-up the memory it occupied. | |
4649 */ | |
4650 if (menu != NULL) | |
4651 gtk_widget_destroy(menu); | |
4652 | |
4653 menu = gtk_menu_new(); | |
4654 | |
4655 if (gtkconv->u.im->icon_timer) { | |
4656 button = gtk_menu_item_new_with_label(_("Disable Animation")); | |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
4657 g_signal_connect(G_OBJECT(button), "activate", |
4359 | 4658 G_CALLBACK(stop_anim), conv); |
4659 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
4660 gtk_widget_show(button); | |
4661 } | |
4662 else if (gtkconv->u.im->anim && | |
4663 !(gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim))) | |
4664 { | |
4665 button = gtk_menu_item_new_with_label(_("Enable Animation")); | |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
4666 g_signal_connect(G_OBJECT(button), "activate", |
4359 | 4667 G_CALLBACK(start_anim), conv); |
4668 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
4669 gtk_widget_show(button); | |
4670 } | |
4671 | |
4672 button = gtk_menu_item_new_with_label(_("Hide Icon")); | |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
4673 g_signal_connect_swapped(G_OBJECT(button), "activate", |
4515
9b9737a00a96
[gaim-migrate @ 4793]
Christian Hammond <chipx86@chipx86.com>
parents:
4513
diff
changeset
|
4674 G_CALLBACK(remove_icon), gtkconv); |
4359 | 4675 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); |
4676 gtk_widget_show(button); | |
4677 | |
4678 button = gtk_menu_item_new_with_label(_("Save Icon As...")); | |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
4679 g_signal_connect(G_OBJECT(button), "activate", |
4359 | 4680 G_CALLBACK(gaim_gtk_save_icon_dialog), conv); |
4681 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
4682 gtk_widget_show(button); | |
4683 | |
4684 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, e->button, e->time); | |
4685 | |
4686 return TRUE; | |
4687 } | |
4688 | |
4689 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4690 gaim_gtkconv_update_buddy_icon(GaimConversation *conv) |
4359 | 4691 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4692 GaimGtkConversation *gtkconv; |
4359 | 4693 |
4694 char filename[256]; | |
4695 FILE *file; | |
4696 GError *err = NULL; | |
5462
8355eeeb52a3
[gaim-migrate @ 5853]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
4697 gboolean animate = TRUE; |
4359 | 4698 |
4757 | 4699 struct buddy *buddy; |
4700 | |
4359 | 4701 void *data; |
4702 int len, delay; | |
4703 | |
4704 GdkPixbuf *buf; | |
4705 | |
4706 GtkWidget *event; | |
4707 GtkWidget *frame; | |
4708 GdkPixbuf *scale; | |
4709 GdkPixmap *pm; | |
4710 GdkBitmap *bm; | |
4711 int sf = 0; | |
4712 | |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
4713 g_return_if_fail(conv != NULL); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
4714 g_return_if_fail(GAIM_IS_GTK_CONVERSATION(conv)); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
4715 g_return_if_fail(gaim_conversation_get_type(conv) == GAIM_CONV_IM); |
4359 | 4716 |
4717 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4718 | |
5462
8355eeeb52a3
[gaim-migrate @ 5853]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
4719 if (gtkconv->u.im->icon_timer == 0 && gtkconv->u.im->icon != NULL) |
8355eeeb52a3
[gaim-migrate @ 5853]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
4720 animate = FALSE; |
8355eeeb52a3
[gaim-migrate @ 5853]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
4721 |
4359 | 4722 remove_icon(gtkconv); |
4723 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4724 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/im/show_buddy_icons")) |
4359 | 4725 return; |
4726 | |
4727 if (gaim_conversation_get_gc(conv) == NULL) | |
4728 return; | |
4729 | |
4793 | 4730 if(gtkconv->u.im->anim) |
4731 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); | |
4732 | |
4757 | 4733 if((buddy = gaim_find_buddy(gaim_conversation_get_account(conv), |
4734 gaim_conversation_get_name(conv))) != NULL) { | |
4735 char *file = gaim_buddy_get_setting(buddy, "buddy_icon"); | |
4736 if(file) { | |
4737 gtkconv->u.im->anim = gdk_pixbuf_animation_new_from_file(file, &err); | |
4738 g_free(file); | |
4739 } | |
4740 } else { | |
4741 data = get_icon_data(gaim_conversation_get_gc(conv), | |
4742 normalize(gaim_conversation_get_name(conv)), | |
4743 &len); | |
4744 | |
4745 if (!data) | |
4746 return; | |
4747 | |
4748 /* this is such an evil hack, i don't know why i'm even considering it. | |
4749 * we'll do it differently when gdk-pixbuf-loader isn't leaky anymore. */ | |
4750 g_snprintf(filename, sizeof(filename), | |
4751 "%s" G_DIR_SEPARATOR_S "gaimicon-%s.%d", | |
4752 g_get_tmp_dir(), gaim_conversation_get_name(conv), getpid()); | |
4753 | |
4754 if (!(file = fopen(filename, "wb"))) | |
4755 return; | |
4756 | |
4757 fwrite(data, 1, len, file); | |
4758 fclose(file); | |
4759 | |
4760 gtkconv->u.im->anim = gdk_pixbuf_animation_new_from_file(filename, &err); | |
4761 /* make sure we remove the file as soon as possible */ | |
4762 unlink(filename); | |
4763 } | |
4359 | 4764 |
4765 if (err) { | |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
4766 gaim_debug(GAIM_DEBUG_ERROR, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
4767 "Buddy icon error: %s\n", err->message); |
4359 | 4768 g_error_free(err); |
4769 } | |
4770 | |
4771 | |
4772 if (!gtkconv->u.im->anim) | |
4773 return; | |
4774 | |
4793 | 4775 if(gtkconv->u.im->iter) |
4776 g_object_unref(G_OBJECT(gtkconv->u.im->iter)); | |
4777 | |
4359 | 4778 if (gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim)) { |
4779 gtkconv->u.im->iter = NULL; | |
4780 delay = 0; | |
4781 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); | |
4782 } else { | |
4783 gtkconv->u.im->iter = | |
4784 gdk_pixbuf_animation_get_iter(gtkconv->u.im->anim, NULL); | |
4785 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); | |
4786 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter); | |
4787 delay = delay / 10; | |
4788 } | |
4789 | |
4790 sf = SCALE(gtkconv->u.im->anim); | |
4791 scale = gdk_pixbuf_scale_simple(buf, | |
4792 MAX(gdk_pixbuf_get_width(buf) * sf / | |
4793 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), | |
4794 MAX(gdk_pixbuf_get_height(buf) * sf / | |
4795 gdk_pixbuf_animation_get_height(gtkconv->u.im->anim), 1), | |
4796 GDK_INTERP_NEAREST); | |
4797 | |
4798 if (delay) | |
4799 gtkconv->u.im->icon_timer = g_timeout_add(delay * 10, redraw_icon, | |
4800 conv); | |
4801 | |
4802 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); | |
4793 | 4803 g_object_unref(G_OBJECT(scale)); |
4359 | 4804 |
4805 frame = gtk_frame_new(NULL); | |
4806 gtk_frame_set_shadow_type(GTK_FRAME(frame), | |
4807 (bm ? GTK_SHADOW_NONE : GTK_SHADOW_IN)); | |
4808 gtk_box_pack_start(GTK_BOX(gtkconv->bbox), frame, FALSE, FALSE, 5); | |
4809 gtk_box_reorder_child(GTK_BOX(gtkconv->bbox), frame, 0); | |
4810 gtk_widget_show(frame); | |
4811 | |
4812 event = gtk_event_box_new(); | |
4813 gtk_container_add(GTK_CONTAINER(frame), event); | |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
4814 g_signal_connect(G_OBJECT(event), "button-press-event", |
4359 | 4815 G_CALLBACK(icon_menu), conv); |
4816 gtk_widget_show(event); | |
4817 | |
4635 | 4818 gtkconv->u.im->icon = gtk_image_new_from_pixmap(pm, bm); |
4359 | 4819 gtk_widget_set_size_request(gtkconv->u.im->icon, sf, sf); |
4820 gtk_container_add(GTK_CONTAINER(event), gtkconv->u.im->icon); | |
4821 gtk_widget_show(gtkconv->u.im->icon); | |
4822 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4823 if (!animate || |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4824 !gaim_prefs_get_bool("/gaim/gtk/conversations/im/animate_buddy_icons")) { |
4359 | 4825 stop_anim(NULL, conv); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4826 } |
4359 | 4827 |
4793 | 4828 g_object_unref(G_OBJECT(pm)); |
4359 | 4829 |
4830 if (bm) | |
4793 | 4831 g_object_unref(G_OBJECT(bm)); |
4359 | 4832 } |
4833 | |
4834 void | |
4835 gaim_gtkconv_update_font_buttons(void) | |
4836 { | |
4837 GList *l; | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4838 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4839 GaimGtkConversation *gtkconv; |
4359 | 4840 |
4841 for (l = gaim_get_ims(); l != NULL; l = l->next) { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4842 conv = (GaimConversation *)l->data; |
4359 | 4843 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
4844 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
4359 | 4845 continue; |
4846 | |
4847 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4848 | |
4849 if (gtkconv->toolbar.bold != NULL) | |
4850 gtk_widget_set_sensitive(gtkconv->toolbar.bold, | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4851 !gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold")); |
4359 | 4852 |
4853 if (gtkconv->toolbar.italic != NULL) | |
4854 gtk_widget_set_sensitive(gtkconv->toolbar.italic, | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4855 !gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic")); |
4359 | 4856 |
4857 if (gtkconv->toolbar.underline != NULL) | |
4858 gtk_widget_set_sensitive(gtkconv->toolbar.underline, | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4859 !gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline")); |
4359 | 4860 } |
4861 } | |
4862 | |
4863 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4864 gaim_gtkconv_update_font_colors(GaimConversation *conv) |
4421 | 4865 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4866 GaimGtkConversation *gtkconv; |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
4867 |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
4868 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
4869 return; |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
4870 |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
4871 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4872 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4873 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4874 >kconv->fg_color); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4875 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4876 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4877 >kconv->bg_color); |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
4878 } |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
4879 |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
4880 void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4881 gaim_gtkconv_update_font_face(GaimConversation *conv) |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
4882 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4883 GaimGtkConversation *gtkconv; |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
4884 |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
4885 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
4886 return; |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
4887 |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
4888 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
4889 |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
4890 strncpy(gtkconv->fontface, fontface, 128); |
4421 | 4891 } |
4892 | |
4893 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4894 gaim_gtkconv_update_buttons_by_protocol(GaimConversation *conv) |
4359 | 4895 { |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4896 GaimPluginProtocolInfo *prpl_info = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4897 GaimWindow *win; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4898 GaimGtkWindow *gtkwin = NULL; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4899 GaimGtkConversation *gtkconv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
4900 GaimConnection *gc; |
4359 | 4901 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
4902 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
4359 | 4903 return; |
4904 | |
4905 gc = gaim_conversation_get_gc(conv); | |
4906 win = gaim_conversation_get_window(conv); | |
4907 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4908 | |
4909 if (win != NULL) | |
4910 gtkwin = GAIM_GTK_WINDOW(win); | |
4911 | |
4912 if (gc == NULL) { | |
4913 gtk_widget_set_sensitive(gtkconv->send, FALSE); | |
4914 | |
4365
6e96ced6fb78
[gaim-migrate @ 4631]
Christian Hammond <chipx86@chipx86.com>
parents:
4364
diff
changeset
|
4915 if (win != NULL && gaim_window_get_active_conversation(win) == conv) { |
4359 | 4916 gtk_widget_set_sensitive(gtkwin->menu.insert_link, FALSE); |
4917 } | |
4918 } | |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
4919 else { |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4920 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4921 |
4674 | 4922 gtk_widget_set_sensitive(gtkconv->send, TRUE); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
4923 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
4924 if (win != NULL) |
4365
6e96ced6fb78
[gaim-migrate @ 4631]
Christian Hammond <chipx86@chipx86.com>
parents:
4364
diff
changeset
|
4925 gtk_widget_set_sensitive(gtkwin->menu.insert_link, TRUE); |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
4926 } |
4359 | 4927 |
4928 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
4929 if (gc == NULL) { | |
4930 gtk_widget_set_sensitive(gtkconv->info, FALSE); | |
4931 gtk_widget_set_sensitive(gtkconv->u.im->warn, FALSE); | |
4932 gtk_widget_set_sensitive(gtkconv->u.im->block, FALSE); | |
4933 gtk_widget_set_sensitive(gtkconv->u.im->add, FALSE); | |
4934 | |
4935 if (win != NULL && | |
4936 gaim_window_get_active_conversation(win) == conv) { | |
4937 | |
4938 gtk_widget_set_sensitive(gtkwin->menu.insert_image, FALSE); | |
4939 } | |
4940 | |
4941 return; | |
4942 } | |
4943 | |
4944 gtk_widget_set_sensitive(gtkconv->info, | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4945 (prpl_info->get_info != NULL)); |
4359 | 4946 |
4947 gtk_widget_set_sensitive(gtkconv->toolbar.image, | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4948 (prpl_info->options & OPT_PROTO_IM_IMAGE)); |
4359 | 4949 |
4950 if (win != NULL && gaim_window_get_active_conversation(win) == conv) { | |
4951 gtk_widget_set_sensitive(gtkwin->menu.insert_image, | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4952 (prpl_info->options & OPT_PROTO_IM_IMAGE)); |
4359 | 4953 } |
4954 | |
4955 gtk_widget_set_sensitive(gtkconv->u.im->warn, | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4956 (prpl_info->warn != NULL)); |
4359 | 4957 |
4958 gtk_widget_set_sensitive(gtkconv->u.im->block, | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4959 (prpl_info->add_permit != NULL)); |
4359 | 4960 |
4961 update_convo_add_button(conv); | |
4962 } | |
4963 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
4964 if (gc == NULL) { | |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
4965 if (gtkconv->u.chat->whisper != NULL) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
4966 gtk_widget_set_sensitive(gtkconv->u.chat->whisper, FALSE); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
4967 |
4359 | 4968 gtk_widget_set_sensitive(gtkconv->u.chat->invite, FALSE); |
4969 | |
4970 return; | |
4971 } | |
4972 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4973 gtk_widget_set_sensitive(gtkconv->send, (prpl_info->chat_send != NULL)); |
4359 | 4974 |
4975 gtk_widget_set_sensitive(gtkconv->toolbar.image, FALSE); | |
4976 /* gtk_widget_set_sensitive(gtkwin->menu.insert_image, FALSE); */ | |
4977 | |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
4978 if (gtkconv->u.chat->whisper != NULL) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
4979 gtk_widget_set_sensitive(gtkconv->u.chat->whisper, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
4980 (prpl_info->chat_whisper != NULL)); |
4359 | 4981 |
4982 gtk_widget_set_sensitive(gtkconv->u.chat->invite, | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4983 (prpl_info->chat_invite != NULL)); |
4359 | 4984 } |
4985 } | |
4986 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4987 GaimWindow * |
4359 | 4988 gaim_gtkwin_get_at_xy(int x, int y) |
4989 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4990 GaimWindow *win = NULL; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4991 GaimGtkWindow *gtkwin; |
4359 | 4992 GdkWindow *gdkwin; |
4993 GList *l; | |
4994 | |
4995 gdkwin = gdk_window_at_pointer(&x, &y); | |
4996 | |
4997 if (gdkwin) | |
4998 gdkwin = gdk_window_get_toplevel(gdkwin); | |
4999 | |
5000 for (l = gaim_get_windows(); l != NULL; l = l->next) { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5001 win = (GaimWindow *)l->data; |
4359 | 5002 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5003 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5004 continue; |
5005 | |
5006 gtkwin = GAIM_GTK_WINDOW(win); | |
5007 | |
5008 if (gdkwin == gtkwin->window->window) | |
5009 return win; | |
5010 } | |
5011 | |
5012 return NULL; | |
5013 } | |
5014 | |
5015 int | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5016 gaim_gtkconv_get_tab_at_xy(GaimWindow *win, int x, int y) |
4359 | 5017 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5018 GaimGtkWindow *gtkwin; |
4359 | 5019 GList *l; |
5020 gint nb_x, nb_y, x_rel, y_rel; | |
5021 GtkNotebook *notebook; | |
5022 GtkWidget *tab; | |
5023 gint i, page_num = 0; | |
5024 gboolean first_visible = TRUE; | |
5025 | |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5026 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5027 return -1; |
5028 | |
5029 gtkwin = GAIM_GTK_WINDOW(win); | |
5030 notebook = GTK_NOTEBOOK(gtkwin->notebook); | |
5031 | |
5032 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
5033 x_rel = x - nb_x; | |
5034 y_rel = y - nb_y; | |
5035 | |
5036 for (l = gaim_window_get_conversations(win), i = 0; | |
5037 l != NULL; | |
5038 l = l->next, i++) { | |
5039 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5040 GaimConversation *conv = l->data; |
4359 | 5041 tab = GAIM_GTK_CONVERSATION(conv)->tab_label; |
5042 | |
5043 if (!GTK_WIDGET_MAPPED(tab)) | |
5044 continue; | |
5045 | |
5046 if (first_visible) { | |
5047 first_visible = FALSE; | |
5048 | |
5049 if (x_rel < tab->allocation.x) x_rel = tab->allocation.x; | |
5050 if (y_rel < tab->allocation.y) y_rel = tab->allocation.y; | |
5051 } | |
5052 | |
5053 if (gtk_notebook_get_tab_pos(notebook) == GTK_POS_TOP || | |
5054 gtk_notebook_get_tab_pos(notebook) == GTK_POS_BOTTOM) { | |
5055 | |
5056 if (tab->allocation.x <= x_rel) { | |
5057 if (tab->allocation.x + tab->allocation.width <= x_rel) | |
5058 page_num = i + 1; | |
5059 else | |
5060 page_num = i; | |
5061 } | |
5062 else | |
5063 break; | |
5064 } | |
5065 else { | |
5066 if (tab->allocation.y <= y_rel) { | |
5067 if (tab->allocation.y + tab->allocation.height <= y_rel) | |
5068 page_num = i + 1; | |
5069 else | |
5070 page_num = i; | |
5071 } | |
5072 else | |
5073 break; | |
5074 } | |
5075 } | |
5076 | |
5077 if (i == gaim_window_get_conversation_count(win) + 1) | |
5078 return -1; | |
5079 | |
5080 return page_num; | |
5081 } | |
5082 | |
5083 int | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5084 gaim_gtkconv_get_dest_tab_at_xy(GaimWindow *win, int x, int y) |
4359 | 5085 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5086 GaimGtkWindow *gtkwin; |
4359 | 5087 GList *l; |
5088 gint nb_x, nb_y, x_rel, y_rel; | |
5089 GtkNotebook *notebook; | |
5090 GtkWidget *tab; | |
5091 gint i, page_num = 0; | |
5092 | |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5093 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5094 return -1; |
5095 | |
5096 gtkwin = GAIM_GTK_WINDOW(win); | |
5097 notebook = GTK_NOTEBOOK(gtkwin->notebook); | |
5098 | |
5099 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
5100 x_rel = x - nb_x; | |
5101 y_rel = y - nb_y; | |
5102 | |
5103 for (l = gaim_window_get_conversations(win), i = 0; | |
5104 l != NULL; | |
5105 l = l->next, i++) { | |
5106 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5107 GaimConversation *conv = l->data; |
4359 | 5108 tab = GAIM_GTK_CONVERSATION(conv)->tab_label; |
5109 | |
5110 if (!GTK_WIDGET_MAPPED(tab)) | |
5111 continue; | |
5112 | |
5113 if (gtk_notebook_get_tab_pos(notebook) == GTK_POS_TOP || | |
5114 gtk_notebook_get_tab_pos(notebook) == GTK_POS_BOTTOM) { | |
5115 | |
5116 if (tab->allocation.x <= x_rel) { | |
5117 if (tab->allocation.x + (tab->allocation.width / 2) <= x_rel) | |
5118 page_num = i + 1; | |
5119 else | |
5120 page_num = i; | |
5121 } | |
5122 else | |
5123 break; | |
5124 } | |
5125 else { | |
5126 if (tab->allocation.y <= y_rel) { | |
5127 if (tab->allocation.y + (tab->allocation.height / 2) <= y_rel) | |
5128 page_num = i + 1; | |
5129 else | |
5130 page_num = i; | |
5131 } | |
5132 else | |
5133 break; | |
5134 } | |
5135 } | |
5136 | |
5137 if (i == gaim_window_get_conversation_count(win) + 1) | |
5138 return -1; | |
5139 | |
5140 return page_num; | |
5141 } | |
4940
3708545afe42
[gaim-migrate @ 5274]
Christian Hammond <chipx86@chipx86.com>
parents:
4939
diff
changeset
|
5142 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5143 static void |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5144 close_on_tabs_pref_cb(const char *name, GaimPrefType type, gpointer value, |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5145 gpointer data) |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5146 { |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5147 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5148 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5149 GaimGtkConversation *gtkconv; |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5150 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5151 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5152 conv = (GaimConversation *)l->data; |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5153 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5154 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5155 continue; |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5156 |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5157 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5158 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5159 if (value) |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5160 gtk_widget_show(gtkconv->close); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5161 else |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5162 gtk_widget_hide(gtkconv->close); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5163 } |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5164 } |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5165 |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5166 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5167 show_timestamps_pref_cb(const char *name, GaimPrefType type, gpointer value, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5168 gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5169 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5170 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5171 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5172 GaimGtkConversation *gtkconv; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5173 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5174 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5175 conv = (GaimConversation *)l->data; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5176 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5177 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5178 continue; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5179 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5180 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5181 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5182 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), (gboolean)value); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5183 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5184 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5185 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5186 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5187 spellcheck_pref_cb(const char *name, GaimPrefType type, gpointer value, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5188 gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5189 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5190 #ifdef USE_GTKSPELL |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5191 GList *cl; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5192 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5193 GaimGtkConversation *gtkconv; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5194 GtkSpell *spell; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5195 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5196 for (cl = gaim_get_conversations(); cl != NULL; cl = cl->next) { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5197 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5198 conv = (GaimConversation *)cl->data; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5199 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5200 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5201 continue; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5202 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5203 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5204 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5205 if (value) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5206 gtkspell_new_attach(GTK_TEXT_VIEW(gtkconv->entry), NULL, NULL); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5207 else { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5208 spell = gtkspell_get_from_text_view(GTK_TEXT_VIEW(gtkconv->entry)); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5209 gtkspell_detach(spell); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5210 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5211 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5212 #endif |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5213 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5214 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5215 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5216 show_smileys_pref_cb(const char *name, GaimPrefType type, gpointer value, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5217 gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5218 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5219 GList *cl; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5220 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5221 GaimGtkConversation *gtkconv; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5222 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5223 for (cl = gaim_get_conversations(); cl != NULL; cl = cl->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5224 conv = (GaimConversation *)cl->data; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5225 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5226 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5227 continue; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5228 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5229 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5230 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5231 gtk_imhtml_show_smileys(GTK_IMHTML(gtkconv->imhtml), (gboolean)value); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5232 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5233 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5234 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5235 static void |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5236 tab_side_pref_cb(const char *name, GaimPrefType type, gpointer value, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5237 gpointer data) |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5238 { |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5239 GList *l; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5240 GtkPositionType pos; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5241 GaimWindow *win; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5242 GaimGtkWindow *gtkwin; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5243 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5244 pos = GPOINTER_TO_INT(value); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5245 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5246 for (l = gaim_get_windows(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5247 win = (GaimWindow *)l->data; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5248 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5249 if (!GAIM_IS_GTK_WINDOW(win)) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5250 continue; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5251 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5252 gtkwin = GAIM_GTK_WINDOW(win); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5253 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5254 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5255 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5256 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5257 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5258 static void |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5259 im_button_type_pref_cb(const char *name, GaimPrefType type, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5260 gpointer value, gpointer data) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5261 { |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5262 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5263 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5264 GaimGtkConversation *gtkconv; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5265 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5266 for (l = gaim_get_ims(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5267 conv = (GaimConversation *)l->data; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5268 gtkconv = GAIM_GTK_CONVERSATION(conv); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5269 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5270 setup_im_buttons(conv, gtk_widget_get_parent(gtkconv->send)); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5271 } |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5272 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5273 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5274 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5275 animate_buddy_icons_pref_cb(const char *name, GaimPrefType type, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5276 gpointer value, gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5277 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5278 GList *l; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5279 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5280 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
|
5281 return; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5282 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5283 if (value) { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5284 for (l = gaim_get_ims(); l != NULL; l = l->next) |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5285 start_anim(NULL, (GaimConversation *)l->data); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5286 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5287 else { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5288 for (l = gaim_get_ims(); l != NULL; l = l->next) |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5289 stop_anim(NULL, (GaimConversation *)l->data); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5290 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5291 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5292 |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5293 static void |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5294 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
|
5295 gpointer data) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5296 { |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5297 gaim_conversation_foreach(gaim_gtkconv_update_buddy_icon); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5298 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5299 |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5680
diff
changeset
|
5300 static void |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5301 chat_button_type_pref_cb(const char *name, GaimPrefType type, gpointer value, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5302 gpointer data) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5303 { |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5304 GList *l; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5305 GaimConnection *g; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5306 GtkWidget *parent; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5307 GaimConversationType conv_type = GAIM_CONV_CHAT; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5308 GSList *bcs; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5309 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5310 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5311 GaimGtkWindow *gtkwin; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5312 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5313 for (l = gaim_connections_get_all(); l != NULL; l = l->next) { |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5314 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5315 g = (GaimConnection *)l->data; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5316 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5317 for (bcs = g->buddy_chats; bcs != NULL; bcs = bcs->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5318 conv = (GaimConversation *)bcs->data; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5319 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5320 if (gaim_conversation_get_type(conv) != GAIM_CONV_CHAT) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5321 continue; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5322 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5323 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5324 continue; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5325 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5326 gtkconv = GAIM_GTK_CONVERSATION(conv); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5327 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5328 parent = gtk_widget_get_parent(gtkconv->send); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5329 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5330 gtkconv->send = |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5331 gaim_gtk_change_text(_("Send"), |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5332 gtkconv->send, GAIM_STOCK_SEND, conv_type); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5333 gtkconv->u.chat->invite = |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5334 gaim_gtk_change_text(_("Invite"), |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5335 gtkconv->u.chat->invite, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5336 GAIM_STOCK_INVITE, conv_type); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5337 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5338 gtk_box_pack_end(GTK_BOX(parent), gtkconv->send, FALSE, FALSE, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5339 conv_type); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5340 gtk_box_pack_end(GTK_BOX(parent), gtkconv->u.chat->invite, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5341 FALSE, FALSE, 0); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5342 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5343 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->send, 0); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5344 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5345 g_signal_connect(G_OBJECT(gtkconv->send), "clicked", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5346 G_CALLBACK(send_cb), conv); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5347 g_signal_connect(G_OBJECT(gtkconv->u.chat->invite), "clicked", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5348 G_CALLBACK(invite_cb), conv); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5349 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5350 gtk_button_set_relief(GTK_BUTTON(gtkconv->send), |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5351 GTK_RELIEF_NONE); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5352 gtk_button_set_relief(GTK_BUTTON(gtkconv->u.chat->invite), |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5353 GTK_RELIEF_NONE); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5354 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5355 gaim_gtkconv_update_buttons_by_protocol(conv); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5356 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5357 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5358 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5359 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5360 void |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5361 gaim_gtk_conversation_init(void) |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5362 { |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5363 /* Conversations */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5364 gaim_prefs_add_none("/gaim/gtk/conversations"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5365 gaim_prefs_add_bool("/gaim/gtk/conversations/close_on_tabs", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5366 gaim_prefs_add_bool("/gaim/gtk/conversations/ctrl_enter_sends", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5367 gaim_prefs_add_bool("/gaim/gtk/conversations/enter_sends", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5368 gaim_prefs_add_bool("/gaim/gtk/conversations/escape_closes", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5369 gaim_prefs_add_bool("/gaim/gtk/conversations/ctrl_w_closes", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5370 gaim_prefs_add_bool("/gaim/gtk/conversations/f2_toggles_timestamps", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5371 gaim_prefs_add_bool("/gaim/gtk/conversations/send_bold", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5372 gaim_prefs_add_bool("/gaim/gtk/conversations/send_italic", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5373 gaim_prefs_add_bool("/gaim/gtk/conversations/send_strikethrough", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5374 gaim_prefs_add_bool("/gaim/gtk/conversations/send_underline", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5375 gaim_prefs_add_bool("/gaim/gtk/conversations/show_smileys", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5376 gaim_prefs_add_bool("/gaim/gtk/conversations/show_timestamps", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5377 gaim_prefs_add_bool("/gaim/gtk/conversations/show_urls_as_links", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5378 gaim_prefs_add_bool("/gaim/gtk/conversations/spellcheck", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5379 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_colors", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5380 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_fonts", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5381 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_font_sizes", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5382 gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_bgcolor", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5383 gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_fgcolor", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5384 gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_font", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5385 gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_size", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5386 gaim_prefs_add_bool("/gaim/gtk/conversations/html_shortcuts", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5387 gaim_prefs_add_bool("/gaim/gtk/conversations/smiley_shortcuts", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5388 gaim_prefs_add_string("/gaim/gtk/conversations/bgcolor", "#FFFFFF"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5389 gaim_prefs_add_string("/gaim/gtk/conversations/fgcolor", "#000000"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5390 gaim_prefs_add_string("/gaim/gtk/conversations/font_face", ""); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5391 gaim_prefs_add_int("/gaim/gtk/conversations/font_size", 3); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5392 gaim_prefs_add_bool("/gaim/gtk/conversations/tabs", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5393 gaim_prefs_add_int("/gaim/gtk/conversations/tab_side", GTK_POS_TOP); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5394 gaim_prefs_add_string("/gaim/gtk/conversations/placement", ""); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5395 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5396 /* Conversations -> Chat */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5397 gaim_prefs_add_none("/gaim/gtk/conversations/chat"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5398 gaim_prefs_add_int("/gaim/gtk/conversations/chat/button_type", |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5399 GAIM_BUTTON_TEXT_IMAGE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5400 gaim_prefs_add_bool("/gaim/gtk/conversations/chat/color_nicks", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5401 gaim_prefs_add_bool("/gaim/gtk/conversations/chat/old_tab_complete", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5402 gaim_prefs_add_bool("/gaim/gtk/conversations/chat/raise_on_events", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5403 gaim_prefs_add_bool("/gaim/gtk/conversations/chat/tab_completion", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5404 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_width", 410); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5405 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_height", 160); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5406 gaim_prefs_add_int("/gaim/gtk/conversations/chat/entry_height", 50); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5407 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5408 /* Conversations -> IM */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5409 gaim_prefs_add_none("/gaim/gtk/conversations/im"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5410 gaim_prefs_add_int("/gaim/gtk/conversations/im/button_type", |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5411 GAIM_BUTTON_TEXT_IMAGE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5412 gaim_prefs_add_bool("/gaim/gtk/conversations/im/animate_buddy_icons", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5413 gaim_prefs_add_bool("/gaim/gtk/conversations/im/hide_on_send", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5414 gaim_prefs_add_bool("/gaim/gtk/conversations/im/raise_on_events", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5415 gaim_prefs_add_bool("/gaim/gtk/conversations/im/show_buddy_icons", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5416 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_width", 410); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5417 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_height", 160); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5418 gaim_prefs_add_int("/gaim/gtk/conversations/im/entry_height", 50); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5419 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5420 /* Connect callbacks. */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5421 gaim_prefs_connect_callback("/gaim/gtk/conversations/close_on_tabs", |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5422 close_on_tabs_pref_cb, NULL); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5423 gaim_prefs_connect_callback("/gaim/gtk/conversations/show_smileys", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5424 show_smileys_pref_cb, NULL); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5425 gaim_prefs_connect_callback("/gaim/gtk/conversations/show_timestamps", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5426 show_timestamps_pref_cb, NULL); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5427 gaim_prefs_connect_callback("/gaim/gtk/conversations/spellcheck", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5428 spellcheck_pref_cb, NULL); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5429 gaim_prefs_connect_callback("/gaim/gtk/conversations/tab_side", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5430 tab_side_pref_cb, NULL); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5431 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5432 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5433 /* IM callbacks */ |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5434 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/button_type", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5435 im_button_type_pref_cb, NULL); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5436 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/animate_buddy_icons", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5437 animate_buddy_icons_pref_cb, NULL); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5438 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/show_buddy_icons", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5439 show_buddy_icons_pref_cb, NULL); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5440 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5441 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5442 /* Chat callbacks */ |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5443 gaim_prefs_connect_callback("/gaim/gtk/conversations/chat/button_type", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5444 chat_button_type_pref_cb, NULL); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5445 } |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5446 |