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