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