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