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