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