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