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