Mercurial > pidgin
annotate src/gtkconv.c @ 8926:8ef82d89faf3
[gaim-migrate @ 9696]
" Crash fix when getting certain commands from server
(NOT and IPG)" --Felipe Contreras
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Thu, 13 May 2004 17:26:51 +0000 |
parents | 73649ee7f687 |
children | 71fddf3f340d |
rev | line source |
---|---|
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
1 /** |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
2 * @file gtkconv.h GTK+ Conversation API |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
3 * @ingroup gtkui |
4359 | 4 * |
8046 | 5 * Gaim is the legal property of its developers, whose names are too numerous |
6 * to list here. Please refer to the COPYRIGHT file distributed with this | |
7 * source distribution. | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
8 * |
4359 | 9 * This program is free software; you can redistribute it and/or modify |
10 * it under the terms of the GNU General Public License as published by | |
11 * the Free Software Foundation; either version 2 of the License, or | |
12 * (at your option) any later version. | |
13 * | |
14 * This program is distributed in the hope that it will be useful, | |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 * GNU General Public License for more details. | |
18 * | |
19 * You should have received a copy of the GNU General Public License | |
20 * along with this program; if not, write to the Free Software | |
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
22 * | |
23 */ | |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
24 #include "gtkinternal.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
25 |
4359 | 26 #ifndef _WIN32 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
27 # include <X11/Xlib.h> |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
28 #endif |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
29 |
4359 | 30 #ifdef USE_GTKSPELL |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
31 # include <gtkspell/gtkspell.h> |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
32 # ifdef _WIN32 |
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
33 # include "wspell.h" |
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
34 # endif |
4359 | 35 #endif |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
36 |
4359 | 37 #include <gdk/gdkkeysyms.h> |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
38 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
39 #include "debug.h" |
6982 | 40 #include "imgstore.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
41 #include "log.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
42 #include "multi.h" |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5402
diff
changeset
|
43 #include "notify.h" |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
44 #include "prefs.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
45 #include "prpl.h" |
6038 | 46 #include "request.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
47 #include "sound.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
48 #include "util.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
49 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
50 #include "dnd-hints.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
51 #include "gtkblist.h" |
5717 | 52 #include "gtkconv.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
53 #include "gtkimhtml.h" |
8317 | 54 #include "gtkimhtmltoolbar.h" |
7431 | 55 #include "gtklog.h" |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
56 #include "gtkpounce.h" |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
57 #include "gtkprivacy.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
58 #include "gtkutils.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
59 #include "stock.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
60 |
5717 | 61 #include "ui.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
62 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
63 /* XXX */ |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
64 #include "gaim.h" |
4359 | 65 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
66 #define AUTO_RESPONSE "<AUTO-REPLY> : " |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
67 |
7990 | 68 #define SEND_COLOR "#16569E" |
7855 | 69 #define RECV_COLOR "#A82F2F" |
7854 | 70 |
4359 | 71 static char nick_colors[][8] = { |
72 "#ba55d3", /* Medium Orchid */ | |
73 "#ee82ee", /* Violet */ | |
74 "#c715b4", /* Medium Violet Red */ | |
75 "#ff69b4", /* Hot Pink */ | |
76 "#ff6347", /* Tomato */ | |
77 "#fa8c00", /* Dark Orange */ | |
78 "#fa8072", /* Salmon */ | |
79 "#b22222", /* Fire Brick */ | |
80 "#f4a460", /* Sandy Brown */ | |
81 "#cd5c5c", /* Indian Red */ | |
82 "#bc8f8f", /* Rosy Brown */ | |
83 "#f0e68c", /* Khaki */ | |
84 "#bdb76b", /* Dark Khaki */ | |
85 "#228b22", /* Forest Green */ | |
86 "#9acd32", /* Yellow Green */ | |
87 "#32cd32", /* Lime Green */ | |
7755 | 88 "#3cb371", /* Medium Sea Green (Medium Sea Green?! What are we women?!) */ |
4359 | 89 "#2e8b57", /* Sea Green */ |
90 "#8fbc8f", /* Dark Sea Green */ | |
91 "#66cdaa", /* Medium Aquamarine */ | |
92 "#5f9ea0", /* Cadet Blue */ | |
93 "#48d1cc", /* Medium Turquoise */ | |
94 "#00ced1", /* Dark Turquoise */ | |
95 "#4682b4", /* Stell Blue */ | |
96 "#00bfff", /* Deep Sky Blue */ | |
97 "#1690ff", /* Dodger Blue */ | |
98 "#4169ff", /* Royal Blue */ | |
99 "#6a5acd", /* Slate Blue */ | |
100 "#6495ed", /* Cornflower Blue */ | |
101 "#708090", /* Slate gray */ | |
7995
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
102 "#2f4f4f", /* Dark Slate Gray */ |
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
103 "#ff8c00", /* Dark Orange */ |
8535 | 104 "#006400", /* DarkGreen */ |
105 "#8b4513", /* SaddleBrown */ | |
106 "#8b8989", /* snow4 */ | |
107 "#7d26cd", /* purple3 */ | |
4359 | 108 }; |
6291 | 109 |
4359 | 110 #define NUM_NICK_COLORS (sizeof(nick_colors) / sizeof(*nick_colors)) |
111 | |
112 #define SCALE(x) \ | |
113 ((gdk_pixbuf_animation_get_width(x) <= 48 && \ | |
114 gdk_pixbuf_animation_get_height(x) <= 48) ? 48 : 50) | |
115 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
116 typedef struct |
4359 | 117 { |
118 GtkWidget *window; | |
119 | |
120 GtkWidget *entry; | |
121 GtkWidget *message; | |
122 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
123 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
124 |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
125 } InviteBuddyInfo; |
4359 | 126 |
127 static GtkWidget *invite_dialog = NULL; | |
128 | |
129 /* Prototypes. <-- because Paco-Paco hates this comment. */ | |
5676
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); |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
136 static gboolean update_send_as_selection(GaimConvWindow *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); |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
138 static void save_convo(GtkWidget *save, GaimConversation *c); |
4359 | 139 |
140 /************************************************************************** | |
141 * Callbacks | |
142 **************************************************************************/ | |
143 static void | |
6038 | 144 do_save_convo(GtkWidget *wid) |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
145 { |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
146 GaimConversation *conv; |
8557 | 147 const char *name; |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
148 const char *filename; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
149 FILE *fp; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
150 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
151 conv = g_object_get_data(G_OBJECT(GTK_FILE_SELECTION(wid)->ok_button), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
152 "gaim_conversation"); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
153 |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
154 filename = gtk_file_selection_get_filename(GTK_FILE_SELECTION(wid)); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
155 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
156 if (!((gaim_conversation_get_type(conv) != GAIM_CONV_CHAT && |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
157 g_list_find(gaim_get_ims(), conv)) || |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
158 (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT && |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
159 g_list_find(gaim_get_chats(), conv)))) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
160 filename = NULL; |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
161 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
162 gtk_widget_destroy(wid); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
163 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
164 if (filename == NULL) |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
165 return; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
166 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
167 if ((fp = fopen(filename, "w+")) == NULL) |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
168 return; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
169 |
8557 | 170 name = gaim_conversation_get_name(conv); |
171 | |
172 fprintf(fp, _("<h1>Conversation with %s</h1>\n"), name); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
173 fprintf(fp, "%s", conv->history->str); |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
174 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
175 fclose(fp); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
176 } |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
177 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
178 static void |
6038 | 179 do_check_save_convo(GObject *obj, GtkWidget *wid) |
180 { | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
181 const char *filename; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
182 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
183 filename = gtk_file_selection_get_filename(GTK_FILE_SELECTION(wid)); |
6038 | 184 |
185 if (gaim_gtk_check_if_dir(filename, GTK_FILE_SELECTION(wid))) | |
186 return; | |
187 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
188 if (g_file_test(filename, G_FILE_TEST_EXISTS)) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
189 { |
6038 | 190 gaim_request_yes_no(NULL, NULL, _("That file already exists"), |
191 _("Would you like to overwrite it?"), 1, wid, | |
192 G_CALLBACK(do_save_convo), NULL); | |
193 } | |
194 else | |
195 do_save_convo(wid); | |
196 } | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6460
diff
changeset
|
197 |
4359 | 198 |
199 static gint | |
200 close_win_cb(GtkWidget *w, GdkEventAny *e, gpointer d) | |
201 { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
202 GaimConvWindow *win = (GaimConvWindow *)d; |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
203 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
204 gaim_conv_window_destroy(win); |
4361
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
205 |
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
206 return TRUE; |
4359 | 207 } |
208 | |
209 static gint | |
210 close_conv_cb(GtkWidget *w, gpointer d) | |
211 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
212 GaimConversation *conv = (GaimConversation *)d; |
4359 | 213 |
214 gaim_conversation_destroy(conv); | |
4361
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
215 |
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
216 return TRUE; |
4359 | 217 } |
218 | |
8914 | 219 static gboolean |
220 size_allocate_cb(GtkWidget *w, GtkAllocation *allocation, GaimConversation *conv) | |
221 { | |
222 GaimGtkConversation *gtkconv; | |
223 | |
224 if (!GTK_WIDGET_VISIBLE(w)) | |
225 return FALSE; | |
226 | |
227 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
228 return FALSE; | |
229 | |
230 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
231 | |
232 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) | |
233 { | |
234 if (w == gtkconv->sw) | |
235 { | |
236 gaim_prefs_set_int("/gaim/gtk/conversations/im/default_width", allocation->width); | |
237 gaim_prefs_set_int("/gaim/gtk/conversations/im/default_height", allocation->height); | |
238 } | |
239 if (w == gtkconv->entry) | |
240 gaim_prefs_set_int("/gaim/gtk/conversations/im/entry_height", allocation->height); | |
241 } | |
242 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
243 { | |
244 if (w == gtkconv->sw) | |
245 { | |
246 gaim_prefs_set_int("/gaim/gtk/conversations/chat/default_width", allocation->width); | |
247 gaim_prefs_set_int("/gaim/gtk/conversations/chat/default_height", allocation->height); | |
248 } | |
249 if (w == gtkconv->entry) | |
250 gaim_prefs_set_int("/gaim/gtk/conversations/chat/entry_height", allocation->height); | |
251 } | |
252 | |
253 return FALSE; | |
254 } | |
255 | |
7446
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
256 /* Courtesy of Galeon! */ |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
257 static void |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
258 tab_close_button_state_changed_cb(GtkWidget *widget, GtkStateType prev_state) |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
259 { |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
260 if (GTK_WIDGET_STATE(widget) == GTK_STATE_ACTIVE) |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
261 gtk_widget_set_state(widget, GTK_STATE_NORMAL); |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
262 } |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
263 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
264 static void |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
265 default_formatize(GaimConversation *conv) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
266 { |
8061 | 267 GaimGtkConversation *c = GAIM_GTK_CONVERSATION(conv); |
268 GaimConnection *gc = gaim_conversation_get_gc(conv); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
269 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
270 if (gc && gc->flags & GAIM_CONNECTION_HTML) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
271 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
272 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold")) |
8061 | 273 gtk_imhtml_toggle_bold(GTK_IMHTML(c->entry)); |
8481 | 274 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
275 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic")) |
8061 | 276 gtk_imhtml_toggle_italic(GTK_IMHTML(c->entry)); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
277 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
278 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline")) |
8061 | 279 gtk_imhtml_toggle_underline(GTK_IMHTML(c->entry)); |
8481 | 280 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
281 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_font") || |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
282 c->has_font) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
283 { |
8061 | 284 gtk_imhtml_toggle_fontface(GTK_IMHTML(c->entry), c->fontface); |
285 } | |
286 | |
8691
0eb5161ef333
[gaim-migrate @ 9444]
Christian Hammond <chipx86@chipx86.com>
parents:
8690
diff
changeset
|
287 if (!(gc->flags & GAIM_CONNECTION_NO_FONTSIZE) && |
0eb5161ef333
[gaim-migrate @ 9444]
Christian Hammond <chipx86@chipx86.com>
parents:
8690
diff
changeset
|
288 gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_size")) |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
289 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
290 gtk_imhtml_font_set_size(GTK_IMHTML(c->entry), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
291 gaim_prefs_get_int("/gaim/gtk/conversations/font_size")); |
8061 | 292 } |
293 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
294 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_fgcolor")) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
295 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
296 char *color = g_strdup_printf("#%02x%02x%02x", |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
297 c->fg_color.red / 256, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
298 c->fg_color.green / 256, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
299 c->fg_color.blue / 256); |
8061 | 300 gtk_imhtml_toggle_forecolor(GTK_IMHTML(c->entry), color); |
301 g_free(color); | |
302 } | |
303 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
304 if (!(gc->flags & GAIM_CONNECTION_NO_BGCOLOR) && |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
305 gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_bgcolor")) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
306 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
307 char *color = g_strdup_printf("#%02x%02x%02x", |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
308 c->bg_color.red / 256, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
309 c->bg_color.green / 256, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
310 c->bg_color.blue / 256); |
8061 | 311 gtk_imhtml_toggle_backcolor(GTK_IMHTML(c->entry), color); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
312 g_free(color); |
8061 | 313 } |
8677 | 314 |
315 if (gc->flags & GAIM_CONNECTION_FORMATTING_WBFO) | |
316 gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(c->entry), TRUE); | |
317 else | |
318 gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(c->entry), FALSE); | |
8061 | 319 } |
320 } | |
321 | |
4359 | 322 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
323 send_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 324 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
325 GaimGtkConversation *gtkconv; |
8655 | 326 GaimAccount *account; |
8677 | 327 GaimConnection *gc; |
8448 | 328 char *buf, *clean; |
4359 | 329 |
330 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
8655 | 331 account = gaim_conversation_get_account(conv); |
332 | |
333 if (!gaim_account_is_connected(account)) | |
334 return; | |
8329
9dd7c75ed433
[gaim-migrate @ 9053]
Christian Hammond <chipx86@chipx86.com>
parents:
8319
diff
changeset
|
335 |
8442 | 336 buf = gtk_imhtml_get_markup(GTK_IMHTML(gtkconv->entry)); |
8448 | 337 clean = gaim_markup_strip_html(buf); |
338 | |
4359 | 339 gtk_widget_grab_focus(gtkconv->entry); |
340 | |
8448 | 341 if (strlen(clean) == 0) { |
342 g_free(clean); | |
4359 | 343 return; |
344 } | |
345 | |
8677 | 346 gc = gaim_account_get_connection(account); |
347 if (gc && (gc->flags & GAIM_CONNECTION_NO_NEWLINES)) { | |
348 char **bufs; | |
349 int i; | |
350 | |
351 bufs = gtk_imhtml_get_markup_lines(GTK_IMHTML(gtkconv->entry)); | |
352 for (i = 0; bufs[i]; i++) { | |
353 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) | |
354 gaim_conv_im_send(GAIM_CONV_IM(conv), bufs[i]); | |
355 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
356 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), bufs[i]); | |
357 } | |
358 | |
359 g_strfreev(bufs); | |
360 | |
361 } else { | |
362 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) | |
363 gaim_conv_im_send(GAIM_CONV_IM(conv), buf); | |
364 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
365 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), buf); | |
366 } | |
4359 | 367 |
8677 | 368 g_free(clean); |
4359 | 369 g_free(buf); |
370 | |
8061 | 371 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); |
372 default_formatize(conv); | |
4359 | 373 } |
374 | |
375 static void | |
7928 | 376 add_remove_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 377 { |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
378 GaimAccount *account; |
4359 | 379 const char *name; |
380 | |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
381 account = gaim_conversation_get_account(conv); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
382 name = gaim_conversation_get_name(conv); |
7879 | 383 |
384 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
7859 | 385 GaimBuddy *b; |
386 | |
387 b = gaim_find_buddy(account, name); | |
388 if (b != NULL) | |
389 show_confirm_del(b); | |
390 else if (account != NULL && gaim_account_is_connected(account)) | |
391 gaim_blist_request_add_buddy(account, (char *)name, NULL, NULL); | |
7879 | 392 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
7859 | 393 GaimChat *c; |
394 | |
395 c = gaim_blist_find_chat(account, name); | |
396 if (c != NULL) | |
397 show_confirm_del_blist_chat(c); | |
398 else if (account != NULL && gaim_account_is_connected(account)) | |
399 gaim_blist_request_add_chat(account, NULL, NULL); | |
400 } | |
4359 | 401 |
402 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
403 } | |
404 | |
7975 | 405 static void chat_do_info(GaimConversation *conv, const char *who) |
406 { | |
407 GaimPluginProtocolInfo *prpl_info = NULL; | |
408 GaimConnection *gc; | |
409 | |
410 if ((gc = gaim_conversation_get_gc(conv))) { | |
411 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | |
412 | |
413 /* | |
414 * If there are special needs for getting info on users in | |
415 * buddy chat "rooms"... | |
416 */ | |
417 if (prpl_info->get_cb_info != NULL) | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
418 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
419 prpl_info->get_cb_info(gc, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
420 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
421 } |
7975 | 422 else |
423 prpl_info->get_info(gc, who); | |
424 } | |
425 } | |
426 | |
427 | |
4359 | 428 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
429 info_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 430 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
431 GaimGtkConversation *gtkconv; |
4359 | 432 |
433 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
434 | |
7879 | 435 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
436 serv_get_info(gaim_conversation_get_gc(conv), | |
437 gaim_conversation_get_name(conv)); | |
438 | |
439 gtk_widget_grab_focus(gtkconv->entry); | |
440 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
441 /* Get info of the person currently selected in the GtkTreeView */ | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
442 GaimGtkChatPane *gtkchat; |
4359 | 443 GtkTreeIter iter; |
444 GtkTreeModel *model; | |
445 GtkTreeSelection *sel; | |
446 const char *name; | |
447 | |
448 gtkchat = gtkconv->u.chat; | |
449 | |
450 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | |
451 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); | |
452 | |
453 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) | |
454 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &name, -1); | |
455 else | |
456 return; | |
457 | |
7975 | 458 chat_do_info(conv, name); |
4359 | 459 } |
460 } | |
461 | |
462 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
463 warn_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 464 { |
465 show_warn_dialog(gaim_conversation_get_gc(conv), | |
7879 | 466 gaim_conversation_get_name(conv)); |
4359 | 467 |
468 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
469 } | |
470 | |
471 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
472 block_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 473 { |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
474 GaimAccount *account; |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
475 |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
476 account = gaim_conversation_get_account(conv); |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
477 |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
478 if (account != NULL && gaim_account_is_connected(account)) |
6399
d726a36628e8
[gaim-migrate @ 6904]
Christian Hammond <chipx86@chipx86.com>
parents:
6398
diff
changeset
|
479 gaim_gtk_request_add_block(account, gaim_conversation_get_name(conv)); |
4359 | 480 |
481 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
482 } | |
483 | |
484 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
485 do_invite(GtkWidget *w, int resp, InviteBuddyInfo *info) |
4359 | 486 { |
487 const char *buddy, *message; | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
488 GaimGtkConversation *gtkconv; |
4359 | 489 |
490 gtkconv = GAIM_GTK_CONVERSATION(info->conv); | |
491 | |
492 if (resp == GTK_RESPONSE_OK) { | |
493 buddy = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(info->entry)->entry)); | |
494 message = gtk_entry_get_text(GTK_ENTRY(info->message)); | |
495 | |
4793 | 496 if (!g_ascii_strcasecmp(buddy, "")) { |
4359 | 497 g_free(info); |
498 | |
499 return; | |
500 } | |
501 | |
502 serv_chat_invite(gaim_conversation_get_gc(info->conv), | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
503 gaim_conv_chat_get_id(GAIM_CONV_CHAT(info->conv)), |
4359 | 504 message, buddy); |
505 } | |
506 | |
507 gtk_widget_destroy(invite_dialog); | |
508 invite_dialog = NULL; | |
509 | |
510 g_free(info); | |
511 } | |
512 | |
513 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
514 invite_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 515 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
516 InviteBuddyInfo *info = NULL; |
4359 | 517 |
518 if (invite_dialog == NULL) { | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
519 GaimConnection *gc; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
520 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
521 GaimGtkWindow *gtkwin; |
4359 | 522 GtkWidget *label; |
523 GtkWidget *vbox, *hbox; | |
524 GtkWidget *table; | |
525 GtkWidget *img; | |
526 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
527 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
528 GTK_ICON_SIZE_DIALOG); |
4359 | 529 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
530 info = g_new0(InviteBuddyInfo, 1); |
4359 | 531 info->conv = conv; |
532 | |
533 gc = gaim_conversation_get_gc(conv); | |
534 win = gaim_conversation_get_window(conv); | |
535 gtkwin = GAIM_GTK_WINDOW(win); | |
536 | |
537 /* Create the new dialog. */ | |
538 invite_dialog = gtk_dialog_new_with_buttons( | |
7859 | 539 _("Invite Buddy Into Chat Room"), |
7879 | 540 GTK_WINDOW(gtkwin->window), 0, |
541 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, | |
4359 | 542 GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); |
543 | |
544 gtk_dialog_set_default_response(GTK_DIALOG(invite_dialog), | |
545 GTK_RESPONSE_OK); | |
546 gtk_container_set_border_width(GTK_CONTAINER(invite_dialog), 6); | |
547 gtk_window_set_resizable(GTK_WINDOW(invite_dialog), FALSE); | |
548 gtk_dialog_set_has_separator(GTK_DIALOG(invite_dialog), FALSE); | |
549 | |
550 /* Setup the outside spacing. */ | |
551 vbox = GTK_DIALOG(invite_dialog)->vbox; | |
552 | |
553 gtk_box_set_spacing(GTK_BOX(vbox), 12); | |
554 gtk_container_set_border_width(GTK_CONTAINER(vbox), 6); | |
555 | |
556 /* Setup the inner hbox and put the dialog's icon in it. */ | |
557 hbox = gtk_hbox_new(FALSE, 12); | |
558 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
559 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
560 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
561 | |
562 /* Setup the right vbox. */ | |
563 vbox = gtk_vbox_new(FALSE, 0); | |
564 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
565 | |
566 /* Put our happy label in it. */ | |
567 label = gtk_label_new(_("Please enter the name of the user you wish " | |
568 "to invite, along with an optional invite " | |
569 "message.")); | |
570 gtk_widget_set_size_request(label, 350, -1); | |
571 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
572 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
573 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
574 | |
575 /* hbox for the table, and to give it some spacing on the left. */ | |
576 hbox = gtk_hbox_new(FALSE, 6); | |
577 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
578 | |
579 /* Setup the table we're going to use to lay stuff out. */ | |
580 table = gtk_table_new(2, 2, FALSE); | |
581 gtk_table_set_row_spacings(GTK_TABLE(table), 6); | |
582 gtk_table_set_col_spacings(GTK_TABLE(table), 6); | |
583 gtk_container_set_border_width(GTK_CONTAINER(table), 12); | |
584 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); | |
585 | |
586 /* Now the Buddy label */ | |
587 label = gtk_label_new(NULL); | |
588 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Buddy:")); | |
589 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
590 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); | |
591 | |
592 /* Now the Buddy drop-down entry field. */ | |
593 info->entry = gtk_combo_new(); | |
594 gtk_combo_set_case_sensitive(GTK_COMBO(info->entry), FALSE); | |
595 gtk_entry_set_activates_default( | |
596 GTK_ENTRY(GTK_COMBO(info->entry)->entry), TRUE); | |
597 | |
598 gtk_table_attach_defaults(GTK_TABLE(table), info->entry, 1, 2, 0, 1); | |
599 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->entry); | |
600 | |
601 /* Fill in the names. */ | |
602 gtk_combo_set_popdown_strings(GTK_COMBO(info->entry), | |
603 generate_invite_user_names(gc)); | |
604 | |
605 | |
606 /* Now the label for "Message" */ | |
607 label = gtk_label_new(NULL); | |
608 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Message:")); | |
609 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
610 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); | |
611 | |
612 | |
613 /* And finally, the Message entry field. */ | |
614 info->message = gtk_entry_new(); | |
615 gtk_entry_set_activates_default(GTK_ENTRY(info->message), TRUE); | |
616 | |
617 gtk_table_attach_defaults(GTK_TABLE(table), info->message, 1, 2, 1, 2); | |
618 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->message); | |
619 | |
620 /* Connect the signals. */ | |
621 g_signal_connect(G_OBJECT(invite_dialog), "response", | |
622 G_CALLBACK(do_invite), info); | |
623 } | |
624 | |
625 gtk_widget_show_all(invite_dialog); | |
626 | |
627 if (info != NULL) | |
628 gtk_widget_grab_focus(GTK_COMBO(info->entry)->entry); | |
629 } | |
630 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
631 static void |
7748 | 632 menu_new_conv_cb(gpointer data, guint action, GtkWidget *widget) |
633 { | |
634 show_im_dialog(); | |
635 } | |
636 | |
637 static void | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
638 menu_save_as_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
639 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
640 GaimConvWindow *win = (GaimConvWindow *)data; |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
641 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
642 save_convo(NULL, gaim_conv_window_get_active_conversation(win)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
643 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
644 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
645 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
646 menu_view_log_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
647 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
648 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
649 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
650 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
651 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
652 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
653 gaim_gtk_log_show((char *)gaim_conversation_get_name(conv), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
654 gaim_conversation_get_account(conv)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
655 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
656 |
7295 | 657 struct _search { |
658 GaimGtkConversation *gtkconv; | |
659 GtkWidget *entry; | |
660 }; | |
661 | |
7929 | 662 static void do_search_cb(GtkWidget *widget, gint resp, struct _search *s) |
7295 | 663 { |
7929 | 664 switch (resp) { |
665 case GTK_RESPONSE_OK: | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
666 gtk_imhtml_search_find(GTK_IMHTML(s->gtkconv->imhtml), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
667 gtk_entry_get_text(GTK_ENTRY(s->entry))); |
7929 | 668 break; |
669 | |
670 case GTK_RESPONSE_DELETE_EVENT: | |
671 case GTK_RESPONSE_CLOSE: | |
672 gtk_imhtml_search_clear(GTK_IMHTML(s->gtkconv->imhtml)); | |
673 gtk_widget_destroy(s->gtkconv->dialogs.search); | |
674 s->gtkconv->dialogs.search = NULL; | |
675 g_free(s); | |
676 break; | |
677 } | |
7295 | 678 } |
679 | |
680 static void | |
7751 | 681 menu_find_cb(gpointer data, guint action, GtkWidget *widget) |
7295 | 682 { |
683 GaimConvWindow *win = (GaimConvWindow *)data; | |
684 GaimConversation *conv = gaim_conv_window_get_active_conversation(win); | |
685 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); | |
686 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7929 | 687 GtkWidget *hbox; |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
688 GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
689 GTK_ICON_SIZE_DIALOG); |
7929 | 690 GtkWidget *label; |
7295 | 691 struct _search *s; |
692 | |
7798 | 693 if (gtkconv->dialogs.search) { |
694 gtk_window_present(GTK_WINDOW(gtkconv->dialogs.search)); | |
7295 | 695 return; |
7798 | 696 } |
7300
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
697 |
7295 | 698 s = g_malloc(sizeof(struct _search)); |
699 s->gtkconv = gtkconv; | |
7929 | 700 |
701 gtkconv->dialogs.search = gtk_dialog_new_with_buttons(_("Find"), | |
702 GTK_WINDOW(gtkwin->window), GTK_DIALOG_DESTROY_WITH_PARENT, | |
703 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, | |
704 GTK_STOCK_FIND, GTK_RESPONSE_OK, NULL); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
705 gtk_dialog_set_default_response(GTK_DIALOG(gtkconv->dialogs.search), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
706 GTK_RESPONSE_OK); |
7929 | 707 g_signal_connect(G_OBJECT(gtkconv->dialogs.search), "response", |
708 G_CALLBACK(do_search_cb), s); | |
709 | |
710 gtk_container_set_border_width(GTK_CONTAINER(gtkconv->dialogs.search), 6); | |
711 gtk_window_set_resizable(GTK_WINDOW(gtkconv->dialogs.search), FALSE); | |
712 gtk_dialog_set_has_separator(GTK_DIALOG(gtkconv->dialogs.search), FALSE); | |
713 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(gtkconv->dialogs.search)->vbox), 12); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
714 gtk_container_set_border_width( |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
715 GTK_CONTAINER(GTK_DIALOG(gtkconv->dialogs.search)->vbox), 6); |
7929 | 716 |
717 hbox = gtk_hbox_new(FALSE, 12); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
718 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(gtkconv->dialogs.search)->vbox), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
719 hbox); |
7929 | 720 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); |
721 | |
722 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
723 gtk_dialog_set_response_sensitive(GTK_DIALOG(gtkconv->dialogs.search), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
724 GTK_RESPONSE_OK, FALSE); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
725 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
726 label = gtk_label_new(NULL); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
727 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Search for:")); |
7929 | 728 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
729 | |
730 s->entry = gtk_entry_new(); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
731 gtk_entry_set_activates_default(GTK_ENTRY(s->entry), TRUE); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
732 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(s->entry)); |
7929 | 733 g_signal_connect(G_OBJECT(s->entry), "changed", |
734 G_CALLBACK(gaim_gtk_set_sensitive_if_input), | |
735 gtkconv->dialogs.search); | |
736 gtk_box_pack_start(GTK_BOX(hbox), s->entry, FALSE, FALSE, 0); | |
7300
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
737 |
7295 | 738 gtk_widget_show_all(gtkconv->dialogs.search); |
7929 | 739 gtk_widget_grab_focus(s->entry); |
7295 | 740 } |
741 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
742 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
743 menu_add_pounce_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
744 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
745 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
746 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
747 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
748 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
749 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
750 gaim_gtkpounce_dialog_show(gaim_conversation_get_account(conv), |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
751 gaim_conversation_get_name(conv), NULL); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
752 } |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
753 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
754 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
755 menu_insert_link_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
756 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
757 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
758 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
759 GaimGtkConversation *gtkconv; |
8756 | 760 GtkIMHtmlToolbar *toolbar; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
761 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
762 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
763 gtkconv = GAIM_GTK_CONVERSATION(conv); |
8756 | 764 toolbar = GTK_IMHTMLTOOLBAR(gtkconv->toolbar); |
765 | |
766 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->link), | |
767 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->link))); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
768 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
769 |
8756 | 770 #if 0 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
771 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
772 menu_insert_image_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
773 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
774 GaimConvWindow *win = (GaimConvWindow *)data; |
8756 | 775 GaimConversation *conv; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
776 GaimGtkConversation *gtkconv; |
8756 | 777 GtkIMHtmlToolbar *toolbar; |
778 | |
779 conv = gaim_conv_window_get_active_conversation(win); | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
780 gtkconv = GAIM_GTK_CONVERSATION(gaim_conv_window_get_active_conversation(win)); |
8756 | 781 toolbar = GTK_IMHTMLTOOLBAR(gtkconv->toolbar); |
782 | |
783 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->image), | |
784 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->image))); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
785 } |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
786 #endif |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
787 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
788 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
789 menu_alias_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
790 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
791 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
792 GaimConversation *conv; |
7879 | 793 GaimAccount *account; |
794 const char *name; | |
795 | |
796 conv = gaim_conv_window_get_active_conversation(win); | |
797 account = gaim_conversation_get_account(conv); | |
798 name = gaim_conversation_get_name(conv); | |
799 | |
800 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
801 GaimBuddy *b; | |
802 | |
803 b = gaim_find_buddy(account, name); | |
804 if (b != NULL) | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
805 alias_dialog_bud(b); |
7879 | 806 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
807 GaimChat *c; | |
808 | |
809 c = gaim_blist_find_chat(account, name); | |
810 if (c != NULL) | |
811 alias_dialog_blist_chat(c); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
812 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
813 } |
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 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
816 menu_get_info_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
817 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
818 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
819 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
820 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
821 conv = gaim_conv_window_get_active_conversation(win); |
5908
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 info_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
824 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
825 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
826 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
827 menu_invite_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
828 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
829 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
830 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
831 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
832 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
833 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
834 invite_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
835 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
836 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
837 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
838 menu_warn_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
839 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
840 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
841 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
842 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
843 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
844 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
845 warn_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
846 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
847 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
848 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
849 menu_block_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
850 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
851 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
852 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
853 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
854 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
855 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
856 block_cb(NULL, conv); |
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 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
859 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
860 menu_add_remove_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
861 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
862 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
863 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
864 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
865 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
866 |
7928 | 867 add_remove_cb(NULL, conv); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
868 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
869 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
870 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
871 menu_close_conv_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
872 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
873 GaimConvWindow *win = (GaimConvWindow *)data; |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
874 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
875 close_conv_cb(NULL, gaim_conv_window_get_active_conversation(win)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
876 } |
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 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
879 menu_logging_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
880 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
881 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
882 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
883 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
884 conv = gaim_conv_window_get_active_conversation(win); |
5908
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 if (conv == NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
887 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
888 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
889 gaim_conversation_set_logging(conv, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
890 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
891 } |
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 static void |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
894 menu_toolbar_cb(gpointer data, guint action, GtkWidget *widget) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
895 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
896 GaimConvWindow *win = (GaimConvWindow *)data; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
897 GaimConversation *conv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
898 GaimGtkConversation *gtkconv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
899 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
900 conv = gaim_conv_window_get_active_conversation(win); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
901 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
902 if (conv == NULL) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
903 return; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
904 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
905 gtkconv = GAIM_GTK_CONVERSATION(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
906 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
907 gtkconv->show_formatting_toolbar = |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
908 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
909 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
910 if (gtkconv->show_formatting_toolbar) |
8317 | 911 gtk_widget_show(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
912 else |
8317 | 913 gtk_widget_hide(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
914 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
915 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
916 static void |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
917 menu_sounds_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
918 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
919 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
920 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
921 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
922 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
923 conv = gaim_conv_window_get_active_conversation(win); |
5908
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 if (!conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
926 return; |
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 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
929 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
930 gtkconv->make_sound = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
931 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
932 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
933 |
7961 | 934 static void |
935 chat_do_im(GaimConversation *conv, const char *who) | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
936 { |
7961 | 937 GaimPluginProtocolInfo *prpl_info = NULL; |
938 char *real_who; | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
939 GaimConversation *conv2; |
7961 | 940 GaimAccount *account; |
941 | |
942 account = gaim_conversation_get_account(conv); | |
943 | |
944 if(account && account->gc) | |
945 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl); | |
946 | |
947 if(prpl_info && prpl_info->get_cb_real_name) | |
948 real_who = prpl_info->get_cb_real_name(account->gc, | |
949 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); | |
950 else | |
951 real_who = g_strdup(who); | |
952 | |
953 if(!real_who) | |
954 return; | |
955 | |
956 conv2 = gaim_find_conversation_with_account(real_who, account); | |
957 | |
958 if (conv2 != NULL) | |
959 gaim_conv_window_show(gaim_conversation_get_window(conv2)); | |
960 else | |
961 conv2 = gaim_conversation_new(GAIM_CONV_IM, account, real_who); | |
962 | |
963 g_free(real_who); | |
964 } | |
965 | |
966 | |
967 static void | |
968 chat_im_button_cb(GtkWidget *widget, GaimConversation *conv) | |
969 { | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
970 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
971 GaimGtkChatPane *gtkchat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
972 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
973 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
974 GtkTreeSelection *sel; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
975 const char *name; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
976 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
977 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
978 gtkchat = gtkconv->u.chat; |
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 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
982 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
983 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
984 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
|
985 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
986 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
987 |
7961 | 988 chat_do_im(conv, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
989 } |
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 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
992 ignore_cb(GtkWidget *w, GaimConversation *conv) |
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 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
995 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
996 GaimConvChat *chat; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
997 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
998 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
999 GtkTreeSelection *sel; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1000 const char *name; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1001 int pos; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1002 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1003 chat = GAIM_CONV_CHAT(conv); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1004 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1005 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1006 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1007 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1008 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1009 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1010 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1011 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
|
1012 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
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 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1015 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1016 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1017 pos = g_list_index(gaim_conv_chat_get_users(chat), name); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1018 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1019 if (gaim_conv_chat_is_user_ignored(chat, name)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1020 gaim_conv_chat_unignore(chat, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1021 else |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1022 gaim_conv_chat_ignore(chat, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1023 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1024 add_chat_buddy_common(conv, name, pos); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1025 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1026 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1027 static void |
7398 | 1028 menu_chat_im_cb(GtkWidget *w, GaimConversation *conv) |
1029 { | |
1030 const char *who = g_object_get_data(G_OBJECT(w), "user_data"); | |
1031 | |
1032 chat_do_im(conv, who); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1033 } |
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 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1036 menu_chat_info_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1037 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1038 char *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1039 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1040 who = g_object_get_data(G_OBJECT(w), "user_data"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1041 |
7975 | 1042 chat_do_info(conv, who); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1043 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1044 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1045 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1046 menu_chat_get_away_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1047 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1048 GaimPluginProtocolInfo *prpl_info = NULL; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1049 GaimConnection *gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1050 char *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1051 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1052 gc = gaim_conversation_get_gc(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1053 who = g_object_get_data(G_OBJECT(w), "user_data"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1054 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1055 if (gc != NULL) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1056 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
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 * 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
|
1060 */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1061 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1062 if (prpl_info->get_cb_away != NULL) |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1063 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1064 prpl_info->get_cb_away(gc, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1065 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1066 } |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1067 } |
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 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1070 static void |
7928 | 1071 menu_chat_add_remove_cb(GtkWidget *w, GaimConversation *conv) |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1072 { |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1073 GaimAccount *account; |
6695 | 1074 GaimBuddy *b; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1075 char *name; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1076 |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1077 account = gaim_conversation_get_account(conv); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1078 name = g_object_get_data(G_OBJECT(w), "user_data"); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1079 b = gaim_find_buddy(account, name); |
5908
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 if (b != NULL) |
5975 | 1082 show_confirm_del(b); |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1083 else if (account != NULL && gaim_account_is_connected(account)) |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1084 gaim_blist_request_add_buddy(account, name, NULL, NULL); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1085 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1086 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1087 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1088 |
8143 | 1089 static GtkWidget * |
1090 create_chat_menu(GaimConversation *conv, gchar *who, | |
1091 GaimPluginProtocolInfo *prpl_info, GaimConnection *gc) | |
1092 { | |
1093 static GtkWidget *menu = NULL; | |
1094 GtkWidget *button; | |
1095 | |
1096 /* | |
1097 * If a menu already exists, destroy it before creating a new one, | |
1098 * thus freeing-up the memory it occupied. | |
1099 */ | |
1100 if (menu) | |
1101 gtk_widget_destroy(menu); | |
1102 | |
1103 menu = gtk_menu_new(); | |
1104 | |
1105 button = gtk_menu_item_new_with_label(_("IM")); | |
1106 g_signal_connect(G_OBJECT(button), "activate", | |
1107 G_CALLBACK(menu_chat_im_cb), conv); | |
1108 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1109 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1110 gtk_widget_show(button); | |
1111 | |
1112 if (gaim_conv_chat_is_user_ignored(GAIM_CONV_CHAT(conv), who)) | |
1113 button = gtk_menu_item_new_with_label(_("Un-Ignore")); | |
1114 else | |
1115 button = gtk_menu_item_new_with_label(_("Ignore")); | |
1116 | |
1117 g_signal_connect(G_OBJECT(button), "activate", | |
1118 G_CALLBACK(ignore_cb), conv); | |
1119 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1120 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1121 gtk_widget_show(button); | |
1122 | |
8170 | 1123 if (gc && (prpl_info->get_info || prpl_info->get_cb_info)) { |
8143 | 1124 button = gtk_menu_item_new_with_label(_("Info")); |
1125 g_signal_connect(G_OBJECT(button), "activate", | |
1126 G_CALLBACK(menu_chat_info_cb), conv); | |
1127 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1128 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1129 gtk_widget_show(button); | |
1130 } | |
1131 | |
1132 if (gc && prpl_info->get_cb_away) { | |
1133 button = gtk_menu_item_new_with_label(_("Get Away Msg")); | |
1134 g_signal_connect(G_OBJECT(button), "activate", | |
1135 G_CALLBACK(menu_chat_get_away_cb), conv); | |
1136 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1137 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1138 gtk_widget_show(button); | |
1139 } | |
1140 | |
8170 | 1141 /* XXX: jabber can only add buddies from here in certain circumstances */ |
8143 | 1142 /* Added by Jonas <jonas@birme.se> */ |
1143 if (gc) { | |
1144 if (gaim_find_buddy(gc->account, who)) | |
1145 button = gtk_menu_item_new_with_label(_("Remove")); | |
1146 else | |
1147 button = gtk_menu_item_new_with_label(_("Add")); | |
1148 | |
1149 g_signal_connect(G_OBJECT(button), "activate", | |
1150 G_CALLBACK(menu_chat_add_remove_cb), conv); | |
1151 | |
1152 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1153 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1154 gtk_widget_show(button); | |
1155 } | |
1156 /* End Jonas */ | |
1157 | |
1158 return menu; | |
1159 } | |
1160 | |
1161 | |
1162 static gint | |
1163 gtkconv_chat_popup_menu_cb(GtkWidget *widget, GaimConversation *conv) | |
1164 { | |
1165 GaimGtkConversation *gtkconv; | |
1166 GaimPluginProtocolInfo *prpl_info = NULL; | |
1167 GaimGtkChatPane *gtkchat; | |
1168 GaimConnection *gc; | |
1169 GaimAccount *account; | |
1170 GtkTreeSelection *sel; | |
1171 GtkTreeIter iter; | |
1172 GtkTreeModel *model; | |
1173 GtkWidget *menu; | |
1174 gchar *who; | |
1175 | |
1176 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1177 gtkchat = gtkconv->u.chat; | |
1178 account = gaim_conversation_get_account(conv); | |
1179 gc = account->gc; | |
1180 | |
1181 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | |
1182 | |
1183 if (gc != NULL) | |
1184 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | |
1185 | |
1186 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); | |
1187 if(!gtk_tree_selection_get_selected(sel, NULL, &iter)) | |
1188 return FALSE; | |
1189 | |
1190 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &who, -1); | |
1191 menu = create_chat_menu (conv, who, prpl_info, gc); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1192 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1193 gaim_gtk_treeview_popup_menu_position_func, widget, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1194 0, GDK_CURRENT_TIME); |
8143 | 1195 |
1196 return TRUE; | |
1197 } | |
1198 | |
1199 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1200 static gint |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1201 right_click_chat_cb(GtkWidget *widget, GdkEventButton *event, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1202 GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1203 { |
8143 | 1204 GaimGtkConversation *gtkconv; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1205 GaimPluginProtocolInfo *prpl_info = NULL; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1206 GaimGtkChatPane *gtkchat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1207 GaimConnection *gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1208 GaimAccount *account; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1209 GtkTreePath *path; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1210 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1211 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1212 GtkTreeViewColumn *column; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1213 gchar *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1214 int x, y; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1215 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1216 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1217 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1218 account = gaim_conversation_get_account(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1219 gc = account->gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1220 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1221 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1222 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1223 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
|
1224 event->x, event->y, &path, &column, &x, &y); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1225 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1226 if (path == NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1227 return FALSE; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1228 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1229 if (gc != NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1230 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1231 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1232 gtk_tree_selection_select_path(GTK_TREE_SELECTION( |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1233 gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list))), path); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1234 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1235 gtk_tree_model_get_iter(GTK_TREE_MODEL(model), &iter, path); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1236 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
|
1237 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1238 if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) { |
7398 | 1239 chat_do_im(conv, who); |
1240 } else if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { | |
8143 | 1241 GtkWidget *menu = create_chat_menu (conv, who, prpl_info, gc); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1242 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1243 event->button, event->time); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1244 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1245 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1246 return TRUE; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1247 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1248 |
8133 | 1249 static void |
1250 move_to_next_unread_tab(GaimConversation *conv) | |
1251 { | |
1252 GaimConversation *next_conv = NULL; | |
1253 GaimConvWindow *win; | |
1254 GList *l; | |
1255 int index, i; | |
1256 | |
1257 win = gaim_conversation_get_window(conv); | |
1258 index = gaim_conversation_get_index(conv); | |
1259 | |
1260 /* First check the tabs after this position. */ | |
1261 for (l = g_list_nth(gaim_conv_window_get_conversations(win), index); | |
1262 l != NULL; | |
1263 l = l->next) { | |
1264 | |
1265 next_conv = (GaimConversation *)l->data; | |
1266 | |
1267 if (gaim_conversation_get_unseen(next_conv) > 0) | |
1268 break; | |
1269 | |
1270 next_conv = NULL; | |
1271 } | |
1272 | |
1273 if (next_conv == NULL) { | |
1274 | |
1275 /* Now check before this position. */ | |
1276 for (l = gaim_conv_window_get_conversations(win), i = 0; | |
1277 l != NULL && i < index; | |
1278 l = l->next) { | |
1279 | |
1280 next_conv = (GaimConversation *)l->data; | |
1281 | |
1282 if (gaim_conversation_get_unseen(next_conv) > 0) | |
1283 break; | |
1284 | |
1285 next_conv = NULL; | |
1286 } | |
1287 | |
1288 if (next_conv == NULL) { | |
1289 /* Okay, just grab the next conversation tab. */ | |
1290 if (index == gaim_conv_window_get_conversation_count(win) - 1) | |
1291 next_conv = gaim_conv_window_get_conversation_at(win, 0); | |
1292 else | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1293 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1294 next_conv = gaim_conv_window_get_conversation_at(win, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1295 index + 1); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1296 } |
8133 | 1297 } |
1298 } | |
1299 | |
1300 if (next_conv != NULL && next_conv != conv) { | |
1301 gaim_conv_window_switch_conversation(win, | |
1302 gaim_conversation_get_index(next_conv)); | |
1303 } | |
1304 } | |
1305 | |
4359 | 1306 static gboolean |
8105 | 1307 entry_key_press_cb(GtkWidget *entry, GdkEventKey *event, gpointer data) |
4359 | 1308 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1309 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1310 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1311 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1312 GaimGtkWindow *gtkwin; |
8105 | 1313 int numconvs; |
1314 int curconv; | |
1315 | |
1316 conv = (GaimConversation *)data; | |
1317 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1318 win = gaim_conversation_get_window(conv); | |
1319 gtkwin = GAIM_GTK_WINDOW(win); | |
1320 numconvs = gaim_conv_window_get_conversation_count(win); | |
1321 curconv = gaim_conversation_get_index(conv); | |
1322 | |
1323 /* If CTRL was held down... */ | |
1324 if (event->state & GDK_CONTROL_MASK) { | |
4359 | 1325 switch (event->keyval) { |
8105 | 1326 case GDK_Return: |
1327 case GDK_KP_Enter: | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1328 if (gaim_prefs_get_bool( |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1329 "/gaim/gtk/conversations/ctrl_enter_sends")) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1330 { |
8105 | 1331 send_cb(NULL, conv); |
1332 | |
1333 return TRUE; | |
1334 } | |
1335 break; | |
1336 | |
4359 | 1337 case GDK_Up: |
1338 if (!conv->send_history) | |
1339 break; | |
1340 | |
1341 if (!conv->send_history->prev) { | |
1342 GtkTextIter start, end; | |
1343 | |
1344 if (conv->send_history->data) | |
1345 g_free(conv->send_history->data); | |
1346 | |
1347 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, | |
1348 &start); | |
1349 gtk_text_buffer_get_end_iter(gtkconv->entry_buffer, &end); | |
1350 | |
1351 conv->send_history->data = | |
8506 | 1352 gtk_imhtml_get_markup(GTK_IMHTML(gtkconv->entry)); |
4359 | 1353 } |
8677 | 1354 |
4359 | 1355 if (conv->send_history->next && |
1356 conv->send_history->next->data) { | |
8677 | 1357 GtkTextIter iter; |
1358 GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); | |
4359 | 1359 |
1360 conv->send_history = conv->send_history->next; | |
8061 | 1361 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1362 gtk_imhtml_append_text_with_images( |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1363 GTK_IMHTML(gtkconv->entry), conv->send_history->data, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1364 0, NULL); |
8677 | 1365 /* this is mainly just a hack so the formatting at the |
1366 * cursor gets picked up. */ | |
1367 gtk_text_buffer_get_end_iter(buffer, &iter); | |
1368 gtk_text_buffer_move_mark_by_name(buffer, "insert", &iter); | |
4359 | 1369 } |
1370 | |
8105 | 1371 return TRUE; |
4359 | 1372 break; |
1373 | |
1374 case GDK_Down: | |
1375 if (!conv->send_history) | |
1376 break; | |
1377 | |
8105 | 1378 if (conv->send_history->prev && |
1379 conv->send_history->prev->data) { | |
8677 | 1380 GtkTextIter iter; |
1381 GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); | |
8105 | 1382 |
4359 | 1383 conv->send_history = conv->send_history->prev; |
8105 | 1384 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1385 gtk_imhtml_append_text_with_images( |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1386 GTK_IMHTML(gtkconv->entry), conv->send_history->data, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1387 0, NULL); |
8677 | 1388 /* this is mainly just a hack so the formatting at the |
1389 * cursor gets picked up. */ | |
1390 gtk_text_buffer_get_end_iter(buffer, &iter); | |
1391 gtk_text_buffer_move_mark_by_name(buffer, "insert", &iter); | |
4359 | 1392 } |
1393 | |
8105 | 1394 return TRUE; |
4359 | 1395 break; |
8105 | 1396 |
8108 | 1397 case GDK_Page_Down: |
8143 | 1398 case ']': |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1399 gaim_conv_window_switch_conversation(win, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1400 (curconv + 1) % numconvs); |
8105 | 1401 |
1402 return TRUE; | |
1403 break; | |
1404 | |
8108 | 1405 case GDK_Page_Up: |
8143 | 1406 case '[': |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1407 gaim_conv_window_switch_conversation(win, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1408 (curconv + numconvs - 1) % numconvs); |
8133 | 1409 |
1410 return TRUE; | |
1411 break; | |
1412 | |
8108 | 1413 case GDK_Tab: |
8133 | 1414 move_to_next_unread_tab(conv); |
8108 | 1415 |
1416 return TRUE; | |
1417 break; | |
1418 | |
1419 case 'l': | |
1420 gtk_imhtml_clear(GTK_IMHTML(gtkconv->imhtml)); | |
1421 g_string_free(conv->history, TRUE); | |
8912 | 1422 conv->history = g_string_new(""); |
8108 | 1423 |
1424 return TRUE; | |
1425 break; | |
1426 | |
1427 case 'z': | |
1428 gtk_window_iconify(GTK_WINDOW(gtkwin->window)); | |
8105 | 1429 |
1430 return TRUE; | |
1431 break; | |
1432 | |
1433 } /* End of switch */ | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1434 } |
8758 | 1435 |
8105 | 1436 /* If ALT (or whatever) was held down... */ |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1437 else if (event->state & GDK_MOD1_MASK) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1438 { |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8730
diff
changeset
|
1439 /* XXX - Make sure the conv exists before switching to it */ |
8105 | 1440 if (event->keyval > '0' && event->keyval <= '9') { |
1441 int switchto = event->keyval - '1'; | |
1442 if (switchto < numconvs) | |
1443 gaim_conv_window_switch_conversation(win, switchto); | |
4359 | 1444 |
1445 return TRUE; | |
1446 } | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1447 } |
8758 | 1448 |
8105 | 1449 /* If neither CTRL nor ALT were held down... */ |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1450 else |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1451 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1452 switch (event->keyval) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1453 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1454 case GDK_Return: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1455 case GDK_KP_Enter: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1456 if (!(event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK)) && |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1457 gaim_prefs_get_bool("/gaim/gtk/conversations/enter_sends")) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1458 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1459 send_cb(NULL, conv); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1460 return TRUE; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1461 } |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1462 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1463 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1464 case GDK_Tab: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1465 if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT && |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1466 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/tab_completion")) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1467 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1468 tab_complete(conv); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1469 return TRUE; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1470 } |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1471 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1472 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1473 case GDK_Page_Up: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1474 gtk_imhtml_page_up(GTK_IMHTML(gtkconv->imhtml)); |
8105 | 1475 return TRUE; |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1476 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1477 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1478 case GDK_Page_Down: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1479 gtk_imhtml_page_down(GTK_IMHTML(gtkconv->imhtml)); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1480 return TRUE; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1481 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1482 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1483 case GDK_F2: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1484 gaim_prefs_set_bool("/gaim/gtk/conversations/show_timestamps", |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1485 !gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1486 return TRUE; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1487 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1488 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1489 } |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1490 } |
4359 | 1491 |
1492 return FALSE; | |
1493 } | |
1494 | |
1495 /* | |
1496 * NOTE: | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1497 * This guy just kills a single right click from being propagated any |
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1498 * further. I have no idea *why* we need this, but we do ... It |
4359 | 1499 * prevents right clicks on the GtkTextView in a convo dialog from |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1500 * going all the way down to the notebook. I suspect a bug in |
4359 | 1501 * GtkTextView, but I'm not ready to point any fingers yet. |
1502 */ | |
1503 static gboolean | |
1504 entry_stop_rclick_cb(GtkWidget *widget, GdkEventButton *event, gpointer data) | |
1505 { | |
1506 if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { | |
1507 /* Right single click */ | |
1508 g_signal_stop_emission_by_name(G_OBJECT(widget), "button_press_event"); | |
1509 | |
1510 return TRUE; | |
1511 } | |
1512 | |
1513 return FALSE; | |
1514 } | |
1515 | |
8173 | 1516 /* |
1517 * If someone tries to type into the conversation backlog of a | |
1518 * conversation window then we yank focus from the conversation backlog | |
1519 * and give it to the text entry box so that people can type | |
1520 * all the live long day and it will get entered into the entry box. | |
1521 */ | |
6057 | 1522 static gboolean |
8105 | 1523 refocus_entry_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) |
6057 | 1524 { |
1525 GaimGtkConversation *gtkconv = data; | |
1526 | |
8237 | 1527 /* If we have a valid key for the conversation display, then exit */ |
8224 | 1528 if ((event->state & GDK_CONTROL_MASK) || |
8237 | 1529 (event->keyval == GDK_F10) || |
1530 (event->keyval == GDK_Shift_L) || | |
1531 (event->keyval == GDK_Shift_R) || | |
1532 (event->keyval == GDK_Escape) || | |
8177 | 1533 (event->keyval == GDK_Up) || |
1534 (event->keyval == GDK_Down) || | |
1535 (event->keyval == GDK_Left) || | |
8191 | 1536 (event->keyval == GDK_Right) || |
1537 (event->keyval == GDK_Home) || | |
1538 (event->keyval == GDK_End)) | |
8177 | 1539 return FALSE; |
1540 | |
1541 if (event->type == GDK_KEY_RELEASE) | |
1542 gtk_widget_grab_focus(gtkconv->entry); | |
1543 | |
1544 gtk_widget_event(gtkconv->entry, (GdkEvent *)event); | |
1545 | |
1546 return TRUE; | |
6057 | 1547 } |
1548 | |
4359 | 1549 static void |
4673 | 1550 menu_conv_sel_send_cb(GObject *m, gpointer data) |
4359 | 1551 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1552 GaimConvWindow *win = g_object_get_data(m, "user_data"); |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
1553 GaimAccount *account = g_object_get_data(m, "gaim_account"); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1554 GaimConversation *conv; |
8456 | 1555 GaimGtkConversation *gtkconv; |
1556 GaimPlugin *protocol; | |
4359 | 1557 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1558 conv = gaim_conv_window_get_active_conversation(win); |
4359 | 1559 |
4491 | 1560 gaim_conversation_set_account(conv, account); |
8456 | 1561 |
1562 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1563 protocol = gaim_find_prpl(conv->account->protocol_id); | |
1564 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), | |
1565 protocol->info->name); | |
4359 | 1566 } |
1567 | |
1568 static void | |
1569 insert_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *position, | |
1570 gchar *new_text, gint new_text_length, gpointer user_data) | |
1571 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1572 GaimConversation *conv = (GaimConversation *)user_data; |
4359 | 1573 |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1574 g_return_if_fail(conv != NULL); |
4359 | 1575 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1576 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) |
4359 | 1577 return; |
1578 | |
1579 got_typing_keypress(conv, (gtk_text_iter_is_start(position) && | |
1580 gtk_text_iter_is_end(position))); | |
1581 } | |
1582 | |
1583 static void | |
1584 delete_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *start_pos, | |
1585 GtkTextIter *end_pos, gpointer user_data) | |
1586 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1587 GaimConversation *conv = (GaimConversation *)user_data; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1588 GaimConvIm *im; |
4359 | 1589 |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1590 g_return_if_fail(conv != NULL); |
4359 | 1591 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1592 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) |
4359 | 1593 return; |
1594 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1595 im = GAIM_CONV_IM(conv); |
4359 | 1596 |
1597 if (gtk_text_iter_is_start(start_pos) && gtk_text_iter_is_end(end_pos)) { | |
1598 | |
1599 /* We deleted all the text, so turn off typing. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1600 if (gaim_conv_im_get_type_again_timeout(im)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1601 gaim_conv_im_stop_type_again_timeout(im); |
4359 | 1602 |
1603 serv_send_typing(gaim_conversation_get_gc(conv), | |
6695 | 1604 gaim_conversation_get_name(conv), |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
1605 GAIM_NOT_TYPING); |
4359 | 1606 } |
1607 else { | |
1608 /* We're deleting, but not all of it, so it counts as typing. */ | |
1609 got_typing_keypress(conv, FALSE); | |
1610 } | |
1611 } | |
1612 | |
1613 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1614 notebook_init_grab(GaimGtkWindow *gtkwin, GtkWidget *widget) |
4359 | 1615 { |
1616 static GdkCursor *cursor = NULL; | |
1617 | |
1618 gtkwin->in_drag = TRUE; | |
1619 | |
1620 if (gtkwin->drag_leave_signal) { | |
1621 g_signal_handler_disconnect(G_OBJECT(widget), | |
1622 gtkwin->drag_leave_signal); | |
1623 | |
1624 gtkwin->drag_leave_signal = 0; | |
1625 } | |
1626 | |
1627 if (cursor == NULL) | |
1628 cursor = gdk_cursor_new(GDK_FLEUR); | |
1629 | |
1630 /* Grab the pointer */ | |
1631 gtk_grab_add(gtkwin->notebook); | |
5114
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1632 #ifndef _WIN32 |
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1633 /* 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
|
1634 always be true after a button press. */ |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1635 if (!gdk_pointer_is_grabbed()) |
5114
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1636 #endif |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1637 gdk_pointer_grab(gtkwin->notebook->window, FALSE, |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1638 GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1639 NULL, cursor, GDK_CURRENT_TIME); |
4359 | 1640 } |
1641 | |
1642 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1643 notebook_motion_cb(GtkWidget *widget, GdkEventButton *e, GaimConvWindow *win) |
4359 | 1644 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1645 GaimGtkWindow *gtkwin; |
4359 | 1646 |
1647 gtkwin = GAIM_GTK_WINDOW(win); | |
1648 | |
1649 /* | |
1650 * Make sure the user moved the mouse far enough for the | |
1651 * drag to be initiated. | |
1652 */ | |
1653 if (gtkwin->in_predrag) { | |
1654 if (e->x_root < gtkwin->drag_min_x || | |
1655 e->x_root >= gtkwin->drag_max_x || | |
1656 e->y_root < gtkwin->drag_min_y || | |
1657 e->y_root >= gtkwin->drag_max_y) { | |
1658 | |
1659 gtkwin->in_predrag = FALSE; | |
1660 notebook_init_grab(gtkwin, widget); | |
1661 } | |
1662 } | |
1663 else { /* Otherwise, draw the arrows. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1664 GaimConvWindow *dest_win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1665 GaimGtkWindow *dest_gtkwin; |
4359 | 1666 GtkNotebook *dest_notebook; |
1667 GtkWidget *tab, *last_vis_tab = NULL; | |
1668 gint nb_x, nb_y, page_num, i, last_vis_tab_loc = -1; | |
1669 gint arrow1_x, arrow1_y, arrow2_x, arrow2_y; | |
1670 gboolean horiz_tabs = FALSE, tab_found = FALSE; | |
1671 GList *l; | |
1672 | |
1673 /* Get the window that the cursor is over. */ | |
1674 dest_win = gaim_gtkwin_get_at_xy(e->x_root, e->y_root); | |
1675 | |
1676 if (dest_win == NULL) { | |
1677 dnd_hints_hide_all(); | |
1678 | |
1679 return TRUE; | |
1680 } | |
1681 | |
1682 dest_gtkwin = GAIM_GTK_WINDOW(dest_win); | |
1683 | |
1684 dest_notebook = GTK_NOTEBOOK(dest_gtkwin->notebook); | |
1685 | |
1686 gdk_window_get_origin(GTK_WIDGET(dest_notebook)->window, &nb_x, &nb_y); | |
1687 | |
1688 arrow1_x = arrow2_x = nb_x; | |
1689 arrow1_y = arrow2_y = nb_y; | |
1690 | |
1691 page_num = gaim_gtkconv_get_dest_tab_at_xy(dest_win, | |
1692 e->x_root, e->y_root); | |
1693 | |
1694 if (gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_TOP || | |
1695 gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_BOTTOM) { | |
1696 | |
1697 horiz_tabs = TRUE; | |
1698 } | |
1699 | |
1700 /* Find out where to put the arrows. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1701 for (l = gaim_conv_window_get_conversations(dest_win), i = 0; |
4359 | 1702 l != NULL; |
1703 l = l->next, i++) { | |
1704 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1705 GaimConversation *conv = l->data; |
4359 | 1706 |
1707 tab = GAIM_GTK_CONVERSATION(conv)->tabby; | |
1708 | |
1709 /* | |
1710 * If this is the correct tab, record the positions | |
1711 * for the arrows. | |
1712 */ | |
1713 if (i == page_num) { | |
1714 if (horiz_tabs) { | |
1715 arrow1_x = arrow2_x = nb_x + tab->allocation.x; | |
1716 arrow1_y = nb_y + tab->allocation.y; | |
1717 arrow2_y = nb_y + tab->allocation.y + | |
1718 tab->allocation.height; | |
1719 } | |
1720 else { | |
1721 arrow1_x = nb_x + tab->allocation.x; | |
1722 arrow2_x = nb_x + tab->allocation.x + | |
1723 tab->allocation.width; | |
1724 arrow1_y = arrow2_y = nb_y + tab->allocation.y; | |
1725 } | |
1726 | |
1727 tab_found = TRUE; | |
1728 break; | |
1729 } | |
1730 else { /* Keep track of the right-most tab that we see. */ | |
1731 if (horiz_tabs && tab->allocation.x > last_vis_tab_loc) { | |
1732 last_vis_tab = tab; | |
1733 last_vis_tab_loc = tab->allocation.x; | |
1734 } | |
1735 else if (!horiz_tabs && tab->allocation.y > last_vis_tab_loc) { | |
1736 last_vis_tab = tab; | |
1737 last_vis_tab_loc = tab->allocation.y; | |
1738 } | |
1739 } | |
1740 } | |
1741 | |
1742 /* | |
1743 * If we didn't find the tab, then we'll just place the | |
1744 * arrows to the right/bottom of the last visible tab. | |
1745 */ | |
1746 if (!tab_found && last_vis_tab) { | |
1747 if (horiz_tabs) { | |
1748 arrow1_x = arrow2_x = nb_x + last_vis_tab->allocation.x + | |
1749 last_vis_tab->allocation.width; | |
1750 arrow1_y = nb_y + last_vis_tab->allocation.y; | |
1751 arrow2_y = nb_y + last_vis_tab->allocation.y + | |
1752 last_vis_tab->allocation.height; | |
1753 } | |
1754 else { | |
1755 arrow1_x = nb_x + last_vis_tab->allocation.x; | |
1756 arrow2_x = nb_x + last_vis_tab->allocation.x + | |
1757 last_vis_tab->allocation.width; | |
1758 arrow1_y = arrow2_y = nb_y + last_vis_tab->allocation.y + | |
1759 last_vis_tab->allocation.height; | |
1760 } | |
1761 } | |
1762 | |
1763 if (horiz_tabs) { | |
1764 dnd_hints_show(HINT_ARROW_DOWN, arrow1_x, arrow1_y); | |
1765 dnd_hints_show(HINT_ARROW_UP, arrow2_x, arrow2_y); | |
1766 } | |
1767 else { | |
1768 dnd_hints_show(HINT_ARROW_RIGHT, arrow1_x, arrow1_y); | |
1769 dnd_hints_show(HINT_ARROW_LEFT, arrow2_x, arrow2_y); | |
1770 } | |
1771 } | |
1772 | |
1773 return TRUE; | |
1774 } | |
1775 | |
1776 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1777 notebook_leave_cb(GtkWidget *widget, GdkEventCrossing *e, GaimConvWindow *win) |
4359 | 1778 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1779 GaimGtkWindow *gtkwin; |
4359 | 1780 |
1781 gtkwin = GAIM_GTK_WINDOW(win); | |
1782 | |
1783 if (gtkwin->in_drag) | |
1784 return FALSE; | |
1785 | |
1786 if (e->x_root < gtkwin->drag_min_x || | |
1787 e->x_root >= gtkwin->drag_max_x || | |
1788 e->y_root < gtkwin->drag_min_y || | |
1789 e->y_root >= gtkwin->drag_max_y) { | |
1790 | |
1791 gtkwin->in_predrag = FALSE; | |
1792 notebook_init_grab(gtkwin, widget); | |
1793 } | |
1794 | |
1795 return TRUE; | |
1796 } | |
1797 | |
1798 /* | |
1799 * THANK YOU GALEON! | |
1800 */ | |
1801 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1802 notebook_press_cb(GtkWidget *widget, GdkEventButton *e, GaimConvWindow *win) |
4359 | 1803 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1804 GaimGtkWindow *gtkwin; |
4359 | 1805 gint nb_x, nb_y, x_rel, y_rel; |
1806 GList *l; | |
1807 int tab_clicked; | |
1808 | |
1809 if (e->button != 1 || e->type != GDK_BUTTON_PRESS) | |
1810 return FALSE; | |
1811 | |
1812 gtkwin = GAIM_GTK_WINDOW(win); | |
1813 | |
1814 if (gtkwin->in_drag) { | |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1815 gaim_debug(GAIM_DEBUG_WARNING, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1816 "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
|
1817 return TRUE; |
4359 | 1818 } |
1819 | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1820 /* |
4359 | 1821 * Make sure a tab was actually clicked. The arrow buttons |
1822 * mess things up. | |
1823 */ | |
1824 tab_clicked = gaim_gtkconv_get_tab_at_xy(win, e->x_root, e->y_root); | |
1825 | |
1826 if (tab_clicked == -1) | |
1827 return FALSE; | |
1828 | |
1829 /* | |
1830 * Get the relative position of the press event, with regards to | |
1831 * the position of the notebook. | |
1832 */ | |
1833 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
1834 | |
1835 x_rel = e->x_root - nb_x; | |
1836 y_rel = e->y_root - nb_y; | |
1837 | |
1838 /* Reset the min/max x/y */ | |
1839 gtkwin->drag_min_x = 0; | |
1840 gtkwin->drag_min_y = 0; | |
1841 gtkwin->drag_max_x = 0; | |
1842 gtkwin->drag_max_y = 0; | |
1843 | |
1844 /* Find out which tab was dragged. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1845 for (l = gaim_conv_window_get_conversations(win); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1846 GaimConversation *conv = l->data; |
4359 | 1847 GtkWidget *tab = GAIM_GTK_CONVERSATION(conv)->tabby; |
1848 | |
1849 if (!GTK_WIDGET_VISIBLE(tab)) | |
1850 continue; | |
1851 | |
1852 if (tab->allocation.x > x_rel || tab->allocation.y > y_rel) | |
1853 break; | |
1854 | |
1855 /* Save the borders of the tab. */ | |
1856 gtkwin->drag_min_x = tab->allocation.x + nb_x; | |
1857 gtkwin->drag_min_y = tab->allocation.y + nb_y; | |
1858 gtkwin->drag_max_x = tab->allocation.width + gtkwin->drag_min_x; | |
1859 gtkwin->drag_max_y = tab->allocation.height + gtkwin->drag_min_y; | |
1860 } | |
1861 | |
1862 /* Make sure the click occurred in the tab. */ | |
1863 if (e->x_root < gtkwin->drag_min_x || | |
1864 e->x_root >= gtkwin->drag_max_x || | |
1865 e->y_root < gtkwin->drag_min_y || | |
1866 e->y_root >= gtkwin->drag_max_y) { | |
1867 | |
1868 return FALSE; | |
1869 } | |
1870 | |
1871 gtkwin->in_predrag = TRUE; | |
1872 | |
1873 /* Connect the new motion signals. */ | |
1874 gtkwin->drag_motion_signal = | |
1875 g_signal_connect(G_OBJECT(widget), "motion_notify_event", | |
1876 G_CALLBACK(notebook_motion_cb), win); | |
1877 | |
1878 gtkwin->drag_leave_signal = | |
1879 g_signal_connect(G_OBJECT(widget), "leave_notify_event", | |
1880 G_CALLBACK(notebook_leave_cb), win); | |
1881 | |
1882 return FALSE; | |
1883 } | |
1884 | |
1885 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1886 notebook_release_cb(GtkWidget *widget, GdkEventButton *e, GaimConvWindow *win) |
4359 | 1887 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1888 GaimConvWindow *dest_win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1889 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1890 GaimGtkWindow *dest_gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1891 GaimConversation *conv; |
4359 | 1892 GtkNotebook *dest_notebook; |
1893 gint dest_page_num; | |
1894 | |
1895 /* | |
1896 * Don't check to make sure that the event's window matches the | |
1897 * widget's, because we may be getting an event passed on from the | |
1898 * close button. | |
1899 */ | |
1900 if (e->button != 1 && e->type != GDK_BUTTON_RELEASE) | |
1901 return FALSE; | |
1902 | |
1903 if (gdk_pointer_is_grabbed()) { | |
1904 gdk_pointer_ungrab(GDK_CURRENT_TIME); | |
1905 gtk_grab_remove(widget); | |
1906 } | |
1907 | |
1908 gtkwin = GAIM_GTK_WINDOW(win); | |
1909 | |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1910 if (!gtkwin->in_predrag && !gtkwin->in_drag) |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1911 return FALSE; |
4359 | 1912 |
1913 /* Disconnect the motion signal. */ | |
1914 if (gtkwin->drag_motion_signal) { | |
1915 g_signal_handler_disconnect(G_OBJECT(widget), | |
1916 gtkwin->drag_motion_signal); | |
1917 | |
1918 gtkwin->drag_motion_signal = 0; | |
1919 } | |
1920 | |
1921 /* | |
1922 * If we're in a pre-drag, we'll also need to disconnect the leave | |
1923 * signal. | |
1924 */ | |
1925 if (gtkwin->in_predrag) { | |
1926 gtkwin->in_predrag = FALSE; | |
1927 | |
1928 if (gtkwin->drag_leave_signal) { | |
1929 g_signal_handler_disconnect(G_OBJECT(widget), | |
1930 gtkwin->drag_leave_signal); | |
1931 | |
1932 gtkwin->drag_leave_signal = 0; | |
1933 } | |
1934 } | |
1935 | |
1936 /* If we're not in drag... */ | |
1937 /* We're perfectly normal people! */ | |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1938 if (!gtkwin->in_drag) |
4359 | 1939 return FALSE; |
1940 | |
1941 gtkwin->in_drag = FALSE; | |
1942 | |
1943 dnd_hints_hide_all(); | |
1944 | |
4369
7e1fb422e5fd
[gaim-migrate @ 4635]
Christian Hammond <chipx86@chipx86.com>
parents:
4368
diff
changeset
|
1945 dest_win = gaim_gtkwin_get_at_xy(e->x_root, e->y_root); |
4359 | 1946 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1947 conv = gaim_conv_window_get_active_conversation(win); |
4359 | 1948 |
1949 if (dest_win == NULL) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1950 if (gaim_conv_window_get_conversation_count(win) < 2) |
4359 | 1951 return FALSE; |
1952 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1953 if (gaim_conv_window_get_conversation_count(win) > 1) { |
4359 | 1954 /* Make a new window to stick this to. */ |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1955 GaimGtkConversation *gtkconv; |
4748
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1956 gint win_width, win_height; |
5121 | 1957 |
1958 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4359 | 1959 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
1960 dest_win = gaim_conv_window_new(); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
1961 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
1962 gaim_conv_window_add_conversation(dest_win, |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1963 gaim_conv_window_remove_conversation(win, |
5139
d0182ae31ab8
[gaim-migrate @ 5503]
Christian Hammond <chipx86@chipx86.com>
parents:
5133
diff
changeset
|
1964 gaim_conversation_get_index(conv))); |
5121 | 1965 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
1966 dest_gtkwin = GAIM_GTK_WINDOW(dest_win); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
1967 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
1968 gtk_window_get_size(GTK_WINDOW(dest_gtkwin->window), |
4748
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1969 &win_width, &win_height); |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1970 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
1971 gtk_window_move(GTK_WINDOW(dest_gtkwin->window), |
4748
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1972 e->x_root - (win_width / 2), |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1973 e->y_root - (win_height / 2)); |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1974 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
1975 gaim_conv_window_show(dest_win); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
1976 } |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
1977 } else { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
1978 dest_gtkwin = GAIM_GTK_WINDOW(dest_win); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
1979 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
1980 /* Get the destination notebook. */ |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
1981 dest_notebook = GTK_NOTEBOOK(gtkwin->notebook); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
1982 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
1983 /* Get the destination page number. */ |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
1984 dest_page_num = gaim_gtkconv_get_dest_tab_at_xy(dest_win, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
1985 e->x_root, e->y_root); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
1986 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
1987 if (win == dest_win) { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
1988 gaim_conv_window_move_conversation(win, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
1989 gaim_conversation_get_index(conv), dest_page_num); |
4359 | 1990 } |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
1991 else { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
1992 size_t pos; |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
1993 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
1994 gaim_conv_window_remove_conversation(win, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
1995 gaim_conversation_get_index(conv)); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
1996 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
1997 pos = gaim_conv_window_add_conversation(dest_win, conv); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
1998 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
1999 if (pos != dest_page_num) |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2000 gaim_conv_window_move_conversation(dest_win, pos, dest_page_num); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2001 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2002 gaim_conv_window_switch_conversation(dest_win, dest_page_num); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2003 } |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2004 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2005 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); |
4359 | 2006 } |
2007 | |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2008 gaim_signal_emit(gaim_gtk_conversations_get_handle(), "conversation-drag-ended", |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2009 win, dest_win); |
4359 | 2010 |
2011 return TRUE; | |
2012 } | |
2013 | |
8189 | 2014 /************************************************************************** |
2015 * A bunch of buddy icon functions | |
2016 **************************************************************************/ | |
2017 static GdkPixbuf * | |
8755
d0364feabf96
[gaim-migrate @ 9510]
Christian Hammond <chipx86@chipx86.com>
parents:
8748
diff
changeset
|
2018 get_tab_icon(GaimConversation *conv, gboolean small_icon) |
7143 | 2019 { |
2020 GaimAccount *account = gaim_conversation_get_account(conv); | |
2021 const char *name = gaim_conversation_get_name(conv); | |
2022 GdkPixbuf *status = NULL; | |
2023 | |
2024 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
2025 GaimBuddy *b = gaim_find_buddy(account, name); | |
2026 if (b != NULL) { | |
2027 status = gaim_gtk_blist_get_status_icon((GaimBlistNode*)b, | |
8755
d0364feabf96
[gaim-migrate @ 9510]
Christian Hammond <chipx86@chipx86.com>
parents:
8748
diff
changeset
|
2028 (small_icon ? GAIM_STATUS_ICON_SMALL : GAIM_STATUS_ICON_LARGE)); |
7143 | 2029 } |
2030 } | |
2031 | |
2032 if (!status) { | |
2033 GdkPixbuf *pixbuf; | |
2034 pixbuf = create_prpl_icon(account); | |
2035 | |
8755
d0364feabf96
[gaim-migrate @ 9510]
Christian Hammond <chipx86@chipx86.com>
parents:
8748
diff
changeset
|
2036 if (small_icon && pixbuf != NULL) |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2037 { |
7143 | 2038 status = gdk_pixbuf_scale_simple(pixbuf, 15, 15, |
2039 GDK_INTERP_BILINEAR); | |
2040 g_object_unref(pixbuf); | |
2041 } | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2042 else |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2043 status = pixbuf; |
7143 | 2044 } |
2045 return status; | |
2046 } | |
2047 | |
8189 | 2048 static void |
2049 update_tab_icon(GaimConversation *conv) | |
2050 { | |
2051 GaimGtkConversation *gtkconv; | |
2052 GaimConvWindow *win = gaim_conversation_get_window(conv); | |
2053 GaimAccount *account; | |
2054 const char *name; | |
2055 GdkPixbuf *status = NULL; | |
2056 | |
2057 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2058 name = gaim_conversation_get_name(conv); | |
2059 account = gaim_conversation_get_account(conv); | |
2060 | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2061 status = get_tab_icon(conv, TRUE); |
8189 | 2062 |
2063 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->icon), status); | |
2064 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->menu_icon), status); | |
2065 | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2066 if (status != NULL) |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2067 g_object_unref(status); |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2068 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2069 if (gaim_conv_window_get_active_conversation(win) == conv && |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2070 gtkconv->u.im->anim == NULL) |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2071 { |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2072 status = get_tab_icon(conv, FALSE); |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2073 |
8189 | 2074 gtk_window_set_icon(GTK_WINDOW(GAIM_GTK_WINDOW(win)->window), status); |
2075 | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2076 if (status != NULL) |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2077 g_object_unref(status); |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2078 } |
8189 | 2079 } |
2080 | |
2081 static gboolean | |
2082 redraw_icon(gpointer data) | |
2083 { | |
2084 GaimConversation *conv = (GaimConversation *)data; | |
2085 GaimGtkConversation *gtkconv; | |
2086 | |
2087 GdkPixbuf *buf; | |
2088 GdkPixbuf *scale; | |
2089 GdkPixmap *pm; | |
2090 GdkBitmap *bm; | |
2091 gint delay; | |
2092 | |
2093 if (!g_list_find(gaim_get_ims(), conv)) { | |
2094 gaim_debug(GAIM_DEBUG_WARNING, "gtkconv", | |
2095 "Conversation not found in redraw_icon. I think this " | |
2096 "is a bug.\n"); | |
2097 return FALSE; | |
2098 } | |
2099 | |
2100 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2101 | |
2102 gdk_pixbuf_animation_iter_advance(gtkconv->u.im->iter, NULL); | |
2103 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); | |
2104 | |
2105 scale = gdk_pixbuf_scale_simple(buf, | |
2106 MAX(gdk_pixbuf_get_width(buf) * SCALE(gtkconv->u.im->anim) / | |
2107 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), | |
2108 MAX(gdk_pixbuf_get_height(buf) * SCALE(gtkconv->u.im->anim) / | |
2109 gdk_pixbuf_animation_get_height(gtkconv->u.im->anim), 1), | |
2110 GDK_INTERP_NEAREST); | |
2111 | |
2112 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); | |
2113 g_object_unref(G_OBJECT(scale)); | |
2114 gtk_image_set_from_pixmap(GTK_IMAGE(gtkconv->u.im->icon), pm, bm); | |
2115 g_object_unref(G_OBJECT(pm)); | |
2116 gtk_widget_queue_draw(gtkconv->u.im->icon); | |
2117 | |
2118 if (bm) | |
2119 g_object_unref(G_OBJECT(bm)); | |
2120 | |
2121 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter) / 10; | |
2122 | |
2123 gtkconv->u.im->icon_timer = g_timeout_add(delay * 10, redraw_icon, conv); | |
2124 | |
2125 return FALSE; | |
2126 } | |
2127 | |
2128 static void | |
2129 start_anim(GtkObject *obj, GaimConversation *conv) | |
2130 { | |
2131 GaimGtkConversation *gtkconv; | |
2132 int delay; | |
2133 | |
2134 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
2135 return; | |
2136 | |
2137 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2138 | |
8228 | 2139 if (gtkconv->u.im->anim == NULL) |
2140 return; | |
2141 | |
8202 | 2142 if (gtkconv->u.im->icon_timer != 0) |
2143 return; | |
2144 | |
8189 | 2145 if (gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim)) |
2146 return; | |
2147 | |
2148 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter) / 10; | |
2149 | |
8758 | 2150 gtkconv->u.im->icon_timer = g_timeout_add(delay * 10, redraw_icon, conv); |
8189 | 2151 } |
2152 | |
2153 static void | |
2154 stop_anim(GtkObject *obj, GaimConversation *conv) | |
2155 { | |
2156 GaimGtkConversation *gtkconv; | |
2157 | |
2158 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
2159 return; | |
2160 | |
2161 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2162 | |
2163 if (gtkconv->u.im->icon_timer != 0) | |
2164 g_source_remove(gtkconv->u.im->icon_timer); | |
2165 | |
2166 gtkconv->u.im->icon_timer = 0; | |
2167 } | |
2168 | |
2169 static void | |
2170 toggle_icon_animate_cb(GtkWidget *w, GaimConversation *conv) | |
2171 { | |
2172 GaimGtkConversation *gtkconv; | |
2173 | |
2174 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
2175 return; | |
2176 | |
2177 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2178 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2179 gtkconv->u.im->animate = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2180 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w)); |
8189 | 2181 |
2182 if (gtkconv->u.im->animate) | |
2183 start_anim(NULL, conv); | |
2184 else | |
2185 stop_anim(NULL, conv); | |
2186 } | |
2187 static void | |
2188 remove_icon(GaimGtkConversation *gtkconv) | |
2189 { | |
2190 g_return_if_fail(gtkconv != NULL); | |
2191 | |
2192 if (gtkconv->u.im->icon != NULL) | |
8821 | 2193 gtk_widget_destroy(gtkconv->u.im->icon->parent->parent->parent); |
8189 | 2194 |
2195 if (gtkconv->u.im->anim != NULL) | |
2196 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); | |
2197 | |
2198 if (gtkconv->u.im->icon_timer != 0) | |
2199 g_source_remove(gtkconv->u.im->icon_timer); | |
2200 | |
2201 if (gtkconv->u.im->iter != NULL) | |
2202 g_object_unref(G_OBJECT(gtkconv->u.im->iter)); | |
2203 | |
2204 gtkconv->u.im->icon_timer = 0; | |
2205 gtkconv->u.im->icon = NULL; | |
2206 gtkconv->u.im->anim = NULL; | |
2207 gtkconv->u.im->iter = NULL; | |
2208 } | |
2209 | |
2210 static gboolean | |
2211 icon_menu(GtkObject *obj, GdkEventButton *e, GaimConversation *conv) | |
2212 { | |
2213 GaimGtkConversation *gtkconv; | |
2214 static GtkWidget *menu = NULL; | |
2215 GtkWidget *button; | |
2216 | |
2217 if (e->button != 3 || e->type != GDK_BUTTON_PRESS) | |
2218 return FALSE; | |
2219 | |
2220 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2221 | |
2222 /* | |
2223 * If a menu already exists, destroy it before creating a new one, | |
2224 * thus freeing-up the memory it occupied. | |
2225 */ | |
2226 if (menu != NULL) | |
2227 gtk_widget_destroy(menu); | |
2228 | |
2229 menu = gtk_menu_new(); | |
2230 | |
2231 if (gtkconv->u.im->anim && | |
2232 !(gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim))) | |
2233 { | |
2234 gaim_new_check_item(menu, _("Animate"), | |
2235 G_CALLBACK(toggle_icon_animate_cb), conv, | |
2236 gtkconv->u.im->icon_timer); | |
2237 } | |
2238 | |
2239 button = gtk_menu_item_new_with_label(_("Hide Icon")); | |
2240 g_signal_connect_swapped(G_OBJECT(button), "activate", | |
2241 G_CALLBACK(remove_icon), gtkconv); | |
2242 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
2243 gtk_widget_show(button); | |
2244 | |
2245 gaim_new_item_from_stock(menu, _("Save Icon As..."), GTK_STOCK_SAVE_AS, | |
2246 G_CALLBACK(gaim_gtk_save_icon_dialog), conv, | |
2247 0, 0, NULL); | |
2248 | |
2249 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, e->button, e->time); | |
2250 | |
2251 return TRUE; | |
2252 } | |
2253 /************************************************************************** | |
2254 * End of the bunch of buddy icon functions | |
2255 **************************************************************************/ | |
2256 | |
7887 | 2257 /* |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2258 * Makes sure all the menu items and all the buttons are hidden/shown and |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8730
diff
changeset
|
2259 * sensitive/insensitive. This is called after changing tabs and when an |
7887 | 2260 * account signs on or off. |
2261 */ | |
4359 | 2262 static void |
7887 | 2263 gray_stuff_out(GaimConversation *conv) |
4359 | 2264 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2265 GaimConvWindow *win; |
7887 | 2266 GaimGtkWindow *gtkwin; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2267 GaimGtkConversation *gtkconv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2268 GaimConnection *gc; |
7887 | 2269 GaimPluginProtocolInfo *prpl_info = NULL; |
7222 | 2270 GdkPixbuf *window_icon = NULL; |
8439 | 2271 GtkIMHtmlButtons buttons; |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2272 |
7887 | 2273 win = gaim_conversation_get_window(conv); |
4359 | 2274 gtkwin = GAIM_GTK_WINDOW(win); |
2275 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7887 | 2276 gc = gaim_conversation_get_gc(conv); |
8439 | 2277 |
7879 | 2278 if (gc != NULL) |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
2279 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2280 |
7887 | 2281 if (gtkwin->menu.send_as != NULL) |
2282 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); | |
2283 | |
2284 /* | |
2285 * Handle hiding and showing stuff based on what type of conv this is. | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2286 * Stuff that Gaim IMs support in general should be shown for IM |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8730
diff
changeset
|
2287 * conversations. Stuff that Gaim chats support in general should be |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2288 * shown for chat conversations. It doesn't matter whether the PRPL |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2289 * supports it or not--that only affects if the button or menu item |
7929 | 2290 * is sensitive or not. |
7887 | 2291 */ |
4359 | 2292 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
7887 | 2293 /* Show stuff that applies to IMs, hide stuff that applies to chats */ |
2294 | |
2295 /* Deal with buttons */ | |
2296 gtk_widget_show(gtkconv->info); | |
2297 gtk_widget_show(gtkconv->send); | |
2298 gtk_widget_show(gtkconv->u.im->warn); | |
2299 gtk_widget_show(gtkconv->u.im->block); | |
2300 | |
2301 /* Deal with menu items */ | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2302 gtk_widget_show(gtkwin->menu.view_log); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2303 gtk_widget_show(gtkwin->menu.add_pounce); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2304 gtk_widget_show(gtkwin->menu.get_info); |
7887 | 2305 gtk_widget_show(gtkwin->menu.warn); |
7859 | 2306 gtk_widget_hide(gtkwin->menu.invite); |
7887 | 2307 gtk_widget_show(gtkwin->menu.alias); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2308 gtk_widget_show(gtkwin->menu.block); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2309 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2310 if (gaim_find_buddy(gaim_conversation_get_account(conv), |
7143 | 2311 gaim_conversation_get_name(conv)) == NULL) { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2312 gtk_widget_show(gtkwin->menu.add); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2313 gtk_widget_hide(gtkwin->menu.remove); |
7929 | 2314 gtk_widget_show(gtkconv->add); |
2315 gtk_widget_hide(gtkconv->remove); | |
7859 | 2316 } else { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2317 gtk_widget_show(gtkwin->menu.remove); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2318 gtk_widget_hide(gtkwin->menu.add); |
7929 | 2319 gtk_widget_hide(gtkconv->add); |
2320 gtk_widget_show(gtkconv->remove); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2321 } |
7887 | 2322 |
2323 gtk_widget_show(gtkwin->menu.insert_link); | |
8756 | 2324 /* XXX - IMIMAGE - Fix IM images then show this. */ |
2325 gtk_widget_hide(gtkwin->menu.insert_image); | |
7887 | 2326 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
2327 /* Show stuff that applies to IMs, hide stuff that applies to chats */ | |
2328 | |
2329 /* Deal with buttons */ | |
7952 | 2330 gtk_widget_show(gtkconv->info); |
7887 | 2331 gtk_widget_show(gtkconv->send); |
2332 gtk_widget_show(gtkconv->u.chat->invite); | |
2333 | |
2334 /* Deal with menu items */ | |
7859 | 2335 gtk_widget_hide(gtkwin->menu.view_log); |
2336 gtk_widget_hide(gtkwin->menu.add_pounce); | |
2337 gtk_widget_hide(gtkwin->menu.get_info); | |
7887 | 2338 gtk_widget_hide(gtkwin->menu.warn); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2339 gtk_widget_show(gtkwin->menu.invite); |
7887 | 2340 gtk_widget_show(gtkwin->menu.alias); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2341 gtk_widget_hide(gtkwin->menu.block); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2342 |
7879 | 2343 if (gaim_blist_find_chat(gaim_conversation_get_account(conv), |
2344 gaim_conversation_get_name(conv)) == NULL) { | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2345 gtk_widget_show(gtkwin->menu.add); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2346 gtk_widget_hide(gtkwin->menu.remove); |
7929 | 2347 gtk_widget_show(gtkconv->add); |
2348 gtk_widget_hide(gtkconv->remove); | |
7859 | 2349 } else { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2350 gtk_widget_show(gtkwin->menu.remove); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2351 gtk_widget_hide(gtkwin->menu.add); |
7929 | 2352 gtk_widget_hide(gtkconv->add); |
2353 gtk_widget_show(gtkconv->remove); | |
7887 | 2354 } |
2355 | |
2356 gtk_widget_show(gtkwin->menu.insert_link); | |
2357 gtk_widget_hide(gtkwin->menu.insert_image); | |
2358 } | |
2359 | |
2360 /* | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2361 * Handle graying stuff out based on whether an account is connected |
7887 | 2362 * and what features that account supports. |
2363 */ | |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
2364 if ((gc != NULL) && |
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
2365 ( (gaim_conversation_get_type(conv) != GAIM_CONV_CHAT) || |
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
2366 !gaim_conv_chat_has_left(GAIM_CONV_CHAT(conv)) )) { |
7887 | 2367 /* Account is online */ |
2368 | |
2369 /* Deal with buttons */ | |
7929 | 2370 gtk_widget_set_sensitive(gtkconv->add, TRUE); |
2371 gtk_widget_set_sensitive(gtkconv->remove, TRUE); | |
7887 | 2372 gtk_widget_set_sensitive(gtkconv->info, (prpl_info->get_info != NULL)); |
7929 | 2373 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2374 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2375 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2376 gtk_widget_set_sensitive(gtkconv->send, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2377 (prpl_info->send_im != NULL)); |
7887 | 2378 gtk_widget_set_sensitive(gtkconv->u.im->warn, |
2379 (prpl_info->warn != NULL)); | |
2380 gtk_widget_set_sensitive(gtkconv->u.im->block, | |
2381 (prpl_info->add_deny != NULL)); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2382 } |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2383 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2384 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2385 gtk_widget_set_sensitive(gtkconv->send, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2386 (prpl_info->chat_send != NULL)); |
7887 | 2387 gtk_widget_set_sensitive(gtkconv->u.chat->invite, |
2388 (prpl_info->chat_invite != NULL)); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2389 } |
7887 | 2390 |
2391 /* Deal with the toolbar */ | |
8422 | 2392 |
8420 | 2393 if (gc->flags & GAIM_CONNECTION_HTML) { |
8677 | 2394 buttons = GTK_IMHTML_ALL; /* Everything on */ |
8420 | 2395 if (!(prpl_info->options & OPT_PROTO_IM_IMAGE)) |
8422 | 2396 buttons &= ~GTK_IMHTML_IMAGE; |
8420 | 2397 if (gc->flags & GAIM_CONNECTION_NO_BGCOLOR) |
8422 | 2398 buttons &= ~GTK_IMHTML_BACKCOLOR; |
8691
0eb5161ef333
[gaim-migrate @ 9444]
Christian Hammond <chipx86@chipx86.com>
parents:
8690
diff
changeset
|
2399 if (gc->flags & GAIM_CONNECTION_NO_FONTSIZE) { |
0eb5161ef333
[gaim-migrate @ 9444]
Christian Hammond <chipx86@chipx86.com>
parents:
8690
diff
changeset
|
2400 buttons &= ~GTK_IMHTML_GROW; |
0eb5161ef333
[gaim-migrate @ 9444]
Christian Hammond <chipx86@chipx86.com>
parents:
8690
diff
changeset
|
2401 buttons &= ~GTK_IMHTML_SHRINK; |
0eb5161ef333
[gaim-migrate @ 9444]
Christian Hammond <chipx86@chipx86.com>
parents:
8690
diff
changeset
|
2402 } |
8420 | 2403 } else { |
8422 | 2404 buttons = GTK_IMHTML_SMILEY; |
8420 | 2405 } |
2406 gtk_imhtml_set_format_functions(GTK_IMHTML(gtkconv->entry), buttons); | |
8427 | 2407 gtk_imhtmltoolbar_associate_smileys (GTK_IMHTMLTOOLBAR(gtkconv->toolbar), gaim_account_get_protocol_id(gaim_conversation_get_account(conv))); |
8422 | 2408 |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
2409 /* Deal with menu items */ |
7887 | 2410 gtk_widget_set_sensitive(gtkwin->menu.view_log, TRUE); |
2411 gtk_widget_set_sensitive(gtkwin->menu.add_pounce, TRUE); | |
2412 gtk_widget_set_sensitive(gtkwin->menu.get_info, (prpl_info->get_info != NULL)); | |
2413 gtk_widget_set_sensitive(gtkwin->menu.warn, (prpl_info->warn != NULL)); | |
2414 gtk_widget_set_sensitive(gtkwin->menu.invite, | |
2415 (prpl_info->chat_invite != NULL)); | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
2416 |
7887 | 2417 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
2418 if (gaim_find_buddy(gaim_conversation_get_account(conv), | |
2419 gaim_conversation_get_name(conv)) == NULL) | |
2420 gtk_widget_set_sensitive(gtkwin->menu.alias, FALSE); | |
2421 else | |
2422 gtk_widget_set_sensitive(gtkwin->menu.alias, TRUE); | |
2423 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
2424 if (gaim_blist_find_chat(gaim_conversation_get_account(conv), | |
2425 gaim_conversation_get_name(conv)) == NULL) | |
2426 gtk_widget_set_sensitive(gtkwin->menu.alias, FALSE); | |
2427 else | |
2428 gtk_widget_set_sensitive(gtkwin->menu.alias, TRUE); | |
2429 } | |
2430 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2431 gtk_widget_set_sensitive(gtkwin->menu.block, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2432 (prpl_info->add_deny != NULL)); |
7887 | 2433 gtk_widget_set_sensitive(gtkwin->menu.add, TRUE); |
7859 | 2434 gtk_widget_set_sensitive(gtkwin->menu.remove, TRUE); |
8758 | 2435 gtk_widget_set_sensitive(gtkwin->menu.insert_link, |
2436 gc->flags & GAIM_CONNECTION_HTML); | |
7887 | 2437 gtk_widget_set_sensitive(gtkwin->menu.insert_image, |
2438 (prpl_info->options & OPT_PROTO_IM_IMAGE)); | |
2439 } else { | |
2440 /* Account is offline */ | |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
2441 /* Or it's a chat where we left. */ |
7887 | 2442 |
2443 /* Deal with buttons */ | |
7929 | 2444 gtk_widget_set_sensitive(gtkconv->add, FALSE); |
2445 gtk_widget_set_sensitive(gtkconv->remove, FALSE); | |
7887 | 2446 gtk_widget_set_sensitive(gtkconv->info, FALSE); |
2447 gtk_widget_set_sensitive(gtkconv->send, FALSE); | |
2448 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
2449 gtk_widget_set_sensitive(gtkconv->u.im->warn, FALSE); | |
2450 gtk_widget_set_sensitive(gtkconv->u.im->block, FALSE); | |
2451 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
2452 gtk_widget_set_sensitive(gtkconv->u.chat->invite, FALSE); | |
2453 } | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2454 |
7887 | 2455 /* Then deal with menu items */ |
2456 gtk_widget_set_sensitive(gtkwin->menu.view_log, TRUE); | |
2457 gtk_widget_set_sensitive(gtkwin->menu.add_pounce, TRUE); | |
2458 gtk_widget_set_sensitive(gtkwin->menu.get_info, FALSE); | |
2459 gtk_widget_set_sensitive(gtkwin->menu.warn, FALSE); | |
2460 gtk_widget_set_sensitive(gtkwin->menu.invite, FALSE); | |
2461 gtk_widget_set_sensitive(gtkwin->menu.alias, FALSE); | |
2462 gtk_widget_set_sensitive(gtkwin->menu.block, FALSE); | |
2463 gtk_widget_set_sensitive(gtkwin->menu.add, FALSE); | |
2464 gtk_widget_set_sensitive(gtkwin->menu.remove, FALSE); | |
7929 | 2465 gtk_widget_set_sensitive(gtkwin->menu.insert_link, TRUE); |
7887 | 2466 gtk_widget_set_sensitive(gtkwin->menu.insert_image, FALSE); |
2467 } | |
2468 | |
2469 /* | |
2470 * Update the window's icon | |
2471 */ | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2472 if ((gaim_conversation_get_type(conv) == GAIM_CONV_IM) && |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2473 (gtkconv->u.im->anim)) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2474 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2475 window_icon = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2476 gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); |
7887 | 2477 g_object_ref(window_icon); |
2478 } else { | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2479 window_icon = get_tab_icon(conv, FALSE); |
4359 | 2480 } |
7887 | 2481 gtk_window_set_icon(GTK_WINDOW(gtkwin->window), window_icon); |
2482 g_object_unref(G_OBJECT(window_icon)); | |
2483 } | |
2484 | |
2485 static void | |
8189 | 2486 before_switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, |
2487 gpointer user_data) | |
2488 { | |
2489 GaimConvWindow *win; | |
2490 GaimConversation *conv; | |
2491 GaimGtkConversation *gtkconv; | |
2492 | |
2493 win = (GaimConvWindow *)user_data; | |
2494 conv = gaim_conv_window_get_active_conversation(win); | |
2495 | |
2496 g_return_if_fail(conv != NULL); | |
2497 | |
8192 | 2498 if (gaim_conversation_get_type(conv) != GAIM_CONV_IM) |
2499 return; | |
2500 | |
8189 | 2501 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2502 | |
2503 stop_anim(NULL, conv); | |
2504 } | |
2505 | |
2506 static void | |
7887 | 2507 switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, |
2508 gpointer user_data) | |
2509 { | |
2510 GaimConvWindow *win; | |
2511 GaimConversation *conv; | |
2512 GaimGtkConversation *gtkconv; | |
2513 GaimGtkWindow *gtkwin; | |
2514 | |
2515 win = (GaimConvWindow *)user_data; | |
2516 conv = gaim_conv_window_get_conversation_at(win, page_num); | |
2517 | |
2518 g_return_if_fail(conv != NULL); | |
2519 | |
2520 gtkwin = GAIM_GTK_WINDOW(win); | |
2521 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2522 | |
2523 gaim_conversation_set_unseen(conv, GAIM_UNSEEN_NONE); | |
2524 | |
2525 /* Update the menubar */ | |
2526 gray_stuff_out(conv); | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2527 |
4736 | 2528 update_typing_icon(conv); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2529 |
4359 | 2530 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.logging), |
7143 | 2531 gaim_conversation_is_logging(conv)); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2532 |
4359 | 2533 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.sounds), |
7143 | 2534 gtkconv->make_sound); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2535 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2536 gtk_check_menu_item_set_active( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2537 GTK_CHECK_MENU_ITEM(gtkwin->menu.show_formatting_toolbar), |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2538 gtkconv->show_formatting_toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2539 |
8189 | 2540 /* |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2541 * We pause icons when they are not visible. If this icon should |
8189 | 2542 * be animated then start it back up again.lll |
2543 */ | |
8192 | 2544 if ((gaim_conversation_get_type(conv) == GAIM_CONV_IM) && |
2545 (gtkconv->u.im->animate)) | |
8189 | 2546 start_anim(NULL, conv); |
2547 | |
4359 | 2548 gtk_widget_grab_focus(gtkconv->entry); |
4681 | 2549 |
4965 | 2550 gtk_window_set_title(GTK_WINDOW(gtkwin->window), |
7143 | 2551 gtk_label_get_text(GTK_LABEL(gtkconv->tab_label))); |
4359 | 2552 } |
2553 | |
2554 /************************************************************************** | |
2555 * Utility functions | |
2556 **************************************************************************/ | |
2557 | |
2558 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2559 got_typing_keypress(GaimConversation *conv, gboolean first) |
4359 | 2560 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2561 GaimConvIm *im; |
4685 | 2562 |
4359 | 2563 /* |
2564 * 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
|
2565 * send GAIM_TYPED any time soon. |
4359 | 2566 */ |
2567 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2568 im = GAIM_CONV_IM(conv); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2569 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2570 if (gaim_conv_im_get_type_again_timeout(im)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2571 gaim_conv_im_stop_type_again_timeout(im); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2572 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2573 gaim_conv_im_start_type_again_timeout(im); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2574 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2575 if (first || (gaim_conv_im_get_type_again(im) != 0 && |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2576 time(NULL) > gaim_conv_im_get_type_again(im))) { |
4359 | 2577 |
2578 int timeout = serv_send_typing(gaim_conversation_get_gc(conv), | |
2579 (char *)gaim_conversation_get_name(conv), | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
2580 GAIM_TYPING); |
4359 | 2581 |
2582 if (timeout) | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2583 gaim_conv_im_set_type_again(im, time(NULL) + timeout); |
4359 | 2584 else |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2585 gaim_conv_im_set_type_again(im, 0); |
4359 | 2586 } |
2587 } | |
2588 | |
4736 | 2589 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2590 update_typing_icon(GaimConversation *conv) |
4736 | 2591 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2592 GaimGtkWindow *gtkwin; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2593 GaimConvIm *im = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2594 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); |
4736 | 2595 |
2596 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); | |
2597 | |
2598 if(gaim_conversation_get_type(conv) == GAIM_CONV_IM) | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2599 im = GAIM_CONV_IM(conv); |
4736 | 2600 |
2601 if(gtkwin->menu.typing_icon) { | |
2602 gtk_widget_destroy(gtkwin->menu.typing_icon); | |
2603 gtkwin->menu.typing_icon = NULL; | |
2604 } | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2605 if(im && gaim_conv_im_get_typing_state(im) == GAIM_TYPING) { |
4736 | 2606 gtkwin->menu.typing_icon = gtk_image_menu_item_new(); |
2607 gtk_image_menu_item_set_image( | |
2608 GTK_IMAGE_MENU_ITEM(gtkwin->menu.typing_icon), | |
2609 gtk_image_new_from_stock(GAIM_STOCK_TYPING, | |
2610 GTK_ICON_SIZE_MENU)); | |
4757 | 2611 gtk_tooltips_set_tip(gtkconv->tooltips, gtkwin->menu.typing_icon, |
4736 | 2612 _("User is typing..."), NULL); |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2613 } else if(im && gaim_conv_im_get_typing_state(im) == GAIM_TYPED) { |
4736 | 2614 gtkwin->menu.typing_icon = gtk_image_menu_item_new(); |
2615 gtk_image_menu_item_set_image( | |
2616 GTK_IMAGE_MENU_ITEM(gtkwin->menu.typing_icon), | |
2617 gtk_image_new_from_stock(GAIM_STOCK_TYPED, | |
2618 GTK_ICON_SIZE_MENU)); | |
4757 | 2619 gtk_tooltips_set_tip(gtkconv->tooltips, gtkwin->menu.typing_icon, |
4736 | 2620 _("User has typed something and paused"), NULL); |
2621 } | |
2622 | |
2623 if(gtkwin->menu.typing_icon) { | |
2624 gtk_menu_item_set_right_justified( | |
2625 GTK_MENU_ITEM(gtkwin->menu.typing_icon), TRUE); | |
2626 gtk_widget_show_all(gtkwin->menu.typing_icon); | |
2627 gtk_menu_shell_append(GTK_MENU_SHELL(gtkwin->menu.menubar), | |
2628 gtkwin->menu.typing_icon); | |
2629 } | |
2630 } | |
2631 | |
4685 | 2632 static gboolean |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2633 update_send_as_selection(GaimConvWindow *win) |
4359 | 2634 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2635 GaimAccount *account; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2636 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2637 GaimGtkWindow *gtkwin; |
4359 | 2638 GtkWidget *menu; |
2639 GList *child; | |
2640 | |
7090
04f9f7440bc3
[gaim-migrate @ 7655]
Christian Hammond <chipx86@chipx86.com>
parents:
7089
diff
changeset
|
2641 if (g_list_find(gaim_get_windows(), win) == NULL) |
04f9f7440bc3
[gaim-migrate @ 7655]
Christian Hammond <chipx86@chipx86.com>
parents:
7089
diff
changeset
|
2642 return FALSE; |
4849 | 2643 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2644 conv = gaim_conv_window_get_active_conversation(win); |
4359 | 2645 |
5860
52d5fad43950
[gaim-migrate @ 6291]
Christian Hammond <chipx86@chipx86.com>
parents:
5858
diff
changeset
|
2646 if (conv == NULL) |
52d5fad43950
[gaim-migrate @ 6291]
Christian Hammond <chipx86@chipx86.com>
parents:
5858
diff
changeset
|
2647 return FALSE; |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2648 |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2649 account = gaim_conversation_get_account(conv); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2650 gtkwin = GAIM_GTK_WINDOW(win); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2651 |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2652 if (gtkwin->menu.send_as == NULL) |
4685 | 2653 return FALSE; |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2654 |
4359 | 2655 gtk_widget_show(gtkwin->menu.send_as); |
2656 | |
2657 menu = gtk_menu_item_get_submenu( | |
2658 GTK_MENU_ITEM(gtkwin->menu.send_as)); | |
2659 | |
2660 for (child = gtk_container_get_children(GTK_CONTAINER(menu)); | |
2661 child != NULL; | |
2662 child = child->next) { | |
2663 | |
2664 GtkWidget *item = child->data; | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2665 GaimAccount *item_account = g_object_get_data(G_OBJECT(item), |
4673 | 2666 "gaim_account"); |
2667 | |
2668 if (account == item_account) { | |
4359 | 2669 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE); |
2670 break; | |
2671 } | |
2672 } | |
6030
54c37db13279
[gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents:
6016
diff
changeset
|
2673 |
4685 | 2674 return FALSE; |
4359 | 2675 } |
2676 | |
2677 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2678 generate_send_as_items(GaimConvWindow *win, GaimConversation *deleted_conv) |
4359 | 2679 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2680 GaimGtkWindow *gtkwin; |
4359 | 2681 GtkWidget *menu; |
2682 GtkWidget *menuitem; | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2683 GList *gcs; |
4359 | 2684 GList *convs; |
2685 GSList *group = NULL; | |
2686 gboolean first_offline = TRUE; | |
2687 gboolean found_online = FALSE; | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2688 GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
4359 | 2689 |
2690 gtkwin = GAIM_GTK_WINDOW(win); | |
2691 | |
2692 if (gtkwin->menu.send_as != NULL) | |
2693 gtk_widget_destroy(gtkwin->menu.send_as); | |
2694 | |
2695 /* See if we have > 1 connection active. */ | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2696 if (g_list_length(gaim_connections_get_all()) < 2) { |
4359 | 2697 /* Now make sure we don't have any Offline entries. */ |
2698 gboolean found_offline = FALSE; | |
2699 | |
2700 for (convs = gaim_get_conversations(); | |
2701 convs != NULL; | |
2702 convs = convs->next) { | |
2703 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2704 GaimConversation *conv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2705 GaimAccount *account; |
4491 | 2706 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2707 conv = (GaimConversation *)convs->data; |
4491 | 2708 account = gaim_conversation_get_account(conv); |
2709 | |
6495
8ce66049ce68
[gaim-migrate @ 7010]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
2710 if (account != NULL && account->gc == NULL) { |
4359 | 2711 found_offline = TRUE; |
2712 break; | |
2713 } | |
2714 } | |
2715 | |
2716 if (!found_offline) { | |
2717 gtkwin->menu.send_as = NULL; | |
2718 return; | |
2719 } | |
2720 } | |
2721 | |
2722 /* Build the Send As menu */ | |
2723 gtkwin->menu.send_as = gtk_menu_item_new_with_mnemonic(_("_Send As")); | |
2724 gtk_widget_show(gtkwin->menu.send_as); | |
2725 | |
2726 menu = gtk_menu_new(); | |
7857
43f63ff8a6d8
[gaim-migrate @ 8511]
Christian Hammond <chipx86@chipx86.com>
parents:
7855
diff
changeset
|
2727 gtk_menu_shell_insert(GTK_MENU_SHELL(gtkwin->menu.menubar), |
43f63ff8a6d8
[gaim-migrate @ 8511]
Christian Hammond <chipx86@chipx86.com>
parents:
7855
diff
changeset
|
2728 gtkwin->menu.send_as, 2); |
4359 | 2729 gtk_menu_item_set_submenu(GTK_MENU_ITEM(gtkwin->menu.send_as), menu); |
2730 | |
2731 gtk_widget_show(menu); | |
2732 | |
2733 /* Fill it with entries. */ | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2734 for (gcs = gaim_connections_get_all(); gcs != NULL; gcs = gcs->next) { |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2735 |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2736 GaimConnection *gc; |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2737 GaimAccount *account; |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2738 GtkWidget *box; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2739 GtkWidget *label; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2740 GtkWidget *image; |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2741 GdkPixbuf *pixbuf, *scale; |
4359 | 2742 |
2743 found_online = TRUE; | |
2744 | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2745 gc = (GaimConnection *)gcs->data; |
4359 | 2746 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2747 /* Create a pixmap for the protocol icon. */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2748 pixbuf = create_prpl_icon(gc->account); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2749 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
|
2750 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2751 /* Now convert it to GtkImage */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2752 if (pixbuf == NULL) |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2753 image = gtk_image_new(); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2754 else |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2755 image = gtk_image_new_from_pixbuf(scale); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2756 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2757 gtk_size_group_add_widget(sg, image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2758 |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2759 g_object_unref(G_OBJECT(scale)); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2760 g_object_unref(G_OBJECT(pixbuf)); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2761 |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2762 account = gaim_connection_get_account(gc); |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2763 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2764 /* Make our menu item */ |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2765 menuitem = gtk_radio_menu_item_new_with_label(group, |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2766 gaim_account_get_username(account)); |
4793 | 2767 group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem)); |
4359 | 2768 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2769 /* Do some evil, see some evil, speak some evil. */ |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2770 box = gtk_hbox_new(FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2771 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2772 label = gtk_bin_get_child(GTK_BIN(menuitem)); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2773 g_object_ref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2774 gtk_container_remove(GTK_CONTAINER(menuitem), label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2775 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2776 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2777 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 4); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2778 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2779 g_object_unref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2780 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2781 gtk_container_add(GTK_CONTAINER(menuitem), box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2782 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2783 gtk_widget_show(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2784 gtk_widget_show(image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2785 gtk_widget_show(box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2786 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2787 /* Set our data and callbacks. */ |
4359 | 2788 g_object_set_data(G_OBJECT(menuitem), "user_data", win); |
4673 | 2789 g_object_set_data(G_OBJECT(menuitem), "gaim_account", gc->account); |
4359 | 2790 |
4786 | 2791 g_signal_connect(G_OBJECT(menuitem), "activate", |
4673 | 2792 G_CALLBACK(menu_conv_sel_send_cb), NULL); |
4359 | 2793 |
2794 gtk_widget_show(menuitem); | |
2795 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
2796 } | |
2797 | |
2798 /* | |
2799 * Fill it with any accounts that still has an open (yet disabled) window | |
2800 * (signed off accounts with a window open). | |
2801 */ | |
2802 for (convs = gaim_get_conversations(); | |
2803 convs != NULL; | |
2804 convs = convs->next) { | |
2805 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2806 GaimConversation *conv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2807 GaimAccount *account; |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2808 GtkWidget *box; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2809 GtkWidget *label; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2810 GtkWidget *image; |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2811 GdkPixbuf *pixbuf, *scale; |
4359 | 2812 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2813 conv = (GaimConversation *)convs->data; |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
2814 |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
2815 if (conv == deleted_conv) |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
2816 continue; |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
2817 |
4491 | 2818 account = gaim_conversation_get_account(conv); |
2819 | |
6495
8ce66049ce68
[gaim-migrate @ 7010]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
2820 if (account != NULL && account->gc == NULL) { |
4359 | 2821 if (first_offline && found_online) { |
2822 menuitem = gtk_separator_menu_item_new(); | |
2823 gtk_widget_show(menuitem); | |
2824 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
2825 | |
2826 first_offline = FALSE; | |
2827 } | |
2828 | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2829 /* Create a pixmap for the protocol icon. */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2830 pixbuf = create_prpl_icon(account); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2831 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2832 GDK_INTERP_BILINEAR); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2833 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2834 /* Now convert it to GtkImage */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2835 if (pixbuf == NULL) |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2836 image = gtk_image_new(); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2837 else |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2838 image = gtk_image_new_from_pixbuf(scale); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2839 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2840 gtk_size_group_add_widget(sg, image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2841 |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2842 if (scale != NULL) g_object_unref(scale); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2843 if (pixbuf != NULL) g_object_unref(pixbuf); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2844 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2845 /* Make our menu item */ |
4359 | 2846 menuitem = gtk_radio_menu_item_new_with_label(group, |
4491 | 2847 account->username); |
4793 | 2848 group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem)); |
4359 | 2849 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2850 /* Do some evil, see some evil, speak some evil. */ |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2851 box = gtk_hbox_new(FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2852 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2853 label = gtk_bin_get_child(GTK_BIN(menuitem)); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2854 g_object_ref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2855 gtk_container_remove(GTK_CONTAINER(menuitem), label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2856 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2857 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2858 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 4); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2859 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2860 g_object_unref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2861 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2862 gtk_container_add(GTK_CONTAINER(menuitem), box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2863 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2864 gtk_widget_show(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2865 gtk_widget_show(image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2866 gtk_widget_show(box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2867 |
4359 | 2868 gtk_widget_set_sensitive(menuitem, FALSE); |
4786 | 2869 g_object_set_data(G_OBJECT(menuitem), "user_data", win); |
4674 | 2870 g_object_set_data(G_OBJECT(menuitem), "gaim_account", account); |
4359 | 2871 |
4786 | 2872 g_signal_connect(G_OBJECT(menuitem), "activate", |
5902
6889b89cab90
[gaim-migrate @ 6334]
Christian Hammond <chipx86@chipx86.com>
parents:
5901
diff
changeset
|
2873 G_CALLBACK(menu_conv_sel_send_cb), NULL); |
4786 | 2874 |
4359 | 2875 gtk_widget_show(menuitem); |
2876 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
2877 } | |
2878 } | |
2879 | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2880 g_object_unref(sg); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2881 |
4359 | 2882 gtk_widget_show(gtkwin->menu.send_as); |
2883 update_send_as_selection(win); | |
2884 } | |
2885 | |
2886 static GList * | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2887 generate_invite_user_names(GaimConnection *gc) |
4359 | 2888 { |
6695 | 2889 GaimBlistNode *gnode,*cnode,*bnode; |
4359 | 2890 static GList *tmp = NULL; |
2891 | |
2892 if (tmp) | |
2893 g_list_free(tmp); | |
2894 | |
2895 tmp = g_list_append(NULL, ""); | |
2896 | |
2897 if (gc != NULL) { | |
4785 | 2898 for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { |
2899 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) | |
2900 continue; | |
6695 | 2901 for(cnode = gnode->child; cnode; cnode = cnode->next) { |
2902 if(!GAIM_BLIST_NODE_IS_CONTACT(cnode)) | |
4785 | 2903 continue; |
6695 | 2904 for(bnode = cnode->child; bnode; bnode = bnode->next) { |
2905 GaimBuddy *buddy; | |
2906 | |
2907 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) | |
2908 continue; | |
2909 | |
2910 buddy = (GaimBuddy *)bnode; | |
2911 | |
2912 if (buddy->account == gc->account && | |
2913 GAIM_BUDDY_IS_ONLINE(buddy)) | |
2914 tmp = g_list_append(tmp, buddy->name); | |
2915 } | |
4359 | 2916 } |
2917 } | |
2918 } | |
2919 | |
2920 return tmp; | |
2921 } | |
2922 | |
2923 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2924 add_chat_buddy_common(GaimConversation *conv, const char *name, int pos) |
4359 | 2925 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2926 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2927 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2928 GaimConvChat *chat; |
4359 | 2929 GtkTreeIter iter; |
2930 GtkListStore *ls; | |
2931 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2932 chat = GAIM_CONV_CHAT(conv); |
4359 | 2933 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2934 gtkchat = gtkconv->u.chat; | |
2935 | |
2936 ls = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list))); | |
2937 | |
2938 gtk_list_store_append(ls, &iter); | |
2939 gtk_list_store_set(ls, &iter, 0, | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2940 (gaim_conv_chat_is_user_ignored(chat, name) ? "X" : " "), |
4359 | 2941 1, name, -1); |
2942 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), 1, | |
2943 GTK_SORT_ASCENDING); | |
2944 } | |
2945 | |
2946 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2947 tab_complete(GaimConversation *conv) |
4359 | 2948 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2949 GaimGtkConversation *gtkconv; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2950 GaimConvChat *chat; |
4359 | 2951 GtkTextIter cursor, word_start, start_buffer; |
2952 int start; | |
2953 int most_matched = -1; | |
2954 char *entered, *partial = NULL; | |
2955 char *text; | |
8021 | 2956 char *nick_partial; |
4359 | 2957 GList *matches = NULL; |
2958 GList *nicks = NULL; | |
2959 | |
2960 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2961 chat = GAIM_CONV_CHAT(conv); |
4359 | 2962 |
2963 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_buffer); | |
2964 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, | |
2965 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
2966 | |
2967 word_start = cursor; | |
2968 | |
2969 /* if there's nothing there just return */ | |
2970 if (!gtk_text_iter_compare(&cursor, &start_buffer)) | |
2971 return; | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2972 |
4359 | 2973 text = gtk_text_buffer_get_text(gtkconv->entry_buffer, &start_buffer, |
2974 &cursor, FALSE); | |
2975 | |
2976 /* if we're at the end of ": " we need to move back 2 spaces */ | |
2977 start = strlen(text) - 1; | |
2978 | |
8021 | 2979 if (strlen(text) >= 2 && !strncmp(&text[start-1], ": ", 2)) { |
4359 | 2980 gtk_text_iter_backward_chars(&word_start, 2); |
8021 | 2981 start-=2; |
2982 } | |
4359 | 2983 |
2984 /* find the start of the word that we're tabbing */ | |
2985 while (start >= 0 && text[start] != ' ') { | |
2986 gtk_text_iter_backward_char(&word_start); | |
2987 start--; | |
2988 } | |
2989 | |
2990 g_free(text); | |
2991 | |
2992 entered = gtk_text_buffer_get_text(gtkconv->entry_buffer, &word_start, | |
2993 &cursor, FALSE); | |
2994 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
2995 if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/old_tab_complete")) { |
4359 | 2996 if (strlen(entered) >= 2 && |
2997 !strncmp(": ", entered + strlen(entered) - 2, 2)) { | |
2998 | |
2999 entered[strlen(entered) - 2] = 0; | |
3000 } | |
3001 } | |
3002 | |
8021 | 3003 if (!g_utf8_strlen(entered, -1)) { |
4359 | 3004 g_free(entered); |
3005 return; | |
3006 } | |
3007 | |
8021 | 3008 nick_partial = g_malloc(strlen(entered)+1); |
3009 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3010 for (nicks = gaim_conv_chat_get_users(chat); |
4359 | 3011 nicks != NULL; |
3012 nicks = nicks->next) { | |
3013 | |
3014 char *nick = nicks->data; | |
8021 | 3015 |
8159 | 3016 strncpy(nick_partial, nick, strlen(entered)); |
8172 | 3017 nick_partial[strlen(entered)] = '\0'; |
8021 | 3018 if(gaim_utf8_strcasecmp(nick_partial, entered)) |
3019 continue; | |
4359 | 3020 |
3021 /* if we're here, it's a possible completion */ | |
3022 | |
3023 /* 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
|
3024 if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/old_tab_complete")) { |
4359 | 3025 gtk_text_buffer_delete(gtkconv->entry_buffer, |
3026 &word_start, &cursor); | |
3027 | |
3028 if (strlen(nick) == strlen(entered)) { | |
3029 nicks = (nicks->next | |
3030 ? nicks->next | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3031 : gaim_conv_chat_get_users(chat)); |
4359 | 3032 |
3033 nick = nicks->data; | |
3034 } | |
3035 | |
3036 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, | |
3037 &start_buffer); | |
3038 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, | |
3039 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
3040 | |
3041 if (!gtk_text_iter_compare(&cursor, &start_buffer)) { | |
3042 char *tmp = g_strdup_printf("%s: ", nick); | |
3043 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, | |
3044 tmp, -1); | |
3045 g_free(tmp); | |
3046 } | |
3047 else | |
3048 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, | |
3049 nick, -1); | |
3050 | |
8021 | 3051 g_free(nick_partial); |
4359 | 3052 g_free(entered); |
3053 | |
3054 return; | |
3055 } | |
3056 | |
3057 /* we're only here if we're doing new style */ | |
3058 if (most_matched == -1) { | |
3059 /* | |
3060 * this will only get called once, since from now | |
3061 * on most_matched is >= 0 | |
3062 */ | |
3063 most_matched = strlen(nick); | |
3064 partial = g_strdup(nick); | |
3065 } | |
3066 else if (most_matched) { | |
8021 | 3067 char *tmp = g_strdup(nick); |
3068 | |
3069 while (gaim_utf8_strcasecmp(tmp, partial)) { | |
3070 partial[most_matched] = '\0'; | |
3071 if(most_matched < strlen(tmp)) | |
3072 tmp[most_matched] = '\0'; | |
4359 | 3073 most_matched--; |
8021 | 3074 } |
8079 | 3075 most_matched++; |
8021 | 3076 |
3077 g_free(tmp); | |
4359 | 3078 } |
3079 | |
3080 matches = g_list_append(matches, nick); | |
3081 } | |
3082 | |
8021 | 3083 g_free(nick_partial); |
3084 | |
4359 | 3085 /* we're only here if we're doing new style */ |
3086 | |
3087 /* if there weren't any matches, return */ | |
3088 if (!matches) { | |
3089 /* if matches isn't set partials won't be either */ | |
3090 g_free(entered); | |
3091 return; | |
3092 } | |
3093 | |
3094 gtk_text_buffer_delete(gtkconv->entry_buffer, &word_start, &cursor); | |
3095 | |
3096 if (!matches->next) { | |
3097 /* there was only one match. fill it in. */ | |
3098 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_buffer); | |
3099 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, | |
3100 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
3101 | |
3102 if (!gtk_text_iter_compare(&cursor, &start_buffer)) { | |
3103 char *tmp = g_strdup_printf("%s: ", (char *)matches->data); | |
3104 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, tmp, -1); | |
3105 g_free(tmp); | |
3106 } | |
3107 else | |
3108 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, | |
3109 matches->data, -1); | |
3110 | |
3111 matches = g_list_remove(matches, matches->data); | |
3112 } | |
3113 else { | |
3114 /* | |
3115 * there were lots of matches, fill in as much as possible | |
3116 * and display all of them | |
3117 */ | |
3118 char *addthis = g_malloc0(1); | |
3119 | |
3120 while (matches) { | |
3121 char *tmp = addthis; | |
3122 addthis = g_strconcat(tmp, matches->data, " ", NULL); | |
3123 g_free(tmp); | |
3124 matches = g_list_remove(matches, matches->data); | |
3125 } | |
3126 | |
6982 | 3127 gaim_conversation_write(conv, NULL, addthis, GAIM_MESSAGE_NO_LOG, |
4359 | 3128 time(NULL)); |
3129 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, partial, -1); | |
3130 g_free(addthis); | |
3131 } | |
3132 | |
3133 g_free(entered); | |
3134 g_free(partial); | |
3135 } | |
3136 | |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3137 static void |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3138 save_convo(GtkWidget *save, GaimConversation *c) |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3139 { |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3140 char buf[BUF_LONG]; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3141 GtkWidget *window; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3142 |
7859 | 3143 window = gtk_file_selection_new(_("Save Conversation")); |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3144 |
8557 | 3145 g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S "%s.html", |
7261 | 3146 gaim_home_dir(), gaim_normalize(c->account, c->name)); |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3147 gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3148 g_object_set_data(G_OBJECT(GTK_FILE_SELECTION(window)->ok_button), |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3149 "gaim_conversation", c); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3150 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(window)->ok_button), |
6038 | 3151 "clicked", G_CALLBACK(do_check_save_convo), window); |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3152 g_signal_connect_swapped(G_OBJECT(GTK_FILE_SELECTION(window)->cancel_button), |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3153 "clicked", G_CALLBACK(gtk_widget_destroy), (gpointer)window); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3154 gtk_widget_show(window); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3155 } |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3156 |
4359 | 3157 static GtkItemFactoryEntry menu_items[] = |
3158 { | |
3159 /* Conversation menu */ | |
4596 | 3160 { N_("/_Conversation"), NULL, NULL, 0, "<Branch>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3161 |
7887 | 3162 { N_("/Conversation/New Instant _Message..."), "<CTL>M", menu_new_conv_cb, |
7859 | 3163 0, "<StockItem>", GAIM_STOCK_IM }, |
3164 | |
3165 { "/Conversation/sep0", NULL, NULL, 0, "<Separator>" }, | |
3166 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3167 { N_("/Conversation/_Find..."), NULL, menu_find_cb, 0, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3168 "<StockItem>", GTK_STOCK_FIND }, |
7859 | 3169 { N_("/Conversation/View _Log"), NULL, menu_view_log_cb, 0, NULL }, |
4596 | 3170 { N_("/Conversation/_Save As..."), NULL, menu_save_as_cb, 0, |
4359 | 3171 "<StockItem>", GTK_STOCK_SAVE_AS }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3172 |
4359 | 3173 { "/Conversation/sep1", NULL, NULL, 0, "<Separator>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3174 |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
3175 { N_("/Conversation/Add Buddy _Pounce..."), NULL, menu_add_pounce_cb, |
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
3176 0, NULL }, |
7859 | 3177 { N_("/Conversation/_Get Info"), NULL, menu_get_info_cb, 0, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3178 "<StockItem>", GAIM_STOCK_INFO }, |
7859 | 3179 { N_("/Conversation/_Warn..."), NULL, menu_warn_cb, 0, |
3180 "<StockItem>", GAIM_STOCK_WARN }, | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3181 { N_("/Conversation/In_vite..."), NULL, menu_invite_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3182 "<StockItem>", GAIM_STOCK_INVITE }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3183 |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
3184 { "/Conversation/sep2", NULL, NULL, 0, "<Separator>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3185 |
7859 | 3186 { N_("/Conversation/A_lias..."), NULL, menu_alias_cb, 0, |
3187 "<StockItem>", GAIM_STOCK_EDIT }, | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3188 { N_("/Conversation/_Block..."), NULL, menu_block_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3189 "<StockItem>", GAIM_STOCK_BLOCK }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3190 { N_("/Conversation/_Add..."), NULL, menu_add_remove_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3191 "<StockItem>", GTK_STOCK_ADD }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3192 { N_("/Conversation/_Remove..."), NULL, menu_add_remove_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3193 "<StockItem>", GTK_STOCK_REMOVE }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3194 |
7859 | 3195 { "/Conversation/sep3", NULL, NULL, 0, "<Separator>" }, |
3196 | |
8756 | 3197 { N_("/Conversation/Insert Lin_k..."), NULL, menu_insert_link_cb, 0, |
7859 | 3198 "<StockItem>", GAIM_STOCK_LINK }, |
8330
80915fd16349
[gaim-migrate @ 9054]
Christian Hammond <chipx86@chipx86.com>
parents:
8329
diff
changeset
|
3199 { N_("/Conversation/Insert Imag_e..."), NULL, NULL, 0, /* menu_insert_image_cb, 0, */ |
7859 | 3200 "<StockItem>", GAIM_STOCK_IMAGE }, |
3201 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3202 { "/Conversation/sep4", NULL, NULL, 0, "<Separator>" }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3203 |
4596 | 3204 { N_("/Conversation/_Close"), NULL, menu_close_conv_cb, 0, |
4359 | 3205 "<StockItem>", GTK_STOCK_CLOSE }, |
3206 | |
3207 /* Options */ | |
4596 | 3208 { N_("/_Options"), NULL, NULL, 0, "<Branch>" }, |
3209 { N_("/Options/Enable _Logging"), NULL, menu_logging_cb, 0, "<CheckItem>" }, | |
3210 { N_("/Options/Enable _Sounds"), NULL, menu_sounds_cb, 0, "<CheckItem>" }, | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3211 { N_("/Options/Show Formatting _Toolbar"), NULL, menu_toolbar_cb, 0, "<CheckItem>" }, |
4359 | 3212 }; |
3213 | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
3214 static const int menu_item_count = |
4359 | 3215 sizeof(menu_items) / sizeof(*menu_items); |
3216 | |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3217 static char * |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3218 item_factory_translate_func (const char *path, gpointer func_data) |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3219 { |
7386 | 3220 return _((char *)path); |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3221 } |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3222 |
4359 | 3223 static GtkWidget * |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3224 setup_menubar(GaimConvWindow *win) |
4359 | 3225 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3226 GaimGtkWindow *gtkwin; |
5116 | 3227 GtkAccelGroup *accel_group; |
4359 | 3228 gtkwin = GAIM_GTK_WINDOW(win); |
3229 | |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
3230 accel_group = gtk_accel_group_new (); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
3231 gtk_window_add_accel_group (GTK_WINDOW (gtkwin->window), accel_group); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
3232 g_object_unref (accel_group); |
5116 | 3233 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3234 gtkwin->menu.item_factory = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3235 gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<main>", accel_group); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3236 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3237 gtk_item_factory_set_translate_func(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3238 item_factory_translate_func, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3239 NULL, NULL); |
4630 | 3240 |
3241 gtk_item_factory_create_items(gtkwin->menu.item_factory, menu_item_count, | |
4359 | 3242 menu_items, win); |
7420 | 3243 g_signal_connect(G_OBJECT(accel_group), "accel-changed", |
3244 G_CALLBACK(gaim_gtk_save_accels_cb), NULL); | |
4359 | 3245 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3246 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3247 gtkwin->menu.menubar = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3248 gtk_item_factory_get_widget(gtkwin->menu.item_factory, "<main>"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3249 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3250 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3251 gtkwin->menu.view_log = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3252 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
7295 | 3253 N_("/Conversation/View Log")); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3254 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3255 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3256 gtkwin->menu.add_pounce = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3257 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3258 N_("/Conversation/Add Buddy Pounce...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3259 |
7879 | 3260 /* --- */ |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3261 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3262 gtkwin->menu.get_info = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3263 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
7859 | 3264 N_("/Conversation/Get Info")); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3265 |
7879 | 3266 gtkwin->menu.warn = |
3267 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3268 N_("/Conversation/Warn...")); | |
3269 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3270 gtkwin->menu.invite = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3271 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3272 N_("/Conversation/Invite...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3273 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3274 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3275 |
7879 | 3276 gtkwin->menu.alias = |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3277 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
7879 | 3278 N_("/Conversation/Alias...")); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3279 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3280 gtkwin->menu.block = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3281 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3282 N_("/Conversation/Block...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3283 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3284 gtkwin->menu.add = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3285 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3286 N_("/Conversation/Add...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3287 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3288 gtkwin->menu.remove = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3289 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3290 N_("/Conversation/Remove...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3291 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3292 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3293 |
7879 | 3294 gtkwin->menu.insert_link = |
3295 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3296 N_("/Conversation/Insert Link...")); | |
3297 | |
3298 gtkwin->menu.insert_image = | |
3299 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3300 N_("/Conversation/Insert Image...")); | |
3301 | |
3302 /* --- */ | |
3303 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3304 gtkwin->menu.logging = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3305 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3306 N_("/Options/Enable Logging")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3307 gtkwin->menu.sounds = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3308 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3309 N_("/Options/Enable Sounds")); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3310 gtkwin->menu.show_formatting_toolbar = |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3311 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3312 N_("/Options/Show Formatting Toolbar")); |
4359 | 3313 |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3314 generate_send_as_items(win, NULL); |
4359 | 3315 |
3316 gtk_widget_show(gtkwin->menu.menubar); | |
4931 | 3317 |
3318 return gtkwin->menu.menubar; | |
4359 | 3319 } |
3320 | |
3321 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3322 setup_im_buttons(GaimConversation *conv, GtkWidget *parent) |
4359 | 3323 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3324 GaimConnection *gc; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3325 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3326 GaimGtkImPane *gtkim; |
8811 | 3327 GaimButtonStyle button_type; |
4359 | 3328 |
3329 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3330 gtkim = gtkconv->u.im; | |
3331 gc = gaim_conversation_get_gc(conv); | |
3332 | |
3333 /* From right to left... */ | |
3334 | |
3335 /* Send button */ | |
3336 gtkconv->send = gaim_gtk_change_text(_("Send"), gtkconv->send, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3337 GAIM_STOCK_SEND, GAIM_CONV_IM); |
4359 | 3338 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->send, _("Send"), NULL); |
3339 gtk_box_pack_end(GTK_BOX(parent), gtkconv->send, FALSE, FALSE, 0); | |
3340 | |
3341 /* Separator */ | |
3342 if (gtkim->sep2 != NULL) | |
3343 gtk_widget_destroy(gtkim->sep2); | |
3344 | |
3345 gtkim->sep2 = gtk_vseparator_new(); | |
3346 gtk_box_pack_end(GTK_BOX(parent), gtkim->sep2, FALSE, TRUE, 0); | |
3347 gtk_widget_show(gtkim->sep2); | |
3348 | |
3349 /* Now, um, just kind of all over the place. Huh? */ | |
3350 | |
3351 /* Warn button */ | |
3352 gtkim->warn = gaim_gtk_change_text(_("Warn"), gtkim->warn, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3353 GAIM_STOCK_WARN, GAIM_CONV_IM); |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3354 gtk_tooltips_set_tip(gtkconv->tooltips, gtkim->warn, |
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3355 _("Warn the user"), NULL); |
7929 | 3356 gtk_box_pack_start(GTK_BOX(parent), gtkim->warn, FALSE, FALSE, 0); |
3357 | |
3358 /* Block button */ | |
3359 gtkim->block = gaim_gtk_change_text(_("Block"), gtkim->block, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3360 GAIM_STOCK_BLOCK, GAIM_CONV_IM); |
7929 | 3361 gtk_tooltips_set_tip(gtkconv->tooltips, gtkim->block, |
3362 _("Block the user"), NULL); | |
3363 gtk_box_pack_start(GTK_BOX(parent), gtkim->block, FALSE, FALSE, 0); | |
3364 | |
3365 /* Add button */ | |
3366 gtkconv->add = gaim_gtk_change_text(_("Add"), gtkconv->add, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3367 GTK_STOCK_ADD, GAIM_CONV_IM); |
7929 | 3368 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->add, |
3369 _("Add the user to your buddy list"), NULL); | |
3370 gtk_box_pack_start(GTK_BOX(parent), gtkconv->add, FALSE, FALSE, 0); | |
3371 | |
3372 /* Remove button */ | |
3373 gtkconv->remove = gaim_gtk_change_text(_("Remove"), gtkconv->remove, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3374 GTK_STOCK_REMOVE, GAIM_CONV_IM); |
7929 | 3375 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->remove, |
3376 _("Remove the user from your buddy list"), NULL); | |
3377 gtk_box_pack_start(GTK_BOX(parent), gtkconv->remove, FALSE, FALSE, 0); | |
4359 | 3378 |
3379 /* Info button */ | |
3380 gtkconv->info = gaim_gtk_change_text(_("Info"), gtkconv->info, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3381 GAIM_STOCK_INFO, GAIM_CONV_IM); |
4359 | 3382 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->info, |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3383 _("Get the user's information"), NULL); |
7929 | 3384 gtk_box_pack_start(GTK_BOX(parent), gtkconv->info, FALSE, FALSE, 0); |
3385 | |
3386 gtk_button_set_relief(GTK_BUTTON(gtkim->warn), GTK_RELIEF_NONE); | |
3387 gtk_button_set_relief(GTK_BUTTON(gtkim->block), GTK_RELIEF_NONE); | |
3388 gtk_button_set_relief(GTK_BUTTON(gtkconv->add), GTK_RELIEF_NONE); | |
3389 gtk_button_set_relief(GTK_BUTTON(gtkconv->remove), GTK_RELIEF_NONE); | |
4359 | 3390 gtk_button_set_relief(GTK_BUTTON(gtkconv->info), GTK_RELIEF_NONE); |
3391 gtk_button_set_relief(GTK_BUTTON(gtkconv->send), GTK_RELIEF_NONE); | |
7929 | 3392 |
3393 gtk_size_group_add_widget(gtkconv->sg, gtkim->warn); | |
3394 gtk_size_group_add_widget(gtkconv->sg, gtkim->block); | |
3395 gtk_size_group_add_widget(gtkconv->sg, gtkconv->add); | |
3396 gtk_size_group_add_widget(gtkconv->sg, gtkconv->remove); | |
4359 | 3397 gtk_size_group_add_widget(gtkconv->sg, gtkconv->info); |
3398 gtk_size_group_add_widget(gtkconv->sg, gtkconv->send); | |
7929 | 3399 |
3400 gtk_box_reorder_child(GTK_BOX(parent), gtkim->warn, 1); | |
3401 gtk_box_reorder_child(GTK_BOX(parent), gtkim->block, 2); | |
3402 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->add, 3); | |
3403 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->remove, 4); | |
3404 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->info, 5); | |
4359 | 3405 |
3406 gaim_gtkconv_update_buttons_by_protocol(conv); | |
3407 | |
8811 | 3408 /* Check if the buttons should be visible or not */ |
3409 button_type = gaim_prefs_get_int("/gaim/gtk/conversations/im/button_type"); | |
3410 if (button_type == GAIM_BUTTON_NONE) | |
3411 gtk_widget_hide(gtkconv->bbox); | |
3412 else | |
3413 gtk_widget_show(gtkconv->bbox); | |
3414 | |
4359 | 3415 g_signal_connect(G_OBJECT(gtkim->warn), "clicked", |
3416 G_CALLBACK(warn_cb), conv); | |
3417 g_signal_connect(G_OBJECT(gtkim->block), "clicked", | |
3418 G_CALLBACK(block_cb), conv); | |
7929 | 3419 g_signal_connect(G_OBJECT(gtkconv->add), "clicked", |
3420 G_CALLBACK(add_remove_cb), conv); | |
3421 g_signal_connect(G_OBJECT(gtkconv->remove), "clicked", | |
3422 G_CALLBACK(add_remove_cb), conv); | |
3423 g_signal_connect(G_OBJECT(gtkconv->info), "clicked", | |
3424 G_CALLBACK(info_cb), conv); | |
3425 g_signal_connect(G_OBJECT(gtkconv->send), "clicked", | |
3426 G_CALLBACK(send_cb), conv); | |
4359 | 3427 } |
3428 | |
3429 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3430 setup_chat_buttons(GaimConversation *conv, GtkWidget *parent) |
4359 | 3431 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3432 GaimConnection *gc; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3433 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3434 GaimGtkChatPane *gtkchat; |
8811 | 3435 GaimButtonStyle button_type; |
4359 | 3436 |
3437 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3438 gtkchat = gtkconv->u.chat; | |
3439 gc = gaim_conversation_get_gc(conv); | |
3440 | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3441 /* From right to left... */ |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3442 |
4359 | 3443 /* Send button */ |
3444 gtkconv->send = gaim_gtk_change_text(_("Send"), gtkconv->send, | |
3445 GAIM_STOCK_SEND, GAIM_CONV_CHAT); | |
3446 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->send, _("Send"), NULL); | |
3447 gtk_box_pack_end(GTK_BOX(parent), gtkconv->send, FALSE, FALSE, 0); | |
3448 | |
3449 /* Separator */ | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3450 if (gtkchat->sep != NULL) |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3451 gtk_widget_destroy(gtkchat->sep); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3452 |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3453 gtkchat->sep = gtk_vseparator_new(); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3454 gtk_box_pack_end(GTK_BOX(parent), gtkchat->sep, FALSE, TRUE, 0); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3455 gtk_widget_show(gtkchat->sep); |
4359 | 3456 |
3457 /* Invite */ | |
3458 gtkchat->invite = gaim_gtk_change_text(_("Invite"), gtkchat->invite, | |
3459 GAIM_STOCK_INVITE, GAIM_CONV_CHAT); | |
3460 gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->invite, | |
3461 _("Invite a user"), NULL); | |
7931 | 3462 gtk_box_pack_start(GTK_BOX(parent), gtkchat->invite, FALSE, FALSE, 0); |
4359 | 3463 |
7929 | 3464 /* Add button */ |
3465 gtkconv->add = gaim_gtk_change_text(_("Add"), gtkconv->add, | |
3466 GTK_STOCK_ADD, GAIM_CONV_CHAT); | |
3467 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->add, | |
3468 _("Add the chat to your buddy list"), NULL); | |
3469 gtk_box_pack_start(GTK_BOX(parent), gtkconv->add, FALSE, FALSE, 0); | |
3470 | |
3471 /* Remove button */ | |
3472 gtkconv->remove = gaim_gtk_change_text(_("Remove"), gtkconv->remove, | |
3473 GTK_STOCK_REMOVE, GAIM_CONV_CHAT); | |
3474 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->remove, | |
3475 _("Remove the chat from your buddy list"), NULL); | |
3476 gtk_box_pack_start(GTK_BOX(parent), gtkconv->remove, FALSE, FALSE, 0); | |
3477 | |
4359 | 3478 /* Set the relief on these. */ |
3479 gtk_button_set_relief(GTK_BUTTON(gtkchat->invite), GTK_RELIEF_NONE); | |
7929 | 3480 gtk_button_set_relief(GTK_BUTTON(gtkconv->add), GTK_RELIEF_NONE); |
3481 gtk_button_set_relief(GTK_BUTTON(gtkconv->remove), GTK_RELIEF_NONE); | |
4359 | 3482 gtk_button_set_relief(GTK_BUTTON(gtkconv->send), GTK_RELIEF_NONE); |
3483 | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3484 gtk_size_group_add_widget(gtkconv->sg, gtkchat->invite); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3485 gtk_size_group_add_widget(gtkconv->sg, gtkconv->add); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3486 gtk_size_group_add_widget(gtkconv->sg, gtkconv->remove); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3487 gtk_size_group_add_widget(gtkconv->sg, gtkconv->send); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3488 |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3489 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->add, 1); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3490 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->remove, 3); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3491 gtk_box_reorder_child(GTK_BOX(parent), gtkchat->invite, 3); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3492 |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3493 gaim_gtkconv_update_buttons_by_protocol(conv); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3494 |
8811 | 3495 /* Check if the buttons should be visible or not */ |
3496 button_type = gaim_prefs_get_int("/gaim/gtk/conversations/chat/button_type"); | |
3497 if (button_type == GAIM_BUTTON_NONE) | |
3498 gtk_widget_hide(gtkconv->bbox); | |
3499 else | |
3500 gtk_widget_show(gtkconv->bbox); | |
3501 | |
4359 | 3502 /* Callbacks */ |
7929 | 3503 g_signal_connect(G_OBJECT(gtkchat->invite), "clicked", |
3504 G_CALLBACK(invite_cb), conv); | |
3505 g_signal_connect(G_OBJECT(gtkconv->add), "clicked", | |
3506 G_CALLBACK(add_remove_cb), conv); | |
3507 g_signal_connect(G_OBJECT(gtkconv->remove), "clicked", | |
3508 G_CALLBACK(add_remove_cb), conv); | |
4359 | 3509 g_signal_connect(G_OBJECT(gtkconv->send), "clicked", |
3510 G_CALLBACK(send_cb), conv); | |
3511 } | |
3512 | |
3513 | |
7971 | 3514 static void topic_callback(GtkWidget *w, GaimConversation *conv) |
3515 { | |
3516 GaimPluginProtocolInfo *prpl_info = NULL; | |
3517 GaimConnection *gc; | |
3518 GaimGtkConversation *gtkconv; | |
3519 GaimGtkChatPane *gtkchat; | |
8858 | 3520 const char *new_topic; |
3521 const char *current_topic; | |
7971 | 3522 |
3523 gc = gaim_conversation_get_gc(conv); | |
3524 | |
3525 if(!gc || !(prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl))) | |
3526 return; | |
3527 | |
3528 if(prpl_info->set_chat_topic == NULL) | |
3529 return; | |
3530 | |
3531 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3532 gtkchat = gtkconv->u.chat; | |
8858 | 3533 new_topic = gtk_entry_get_text(GTK_ENTRY(gtkchat->topic_text)); |
3534 current_topic = gaim_conv_chat_get_topic(GAIM_CONV_CHAT(conv)); | |
3535 | |
3536 if(current_topic && !g_utf8_collate(new_topic, current_topic)) | |
7971 | 3537 return; |
3538 | |
8858 | 3539 prpl_info->set_chat_topic(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), |
3540 new_topic); | |
7971 | 3541 } |
3542 | |
4359 | 3543 static GtkWidget * |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3544 setup_chat_pane(GaimConversation *conv) |
4359 | 3545 { |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3546 GaimPluginProtocolInfo *prpl_info = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3547 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3548 GaimGtkChatPane *gtkchat; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3549 GaimConnection *gc; |
8456 | 3550 GaimPlugin *protocol; |
4359 | 3551 GtkWidget *vpaned, *hpaned; |
3552 GtkWidget *vbox, *hbox; | |
3553 GtkWidget *lbox, *bbox; | |
3554 GtkWidget *label; | |
3555 GtkWidget *list; | |
3556 GtkWidget *button; | |
7949 | 3557 GtkWidget *sw; |
4359 | 3558 GtkListStore *ls; |
3559 GtkCellRenderer *rend; | |
3560 GtkTreeViewColumn *col; | |
8143 | 3561 GList *focus_chain; |
4359 | 3562 |
3563 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3564 gtkchat = gtkconv->u.chat; | |
3565 gc = gaim_conversation_get_gc(conv); | |
3566 | |
3567 /* Setup the outer pane. */ | |
3568 vpaned = gtk_vpaned_new(); | |
3569 gtk_widget_show(vpaned); | |
3570 | |
3571 /* Setup the top part of the pane. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3572 vbox = gtk_vbox_new(FALSE, 6); |
8914 | 3573 gtk_paned_pack1(GTK_PANED(vpaned), vbox, TRUE, TRUE); |
4359 | 3574 gtk_widget_show(vbox); |
3575 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3576 if (gc != NULL) |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3577 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3578 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3579 if (prpl_info->options & OPT_PROTO_CHAT_TOPIC) |
4359 | 3580 { |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3581 hbox = gtk_hbox_new(FALSE, 6); |
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3582 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
4359 | 3583 gtk_widget_show(hbox); |
3584 | |
3585 label = gtk_label_new(_("Topic:")); | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3586 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
4359 | 3587 gtk_widget_show(label); |
3588 | |
3589 gtkchat->topic_text = gtk_entry_new(); | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3590 |
7971 | 3591 if(prpl_info->set_chat_topic == NULL) { |
3592 gtk_editable_set_editable(GTK_EDITABLE(gtkchat->topic_text), FALSE); | |
3593 } else { | |
3594 g_signal_connect(GTK_OBJECT(gtkchat->topic_text), "activate", | |
3595 G_CALLBACK(topic_callback), conv); | |
3596 } | |
3597 | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3598 gtk_box_pack_start(GTK_BOX(hbox), gtkchat->topic_text, TRUE, TRUE, 0); |
4359 | 3599 gtk_widget_show(gtkchat->topic_text); |
3600 } | |
3601 | |
3602 /* Setup the horizontal pane. */ | |
3603 hpaned = gtk_hpaned_new(); | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3604 gtk_box_pack_start(GTK_BOX(vbox), hpaned, TRUE, TRUE, 0); |
4359 | 3605 gtk_widget_show(hpaned); |
3606 | |
3607 /* Setup the scrolled window to put gtkimhtml in. */ | |
3608 gtkconv->sw = gtk_scrolled_window_new(NULL, NULL); | |
3609 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
8076 | 3610 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
4359 | 3611 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(gtkconv->sw), |
3612 GTK_SHADOW_IN); | |
3613 gtk_paned_pack1(GTK_PANED(hpaned), gtkconv->sw, TRUE, TRUE); | |
3614 | |
3615 gtk_widget_set_size_request(gtkconv->sw, | |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3616 gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_width"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3617 gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_height")); |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3618 |
8914 | 3619 g_signal_connect(G_OBJECT(gtkconv->sw), "size-allocate", |
3620 G_CALLBACK(size_allocate_cb), conv); | |
3621 | |
4359 | 3622 gtk_widget_show(gtkconv->sw); |
3623 | |
3624 /* Setup gtkihmtml. */ | |
3625 gtkconv->imhtml = gtk_imhtml_new(NULL, NULL); | |
8829 | 3626 gtk_widget_set_name(gtkconv->imhtml, "gtkconv_imhtml"); |
4359 | 3627 gtk_container_add(GTK_CONTAINER(gtkconv->sw), gtkconv->imhtml); |
3628 | |
3629 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3630 gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); |
4359 | 3631 |
3632 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", | |
3633 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
8105 | 3634 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_press_event", |
6057 | 3635 G_CALLBACK(refocus_entry_cb), gtkconv); |
8109 | 3636 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_release_event", |
3637 G_CALLBACK(refocus_entry_cb), gtkconv); | |
4359 | 3638 |
3639 gaim_setup_imhtml(gtkconv->imhtml); | |
3640 | |
3641 gtk_widget_show(gtkconv->imhtml); | |
3642 | |
3643 /* Build the right pane. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3644 lbox = gtk_vbox_new(FALSE, 6); |
4409
0521eec12c33
[gaim-migrate @ 4682]
Christian Hammond <chipx86@chipx86.com>
parents:
4398
diff
changeset
|
3645 gtk_paned_pack2(GTK_PANED(hpaned), lbox, FALSE, TRUE); |
4359 | 3646 gtk_widget_show(lbox); |
3647 | |
3648 /* Setup the label telling how many people are in the room. */ | |
3649 gtkchat->count = gtk_label_new(_("0 people in room")); | |
3650 gtk_box_pack_start(GTK_BOX(lbox), gtkchat->count, FALSE, FALSE, 0); | |
3651 gtk_widget_show(gtkchat->count); | |
3652 | |
3653 /* Setup the list of users. */ | |
7949 | 3654 sw = gtk_scrolled_window_new(NULL, NULL); |
3655 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
8076 | 3656 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
7949 | 3657 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); |
3658 gtk_box_pack_start(GTK_BOX(lbox), sw, TRUE, TRUE, 0); | |
3659 gtk_widget_show(sw); | |
4359 | 3660 |
3661 ls = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING); | |
3662 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), 1, | |
3663 GTK_SORT_ASCENDING); | |
3664 | |
3665 list = gtk_tree_view_new_with_model(GTK_TREE_MODEL(ls)); | |
3666 | |
3667 rend = gtk_cell_renderer_text_new(); | |
3668 col = gtk_tree_view_column_new_with_attributes(NULL, rend, | |
3669 "text", 0, NULL); | |
3670 gtk_tree_view_column_set_clickable(GTK_TREE_VIEW_COLUMN(col), TRUE); | |
3671 | |
3672 g_signal_connect(G_OBJECT(list), "button_press_event", | |
3673 G_CALLBACK(right_click_chat_cb), conv); | |
8143 | 3674 g_signal_connect(G_OBJECT(list), "popup-menu", |
3675 G_CALLBACK(gtkconv_chat_popup_menu_cb), conv); | |
4359 | 3676 |
3677 gtk_tree_view_append_column(GTK_TREE_VIEW(list), col); | |
3678 | |
3679 col = gtk_tree_view_column_new_with_attributes(NULL, rend, | |
3680 "text", 1, NULL); | |
3681 gtk_tree_view_column_set_clickable(GTK_TREE_VIEW_COLUMN(col), TRUE); | |
3682 | |
3683 gtk_tree_view_append_column(GTK_TREE_VIEW(list), col); | |
3684 | |
3685 gtk_widget_set_size_request(list, 150, -1); | |
3686 | |
3687 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(list), FALSE); | |
3688 gtk_widget_show(list); | |
3689 | |
3690 gtkchat->list = list; | |
3691 | |
7949 | 3692 gtk_container_add(GTK_CONTAINER(sw), list); |
4359 | 3693 |
3694 /* Setup the user list toolbar. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3695 bbox = gtk_hbox_new(TRUE, 6); |
4359 | 3696 gtk_box_pack_start(GTK_BOX(lbox), bbox, FALSE, FALSE, 0); |
3697 gtk_widget_show(bbox); | |
3698 | |
3699 /* IM */ | |
3700 button = gaim_pixbuf_button_from_stock(NULL, GTK_STOCK_REDO, | |
3701 GAIM_BUTTON_VERTICAL); | |
3702 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
3703 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
|
3704 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("IM the user"), NULL); |
4359 | 3705 g_signal_connect(G_OBJECT(button), "clicked", |
7961 | 3706 G_CALLBACK(chat_im_button_cb), conv); |
4359 | 3707 |
3708 gtk_widget_show(button); | |
3709 | |
3710 /* Ignore */ | |
3711 button = gaim_pixbuf_button_from_stock(NULL, GAIM_STOCK_IGNORE, | |
3712 GAIM_BUTTON_VERTICAL); | |
3713 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
3714 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
|
3715 gtk_tooltips_set_tip(gtkconv->tooltips, button, |
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3716 _("Ignore the user"), NULL); |
4359 | 3717 g_signal_connect(G_OBJECT(button), "clicked", |
3718 G_CALLBACK(ignore_cb), conv); | |
3719 gtk_widget_show(button); | |
3720 | |
3721 /* Info */ | |
3722 button = gaim_pixbuf_button_from_stock(NULL, GAIM_STOCK_INFO, | |
3723 GAIM_BUTTON_VERTICAL); | |
3724 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
3725 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
3726 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3727 _("Get the user's information"), NULL); |
4359 | 3728 g_signal_connect(G_OBJECT(button), "clicked", |
3729 G_CALLBACK(info_cb), conv); | |
3730 | |
3731 gtk_widget_show(button); | |
3732 | |
3733 gtkconv->info = button; | |
3734 | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3735 /* Build the toolbar. */ |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3736 vbox = gtk_vbox_new(FALSE, 6); |
8914 | 3737 gtk_paned_pack2(GTK_PANED(vpaned), vbox, FALSE, TRUE); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3738 gtk_widget_show(vbox); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3739 |
8317 | 3740 gtkconv->toolbar = gtk_imhtmltoolbar_new(); |
3741 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->toolbar, FALSE, FALSE, 0); | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3742 |
8123 | 3743 /* Setup the entry widget. |
3744 * We never show the horizontal scrollbar because it was causing weird | |
3745 * lockups when typing text just as you type the character that would | |
3746 * cause both scrollbars to appear. Definitely seems like a gtk bug. | |
3747 */ | |
8821 | 3748 gtkconv->entrybox = gtk_hbox_new(FALSE, 6); |
3749 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->entrybox, TRUE, TRUE, 0); | |
3750 gtk_widget_show(gtkconv->entrybox); | |
3751 | |
7949 | 3752 sw = gtk_scrolled_window_new(NULL, NULL); |
3753 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
8112 | 3754 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); |
8061 | 3755 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), |
3756 GTK_SHADOW_IN); | |
8821 | 3757 gtk_box_pack_start(GTK_BOX(gtkconv->entrybox), sw, TRUE, TRUE, 0); |
7949 | 3758 gtk_widget_show(sw); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3759 |
8061 | 3760 gtkconv->entry = gtk_imhtml_new(NULL, NULL); |
8829 | 3761 gtk_widget_set_name(gtkconv->entry, "gtkconv_entry"); |
8456 | 3762 gtk_imhtml_smiley_shortcuts(GTK_IMHTML(gtkconv->entry), |
3763 gaim_prefs_get_bool("/gaim/gtk/conversations/smiley_shortcuts")); | |
3764 gtk_imhtml_html_shortcuts(GTK_IMHTML(gtkconv->entry), | |
3765 gaim_prefs_get_bool("/gaim/gtk/conversations/html_shortcuts")); | |
3766 | |
3767 protocol = gaim_find_prpl(conv->account->protocol_id); | |
3768 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), | |
3769 protocol->info->name); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3770 gtkconv->entry_buffer = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3771 gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); |
8061 | 3772 gaim_setup_imhtml(gtkconv->entry); |
3773 gtk_imhtml_set_editable(GTK_IMHTML(gtkconv->entry), TRUE); | |
3774 default_formatize(conv); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3775 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(gtkconv->entry), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3776 GTK_WRAP_WORD_CHAR); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3777 gtk_widget_set_size_request(gtkconv->entry, -1, |
8106 | 3778 gaim_prefs_get_int("/gaim/gtk/conversations/chat/entry_height")); |
7949 | 3779 g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", conv); |
3780 | |
3781 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", | |
8105 | 3782 G_CALLBACK(entry_key_press_cb), conv); |
4359 | 3783 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", |
3784 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
8914 | 3785 g_signal_connect(G_OBJECT(gtkconv->entry), "size-allocate", |
3786 G_CALLBACK(size_allocate_cb), conv); | |
4359 | 3787 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3788 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
3789 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3790 gtk_imhtmltoolbar_attach(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3791 gtkconv->entry); |
4359 | 3792 |
7949 | 3793 gtk_container_add(GTK_CONTAINER(sw), GTK_WIDGET(gtkconv->entry)); |
4359 | 3794 gtk_widget_show(gtkconv->entry); |
3795 | |
3796 /* Setup the bottom button box. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3797 gtkconv->bbox = gtk_hbox_new(FALSE, 6); |
4359 | 3798 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->bbox, FALSE, FALSE, 0); |
3799 gtk_widget_show(gtkconv->bbox); | |
3800 | |
3801 setup_chat_buttons(conv, gtkconv->bbox); | |
3802 | |
8143 | 3803 focus_chain = g_list_prepend (NULL, sw); |
3804 gtk_container_set_focus_chain (GTK_CONTAINER(vbox), focus_chain); | |
4359 | 3805 return vpaned; |
3806 } | |
3807 | |
3808 static GtkWidget * | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3809 setup_im_pane(GaimConversation *conv) |
4359 | 3810 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3811 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3812 GaimGtkImPane *gtkim; |
8456 | 3813 GaimPlugin *protocol; |
4359 | 3814 GtkWidget *paned; |
3815 GtkWidget *vbox; | |
3816 GtkWidget *vbox2; | |
7949 | 3817 GtkWidget *sw; |
8143 | 3818 GList *focus_chain; |
4359 | 3819 |
3820 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3821 gtkim = gtkconv->u.im; | |
3822 | |
3823 /* Setup the outer pane. */ | |
3824 paned = gtk_vpaned_new(); | |
3825 gtk_widget_show(paned); | |
3826 | |
3827 /* Setup the top part of the pane. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3828 vbox = gtk_vbox_new(FALSE, 6); |
4409
0521eec12c33
[gaim-migrate @ 4682]
Christian Hammond <chipx86@chipx86.com>
parents:
4398
diff
changeset
|
3829 gtk_paned_pack1(GTK_PANED(paned), vbox, TRUE, TRUE); |
4359 | 3830 gtk_widget_show(vbox); |
3831 | |
3832 /* Setup the gtkimhtml widget. */ | |
3833 gtkconv->sw = gtk_scrolled_window_new(NULL, NULL); | |
3834 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
8076 | 3835 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
4359 | 3836 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(gtkconv->sw), |
3837 GTK_SHADOW_IN); | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3838 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->sw, TRUE, TRUE, 0); |
4851 | 3839 |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3840 gtk_widget_set_size_request(gtkconv->sw, |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3841 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_width"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3842 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_height")); |
8914 | 3843 g_signal_connect(G_OBJECT(gtkconv->sw), "size-allocate", |
3844 G_CALLBACK(size_allocate_cb), conv); | |
4359 | 3845 gtk_widget_show(gtkconv->sw); |
3846 | |
3847 gtkconv->imhtml = gtk_imhtml_new(NULL, NULL); | |
8829 | 3848 gtk_widget_set_name(gtkconv->imhtml, "gtkconv_imhtml"); |
4359 | 3849 gtk_container_add(GTK_CONTAINER(gtkconv->sw), gtkconv->imhtml); |
3850 | |
3851 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", | |
3852 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
8105 | 3853 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_press_event", |
6057 | 3854 G_CALLBACK(refocus_entry_cb), gtkconv); |
8109 | 3855 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_release_event", |
3856 G_CALLBACK(refocus_entry_cb), gtkconv); | |
4359 | 3857 |
3858 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3859 gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); |
4359 | 3860 |
3861 gaim_setup_imhtml(gtkconv->imhtml); | |
3862 gtk_widget_show(gtkconv->imhtml); | |
3863 | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3864 vbox2 = gtk_vbox_new(FALSE, 6); |
8914 | 3865 gtk_paned_pack2(GTK_PANED(paned), vbox2, FALSE, TRUE); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3866 gtk_widget_show(vbox2); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3867 |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3868 /* Build the toolbar. */ |
8317 | 3869 gtkconv->toolbar = gtk_imhtmltoolbar_new(); |
3870 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->toolbar, FALSE, FALSE, 0); | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3871 |
8123 | 3872 /* Setup the entry widget. |
3873 * We never show the horizontal scrollbar because it was causing weird | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3874 * lockups when typing text just as you type the character that would |
8123 | 3875 * cause both scrollbars to appear. Definitely seems like a gtk bug. |
3876 */ | |
8821 | 3877 gtkconv->entrybox = gtk_hbox_new(FALSE, 6); |
3878 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->entrybox, TRUE, TRUE, 0); | |
3879 gtk_widget_show(gtkconv->entrybox); | |
3880 | |
7949 | 3881 sw = gtk_scrolled_window_new(NULL, NULL); |
3882 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
8112 | 3883 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); |
8061 | 3884 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), |
3885 GTK_SHADOW_IN); | |
8821 | 3886 gtk_box_pack_start(GTK_BOX(gtkconv->entrybox), sw, TRUE, TRUE, 0); |
7949 | 3887 gtk_widget_show(sw); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3888 |
8061 | 3889 gtkconv->entry = gtk_imhtml_new(NULL, NULL); |
8829 | 3890 gtk_widget_set_name(gtkconv->entry, "gtkconv_entry"); |
8456 | 3891 |
3892 gtk_imhtml_smiley_shortcuts(GTK_IMHTML(gtkconv->entry), | |
3893 gaim_prefs_get_bool("/gaim/gtk/conversations/smiley_shortcuts")); | |
3894 gtk_imhtml_html_shortcuts(GTK_IMHTML(gtkconv->entry), | |
3895 gaim_prefs_get_bool("/gaim/gtk/conversations/html_shortcuts")); | |
3896 | |
3897 protocol = gaim_find_prpl(conv->account->protocol_id); | |
3898 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), | |
3899 protocol->info->name); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3900 gtkconv->entry_buffer = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3901 gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); |
8061 | 3902 gaim_setup_imhtml(gtkconv->entry); |
3903 gtk_imhtml_set_editable(GTK_IMHTML(gtkconv->entry), TRUE); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3904 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(gtkconv->entry), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3905 GTK_WRAP_WORD_CHAR); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3906 gtk_widget_set_size_request(gtkconv->entry, -1, |
8106 | 3907 gaim_prefs_get_int("/gaim/gtk/conversations/im/entry_height")); |
7949 | 3908 g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", conv); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3909 |
4359 | 3910 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", |
8105 | 3911 G_CALLBACK(entry_key_press_cb), conv); |
4359 | 3912 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", |
3913 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
8914 | 3914 g_signal_connect(G_OBJECT(gtkconv->entry), "size-allocate", |
3915 G_CALLBACK(size_allocate_cb), conv); | |
4359 | 3916 |
3917 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "insert_text", | |
3918 G_CALLBACK(insert_text_cb), conv); | |
3919 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "delete_range", | |
3920 G_CALLBACK(delete_text_cb), conv); | |
3921 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3922 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
3923 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
4359 | 3924 |
7949 | 3925 gtk_container_add(GTK_CONTAINER(sw), GTK_WIDGET(gtkconv->entry)); |
4359 | 3926 gtk_widget_show(gtkconv->entry); |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
3927 gtk_imhtmltoolbar_attach(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), |
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
3928 gtkconv->entry); |
8481 | 3929 /* had to move this after the imtoolbar is attached so that the |
3930 * signals get fired to toggle the buttons on the toolbar as well. | |
3931 */ | |
3932 default_formatize(conv); | |
4359 | 3933 |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3934 gtkconv->bbox = gtk_hbox_new(FALSE, 6); |
4359 | 3935 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->bbox, FALSE, FALSE, 0); |
3936 gtk_widget_show(gtkconv->bbox); | |
3937 | |
3938 setup_im_buttons(conv, gtkconv->bbox); | |
8758 | 3939 gtkconv->u.im->animate = gaim_prefs_get_bool("/gaim/gtk/conversations/im/animate_buddy_icons"); |
4359 | 3940 |
8143 | 3941 focus_chain = g_list_prepend (NULL, sw); |
3942 gtk_container_set_focus_chain (GTK_CONTAINER(vbox2), focus_chain); | |
3943 | |
4359 | 3944 return paned; |
3945 } | |
3946 | |
3947 static void | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3948 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
|
3949 GtkSelectionData *sd, guint info, guint t, |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3950 GaimConversation *conv) |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3951 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3952 GaimConvWindow *win = conv->window; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3953 GaimConversation *c; |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3954 |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3955 if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE)) |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3956 { |
4781 | 3957 GaimBlistNode *n = NULL; |
6695 | 3958 GaimBuddy *b; |
4781 | 3959 memcpy(&n, sd->data, sizeof(n)); |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3960 |
6695 | 3961 if (GAIM_BLIST_NODE_IS_CONTACT(n)) |
3962 b = gaim_contact_get_priority_buddy((GaimContact*)n); | |
3963 else if (GAIM_BLIST_NODE_IS_BUDDY(n)) | |
3964 b = (GaimBuddy*)n; | |
3965 else | |
4781 | 3966 return; |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3967 |
7089
2cd3756a637b
[gaim-migrate @ 7654]
Christian Hammond <chipx86@chipx86.com>
parents:
7078
diff
changeset
|
3968 c = gaim_conversation_new(GAIM_CONV_IM, b->account, b->name); |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3969 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3970 gaim_conv_window_add_conversation(win, c); |
8802
1076cd8579ea
[gaim-migrate @ 9564]
Christian Hammond <chipx86@chipx86.com>
parents:
8758
diff
changeset
|
3971 |
1076cd8579ea
[gaim-migrate @ 9564]
Christian Hammond <chipx86@chipx86.com>
parents:
8758
diff
changeset
|
3972 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); |
4702 | 3973 } |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3974 else if (sd->target == gdk_atom_intern("application/x-im-contact", FALSE)) |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3975 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3976 char *protocol = NULL; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3977 char *username = NULL; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3978 GaimAccount *account; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3979 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3980 if (gaim_gtk_parse_x_im_contact(sd->data, FALSE, &account, |
7718 | 3981 &protocol, &username, NULL)) |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3982 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3983 if (account == NULL) |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3984 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3985 gaim_notify_error(NULL, NULL, |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3986 _("You are not currently signed on with an account that " |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3987 "can add that buddy."), NULL); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3988 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3989 else |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3990 { |
7718 | 3991 c = gaim_conversation_new(GAIM_CONV_IM, account, username); |
3992 gaim_conv_window_add_conversation(win, c); | |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3993 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3994 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3995 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3996 if (username != NULL) g_free(username); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3997 if (protocol != NULL) g_free(protocol); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3998 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3999 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4000 } |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4001 } |
4359 | 4002 |
4003 /************************************************************************** | |
4004 * GTK+ window ops | |
4005 **************************************************************************/ | |
4006 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4007 gaim_gtk_new_window(GaimConvWindow *win) |
4359 | 4008 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4009 GaimGtkWindow *gtkwin; |
4359 | 4010 GtkPositionType pos; |
4011 GtkWidget *testidea; | |
4012 GtkWidget *menubar; | |
4013 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4014 gtkwin = g_malloc0(sizeof(GaimGtkWindow)); |
4359 | 4015 |
4016 win->ui_data = gtkwin; | |
4017 | |
4018 /* Create the window. */ | |
4019 gtkwin->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
4020 gtk_window_set_role(GTK_WINDOW(gtkwin->window), "conversation"); | |
4635 | 4021 gtk_window_set_resizable(GTK_WINDOW(gtkwin->window), TRUE); |
4510
4c394222c732
[gaim-migrate @ 4786]
Christian Hammond <chipx86@chipx86.com>
parents:
4505
diff
changeset
|
4022 gtk_container_set_border_width(GTK_CONTAINER(gtkwin->window), 0); |
5173 | 4023 GTK_WINDOW(gtkwin->window)->allow_shrink = TRUE; |
4359 | 4024 gtk_widget_realize(gtkwin->window); |
4025 | |
4026 g_signal_connect(G_OBJECT(gtkwin->window), "delete_event", | |
4027 G_CALLBACK(close_win_cb), win); | |
4028 | |
4029 /* Create the notebook. */ | |
4030 gtkwin->notebook = gtk_notebook_new(); | |
4031 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4032 pos = gaim_prefs_get_int("/gaim/gtk/conversations/tab_side"); |
4359 | 4033 |
4034 #if 0 | |
4035 gtk_notebook_set_tab_hborder(GTK_NOTEBOOK(gtkwin->notebook), 0); | |
4036 gtk_notebook_set_tab_vborder(GTK_NOTEBOOK(gtkwin->notebook), 0); | |
4037 #endif | |
4038 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos); | |
4039 gtk_notebook_set_scrollable(GTK_NOTEBOOK(gtkwin->notebook), TRUE); | |
4040 gtk_notebook_popup_enable(GTK_NOTEBOOK(gtkwin->notebook)); | |
4818 | 4041 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), FALSE); |
4042 | |
4359 | 4043 gtk_widget_show(gtkwin->notebook); |
4044 | |
8189 | 4045 g_signal_connect(G_OBJECT(gtkwin->notebook), "switch_page", |
4046 G_CALLBACK(before_switch_conv_cb), win); | |
4359 | 4047 g_signal_connect_after(G_OBJECT(gtkwin->notebook), "switch_page", |
4048 G_CALLBACK(switch_conv_cb), win); | |
4049 | |
4050 /* Setup the tab drag and drop signals. */ | |
4486 | 4051 gtk_widget_add_events(gtkwin->notebook, |
4052 GDK_BUTTON1_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK); | |
4053 g_signal_connect(G_OBJECT(gtkwin->notebook), "button_press_event", | |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4054 G_CALLBACK(notebook_press_cb), win); |
4486 | 4055 g_signal_connect(G_OBJECT(gtkwin->notebook), "button_release_event", |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4056 G_CALLBACK(notebook_release_cb), win); |
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4057 |
4359 | 4058 testidea = gtk_vbox_new(FALSE, 0); |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4059 |
4359 | 4060 /* Setup the menubar. */ |
4061 menubar = setup_menubar(win); | |
4062 gtk_box_pack_start(GTK_BOX(testidea), menubar, FALSE, TRUE, 0); | |
4063 | |
4064 gtk_box_pack_start(GTK_BOX(testidea), gtkwin->notebook, TRUE, TRUE, 0); | |
4065 | |
4066 gtk_container_add(GTK_CONTAINER(gtkwin->window), testidea); | |
4067 | |
4068 gtk_widget_show(testidea); | |
4069 } | |
4070 | |
4071 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4072 gaim_gtk_destroy_window(GaimConvWindow *win) |
4359 | 4073 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4074 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4075 |
4076 gtk_widget_destroy(gtkwin->window); | |
4077 | |
4630 | 4078 g_object_unref(G_OBJECT(gtkwin->menu.item_factory)); |
4079 | |
4359 | 4080 g_free(gtkwin); |
4081 win->ui_data = NULL; | |
4082 } | |
4083 | |
4084 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4085 gaim_gtk_show(GaimConvWindow *win) |
4359 | 4086 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4087 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4088 |
4089 gtk_widget_show(gtkwin->window); | |
7413 | 4090 |
4091 #ifdef _WIN32 | |
7415 | 4092 /* This works around a win32 gtk+ bug, where it can't handle |
4093 * creating the button correctly before the window is shown. | |
4094 * That's why we get the appearance of a button, without all | |
4095 * the normal button-like properties, like being able to click | |
7413 | 4096 * it. ;-) --Nathan */ |
7414 | 4097 if (gaim_prefs_get_bool("/gaim/gtk/conversations/close_on_tabs")) { |
4098 GaimConversation *conv; | |
4099 GaimGtkConversation *gtkconv; | |
4100 | |
4101 conv = gaim_conv_window_get_conversation_at(win, 0); | |
4102 if(conv) { | |
4103 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7415 | 4104 gtk_widget_hide(gtkconv->close); |
7414 | 4105 gtk_widget_show_all(gtkconv->close); |
4106 } | |
4107 } | |
7413 | 4108 #endif |
4359 | 4109 } |
4110 | |
4111 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4112 gaim_gtk_hide(GaimConvWindow *win) |
4359 | 4113 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4114 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4115 |
4116 gtk_widget_hide(gtkwin->window); | |
4117 } | |
4118 | |
4119 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4120 gaim_gtk_raise(GaimConvWindow *win) |
4359 | 4121 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4122 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4123 |
5484 | 4124 gtk_widget_show(gtkwin->window); |
5103 | 4125 gtk_window_deiconify(GTK_WINDOW(gtkwin->window)); |
4526 | 4126 gdk_window_raise(gtkwin->window->window); |
4359 | 4127 } |
4128 | |
4129 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4130 gaim_gtk_flash(GaimConvWindow *win) |
4359 | 4131 { |
4132 #ifdef _WIN32 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4133 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4134 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4135 wgaim_conv_im_blink(gtkwin->window); |
4359 | 4136 #endif |
4137 } | |
4138 | |
4139 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4140 gaim_gtk_switch_conversation(GaimConvWindow *win, unsigned int index) |
4359 | 4141 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4142 GaimGtkWindow *gtkwin; |
4359 | 4143 |
4144 gtkwin = GAIM_GTK_WINDOW(win); | |
4145 | |
4146 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), index); | |
4147 } | |
4148 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4149 static const GtkTargetEntry te[] = |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4150 { |
7695 | 4151 {"text/plain", 0, 0}, |
4152 {"text/uri-list", 0, 1}, | |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4153 {"GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, 2}, |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4154 {"STRING", 0, 3}, |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4155 {"application/x-im-contact", 0, 4} |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4156 }; |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4157 |
4359 | 4158 static void |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4159 gaim_gtk_add_conversation(GaimConvWindow *win, GaimConversation *conv) |
4359 | 4160 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4161 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4162 GaimGtkConversation *gtkconv, *focus_gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4163 GaimConversation *focus_conv; |
4359 | 4164 GtkWidget *pane = NULL; |
4165 GtkWidget *tab_cont; | |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4166 GtkWidget *tabby, *menu_tabby; |
4359 | 4167 gboolean new_ui; |
4383
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4168 GaimConversationType conv_type; |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4169 const char *name; |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4170 |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4171 name = gaim_conversation_get_name(conv); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4172 conv_type = gaim_conversation_get_type(conv); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4173 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4174 |
4175 if (conv->ui_data != NULL) { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4176 gtkconv = (GaimGtkConversation *)conv->ui_data; |
4359 | 4177 |
4178 tab_cont = gtkconv->tab_cont; | |
4179 | |
4180 new_ui = FALSE; | |
4181 } | |
4182 else { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4183 gtkconv = g_malloc0(sizeof(GaimGtkConversation)); |
4359 | 4184 conv->ui_data = gtkconv; |
4185 | |
4186 /* Setup some initial variables. */ | |
4187 gtkconv->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
4188 gtkconv->tooltips = gtk_tooltips_new(); | |
4189 | |
4421 | 4190 /* Setup the foreground and background colors */ |
4191 gaim_gtkconv_update_font_colors(conv); | |
4192 | |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
4193 /* Setup the font face */ |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
4194 gaim_gtkconv_update_font_face(conv); |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
4195 |
7879 | 4196 if (conv_type == GAIM_CONV_IM) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4197 gtkconv->u.im = g_malloc0(sizeof(GaimGtkImPane)); |
4359 | 4198 gtkconv->u.im->a_virgin = TRUE; |
4199 | |
4200 pane = setup_im_pane(conv); | |
4201 } | |
7879 | 4202 else if (conv_type == GAIM_CONV_CHAT) { |
4203 gtkconv->u.chat = g_malloc0(sizeof(GaimGtkChatPane)); | |
4204 | |
4205 pane = setup_chat_pane(conv); | |
4206 } | |
4359 | 4207 |
4208 if (pane == NULL) { | |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4209 if (conv_type == GAIM_CONV_CHAT) g_free(gtkconv->u.chat); |
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4210 else if (conv_type == GAIM_CONV_IM) g_free(gtkconv->u.im); |
4359 | 4211 |
4212 g_free(gtkconv); | |
4213 conv->ui_data = NULL; | |
4214 | |
4215 return; | |
4216 } | |
4217 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4218 /* Setup drag-and-drop */ |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4219 gtk_drag_dest_set(pane, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4220 GTK_DEST_DEFAULT_MOTION | |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4221 GTK_DEST_DEFAULT_DROP, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4222 te, sizeof(te) / sizeof(GtkTargetEntry), |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4223 GDK_ACTION_COPY); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4224 gtk_drag_dest_set(gtkconv->imhtml, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4225 GTK_DEST_DEFAULT_MOTION | |
4702 | 4226 GTK_DEST_DEFAULT_DROP, |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4227 te, sizeof(te) / sizeof(GtkTargetEntry), |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4228 GDK_ACTION_DEFAULT | GDK_ACTION_COPY | |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4229 GDK_ACTION_MOVE); |
7695 | 4230 gtk_drag_dest_set(gtkconv->entry, |
4231 GTK_DEST_DEFAULT_MOTION | | |
4232 GTK_DEST_DEFAULT_DROP, | |
4233 te, sizeof(te) / sizeof(GtkTargetEntry), | |
4234 GDK_ACTION_COPY); | |
4235 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4236 g_signal_connect(G_OBJECT(pane), "drag_data_received", |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4237 G_CALLBACK(conv_dnd_recv), conv); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4238 g_signal_connect(G_OBJECT(gtkconv->imhtml), "drag_data_received", |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4239 G_CALLBACK(conv_dnd_recv), conv); |
8105 | 4240 #if 0 |
4241 g_signal_connect(G_OBJECT(gtkconv->entry), "drag_data_received", | |
4242 G_CALLBACK(conv_dnd_recv), conv); | |
4243 #endif | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4244 |
4359 | 4245 /* Setup the container for the tab. */ |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4246 gtkconv->tab_cont = tab_cont = gtk_vbox_new(FALSE, 6); |
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4247 gtk_container_set_border_width(GTK_CONTAINER(tab_cont), 6); |
4359 | 4248 gtk_container_add(GTK_CONTAINER(tab_cont), pane); |
4249 gtk_widget_show(pane); | |
4250 | |
4251 new_ui = TRUE; | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
4252 |
4359 | 4253 gtkconv->make_sound = TRUE; |
5902
6889b89cab90
[gaim-migrate @ 6334]
Christian Hammond <chipx86@chipx86.com>
parents:
5901
diff
changeset
|
4254 |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4255 gtkconv->show_formatting_toolbar = gaim_prefs_get_bool( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4256 "/gaim/gtk/conversations/show_formatting_toolbar"); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4257 |
8329
9dd7c75ed433
[gaim-migrate @ 9053]
Christian Hammond <chipx86@chipx86.com>
parents:
8319
diff
changeset
|
4258 if (gtkconv->show_formatting_toolbar) |
9dd7c75ed433
[gaim-migrate @ 9053]
Christian Hammond <chipx86@chipx86.com>
parents:
8319
diff
changeset
|
4259 gtk_widget_show(gtkconv->toolbar); |
9dd7c75ed433
[gaim-migrate @ 9053]
Christian Hammond <chipx86@chipx86.com>
parents:
8319
diff
changeset
|
4260 |
8176 | 4261 g_signal_connect_swapped(G_OBJECT(pane), "focus", |
4262 G_CALLBACK(gtk_widget_grab_focus), | |
4263 gtkconv->entry); | |
4359 | 4264 } |
4265 | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4266 gtkconv->tabby = tabby = gtk_hbox_new(FALSE, 6); |
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4267 gtkconv->menu_tabby = menu_tabby = gtk_hbox_new(FALSE, 6); |
4359 | 4268 |
4269 /* Close button. */ | |
4270 gtkconv->close = gtk_button_new(); | |
4271 gtk_widget_set_size_request(GTK_WIDGET(gtkconv->close), 16, 16); | |
7446
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4272 gtk_button_set_relief(GTK_BUTTON(gtkconv->close), GTK_RELIEF_NONE); |
4359 | 4273 gtk_container_add(GTK_CONTAINER(gtkconv->close), |
4445 | 4274 gtk_image_new_from_stock(GTK_STOCK_CLOSE, |
4275 GTK_ICON_SIZE_MENU)); | |
4359 | 4276 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->close, |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4277 _("Close conversation"), NULL); |
4359 | 4278 |
4279 g_signal_connect(G_OBJECT(gtkconv->close), "clicked", | |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4280 G_CALLBACK(close_conv_cb), conv); |
4359 | 4281 |
7446
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4282 /* |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4283 * I love Galeon. They have a fix for that stupid annoying visible |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4284 * border bug. I love you guys! -- ChipX86 |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4285 */ |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4286 g_signal_connect(G_OBJECT(gtkconv->close), "state_changed", |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4287 G_CALLBACK(tab_close_button_state_changed_cb), NULL); |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4288 |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4289 /* Status icon. */ |
6440 | 4290 gtkconv->icon = gtk_image_new(); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4291 gtkconv->menu_icon = gtk_image_new(); |
6440 | 4292 update_tab_icon(conv); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4293 |
4359 | 4294 /* Tab label. */ |
4295 gtkconv->tab_label = gtk_label_new(gaim_conversation_get_title(conv)); | |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4296 gtkconv->menu_label = gtk_label_new(gaim_conversation_get_title(conv)); |
4359 | 4297 #if 0 |
4298 gtk_misc_set_alignment(GTK_MISC(gtkconv->tab_label), 0.00, 0.5); | |
4299 gtk_misc_set_padding(GTK_MISC(gtkconv->tab_label), 4, 0); | |
4300 #endif | |
4301 | |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
4302 |
4359 | 4303 /* Pack it all together. */ |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4304 gtk_box_pack_start(GTK_BOX(tabby), gtkconv->icon, FALSE, FALSE, 0); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4305 gtk_box_pack_start(GTK_BOX(menu_tabby), gtkconv->menu_icon, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4306 FALSE, FALSE, 0); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4307 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4308 if (gaim_prefs_get_bool("/gaim/gtk/conversations/icons_on_tabs")) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4309 { |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4310 gtk_widget_show_all(gtkconv->icon); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4311 gtk_widget_show_all(gtkconv->menu_icon); |
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4312 } |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4313 |
4359 | 4314 gtk_box_pack_start(GTK_BOX(tabby), gtkconv->tab_label, TRUE, TRUE, 0); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4315 gtk_box_pack_start(GTK_BOX(menu_tabby), gtkconv->menu_label, TRUE, TRUE, 0); |
4445 | 4316 gtk_widget_show(gtkconv->tab_label); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4317 gtk_widget_show(gtkconv->menu_label); |
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4318 gtk_misc_set_alignment(GTK_MISC(gtkconv->menu_label), 0, 0); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4319 |
4445 | 4320 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
|
4321 if (gaim_prefs_get_bool("/gaim/gtk/conversations/close_on_tabs")) |
4445 | 4322 gtk_widget_show_all(gtkconv->close); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4323 |
4445 | 4324 gtk_widget_show(tabby); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4325 gtk_widget_show(menu_tabby); |
4359 | 4326 |
7143 | 4327 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
4328 gaim_gtkconv_update_buddy_icon(conv); | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4329 |
4359 | 4330 /* Add this pane to the conversations notebook. */ |
4331 gtk_notebook_append_page(GTK_NOTEBOOK(gtkwin->notebook), tab_cont, tabby); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4332 gtk_notebook_set_menu_label(GTK_NOTEBOOK(gtkwin->notebook), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4333 tab_cont, menu_tabby); |
4359 | 4334 |
4335 gtk_widget_show(tab_cont); | |
4336 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4337 if (gaim_conv_window_get_conversation_count(win) == 1) { |
4818 | 4338 /* Er, bug in notebooks? Switch to the page manually. */ |
4359 | 4339 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), 0); |
4851 | 4340 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4341 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4342 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4343 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4344 else |
4818 | 4345 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), TRUE); |
4359 | 4346 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4347 focus_conv = g_list_nth_data(gaim_conv_window_get_conversations(win), |
5204 | 4348 gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook))); |
4349 focus_gtkconv = GAIM_GTK_CONVERSATION(focus_conv); | |
4350 gtk_widget_grab_focus(focus_gtkconv->entry); | |
4359 | 4351 |
4352 if (!new_ui) | |
4353 g_object_unref(gtkconv->tab_cont); | |
4354 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4355 if (gaim_conv_window_get_conversation_count(win) == 1) |
4685 | 4356 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); |
4359 | 4357 } |
4358 | |
4359 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4360 gaim_gtk_remove_conversation(GaimConvWindow *win, GaimConversation *conv) |
4359 | 4361 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4362 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4363 GaimGtkConversation *gtkconv; |
4359 | 4364 unsigned int index; |
4818 | 4365 GaimConversationType conv_type; |
4366 | |
4367 conv_type = gaim_conversation_get_type(conv); | |
4359 | 4368 index = gaim_conversation_get_index(conv); |
4369 | |
4370 gtkwin = GAIM_GTK_WINDOW(win); | |
4371 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4372 | |
4373 g_object_ref(gtkconv->tab_cont); | |
4374 gtk_object_sink(GTK_OBJECT(gtkconv->tab_cont)); | |
4375 | |
4376 gtk_notebook_remove_page(GTK_NOTEBOOK(gtkwin->notebook), index); | |
4377 | |
4818 | 4378 /* go back to tabless if need be */ |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4379 if (gaim_conv_window_get_conversation_count(win) <= 2) { |
4818 | 4380 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4381 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); |
4818 | 4382 } |
4383 | |
4384 | |
4359 | 4385 /* If this window is setup with an inactive gc, regenerate the menu. */ |
4818 | 4386 if (conv_type == GAIM_CONV_IM && |
4359 | 4387 gaim_conversation_get_gc(conv) == NULL) { |
4388 | |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
4389 generate_send_as_items(win, conv); |
4359 | 4390 } |
4391 } | |
4392 | |
4393 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4394 gaim_gtk_move_conversation(GaimConvWindow *win, GaimConversation *conv, |
4359 | 4395 unsigned int new_index) |
4396 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4397 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4398 GaimGtkConversation *gtkconv; |
4359 | 4399 |
4400 gtkwin = GAIM_GTK_WINDOW(win); | |
4401 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4402 | |
4415
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4403 if (new_index > gaim_conversation_get_index(conv)) |
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4404 new_index--; |
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4405 |
4359 | 4406 gtk_notebook_reorder_child(GTK_NOTEBOOK(gtkwin->notebook), |
4407 gtkconv->tab_cont, new_index); | |
4408 } | |
4409 | |
4410 static int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4411 gaim_gtk_get_active_index(const GaimConvWindow *win) |
4359 | 4412 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4413 GaimGtkWindow *gtkwin; |
5680
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4414 int index; |
4359 | 4415 |
4416 gtkwin = GAIM_GTK_WINDOW(win); | |
4417 | |
5680
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4418 index = gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook)); |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4419 |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4420 /* |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4421 * A fix, because the first conversation may be active, but not |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4422 * appear in the notebook just yet. -- ChipX86 |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4423 */ |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4424 return (index == -1 ? 0 : index); |
4359 | 4425 } |
4426 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4427 static GaimConvWindowUiOps window_ui_ops = |
4359 | 4428 { |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
4429 gaim_gtk_conversations_get_conv_ui_ops, |
4359 | 4430 gaim_gtk_new_window, |
4431 gaim_gtk_destroy_window, | |
4432 gaim_gtk_show, | |
4433 gaim_gtk_hide, | |
4434 gaim_gtk_raise, | |
4435 gaim_gtk_flash, | |
4436 gaim_gtk_switch_conversation, | |
4437 gaim_gtk_add_conversation, | |
4438 gaim_gtk_remove_conversation, | |
4439 gaim_gtk_move_conversation, | |
4440 gaim_gtk_get_active_index | |
4441 }; | |
4442 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4443 GaimConvWindowUiOps * |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
4444 gaim_gtk_conversations_get_win_ui_ops(void) |
4359 | 4445 { |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4446 return &window_ui_ops; |
4359 | 4447 } |
4448 | |
4449 /************************************************************************** | |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4450 * Conversation UI operations |
4359 | 4451 **************************************************************************/ |
4452 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4453 gaim_gtkconv_destroy(GaimConversation *conv) |
4359 | 4454 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4455 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); |
4359 | 4456 |
4457 if (gtkconv->dialogs.log != NULL) | |
4458 gtk_widget_destroy(gtkconv->dialogs.log); | |
4459 | |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4460 gtk_widget_destroy(gtkconv->tab_cont); |
4892 | 4461 g_object_unref(gtkconv->tab_cont); |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4462 |
4359 | 4463 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
4755 | 4464 if (gtkconv->u.im->icon_timer != 0) |
4465 g_source_remove(gtkconv->u.im->icon_timer); | |
4466 | |
4359 | 4467 if (gtkconv->u.im->save_icon != NULL) |
4468 gtk_widget_destroy(gtkconv->u.im->save_icon); | |
4469 | |
4470 if (gtkconv->u.im->anim != NULL) | |
4793 | 4471 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); |
4359 | 4472 |
4473 g_free(gtkconv->u.im); | |
4474 } | |
4475 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
4476 g_free(gtkconv->u.chat); | |
4477 } | |
4478 | |
4633 | 4479 gtk_object_sink(GTK_OBJECT(gtkconv->tooltips)); |
4480 | |
4359 | 4481 g_free(gtkconv); |
4482 } | |
4483 | |
4484 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4485 gaim_gtkconv_write_im(GaimConversation *conv, const char *who, |
6982 | 4486 const char *message, GaimMessageFlags flags, |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4487 time_t mtime) |
4359 | 4488 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4489 GaimGtkConversation *gtkconv; |
8630 | 4490 GaimConvWindow *gaimwin; |
4491 GaimGtkWindow *gtkwin; | |
4492 gboolean has_focus; | |
4359 | 4493 |
4494 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
8630 | 4495 gaimwin = gaim_conversation_get_window(conv); |
4496 gtkwin = GAIM_GTK_WINDOW(gaimwin); | |
4497 | |
4498 g_object_get(G_OBJECT(gtkwin->window), "has-toplevel-focus", &has_focus, NULL); | |
4359 | 4499 |
6621 | 4500 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4501 gaim_prefs_get_bool("/gaim/gtk/conversations/im/raise_on_events")) { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4502 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4503 gaim_conv_window_raise(gaim_conversation_get_window(conv)); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4504 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4505 |
4382
76223649765b
[gaim-migrate @ 4648]
Christian Hammond <chipx86@chipx86.com>
parents:
4378
diff
changeset
|
4506 /* Play a sound, if specified in prefs. */ |
8630 | 4507 if (gtkconv->make_sound && !((gaim_conv_window_get_active_conversation(gaimwin) == conv) && |
8633 | 4508 !gaim_prefs_get_bool("/gaim/gtk/sound/conv_focus") && has_focus)) { |
6621 | 4509 if (flags & GAIM_MESSAGE_RECV) { |
4359 | 4510 if (gtkconv->u.im->a_virgin && |
5820 | 4511 gaim_prefs_get_bool("/gaim/gtk/sound/enabled/first_im_recv")) { |
4359 | 4512 |
4561 | 4513 gaim_sound_play_event(GAIM_SOUND_FIRST_RECEIVE); |
4359 | 4514 } |
4515 else | |
4561 | 4516 gaim_sound_play_event(GAIM_SOUND_RECEIVE); |
4359 | 4517 } |
4518 else { | |
4561 | 4519 gaim_sound_play_event(GAIM_SOUND_SEND); |
4359 | 4520 } |
4521 } | |
4522 | |
4523 gtkconv->u.im->a_virgin = FALSE; | |
4524 | |
6982 | 4525 gaim_conversation_write(conv, who, message, flags, mtime); |
4359 | 4526 } |
4527 | |
4528 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4529 gaim_gtkconv_write_chat(GaimConversation *conv, const char *who, |
6621 | 4530 const char *message, GaimMessageFlags flags, time_t mtime) |
4359 | 4531 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4532 GaimGtkConversation *gtkconv; |
8630 | 4533 GaimConvWindow *gaimwin; |
4534 GaimGtkWindow *gtkwin; | |
4535 gboolean has_focus; | |
4359 | 4536 |
4537 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
8630 | 4538 gaimwin = gaim_conversation_get_window(conv); |
4539 gtkwin = GAIM_GTK_WINDOW(gaimwin); | |
4540 | |
4541 g_object_get(G_OBJECT(gtkwin->window), "has-toplevel-focus", &has_focus, NULL); | |
4359 | 4542 |
4382
76223649765b
[gaim-migrate @ 4648]
Christian Hammond <chipx86@chipx86.com>
parents:
4378
diff
changeset
|
4543 /* Play a sound, if specified in prefs. */ |
8630 | 4544 if (gtkconv->make_sound && !((gaim_conv_window_get_active_conversation(gaimwin) == conv) && |
8633 | 4545 !gaim_prefs_get_bool("/gaim/gtk/sound/conv_focus") && has_focus)) { |
6621 | 4546 if (!(flags & GAIM_MESSAGE_WHISPER) && (flags & GAIM_MESSAGE_SEND)) |
4561 | 4547 gaim_sound_play_event(GAIM_SOUND_CHAT_YOU_SAY); |
6621 | 4548 else if (flags & GAIM_MESSAGE_RECV) { |
4549 if ((flags & GAIM_MESSAGE_NICK) && | |
8573 | 4550 gaim_prefs_get_bool("/gaim/gtk/sound/enabled/nick_said") && |
4551 !(flags & GAIM_MESSAGE_SYSTEM)) { | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4552 |
4561 | 4553 gaim_sound_play_event(GAIM_SOUND_CHAT_NICK); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4554 } |
4359 | 4555 else |
4561 | 4556 gaim_sound_play_event(GAIM_SOUND_CHAT_SAY); |
4359 | 4557 } |
4558 } | |
4559 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4560 if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/color_nicks")) |
6621 | 4561 flags |= GAIM_MESSAGE_COLORIZE; |
4359 | 4562 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4563 /* Raise the window, if specified in prefs. */ |
6621 | 4564 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4565 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4566 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4567 gaim_conv_window_raise(gaim_conversation_get_window(conv)); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4568 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4569 |
6982 | 4570 gaim_conversation_write(conv, who, message, flags, mtime); |
4359 | 4571 } |
4572 | |
4573 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4574 gaim_gtkconv_write_conv(GaimConversation *conv, const char *who, |
6982 | 4575 const char *message, GaimMessageFlags flags, |
4359 | 4576 time_t mtime) |
4577 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4578 GaimGtkConversation *gtkconv; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4579 GaimConvWindow *win; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
4580 GaimConnection *gc; |
4359 | 4581 int gtk_font_options = 0; |
6982 | 4582 GSList *images = NULL; |
7440 | 4583 char buf[BUF_LONG]; |
4359 | 4584 char buf2[BUF_LONG]; |
4585 char mdate[64]; | |
4586 char color[10]; | |
4587 char *str; | |
4588 char *with_font_tag; | |
4896 | 4589 char *sml_attrib = NULL; |
6982 | 4590 size_t length = strlen(message) + 1; |
4895 | 4591 |
4359 | 4592 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4593 gc = gaim_conversation_get_gc(conv); | |
4594 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4595 win = gaim_conversation_get_window(conv); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4596 |
6621 | 4597 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
7431 | 4598 ((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT && |
4599 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) || | |
4600 (gaim_conversation_get_type(conv) == GAIM_CONV_IM && | |
8897 | 4601 gaim_prefs_get_bool("/gaim/gtk/conversations/im/raise_on_events")))) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4602 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4603 gaim_conv_window_show(win); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4604 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4605 |
7078 | 4606 if (flags & GAIM_MESSAGE_IMAGES) |
4607 gaim_gtk_find_images(message, &images); | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4608 |
8677 | 4609 if (gtk_text_buffer_get_char_count(gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)))) |
4610 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", 0); | |
4611 | |
5133 | 4612 if(time(NULL) > mtime + 20*60) /* show date if older than 20 minutes */ |
4613 strftime(mdate, sizeof(mdate), "%Y-%m-%d %H:%M:%S", localtime(&mtime)); | |
4614 else | |
4615 strftime(mdate, sizeof(mdate), "%H:%M:%S", localtime(&mtime)); | |
4359 | 4616 |
4896 | 4617 if(gc) |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4618 sml_attrib = g_strdup_printf("sml=\"%s\"", gc->prpl->info->name); |
7440 | 4619 |
4359 | 4620 gtk_font_options ^= GTK_IMHTML_NO_COMMENTS; |
4621 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4622 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_colors")) |
4359 | 4623 gtk_font_options ^= GTK_IMHTML_NO_COLOURS; |
4624 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4625 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_fonts")) |
4359 | 4626 gtk_font_options ^= GTK_IMHTML_NO_FONTS; |
4627 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4628 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_font_sizes")) |
4359 | 4629 gtk_font_options ^= GTK_IMHTML_NO_SIZES; |
4630 | |
7956 | 4631 /* this is gonna crash one day, I can feel it. */ |
4632 if (GAIM_PLUGIN_PROTOCOL_INFO(gaim_find_prpl(gaim_account_get_protocol_id(conv->account)))->options & | |
7431 | 4633 OPT_PROTO_USE_POINTSIZE) { |
5367 | 4634 gtk_font_options ^= GTK_IMHTML_USE_POINTSIZE; |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4635 } |
4359 | 4636 |
6621 | 4637 if (flags & GAIM_MESSAGE_SYSTEM) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4638 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) |
8380 | 4639 g_snprintf(buf, BUF_LONG, "<FONT SIZE=\"2\">(%s)</FONT> <B>%s</B>", |
7431 | 4640 mdate, message); |
4359 | 4641 else |
4642 g_snprintf(buf, BUF_LONG, "<B>%s</B>", message); | |
7440 | 4643 |
4359 | 4644 g_snprintf(buf2, sizeof(buf2), |
8690 | 4645 "<FONT %s><FONT SIZE=\"2\"><!--(%s) --></FONT><B>%s</B></FONT>", |
7850 | 4646 sml_attrib, mdate, message); |
7440 | 4647 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4648 gtk_imhtml_append_text_with_images(GTK_IMHTML(gtkconv->imhtml), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4649 buf2, 0, images); |
7440 | 4650 |
7583 | 4651 /* Add the message to a conversations scrollback buffer */ |
4652 conv->history = g_string_append(conv->history, buf); | |
4653 conv->history = g_string_append(conv->history, "<BR>\n"); | |
7440 | 4654 |
8722 | 4655 } else if (flags & GAIM_MESSAGE_ERROR) { |
4656 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) | |
4657 g_snprintf(buf, BUF_LONG, "<FONT SIZE=\"2\">(%s)</FONT> <B>%s</B>", | |
4658 mdate, message); | |
4659 else | |
4660 g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"#ff0000\"><B>%s</B></FONT>", message); | |
4661 | |
4662 g_snprintf(buf2, sizeof(buf2), | |
4663 "<FONT %s><FONT SIZE=\"2\"><!--(%s) --></FONT><B>%s</B></FONT>", | |
4664 sml_attrib, mdate, message); | |
4665 | |
4666 gtk_imhtml_append_text_with_images(GTK_IMHTML(gtkconv->imhtml), | |
4667 buf2, 0, images); | |
4668 | |
4669 /* Add the message to a conversations scrollback buffer */ | |
4670 conv->history = g_string_append(conv->history, buf); | |
4671 conv->history = g_string_append(conv->history, "<BR>\n"); | |
7431 | 4672 } else if (flags & GAIM_MESSAGE_NO_LOG) { |
4359 | 4673 g_snprintf(buf, BUF_LONG, |
8690 | 4674 "<B><FONT %s COLOR=\"#777777\">%s</FONT></B>", |
7850 | 4675 sml_attrib, message); |
7440 | 4676 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4677 gtk_imhtml_append_text_with_images(GTK_IMHTML(gtkconv->imhtml), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4678 buf, 0, images); |
4359 | 4679 } |
4680 else { | |
4895 | 4681 char *new_message = g_memdup(message, length); |
8908 | 4682 char *who_escaped = g_markup_escape_text(who, strlen(who)); |
7440 | 4683 |
6621 | 4684 if (flags & GAIM_MESSAGE_WHISPER) { |
4359 | 4685 str = g_malloc(1024); |
7440 | 4686 |
4359 | 4687 /* If we're whispering, it's not an autoresponse. */ |
7564 | 4688 if (gaim_message_meify(new_message, length)) { |
8908 | 4689 g_snprintf(str, 1024, "***%s", who_escaped); |
4359 | 4690 strcpy(color, "#6C2585"); |
4691 } | |
4692 else { | |
8908 | 4693 g_snprintf(str, 1024, "*%s*:", who_escaped); |
4359 | 4694 strcpy(color, "#00FF00"); |
4695 } | |
7440 | 4696 } |
4359 | 4697 else { |
7564 | 4698 if (gaim_message_meify(new_message, length)) { |
4359 | 4699 str = g_malloc(1024); |
7440 | 4700 |
6621 | 4701 if (flags & GAIM_MESSAGE_AUTO_RESP) |
8908 | 4702 g_snprintf(str, 1024, "%s ***%s", AUTO_RESPONSE, who_escaped); |
4359 | 4703 else |
8908 | 4704 g_snprintf(str, 1024, "***%s", who_escaped); |
7440 | 4705 |
6621 | 4706 if (flags & GAIM_MESSAGE_NICK) |
4359 | 4707 strcpy(color, "#AF7F00"); |
4708 else | |
4709 strcpy(color, "#062585"); | |
4710 } | |
4711 else { | |
4712 str = g_malloc(1024); | |
6621 | 4713 if (flags & GAIM_MESSAGE_AUTO_RESP) |
8908 | 4714 g_snprintf(str, 1024, "%s %s", who_escaped, AUTO_RESPONSE); |
4359 | 4715 else |
8908 | 4716 g_snprintf(str, 1024, "%s:", who_escaped); |
6621 | 4717 if (flags & GAIM_MESSAGE_NICK) |
4359 | 4718 strcpy(color, "#AF7F00"); |
6621 | 4719 else if (flags & GAIM_MESSAGE_RECV) { |
4720 if (flags & GAIM_MESSAGE_COLORIZE) { | |
4359 | 4721 const char *u; |
4722 int m = 0; | |
7440 | 4723 |
4359 | 4724 for (u = who; *u != '\0'; u++) |
4725 m += *u; | |
7440 | 4726 |
4359 | 4727 m = m % NUM_NICK_COLORS; |
7440 | 4728 |
4359 | 4729 strcpy(color, nick_colors[m]); |
4730 } | |
4731 else | |
7854 | 4732 strcpy(color, RECV_COLOR); |
4359 | 4733 } |
6621 | 4734 else if (flags & GAIM_MESSAGE_SEND) |
7854 | 4735 strcpy(color, SEND_COLOR); |
4359 | 4736 } |
8908 | 4737 |
4738 if(who_escaped) | |
4739 g_free(who_escaped); | |
4359 | 4740 } |
7440 | 4741 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4742 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) |
4359 | 4743 g_snprintf(buf, BUF_LONG, |
8380 | 4744 "<FONT COLOR=\"%s\" %s><FONT SIZE=\"2\">(%s)</FONT> " |
7431 | 4745 "<B>%s</B></FONT> ", color, |
4746 sml_attrib ? sml_attrib : "", mdate, str); | |
4359 | 4747 else |
4748 g_snprintf(buf, BUF_LONG, | |
7431 | 4749 "<FONT COLOR=\"%s\" %s><B>%s</B></FONT> ", color, |
4750 sml_attrib ? sml_attrib : "", str); | |
7440 | 4751 |
4359 | 4752 g_snprintf(buf2, BUF_LONG, |
8380 | 4753 "<FONT COLOR=\"%s\" %s><FONT SIZE=\"2\"><!--(%s) --></FONT>" |
7431 | 4754 "<B>%s</B></FONT> ", |
4755 color, sml_attrib ? sml_attrib : "", mdate, str); | |
7440 | 4756 |
4359 | 4757 g_free(str); |
4758 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4759 gtk_imhtml_append_text_with_images(GTK_IMHTML(gtkconv->imhtml), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4760 buf2, 0, images); |
4359 | 4761 |
4895 | 4762 if(gc){ |
4896 | 4763 char *pre = g_strdup_printf("<font %s>", sml_attrib ? sml_attrib : ""); |
4895 | 4764 char *post = "</font>"; |
4765 int pre_len = strlen(pre); | |
4766 int post_len = strlen(post); | |
7440 | 4767 |
4895 | 4768 with_font_tag = g_malloc(length + pre_len + post_len + 1); |
7440 | 4769 |
4895 | 4770 strcpy(with_font_tag, pre); |
4771 memcpy(with_font_tag + pre_len, new_message, length); | |
4772 strcpy(with_font_tag + pre_len + length, post); | |
7440 | 4773 |
4895 | 4774 length += pre_len + post_len; |
4775 g_free(pre); | |
4776 } | |
4608 | 4777 else |
4895 | 4778 with_font_tag = g_memdup(new_message, length); |
7440 | 4779 |
7589 | 4780 gtk_imhtml_append_text_with_images(GTK_IMHTML(gtkconv->imhtml), |
7431 | 4781 with_font_tag, gtk_font_options, images); |
7440 | 4782 |
8557 | 4783 conv->history = g_string_append(conv->history, buf); |
4784 conv->history = g_string_append(conv->history, new_message); | |
4785 conv->history = g_string_append(conv->history, "<BR>\n"); | |
7440 | 4786 |
4787 g_free(with_font_tag); | |
7447 | 4788 g_free(new_message); |
7440 | 4789 } |
4790 | |
6062 | 4791 |
5012 | 4792 if(sml_attrib) |
4793 g_free(sml_attrib); | |
6982 | 4794 |
4795 if (images) { | |
7078 | 4796 GSList *tmp; |
4797 | |
4798 for (tmp = images; tmp; tmp = tmp->next) { | |
4799 GdkPixbuf *pixbuf = tmp->data; | |
4800 if(pixbuf) | |
4801 g_object_unref(pixbuf); | |
6982 | 4802 } |
7078 | 4803 |
6982 | 4804 g_slist_free(images); |
4805 } | |
4359 | 4806 } |
4807 | |
4808 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4809 gaim_gtkconv_chat_add_user(GaimConversation *conv, const char *user) |
4359 | 4810 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4811 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4812 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4813 GaimGtkChatPane *gtkchat; |
4359 | 4814 char tmp[BUF_LONG]; |
4815 int num_users; | |
4816 int pos; | |
4817 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4818 chat = GAIM_CONV_CHAT(conv); |
4359 | 4819 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4820 gtkchat = gtkconv->u.chat; | |
4821 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4822 num_users = g_list_length(gaim_conv_chat_get_users(chat)); |
4359 | 4823 |
4824 g_snprintf(tmp, sizeof(tmp), | |
4825 ngettext("%d person in room", "%d people in room", | |
4826 num_users), | |
4827 num_users); | |
4828 | |
4829 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); | |
4830 | |
4831 if (gtkconv->make_sound) | |
4561 | 4832 gaim_sound_play_event(GAIM_SOUND_CHAT_JOIN); |
4359 | 4833 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4834 pos = g_list_index(gaim_conv_chat_get_users(chat), user); |
4359 | 4835 |
4836 add_chat_buddy_common(conv, user, pos); | |
4837 } | |
4838 | |
4839 static void | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4840 gaim_gtkconv_chat_add_users(GaimConversation *conv, GList *users) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4841 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4842 GaimConvChat *chat; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4843 GaimGtkConversation *gtkconv; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4844 GaimGtkChatPane *gtkchat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4845 GList *l; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4846 char tmp[BUF_LONG]; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4847 int num_users; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4848 int pos; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4849 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4850 chat = GAIM_CONV_CHAT(conv); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4851 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4852 gtkchat = gtkconv->u.chat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4853 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4854 num_users = g_list_length(gaim_conv_chat_get_users(chat)); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4855 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4856 g_snprintf(tmp, sizeof(tmp), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4857 ngettext("%d person in room", "%d people in room", |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4858 num_users), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4859 num_users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4860 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4861 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4862 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4863 for (l = users; l != NULL; l = l->next) { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4864 pos = g_list_index(gaim_conv_chat_get_users(chat), (char *)l->data); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4865 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4866 add_chat_buddy_common(conv, (char *)l->data, pos); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4867 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4868 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4869 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4870 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4871 gaim_gtkconv_chat_rename_user(GaimConversation *conv, const char *old_name, |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4872 const char *new_name) |
4359 | 4873 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4874 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4875 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4876 GaimGtkChatPane *gtkchat; |
4359 | 4877 GtkTreeIter iter; |
4878 GtkTreeModel *model; | |
4879 GList *names; | |
4880 int pos; | |
4881 int f = 1; | |
4882 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4883 chat = GAIM_CONV_CHAT(conv); |
4359 | 4884 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4885 gtkchat = gtkconv->u.chat; | |
4886 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4887 for (names = gaim_conv_chat_get_users(chat); |
4359 | 4888 names != NULL; |
4889 names = names->next) { | |
4890 | |
4891 char *u = (char *)names->data; | |
4892 | |
4793 | 4893 if (!gaim_utf8_strcasecmp(u, old_name)) { |
4359 | 4894 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
4895 | |
4896 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
4897 break; | |
4898 | |
4899 while (f != 0) { | |
4900 char *val; | |
4901 | |
4902 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &val, -1); | |
4903 | |
4793 | 4904 if (!gaim_utf8_strcasecmp(old_name, val)) { |
4359 | 4905 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
4640 | 4906 break; |
4907 } | |
4359 | 4908 |
4909 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
4910 | |
4911 g_free(val); | |
4912 } | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
4913 |
4359 | 4914 break; |
4915 } | |
4916 } | |
4917 | |
4918 if (!names) | |
4919 return; | |
4920 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4921 pos = g_list_index(gaim_conv_chat_get_users(chat), new_name); |
4359 | 4922 |
4923 add_chat_buddy_common(conv, new_name, pos); | |
4924 } | |
4925 | |
4926 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4927 gaim_gtkconv_chat_remove_user(GaimConversation *conv, const char *user) |
4359 | 4928 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4929 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4930 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4931 GaimGtkChatPane *gtkchat; |
4359 | 4932 GtkTreeIter iter; |
4933 GtkTreeModel *model; | |
4934 GList *names; | |
4935 char tmp[BUF_LONG]; | |
4936 int num_users; | |
4937 int f = 1; | |
4938 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4939 chat = GAIM_CONV_CHAT(conv); |
4359 | 4940 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4941 gtkchat = gtkconv->u.chat; | |
4942 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4943 num_users = g_list_length(gaim_conv_chat_get_users(chat)) - 1; |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4944 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4945 for (names = gaim_conv_chat_get_users(chat); |
4359 | 4946 names != NULL; |
4947 names = names->next) { | |
4948 | |
4949 char *u = (char *)names->data; | |
4950 | |
4793 | 4951 if (!gaim_utf8_strcasecmp(u, user)) { |
4359 | 4952 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
4953 | |
4954 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
4955 break; | |
4956 | |
4957 while (f != 0) { | |
4958 char *val; | |
4959 | |
4960 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &val, -1); | |
4961 | |
4793 | 4962 if (!gaim_utf8_strcasecmp(user, val)) |
4359 | 4963 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
4964 | |
4965 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
4966 | |
4967 g_free(val); | |
4968 } | |
4969 | |
4970 break; | |
4971 } | |
4972 } | |
4973 | |
4974 if (names == NULL) | |
4975 return; | |
4976 | |
4977 g_snprintf(tmp, sizeof(tmp), | |
4978 ngettext("%d person in room", "%d people in room", | |
4979 num_users), num_users); | |
4980 | |
4981 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); | |
4982 | |
4983 if (gtkconv->make_sound) | |
4561 | 4984 gaim_sound_play_event(GAIM_SOUND_CHAT_LEAVE); |
4359 | 4985 } |
4986 | |
4987 static void | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4988 gaim_gtkconv_chat_remove_users(GaimConversation *conv, GList *users) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4989 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4990 GaimConvChat *chat; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4991 GaimGtkConversation *gtkconv; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4992 GaimGtkChatPane *gtkchat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4993 GtkTreeIter iter; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4994 GtkTreeModel *model; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4995 GList *names = NULL; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4996 GList *l; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4997 char tmp[BUF_LONG]; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4998 int num_users; |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
4999 gboolean f; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5000 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5001 chat = GAIM_CONV_CHAT(conv); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5002 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5003 gtkchat = gtkconv->u.chat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5004 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5005 num_users = g_list_length(gaim_conv_chat_get_users(chat)) - |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5006 g_list_length(users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5007 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5008 for (l = users; l != NULL; l = l->next) { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5009 for (names = gaim_conv_chat_get_users(chat); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5010 names != NULL; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5011 names = names->next) { |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5012 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5013 char *u = (char *)names->data; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5014 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5015 if (!gaim_utf8_strcasecmp(u, (char *)l->data)) { |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5016 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5017 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5018 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5019 &iter)) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5020 break; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5021 |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
5022 do { |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5023 char *val; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5024 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5025 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5026 1, &val, -1); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5027 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5028 if (!gaim_utf8_strcasecmp((char *)l->data, val)) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5029 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5030 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5031 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5032 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5033 g_free(val); |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
5034 } while (f); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
5035 |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5036 break; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5037 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5038 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5039 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5040 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5041 if (names == NULL) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5042 return; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5043 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5044 g_snprintf(tmp, sizeof(tmp), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5045 ngettext("%d person in room", "%d people in room", |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5046 num_users), num_users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5047 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5048 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5049 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5050 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5051 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5052 gaim_gtkconv_updated(GaimConversation *conv, GaimConvUpdateType type) |
4359 | 5053 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5054 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5055 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5056 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5057 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5058 GaimConvChat *chat; |
4359 | 5059 |
5060 win = gaim_conversation_get_window(conv); | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5061 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 5062 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5063 | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5064 if (type == GAIM_CONV_UPDATE_ACCOUNT) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5065 { |
4359 | 5066 gaim_conversation_autoset_title(conv); |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5067 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5068 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5069 gaim_gtkconv_update_buddy_icon(conv); |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5070 |
4359 | 5071 gaim_gtkconv_update_buttons_by_protocol(conv); |
5072 | |
4685 | 5073 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); |
4359 | 5074 |
5075 smiley_themeize(gtkconv->imhtml); | |
6394 | 5076 |
6395 | 5077 update_tab_icon(conv); |
4359 | 5078 } |
5079 else if (type == GAIM_CONV_UPDATE_TYPING || | |
8155
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5080 type == GAIM_CONV_UPDATE_UNSEEN || |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5081 type == GAIM_CONV_UPDATE_TITLE) |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5082 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5083 const char *title; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5084 GaimConvIm *im = NULL; |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5085 char color[8]; |
4736 | 5086 |
4359 | 5087 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5088 im = GAIM_CONV_IM(conv); |
4359 | 5089 |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5090 title = gaim_conversation_get_title(conv); |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5091 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5092 *color = '\0'; |
4359 | 5093 |
5094 if (!GTK_WIDGET_REALIZED(gtkconv->tab_label)) | |
5095 gtk_widget_realize(gtkconv->tab_label); | |
5096 | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5097 if (im != NULL && gaim_conv_im_get_typing_state(im) == GAIM_TYPING) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5098 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5099 strcpy(color, "#47A046"); |
4359 | 5100 } |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5101 else if (im != NULL && gaim_conv_im_get_typing_state(im) == GAIM_TYPED) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5102 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5103 strcpy(color, "#D1940C"); |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5104 } |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5105 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_NICK) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5106 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5107 strcpy(color, "#314E6C"); |
4359 | 5108 } |
8252 | 5109 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_TEXT) |
5110 { | |
5111 strcpy(color, "#DF421E"); | |
5112 } | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5113 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_EVENT) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5114 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5115 strcpy(color, "#868272"); |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5116 } |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5117 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5118 if (*color != '\0') |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5119 { |
8536 | 5120 char *html_title,*label; |
5121 | |
5122 html_title = gaim_escape_html(title); | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5123 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5124 label = g_strdup_printf("<span color=\"%s\">%s</span>", |
8536 | 5125 color, html_title); |
5126 g_free(html_title); | |
7995
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
5127 gtk_label_set_markup(GTK_LABEL(gtkconv->tab_label), label); |
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
5128 g_free(label); |
4359 | 5129 } |
7995
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
5130 else |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5131 gtk_label_set_text(GTK_LABEL(gtkconv->tab_label), title); |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5132 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5133 if (conv == gaim_conv_window_get_active_conversation(win)) |
4736 | 5134 update_typing_icon(conv); |
8155
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5135 |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5136 if (type == GAIM_CONV_UPDATE_TITLE) { |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5137 gtk_label_set_text(GTK_LABEL(gtkconv->menu_label), title); |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5138 if (conv == gaim_conv_window_get_active_conversation(win)) |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5139 gtk_window_set_title(GTK_WINDOW(gtkwin->window), title); |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5140 } |
4359 | 5141 } |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5142 else if (type == GAIM_CONV_UPDATE_TOPIC) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5143 { |
7154 | 5144 const char *topic; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5145 chat = GAIM_CONV_CHAT(conv); |
4359 | 5146 gtkchat = gtkconv->u.chat; |
5147 | |
7154 | 5148 topic = gaim_conv_chat_get_topic(chat); |
5149 | |
5150 gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text),topic); | |
5151 gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->topic_text, | |
8155
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5152 topic, NULL); |
4359 | 5153 } |
5154 else if (type == GAIM_CONV_ACCOUNT_ONLINE || | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5155 type == GAIM_CONV_ACCOUNT_OFFLINE) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5156 { |
7929 | 5157 gray_stuff_out(gaim_conv_window_get_active_conversation(win)); |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
5158 generate_send_as_items(win, NULL); |
6440 | 5159 if (gaim_prefs_get_bool("/gaim/gtk/conversations/icons_on_tabs")) |
5160 update_tab_icon(conv); | |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5161 } |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5162 else if (type == GAIM_CONV_UPDATE_AWAY) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5163 { |
6440 | 5164 if (gaim_prefs_get_bool("/gaim/gtk/conversations/icons_on_tabs")) |
5165 update_tab_icon(conv); | |
4359 | 5166 } |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
5167 else if (type == GAIM_CONV_UPDATE_ADD || type == GAIM_CONV_UPDATE_REMOVE || |
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
5168 type == GAIM_CONV_UPDATE_CHATLEFT) |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5169 { |
7929 | 5170 gray_stuff_out(conv); |
4397
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
5171 } |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5172 else if (type == GAIM_CONV_UPDATE_ICON) |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5173 { |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5174 gaim_gtkconv_update_buddy_icon(conv); |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5175 } |
4359 | 5176 } |
5177 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5178 static GaimConversationUiOps conversation_ui_ops = |
4359 | 5179 { |
5180 gaim_gtkconv_destroy, /* destroy_conversation */ | |
5181 gaim_gtkconv_write_chat, /* write_chat */ | |
5182 gaim_gtkconv_write_im, /* write_im */ | |
5183 gaim_gtkconv_write_conv, /* write_conv */ | |
5184 gaim_gtkconv_chat_add_user, /* chat_add_user */ | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5185 gaim_gtkconv_chat_add_users, /* chat_add_users */ |
4359 | 5186 gaim_gtkconv_chat_rename_user, /* chat_rename_user */ |
5187 gaim_gtkconv_chat_remove_user, /* chat_remove_user */ | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5188 gaim_gtkconv_chat_remove_users, /* chat_remove_users */ |
4359 | 5189 NULL, /* update_progress */ |
5190 gaim_gtkconv_updated /* updated */ | |
5191 }; | |
5192 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5193 GaimConversationUiOps * |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
5194 gaim_gtk_conversations_get_conv_ui_ops(void) |
4359 | 5195 { |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
5196 return &conversation_ui_ops; |
4359 | 5197 } |
5198 | |
5199 /************************************************************************** | |
5200 * Public conversation utility functions | |
5201 **************************************************************************/ | |
5202 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5203 gaim_gtkconv_update_buddy_icon(GaimConversation *conv) |
4359 | 5204 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5205 GaimGtkConversation *gtkconv; |
7143 | 5206 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); |
4359 | 5207 |
5208 char filename[256]; | |
5209 FILE *file; | |
5210 GError *err = NULL; | |
5211 | |
6695 | 5212 GaimBuddy *buddy; |
4757 | 5213 |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5214 const void *data; |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5215 size_t len; |
4359 | 5216 |
5217 GdkPixbuf *buf; | |
5218 | |
8821 | 5219 GtkWidget *vbox; |
4359 | 5220 GtkWidget *event; |
5221 GtkWidget *frame; | |
5222 GdkPixbuf *scale; | |
5223 GdkPixmap *pm; | |
5224 GdkBitmap *bm; | |
5225 int sf = 0; | |
5226 | |
8821 | 5227 GaimButtonStyle button_type; |
5228 | |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5229 g_return_if_fail(conv != NULL); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5230 g_return_if_fail(GAIM_IS_GTK_CONVERSATION(conv)); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5231 g_return_if_fail(gaim_conversation_get_type(conv) == GAIM_CONV_IM); |
4359 | 5232 |
5233 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5234 | |
5235 remove_icon(gtkconv); | |
5236 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5237 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/im/show_buddy_icons")) |
4359 | 5238 return; |
5239 | |
5240 if (gaim_conversation_get_gc(conv) == NULL) | |
5241 return; | |
5242 | |
8189 | 5243 if (gtkconv->u.im->anim) |
4793 | 5244 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); |
5245 | |
4757 | 5246 if((buddy = gaim_find_buddy(gaim_conversation_get_account(conv), |
5247 gaim_conversation_get_name(conv))) != NULL) { | |
8374 | 5248 const char *iconfile; |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
5249 if((iconfile = gaim_blist_node_get_string((GaimBlistNode*)buddy, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
5250 "buddy_icon"))) { |
8374 | 5251 GaimBuddyIcon *icon = gaim_conv_im_get_icon(GAIM_CONV_IM(conv)); |
5252 struct stat st; | |
5253 if ((icon == NULL) && (!stat(iconfile, &st))) { | |
5254 FILE *file = fopen(iconfile, "rb"); | |
5255 if (file) { | |
5256 char *data = g_malloc(st.st_size); | |
5257 fread(data, 1, st.st_size, file); | |
5258 fclose(file); | |
5259 gaim_buddy_icons_set_for_user(gaim_conversation_get_account(conv), gaim_conversation_get_name(conv), data, st.st_size); | |
5260 g_free(data); | |
5261 } | |
5262 return; | |
5263 } | |
5264 else | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
5265 gtkconv->u.im->anim = |
8496 | 5266 gdk_pixbuf_animation_new_from_file(iconfile, &err); /* LEAK */ |
8374 | 5267 } |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5268 } |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5269 else |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5270 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5271 GaimBuddyIcon *icon = gaim_conv_im_get_icon(GAIM_CONV_IM(conv)); |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5272 |
6877
1b5b0cea6915
[gaim-migrate @ 7423]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
5273 if (icon == NULL) |
1b5b0cea6915
[gaim-migrate @ 7423]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
5274 return; |
1b5b0cea6915
[gaim-migrate @ 7423]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
5275 |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5276 data = gaim_buddy_icon_get_data(icon, &len); |
4757 | 5277 |
5278 /* this is such an evil hack, i don't know why i'm even considering it. | |
5279 * we'll do it differently when gdk-pixbuf-loader isn't leaky anymore. */ | |
5280 g_snprintf(filename, sizeof(filename), | |
5281 "%s" G_DIR_SEPARATOR_S "gaimicon-%s.%d", | |
5282 g_get_tmp_dir(), gaim_conversation_get_name(conv), getpid()); | |
5283 | |
5284 if (!(file = fopen(filename, "wb"))) | |
5285 return; | |
5286 | |
5287 fwrite(data, 1, len, file); | |
5288 fclose(file); | |
5289 | |
5290 gtkconv->u.im->anim = gdk_pixbuf_animation_new_from_file(filename, &err); | |
5291 /* make sure we remove the file as soon as possible */ | |
5292 unlink(filename); | |
5293 } | |
4359 | 5294 |
5295 if (err) { | |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5296 gaim_debug(GAIM_DEBUG_ERROR, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5297 "Buddy icon error: %s\n", err->message); |
4359 | 5298 g_error_free(err); |
5299 } | |
5300 | |
5301 if (!gtkconv->u.im->anim) | |
5302 return; | |
5303 | |
4793 | 5304 if(gtkconv->u.im->iter) |
5305 g_object_unref(G_OBJECT(gtkconv->u.im->iter)); | |
5306 | |
4359 | 5307 if (gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim)) { |
5308 gtkconv->u.im->iter = NULL; | |
5309 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); | |
5310 } else { | |
5311 gtkconv->u.im->iter = | |
8496 | 5312 gdk_pixbuf_animation_get_iter(gtkconv->u.im->anim, NULL); /* LEAK */ |
4359 | 5313 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); |
8189 | 5314 if (gtkconv->u.im->animate) |
5315 start_anim(NULL, conv); | |
4359 | 5316 } |
5317 | |
5318 sf = SCALE(gtkconv->u.im->anim); | |
5319 scale = gdk_pixbuf_scale_simple(buf, | |
5320 MAX(gdk_pixbuf_get_width(buf) * sf / | |
5321 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), | |
5322 MAX(gdk_pixbuf_get_height(buf) * sf / | |
5323 gdk_pixbuf_animation_get_height(gtkconv->u.im->anim), 1), | |
5324 GDK_INTERP_NEAREST); | |
5325 | |
5326 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); | |
4793 | 5327 g_object_unref(G_OBJECT(scale)); |
4359 | 5328 |
8821 | 5329 |
5330 vbox = gtk_vbox_new(FALSE, 0); | |
5331 button_type = gaim_prefs_get_int("/gaim/gtk/conversations/im/button_type"); | |
5332 if(button_type == GAIM_BUTTON_NONE) { | |
5333 gtk_box_pack_start(GTK_BOX(gtkconv->entrybox), vbox, FALSE, FALSE, 0); | |
5334 gtk_box_reorder_child(GTK_BOX(gtkconv->entrybox), vbox, 0); | |
5335 } else { | |
5336 gtk_box_pack_start(GTK_BOX(gtkconv->bbox), vbox, FALSE, FALSE, 0); | |
5337 gtk_box_reorder_child(GTK_BOX(gtkconv->bbox), vbox, 0); | |
5338 } | |
5339 | |
4359 | 5340 frame = gtk_frame_new(NULL); |
5341 gtk_frame_set_shadow_type(GTK_FRAME(frame), | |
5342 (bm ? GTK_SHADOW_NONE : GTK_SHADOW_IN)); | |
8821 | 5343 gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); |
5344 | |
5345 | |
5346 gtk_widget_show(vbox); | |
4359 | 5347 gtk_widget_show(frame); |
5348 | |
5349 event = gtk_event_box_new(); | |
5350 gtk_container_add(GTK_CONTAINER(frame), event); | |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
5351 g_signal_connect(G_OBJECT(event), "button-press-event", |
4359 | 5352 G_CALLBACK(icon_menu), conv); |
5353 gtk_widget_show(event); | |
5354 | |
4635 | 5355 gtkconv->u.im->icon = gtk_image_new_from_pixmap(pm, bm); |
4359 | 5356 gtk_widget_set_size_request(gtkconv->u.im->icon, sf, sf); |
5357 gtk_container_add(GTK_CONTAINER(event), gtkconv->u.im->icon); | |
5358 gtk_widget_show(gtkconv->u.im->icon); | |
5359 | |
4793 | 5360 g_object_unref(G_OBJECT(pm)); |
4359 | 5361 |
5362 if (bm) | |
4793 | 5363 g_object_unref(G_OBJECT(bm)); |
7143 | 5364 |
5365 /* The buddy icon code needs badly to be fixed. */ | |
5366 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); | |
8068 | 5367 if(conv == gaim_conv_window_get_active_conversation(gaim_conversation_get_window(conv))) |
5368 gtk_window_set_icon(GTK_WINDOW(gtkwin->window), buf); | |
4359 | 5369 } |
5370 | |
5371 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5372 gaim_gtkconv_update_font_colors(GaimConversation *conv) |
4421 | 5373 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5374 GaimGtkConversation *gtkconv; |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
5375 |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5376 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5377 return; |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
5378 |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5379 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5380 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5381 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5382 >kconv->fg_color); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5383 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5384 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5385 >kconv->bg_color); |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5386 } |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5387 |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5388 void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5389 gaim_gtkconv_update_font_face(GaimConversation *conv) |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5390 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5391 GaimGtkConversation *gtkconv; |
6141 | 5392 |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5393 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5394 return; |
6141 | 5395 |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5396 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
5397 |
6141 | 5398 strncpy(gtkconv->fontface, |
5399 gaim_prefs_get_string("/gaim/gtk/conversations/font_face"), | |
5400 sizeof(gtkconv->fontface)); | |
4421 | 5401 } |
5402 | |
5403 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5404 gaim_gtkconv_update_buttons_by_protocol(GaimConversation *conv) |
4359 | 5405 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5406 GaimConvWindow *win; |
4359 | 5407 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5408 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
4359 | 5409 return; |
5410 | |
7887 | 5411 win = gaim_conversation_get_window(conv); |
5412 | |
5413 if (win != NULL && gaim_conv_window_get_active_conversation(win) == conv) | |
5414 gray_stuff_out(conv); | |
4359 | 5415 } |
5416 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5417 GaimConvWindow * |
4359 | 5418 gaim_gtkwin_get_at_xy(int x, int y) |
5419 { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5420 GaimConvWindow *win = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5421 GaimGtkWindow *gtkwin; |
4359 | 5422 GdkWindow *gdkwin; |
5423 GList *l; | |
5424 | |
5425 gdkwin = gdk_window_at_pointer(&x, &y); | |
5426 | |
5427 if (gdkwin) | |
5428 gdkwin = gdk_window_get_toplevel(gdkwin); | |
5429 | |
5430 for (l = gaim_get_windows(); l != NULL; l = l->next) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5431 win = (GaimConvWindow *)l->data; |
4359 | 5432 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5433 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5434 continue; |
5435 | |
5436 gtkwin = GAIM_GTK_WINDOW(win); | |
5437 | |
5438 if (gdkwin == gtkwin->window->window) | |
5439 return win; | |
5440 } | |
5441 | |
5442 return NULL; | |
5443 } | |
5444 | |
5445 int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5446 gaim_gtkconv_get_tab_at_xy(GaimConvWindow *win, int x, int y) |
4359 | 5447 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5448 GaimGtkWindow *gtkwin; |
4359 | 5449 GList *l; |
5450 gint nb_x, nb_y, x_rel, y_rel; | |
5451 GtkNotebook *notebook; | |
5452 GtkWidget *tab; | |
5453 gint i, page_num = 0; | |
5454 gboolean first_visible = TRUE; | |
5455 | |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5456 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5457 return -1; |
5458 | |
5459 gtkwin = GAIM_GTK_WINDOW(win); | |
5460 notebook = GTK_NOTEBOOK(gtkwin->notebook); | |
5461 | |
5462 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
5463 x_rel = x - nb_x; | |
5464 y_rel = y - nb_y; | |
5465 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5466 for (l = gaim_conv_window_get_conversations(win), i = 0; |
4359 | 5467 l != NULL; |
5468 l = l->next, i++) { | |
5469 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5470 GaimConversation *conv = l->data; |
4359 | 5471 tab = GAIM_GTK_CONVERSATION(conv)->tab_label; |
5472 | |
5473 if (!GTK_WIDGET_MAPPED(tab)) | |
5474 continue; | |
5475 | |
5476 if (first_visible) { | |
5477 first_visible = FALSE; | |
5478 | |
5479 if (x_rel < tab->allocation.x) x_rel = tab->allocation.x; | |
5480 if (y_rel < tab->allocation.y) y_rel = tab->allocation.y; | |
5481 } | |
5482 | |
5483 if (gtk_notebook_get_tab_pos(notebook) == GTK_POS_TOP || | |
5484 gtk_notebook_get_tab_pos(notebook) == GTK_POS_BOTTOM) { | |
5485 | |
5486 if (tab->allocation.x <= x_rel) { | |
5487 if (tab->allocation.x + tab->allocation.width <= x_rel) | |
5488 page_num = i + 1; | |
5489 else | |
5490 page_num = i; | |
5491 } | |
5492 else | |
5493 break; | |
5494 } | |
5495 else { | |
5496 if (tab->allocation.y <= y_rel) { | |
5497 if (tab->allocation.y + tab->allocation.height <= y_rel) | |
5498 page_num = i + 1; | |
5499 else | |
5500 page_num = i; | |
5501 } | |
5502 else | |
5503 break; | |
5504 } | |
5505 } | |
5506 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5507 if (i == gaim_conv_window_get_conversation_count(win) + 1) |
4359 | 5508 return -1; |
5509 | |
5510 return page_num; | |
5511 } | |
5512 | |
5513 int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5514 gaim_gtkconv_get_dest_tab_at_xy(GaimConvWindow *win, int x, int y) |
4359 | 5515 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5516 GaimGtkWindow *gtkwin; |
4359 | 5517 GList *l; |
5518 gint nb_x, nb_y, x_rel, y_rel; | |
5519 GtkNotebook *notebook; | |
5520 GtkWidget *tab; | |
5521 gint i, page_num = 0; | |
5522 | |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5523 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5524 return -1; |
5525 | |
5526 gtkwin = GAIM_GTK_WINDOW(win); | |
5527 notebook = GTK_NOTEBOOK(gtkwin->notebook); | |
5528 | |
5529 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
5530 x_rel = x - nb_x; | |
5531 y_rel = y - nb_y; | |
5532 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5533 for (l = gaim_conv_window_get_conversations(win), i = 0; |
4359 | 5534 l != NULL; |
5535 l = l->next, i++) { | |
5536 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5537 GaimConversation *conv = l->data; |
4359 | 5538 tab = GAIM_GTK_CONVERSATION(conv)->tab_label; |
5539 | |
5540 if (!GTK_WIDGET_MAPPED(tab)) | |
5541 continue; | |
5542 | |
5543 if (gtk_notebook_get_tab_pos(notebook) == GTK_POS_TOP || | |
5544 gtk_notebook_get_tab_pos(notebook) == GTK_POS_BOTTOM) { | |
5545 | |
5546 if (tab->allocation.x <= x_rel) { | |
5547 if (tab->allocation.x + (tab->allocation.width / 2) <= x_rel) | |
5548 page_num = i + 1; | |
5549 else | |
5550 page_num = i; | |
5551 } | |
5552 else | |
5553 break; | |
5554 } | |
5555 else { | |
5556 if (tab->allocation.y <= y_rel) { | |
5557 if (tab->allocation.y + (tab->allocation.height / 2) <= y_rel) | |
5558 page_num = i + 1; | |
5559 else | |
5560 page_num = i; | |
5561 } | |
5562 else | |
5563 break; | |
5564 } | |
5565 } | |
5566 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5567 if (i == gaim_conv_window_get_conversation_count(win) + 1) |
4359 | 5568 return -1; |
5569 | |
5570 return page_num; | |
5571 } | |
4940
3708545afe42
[gaim-migrate @ 5274]
Christian Hammond <chipx86@chipx86.com>
parents:
4939
diff
changeset
|
5572 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5573 static void |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5574 escape_closes_pref_cb(const char *name, GaimPrefType type, gpointer value, |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5575 gpointer data) |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5576 { |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5577 if (value) |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5578 gtk_accel_map_change_entry(N_("<main>/Conversation/Close"), |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5579 GDK_Escape, 0, TRUE); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5580 else |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5581 gtk_accel_map_change_entry(N_("<main>/Conversation/Close"), |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5582 GDK_W, GDK_CONTROL_MASK, TRUE); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5583 } |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5584 |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5585 static void |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5586 icons_on_tabs_pref_cb(const char *name, GaimPrefType type, gpointer value, |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5587 gpointer data) |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5588 { |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5589 GList *l; |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5590 GaimConversation *conv; |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5591 GaimGtkConversation *gtkconv; |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5592 |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5593 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5594 conv = (GaimConversation *)l->data; |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5595 |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5596 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5597 continue; |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5598 |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5599 gtkconv = GAIM_GTK_CONVERSATION(conv); |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5600 |
6440 | 5601 if (value) { |
5602 update_tab_icon(conv); | |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5603 gtk_widget_show(gtkconv->icon); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
5604 gtk_widget_show(gtkconv->menu_icon); |
6440 | 5605 } |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
5606 else { |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5607 gtk_widget_hide(gtkconv->icon); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
5608 gtk_widget_hide(gtkconv->menu_icon); |
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
5609 } |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5610 } |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5611 } |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5612 |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5613 static void |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5614 close_on_tabs_pref_cb(const char *name, GaimPrefType type, gpointer value, |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5615 gpointer data) |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5616 { |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5617 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5618 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5619 GaimGtkConversation *gtkconv; |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5620 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5621 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5622 conv = (GaimConversation *)l->data; |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5623 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5624 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5625 continue; |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5626 |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5627 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5628 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5629 if (value) |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5630 gtk_widget_show(gtkconv->close); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5631 else |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5632 gtk_widget_hide(gtkconv->close); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5633 } |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5634 } |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5635 |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5636 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5637 show_timestamps_pref_cb(const char *name, GaimPrefType type, gpointer value, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5638 gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5639 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5640 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5641 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5642 GaimGtkConversation *gtkconv; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5643 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5644 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5645 conv = (GaimConversation *)l->data; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5646 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5647 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5648 continue; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5649 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5650 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5651 |
7386 | 5652 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), (gboolean)GPOINTER_TO_INT(value)); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5653 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5654 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5655 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5656 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5657 spellcheck_pref_cb(const char *name, GaimPrefType type, gpointer value, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5658 gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5659 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5660 #ifdef USE_GTKSPELL |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5661 GList *cl; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5662 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5663 GaimGtkConversation *gtkconv; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5664 GtkSpell *spell; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5665 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5666 for (cl = gaim_get_conversations(); cl != NULL; cl = cl->next) { |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
5667 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5668 conv = (GaimConversation *)cl->data; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5669 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5670 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5671 continue; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5672 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5673 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5674 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5675 if (value) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
5676 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5677 else { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5678 spell = gtkspell_get_from_text_view(GTK_TEXT_VIEW(gtkconv->entry)); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5679 gtkspell_detach(spell); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5680 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5681 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5682 #endif |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5683 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5684 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5685 static void |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5686 tab_side_pref_cb(const char *name, GaimPrefType type, gpointer value, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5687 gpointer data) |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5688 { |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5689 GList *l; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5690 GtkPositionType pos; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5691 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5692 GaimGtkWindow *gtkwin; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5693 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5694 pos = GPOINTER_TO_INT(value); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5695 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5696 for (l = gaim_get_windows(); l != NULL; l = l->next) { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5697 win = (GaimConvWindow *)l->data; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5698 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5699 if (!GAIM_IS_GTK_WINDOW(win)) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5700 continue; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5701 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5702 gtkwin = GAIM_GTK_WINDOW(win); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5703 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5704 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5705 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5706 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5707 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5708 static void |
8456 | 5709 html_shortcuts_pref_cb(const char *name, GaimPrefType type, |
5710 gpointer value, gpointer data) | |
5711 { | |
5712 GList *l; | |
5713 GaimConversation *conv; | |
5714 GaimGtkConversation *gtkconv; | |
5715 | |
5716 for(l = gaim_get_conversations(); l != NULL; l = l->next) { | |
5717 conv = (GaimConversation *)l->data; | |
5718 | |
5719 if(!GAIM_IS_GTK_CONVERSATION(conv)) | |
5720 continue; | |
5721 | |
5722 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5723 | |
5724 gtk_imhtml_html_shortcuts(GTK_IMHTML(gtkconv->entry), | |
5725 (gboolean)GPOINTER_TO_INT(value)); | |
5726 } | |
5727 } | |
5728 | |
5729 static void | |
5730 smiley_shortcuts_pref_cb(const char *name, GaimPrefType type, | |
5731 gpointer value, gpointer data) | |
5732 { | |
5733 GList *l; | |
5734 GaimConversation *conv; | |
5735 GaimGtkConversation *gtkconv; | |
5736 | |
5737 for(l = gaim_get_conversations(); l != NULL; l = l->next) { | |
5738 conv = (GaimConversation *)l->data; | |
5739 | |
5740 if(!GAIM_IS_GTK_CONVERSATION(conv)) | |
5741 continue; | |
5742 | |
5743 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5744 | |
5745 gtk_imhtml_smiley_shortcuts(GTK_IMHTML(gtkconv->entry), | |
5746 (gboolean)GPOINTER_TO_INT(value)); | |
5747 } | |
5748 } | |
5749 | |
5750 static void | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5751 show_formatting_toolbar_pref_cb(const char *name, GaimPrefType type, |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5752 gpointer value, gpointer data) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5753 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5754 GList *l; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5755 GaimConversation *conv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5756 GaimGtkConversation *gtkconv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5757 GaimConvWindow *win; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5758 GaimGtkWindow *gtkwin; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5759 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5760 for (l = gaim_get_conversations(); l != NULL; l = l->next) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5761 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5762 conv = (GaimConversation *)l->data; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5763 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5764 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5765 continue; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5766 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5767 gtkconv = GAIM_GTK_CONVERSATION(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5768 win = gaim_conversation_get_window(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5769 gtkwin = GAIM_GTK_WINDOW(win); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5770 |
7386 | 5771 gtkconv->show_formatting_toolbar = (gboolean)GPOINTER_TO_INT(value); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5772 gtk_check_menu_item_set_active( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5773 GTK_CHECK_MENU_ITEM(gtkwin->menu.show_formatting_toolbar), |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5774 gtkconv->show_formatting_toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5775 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5776 if (gtkconv->show_formatting_toolbar) |
8317 | 5777 gtk_widget_show(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5778 else |
8317 | 5779 gtk_widget_hide(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5780 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5781 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5782 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5783 static void |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5784 im_button_type_pref_cb(const char *name, GaimPrefType type, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5785 gpointer value, gpointer data) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5786 { |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5787 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5788 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5789 GaimGtkConversation *gtkconv; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5790 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5791 for (l = gaim_get_ims(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5792 conv = (GaimConversation *)l->data; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5793 gtkconv = GAIM_GTK_CONVERSATION(conv); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5794 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5795 setup_im_buttons(conv, gtk_widget_get_parent(gtkconv->send)); |
8821 | 5796 gaim_gtkconv_update_buddy_icon(conv); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5797 } |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5798 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5799 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5800 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5801 animate_buddy_icons_pref_cb(const char *name, GaimPrefType type, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5802 gpointer value, gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5803 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5804 GList *l; |
8189 | 5805 GaimConversation *conv; |
5806 GaimGtkConversation *gtkconv; | |
5807 GaimConvWindow *win; | |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5808 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5809 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
|
5810 return; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5811 |
8189 | 5812 /* Set the "animate" flag for each icon based on the new preference */ |
5813 for (l = gaim_get_ims(); l != NULL; l = l->next) { | |
5814 conv = (GaimConversation *)l->data; | |
5815 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5816 gtkconv->u.im->animate = (gboolean)value; | |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5817 } |
8189 | 5818 |
5819 /* Now either stop or start animation for the active conversation in each window */ | |
5820 for (l = gaim_get_windows(); l != NULL; l = l->next) { | |
5821 win = (GaimConvWindow *)l->data; | |
5822 conv = gaim_conv_window_get_active_conversation(win); | |
5823 gaim_gtkconv_update_buddy_icon(conv); | |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5824 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5825 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5826 |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5827 static void |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5828 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
|
5829 gpointer data) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5830 { |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5831 GList *l; |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5832 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5833 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5834 GaimConversation *conv = l->data; |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5835 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5836 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5837 gaim_conversation_foreach(gaim_gtkconv_update_buddy_icon); |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5838 } |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5839 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5840 |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5680
diff
changeset
|
5841 static void |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
5842 chat_button_type_pref_cb(const char *name, GaimPrefType type, |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
5843 gpointer value, gpointer data) |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5844 { |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5845 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5846 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5847 GaimGtkConversation *gtkconv; |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
5848 |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
5849 for (l = gaim_get_chats(); l != NULL; l = l->next) { |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
5850 conv = (GaimConversation *)l->data; |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
5851 gtkconv = GAIM_GTK_CONVERSATION(conv); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
5852 |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
5853 setup_chat_buttons(conv, gtk_widget_get_parent(gtkconv->send)); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5854 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5855 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5856 |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5857 static void |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5858 conv_placement_pref_cb(const char *name, GaimPrefType type, |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5859 gpointer value, gpointer data) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5860 { |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5861 GaimConvPlacementFunc func; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5862 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5863 if (strcmp(name, "/gaim/gtk/conversations/placement")) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5864 return; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5865 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5866 func = gaim_conv_placement_get_fnc(value); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5867 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5868 if (func == NULL) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5869 return; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5870 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5871 gaim_conv_placement_set_current_func(func); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5872 } |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5873 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5874 void * |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5875 gaim_gtk_conversations_get_handle(void) |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5876 { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5877 static int handle; |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5878 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5879 return &handle; |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5880 } |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5881 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5882 void |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
5883 gaim_gtk_conversations_init(void) |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5884 { |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5885 void *handle = gaim_gtk_conversations_get_handle(); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5886 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5887 /* Conversations */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5888 gaim_prefs_add_none("/gaim/gtk/conversations"); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5889 gaim_prefs_add_bool("/gaim/gtk/conversations/icons_on_tabs", TRUE); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5890 gaim_prefs_add_bool("/gaim/gtk/conversations/close_on_tabs", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5891 gaim_prefs_add_bool("/gaim/gtk/conversations/ctrl_enter_sends", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5892 gaim_prefs_add_bool("/gaim/gtk/conversations/enter_sends", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5893 gaim_prefs_add_bool("/gaim/gtk/conversations/escape_closes", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5894 gaim_prefs_add_bool("/gaim/gtk/conversations/send_bold", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5895 gaim_prefs_add_bool("/gaim/gtk/conversations/send_italic", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5896 gaim_prefs_add_bool("/gaim/gtk/conversations/send_underline", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5897 gaim_prefs_add_bool("/gaim/gtk/conversations/show_timestamps", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5898 gaim_prefs_add_bool("/gaim/gtk/conversations/spellcheck", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5899 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_colors", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5900 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_fonts", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5901 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_font_sizes", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5902 gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_bgcolor", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5903 gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_fgcolor", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5904 gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_font", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5905 gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_size", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5906 gaim_prefs_add_bool("/gaim/gtk/conversations/html_shortcuts", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5907 gaim_prefs_add_bool("/gaim/gtk/conversations/smiley_shortcuts", FALSE); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5908 gaim_prefs_add_bool("/gaim/gtk/conversations/show_formatting_toolbar", TRUE); |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5909 gaim_prefs_add_string("/gaim/gtk/conversations/placement", "last"); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5910 gaim_prefs_add_string("/gaim/gtk/conversations/bgcolor", "#FFFFFF"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5911 gaim_prefs_add_string("/gaim/gtk/conversations/fgcolor", "#000000"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5912 gaim_prefs_add_string("/gaim/gtk/conversations/font_face", ""); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5913 gaim_prefs_add_int("/gaim/gtk/conversations/font_size", 3); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5914 gaim_prefs_add_bool("/gaim/gtk/conversations/tabs", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5915 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
|
5916 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5917 /* Conversations -> Chat */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5918 gaim_prefs_add_none("/gaim/gtk/conversations/chat"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5919 gaim_prefs_add_int("/gaim/gtk/conversations/chat/button_type", |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5920 GAIM_BUTTON_TEXT_IMAGE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5921 gaim_prefs_add_bool("/gaim/gtk/conversations/chat/color_nicks", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5922 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
|
5923 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
|
5924 gaim_prefs_add_bool("/gaim/gtk/conversations/chat/tab_completion", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5925 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_width", 410); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5926 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_height", 160); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5927 gaim_prefs_add_int("/gaim/gtk/conversations/chat/entry_height", 50); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5928 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5929 /* Conversations -> IM */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5930 gaim_prefs_add_none("/gaim/gtk/conversations/im"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5931 gaim_prefs_add_int("/gaim/gtk/conversations/im/button_type", |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5932 GAIM_BUTTON_TEXT_IMAGE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5933 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
|
5934 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
|
5935 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
|
5936 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_width", 410); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5937 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_height", 160); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5938 gaim_prefs_add_int("/gaim/gtk/conversations/im/entry_height", 50); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5939 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5940 /* Connect callbacks. */ |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5941 gaim_prefs_connect_callback("/gaim/gtk/conversations/escape_closes", |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5942 escape_closes_pref_cb, NULL); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5943 gaim_prefs_connect_callback("/gaim/gtk/conversations/icons_on_tabs", |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5944 icons_on_tabs_pref_cb, NULL); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5945 gaim_prefs_connect_callback("/gaim/gtk/conversations/close_on_tabs", |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5946 close_on_tabs_pref_cb, NULL); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5947 gaim_prefs_connect_callback("/gaim/gtk/conversations/show_timestamps", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5948 show_timestamps_pref_cb, NULL); |
8456 | 5949 gaim_prefs_connect_callback("/gaim/gtk/conversations/html_shortcuts", |
5950 html_shortcuts_pref_cb, NULL); | |
5951 gaim_prefs_connect_callback("/gaim/gtk/conversations/smiley_shortcuts", | |
5952 smiley_shortcuts_pref_cb, NULL); | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5953 gaim_prefs_connect_callback("/gaim/gtk/conversations/show_formatting_toolbar", |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5954 show_formatting_toolbar_pref_cb, NULL); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5955 gaim_prefs_connect_callback("/gaim/gtk/conversations/spellcheck", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5956 spellcheck_pref_cb, NULL); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5957 gaim_prefs_connect_callback("/gaim/gtk/conversations/tab_side", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5958 tab_side_pref_cb, NULL); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5959 |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5960 gaim_prefs_connect_callback("/gaim/gtk/conversations/placement", |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5961 conv_placement_pref_cb, NULL); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5962 gaim_prefs_trigger_callback("/gaim/gtk/conversations/placement"); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5963 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5964 |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
5965 |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5966 /* IM callbacks */ |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5967 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/button_type", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5968 im_button_type_pref_cb, NULL); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5969 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/animate_buddy_icons", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5970 animate_buddy_icons_pref_cb, NULL); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5971 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/show_buddy_icons", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5972 show_buddy_icons_pref_cb, NULL); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5973 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5974 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5975 /* Chat callbacks */ |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5976 gaim_prefs_connect_callback("/gaim/gtk/conversations/chat/button_type", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5977 chat_button_type_pref_cb, NULL); |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5978 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5979 /********************************************************************** |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5980 * Register signals |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5981 **********************************************************************/ |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5982 gaim_signal_register(handle, "conversation-drag-ended", |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5983 gaim_marshal_VOID__POINTER_POINTER, NULL, 2, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5984 gaim_value_new(GAIM_TYPE_SUBTYPE, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5985 GAIM_SUBTYPE_CONV_WINDOW), |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5986 gaim_value_new(GAIM_TYPE_SUBTYPE, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5987 GAIM_SUBTYPE_CONV_WINDOW)); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5988 } |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5989 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5990 void |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5991 gaim_gtk_conversations_uninit(void) |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5992 { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5993 gaim_signals_unregister_by_instance(gaim_gtk_conversations_get_handle()); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5994 } |