Mercurial > pidgin
annotate src/gtkconv.c @ 9301:3d5519a84d02
[gaim-migrate @ 10105]
Some stuff. Mostly from nosnilmot. Re-split the raise on events
preference for IMs and chats.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Thu, 17 Jun 2004 01:18:21 +0000 |
parents | 98f01c233a40 |
children | 8e1ddf5d81d0 |
rev | line source |
---|---|
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
1 /** |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
2 * @file gtkconv.h GTK+ Conversation API |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
3 * @ingroup gtkui |
4359 | 4 * |
8046 | 5 * Gaim is the legal property of its developers, whose names are too numerous |
6 * to list here. Please refer to the COPYRIGHT file distributed with this | |
7 * source distribution. | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
8 * |
4359 | 9 * This program is free software; you can redistribute it and/or modify |
10 * it under the terms of the GNU General Public License as published by | |
11 * the Free Software Foundation; either version 2 of the License, or | |
12 * (at your option) any later version. | |
13 * | |
14 * This program is distributed in the hope that it will be useful, | |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 * GNU General Public License for more details. | |
18 * | |
19 * You should have received a copy of the GNU General Public License | |
20 * along with this program; if not, write to the Free Software | |
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
22 * | |
23 */ | |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
24 #include "gtkinternal.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
25 |
4359 | 26 #ifndef _WIN32 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
27 # include <X11/Xlib.h> |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
28 #endif |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
29 |
4359 | 30 #ifdef USE_GTKSPELL |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
31 # include <gtkspell/gtkspell.h> |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
32 # ifdef _WIN32 |
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
33 # include "wspell.h" |
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
34 # endif |
4359 | 35 #endif |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
36 |
4359 | 37 #include <gdk/gdkkeysyms.h> |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
38 |
9130 | 39 #include "cmds.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
40 #include "debug.h" |
6982 | 41 #include "imgstore.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
42 #include "log.h" |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5402
diff
changeset
|
43 #include "notify.h" |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
44 #include "prefs.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
45 #include "prpl.h" |
6038 | 46 #include "request.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
47 #include "sound.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
48 #include "util.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
49 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
50 #include "dnd-hints.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
51 #include "gtkblist.h" |
5717 | 52 #include "gtkconv.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
53 #include "gtkimhtml.h" |
8317 | 54 #include "gtkimhtmltoolbar.h" |
7431 | 55 #include "gtklog.h" |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
56 #include "gtkpounce.h" |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
57 #include "gtkprivacy.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
58 #include "gtkutils.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
59 #include "stock.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
60 |
5717 | 61 #include "ui.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
62 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
63 /* XXX */ |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
64 #include "gaim.h" |
4359 | 65 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
66 #define AUTO_RESPONSE "<AUTO-REPLY> : " |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
67 |
7990 | 68 #define SEND_COLOR "#16569E" |
7855 | 69 #define RECV_COLOR "#A82F2F" |
7854 | 70 |
4359 | 71 static char nick_colors[][8] = { |
72 "#ba55d3", /* Medium Orchid */ | |
73 "#ee82ee", /* Violet */ | |
74 "#c715b4", /* Medium Violet Red */ | |
75 "#ff69b4", /* Hot Pink */ | |
76 "#ff6347", /* Tomato */ | |
77 "#fa8c00", /* Dark Orange */ | |
78 "#fa8072", /* Salmon */ | |
79 "#b22222", /* Fire Brick */ | |
80 "#f4a460", /* Sandy Brown */ | |
81 "#cd5c5c", /* Indian Red */ | |
82 "#bc8f8f", /* Rosy Brown */ | |
83 "#f0e68c", /* Khaki */ | |
84 "#bdb76b", /* Dark Khaki */ | |
85 "#228b22", /* Forest Green */ | |
86 "#9acd32", /* Yellow Green */ | |
87 "#32cd32", /* Lime Green */ | |
7755 | 88 "#3cb371", /* Medium Sea Green (Medium Sea Green?! What are we women?!) */ |
4359 | 89 "#2e8b57", /* Sea Green */ |
90 "#8fbc8f", /* Dark Sea Green */ | |
91 "#66cdaa", /* Medium Aquamarine */ | |
92 "#5f9ea0", /* Cadet Blue */ | |
93 "#48d1cc", /* Medium Turquoise */ | |
94 "#00ced1", /* Dark Turquoise */ | |
95 "#4682b4", /* Stell Blue */ | |
96 "#00bfff", /* Deep Sky Blue */ | |
97 "#1690ff", /* Dodger Blue */ | |
98 "#4169ff", /* Royal Blue */ | |
99 "#6a5acd", /* Slate Blue */ | |
100 "#6495ed", /* Cornflower Blue */ | |
101 "#708090", /* Slate gray */ | |
7995
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
102 "#2f4f4f", /* Dark Slate Gray */ |
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
103 "#ff8c00", /* Dark Orange */ |
8535 | 104 "#006400", /* DarkGreen */ |
105 "#8b4513", /* SaddleBrown */ | |
106 "#8b8989", /* snow4 */ | |
107 "#7d26cd", /* purple3 */ | |
4359 | 108 }; |
6291 | 109 |
4359 | 110 #define NUM_NICK_COLORS (sizeof(nick_colors) / sizeof(*nick_colors)) |
111 | |
112 #define SCALE(x) \ | |
113 ((gdk_pixbuf_animation_get_width(x) <= 48 && \ | |
114 gdk_pixbuf_animation_get_height(x) <= 48) ? 48 : 50) | |
115 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
116 typedef struct |
4359 | 117 { |
118 GtkWidget *window; | |
119 | |
120 GtkWidget *entry; | |
121 GtkWidget *message; | |
122 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
123 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
124 |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
125 } InviteBuddyInfo; |
4359 | 126 |
127 static GtkWidget *invite_dialog = NULL; | |
128 | |
129 /* Prototypes. <-- because Paco-Paco hates this comment. */ | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
130 static void got_typing_keypress(GaimConversation *conv, gboolean first); |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
131 static GList *generate_invite_user_names(GaimConnection *gc); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
132 static void add_chat_buddy_common(GaimConversation *conv, |
4359 | 133 const char *name, int pos); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
134 static void tab_complete(GaimConversation *conv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
135 static void update_typing_icon(GaimConversation *conv); |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
136 static gboolean update_send_as_selection(GaimConvWindow *win); |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
137 static char *item_factory_translate_func (const char *path, gpointer func_data); |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
138 static void save_convo(GtkWidget *save, GaimConversation *c); |
4359 | 139 |
140 /************************************************************************** | |
141 * Callbacks | |
142 **************************************************************************/ | |
143 static void | |
6038 | 144 do_save_convo(GtkWidget *wid) |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
145 { |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
146 GaimConversation *conv; |
8557 | 147 const char *name; |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
148 const char *filename; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
149 FILE *fp; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
150 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
151 conv = g_object_get_data(G_OBJECT(GTK_FILE_SELECTION(wid)->ok_button), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
152 "gaim_conversation"); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
153 |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
154 filename = gtk_file_selection_get_filename(GTK_FILE_SELECTION(wid)); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
155 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
156 if (!((gaim_conversation_get_type(conv) != GAIM_CONV_CHAT && |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
157 g_list_find(gaim_get_ims(), conv)) || |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
158 (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT && |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
159 g_list_find(gaim_get_chats(), conv)))) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
160 filename = NULL; |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
161 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
162 gtk_widget_destroy(wid); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
163 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
164 if (filename == NULL) |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
165 return; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
166 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
167 if ((fp = fopen(filename, "w+")) == NULL) |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
168 return; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
169 |
8557 | 170 name = gaim_conversation_get_name(conv); |
171 | |
172 fprintf(fp, _("<h1>Conversation with %s</h1>\n"), name); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
173 fprintf(fp, "%s", conv->history->str); |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
174 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
175 fclose(fp); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
176 } |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
177 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
178 static void |
6038 | 179 do_check_save_convo(GObject *obj, GtkWidget *wid) |
180 { | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
181 const char *filename; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
182 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
183 filename = gtk_file_selection_get_filename(GTK_FILE_SELECTION(wid)); |
6038 | 184 |
185 if (gaim_gtk_check_if_dir(filename, GTK_FILE_SELECTION(wid))) | |
186 return; | |
187 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
188 if (g_file_test(filename, G_FILE_TEST_EXISTS)) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
189 { |
6038 | 190 gaim_request_yes_no(NULL, NULL, _("That file already exists"), |
191 _("Would you like to overwrite it?"), 1, wid, | |
192 G_CALLBACK(do_save_convo), NULL); | |
193 } | |
194 else | |
195 do_save_convo(wid); | |
196 } | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6460
diff
changeset
|
197 |
4359 | 198 |
199 static gint | |
200 close_win_cb(GtkWidget *w, GdkEventAny *e, gpointer d) | |
201 { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
202 GaimConvWindow *win = (GaimConvWindow *)d; |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
203 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
204 gaim_conv_window_destroy(win); |
4361
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
205 |
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
206 return TRUE; |
4359 | 207 } |
208 | |
209 static gint | |
210 close_conv_cb(GtkWidget *w, gpointer d) | |
211 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
212 GaimConversation *conv = (GaimConversation *)d; |
4359 | 213 |
214 gaim_conversation_destroy(conv); | |
4361
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
215 |
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
216 return TRUE; |
4359 | 217 } |
218 | |
8914 | 219 static gboolean |
220 size_allocate_cb(GtkWidget *w, GtkAllocation *allocation, GaimConversation *conv) | |
221 { | |
222 GaimGtkConversation *gtkconv; | |
9048 | 223 GaimConvWindow *win = gaim_conversation_get_window(conv); |
8914 | 224 |
225 if (!GTK_WIDGET_VISIBLE(w)) | |
226 return FALSE; | |
227 | |
228 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
229 return FALSE; | |
230 | |
231 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
232 | |
9048 | 233 /* I find that I resize the window when it has a bunch of conversations in it, mostly so that the tab bar |
234 * will fit, but then I don't want new windows taking up the entire screen. I check to see if there is only one | |
235 * conversation in the window. This way we'll be setting new windows to the size of the last resized new window. */ | |
236 | |
8914 | 237 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
238 { | |
9048 | 239 if (w == gtkconv->sw && (gaim_conv_window_get_conversation_count(win) == 1)) |
8914 | 240 { |
241 gaim_prefs_set_int("/gaim/gtk/conversations/im/default_width", allocation->width); | |
242 gaim_prefs_set_int("/gaim/gtk/conversations/im/default_height", allocation->height); | |
243 } | |
244 if (w == gtkconv->entry) | |
245 gaim_prefs_set_int("/gaim/gtk/conversations/im/entry_height", allocation->height); | |
246 } | |
247 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
248 { | |
9048 | 249 if (w == gtkconv->sw && (gaim_conv_window_get_conversation_count(win) == 1)) |
8914 | 250 { |
251 gaim_prefs_set_int("/gaim/gtk/conversations/chat/default_width", allocation->width); | |
252 gaim_prefs_set_int("/gaim/gtk/conversations/chat/default_height", allocation->height); | |
253 } | |
254 if (w == gtkconv->entry) | |
255 gaim_prefs_set_int("/gaim/gtk/conversations/chat/entry_height", allocation->height); | |
256 } | |
257 | |
258 return FALSE; | |
259 } | |
260 | |
7446
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
261 /* Courtesy of Galeon! */ |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
262 static void |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
263 tab_close_button_state_changed_cb(GtkWidget *widget, GtkStateType prev_state) |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
264 { |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
265 if (GTK_WIDGET_STATE(widget) == GTK_STATE_ACTIVE) |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
266 gtk_widget_set_state(widget, GTK_STATE_NORMAL); |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
267 } |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
268 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
269 static void |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
270 default_formatize(GaimConversation *conv) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
271 { |
8061 | 272 GaimGtkConversation *c = GAIM_GTK_CONVERSATION(conv); |
273 GaimConnection *gc = gaim_conversation_get_gc(conv); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
274 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
275 if (gc && gc->flags & GAIM_CONNECTION_HTML) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
276 { |
9025 | 277 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_formatting")) |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
278 { |
9025 | 279 char *color; |
280 GdkColor fg_color, bg_color; | |
281 | |
282 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold")) | |
283 gtk_imhtml_toggle_bold(GTK_IMHTML(c->entry)); | |
284 | |
285 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic")) | |
286 gtk_imhtml_toggle_italic(GTK_IMHTML(c->entry)); | |
287 | |
288 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline")) | |
289 gtk_imhtml_toggle_underline(GTK_IMHTML(c->entry)); | |
290 | |
291 gtk_imhtml_toggle_fontface(GTK_IMHTML(c->entry), | |
292 gaim_prefs_get_string("/gaim/gtk/conversations/font_face")); | |
293 | |
294 if (!(gc->flags & GAIM_CONNECTION_NO_FONTSIZE)) | |
295 gtk_imhtml_font_set_size(GTK_IMHTML(c->entry), | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
296 gaim_prefs_get_int("/gaim/gtk/conversations/font_size")); |
9025 | 297 |
298 if(strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"), "") != 0) | |
299 { | |
300 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"), | |
301 &fg_color); | |
302 color = g_strdup_printf("#%02x%02x%02x", | |
303 fg_color.red / 256, | |
304 fg_color.green / 256, | |
305 fg_color.blue / 256); | |
306 } | |
307 else | |
308 color = g_strdup(""); | |
309 | |
8061 | 310 gtk_imhtml_toggle_forecolor(GTK_IMHTML(c->entry), color); |
311 g_free(color); | |
9025 | 312 |
313 if(!(gc->flags & GAIM_CONNECTION_NO_BGCOLOR) && | |
314 strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), "") != 0) | |
315 { | |
316 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), | |
317 &bg_color); | |
318 color = g_strdup_printf("#%02x%02x%02x", | |
319 bg_color.red / 256, | |
320 bg_color.green / 256, | |
321 bg_color.blue / 256); | |
322 } | |
323 else | |
324 color = g_strdup(""); | |
325 | |
8061 | 326 gtk_imhtml_toggle_backcolor(GTK_IMHTML(c->entry), color); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
327 g_free(color); |
8061 | 328 } |
8677 | 329 |
9025 | 330 |
8677 | 331 if (gc->flags & GAIM_CONNECTION_FORMATTING_WBFO) |
332 gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(c->entry), TRUE); | |
333 else | |
334 gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(c->entry), FALSE); | |
8061 | 335 } |
336 } | |
9130 | 337 |
338 static const char * | |
339 gaim_gtk_get_cmd_prefix(void) | |
340 { | |
341 return "/"; | |
342 } | |
343 | |
9167 | 344 static GaimCmdRet |
345 me_command_cb(GaimConversation *conv, | |
346 const char *cmd, char **args, char **error) | |
347 { | |
348 char *tmp; | |
349 | |
350 tmp = g_strdup_printf("/me %s", args[0]); | |
9175 | 351 |
9167 | 352 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
353 gaim_conv_im_send(GAIM_CONV_IM(conv), tmp); | |
354 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
355 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), tmp); | |
356 | |
357 g_free(tmp); | |
358 return GAIM_CMD_RET_OK; | |
359 } | |
360 | |
9212 | 361 static GaimCmdRet |
362 debug_command_cb(GaimConversation *conv, | |
363 const char *cmd, char **args, char **error) | |
364 { | |
365 char *tmp, *markup; | |
366 GaimCmdStatus status; | |
367 | |
368 if (!g_ascii_strcasecmp(args[0], "version")) { | |
369 tmp = g_strdup_printf(_("me is using Gaim v%s."), VERSION); | |
370 markup = gaim_escape_html(tmp); | |
371 | |
372 status = gaim_cmd_do_command(conv, tmp, markup, error); | |
373 | |
374 g_free(tmp); | |
375 g_free(markup); | |
376 return status; | |
377 } else { | |
378 gaim_conversation_write(conv, NULL, _("Supported debug options are: version"), | |
379 GAIM_MESSAGE_NO_LOG|GAIM_MESSAGE_ERROR, time(NULL)); | |
380 return GAIM_CMD_STATUS_OK; | |
381 } | |
382 } | |
383 | |
9213 | 384 static GaimCmdRet |
385 help_command_cb(GaimConversation *conv, | |
386 const char *cmd, char **args, char **error) | |
387 { | |
388 GString *s; | |
389 GList *cmds, *l; | |
390 | |
391 s = g_string_new(_("Use \"/help <command>\" for help on a specific command.\n" | |
392 "The following commands are available in this context:\n")); | |
393 | |
394 cmds = gaim_cmd_list(conv); | |
395 for (l = cmds; l; l = l->next) | |
396 if (l->next) | |
397 g_string_append_printf(s, "%s, ", (char *)l->data); | |
398 else | |
399 g_string_append_printf(s, "%s.", (char *)l->data); | |
400 | |
401 gaim_conversation_write(conv, NULL, s->str, GAIM_MESSAGE_NO_LOG, time(NULL)); | |
402 g_string_free(s, TRUE); | |
403 g_list_free(cmds); | |
404 | |
405 return GAIM_CMD_STATUS_OK; | |
406 } | |
407 | |
408 static GaimCmdRet | |
409 help_arg_command_cb(GaimConversation *conv, | |
410 const char *cmd, char **args, char **error) | |
411 { | |
412 GList *help, *l; | |
413 GString *s; | |
414 | |
415 s = g_string_new(""); | |
416 help = gaim_cmd_help(conv, args[0]); | |
417 | |
418 if (help) { | |
419 for (l = help; l; l = l->next) | |
420 if (l->next) | |
9247 | 421 g_string_append_printf(s, "/%s\n", (char *)l->data); |
9213 | 422 else |
9247 | 423 g_string_append_printf(s, "/%s", (char *)l->data); |
9213 | 424 } else { |
425 g_string_append(s, _("No such command (in this context).")); | |
426 } | |
427 | |
428 gaim_conversation_write(conv, NULL, s->str, GAIM_MESSAGE_NO_LOG, time(NULL)); | |
429 g_string_free(s, TRUE); | |
430 g_list_free(help); | |
431 | |
432 return GAIM_CMD_STATUS_OK; | |
433 } | |
434 | |
4359 | 435 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
436 send_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 437 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
438 GaimGtkConversation *gtkconv; |
9130 | 439 char *cmd; |
440 const char *prefix; | |
8655 | 441 GaimAccount *account; |
8677 | 442 GaimConnection *gc; |
8448 | 443 char *buf, *clean; |
4359 | 444 |
445 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
8655 | 446 account = gaim_conversation_get_account(conv); |
9130 | 447 prefix = gaim_gtk_get_cmd_prefix(); |
448 | |
449 if(gaim_prefs_get_bool("/gaim/gtk/conversations/enable_commands")) { | |
450 cmd = gtk_imhtml_get_text(GTK_IMHTML(gtkconv->entry), NULL, NULL); | |
451 if(cmd && (strncmp(cmd, prefix, strlen(prefix)) == 0)) { | |
452 GaimCmdStatus status; | |
9175 | 453 char *error, *cmdline, *markup; |
454 GtkTextIter start, end; | |
9130 | 455 |
456 cmdline = cmd + strlen(prefix); | |
9175 | 457 gtk_text_buffer_get_start_iter(GTK_IMHTML(gtkconv->entry)->text_buffer, &start); |
458 gtk_text_iter_forward_chars(&start, g_utf8_strlen(prefix, -1)); | |
459 gtk_text_buffer_get_end_iter(GTK_IMHTML(gtkconv->entry)->text_buffer, &end); | |
460 markup = gtk_imhtml_get_markup_range(GTK_IMHTML(gtkconv->entry), &start, &end); | |
461 status = gaim_cmd_do_command(conv, cmdline, markup, &error); | |
9130 | 462 g_free(cmd); |
9175 | 463 g_free(markup); |
9130 | 464 |
465 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); | |
466 default_formatize(conv); | |
467 | |
468 switch(status) { | |
469 case GAIM_CMD_STATUS_OK: | |
470 return; | |
471 case GAIM_CMD_STATUS_NOT_FOUND: | |
9212 | 472 gaim_conversation_write(conv, "", _("No such command. If you didn't mean " |
473 "to type a command, you can turn " | |
474 "commands off from Tools->" | |
475 "Preferences->Interface->Conversation" | |
476 "->Enable \"slash\" commands."), | |
9213 | 477 GAIM_MESSAGE_NO_LOG, time(NULL)); |
9130 | 478 return; |
479 case GAIM_CMD_STATUS_WRONG_ARGS: | |
9212 | 480 gaim_conversation_write(conv, "", _("Syntax Error: You typed the wrong number of arguments " |
481 "to that command. If you didn't mean to type a command, " | |
482 "you can turn commands off from Tools->Preferences->" | |
483 "Interface->Conversation->Enable \"slash\" commands."), | |
9213 | 484 GAIM_MESSAGE_NO_LOG, time(NULL)); |
9130 | 485 return; |
486 case GAIM_CMD_STATUS_FAILED: | |
9212 | 487 gaim_conversation_write(conv, "", error ? error : _("Your command failed for an unknown reason."), |
9213 | 488 GAIM_MESSAGE_NO_LOG, time(NULL)); |
9130 | 489 if(error) |
490 g_free(error); | |
491 return; | |
492 case GAIM_CMD_STATUS_WRONG_TYPE: | |
493 if(gaim_conversation_get_type(conv) == GAIM_CONV_IM) | |
494 gaim_conversation_write(conv, "", _("That command only works in Chats, not IMs."), | |
9213 | 495 GAIM_MESSAGE_NO_LOG, time(NULL)); |
9130 | 496 else |
497 gaim_conversation_write(conv, "", _("That command only works in IMs, not Chats."), | |
9213 | 498 GAIM_MESSAGE_NO_LOG, time(NULL)); |
9130 | 499 return; |
500 case GAIM_CMD_STATUS_WRONG_PRPL: | |
501 gaim_conversation_write(conv, "", _("That command doesn't work on this protocol."), | |
9213 | 502 GAIM_MESSAGE_NO_LOG, time(NULL)); |
9130 | 503 return; |
504 } | |
505 } | |
506 | |
507 g_free(cmd); | |
508 } | |
509 | |
8655 | 510 |
511 if (!gaim_account_is_connected(account)) | |
512 return; | |
8329
9dd7c75ed433
[gaim-migrate @ 9053]
Christian Hammond <chipx86@chipx86.com>
parents:
8319
diff
changeset
|
513 |
8442 | 514 buf = gtk_imhtml_get_markup(GTK_IMHTML(gtkconv->entry)); |
8962 | 515 clean = gtk_imhtml_get_text(GTK_IMHTML(gtkconv->entry), NULL, NULL); |
8448 | 516 |
4359 | 517 gtk_widget_grab_focus(gtkconv->entry); |
518 | |
8448 | 519 if (strlen(clean) == 0) { |
520 g_free(clean); | |
4359 | 521 return; |
522 } | |
523 | |
8677 | 524 gc = gaim_account_get_connection(account); |
525 if (gc && (gc->flags & GAIM_CONNECTION_NO_NEWLINES)) { | |
526 char **bufs; | |
527 int i; | |
528 | |
529 bufs = gtk_imhtml_get_markup_lines(GTK_IMHTML(gtkconv->entry)); | |
530 for (i = 0; bufs[i]; i++) { | |
531 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) | |
532 gaim_conv_im_send(GAIM_CONV_IM(conv), bufs[i]); | |
533 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
534 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), bufs[i]); | |
535 } | |
536 | |
537 g_strfreev(bufs); | |
538 | |
539 } else { | |
540 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) | |
541 gaim_conv_im_send(GAIM_CONV_IM(conv), buf); | |
542 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
543 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), buf); | |
544 } | |
4359 | 545 |
8677 | 546 g_free(clean); |
4359 | 547 g_free(buf); |
548 | |
8061 | 549 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); |
550 default_formatize(conv); | |
4359 | 551 } |
552 | |
553 static void | |
7928 | 554 add_remove_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 555 { |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
556 GaimAccount *account; |
4359 | 557 const char *name; |
558 | |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
559 account = gaim_conversation_get_account(conv); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
560 name = gaim_conversation_get_name(conv); |
7879 | 561 |
562 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
7859 | 563 GaimBuddy *b; |
564 | |
565 b = gaim_find_buddy(account, name); | |
566 if (b != NULL) | |
567 show_confirm_del(b); | |
568 else if (account != NULL && gaim_account_is_connected(account)) | |
569 gaim_blist_request_add_buddy(account, (char *)name, NULL, NULL); | |
7879 | 570 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
7859 | 571 GaimChat *c; |
572 | |
573 c = gaim_blist_find_chat(account, name); | |
574 if (c != NULL) | |
575 show_confirm_del_blist_chat(c); | |
576 else if (account != NULL && gaim_account_is_connected(account)) | |
577 gaim_blist_request_add_chat(account, NULL, NULL); | |
578 } | |
4359 | 579 |
580 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
581 } | |
582 | |
7975 | 583 static void chat_do_info(GaimConversation *conv, const char *who) |
584 { | |
585 GaimPluginProtocolInfo *prpl_info = NULL; | |
586 GaimConnection *gc; | |
587 | |
588 if ((gc = gaim_conversation_get_gc(conv))) { | |
589 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | |
590 | |
591 /* | |
592 * If there are special needs for getting info on users in | |
593 * buddy chat "rooms"... | |
594 */ | |
595 if (prpl_info->get_cb_info != NULL) | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
596 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
597 prpl_info->get_cb_info(gc, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
598 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
599 } |
7975 | 600 else |
601 prpl_info->get_info(gc, who); | |
602 } | |
603 } | |
604 | |
605 | |
4359 | 606 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
607 info_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 608 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
609 GaimGtkConversation *gtkconv; |
4359 | 610 |
611 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
612 | |
7879 | 613 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
614 serv_get_info(gaim_conversation_get_gc(conv), | |
615 gaim_conversation_get_name(conv)); | |
616 | |
617 gtk_widget_grab_focus(gtkconv->entry); | |
618 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
619 /* Get info of the person currently selected in the GtkTreeView */ | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
620 GaimGtkChatPane *gtkchat; |
4359 | 621 GtkTreeIter iter; |
622 GtkTreeModel *model; | |
623 GtkTreeSelection *sel; | |
624 const char *name; | |
625 | |
626 gtkchat = gtkconv->u.chat; | |
627 | |
628 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | |
629 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); | |
630 | |
631 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) | |
632 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &name, -1); | |
633 else | |
634 return; | |
635 | |
7975 | 636 chat_do_info(conv, name); |
4359 | 637 } |
638 } | |
639 | |
640 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
641 warn_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 642 { |
643 show_warn_dialog(gaim_conversation_get_gc(conv), | |
7879 | 644 gaim_conversation_get_name(conv)); |
4359 | 645 |
646 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
647 } | |
648 | |
649 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
650 block_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 651 { |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
652 GaimAccount *account; |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
653 |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
654 account = gaim_conversation_get_account(conv); |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
655 |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
656 if (account != NULL && gaim_account_is_connected(account)) |
6399
d726a36628e8
[gaim-migrate @ 6904]
Christian Hammond <chipx86@chipx86.com>
parents:
6398
diff
changeset
|
657 gaim_gtk_request_add_block(account, gaim_conversation_get_name(conv)); |
4359 | 658 |
659 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
660 } | |
661 | |
662 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
663 do_invite(GtkWidget *w, int resp, InviteBuddyInfo *info) |
4359 | 664 { |
665 const char *buddy, *message; | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
666 GaimGtkConversation *gtkconv; |
4359 | 667 |
668 gtkconv = GAIM_GTK_CONVERSATION(info->conv); | |
669 | |
670 if (resp == GTK_RESPONSE_OK) { | |
671 buddy = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(info->entry)->entry)); | |
672 message = gtk_entry_get_text(GTK_ENTRY(info->message)); | |
673 | |
4793 | 674 if (!g_ascii_strcasecmp(buddy, "")) { |
4359 | 675 g_free(info); |
676 | |
677 return; | |
678 } | |
679 | |
680 serv_chat_invite(gaim_conversation_get_gc(info->conv), | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
681 gaim_conv_chat_get_id(GAIM_CONV_CHAT(info->conv)), |
4359 | 682 message, buddy); |
683 } | |
684 | |
685 gtk_widget_destroy(invite_dialog); | |
686 invite_dialog = NULL; | |
687 | |
688 g_free(info); | |
689 } | |
690 | |
691 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
692 invite_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 693 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
694 InviteBuddyInfo *info = NULL; |
4359 | 695 |
696 if (invite_dialog == NULL) { | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
697 GaimConnection *gc; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
698 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
699 GaimGtkWindow *gtkwin; |
4359 | 700 GtkWidget *label; |
701 GtkWidget *vbox, *hbox; | |
702 GtkWidget *table; | |
703 GtkWidget *img; | |
704 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
705 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
706 GTK_ICON_SIZE_DIALOG); |
4359 | 707 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
708 info = g_new0(InviteBuddyInfo, 1); |
4359 | 709 info->conv = conv; |
710 | |
711 gc = gaim_conversation_get_gc(conv); | |
712 win = gaim_conversation_get_window(conv); | |
713 gtkwin = GAIM_GTK_WINDOW(win); | |
714 | |
715 /* Create the new dialog. */ | |
716 invite_dialog = gtk_dialog_new_with_buttons( | |
7859 | 717 _("Invite Buddy Into Chat Room"), |
7879 | 718 GTK_WINDOW(gtkwin->window), 0, |
719 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, | |
4359 | 720 GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); |
721 | |
722 gtk_dialog_set_default_response(GTK_DIALOG(invite_dialog), | |
723 GTK_RESPONSE_OK); | |
724 gtk_container_set_border_width(GTK_CONTAINER(invite_dialog), 6); | |
725 gtk_window_set_resizable(GTK_WINDOW(invite_dialog), FALSE); | |
726 gtk_dialog_set_has_separator(GTK_DIALOG(invite_dialog), FALSE); | |
727 | |
728 /* Setup the outside spacing. */ | |
729 vbox = GTK_DIALOG(invite_dialog)->vbox; | |
730 | |
731 gtk_box_set_spacing(GTK_BOX(vbox), 12); | |
732 gtk_container_set_border_width(GTK_CONTAINER(vbox), 6); | |
733 | |
734 /* Setup the inner hbox and put the dialog's icon in it. */ | |
735 hbox = gtk_hbox_new(FALSE, 12); | |
736 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
737 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
738 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
739 | |
740 /* Setup the right vbox. */ | |
741 vbox = gtk_vbox_new(FALSE, 0); | |
742 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
743 | |
744 /* Put our happy label in it. */ | |
745 label = gtk_label_new(_("Please enter the name of the user you wish " | |
746 "to invite, along with an optional invite " | |
747 "message.")); | |
748 gtk_widget_set_size_request(label, 350, -1); | |
749 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
750 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
751 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
752 | |
753 /* hbox for the table, and to give it some spacing on the left. */ | |
754 hbox = gtk_hbox_new(FALSE, 6); | |
755 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
756 | |
757 /* Setup the table we're going to use to lay stuff out. */ | |
758 table = gtk_table_new(2, 2, FALSE); | |
759 gtk_table_set_row_spacings(GTK_TABLE(table), 6); | |
760 gtk_table_set_col_spacings(GTK_TABLE(table), 6); | |
761 gtk_container_set_border_width(GTK_CONTAINER(table), 12); | |
762 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); | |
763 | |
764 /* Now the Buddy label */ | |
765 label = gtk_label_new(NULL); | |
766 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Buddy:")); | |
767 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
768 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); | |
769 | |
770 /* Now the Buddy drop-down entry field. */ | |
771 info->entry = gtk_combo_new(); | |
772 gtk_combo_set_case_sensitive(GTK_COMBO(info->entry), FALSE); | |
773 gtk_entry_set_activates_default( | |
774 GTK_ENTRY(GTK_COMBO(info->entry)->entry), TRUE); | |
775 | |
776 gtk_table_attach_defaults(GTK_TABLE(table), info->entry, 1, 2, 0, 1); | |
777 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->entry); | |
778 | |
779 /* Fill in the names. */ | |
780 gtk_combo_set_popdown_strings(GTK_COMBO(info->entry), | |
781 generate_invite_user_names(gc)); | |
782 | |
783 | |
784 /* Now the label for "Message" */ | |
785 label = gtk_label_new(NULL); | |
786 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Message:")); | |
787 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
788 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); | |
789 | |
790 | |
791 /* And finally, the Message entry field. */ | |
792 info->message = gtk_entry_new(); | |
793 gtk_entry_set_activates_default(GTK_ENTRY(info->message), TRUE); | |
794 | |
795 gtk_table_attach_defaults(GTK_TABLE(table), info->message, 1, 2, 1, 2); | |
796 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->message); | |
797 | |
798 /* Connect the signals. */ | |
799 g_signal_connect(G_OBJECT(invite_dialog), "response", | |
800 G_CALLBACK(do_invite), info); | |
801 } | |
802 | |
803 gtk_widget_show_all(invite_dialog); | |
804 | |
805 if (info != NULL) | |
806 gtk_widget_grab_focus(GTK_COMBO(info->entry)->entry); | |
807 } | |
808 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
809 static void |
7748 | 810 menu_new_conv_cb(gpointer data, guint action, GtkWidget *widget) |
811 { | |
812 show_im_dialog(); | |
813 } | |
814 | |
815 static void | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
816 menu_save_as_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
817 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
818 GaimConvWindow *win = (GaimConvWindow *)data; |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
819 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
820 save_convo(NULL, gaim_conv_window_get_active_conversation(win)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
821 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
822 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
823 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
824 menu_view_log_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
825 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
826 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
827 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
828 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
829 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
830 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
831 gaim_gtk_log_show((char *)gaim_conversation_get_name(conv), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
832 gaim_conversation_get_account(conv)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
833 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
834 |
8974 | 835 static void |
836 menu_clear_cb(gpointer data, guint action, GtkWidget *widget) | |
837 { | |
838 GaimConvWindow *win = (GaimConvWindow *)data; | |
839 GaimConversation *conv; | |
840 GaimGtkConversation *gtkconv; | |
841 | |
842 conv = gaim_conv_window_get_active_conversation(win); | |
843 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
844 | |
845 gtk_imhtml_clear(GTK_IMHTML(gtkconv->imhtml)); | |
846 g_string_free(conv->history, TRUE); | |
847 conv->history = g_string_new(""); | |
848 } | |
849 | |
7295 | 850 struct _search { |
851 GaimGtkConversation *gtkconv; | |
852 GtkWidget *entry; | |
853 }; | |
854 | |
7929 | 855 static void do_search_cb(GtkWidget *widget, gint resp, struct _search *s) |
7295 | 856 { |
7929 | 857 switch (resp) { |
858 case GTK_RESPONSE_OK: | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
859 gtk_imhtml_search_find(GTK_IMHTML(s->gtkconv->imhtml), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
860 gtk_entry_get_text(GTK_ENTRY(s->entry))); |
7929 | 861 break; |
862 | |
863 case GTK_RESPONSE_DELETE_EVENT: | |
864 case GTK_RESPONSE_CLOSE: | |
865 gtk_imhtml_search_clear(GTK_IMHTML(s->gtkconv->imhtml)); | |
866 gtk_widget_destroy(s->gtkconv->dialogs.search); | |
867 s->gtkconv->dialogs.search = NULL; | |
868 g_free(s); | |
869 break; | |
870 } | |
7295 | 871 } |
872 | |
873 static void | |
7751 | 874 menu_find_cb(gpointer data, guint action, GtkWidget *widget) |
7295 | 875 { |
876 GaimConvWindow *win = (GaimConvWindow *)data; | |
877 GaimConversation *conv = gaim_conv_window_get_active_conversation(win); | |
878 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); | |
879 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7929 | 880 GtkWidget *hbox; |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
881 GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
882 GTK_ICON_SIZE_DIALOG); |
7929 | 883 GtkWidget *label; |
7295 | 884 struct _search *s; |
885 | |
7798 | 886 if (gtkconv->dialogs.search) { |
887 gtk_window_present(GTK_WINDOW(gtkconv->dialogs.search)); | |
7295 | 888 return; |
7798 | 889 } |
7300
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
890 |
7295 | 891 s = g_malloc(sizeof(struct _search)); |
892 s->gtkconv = gtkconv; | |
7929 | 893 |
894 gtkconv->dialogs.search = gtk_dialog_new_with_buttons(_("Find"), | |
895 GTK_WINDOW(gtkwin->window), GTK_DIALOG_DESTROY_WITH_PARENT, | |
896 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, | |
897 GTK_STOCK_FIND, GTK_RESPONSE_OK, NULL); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
898 gtk_dialog_set_default_response(GTK_DIALOG(gtkconv->dialogs.search), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
899 GTK_RESPONSE_OK); |
7929 | 900 g_signal_connect(G_OBJECT(gtkconv->dialogs.search), "response", |
901 G_CALLBACK(do_search_cb), s); | |
902 | |
903 gtk_container_set_border_width(GTK_CONTAINER(gtkconv->dialogs.search), 6); | |
904 gtk_window_set_resizable(GTK_WINDOW(gtkconv->dialogs.search), FALSE); | |
905 gtk_dialog_set_has_separator(GTK_DIALOG(gtkconv->dialogs.search), FALSE); | |
906 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
|
907 gtk_container_set_border_width( |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
908 GTK_CONTAINER(GTK_DIALOG(gtkconv->dialogs.search)->vbox), 6); |
7929 | 909 |
910 hbox = gtk_hbox_new(FALSE, 12); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
911 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(gtkconv->dialogs.search)->vbox), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
912 hbox); |
7929 | 913 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); |
914 | |
915 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
916 gtk_dialog_set_response_sensitive(GTK_DIALOG(gtkconv->dialogs.search), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
917 GTK_RESPONSE_OK, FALSE); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
918 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
919 label = gtk_label_new(NULL); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
920 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Search for:")); |
7929 | 921 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
922 | |
923 s->entry = gtk_entry_new(); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
924 gtk_entry_set_activates_default(GTK_ENTRY(s->entry), TRUE); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
925 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(s->entry)); |
7929 | 926 g_signal_connect(G_OBJECT(s->entry), "changed", |
927 G_CALLBACK(gaim_gtk_set_sensitive_if_input), | |
928 gtkconv->dialogs.search); | |
929 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
|
930 |
7295 | 931 gtk_widget_show_all(gtkconv->dialogs.search); |
7929 | 932 gtk_widget_grab_focus(s->entry); |
7295 | 933 } |
934 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
935 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
936 menu_add_pounce_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
937 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
938 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
939 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
940 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
941 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
942 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
943 gaim_gtkpounce_dialog_show(gaim_conversation_get_account(conv), |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
944 gaim_conversation_get_name(conv), NULL); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
945 } |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
946 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
947 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
948 menu_insert_link_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
949 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
950 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
951 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
952 GaimGtkConversation *gtkconv; |
8756 | 953 GtkIMHtmlToolbar *toolbar; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
954 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
955 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
956 gtkconv = GAIM_GTK_CONVERSATION(conv); |
8756 | 957 toolbar = GTK_IMHTMLTOOLBAR(gtkconv->toolbar); |
958 | |
959 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->link), | |
960 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->link))); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
961 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
962 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
963 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
964 menu_insert_image_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
965 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
966 GaimConvWindow *win = (GaimConvWindow *)data; |
8756 | 967 GaimConversation *conv; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
968 GaimGtkConversation *gtkconv; |
8756 | 969 GtkIMHtmlToolbar *toolbar; |
970 | |
971 conv = gaim_conv_window_get_active_conversation(win); | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
972 gtkconv = GAIM_GTK_CONVERSATION(gaim_conv_window_get_active_conversation(win)); |
8756 | 973 toolbar = GTK_IMHTMLTOOLBAR(gtkconv->toolbar); |
974 | |
975 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->image), | |
976 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->image))); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
977 } |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
978 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
979 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
980 menu_alias_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
981 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
982 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
983 GaimConversation *conv; |
7879 | 984 GaimAccount *account; |
985 const char *name; | |
986 | |
987 conv = gaim_conv_window_get_active_conversation(win); | |
988 account = gaim_conversation_get_account(conv); | |
989 name = gaim_conversation_get_name(conv); | |
990 | |
991 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
992 GaimBuddy *b; | |
993 | |
994 b = gaim_find_buddy(account, name); | |
995 if (b != NULL) | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
996 alias_dialog_bud(b); |
7879 | 997 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
998 GaimChat *c; | |
999 | |
1000 c = gaim_blist_find_chat(account, name); | |
1001 if (c != NULL) | |
1002 alias_dialog_blist_chat(c); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1003 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1004 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1005 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1006 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1007 menu_get_info_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1008 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1009 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1010 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1011 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1012 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1013 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1014 info_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1015 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1016 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1017 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1018 menu_invite_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1019 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1020 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1021 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1022 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1023 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1024 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1025 invite_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1026 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1027 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1028 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1029 menu_warn_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1030 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1031 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1032 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1033 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1034 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1035 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1036 warn_cb(NULL, conv); |
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 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1039 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1040 menu_block_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1041 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1042 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1043 GaimConversation *conv; |
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 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1046 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1047 block_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1048 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1049 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1050 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1051 menu_add_remove_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1052 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1053 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1054 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1055 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1056 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1057 |
7928 | 1058 add_remove_cb(NULL, conv); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1059 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1060 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1061 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1062 menu_close_conv_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1063 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1064 GaimConvWindow *win = (GaimConvWindow *)data; |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1065 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1066 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
|
1067 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1068 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1069 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1070 menu_logging_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1071 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1072 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1073 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1074 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1075 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1076 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1077 if (conv == NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1078 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1079 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1080 gaim_conversation_set_logging(conv, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1081 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1082 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1083 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1084 static void |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1085 menu_toolbar_cb(gpointer data, guint action, GtkWidget *widget) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1086 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1087 GaimConvWindow *win = (GaimConvWindow *)data; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1088 GaimConversation *conv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1089 GaimGtkConversation *gtkconv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1090 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1091 conv = gaim_conv_window_get_active_conversation(win); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1092 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1093 if (conv == NULL) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1094 return; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1095 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1096 gtkconv = GAIM_GTK_CONVERSATION(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1097 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1098 gtkconv->show_formatting_toolbar = |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1099 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1100 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1101 if (gtkconv->show_formatting_toolbar) |
8317 | 1102 gtk_widget_show(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1103 else |
8317 | 1104 gtk_widget_hide(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1105 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1106 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1107 static void |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1108 menu_sounds_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1109 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1110 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1111 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1112 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1113 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1114 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1115 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1116 if (!conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1117 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1118 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1119 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1120 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1121 gtkconv->make_sound = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1122 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1123 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1124 |
7961 | 1125 static void |
9188 | 1126 menu_timestamps_cb(gpointer data, guint action, GtkWidget *widget) |
1127 { | |
1128 GaimConvWindow *win = (GaimConvWindow *)data; | |
1129 GaimConversation *conv; | |
1130 GaimGtkConversation *gtkconv; | |
1131 | |
1132 conv = gaim_conv_window_get_active_conversation(win); | |
1133 | |
1134 if (!conv) | |
1135 return; | |
1136 | |
1137 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1138 | |
1139 gtkconv->show_timestamps = | |
1140 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); | |
1141 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
1142 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))); | |
1143 } | |
1144 | |
1145 static void | |
7961 | 1146 chat_do_im(GaimConversation *conv, const char *who) |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1147 { |
7961 | 1148 GaimPluginProtocolInfo *prpl_info = NULL; |
1149 char *real_who; | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1150 GaimConversation *conv2; |
7961 | 1151 GaimAccount *account; |
1152 | |
1153 account = gaim_conversation_get_account(conv); | |
1154 | |
1155 if(account && account->gc) | |
1156 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl); | |
1157 | |
1158 if(prpl_info && prpl_info->get_cb_real_name) | |
1159 real_who = prpl_info->get_cb_real_name(account->gc, | |
1160 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); | |
1161 else | |
1162 real_who = g_strdup(who); | |
1163 | |
1164 if(!real_who) | |
1165 return; | |
1166 | |
1167 conv2 = gaim_find_conversation_with_account(real_who, account); | |
1168 | |
1169 if (conv2 != NULL) | |
1170 gaim_conv_window_show(gaim_conversation_get_window(conv2)); | |
1171 else | |
1172 conv2 = gaim_conversation_new(GAIM_CONV_IM, account, real_who); | |
1173 | |
1174 g_free(real_who); | |
1175 } | |
1176 | |
1177 | |
1178 static void | |
1179 chat_im_button_cb(GtkWidget *widget, GaimConversation *conv) | |
1180 { | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1181 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1182 GaimGtkChatPane *gtkchat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1183 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1184 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1185 GtkTreeSelection *sel; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1186 const char *name; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1187 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1188 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1189 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1190 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1191 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1192 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1193 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1194 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1195 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &name, -1); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1196 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1197 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1198 |
7961 | 1199 chat_do_im(conv, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1200 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1201 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1202 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1203 ignore_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1204 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1205 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1206 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1207 GaimConvChat *chat; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1208 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1209 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1210 GtkTreeSelection *sel; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1211 const char *name; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1212 int pos; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1213 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1214 chat = GAIM_CONV_CHAT(conv); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1215 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1216 gtkchat = gtkconv->u.chat; |
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 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1219 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1220 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1221 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1222 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &name, -1); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1223 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1224 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1225 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1226 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1227 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1228 pos = g_list_index(gaim_conv_chat_get_users(chat), name); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1229 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1230 if (gaim_conv_chat_is_user_ignored(chat, name)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1231 gaim_conv_chat_unignore(chat, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1232 else |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1233 gaim_conv_chat_ignore(chat, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1234 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1235 add_chat_buddy_common(conv, name, pos); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1236 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1237 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1238 static void |
7398 | 1239 menu_chat_im_cb(GtkWidget *w, GaimConversation *conv) |
1240 { | |
1241 const char *who = g_object_get_data(G_OBJECT(w), "user_data"); | |
1242 | |
1243 chat_do_im(conv, who); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1244 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1245 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1246 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1247 menu_chat_info_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1248 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1249 char *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1250 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1251 who = g_object_get_data(G_OBJECT(w), "user_data"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1252 |
7975 | 1253 chat_do_info(conv, who); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1254 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1255 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1256 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1257 menu_chat_get_away_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1258 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1259 GaimPluginProtocolInfo *prpl_info = NULL; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1260 GaimConnection *gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1261 char *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1262 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1263 gc = gaim_conversation_get_gc(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1264 who = g_object_get_data(G_OBJECT(w), "user_data"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1265 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1266 if (gc != NULL) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1267 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1268 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1269 /* |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1270 * 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
|
1271 */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1272 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1273 if (prpl_info->get_cb_away != NULL) |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1274 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1275 prpl_info->get_cb_away(gc, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1276 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1277 } |
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 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1280 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1281 static void |
7928 | 1282 menu_chat_add_remove_cb(GtkWidget *w, GaimConversation *conv) |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1283 { |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1284 GaimAccount *account; |
6695 | 1285 GaimBuddy *b; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1286 char *name; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1287 |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1288 account = gaim_conversation_get_account(conv); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1289 name = g_object_get_data(G_OBJECT(w), "user_data"); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1290 b = gaim_find_buddy(account, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1291 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1292 if (b != NULL) |
5975 | 1293 show_confirm_del(b); |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1294 else if (account != NULL && gaim_account_is_connected(account)) |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1295 gaim_blist_request_add_buddy(account, name, NULL, NULL); |
5908
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 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1298 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1299 |
8143 | 1300 static GtkWidget * |
1301 create_chat_menu(GaimConversation *conv, gchar *who, | |
1302 GaimPluginProtocolInfo *prpl_info, GaimConnection *gc) | |
1303 { | |
1304 static GtkWidget *menu = NULL; | |
1305 GtkWidget *button; | |
1306 | |
1307 /* | |
1308 * If a menu already exists, destroy it before creating a new one, | |
1309 * thus freeing-up the memory it occupied. | |
1310 */ | |
1311 if (menu) | |
1312 gtk_widget_destroy(menu); | |
1313 | |
1314 menu = gtk_menu_new(); | |
1315 | |
1316 button = gtk_menu_item_new_with_label(_("IM")); | |
1317 g_signal_connect(G_OBJECT(button), "activate", | |
1318 G_CALLBACK(menu_chat_im_cb), conv); | |
1319 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1320 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1321 gtk_widget_show(button); | |
1322 | |
1323 if (gaim_conv_chat_is_user_ignored(GAIM_CONV_CHAT(conv), who)) | |
1324 button = gtk_menu_item_new_with_label(_("Un-Ignore")); | |
1325 else | |
1326 button = gtk_menu_item_new_with_label(_("Ignore")); | |
1327 | |
1328 g_signal_connect(G_OBJECT(button), "activate", | |
1329 G_CALLBACK(ignore_cb), conv); | |
1330 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1331 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1332 gtk_widget_show(button); | |
1333 | |
8170 | 1334 if (gc && (prpl_info->get_info || prpl_info->get_cb_info)) { |
8143 | 1335 button = gtk_menu_item_new_with_label(_("Info")); |
1336 g_signal_connect(G_OBJECT(button), "activate", | |
1337 G_CALLBACK(menu_chat_info_cb), conv); | |
1338 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1339 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1340 gtk_widget_show(button); | |
1341 } | |
1342 | |
1343 if (gc && prpl_info->get_cb_away) { | |
1344 button = gtk_menu_item_new_with_label(_("Get Away Msg")); | |
1345 g_signal_connect(G_OBJECT(button), "activate", | |
1346 G_CALLBACK(menu_chat_get_away_cb), conv); | |
1347 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1348 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1349 gtk_widget_show(button); | |
1350 } | |
1351 | |
8170 | 1352 /* XXX: jabber can only add buddies from here in certain circumstances */ |
8143 | 1353 /* Added by Jonas <jonas@birme.se> */ |
1354 if (gc) { | |
1355 if (gaim_find_buddy(gc->account, who)) | |
1356 button = gtk_menu_item_new_with_label(_("Remove")); | |
1357 else | |
1358 button = gtk_menu_item_new_with_label(_("Add")); | |
1359 | |
1360 g_signal_connect(G_OBJECT(button), "activate", | |
1361 G_CALLBACK(menu_chat_add_remove_cb), conv); | |
1362 | |
1363 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1364 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1365 gtk_widget_show(button); | |
1366 } | |
1367 /* End Jonas */ | |
1368 | |
1369 return menu; | |
1370 } | |
1371 | |
1372 | |
1373 static gint | |
1374 gtkconv_chat_popup_menu_cb(GtkWidget *widget, GaimConversation *conv) | |
1375 { | |
1376 GaimGtkConversation *gtkconv; | |
1377 GaimPluginProtocolInfo *prpl_info = NULL; | |
1378 GaimGtkChatPane *gtkchat; | |
1379 GaimConnection *gc; | |
1380 GaimAccount *account; | |
1381 GtkTreeSelection *sel; | |
1382 GtkTreeIter iter; | |
1383 GtkTreeModel *model; | |
1384 GtkWidget *menu; | |
1385 gchar *who; | |
1386 | |
1387 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1388 gtkchat = gtkconv->u.chat; | |
1389 account = gaim_conversation_get_account(conv); | |
1390 gc = account->gc; | |
1391 | |
1392 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | |
1393 | |
1394 if (gc != NULL) | |
1395 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | |
1396 | |
1397 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); | |
1398 if(!gtk_tree_selection_get_selected(sel, NULL, &iter)) | |
1399 return FALSE; | |
1400 | |
1401 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &who, -1); | |
1402 menu = create_chat_menu (conv, who, prpl_info, gc); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1403 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1404 gaim_gtk_treeview_popup_menu_position_func, widget, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1405 0, GDK_CURRENT_TIME); |
8143 | 1406 |
1407 return TRUE; | |
1408 } | |
1409 | |
1410 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1411 static gint |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1412 right_click_chat_cb(GtkWidget *widget, GdkEventButton *event, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1413 GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1414 { |
8143 | 1415 GaimGtkConversation *gtkconv; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1416 GaimPluginProtocolInfo *prpl_info = NULL; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1417 GaimGtkChatPane *gtkchat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1418 GaimConnection *gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1419 GaimAccount *account; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1420 GtkTreePath *path; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1421 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1422 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1423 GtkTreeViewColumn *column; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1424 gchar *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1425 int x, y; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1426 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1427 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1428 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1429 account = gaim_conversation_get_account(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1430 gc = account->gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1431 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1432 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1433 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1434 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
|
1435 event->x, event->y, &path, &column, &x, &y); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1436 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1437 if (path == NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1438 return FALSE; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1439 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1440 if (gc != NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1441 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1442 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1443 gtk_tree_selection_select_path(GTK_TREE_SELECTION( |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1444 gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list))), path); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1445 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1446 gtk_tree_model_get_iter(GTK_TREE_MODEL(model), &iter, path); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1447 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &who, -1); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1448 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1449 if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) { |
7398 | 1450 chat_do_im(conv, who); |
1451 } else if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { | |
8143 | 1452 GtkWidget *menu = create_chat_menu (conv, who, prpl_info, gc); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1453 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1454 event->button, event->time); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1455 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1456 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1457 return TRUE; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1458 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1459 |
8133 | 1460 static void |
1461 move_to_next_unread_tab(GaimConversation *conv) | |
1462 { | |
1463 GaimConversation *next_conv = NULL; | |
1464 GaimConvWindow *win; | |
1465 GList *l; | |
1466 int index, i; | |
1467 | |
1468 win = gaim_conversation_get_window(conv); | |
1469 index = gaim_conversation_get_index(conv); | |
1470 | |
1471 /* First check the tabs after this position. */ | |
1472 for (l = g_list_nth(gaim_conv_window_get_conversations(win), index); | |
1473 l != NULL; | |
1474 l = l->next) { | |
1475 | |
1476 next_conv = (GaimConversation *)l->data; | |
1477 | |
1478 if (gaim_conversation_get_unseen(next_conv) > 0) | |
1479 break; | |
1480 | |
1481 next_conv = NULL; | |
1482 } | |
1483 | |
1484 if (next_conv == NULL) { | |
1485 | |
1486 /* Now check before this position. */ | |
1487 for (l = gaim_conv_window_get_conversations(win), i = 0; | |
1488 l != NULL && i < index; | |
1489 l = l->next) { | |
1490 | |
1491 next_conv = (GaimConversation *)l->data; | |
1492 | |
1493 if (gaim_conversation_get_unseen(next_conv) > 0) | |
1494 break; | |
1495 | |
1496 next_conv = NULL; | |
1497 } | |
1498 | |
1499 if (next_conv == NULL) { | |
1500 /* Okay, just grab the next conversation tab. */ | |
1501 if (index == gaim_conv_window_get_conversation_count(win) - 1) | |
1502 next_conv = gaim_conv_window_get_conversation_at(win, 0); | |
1503 else | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1504 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1505 next_conv = gaim_conv_window_get_conversation_at(win, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1506 index + 1); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1507 } |
8133 | 1508 } |
1509 } | |
1510 | |
1511 if (next_conv != NULL && next_conv != conv) { | |
1512 gaim_conv_window_switch_conversation(win, | |
1513 gaim_conversation_get_index(next_conv)); | |
1514 } | |
1515 } | |
1516 | |
4359 | 1517 static gboolean |
8105 | 1518 entry_key_press_cb(GtkWidget *entry, GdkEventKey *event, gpointer data) |
4359 | 1519 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1520 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1521 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1522 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1523 GaimGtkWindow *gtkwin; |
8105 | 1524 int numconvs; |
1525 int curconv; | |
1526 | |
1527 conv = (GaimConversation *)data; | |
1528 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1529 win = gaim_conversation_get_window(conv); | |
1530 gtkwin = GAIM_GTK_WINDOW(win); | |
1531 numconvs = gaim_conv_window_get_conversation_count(win); | |
1532 curconv = gaim_conversation_get_index(conv); | |
1533 | |
1534 /* If CTRL was held down... */ | |
1535 if (event->state & GDK_CONTROL_MASK) { | |
4359 | 1536 switch (event->keyval) { |
8105 | 1537 case GDK_Return: |
1538 case GDK_KP_Enter: | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1539 if (gaim_prefs_get_bool( |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1540 "/gaim/gtk/conversations/ctrl_enter_sends")) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1541 { |
8105 | 1542 send_cb(NULL, conv); |
1543 | |
1544 return TRUE; | |
1545 } | |
1546 break; | |
1547 | |
4359 | 1548 case GDK_Up: |
1549 if (!conv->send_history) | |
1550 break; | |
1551 | |
1552 if (!conv->send_history->prev) { | |
1553 GtkTextIter start, end; | |
1554 | |
1555 if (conv->send_history->data) | |
1556 g_free(conv->send_history->data); | |
1557 | |
1558 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, | |
1559 &start); | |
1560 gtk_text_buffer_get_end_iter(gtkconv->entry_buffer, &end); | |
1561 | |
1562 conv->send_history->data = | |
8506 | 1563 gtk_imhtml_get_markup(GTK_IMHTML(gtkconv->entry)); |
4359 | 1564 } |
8677 | 1565 |
4359 | 1566 if (conv->send_history->next && |
1567 conv->send_history->next->data) { | |
8677 | 1568 GtkTextIter iter; |
1569 GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); | |
4359 | 1570 |
1571 conv->send_history = conv->send_history->next; | |
8061 | 1572 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1573 gtk_imhtml_append_text_with_images( |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1574 GTK_IMHTML(gtkconv->entry), conv->send_history->data, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1575 0, NULL); |
8677 | 1576 /* this is mainly just a hack so the formatting at the |
1577 * cursor gets picked up. */ | |
1578 gtk_text_buffer_get_end_iter(buffer, &iter); | |
1579 gtk_text_buffer_move_mark_by_name(buffer, "insert", &iter); | |
4359 | 1580 } |
1581 | |
8105 | 1582 return TRUE; |
4359 | 1583 break; |
1584 | |
1585 case GDK_Down: | |
1586 if (!conv->send_history) | |
1587 break; | |
1588 | |
8105 | 1589 if (conv->send_history->prev && |
1590 conv->send_history->prev->data) { | |
8677 | 1591 GtkTextIter iter; |
1592 GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); | |
8105 | 1593 |
4359 | 1594 conv->send_history = conv->send_history->prev; |
8105 | 1595 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1596 gtk_imhtml_append_text_with_images( |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1597 GTK_IMHTML(gtkconv->entry), conv->send_history->data, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1598 0, NULL); |
8677 | 1599 /* this is mainly just a hack so the formatting at the |
1600 * cursor gets picked up. */ | |
1601 gtk_text_buffer_get_end_iter(buffer, &iter); | |
1602 gtk_text_buffer_move_mark_by_name(buffer, "insert", &iter); | |
4359 | 1603 } |
1604 | |
8105 | 1605 return TRUE; |
4359 | 1606 break; |
8105 | 1607 |
8108 | 1608 case GDK_Page_Down: |
8143 | 1609 case ']': |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1610 gaim_conv_window_switch_conversation(win, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1611 (curconv + 1) % numconvs); |
8105 | 1612 |
1613 return TRUE; | |
1614 break; | |
1615 | |
8108 | 1616 case GDK_Page_Up: |
8143 | 1617 case '[': |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1618 gaim_conv_window_switch_conversation(win, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1619 (curconv + numconvs - 1) % numconvs); |
8133 | 1620 |
1621 return TRUE; | |
1622 break; | |
1623 | |
8108 | 1624 case GDK_Tab: |
8133 | 1625 move_to_next_unread_tab(conv); |
8108 | 1626 |
1627 return TRUE; | |
1628 break; | |
1629 | |
1630 case 'z': | |
1631 gtk_window_iconify(GTK_WINDOW(gtkwin->window)); | |
8105 | 1632 |
1633 return TRUE; | |
1634 break; | |
1635 | |
1636 } /* End of switch */ | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1637 } |
8758 | 1638 |
8105 | 1639 /* If ALT (or whatever) was held down... */ |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1640 else if (event->state & GDK_MOD1_MASK) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1641 { |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8730
diff
changeset
|
1642 /* XXX - Make sure the conv exists before switching to it */ |
8105 | 1643 if (event->keyval > '0' && event->keyval <= '9') { |
1644 int switchto = event->keyval - '1'; | |
1645 if (switchto < numconvs) | |
1646 gaim_conv_window_switch_conversation(win, switchto); | |
4359 | 1647 |
1648 return TRUE; | |
1649 } | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1650 } |
8758 | 1651 |
8105 | 1652 /* If neither CTRL nor ALT were held down... */ |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1653 else |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1654 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1655 switch (event->keyval) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1656 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1657 case GDK_Return: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1658 case GDK_KP_Enter: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1659 if (!(event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK)) && |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1660 gaim_prefs_get_bool("/gaim/gtk/conversations/enter_sends")) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1661 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1662 send_cb(NULL, conv); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1663 return TRUE; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1664 } |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1665 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1666 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1667 case GDK_Tab: |
8941 | 1668 if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1669 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1670 tab_complete(conv); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1671 return TRUE; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1672 } |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1673 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1674 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1675 case GDK_Page_Up: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1676 gtk_imhtml_page_up(GTK_IMHTML(gtkconv->imhtml)); |
8105 | 1677 return TRUE; |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1678 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1679 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1680 case GDK_Page_Down: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1681 gtk_imhtml_page_down(GTK_IMHTML(gtkconv->imhtml)); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1682 return TRUE; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1683 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1684 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1685 } |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1686 } |
4359 | 1687 |
1688 return FALSE; | |
1689 } | |
1690 | |
1691 /* | |
1692 * NOTE: | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1693 * 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
|
1694 * further. I have no idea *why* we need this, but we do ... It |
4359 | 1695 * 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
|
1696 * going all the way down to the notebook. I suspect a bug in |
4359 | 1697 * GtkTextView, but I'm not ready to point any fingers yet. |
1698 */ | |
1699 static gboolean | |
1700 entry_stop_rclick_cb(GtkWidget *widget, GdkEventButton *event, gpointer data) | |
1701 { | |
1702 if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { | |
1703 /* Right single click */ | |
1704 g_signal_stop_emission_by_name(G_OBJECT(widget), "button_press_event"); | |
1705 | |
1706 return TRUE; | |
1707 } | |
1708 | |
1709 return FALSE; | |
1710 } | |
1711 | |
8173 | 1712 /* |
1713 * If someone tries to type into the conversation backlog of a | |
1714 * conversation window then we yank focus from the conversation backlog | |
1715 * and give it to the text entry box so that people can type | |
1716 * all the live long day and it will get entered into the entry box. | |
1717 */ | |
6057 | 1718 static gboolean |
8105 | 1719 refocus_entry_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) |
6057 | 1720 { |
1721 GaimGtkConversation *gtkconv = data; | |
1722 | |
8237 | 1723 /* If we have a valid key for the conversation display, then exit */ |
8224 | 1724 if ((event->state & GDK_CONTROL_MASK) || |
8237 | 1725 (event->keyval == GDK_F10) || |
1726 (event->keyval == GDK_Shift_L) || | |
1727 (event->keyval == GDK_Shift_R) || | |
1728 (event->keyval == GDK_Escape) || | |
8177 | 1729 (event->keyval == GDK_Up) || |
1730 (event->keyval == GDK_Down) || | |
1731 (event->keyval == GDK_Left) || | |
8191 | 1732 (event->keyval == GDK_Right) || |
1733 (event->keyval == GDK_Home) || | |
9297 | 1734 (event->keyval == GDK_End) || |
1735 (event->keyval == GDK_Tab) || | |
1736 (event->keyval == GDK_ISO_Left_Tab)) | |
8177 | 1737 return FALSE; |
1738 | |
1739 if (event->type == GDK_KEY_RELEASE) | |
1740 gtk_widget_grab_focus(gtkconv->entry); | |
1741 | |
1742 gtk_widget_event(gtkconv->entry, (GdkEvent *)event); | |
1743 | |
1744 return TRUE; | |
6057 | 1745 } |
1746 | |
4359 | 1747 static void |
4673 | 1748 menu_conv_sel_send_cb(GObject *m, gpointer data) |
4359 | 1749 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1750 GaimConvWindow *win = g_object_get_data(m, "user_data"); |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
1751 GaimAccount *account = g_object_get_data(m, "gaim_account"); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1752 GaimConversation *conv; |
8456 | 1753 GaimGtkConversation *gtkconv; |
1754 GaimPlugin *protocol; | |
4359 | 1755 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1756 conv = gaim_conv_window_get_active_conversation(win); |
4359 | 1757 |
4491 | 1758 gaim_conversation_set_account(conv, account); |
8456 | 1759 |
1760 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1761 protocol = gaim_find_prpl(conv->account->protocol_id); | |
1762 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), | |
1763 protocol->info->name); | |
4359 | 1764 } |
1765 | |
1766 static void | |
1767 insert_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *position, | |
1768 gchar *new_text, gint new_text_length, gpointer user_data) | |
1769 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1770 GaimConversation *conv = (GaimConversation *)user_data; |
4359 | 1771 |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1772 g_return_if_fail(conv != NULL); |
4359 | 1773 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1774 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) |
4359 | 1775 return; |
1776 | |
1777 got_typing_keypress(conv, (gtk_text_iter_is_start(position) && | |
1778 gtk_text_iter_is_end(position))); | |
1779 } | |
1780 | |
1781 static void | |
1782 delete_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *start_pos, | |
1783 GtkTextIter *end_pos, gpointer user_data) | |
1784 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1785 GaimConversation *conv = (GaimConversation *)user_data; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1786 GaimConvIm *im; |
4359 | 1787 |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1788 g_return_if_fail(conv != NULL); |
4359 | 1789 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1790 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) |
4359 | 1791 return; |
1792 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1793 im = GAIM_CONV_IM(conv); |
4359 | 1794 |
1795 if (gtk_text_iter_is_start(start_pos) && gtk_text_iter_is_end(end_pos)) { | |
1796 | |
1797 /* We deleted all the text, so turn off typing. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1798 if (gaim_conv_im_get_type_again_timeout(im)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1799 gaim_conv_im_stop_type_again_timeout(im); |
4359 | 1800 |
1801 serv_send_typing(gaim_conversation_get_gc(conv), | |
6695 | 1802 gaim_conversation_get_name(conv), |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
1803 GAIM_NOT_TYPING); |
4359 | 1804 } |
1805 else { | |
1806 /* We're deleting, but not all of it, so it counts as typing. */ | |
1807 got_typing_keypress(conv, FALSE); | |
1808 } | |
1809 } | |
1810 | |
1811 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1812 notebook_init_grab(GaimGtkWindow *gtkwin, GtkWidget *widget) |
4359 | 1813 { |
1814 static GdkCursor *cursor = NULL; | |
1815 | |
1816 gtkwin->in_drag = TRUE; | |
1817 | |
1818 if (gtkwin->drag_leave_signal) { | |
1819 g_signal_handler_disconnect(G_OBJECT(widget), | |
1820 gtkwin->drag_leave_signal); | |
1821 | |
1822 gtkwin->drag_leave_signal = 0; | |
1823 } | |
1824 | |
1825 if (cursor == NULL) | |
1826 cursor = gdk_cursor_new(GDK_FLEUR); | |
1827 | |
1828 /* Grab the pointer */ | |
1829 gtk_grab_add(gtkwin->notebook); | |
5114
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1830 #ifndef _WIN32 |
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1831 /* 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
|
1832 always be true after a button press. */ |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1833 if (!gdk_pointer_is_grabbed()) |
5114
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1834 #endif |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1835 gdk_pointer_grab(gtkwin->notebook->window, FALSE, |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1836 GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1837 NULL, cursor, GDK_CURRENT_TIME); |
4359 | 1838 } |
1839 | |
1840 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1841 notebook_motion_cb(GtkWidget *widget, GdkEventButton *e, GaimConvWindow *win) |
4359 | 1842 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1843 GaimGtkWindow *gtkwin; |
4359 | 1844 |
1845 gtkwin = GAIM_GTK_WINDOW(win); | |
1846 | |
1847 /* | |
1848 * Make sure the user moved the mouse far enough for the | |
1849 * drag to be initiated. | |
1850 */ | |
1851 if (gtkwin->in_predrag) { | |
1852 if (e->x_root < gtkwin->drag_min_x || | |
1853 e->x_root >= gtkwin->drag_max_x || | |
1854 e->y_root < gtkwin->drag_min_y || | |
1855 e->y_root >= gtkwin->drag_max_y) { | |
1856 | |
1857 gtkwin->in_predrag = FALSE; | |
1858 notebook_init_grab(gtkwin, widget); | |
1859 } | |
1860 } | |
1861 else { /* Otherwise, draw the arrows. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1862 GaimConvWindow *dest_win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1863 GaimGtkWindow *dest_gtkwin; |
4359 | 1864 GtkNotebook *dest_notebook; |
1865 GtkWidget *tab, *last_vis_tab = NULL; | |
1866 gint nb_x, nb_y, page_num, i, last_vis_tab_loc = -1; | |
1867 gint arrow1_x, arrow1_y, arrow2_x, arrow2_y; | |
1868 gboolean horiz_tabs = FALSE, tab_found = FALSE; | |
1869 GList *l; | |
1870 | |
1871 /* Get the window that the cursor is over. */ | |
1872 dest_win = gaim_gtkwin_get_at_xy(e->x_root, e->y_root); | |
1873 | |
1874 if (dest_win == NULL) { | |
1875 dnd_hints_hide_all(); | |
1876 | |
1877 return TRUE; | |
1878 } | |
1879 | |
1880 dest_gtkwin = GAIM_GTK_WINDOW(dest_win); | |
1881 | |
1882 dest_notebook = GTK_NOTEBOOK(dest_gtkwin->notebook); | |
1883 | |
1884 gdk_window_get_origin(GTK_WIDGET(dest_notebook)->window, &nb_x, &nb_y); | |
1885 | |
1886 arrow1_x = arrow2_x = nb_x; | |
1887 arrow1_y = arrow2_y = nb_y; | |
1888 | |
1889 page_num = gaim_gtkconv_get_dest_tab_at_xy(dest_win, | |
1890 e->x_root, e->y_root); | |
1891 | |
1892 if (gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_TOP || | |
1893 gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_BOTTOM) { | |
1894 | |
1895 horiz_tabs = TRUE; | |
1896 } | |
1897 | |
1898 /* Find out where to put the arrows. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1899 for (l = gaim_conv_window_get_conversations(dest_win), i = 0; |
4359 | 1900 l != NULL; |
1901 l = l->next, i++) { | |
1902 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1903 GaimConversation *conv = l->data; |
4359 | 1904 |
1905 tab = GAIM_GTK_CONVERSATION(conv)->tabby; | |
1906 | |
1907 /* | |
1908 * If this is the correct tab, record the positions | |
1909 * for the arrows. | |
1910 */ | |
1911 if (i == page_num) { | |
1912 if (horiz_tabs) { | |
1913 arrow1_x = arrow2_x = nb_x + tab->allocation.x; | |
1914 arrow1_y = nb_y + tab->allocation.y; | |
1915 arrow2_y = nb_y + tab->allocation.y + | |
1916 tab->allocation.height; | |
1917 } | |
1918 else { | |
1919 arrow1_x = nb_x + tab->allocation.x; | |
1920 arrow2_x = nb_x + tab->allocation.x + | |
1921 tab->allocation.width; | |
1922 arrow1_y = arrow2_y = nb_y + tab->allocation.y; | |
1923 } | |
1924 | |
1925 tab_found = TRUE; | |
1926 break; | |
1927 } | |
1928 else { /* Keep track of the right-most tab that we see. */ | |
1929 if (horiz_tabs && tab->allocation.x > last_vis_tab_loc) { | |
1930 last_vis_tab = tab; | |
1931 last_vis_tab_loc = tab->allocation.x; | |
1932 } | |
1933 else if (!horiz_tabs && tab->allocation.y > last_vis_tab_loc) { | |
1934 last_vis_tab = tab; | |
1935 last_vis_tab_loc = tab->allocation.y; | |
1936 } | |
1937 } | |
1938 } | |
1939 | |
1940 /* | |
1941 * If we didn't find the tab, then we'll just place the | |
1942 * arrows to the right/bottom of the last visible tab. | |
1943 */ | |
1944 if (!tab_found && last_vis_tab) { | |
1945 if (horiz_tabs) { | |
1946 arrow1_x = arrow2_x = nb_x + last_vis_tab->allocation.x + | |
1947 last_vis_tab->allocation.width; | |
1948 arrow1_y = nb_y + last_vis_tab->allocation.y; | |
1949 arrow2_y = nb_y + last_vis_tab->allocation.y + | |
1950 last_vis_tab->allocation.height; | |
1951 } | |
1952 else { | |
1953 arrow1_x = nb_x + last_vis_tab->allocation.x; | |
1954 arrow2_x = nb_x + last_vis_tab->allocation.x + | |
1955 last_vis_tab->allocation.width; | |
1956 arrow1_y = arrow2_y = nb_y + last_vis_tab->allocation.y + | |
1957 last_vis_tab->allocation.height; | |
1958 } | |
1959 } | |
1960 | |
1961 if (horiz_tabs) { | |
1962 dnd_hints_show(HINT_ARROW_DOWN, arrow1_x, arrow1_y); | |
1963 dnd_hints_show(HINT_ARROW_UP, arrow2_x, arrow2_y); | |
1964 } | |
1965 else { | |
1966 dnd_hints_show(HINT_ARROW_RIGHT, arrow1_x, arrow1_y); | |
1967 dnd_hints_show(HINT_ARROW_LEFT, arrow2_x, arrow2_y); | |
1968 } | |
1969 } | |
1970 | |
1971 return TRUE; | |
1972 } | |
1973 | |
1974 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1975 notebook_leave_cb(GtkWidget *widget, GdkEventCrossing *e, GaimConvWindow *win) |
4359 | 1976 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1977 GaimGtkWindow *gtkwin; |
4359 | 1978 |
1979 gtkwin = GAIM_GTK_WINDOW(win); | |
1980 | |
1981 if (gtkwin->in_drag) | |
1982 return FALSE; | |
1983 | |
1984 if (e->x_root < gtkwin->drag_min_x || | |
1985 e->x_root >= gtkwin->drag_max_x || | |
1986 e->y_root < gtkwin->drag_min_y || | |
1987 e->y_root >= gtkwin->drag_max_y) { | |
1988 | |
1989 gtkwin->in_predrag = FALSE; | |
1990 notebook_init_grab(gtkwin, widget); | |
1991 } | |
1992 | |
1993 return TRUE; | |
1994 } | |
1995 | |
1996 /* | |
1997 * THANK YOU GALEON! | |
1998 */ | |
1999 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2000 notebook_press_cb(GtkWidget *widget, GdkEventButton *e, GaimConvWindow *win) |
4359 | 2001 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2002 GaimGtkWindow *gtkwin; |
4359 | 2003 gint nb_x, nb_y, x_rel, y_rel; |
2004 GList *l; | |
2005 int tab_clicked; | |
2006 | |
2007 if (e->button != 1 || e->type != GDK_BUTTON_PRESS) | |
2008 return FALSE; | |
2009 | |
2010 gtkwin = GAIM_GTK_WINDOW(win); | |
2011 | |
2012 if (gtkwin->in_drag) { | |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
2013 gaim_debug(GAIM_DEBUG_WARNING, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
2014 "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
|
2015 return TRUE; |
4359 | 2016 } |
2017 | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2018 /* |
4359 | 2019 * Make sure a tab was actually clicked. The arrow buttons |
2020 * mess things up. | |
2021 */ | |
2022 tab_clicked = gaim_gtkconv_get_tab_at_xy(win, e->x_root, e->y_root); | |
2023 | |
2024 if (tab_clicked == -1) | |
2025 return FALSE; | |
2026 | |
2027 /* | |
2028 * Get the relative position of the press event, with regards to | |
2029 * the position of the notebook. | |
2030 */ | |
2031 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
2032 | |
2033 x_rel = e->x_root - nb_x; | |
2034 y_rel = e->y_root - nb_y; | |
2035 | |
2036 /* Reset the min/max x/y */ | |
2037 gtkwin->drag_min_x = 0; | |
2038 gtkwin->drag_min_y = 0; | |
2039 gtkwin->drag_max_x = 0; | |
2040 gtkwin->drag_max_y = 0; | |
2041 | |
2042 /* Find out which tab was dragged. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2043 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
|
2044 GaimConversation *conv = l->data; |
4359 | 2045 GtkWidget *tab = GAIM_GTK_CONVERSATION(conv)->tabby; |
2046 | |
2047 if (!GTK_WIDGET_VISIBLE(tab)) | |
2048 continue; | |
2049 | |
2050 if (tab->allocation.x > x_rel || tab->allocation.y > y_rel) | |
2051 break; | |
2052 | |
2053 /* Save the borders of the tab. */ | |
2054 gtkwin->drag_min_x = tab->allocation.x + nb_x; | |
2055 gtkwin->drag_min_y = tab->allocation.y + nb_y; | |
2056 gtkwin->drag_max_x = tab->allocation.width + gtkwin->drag_min_x; | |
2057 gtkwin->drag_max_y = tab->allocation.height + gtkwin->drag_min_y; | |
2058 } | |
2059 | |
2060 /* Make sure the click occurred in the tab. */ | |
2061 if (e->x_root < gtkwin->drag_min_x || | |
2062 e->x_root >= gtkwin->drag_max_x || | |
2063 e->y_root < gtkwin->drag_min_y || | |
2064 e->y_root >= gtkwin->drag_max_y) { | |
2065 | |
2066 return FALSE; | |
2067 } | |
2068 | |
2069 gtkwin->in_predrag = TRUE; | |
2070 | |
2071 /* Connect the new motion signals. */ | |
2072 gtkwin->drag_motion_signal = | |
2073 g_signal_connect(G_OBJECT(widget), "motion_notify_event", | |
2074 G_CALLBACK(notebook_motion_cb), win); | |
2075 | |
2076 gtkwin->drag_leave_signal = | |
2077 g_signal_connect(G_OBJECT(widget), "leave_notify_event", | |
2078 G_CALLBACK(notebook_leave_cb), win); | |
2079 | |
2080 return FALSE; | |
2081 } | |
2082 | |
2083 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2084 notebook_release_cb(GtkWidget *widget, GdkEventButton *e, GaimConvWindow *win) |
4359 | 2085 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2086 GaimConvWindow *dest_win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2087 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2088 GaimGtkWindow *dest_gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2089 GaimConversation *conv; |
4359 | 2090 GtkNotebook *dest_notebook; |
2091 gint dest_page_num; | |
2092 | |
2093 /* | |
2094 * Don't check to make sure that the event's window matches the | |
2095 * widget's, because we may be getting an event passed on from the | |
2096 * close button. | |
2097 */ | |
2098 if (e->button != 1 && e->type != GDK_BUTTON_RELEASE) | |
2099 return FALSE; | |
2100 | |
2101 if (gdk_pointer_is_grabbed()) { | |
2102 gdk_pointer_ungrab(GDK_CURRENT_TIME); | |
2103 gtk_grab_remove(widget); | |
2104 } | |
2105 | |
2106 gtkwin = GAIM_GTK_WINDOW(win); | |
2107 | |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
2108 if (!gtkwin->in_predrag && !gtkwin->in_drag) |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
2109 return FALSE; |
4359 | 2110 |
2111 /* Disconnect the motion signal. */ | |
2112 if (gtkwin->drag_motion_signal) { | |
2113 g_signal_handler_disconnect(G_OBJECT(widget), | |
2114 gtkwin->drag_motion_signal); | |
2115 | |
2116 gtkwin->drag_motion_signal = 0; | |
2117 } | |
2118 | |
2119 /* | |
2120 * If we're in a pre-drag, we'll also need to disconnect the leave | |
2121 * signal. | |
2122 */ | |
2123 if (gtkwin->in_predrag) { | |
2124 gtkwin->in_predrag = FALSE; | |
2125 | |
2126 if (gtkwin->drag_leave_signal) { | |
2127 g_signal_handler_disconnect(G_OBJECT(widget), | |
2128 gtkwin->drag_leave_signal); | |
2129 | |
2130 gtkwin->drag_leave_signal = 0; | |
2131 } | |
2132 } | |
2133 | |
2134 /* If we're not in drag... */ | |
2135 /* We're perfectly normal people! */ | |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
2136 if (!gtkwin->in_drag) |
4359 | 2137 return FALSE; |
2138 | |
2139 gtkwin->in_drag = FALSE; | |
2140 | |
2141 dnd_hints_hide_all(); | |
2142 | |
4369
7e1fb422e5fd
[gaim-migrate @ 4635]
Christian Hammond <chipx86@chipx86.com>
parents:
4368
diff
changeset
|
2143 dest_win = gaim_gtkwin_get_at_xy(e->x_root, e->y_root); |
4359 | 2144 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2145 conv = gaim_conv_window_get_active_conversation(win); |
4359 | 2146 |
2147 if (dest_win == NULL) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2148 if (gaim_conv_window_get_conversation_count(win) < 2) |
4359 | 2149 return FALSE; |
2150 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2151 if (gaim_conv_window_get_conversation_count(win) > 1) { |
4359 | 2152 /* Make a new window to stick this to. */ |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2153 GaimGtkConversation *gtkconv; |
4748
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2154 gint win_width, win_height; |
5121 | 2155 |
2156 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4359 | 2157 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2158 dest_win = gaim_conv_window_new(); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2159 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2160 gaim_conv_window_add_conversation(dest_win, |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2161 gaim_conv_window_remove_conversation(win, |
5139
d0182ae31ab8
[gaim-migrate @ 5503]
Christian Hammond <chipx86@chipx86.com>
parents:
5133
diff
changeset
|
2162 gaim_conversation_get_index(conv))); |
5121 | 2163 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2164 dest_gtkwin = GAIM_GTK_WINDOW(dest_win); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2165 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2166 gtk_window_get_size(GTK_WINDOW(dest_gtkwin->window), |
4748
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2167 &win_width, &win_height); |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2168 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2169 gtk_window_move(GTK_WINDOW(dest_gtkwin->window), |
4748
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2170 e->x_root - (win_width / 2), |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2171 e->y_root - (win_height / 2)); |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2172 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2173 gaim_conv_window_show(dest_win); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2174 } |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2175 } else { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2176 dest_gtkwin = GAIM_GTK_WINDOW(dest_win); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2177 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2178 /* Get the destination notebook. */ |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2179 dest_notebook = GTK_NOTEBOOK(gtkwin->notebook); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2180 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2181 /* Get the destination page number. */ |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2182 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
|
2183 e->x_root, e->y_root); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2184 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2185 if (win == dest_win) { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2186 gaim_conv_window_move_conversation(win, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2187 gaim_conversation_get_index(conv), dest_page_num); |
4359 | 2188 } |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2189 else { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2190 size_t pos; |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2191 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2192 gaim_conv_window_remove_conversation(win, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2193 gaim_conversation_get_index(conv)); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2194 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2195 pos = gaim_conv_window_add_conversation(dest_win, conv); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2196 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2197 if (pos != dest_page_num) |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2198 gaim_conv_window_move_conversation(dest_win, pos, dest_page_num); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2199 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2200 gaim_conv_window_switch_conversation(dest_win, dest_page_num); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2201 } |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2202 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2203 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); |
4359 | 2204 } |
2205 | |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2206 gaim_signal_emit(gaim_gtk_conversations_get_handle(), "conversation-drag-ended", |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2207 win, dest_win); |
4359 | 2208 |
2209 return TRUE; | |
2210 } | |
2211 | |
8189 | 2212 /************************************************************************** |
2213 * A bunch of buddy icon functions | |
2214 **************************************************************************/ | |
2215 static GdkPixbuf * | |
8755
d0364feabf96
[gaim-migrate @ 9510]
Christian Hammond <chipx86@chipx86.com>
parents:
8748
diff
changeset
|
2216 get_tab_icon(GaimConversation *conv, gboolean small_icon) |
7143 | 2217 { |
2218 GaimAccount *account = gaim_conversation_get_account(conv); | |
2219 const char *name = gaim_conversation_get_name(conv); | |
2220 GdkPixbuf *status = NULL; | |
2221 | |
2222 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
2223 GaimBuddy *b = gaim_find_buddy(account, name); | |
2224 if (b != NULL) { | |
2225 status = gaim_gtk_blist_get_status_icon((GaimBlistNode*)b, | |
8755
d0364feabf96
[gaim-migrate @ 9510]
Christian Hammond <chipx86@chipx86.com>
parents:
8748
diff
changeset
|
2226 (small_icon ? GAIM_STATUS_ICON_SMALL : GAIM_STATUS_ICON_LARGE)); |
7143 | 2227 } |
2228 } | |
2229 | |
2230 if (!status) { | |
2231 GdkPixbuf *pixbuf; | |
2232 pixbuf = create_prpl_icon(account); | |
2233 | |
8755
d0364feabf96
[gaim-migrate @ 9510]
Christian Hammond <chipx86@chipx86.com>
parents:
8748
diff
changeset
|
2234 if (small_icon && pixbuf != NULL) |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2235 { |
7143 | 2236 status = gdk_pixbuf_scale_simple(pixbuf, 15, 15, |
2237 GDK_INTERP_BILINEAR); | |
2238 g_object_unref(pixbuf); | |
2239 } | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2240 else |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2241 status = pixbuf; |
7143 | 2242 } |
2243 return status; | |
2244 } | |
2245 | |
8189 | 2246 static void |
2247 update_tab_icon(GaimConversation *conv) | |
2248 { | |
2249 GaimGtkConversation *gtkconv; | |
2250 GaimConvWindow *win = gaim_conversation_get_window(conv); | |
2251 GaimAccount *account; | |
2252 const char *name; | |
2253 GdkPixbuf *status = NULL; | |
2254 | |
2255 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2256 name = gaim_conversation_get_name(conv); | |
2257 account = gaim_conversation_get_account(conv); | |
2258 | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2259 status = get_tab_icon(conv, TRUE); |
8189 | 2260 |
2261 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->icon), status); | |
2262 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->menu_icon), status); | |
2263 | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2264 if (status != NULL) |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2265 g_object_unref(status); |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2266 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2267 if (gaim_conv_window_get_active_conversation(win) == conv && |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2268 gtkconv->u.im->anim == NULL) |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2269 { |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2270 status = get_tab_icon(conv, FALSE); |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2271 |
8189 | 2272 gtk_window_set_icon(GTK_WINDOW(GAIM_GTK_WINDOW(win)->window), status); |
2273 | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2274 if (status != NULL) |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2275 g_object_unref(status); |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2276 } |
8189 | 2277 } |
2278 | |
2279 static gboolean | |
2280 redraw_icon(gpointer data) | |
2281 { | |
2282 GaimConversation *conv = (GaimConversation *)data; | |
2283 GaimGtkConversation *gtkconv; | |
2284 | |
2285 GdkPixbuf *buf; | |
2286 GdkPixbuf *scale; | |
2287 GdkPixmap *pm; | |
2288 GdkBitmap *bm; | |
2289 gint delay; | |
2290 | |
2291 if (!g_list_find(gaim_get_ims(), conv)) { | |
2292 gaim_debug(GAIM_DEBUG_WARNING, "gtkconv", | |
2293 "Conversation not found in redraw_icon. I think this " | |
2294 "is a bug.\n"); | |
2295 return FALSE; | |
2296 } | |
2297 | |
2298 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2299 | |
2300 gdk_pixbuf_animation_iter_advance(gtkconv->u.im->iter, NULL); | |
2301 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); | |
2302 | |
2303 scale = gdk_pixbuf_scale_simple(buf, | |
2304 MAX(gdk_pixbuf_get_width(buf) * SCALE(gtkconv->u.im->anim) / | |
2305 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), | |
2306 MAX(gdk_pixbuf_get_height(buf) * SCALE(gtkconv->u.im->anim) / | |
2307 gdk_pixbuf_animation_get_height(gtkconv->u.im->anim), 1), | |
2308 GDK_INTERP_NEAREST); | |
2309 | |
2310 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); | |
2311 g_object_unref(G_OBJECT(scale)); | |
2312 gtk_image_set_from_pixmap(GTK_IMAGE(gtkconv->u.im->icon), pm, bm); | |
2313 g_object_unref(G_OBJECT(pm)); | |
2314 gtk_widget_queue_draw(gtkconv->u.im->icon); | |
2315 | |
2316 if (bm) | |
2317 g_object_unref(G_OBJECT(bm)); | |
2318 | |
9131 | 2319 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter); |
2320 if (delay <= 0) | |
2321 delay = 100; | |
2322 | |
2323 gtkconv->u.im->icon_timer = g_timeout_add(delay, redraw_icon, conv); | |
8189 | 2324 |
2325 return FALSE; | |
2326 } | |
2327 | |
2328 static void | |
2329 start_anim(GtkObject *obj, GaimConversation *conv) | |
2330 { | |
2331 GaimGtkConversation *gtkconv; | |
2332 int delay; | |
2333 | |
2334 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
2335 return; | |
2336 | |
2337 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2338 | |
8228 | 2339 if (gtkconv->u.im->anim == NULL) |
2340 return; | |
2341 | |
8202 | 2342 if (gtkconv->u.im->icon_timer != 0) |
2343 return; | |
2344 | |
8189 | 2345 if (gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim)) |
2346 return; | |
2347 | |
2348 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter) / 10; | |
2349 | |
8758 | 2350 gtkconv->u.im->icon_timer = g_timeout_add(delay * 10, redraw_icon, conv); |
8189 | 2351 } |
2352 | |
2353 static void | |
2354 stop_anim(GtkObject *obj, GaimConversation *conv) | |
2355 { | |
2356 GaimGtkConversation *gtkconv; | |
2357 | |
2358 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
2359 return; | |
2360 | |
2361 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2362 | |
2363 if (gtkconv->u.im->icon_timer != 0) | |
2364 g_source_remove(gtkconv->u.im->icon_timer); | |
2365 | |
2366 gtkconv->u.im->icon_timer = 0; | |
2367 } | |
2368 | |
2369 static void | |
2370 toggle_icon_animate_cb(GtkWidget *w, GaimConversation *conv) | |
2371 { | |
2372 GaimGtkConversation *gtkconv; | |
2373 | |
2374 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
2375 return; | |
2376 | |
2377 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2378 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2379 gtkconv->u.im->animate = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2380 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w)); |
8189 | 2381 |
2382 if (gtkconv->u.im->animate) | |
2383 start_anim(NULL, conv); | |
2384 else | |
2385 stop_anim(NULL, conv); | |
2386 } | |
2387 static void | |
2388 remove_icon(GaimGtkConversation *gtkconv) | |
2389 { | |
2390 g_return_if_fail(gtkconv != NULL); | |
2391 | |
2392 if (gtkconv->u.im->icon != NULL) | |
8821 | 2393 gtk_widget_destroy(gtkconv->u.im->icon->parent->parent->parent); |
8189 | 2394 |
2395 if (gtkconv->u.im->anim != NULL) | |
2396 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); | |
2397 | |
2398 if (gtkconv->u.im->icon_timer != 0) | |
2399 g_source_remove(gtkconv->u.im->icon_timer); | |
2400 | |
2401 if (gtkconv->u.im->iter != NULL) | |
2402 g_object_unref(G_OBJECT(gtkconv->u.im->iter)); | |
2403 | |
2404 gtkconv->u.im->icon_timer = 0; | |
2405 gtkconv->u.im->icon = NULL; | |
2406 gtkconv->u.im->anim = NULL; | |
2407 gtkconv->u.im->iter = NULL; | |
2408 } | |
2409 | |
2410 static gboolean | |
2411 icon_menu(GtkObject *obj, GdkEventButton *e, GaimConversation *conv) | |
2412 { | |
2413 GaimGtkConversation *gtkconv; | |
2414 static GtkWidget *menu = NULL; | |
2415 GtkWidget *button; | |
2416 | |
2417 if (e->button != 3 || e->type != GDK_BUTTON_PRESS) | |
2418 return FALSE; | |
2419 | |
2420 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2421 | |
2422 /* | |
2423 * If a menu already exists, destroy it before creating a new one, | |
2424 * thus freeing-up the memory it occupied. | |
2425 */ | |
2426 if (menu != NULL) | |
2427 gtk_widget_destroy(menu); | |
2428 | |
2429 menu = gtk_menu_new(); | |
2430 | |
2431 if (gtkconv->u.im->anim && | |
2432 !(gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim))) | |
2433 { | |
2434 gaim_new_check_item(menu, _("Animate"), | |
2435 G_CALLBACK(toggle_icon_animate_cb), conv, | |
2436 gtkconv->u.im->icon_timer); | |
2437 } | |
2438 | |
2439 button = gtk_menu_item_new_with_label(_("Hide Icon")); | |
2440 g_signal_connect_swapped(G_OBJECT(button), "activate", | |
2441 G_CALLBACK(remove_icon), gtkconv); | |
2442 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
2443 gtk_widget_show(button); | |
2444 | |
2445 gaim_new_item_from_stock(menu, _("Save Icon As..."), GTK_STOCK_SAVE_AS, | |
2446 G_CALLBACK(gaim_gtk_save_icon_dialog), conv, | |
2447 0, 0, NULL); | |
2448 | |
2449 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, e->button, e->time); | |
2450 | |
2451 return TRUE; | |
2452 } | |
2453 /************************************************************************** | |
2454 * End of the bunch of buddy icon functions | |
2455 **************************************************************************/ | |
2456 | |
7887 | 2457 /* |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2458 * 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
|
2459 * sensitive/insensitive. This is called after changing tabs and when an |
7887 | 2460 * account signs on or off. |
2461 */ | |
4359 | 2462 static void |
7887 | 2463 gray_stuff_out(GaimConversation *conv) |
4359 | 2464 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2465 GaimConvWindow *win; |
7887 | 2466 GaimGtkWindow *gtkwin; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2467 GaimGtkConversation *gtkconv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2468 GaimConnection *gc; |
7887 | 2469 GaimPluginProtocolInfo *prpl_info = NULL; |
7222 | 2470 GdkPixbuf *window_icon = NULL; |
8439 | 2471 GtkIMHtmlButtons buttons; |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2472 |
7887 | 2473 win = gaim_conversation_get_window(conv); |
4359 | 2474 gtkwin = GAIM_GTK_WINDOW(win); |
2475 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7887 | 2476 gc = gaim_conversation_get_gc(conv); |
8439 | 2477 |
7879 | 2478 if (gc != NULL) |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
2479 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2480 |
7887 | 2481 if (gtkwin->menu.send_as != NULL) |
2482 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); | |
2483 | |
2484 /* | |
2485 * 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
|
2486 * 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
|
2487 * conversations. Stuff that Gaim chats support in general should be |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2488 * shown for chat conversations. It doesn't matter whether the PRPL |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2489 * supports it or not--that only affects if the button or menu item |
7929 | 2490 * is sensitive or not. |
7887 | 2491 */ |
4359 | 2492 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
7887 | 2493 /* Show stuff that applies to IMs, hide stuff that applies to chats */ |
2494 | |
2495 /* Deal with buttons */ | |
2496 gtk_widget_show(gtkconv->info); | |
2497 gtk_widget_show(gtkconv->send); | |
2498 gtk_widget_show(gtkconv->u.im->warn); | |
2499 gtk_widget_show(gtkconv->u.im->block); | |
2500 | |
2501 /* Deal with menu items */ | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2502 gtk_widget_show(gtkwin->menu.view_log); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2503 gtk_widget_show(gtkwin->menu.add_pounce); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2504 gtk_widget_show(gtkwin->menu.get_info); |
7887 | 2505 gtk_widget_show(gtkwin->menu.warn); |
7859 | 2506 gtk_widget_hide(gtkwin->menu.invite); |
7887 | 2507 gtk_widget_show(gtkwin->menu.alias); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2508 gtk_widget_show(gtkwin->menu.block); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2509 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2510 if (gaim_find_buddy(gaim_conversation_get_account(conv), |
7143 | 2511 gaim_conversation_get_name(conv)) == NULL) { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2512 gtk_widget_show(gtkwin->menu.add); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2513 gtk_widget_hide(gtkwin->menu.remove); |
7929 | 2514 gtk_widget_show(gtkconv->add); |
2515 gtk_widget_hide(gtkconv->remove); | |
7859 | 2516 } else { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2517 gtk_widget_show(gtkwin->menu.remove); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2518 gtk_widget_hide(gtkwin->menu.add); |
7929 | 2519 gtk_widget_hide(gtkconv->add); |
2520 gtk_widget_show(gtkconv->remove); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2521 } |
7887 | 2522 |
2523 gtk_widget_show(gtkwin->menu.insert_link); | |
9287 | 2524 gtk_widget_show(gtkwin->menu.insert_image); |
7887 | 2525 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
2526 /* Show stuff that applies to IMs, hide stuff that applies to chats */ | |
2527 | |
2528 /* Deal with buttons */ | |
7952 | 2529 gtk_widget_show(gtkconv->info); |
7887 | 2530 gtk_widget_show(gtkconv->send); |
2531 gtk_widget_show(gtkconv->u.chat->invite); | |
2532 | |
2533 /* Deal with menu items */ | |
7859 | 2534 gtk_widget_hide(gtkwin->menu.view_log); |
2535 gtk_widget_hide(gtkwin->menu.add_pounce); | |
2536 gtk_widget_hide(gtkwin->menu.get_info); | |
7887 | 2537 gtk_widget_hide(gtkwin->menu.warn); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2538 gtk_widget_show(gtkwin->menu.invite); |
7887 | 2539 gtk_widget_show(gtkwin->menu.alias); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2540 gtk_widget_hide(gtkwin->menu.block); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2541 |
7879 | 2542 if (gaim_blist_find_chat(gaim_conversation_get_account(conv), |
2543 gaim_conversation_get_name(conv)) == NULL) { | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2544 gtk_widget_show(gtkwin->menu.add); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2545 gtk_widget_hide(gtkwin->menu.remove); |
7929 | 2546 gtk_widget_show(gtkconv->add); |
2547 gtk_widget_hide(gtkconv->remove); | |
7859 | 2548 } else { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2549 gtk_widget_show(gtkwin->menu.remove); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2550 gtk_widget_hide(gtkwin->menu.add); |
7929 | 2551 gtk_widget_hide(gtkconv->add); |
2552 gtk_widget_show(gtkconv->remove); | |
7887 | 2553 } |
2554 | |
2555 gtk_widget_show(gtkwin->menu.insert_link); | |
2556 gtk_widget_hide(gtkwin->menu.insert_image); | |
2557 } | |
2558 | |
2559 /* | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2560 * Handle graying stuff out based on whether an account is connected |
7887 | 2561 * and what features that account supports. |
2562 */ | |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
2563 if ((gc != NULL) && |
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
2564 ( (gaim_conversation_get_type(conv) != GAIM_CONV_CHAT) || |
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
2565 !gaim_conv_chat_has_left(GAIM_CONV_CHAT(conv)) )) { |
7887 | 2566 /* Account is online */ |
2567 | |
2568 /* Deal with buttons */ | |
7929 | 2569 gtk_widget_set_sensitive(gtkconv->add, TRUE); |
2570 gtk_widget_set_sensitive(gtkconv->remove, TRUE); | |
7887 | 2571 gtk_widget_set_sensitive(gtkconv->info, (prpl_info->get_info != NULL)); |
7929 | 2572 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2573 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2574 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2575 gtk_widget_set_sensitive(gtkconv->send, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2576 (prpl_info->send_im != NULL)); |
7887 | 2577 gtk_widget_set_sensitive(gtkconv->u.im->warn, |
2578 (prpl_info->warn != NULL)); | |
2579 gtk_widget_set_sensitive(gtkconv->u.im->block, | |
2580 (prpl_info->add_deny != NULL)); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2581 } |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2582 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2583 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2584 gtk_widget_set_sensitive(gtkconv->send, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2585 (prpl_info->chat_send != NULL)); |
7887 | 2586 gtk_widget_set_sensitive(gtkconv->u.chat->invite, |
2587 (prpl_info->chat_invite != NULL)); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2588 } |
7887 | 2589 |
2590 /* Deal with the toolbar */ | |
8422 | 2591 |
8420 | 2592 if (gc->flags & GAIM_CONNECTION_HTML) { |
8677 | 2593 buttons = GTK_IMHTML_ALL; /* Everything on */ |
8420 | 2594 if (!(prpl_info->options & OPT_PROTO_IM_IMAGE)) |
8422 | 2595 buttons &= ~GTK_IMHTML_IMAGE; |
8420 | 2596 if (gc->flags & GAIM_CONNECTION_NO_BGCOLOR) |
8422 | 2597 buttons &= ~GTK_IMHTML_BACKCOLOR; |
8691
0eb5161ef333
[gaim-migrate @ 9444]
Christian Hammond <chipx86@chipx86.com>
parents:
8690
diff
changeset
|
2598 if (gc->flags & GAIM_CONNECTION_NO_FONTSIZE) { |
0eb5161ef333
[gaim-migrate @ 9444]
Christian Hammond <chipx86@chipx86.com>
parents:
8690
diff
changeset
|
2599 buttons &= ~GTK_IMHTML_GROW; |
0eb5161ef333
[gaim-migrate @ 9444]
Christian Hammond <chipx86@chipx86.com>
parents:
8690
diff
changeset
|
2600 buttons &= ~GTK_IMHTML_SHRINK; |
0eb5161ef333
[gaim-migrate @ 9444]
Christian Hammond <chipx86@chipx86.com>
parents:
8690
diff
changeset
|
2601 } |
9041 | 2602 if (gc->flags & GAIM_CONNECTION_NO_URLDESC) |
2603 buttons &= ~GTK_IMHTML_LINKDESC; | |
8420 | 2604 } else { |
8422 | 2605 buttons = GTK_IMHTML_SMILEY; |
8420 | 2606 } |
2607 gtk_imhtml_set_format_functions(GTK_IMHTML(gtkconv->entry), buttons); | |
8427 | 2608 gtk_imhtmltoolbar_associate_smileys (GTK_IMHTMLTOOLBAR(gtkconv->toolbar), gaim_account_get_protocol_id(gaim_conversation_get_account(conv))); |
8422 | 2609 |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
2610 /* Deal with menu items */ |
7887 | 2611 gtk_widget_set_sensitive(gtkwin->menu.view_log, TRUE); |
2612 gtk_widget_set_sensitive(gtkwin->menu.add_pounce, TRUE); | |
2613 gtk_widget_set_sensitive(gtkwin->menu.get_info, (prpl_info->get_info != NULL)); | |
2614 gtk_widget_set_sensitive(gtkwin->menu.warn, (prpl_info->warn != NULL)); | |
2615 gtk_widget_set_sensitive(gtkwin->menu.invite, | |
2616 (prpl_info->chat_invite != NULL)); | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
2617 |
7887 | 2618 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
2619 if (gaim_find_buddy(gaim_conversation_get_account(conv), | |
2620 gaim_conversation_get_name(conv)) == NULL) | |
2621 gtk_widget_set_sensitive(gtkwin->menu.alias, FALSE); | |
2622 else | |
2623 gtk_widget_set_sensitive(gtkwin->menu.alias, TRUE); | |
2624 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
2625 if (gaim_blist_find_chat(gaim_conversation_get_account(conv), | |
2626 gaim_conversation_get_name(conv)) == NULL) | |
2627 gtk_widget_set_sensitive(gtkwin->menu.alias, FALSE); | |
2628 else | |
2629 gtk_widget_set_sensitive(gtkwin->menu.alias, TRUE); | |
2630 } | |
2631 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2632 gtk_widget_set_sensitive(gtkwin->menu.block, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2633 (prpl_info->add_deny != NULL)); |
7887 | 2634 gtk_widget_set_sensitive(gtkwin->menu.add, TRUE); |
7859 | 2635 gtk_widget_set_sensitive(gtkwin->menu.remove, TRUE); |
8758 | 2636 gtk_widget_set_sensitive(gtkwin->menu.insert_link, |
2637 gc->flags & GAIM_CONNECTION_HTML); | |
7887 | 2638 gtk_widget_set_sensitive(gtkwin->menu.insert_image, |
2639 (prpl_info->options & OPT_PROTO_IM_IMAGE)); | |
2640 } else { | |
2641 /* Account is offline */ | |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
2642 /* Or it's a chat where we left. */ |
7887 | 2643 |
2644 /* Deal with buttons */ | |
7929 | 2645 gtk_widget_set_sensitive(gtkconv->add, FALSE); |
2646 gtk_widget_set_sensitive(gtkconv->remove, FALSE); | |
7887 | 2647 gtk_widget_set_sensitive(gtkconv->info, FALSE); |
2648 gtk_widget_set_sensitive(gtkconv->send, FALSE); | |
2649 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
2650 gtk_widget_set_sensitive(gtkconv->u.im->warn, FALSE); | |
2651 gtk_widget_set_sensitive(gtkconv->u.im->block, FALSE); | |
2652 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
2653 gtk_widget_set_sensitive(gtkconv->u.chat->invite, FALSE); | |
2654 } | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2655 |
7887 | 2656 /* Then deal with menu items */ |
2657 gtk_widget_set_sensitive(gtkwin->menu.view_log, TRUE); | |
2658 gtk_widget_set_sensitive(gtkwin->menu.add_pounce, TRUE); | |
2659 gtk_widget_set_sensitive(gtkwin->menu.get_info, FALSE); | |
2660 gtk_widget_set_sensitive(gtkwin->menu.warn, FALSE); | |
2661 gtk_widget_set_sensitive(gtkwin->menu.invite, FALSE); | |
2662 gtk_widget_set_sensitive(gtkwin->menu.alias, FALSE); | |
2663 gtk_widget_set_sensitive(gtkwin->menu.block, FALSE); | |
2664 gtk_widget_set_sensitive(gtkwin->menu.add, FALSE); | |
2665 gtk_widget_set_sensitive(gtkwin->menu.remove, FALSE); | |
7929 | 2666 gtk_widget_set_sensitive(gtkwin->menu.insert_link, TRUE); |
7887 | 2667 gtk_widget_set_sensitive(gtkwin->menu.insert_image, FALSE); |
2668 } | |
2669 | |
2670 /* | |
2671 * Update the window's icon | |
2672 */ | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2673 if ((gaim_conversation_get_type(conv) == GAIM_CONV_IM) && |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2674 (gtkconv->u.im->anim)) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2675 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2676 window_icon = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2677 gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); |
7887 | 2678 g_object_ref(window_icon); |
2679 } else { | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2680 window_icon = get_tab_icon(conv, FALSE); |
4359 | 2681 } |
7887 | 2682 gtk_window_set_icon(GTK_WINDOW(gtkwin->window), window_icon); |
2683 g_object_unref(G_OBJECT(window_icon)); | |
2684 } | |
2685 | |
2686 static void | |
8189 | 2687 before_switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, |
2688 gpointer user_data) | |
2689 { | |
2690 GaimConvWindow *win; | |
2691 GaimConversation *conv; | |
2692 GaimGtkConversation *gtkconv; | |
2693 | |
2694 win = (GaimConvWindow *)user_data; | |
2695 conv = gaim_conv_window_get_active_conversation(win); | |
2696 | |
2697 g_return_if_fail(conv != NULL); | |
2698 | |
8192 | 2699 if (gaim_conversation_get_type(conv) != GAIM_CONV_IM) |
2700 return; | |
2701 | |
8189 | 2702 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2703 | |
2704 stop_anim(NULL, conv); | |
2705 } | |
2706 | |
2707 static void | |
7887 | 2708 switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, |
2709 gpointer user_data) | |
2710 { | |
2711 GaimConvWindow *win; | |
2712 GaimConversation *conv; | |
2713 GaimGtkConversation *gtkconv; | |
2714 GaimGtkWindow *gtkwin; | |
2715 | |
2716 win = (GaimConvWindow *)user_data; | |
2717 conv = gaim_conv_window_get_conversation_at(win, page_num); | |
2718 | |
2719 g_return_if_fail(conv != NULL); | |
2720 | |
2721 gtkwin = GAIM_GTK_WINDOW(win); | |
2722 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2723 | |
2724 gaim_conversation_set_unseen(conv, GAIM_UNSEEN_NONE); | |
2725 | |
2726 /* Update the menubar */ | |
2727 gray_stuff_out(conv); | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2728 |
4736 | 2729 update_typing_icon(conv); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2730 |
4359 | 2731 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.logging), |
7143 | 2732 gaim_conversation_is_logging(conv)); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2733 |
4359 | 2734 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.sounds), |
7143 | 2735 gtkconv->make_sound); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2736 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2737 gtk_check_menu_item_set_active( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2738 GTK_CHECK_MENU_ITEM(gtkwin->menu.show_formatting_toolbar), |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2739 gtkconv->show_formatting_toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2740 |
9188 | 2741 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.show_timestamps), |
2742 gtkconv->show_timestamps); | |
2743 | |
8189 | 2744 /* |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2745 * We pause icons when they are not visible. If this icon should |
9297 | 2746 * be animated then start it back up again. |
8189 | 2747 */ |
8192 | 2748 if ((gaim_conversation_get_type(conv) == GAIM_CONV_IM) && |
2749 (gtkconv->u.im->animate)) | |
8189 | 2750 start_anim(NULL, conv); |
2751 | |
4965 | 2752 gtk_window_set_title(GTK_WINDOW(gtkwin->window), |
7143 | 2753 gtk_label_get_text(GTK_LABEL(gtkconv->tab_label))); |
4359 | 2754 } |
2755 | |
2756 /************************************************************************** | |
2757 * Utility functions | |
2758 **************************************************************************/ | |
2759 | |
2760 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2761 got_typing_keypress(GaimConversation *conv, gboolean first) |
4359 | 2762 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2763 GaimConvIm *im; |
4685 | 2764 |
4359 | 2765 /* |
2766 * 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
|
2767 * send GAIM_TYPED any time soon. |
4359 | 2768 */ |
2769 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2770 im = GAIM_CONV_IM(conv); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2771 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2772 if (gaim_conv_im_get_type_again_timeout(im)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2773 gaim_conv_im_stop_type_again_timeout(im); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2774 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2775 gaim_conv_im_start_type_again_timeout(im); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2776 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2777 if (first || (gaim_conv_im_get_type_again(im) != 0 && |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2778 time(NULL) > gaim_conv_im_get_type_again(im))) { |
4359 | 2779 |
2780 int timeout = serv_send_typing(gaim_conversation_get_gc(conv), | |
2781 (char *)gaim_conversation_get_name(conv), | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
2782 GAIM_TYPING); |
4359 | 2783 |
2784 if (timeout) | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2785 gaim_conv_im_set_type_again(im, time(NULL) + timeout); |
4359 | 2786 else |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2787 gaim_conv_im_set_type_again(im, 0); |
4359 | 2788 } |
2789 } | |
2790 | |
4736 | 2791 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2792 update_typing_icon(GaimConversation *conv) |
4736 | 2793 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2794 GaimGtkWindow *gtkwin; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2795 GaimConvIm *im = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2796 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); |
4736 | 2797 |
2798 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); | |
2799 | |
2800 if(gaim_conversation_get_type(conv) == GAIM_CONV_IM) | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2801 im = GAIM_CONV_IM(conv); |
4736 | 2802 |
2803 if(gtkwin->menu.typing_icon) { | |
2804 gtk_widget_destroy(gtkwin->menu.typing_icon); | |
2805 gtkwin->menu.typing_icon = NULL; | |
2806 } | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2807 if(im && gaim_conv_im_get_typing_state(im) == GAIM_TYPING) { |
4736 | 2808 gtkwin->menu.typing_icon = gtk_image_menu_item_new(); |
2809 gtk_image_menu_item_set_image( | |
2810 GTK_IMAGE_MENU_ITEM(gtkwin->menu.typing_icon), | |
2811 gtk_image_new_from_stock(GAIM_STOCK_TYPING, | |
2812 GTK_ICON_SIZE_MENU)); | |
4757 | 2813 gtk_tooltips_set_tip(gtkconv->tooltips, gtkwin->menu.typing_icon, |
4736 | 2814 _("User is typing..."), NULL); |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2815 } else if(im && gaim_conv_im_get_typing_state(im) == GAIM_TYPED) { |
4736 | 2816 gtkwin->menu.typing_icon = gtk_image_menu_item_new(); |
2817 gtk_image_menu_item_set_image( | |
2818 GTK_IMAGE_MENU_ITEM(gtkwin->menu.typing_icon), | |
2819 gtk_image_new_from_stock(GAIM_STOCK_TYPED, | |
2820 GTK_ICON_SIZE_MENU)); | |
4757 | 2821 gtk_tooltips_set_tip(gtkconv->tooltips, gtkwin->menu.typing_icon, |
4736 | 2822 _("User has typed something and paused"), NULL); |
2823 } | |
2824 | |
2825 if(gtkwin->menu.typing_icon) { | |
2826 gtk_menu_item_set_right_justified( | |
2827 GTK_MENU_ITEM(gtkwin->menu.typing_icon), TRUE); | |
2828 gtk_widget_show_all(gtkwin->menu.typing_icon); | |
2829 gtk_menu_shell_append(GTK_MENU_SHELL(gtkwin->menu.menubar), | |
2830 gtkwin->menu.typing_icon); | |
2831 } | |
2832 } | |
2833 | |
4685 | 2834 static gboolean |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2835 update_send_as_selection(GaimConvWindow *win) |
4359 | 2836 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2837 GaimAccount *account; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2838 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2839 GaimGtkWindow *gtkwin; |
4359 | 2840 GtkWidget *menu; |
2841 GList *child; | |
2842 | |
7090
04f9f7440bc3
[gaim-migrate @ 7655]
Christian Hammond <chipx86@chipx86.com>
parents:
7089
diff
changeset
|
2843 if (g_list_find(gaim_get_windows(), win) == NULL) |
04f9f7440bc3
[gaim-migrate @ 7655]
Christian Hammond <chipx86@chipx86.com>
parents:
7089
diff
changeset
|
2844 return FALSE; |
4849 | 2845 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2846 conv = gaim_conv_window_get_active_conversation(win); |
4359 | 2847 |
5860
52d5fad43950
[gaim-migrate @ 6291]
Christian Hammond <chipx86@chipx86.com>
parents:
5858
diff
changeset
|
2848 if (conv == NULL) |
52d5fad43950
[gaim-migrate @ 6291]
Christian Hammond <chipx86@chipx86.com>
parents:
5858
diff
changeset
|
2849 return FALSE; |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2850 |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2851 account = gaim_conversation_get_account(conv); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2852 gtkwin = GAIM_GTK_WINDOW(win); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2853 |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2854 if (gtkwin->menu.send_as == NULL) |
4685 | 2855 return FALSE; |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2856 |
4359 | 2857 gtk_widget_show(gtkwin->menu.send_as); |
2858 | |
2859 menu = gtk_menu_item_get_submenu( | |
2860 GTK_MENU_ITEM(gtkwin->menu.send_as)); | |
2861 | |
2862 for (child = gtk_container_get_children(GTK_CONTAINER(menu)); | |
2863 child != NULL; | |
2864 child = child->next) { | |
2865 | |
2866 GtkWidget *item = child->data; | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2867 GaimAccount *item_account = g_object_get_data(G_OBJECT(item), |
4673 | 2868 "gaim_account"); |
2869 | |
2870 if (account == item_account) { | |
4359 | 2871 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE); |
2872 break; | |
2873 } | |
2874 } | |
6030
54c37db13279
[gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents:
6016
diff
changeset
|
2875 |
4685 | 2876 return FALSE; |
4359 | 2877 } |
2878 | |
2879 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2880 generate_send_as_items(GaimConvWindow *win, GaimConversation *deleted_conv) |
4359 | 2881 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2882 GaimGtkWindow *gtkwin; |
4359 | 2883 GtkWidget *menu; |
2884 GtkWidget *menuitem; | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2885 GList *gcs; |
4359 | 2886 GList *convs; |
2887 GSList *group = NULL; | |
2888 gboolean first_offline = TRUE; | |
2889 gboolean found_online = FALSE; | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2890 GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
4359 | 2891 |
2892 gtkwin = GAIM_GTK_WINDOW(win); | |
2893 | |
2894 if (gtkwin->menu.send_as != NULL) | |
2895 gtk_widget_destroy(gtkwin->menu.send_as); | |
2896 | |
2897 /* See if we have > 1 connection active. */ | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2898 if (g_list_length(gaim_connections_get_all()) < 2) { |
4359 | 2899 /* Now make sure we don't have any Offline entries. */ |
2900 gboolean found_offline = FALSE; | |
2901 | |
2902 for (convs = gaim_get_conversations(); | |
2903 convs != NULL; | |
2904 convs = convs->next) { | |
2905 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2906 GaimConversation *conv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2907 GaimAccount *account; |
4491 | 2908 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2909 conv = (GaimConversation *)convs->data; |
4491 | 2910 account = gaim_conversation_get_account(conv); |
2911 | |
6495
8ce66049ce68
[gaim-migrate @ 7010]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
2912 if (account != NULL && account->gc == NULL) { |
4359 | 2913 found_offline = TRUE; |
2914 break; | |
2915 } | |
2916 } | |
2917 | |
2918 if (!found_offline) { | |
2919 gtkwin->menu.send_as = NULL; | |
2920 return; | |
2921 } | |
2922 } | |
2923 | |
2924 /* Build the Send As menu */ | |
2925 gtkwin->menu.send_as = gtk_menu_item_new_with_mnemonic(_("_Send As")); | |
2926 gtk_widget_show(gtkwin->menu.send_as); | |
2927 | |
2928 menu = gtk_menu_new(); | |
7857
43f63ff8a6d8
[gaim-migrate @ 8511]
Christian Hammond <chipx86@chipx86.com>
parents:
7855
diff
changeset
|
2929 gtk_menu_shell_insert(GTK_MENU_SHELL(gtkwin->menu.menubar), |
43f63ff8a6d8
[gaim-migrate @ 8511]
Christian Hammond <chipx86@chipx86.com>
parents:
7855
diff
changeset
|
2930 gtkwin->menu.send_as, 2); |
4359 | 2931 gtk_menu_item_set_submenu(GTK_MENU_ITEM(gtkwin->menu.send_as), menu); |
2932 | |
2933 gtk_widget_show(menu); | |
2934 | |
2935 /* Fill it with entries. */ | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2936 for (gcs = gaim_connections_get_all(); gcs != NULL; gcs = gcs->next) { |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2937 |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2938 GaimConnection *gc; |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2939 GaimAccount *account; |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2940 GtkWidget *box; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2941 GtkWidget *label; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2942 GtkWidget *image; |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2943 GdkPixbuf *pixbuf, *scale; |
4359 | 2944 |
2945 found_online = TRUE; | |
2946 | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2947 gc = (GaimConnection *)gcs->data; |
4359 | 2948 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2949 /* Create a pixmap for the protocol icon. */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2950 pixbuf = create_prpl_icon(gc->account); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2951 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
|
2952 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2953 /* Now convert it to GtkImage */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2954 if (pixbuf == NULL) |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2955 image = gtk_image_new(); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2956 else |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2957 image = gtk_image_new_from_pixbuf(scale); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2958 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2959 gtk_size_group_add_widget(sg, image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2960 |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2961 g_object_unref(G_OBJECT(scale)); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2962 g_object_unref(G_OBJECT(pixbuf)); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2963 |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2964 account = gaim_connection_get_account(gc); |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2965 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2966 /* Make our menu item */ |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2967 menuitem = gtk_radio_menu_item_new_with_label(group, |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2968 gaim_account_get_username(account)); |
4793 | 2969 group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem)); |
4359 | 2970 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2971 /* Do some evil, see some evil, speak some evil. */ |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2972 box = gtk_hbox_new(FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2973 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2974 label = gtk_bin_get_child(GTK_BIN(menuitem)); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2975 g_object_ref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2976 gtk_container_remove(GTK_CONTAINER(menuitem), label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2977 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2978 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2979 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 4); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2980 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2981 g_object_unref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2982 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2983 gtk_container_add(GTK_CONTAINER(menuitem), box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2984 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2985 gtk_widget_show(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2986 gtk_widget_show(image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2987 gtk_widget_show(box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2988 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2989 /* Set our data and callbacks. */ |
4359 | 2990 g_object_set_data(G_OBJECT(menuitem), "user_data", win); |
4673 | 2991 g_object_set_data(G_OBJECT(menuitem), "gaim_account", gc->account); |
4359 | 2992 |
4786 | 2993 g_signal_connect(G_OBJECT(menuitem), "activate", |
4673 | 2994 G_CALLBACK(menu_conv_sel_send_cb), NULL); |
4359 | 2995 |
2996 gtk_widget_show(menuitem); | |
2997 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
2998 } | |
2999 | |
3000 /* | |
3001 * Fill it with any accounts that still has an open (yet disabled) window | |
3002 * (signed off accounts with a window open). | |
3003 */ | |
3004 for (convs = gaim_get_conversations(); | |
3005 convs != NULL; | |
3006 convs = convs->next) { | |
3007 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3008 GaimConversation *conv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3009 GaimAccount *account; |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3010 GtkWidget *box; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3011 GtkWidget *label; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3012 GtkWidget *image; |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3013 GdkPixbuf *pixbuf, *scale; |
4359 | 3014 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3015 conv = (GaimConversation *)convs->data; |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3016 |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3017 if (conv == deleted_conv) |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3018 continue; |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3019 |
4491 | 3020 account = gaim_conversation_get_account(conv); |
3021 | |
6495
8ce66049ce68
[gaim-migrate @ 7010]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
3022 if (account != NULL && account->gc == NULL) { |
4359 | 3023 if (first_offline && found_online) { |
3024 menuitem = gtk_separator_menu_item_new(); | |
3025 gtk_widget_show(menuitem); | |
3026 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
3027 | |
3028 first_offline = FALSE; | |
3029 } | |
3030 | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3031 /* Create a pixmap for the protocol icon. */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3032 pixbuf = create_prpl_icon(account); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3033 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3034 GDK_INTERP_BILINEAR); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3035 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3036 /* Now convert it to GtkImage */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3037 if (pixbuf == NULL) |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3038 image = gtk_image_new(); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3039 else |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3040 image = gtk_image_new_from_pixbuf(scale); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3041 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3042 gtk_size_group_add_widget(sg, image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3043 |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3044 if (scale != NULL) g_object_unref(scale); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3045 if (pixbuf != NULL) g_object_unref(pixbuf); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3046 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3047 /* Make our menu item */ |
4359 | 3048 menuitem = gtk_radio_menu_item_new_with_label(group, |
4491 | 3049 account->username); |
4793 | 3050 group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem)); |
4359 | 3051 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3052 /* Do some evil, see some evil, speak some evil. */ |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3053 box = gtk_hbox_new(FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3054 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3055 label = gtk_bin_get_child(GTK_BIN(menuitem)); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3056 g_object_ref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3057 gtk_container_remove(GTK_CONTAINER(menuitem), label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3058 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3059 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3060 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 4); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3061 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3062 g_object_unref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3063 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3064 gtk_container_add(GTK_CONTAINER(menuitem), box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3065 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3066 gtk_widget_show(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3067 gtk_widget_show(image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3068 gtk_widget_show(box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3069 |
4359 | 3070 gtk_widget_set_sensitive(menuitem, FALSE); |
4786 | 3071 g_object_set_data(G_OBJECT(menuitem), "user_data", win); |
4674 | 3072 g_object_set_data(G_OBJECT(menuitem), "gaim_account", account); |
4359 | 3073 |
4786 | 3074 g_signal_connect(G_OBJECT(menuitem), "activate", |
5902
6889b89cab90
[gaim-migrate @ 6334]
Christian Hammond <chipx86@chipx86.com>
parents:
5901
diff
changeset
|
3075 G_CALLBACK(menu_conv_sel_send_cb), NULL); |
4786 | 3076 |
4359 | 3077 gtk_widget_show(menuitem); |
3078 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
3079 } | |
3080 } | |
3081 | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3082 g_object_unref(sg); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3083 |
4359 | 3084 gtk_widget_show(gtkwin->menu.send_as); |
3085 update_send_as_selection(win); | |
3086 } | |
3087 | |
3088 static GList * | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3089 generate_invite_user_names(GaimConnection *gc) |
4359 | 3090 { |
6695 | 3091 GaimBlistNode *gnode,*cnode,*bnode; |
4359 | 3092 static GList *tmp = NULL; |
3093 | |
3094 if (tmp) | |
3095 g_list_free(tmp); | |
3096 | |
3097 tmp = g_list_append(NULL, ""); | |
3098 | |
3099 if (gc != NULL) { | |
4785 | 3100 for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { |
3101 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) | |
3102 continue; | |
6695 | 3103 for(cnode = gnode->child; cnode; cnode = cnode->next) { |
3104 if(!GAIM_BLIST_NODE_IS_CONTACT(cnode)) | |
4785 | 3105 continue; |
6695 | 3106 for(bnode = cnode->child; bnode; bnode = bnode->next) { |
3107 GaimBuddy *buddy; | |
3108 | |
3109 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) | |
3110 continue; | |
3111 | |
3112 buddy = (GaimBuddy *)bnode; | |
3113 | |
3114 if (buddy->account == gc->account && | |
3115 GAIM_BUDDY_IS_ONLINE(buddy)) | |
3116 tmp = g_list_append(tmp, buddy->name); | |
3117 } | |
4359 | 3118 } |
3119 } | |
3120 } | |
3121 | |
3122 return tmp; | |
3123 } | |
3124 | |
3125 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3126 add_chat_buddy_common(GaimConversation *conv, const char *name, int pos) |
4359 | 3127 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3128 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3129 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3130 GaimConvChat *chat; |
4359 | 3131 GtkTreeIter iter; |
3132 GtkListStore *ls; | |
3133 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3134 chat = GAIM_CONV_CHAT(conv); |
4359 | 3135 gtkconv = GAIM_GTK_CONVERSATION(conv); |
3136 gtkchat = gtkconv->u.chat; | |
3137 | |
3138 ls = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list))); | |
3139 | |
3140 gtk_list_store_append(ls, &iter); | |
3141 gtk_list_store_set(ls, &iter, 0, | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3142 (gaim_conv_chat_is_user_ignored(chat, name) ? "X" : " "), |
4359 | 3143 1, name, -1); |
3144 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), 1, | |
3145 GTK_SORT_ASCENDING); | |
3146 } | |
3147 | |
3148 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3149 tab_complete(GaimConversation *conv) |
4359 | 3150 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3151 GaimGtkConversation *gtkconv; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3152 GaimConvChat *chat; |
4359 | 3153 GtkTextIter cursor, word_start, start_buffer; |
3154 int start; | |
3155 int most_matched = -1; | |
3156 char *entered, *partial = NULL; | |
3157 char *text; | |
8021 | 3158 char *nick_partial; |
4359 | 3159 GList *matches = NULL; |
3160 GList *nicks = NULL; | |
3161 | |
3162 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3163 chat = GAIM_CONV_CHAT(conv); |
4359 | 3164 |
3165 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_buffer); | |
3166 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, | |
3167 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
3168 | |
3169 word_start = cursor; | |
3170 | |
3171 /* if there's nothing there just return */ | |
3172 if (!gtk_text_iter_compare(&cursor, &start_buffer)) | |
3173 return; | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
3174 |
4359 | 3175 text = gtk_text_buffer_get_text(gtkconv->entry_buffer, &start_buffer, |
3176 &cursor, FALSE); | |
3177 | |
3178 /* if we're at the end of ": " we need to move back 2 spaces */ | |
3179 start = strlen(text) - 1; | |
3180 | |
8021 | 3181 if (strlen(text) >= 2 && !strncmp(&text[start-1], ": ", 2)) { |
4359 | 3182 gtk_text_iter_backward_chars(&word_start, 2); |
8021 | 3183 start-=2; |
3184 } | |
4359 | 3185 |
3186 /* find the start of the word that we're tabbing */ | |
3187 while (start >= 0 && text[start] != ' ') { | |
3188 gtk_text_iter_backward_char(&word_start); | |
3189 start--; | |
3190 } | |
3191 | |
3192 g_free(text); | |
3193 | |
3194 entered = gtk_text_buffer_get_text(gtkconv->entry_buffer, &word_start, | |
3195 &cursor, FALSE); | |
3196 | |
8021 | 3197 if (!g_utf8_strlen(entered, -1)) { |
4359 | 3198 g_free(entered); |
3199 return; | |
3200 } | |
3201 | |
8021 | 3202 nick_partial = g_malloc(strlen(entered)+1); |
3203 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3204 for (nicks = gaim_conv_chat_get_users(chat); |
4359 | 3205 nicks != NULL; |
3206 nicks = nicks->next) { | |
3207 | |
3208 char *nick = nicks->data; | |
8021 | 3209 |
8159 | 3210 strncpy(nick_partial, nick, strlen(entered)); |
8172 | 3211 nick_partial[strlen(entered)] = '\0'; |
8021 | 3212 if(gaim_utf8_strcasecmp(nick_partial, entered)) |
3213 continue; | |
4359 | 3214 |
3215 /* if we're here, it's a possible completion */ | |
3216 | |
3217 if (most_matched == -1) { | |
3218 /* | |
3219 * this will only get called once, since from now | |
3220 * on most_matched is >= 0 | |
3221 */ | |
3222 most_matched = strlen(nick); | |
3223 partial = g_strdup(nick); | |
3224 } | |
3225 else if (most_matched) { | |
8021 | 3226 char *tmp = g_strdup(nick); |
3227 | |
3228 while (gaim_utf8_strcasecmp(tmp, partial)) { | |
3229 partial[most_matched] = '\0'; | |
3230 if(most_matched < strlen(tmp)) | |
3231 tmp[most_matched] = '\0'; | |
4359 | 3232 most_matched--; |
8021 | 3233 } |
8079 | 3234 most_matched++; |
8021 | 3235 |
3236 g_free(tmp); | |
4359 | 3237 } |
3238 | |
3239 matches = g_list_append(matches, nick); | |
3240 } | |
3241 | |
8021 | 3242 g_free(nick_partial); |
3243 | |
4359 | 3244 /* we're only here if we're doing new style */ |
3245 | |
3246 /* if there weren't any matches, return */ | |
3247 if (!matches) { | |
3248 /* if matches isn't set partials won't be either */ | |
3249 g_free(entered); | |
3250 return; | |
3251 } | |
3252 | |
3253 gtk_text_buffer_delete(gtkconv->entry_buffer, &word_start, &cursor); | |
3254 | |
3255 if (!matches->next) { | |
3256 /* there was only one match. fill it in. */ | |
3257 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_buffer); | |
3258 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, | |
3259 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
3260 | |
3261 if (!gtk_text_iter_compare(&cursor, &start_buffer)) { | |
3262 char *tmp = g_strdup_printf("%s: ", (char *)matches->data); | |
3263 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, tmp, -1); | |
3264 g_free(tmp); | |
3265 } | |
3266 else | |
3267 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, | |
3268 matches->data, -1); | |
3269 | |
3270 matches = g_list_remove(matches, matches->data); | |
3271 } | |
3272 else { | |
3273 /* | |
3274 * there were lots of matches, fill in as much as possible | |
3275 * and display all of them | |
3276 */ | |
3277 char *addthis = g_malloc0(1); | |
3278 | |
3279 while (matches) { | |
3280 char *tmp = addthis; | |
3281 addthis = g_strconcat(tmp, matches->data, " ", NULL); | |
3282 g_free(tmp); | |
3283 matches = g_list_remove(matches, matches->data); | |
3284 } | |
3285 | |
6982 | 3286 gaim_conversation_write(conv, NULL, addthis, GAIM_MESSAGE_NO_LOG, |
4359 | 3287 time(NULL)); |
3288 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, partial, -1); | |
3289 g_free(addthis); | |
3290 } | |
3291 | |
3292 g_free(entered); | |
3293 g_free(partial); | |
3294 } | |
3295 | |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3296 static void |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3297 save_convo(GtkWidget *save, GaimConversation *c) |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3298 { |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3299 char buf[BUF_LONG]; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3300 GtkWidget *window; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3301 |
7859 | 3302 window = gtk_file_selection_new(_("Save Conversation")); |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3303 |
8557 | 3304 g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S "%s.html", |
7261 | 3305 gaim_home_dir(), gaim_normalize(c->account, c->name)); |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3306 gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3307 g_object_set_data(G_OBJECT(GTK_FILE_SELECTION(window)->ok_button), |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3308 "gaim_conversation", c); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3309 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(window)->ok_button), |
6038 | 3310 "clicked", G_CALLBACK(do_check_save_convo), window); |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3311 g_signal_connect_swapped(G_OBJECT(GTK_FILE_SELECTION(window)->cancel_button), |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3312 "clicked", G_CALLBACK(gtk_widget_destroy), (gpointer)window); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3313 gtk_widget_show(window); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3314 } |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3315 |
4359 | 3316 static GtkItemFactoryEntry menu_items[] = |
3317 { | |
3318 /* Conversation menu */ | |
4596 | 3319 { N_("/_Conversation"), NULL, NULL, 0, "<Branch>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3320 |
7887 | 3321 { N_("/Conversation/New Instant _Message..."), "<CTL>M", menu_new_conv_cb, |
7859 | 3322 0, "<StockItem>", GAIM_STOCK_IM }, |
3323 | |
3324 { "/Conversation/sep0", NULL, NULL, 0, "<Separator>" }, | |
3325 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3326 { N_("/Conversation/_Find..."), NULL, menu_find_cb, 0, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3327 "<StockItem>", GTK_STOCK_FIND }, |
7859 | 3328 { N_("/Conversation/View _Log"), NULL, menu_view_log_cb, 0, NULL }, |
4596 | 3329 { N_("/Conversation/_Save As..."), NULL, menu_save_as_cb, 0, |
4359 | 3330 "<StockItem>", GTK_STOCK_SAVE_AS }, |
8974 | 3331 { 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
|
3332 |
4359 | 3333 { "/Conversation/sep1", NULL, NULL, 0, "<Separator>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3334 |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
3335 { N_("/Conversation/Add Buddy _Pounce..."), NULL, menu_add_pounce_cb, |
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
3336 0, NULL }, |
7859 | 3337 { N_("/Conversation/_Get Info"), NULL, menu_get_info_cb, 0, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3338 "<StockItem>", GAIM_STOCK_INFO }, |
7859 | 3339 { N_("/Conversation/_Warn..."), NULL, menu_warn_cb, 0, |
3340 "<StockItem>", GAIM_STOCK_WARN }, | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3341 { N_("/Conversation/In_vite..."), NULL, menu_invite_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3342 "<StockItem>", GAIM_STOCK_INVITE }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3343 |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
3344 { "/Conversation/sep2", NULL, NULL, 0, "<Separator>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3345 |
7859 | 3346 { N_("/Conversation/A_lias..."), NULL, menu_alias_cb, 0, |
3347 "<StockItem>", GAIM_STOCK_EDIT }, | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3348 { N_("/Conversation/_Block..."), NULL, menu_block_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3349 "<StockItem>", GAIM_STOCK_BLOCK }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3350 { N_("/Conversation/_Add..."), NULL, menu_add_remove_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3351 "<StockItem>", GTK_STOCK_ADD }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3352 { N_("/Conversation/_Remove..."), NULL, menu_add_remove_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3353 "<StockItem>", GTK_STOCK_REMOVE }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3354 |
7859 | 3355 { "/Conversation/sep3", NULL, NULL, 0, "<Separator>" }, |
3356 | |
8756 | 3357 { N_("/Conversation/Insert Lin_k..."), NULL, menu_insert_link_cb, 0, |
7859 | 3358 "<StockItem>", GAIM_STOCK_LINK }, |
9287 | 3359 { N_("/Conversation/Insert Imag_e..."), NULL, menu_insert_image_cb, 0, |
7859 | 3360 "<StockItem>", GAIM_STOCK_IMAGE }, |
3361 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3362 { "/Conversation/sep4", NULL, NULL, 0, "<Separator>" }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3363 |
4596 | 3364 { N_("/Conversation/_Close"), NULL, menu_close_conv_cb, 0, |
4359 | 3365 "<StockItem>", GTK_STOCK_CLOSE }, |
3366 | |
3367 /* Options */ | |
4596 | 3368 { N_("/_Options"), NULL, NULL, 0, "<Branch>" }, |
3369 { N_("/Options/Enable _Logging"), NULL, menu_logging_cb, 0, "<CheckItem>" }, | |
3370 { N_("/Options/Enable _Sounds"), NULL, menu_sounds_cb, 0, "<CheckItem>" }, | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3371 { N_("/Options/Show Formatting _Toolbar"), NULL, menu_toolbar_cb, 0, "<CheckItem>" }, |
9188 | 3372 { N_("/Options/Show T_imestamps"), "F2", menu_timestamps_cb, 0, "<CheckItem>" }, |
4359 | 3373 }; |
3374 | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
3375 static const int menu_item_count = |
4359 | 3376 sizeof(menu_items) / sizeof(*menu_items); |
3377 | |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3378 static char * |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3379 item_factory_translate_func (const char *path, gpointer func_data) |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3380 { |
7386 | 3381 return _((char *)path); |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3382 } |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3383 |
4359 | 3384 static GtkWidget * |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3385 setup_menubar(GaimConvWindow *win) |
4359 | 3386 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3387 GaimGtkWindow *gtkwin; |
5116 | 3388 GtkAccelGroup *accel_group; |
4359 | 3389 gtkwin = GAIM_GTK_WINDOW(win); |
3390 | |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
3391 accel_group = gtk_accel_group_new (); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
3392 gtk_window_add_accel_group (GTK_WINDOW (gtkwin->window), accel_group); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
3393 g_object_unref (accel_group); |
5116 | 3394 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3395 gtkwin->menu.item_factory = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3396 gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<main>", accel_group); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3397 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3398 gtk_item_factory_set_translate_func(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3399 item_factory_translate_func, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3400 NULL, NULL); |
4630 | 3401 |
3402 gtk_item_factory_create_items(gtkwin->menu.item_factory, menu_item_count, | |
4359 | 3403 menu_items, win); |
7420 | 3404 g_signal_connect(G_OBJECT(accel_group), "accel-changed", |
3405 G_CALLBACK(gaim_gtk_save_accels_cb), NULL); | |
4359 | 3406 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3407 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3408 gtkwin->menu.menubar = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3409 gtk_item_factory_get_widget(gtkwin->menu.item_factory, "<main>"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3410 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3411 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3412 gtkwin->menu.view_log = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3413 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
7295 | 3414 N_("/Conversation/View Log")); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3415 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3416 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3417 gtkwin->menu.add_pounce = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3418 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3419 N_("/Conversation/Add Buddy Pounce...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3420 |
7879 | 3421 /* --- */ |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3422 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3423 gtkwin->menu.get_info = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3424 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
7859 | 3425 N_("/Conversation/Get Info")); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3426 |
7879 | 3427 gtkwin->menu.warn = |
3428 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3429 N_("/Conversation/Warn...")); | |
3430 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3431 gtkwin->menu.invite = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3432 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3433 N_("/Conversation/Invite...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3434 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3435 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3436 |
7879 | 3437 gtkwin->menu.alias = |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3438 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
7879 | 3439 N_("/Conversation/Alias...")); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3440 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3441 gtkwin->menu.block = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3442 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3443 N_("/Conversation/Block...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3444 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3445 gtkwin->menu.add = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3446 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3447 N_("/Conversation/Add...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3448 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3449 gtkwin->menu.remove = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3450 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3451 N_("/Conversation/Remove...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3452 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3453 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3454 |
7879 | 3455 gtkwin->menu.insert_link = |
3456 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3457 N_("/Conversation/Insert Link...")); | |
3458 | |
3459 gtkwin->menu.insert_image = | |
3460 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3461 N_("/Conversation/Insert Image...")); | |
3462 | |
3463 /* --- */ | |
3464 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3465 gtkwin->menu.logging = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3466 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3467 N_("/Options/Enable Logging")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3468 gtkwin->menu.sounds = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3469 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3470 N_("/Options/Enable Sounds")); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3471 gtkwin->menu.show_formatting_toolbar = |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3472 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3473 N_("/Options/Show Formatting Toolbar")); |
9188 | 3474 gtkwin->menu.show_timestamps = |
3475 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3476 N_("/Options/Show Timestamps")); | |
4359 | 3477 |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3478 generate_send_as_items(win, NULL); |
4359 | 3479 |
3480 gtk_widget_show(gtkwin->menu.menubar); | |
4931 | 3481 |
3482 return gtkwin->menu.menubar; | |
4359 | 3483 } |
3484 | |
3485 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3486 setup_im_buttons(GaimConversation *conv, GtkWidget *parent) |
4359 | 3487 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3488 GaimConnection *gc; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3489 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3490 GaimGtkImPane *gtkim; |
8811 | 3491 GaimButtonStyle button_type; |
4359 | 3492 |
3493 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3494 gtkim = gtkconv->u.im; | |
3495 gc = gaim_conversation_get_gc(conv); | |
3496 | |
3497 /* From right to left... */ | |
3498 | |
3499 /* Send button */ | |
3500 gtkconv->send = gaim_gtk_change_text(_("Send"), gtkconv->send, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3501 GAIM_STOCK_SEND, GAIM_CONV_IM); |
4359 | 3502 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->send, _("Send"), NULL); |
3503 gtk_box_pack_end(GTK_BOX(parent), gtkconv->send, FALSE, FALSE, 0); | |
3504 | |
3505 /* Separator */ | |
3506 if (gtkim->sep2 != NULL) | |
3507 gtk_widget_destroy(gtkim->sep2); | |
3508 | |
3509 gtkim->sep2 = gtk_vseparator_new(); | |
3510 gtk_box_pack_end(GTK_BOX(parent), gtkim->sep2, FALSE, TRUE, 0); | |
3511 gtk_widget_show(gtkim->sep2); | |
3512 | |
3513 /* Now, um, just kind of all over the place. Huh? */ | |
3514 | |
3515 /* Warn button */ | |
3516 gtkim->warn = gaim_gtk_change_text(_("Warn"), gtkim->warn, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3517 GAIM_STOCK_WARN, GAIM_CONV_IM); |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3518 gtk_tooltips_set_tip(gtkconv->tooltips, gtkim->warn, |
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3519 _("Warn the user"), NULL); |
7929 | 3520 gtk_box_pack_start(GTK_BOX(parent), gtkim->warn, FALSE, FALSE, 0); |
3521 | |
3522 /* Block button */ | |
3523 gtkim->block = gaim_gtk_change_text(_("Block"), gtkim->block, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3524 GAIM_STOCK_BLOCK, GAIM_CONV_IM); |
7929 | 3525 gtk_tooltips_set_tip(gtkconv->tooltips, gtkim->block, |
3526 _("Block the user"), NULL); | |
3527 gtk_box_pack_start(GTK_BOX(parent), gtkim->block, FALSE, FALSE, 0); | |
3528 | |
3529 /* Add button */ | |
3530 gtkconv->add = gaim_gtk_change_text(_("Add"), gtkconv->add, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3531 GTK_STOCK_ADD, GAIM_CONV_IM); |
7929 | 3532 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->add, |
3533 _("Add the user to your buddy list"), NULL); | |
3534 gtk_box_pack_start(GTK_BOX(parent), gtkconv->add, FALSE, FALSE, 0); | |
3535 | |
3536 /* Remove button */ | |
3537 gtkconv->remove = gaim_gtk_change_text(_("Remove"), gtkconv->remove, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3538 GTK_STOCK_REMOVE, GAIM_CONV_IM); |
7929 | 3539 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->remove, |
3540 _("Remove the user from your buddy list"), NULL); | |
3541 gtk_box_pack_start(GTK_BOX(parent), gtkconv->remove, FALSE, FALSE, 0); | |
4359 | 3542 |
3543 /* Info button */ | |
3544 gtkconv->info = gaim_gtk_change_text(_("Info"), gtkconv->info, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3545 GAIM_STOCK_INFO, GAIM_CONV_IM); |
4359 | 3546 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->info, |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3547 _("Get the user's information"), NULL); |
7929 | 3548 gtk_box_pack_start(GTK_BOX(parent), gtkconv->info, FALSE, FALSE, 0); |
3549 | |
3550 gtk_button_set_relief(GTK_BUTTON(gtkim->warn), GTK_RELIEF_NONE); | |
3551 gtk_button_set_relief(GTK_BUTTON(gtkim->block), GTK_RELIEF_NONE); | |
3552 gtk_button_set_relief(GTK_BUTTON(gtkconv->add), GTK_RELIEF_NONE); | |
3553 gtk_button_set_relief(GTK_BUTTON(gtkconv->remove), GTK_RELIEF_NONE); | |
4359 | 3554 gtk_button_set_relief(GTK_BUTTON(gtkconv->info), GTK_RELIEF_NONE); |
3555 gtk_button_set_relief(GTK_BUTTON(gtkconv->send), GTK_RELIEF_NONE); | |
7929 | 3556 |
3557 gtk_size_group_add_widget(gtkconv->sg, gtkim->warn); | |
3558 gtk_size_group_add_widget(gtkconv->sg, gtkim->block); | |
3559 gtk_size_group_add_widget(gtkconv->sg, gtkconv->add); | |
3560 gtk_size_group_add_widget(gtkconv->sg, gtkconv->remove); | |
4359 | 3561 gtk_size_group_add_widget(gtkconv->sg, gtkconv->info); |
3562 gtk_size_group_add_widget(gtkconv->sg, gtkconv->send); | |
7929 | 3563 |
3564 gtk_box_reorder_child(GTK_BOX(parent), gtkim->warn, 1); | |
3565 gtk_box_reorder_child(GTK_BOX(parent), gtkim->block, 2); | |
3566 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->add, 3); | |
3567 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->remove, 4); | |
3568 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->info, 5); | |
4359 | 3569 |
3570 gaim_gtkconv_update_buttons_by_protocol(conv); | |
3571 | |
8811 | 3572 /* Check if the buttons should be visible or not */ |
9150 | 3573 button_type = gaim_prefs_get_int("/gaim/gtk/conversations/button_type"); |
8811 | 3574 if (button_type == GAIM_BUTTON_NONE) |
3575 gtk_widget_hide(gtkconv->bbox); | |
3576 else | |
3577 gtk_widget_show(gtkconv->bbox); | |
3578 | |
4359 | 3579 g_signal_connect(G_OBJECT(gtkim->warn), "clicked", |
3580 G_CALLBACK(warn_cb), conv); | |
3581 g_signal_connect(G_OBJECT(gtkim->block), "clicked", | |
3582 G_CALLBACK(block_cb), conv); | |
7929 | 3583 g_signal_connect(G_OBJECT(gtkconv->add), "clicked", |
3584 G_CALLBACK(add_remove_cb), conv); | |
3585 g_signal_connect(G_OBJECT(gtkconv->remove), "clicked", | |
3586 G_CALLBACK(add_remove_cb), conv); | |
3587 g_signal_connect(G_OBJECT(gtkconv->info), "clicked", | |
3588 G_CALLBACK(info_cb), conv); | |
3589 g_signal_connect(G_OBJECT(gtkconv->send), "clicked", | |
3590 G_CALLBACK(send_cb), conv); | |
4359 | 3591 } |
3592 | |
3593 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3594 setup_chat_buttons(GaimConversation *conv, GtkWidget *parent) |
4359 | 3595 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3596 GaimConnection *gc; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3597 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3598 GaimGtkChatPane *gtkchat; |
8811 | 3599 GaimButtonStyle button_type; |
4359 | 3600 |
3601 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3602 gtkchat = gtkconv->u.chat; | |
3603 gc = gaim_conversation_get_gc(conv); | |
3604 | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3605 /* From right to left... */ |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3606 |
4359 | 3607 /* Send button */ |
3608 gtkconv->send = gaim_gtk_change_text(_("Send"), gtkconv->send, | |
3609 GAIM_STOCK_SEND, GAIM_CONV_CHAT); | |
3610 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->send, _("Send"), NULL); | |
3611 gtk_box_pack_end(GTK_BOX(parent), gtkconv->send, FALSE, FALSE, 0); | |
3612 | |
3613 /* Separator */ | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3614 if (gtkchat->sep != NULL) |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3615 gtk_widget_destroy(gtkchat->sep); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3616 |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3617 gtkchat->sep = gtk_vseparator_new(); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3618 gtk_box_pack_end(GTK_BOX(parent), gtkchat->sep, FALSE, TRUE, 0); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3619 gtk_widget_show(gtkchat->sep); |
4359 | 3620 |
3621 /* Invite */ | |
3622 gtkchat->invite = gaim_gtk_change_text(_("Invite"), gtkchat->invite, | |
3623 GAIM_STOCK_INVITE, GAIM_CONV_CHAT); | |
3624 gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->invite, | |
3625 _("Invite a user"), NULL); | |
7931 | 3626 gtk_box_pack_start(GTK_BOX(parent), gtkchat->invite, FALSE, FALSE, 0); |
4359 | 3627 |
7929 | 3628 /* Add button */ |
3629 gtkconv->add = gaim_gtk_change_text(_("Add"), gtkconv->add, | |
3630 GTK_STOCK_ADD, GAIM_CONV_CHAT); | |
3631 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->add, | |
3632 _("Add the chat to your buddy list"), NULL); | |
3633 gtk_box_pack_start(GTK_BOX(parent), gtkconv->add, FALSE, FALSE, 0); | |
3634 | |
3635 /* Remove button */ | |
3636 gtkconv->remove = gaim_gtk_change_text(_("Remove"), gtkconv->remove, | |
3637 GTK_STOCK_REMOVE, GAIM_CONV_CHAT); | |
3638 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->remove, | |
3639 _("Remove the chat from your buddy list"), NULL); | |
3640 gtk_box_pack_start(GTK_BOX(parent), gtkconv->remove, FALSE, FALSE, 0); | |
3641 | |
4359 | 3642 /* Set the relief on these. */ |
3643 gtk_button_set_relief(GTK_BUTTON(gtkchat->invite), GTK_RELIEF_NONE); | |
7929 | 3644 gtk_button_set_relief(GTK_BUTTON(gtkconv->add), GTK_RELIEF_NONE); |
3645 gtk_button_set_relief(GTK_BUTTON(gtkconv->remove), GTK_RELIEF_NONE); | |
4359 | 3646 gtk_button_set_relief(GTK_BUTTON(gtkconv->send), GTK_RELIEF_NONE); |
3647 | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3648 gtk_size_group_add_widget(gtkconv->sg, gtkchat->invite); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3649 gtk_size_group_add_widget(gtkconv->sg, gtkconv->add); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3650 gtk_size_group_add_widget(gtkconv->sg, gtkconv->remove); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3651 gtk_size_group_add_widget(gtkconv->sg, gtkconv->send); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3652 |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3653 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->add, 1); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3654 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->remove, 3); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3655 gtk_box_reorder_child(GTK_BOX(parent), gtkchat->invite, 3); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3656 |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3657 gaim_gtkconv_update_buttons_by_protocol(conv); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3658 |
8811 | 3659 /* Check if the buttons should be visible or not */ |
9150 | 3660 button_type = gaim_prefs_get_int("/gaim/gtk/conversations/button_type"); |
8811 | 3661 if (button_type == GAIM_BUTTON_NONE) |
3662 gtk_widget_hide(gtkconv->bbox); | |
3663 else | |
3664 gtk_widget_show(gtkconv->bbox); | |
3665 | |
4359 | 3666 /* Callbacks */ |
7929 | 3667 g_signal_connect(G_OBJECT(gtkchat->invite), "clicked", |
3668 G_CALLBACK(invite_cb), conv); | |
3669 g_signal_connect(G_OBJECT(gtkconv->add), "clicked", | |
3670 G_CALLBACK(add_remove_cb), conv); | |
3671 g_signal_connect(G_OBJECT(gtkconv->remove), "clicked", | |
3672 G_CALLBACK(add_remove_cb), conv); | |
4359 | 3673 g_signal_connect(G_OBJECT(gtkconv->send), "clicked", |
3674 G_CALLBACK(send_cb), conv); | |
3675 } | |
3676 | |
3677 | |
7971 | 3678 static void topic_callback(GtkWidget *w, GaimConversation *conv) |
3679 { | |
3680 GaimPluginProtocolInfo *prpl_info = NULL; | |
3681 GaimConnection *gc; | |
3682 GaimGtkConversation *gtkconv; | |
3683 GaimGtkChatPane *gtkchat; | |
8858 | 3684 const char *new_topic; |
3685 const char *current_topic; | |
7971 | 3686 |
3687 gc = gaim_conversation_get_gc(conv); | |
3688 | |
3689 if(!gc || !(prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl))) | |
3690 return; | |
3691 | |
3692 if(prpl_info->set_chat_topic == NULL) | |
3693 return; | |
3694 | |
3695 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3696 gtkchat = gtkconv->u.chat; | |
8858 | 3697 new_topic = gtk_entry_get_text(GTK_ENTRY(gtkchat->topic_text)); |
3698 current_topic = gaim_conv_chat_get_topic(GAIM_CONV_CHAT(conv)); | |
3699 | |
3700 if(current_topic && !g_utf8_collate(new_topic, current_topic)) | |
7971 | 3701 return; |
3702 | |
8858 | 3703 prpl_info->set_chat_topic(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), |
3704 new_topic); | |
7971 | 3705 } |
3706 | |
4359 | 3707 static GtkWidget * |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3708 setup_chat_pane(GaimConversation *conv) |
4359 | 3709 { |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3710 GaimPluginProtocolInfo *prpl_info = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3711 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3712 GaimGtkChatPane *gtkchat; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3713 GaimConnection *gc; |
8456 | 3714 GaimPlugin *protocol; |
4359 | 3715 GtkWidget *vpaned, *hpaned; |
3716 GtkWidget *vbox, *hbox; | |
3717 GtkWidget *lbox, *bbox; | |
3718 GtkWidget *label; | |
3719 GtkWidget *list; | |
3720 GtkWidget *button; | |
7949 | 3721 GtkWidget *sw; |
4359 | 3722 GtkListStore *ls; |
3723 GtkCellRenderer *rend; | |
3724 GtkTreeViewColumn *col; | |
9080 | 3725 GList *focus_chain = NULL; |
4359 | 3726 |
3727 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3728 gtkchat = gtkconv->u.chat; | |
3729 gc = gaim_conversation_get_gc(conv); | |
3730 | |
3731 /* Setup the outer pane. */ | |
3732 vpaned = gtk_vpaned_new(); | |
3733 gtk_widget_show(vpaned); | |
3734 | |
3735 /* Setup the top part of the pane. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3736 vbox = gtk_vbox_new(FALSE, 6); |
8914 | 3737 gtk_paned_pack1(GTK_PANED(vpaned), vbox, TRUE, TRUE); |
4359 | 3738 gtk_widget_show(vbox); |
3739 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3740 if (gc != NULL) |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3741 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3742 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3743 if (prpl_info->options & OPT_PROTO_CHAT_TOPIC) |
4359 | 3744 { |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3745 hbox = gtk_hbox_new(FALSE, 6); |
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3746 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
4359 | 3747 gtk_widget_show(hbox); |
3748 | |
3749 label = gtk_label_new(_("Topic:")); | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3750 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
4359 | 3751 gtk_widget_show(label); |
3752 | |
3753 gtkchat->topic_text = gtk_entry_new(); | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3754 |
7971 | 3755 if(prpl_info->set_chat_topic == NULL) { |
3756 gtk_editable_set_editable(GTK_EDITABLE(gtkchat->topic_text), FALSE); | |
3757 } else { | |
3758 g_signal_connect(GTK_OBJECT(gtkchat->topic_text), "activate", | |
3759 G_CALLBACK(topic_callback), conv); | |
3760 } | |
3761 | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3762 gtk_box_pack_start(GTK_BOX(hbox), gtkchat->topic_text, TRUE, TRUE, 0); |
4359 | 3763 gtk_widget_show(gtkchat->topic_text); |
3764 } | |
3765 | |
3766 /* Setup the horizontal pane. */ | |
3767 hpaned = gtk_hpaned_new(); | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3768 gtk_box_pack_start(GTK_BOX(vbox), hpaned, TRUE, TRUE, 0); |
4359 | 3769 gtk_widget_show(hpaned); |
3770 | |
3771 /* Setup the scrolled window to put gtkimhtml in. */ | |
3772 gtkconv->sw = gtk_scrolled_window_new(NULL, NULL); | |
3773 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
8076 | 3774 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
4359 | 3775 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(gtkconv->sw), |
3776 GTK_SHADOW_IN); | |
3777 gtk_paned_pack1(GTK_PANED(hpaned), gtkconv->sw, TRUE, TRUE); | |
3778 | |
3779 gtk_widget_set_size_request(gtkconv->sw, | |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3780 gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_width"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3781 gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_height")); |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3782 |
8914 | 3783 g_signal_connect(G_OBJECT(gtkconv->sw), "size-allocate", |
3784 G_CALLBACK(size_allocate_cb), conv); | |
3785 | |
4359 | 3786 gtk_widget_show(gtkconv->sw); |
3787 | |
3788 /* Setup gtkihmtml. */ | |
3789 gtkconv->imhtml = gtk_imhtml_new(NULL, NULL); | |
9005 | 3790 gtk_widget_set_name(gtkconv->imhtml, "gaim_gtkconv_imhtml"); |
4359 | 3791 gtk_container_add(GTK_CONTAINER(gtkconv->sw), gtkconv->imhtml); |
3792 | |
3793 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3794 gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); |
4359 | 3795 |
3796 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", | |
3797 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
8105 | 3798 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_press_event", |
6057 | 3799 G_CALLBACK(refocus_entry_cb), gtkconv); |
8109 | 3800 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_release_event", |
3801 G_CALLBACK(refocus_entry_cb), gtkconv); | |
4359 | 3802 |
3803 gaim_setup_imhtml(gtkconv->imhtml); | |
3804 gtk_widget_show(gtkconv->imhtml); | |
3805 | |
3806 /* Build the right pane. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3807 lbox = gtk_vbox_new(FALSE, 6); |
4409
0521eec12c33
[gaim-migrate @ 4682]
Christian Hammond <chipx86@chipx86.com>
parents:
4398
diff
changeset
|
3808 gtk_paned_pack2(GTK_PANED(hpaned), lbox, FALSE, TRUE); |
4359 | 3809 gtk_widget_show(lbox); |
3810 | |
3811 /* Setup the label telling how many people are in the room. */ | |
3812 gtkchat->count = gtk_label_new(_("0 people in room")); | |
3813 gtk_box_pack_start(GTK_BOX(lbox), gtkchat->count, FALSE, FALSE, 0); | |
3814 gtk_widget_show(gtkchat->count); | |
3815 | |
3816 /* Setup the list of users. */ | |
7949 | 3817 sw = gtk_scrolled_window_new(NULL, NULL); |
3818 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
8076 | 3819 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
7949 | 3820 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); |
3821 gtk_box_pack_start(GTK_BOX(lbox), sw, TRUE, TRUE, 0); | |
3822 gtk_widget_show(sw); | |
4359 | 3823 |
3824 ls = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING); | |
3825 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), 1, | |
3826 GTK_SORT_ASCENDING); | |
3827 | |
3828 list = gtk_tree_view_new_with_model(GTK_TREE_MODEL(ls)); | |
3829 | |
3830 rend = gtk_cell_renderer_text_new(); | |
3831 col = gtk_tree_view_column_new_with_attributes(NULL, rend, | |
3832 "text", 0, NULL); | |
3833 gtk_tree_view_column_set_clickable(GTK_TREE_VIEW_COLUMN(col), TRUE); | |
3834 | |
3835 g_signal_connect(G_OBJECT(list), "button_press_event", | |
3836 G_CALLBACK(right_click_chat_cb), conv); | |
8143 | 3837 g_signal_connect(G_OBJECT(list), "popup-menu", |
3838 G_CALLBACK(gtkconv_chat_popup_menu_cb), conv); | |
4359 | 3839 |
3840 gtk_tree_view_append_column(GTK_TREE_VIEW(list), col); | |
3841 | |
3842 col = gtk_tree_view_column_new_with_attributes(NULL, rend, | |
3843 "text", 1, NULL); | |
3844 gtk_tree_view_column_set_clickable(GTK_TREE_VIEW_COLUMN(col), TRUE); | |
3845 | |
3846 gtk_tree_view_append_column(GTK_TREE_VIEW(list), col); | |
3847 | |
3848 gtk_widget_set_size_request(list, 150, -1); | |
3849 | |
3850 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(list), FALSE); | |
3851 gtk_widget_show(list); | |
3852 | |
3853 gtkchat->list = list; | |
3854 | |
7949 | 3855 gtk_container_add(GTK_CONTAINER(sw), list); |
4359 | 3856 |
3857 /* Setup the user list toolbar. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3858 bbox = gtk_hbox_new(TRUE, 6); |
4359 | 3859 gtk_box_pack_start(GTK_BOX(lbox), bbox, FALSE, FALSE, 0); |
3860 gtk_widget_show(bbox); | |
3861 | |
3862 /* IM */ | |
3863 button = gaim_pixbuf_button_from_stock(NULL, GTK_STOCK_REDO, | |
3864 GAIM_BUTTON_VERTICAL); | |
3865 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
3866 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
|
3867 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("IM the user"), NULL); |
4359 | 3868 g_signal_connect(G_OBJECT(button), "clicked", |
7961 | 3869 G_CALLBACK(chat_im_button_cb), conv); |
4359 | 3870 |
3871 gtk_widget_show(button); | |
3872 | |
3873 /* Ignore */ | |
3874 button = gaim_pixbuf_button_from_stock(NULL, GAIM_STOCK_IGNORE, | |
3875 GAIM_BUTTON_VERTICAL); | |
3876 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
3877 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
|
3878 gtk_tooltips_set_tip(gtkconv->tooltips, button, |
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3879 _("Ignore the user"), NULL); |
4359 | 3880 g_signal_connect(G_OBJECT(button), "clicked", |
3881 G_CALLBACK(ignore_cb), conv); | |
3882 gtk_widget_show(button); | |
3883 | |
3884 /* Info */ | |
3885 button = gaim_pixbuf_button_from_stock(NULL, GAIM_STOCK_INFO, | |
3886 GAIM_BUTTON_VERTICAL); | |
3887 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
3888 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
3889 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3890 _("Get the user's information"), NULL); |
4359 | 3891 g_signal_connect(G_OBJECT(button), "clicked", |
3892 G_CALLBACK(info_cb), conv); | |
3893 | |
3894 gtk_widget_show(button); | |
3895 | |
3896 gtkconv->info = button; | |
3897 | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3898 /* Build the toolbar. */ |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3899 vbox = gtk_vbox_new(FALSE, 6); |
8914 | 3900 gtk_paned_pack2(GTK_PANED(vpaned), vbox, FALSE, TRUE); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3901 gtk_widget_show(vbox); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3902 |
8317 | 3903 gtkconv->toolbar = gtk_imhtmltoolbar_new(); |
3904 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->toolbar, FALSE, FALSE, 0); | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3905 |
8123 | 3906 /* Setup the entry widget. |
3907 * We never show the horizontal scrollbar because it was causing weird | |
3908 * lockups when typing text just as you type the character that would | |
3909 * cause both scrollbars to appear. Definitely seems like a gtk bug. | |
3910 */ | |
8821 | 3911 gtkconv->entrybox = gtk_hbox_new(FALSE, 6); |
3912 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->entrybox, TRUE, TRUE, 0); | |
3913 gtk_widget_show(gtkconv->entrybox); | |
3914 | |
7949 | 3915 sw = gtk_scrolled_window_new(NULL, NULL); |
3916 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
8112 | 3917 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); |
8061 | 3918 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), |
3919 GTK_SHADOW_IN); | |
8821 | 3920 gtk_box_pack_start(GTK_BOX(gtkconv->entrybox), sw, TRUE, TRUE, 0); |
7949 | 3921 gtk_widget_show(sw); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3922 |
8061 | 3923 gtkconv->entry = gtk_imhtml_new(NULL, NULL); |
9005 | 3924 gtk_widget_set_name(gtkconv->entry, "gaim_gtkconv_entry"); |
8456 | 3925 gtk_imhtml_smiley_shortcuts(GTK_IMHTML(gtkconv->entry), |
3926 gaim_prefs_get_bool("/gaim/gtk/conversations/smiley_shortcuts")); | |
3927 gtk_imhtml_html_shortcuts(GTK_IMHTML(gtkconv->entry), | |
3928 gaim_prefs_get_bool("/gaim/gtk/conversations/html_shortcuts")); | |
3929 | |
3930 protocol = gaim_find_prpl(conv->account->protocol_id); | |
3931 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), | |
3932 protocol->info->name); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3933 gtkconv->entry_buffer = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3934 gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); |
8061 | 3935 gaim_setup_imhtml(gtkconv->entry); |
3936 gtk_imhtml_set_editable(GTK_IMHTML(gtkconv->entry), TRUE); | |
3937 default_formatize(conv); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3938 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(gtkconv->entry), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3939 GTK_WRAP_WORD_CHAR); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3940 gtk_widget_set_size_request(gtkconv->entry, -1, |
8106 | 3941 gaim_prefs_get_int("/gaim/gtk/conversations/chat/entry_height")); |
7949 | 3942 g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", conv); |
3943 | |
3944 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", | |
8105 | 3945 G_CALLBACK(entry_key_press_cb), conv); |
4359 | 3946 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", |
3947 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
8914 | 3948 g_signal_connect(G_OBJECT(gtkconv->entry), "size-allocate", |
3949 G_CALLBACK(size_allocate_cb), conv); | |
4359 | 3950 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3951 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
3952 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3953 gtk_imhtmltoolbar_attach(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3954 gtkconv->entry); |
4359 | 3955 |
7949 | 3956 gtk_container_add(GTK_CONTAINER(sw), GTK_WIDGET(gtkconv->entry)); |
4359 | 3957 gtk_widget_show(gtkconv->entry); |
3958 | |
3959 /* Setup the bottom button box. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3960 gtkconv->bbox = gtk_hbox_new(FALSE, 6); |
4359 | 3961 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->bbox, FALSE, FALSE, 0); |
3962 gtk_widget_show(gtkconv->bbox); | |
3963 | |
3964 setup_chat_buttons(conv, gtkconv->bbox); | |
3965 | |
9080 | 3966 /* |
3967 * Focus for chat windows should be as follows: | |
3968 * Tab title -> chat topic -> conversation scrollback -> user list -> | |
3969 * user list buttons -> entry -> buttons at bottom | |
3970 */ | |
3971 focus_chain = g_list_prepend(focus_chain, gtkconv->bbox); | |
3972 focus_chain = g_list_prepend(focus_chain, gtkconv->entrybox); | |
3973 gtk_container_set_focus_chain(GTK_CONTAINER(vbox), focus_chain); | |
3974 | |
4359 | 3975 return vpaned; |
3976 } | |
3977 | |
3978 static GtkWidget * | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3979 setup_im_pane(GaimConversation *conv) |
4359 | 3980 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3981 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3982 GaimGtkImPane *gtkim; |
8456 | 3983 GaimPlugin *protocol; |
4359 | 3984 GtkWidget *paned; |
3985 GtkWidget *vbox; | |
3986 GtkWidget *vbox2; | |
7949 | 3987 GtkWidget *sw; |
9080 | 3988 GList *focus_chain = NULL; |
4359 | 3989 |
3990 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3991 gtkim = gtkconv->u.im; | |
3992 | |
3993 /* Setup the outer pane. */ | |
3994 paned = gtk_vpaned_new(); | |
3995 gtk_widget_show(paned); | |
3996 | |
3997 /* Setup the top part of the pane. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3998 vbox = gtk_vbox_new(FALSE, 6); |
4409
0521eec12c33
[gaim-migrate @ 4682]
Christian Hammond <chipx86@chipx86.com>
parents:
4398
diff
changeset
|
3999 gtk_paned_pack1(GTK_PANED(paned), vbox, TRUE, TRUE); |
4359 | 4000 gtk_widget_show(vbox); |
4001 | |
4002 /* Setup the gtkimhtml widget. */ | |
4003 gtkconv->sw = gtk_scrolled_window_new(NULL, NULL); | |
4004 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
8076 | 4005 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
4359 | 4006 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(gtkconv->sw), |
4007 GTK_SHADOW_IN); | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4008 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->sw, TRUE, TRUE, 0); |
4851 | 4009 |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
4010 gtk_widget_set_size_request(gtkconv->sw, |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
4011 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_width"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
4012 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_height")); |
8914 | 4013 g_signal_connect(G_OBJECT(gtkconv->sw), "size-allocate", |
4014 G_CALLBACK(size_allocate_cb), conv); | |
4359 | 4015 gtk_widget_show(gtkconv->sw); |
4016 | |
4017 gtkconv->imhtml = gtk_imhtml_new(NULL, NULL); | |
9005 | 4018 gtk_widget_set_name(gtkconv->imhtml, "gaim_gtkconv_imhtml"); |
4359 | 4019 gtk_container_add(GTK_CONTAINER(gtkconv->sw), gtkconv->imhtml); |
4020 | |
4021 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", | |
4022 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
8105 | 4023 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_press_event", |
6057 | 4024 G_CALLBACK(refocus_entry_cb), gtkconv); |
8109 | 4025 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_release_event", |
4026 G_CALLBACK(refocus_entry_cb), gtkconv); | |
4359 | 4027 |
4028 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4029 gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); |
4359 | 4030 gaim_setup_imhtml(gtkconv->imhtml); |
4031 gtk_widget_show(gtkconv->imhtml); | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4032 vbox2 = gtk_vbox_new(FALSE, 6); |
8914 | 4033 gtk_paned_pack2(GTK_PANED(paned), vbox2, FALSE, TRUE); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4034 gtk_widget_show(vbox2); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4035 |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4036 /* Build the toolbar. */ |
8317 | 4037 gtkconv->toolbar = gtk_imhtmltoolbar_new(); |
4038 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->toolbar, FALSE, FALSE, 0); | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4039 |
8123 | 4040 /* Setup the entry widget. |
4041 * We never show the horizontal scrollbar because it was causing weird | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4042 * lockups when typing text just as you type the character that would |
8123 | 4043 * cause both scrollbars to appear. Definitely seems like a gtk bug. |
4044 */ | |
8821 | 4045 gtkconv->entrybox = gtk_hbox_new(FALSE, 6); |
4046 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->entrybox, TRUE, TRUE, 0); | |
4047 gtk_widget_show(gtkconv->entrybox); | |
4048 | |
7949 | 4049 sw = gtk_scrolled_window_new(NULL, NULL); |
4050 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
8112 | 4051 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); |
8061 | 4052 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), |
4053 GTK_SHADOW_IN); | |
8821 | 4054 gtk_box_pack_start(GTK_BOX(gtkconv->entrybox), sw, TRUE, TRUE, 0); |
7949 | 4055 gtk_widget_show(sw); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4056 |
8061 | 4057 gtkconv->entry = gtk_imhtml_new(NULL, NULL); |
9005 | 4058 gtk_widget_set_name(gtkconv->entry, "gaim_gtkconv_entry"); |
8456 | 4059 |
4060 gtk_imhtml_smiley_shortcuts(GTK_IMHTML(gtkconv->entry), | |
4061 gaim_prefs_get_bool("/gaim/gtk/conversations/smiley_shortcuts")); | |
4062 gtk_imhtml_html_shortcuts(GTK_IMHTML(gtkconv->entry), | |
4063 gaim_prefs_get_bool("/gaim/gtk/conversations/html_shortcuts")); | |
4064 | |
4065 protocol = gaim_find_prpl(conv->account->protocol_id); | |
4066 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), | |
4067 protocol->info->name); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4068 gtkconv->entry_buffer = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4069 gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); |
8061 | 4070 gaim_setup_imhtml(gtkconv->entry); |
4071 gtk_imhtml_set_editable(GTK_IMHTML(gtkconv->entry), TRUE); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4072 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(gtkconv->entry), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4073 GTK_WRAP_WORD_CHAR); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4074 gtk_widget_set_size_request(gtkconv->entry, -1, |
8106 | 4075 gaim_prefs_get_int("/gaim/gtk/conversations/im/entry_height")); |
7949 | 4076 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
|
4077 |
4359 | 4078 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", |
8105 | 4079 G_CALLBACK(entry_key_press_cb), conv); |
4359 | 4080 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", |
4081 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
8914 | 4082 g_signal_connect(G_OBJECT(gtkconv->entry), "size-allocate", |
4083 G_CALLBACK(size_allocate_cb), conv); | |
4359 | 4084 |
4085 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "insert_text", | |
4086 G_CALLBACK(insert_text_cb), conv); | |
4087 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "delete_range", | |
4088 G_CALLBACK(delete_text_cb), conv); | |
4089 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4090 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
4091 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
4359 | 4092 |
7949 | 4093 gtk_container_add(GTK_CONTAINER(sw), GTK_WIDGET(gtkconv->entry)); |
4359 | 4094 gtk_widget_show(gtkconv->entry); |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
4095 gtk_imhtmltoolbar_attach(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), |
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
4096 gtkconv->entry); |
8481 | 4097 /* had to move this after the imtoolbar is attached so that the |
4098 * signals get fired to toggle the buttons on the toolbar as well. | |
4099 */ | |
4100 default_formatize(conv); | |
4359 | 4101 |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4102 gtkconv->bbox = gtk_hbox_new(FALSE, 6); |
4359 | 4103 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->bbox, FALSE, FALSE, 0); |
4104 gtk_widget_show(gtkconv->bbox); | |
4105 | |
4106 setup_im_buttons(conv, gtkconv->bbox); | |
8758 | 4107 gtkconv->u.im->animate = gaim_prefs_get_bool("/gaim/gtk/conversations/im/animate_buddy_icons"); |
4359 | 4108 |
9080 | 4109 /* |
4110 * Focus for IM windows should be as follows: | |
4111 * Tab title -> conversation scrollback -> entry -> buttons at bottom | |
4112 */ | |
4113 focus_chain = g_list_prepend(focus_chain, gtkconv->bbox); | |
4114 focus_chain = g_list_prepend(focus_chain, gtkconv->entrybox); | |
4115 gtk_container_set_focus_chain(GTK_CONTAINER(vbox2), focus_chain); | |
8143 | 4116 |
4359 | 4117 return paned; |
4118 } | |
4119 | |
4120 static void | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4121 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
|
4122 GtkSelectionData *sd, guint info, guint t, |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4123 GaimConversation *conv) |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4124 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4125 GaimConvWindow *win = conv->window; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4126 GaimConversation *c; |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4127 if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE)) |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4128 { |
4781 | 4129 GaimBlistNode *n = NULL; |
6695 | 4130 GaimBuddy *b; |
4781 | 4131 memcpy(&n, sd->data, sizeof(n)); |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
4132 |
6695 | 4133 if (GAIM_BLIST_NODE_IS_CONTACT(n)) |
4134 b = gaim_contact_get_priority_buddy((GaimContact*)n); | |
4135 else if (GAIM_BLIST_NODE_IS_BUDDY(n)) | |
4136 b = (GaimBuddy*)n; | |
4137 else | |
4781 | 4138 return; |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
4139 |
7089
2cd3756a637b
[gaim-migrate @ 7654]
Christian Hammond <chipx86@chipx86.com>
parents:
7078
diff
changeset
|
4140 c = gaim_conversation_new(GAIM_CONV_IM, b->account, b->name); |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
4141 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4142 gaim_conv_window_add_conversation(win, c); |
8802
1076cd8579ea
[gaim-migrate @ 9564]
Christian Hammond <chipx86@chipx86.com>
parents:
8758
diff
changeset
|
4143 |
1076cd8579ea
[gaim-migrate @ 9564]
Christian Hammond <chipx86@chipx86.com>
parents:
8758
diff
changeset
|
4144 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); |
4702 | 4145 } |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4146 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
|
4147 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4148 char *protocol = NULL; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4149 char *username = NULL; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4150 GaimAccount *account; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4151 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4152 if (gaim_gtk_parse_x_im_contact(sd->data, FALSE, &account, |
7718 | 4153 &protocol, &username, NULL)) |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4154 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4155 if (account == NULL) |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4156 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4157 gaim_notify_error(NULL, NULL, |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4158 _("You are not currently signed on with an account that " |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4159 "can add that buddy."), NULL); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4160 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4161 else |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4162 { |
7718 | 4163 c = gaim_conversation_new(GAIM_CONV_IM, account, username); |
4164 gaim_conv_window_add_conversation(win, c); | |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4165 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4166 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4167 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4168 if (username != NULL) g_free(username); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4169 if (protocol != NULL) g_free(protocol); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4170 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4171 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4172 } |
9300 | 4173 gtk_drag_finish(dc, FALSE, FALSE, t); |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4174 } |
4359 | 4175 |
4176 /************************************************************************** | |
4177 * GTK+ window ops | |
4178 **************************************************************************/ | |
4179 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4180 gaim_gtk_new_window(GaimConvWindow *win) |
4359 | 4181 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4182 GaimGtkWindow *gtkwin; |
4359 | 4183 GtkPositionType pos; |
4184 GtkWidget *testidea; | |
4185 GtkWidget *menubar; | |
4186 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4187 gtkwin = g_malloc0(sizeof(GaimGtkWindow)); |
4359 | 4188 |
4189 win->ui_data = gtkwin; | |
4190 | |
4191 /* Create the window. */ | |
4192 gtkwin->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
4193 gtk_window_set_role(GTK_WINDOW(gtkwin->window), "conversation"); | |
4635 | 4194 gtk_window_set_resizable(GTK_WINDOW(gtkwin->window), TRUE); |
4510
4c394222c732
[gaim-migrate @ 4786]
Christian Hammond <chipx86@chipx86.com>
parents:
4505
diff
changeset
|
4195 gtk_container_set_border_width(GTK_CONTAINER(gtkwin->window), 0); |
5173 | 4196 GTK_WINDOW(gtkwin->window)->allow_shrink = TRUE; |
4359 | 4197 gtk_widget_realize(gtkwin->window); |
4198 | |
4199 g_signal_connect(G_OBJECT(gtkwin->window), "delete_event", | |
4200 G_CALLBACK(close_win_cb), win); | |
4201 | |
4202 /* Create the notebook. */ | |
4203 gtkwin->notebook = gtk_notebook_new(); | |
4204 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4205 pos = gaim_prefs_get_int("/gaim/gtk/conversations/tab_side"); |
4359 | 4206 |
4207 #if 0 | |
4208 gtk_notebook_set_tab_hborder(GTK_NOTEBOOK(gtkwin->notebook), 0); | |
4209 gtk_notebook_set_tab_vborder(GTK_NOTEBOOK(gtkwin->notebook), 0); | |
4210 #endif | |
4211 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos); | |
4212 gtk_notebook_set_scrollable(GTK_NOTEBOOK(gtkwin->notebook), TRUE); | |
4213 gtk_notebook_popup_enable(GTK_NOTEBOOK(gtkwin->notebook)); | |
4818 | 4214 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), FALSE); |
4215 | |
4359 | 4216 gtk_widget_show(gtkwin->notebook); |
4217 | |
8189 | 4218 g_signal_connect(G_OBJECT(gtkwin->notebook), "switch_page", |
4219 G_CALLBACK(before_switch_conv_cb), win); | |
4359 | 4220 g_signal_connect_after(G_OBJECT(gtkwin->notebook), "switch_page", |
4221 G_CALLBACK(switch_conv_cb), win); | |
4222 | |
4223 /* Setup the tab drag and drop signals. */ | |
4486 | 4224 gtk_widget_add_events(gtkwin->notebook, |
4225 GDK_BUTTON1_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK); | |
4226 g_signal_connect(G_OBJECT(gtkwin->notebook), "button_press_event", | |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4227 G_CALLBACK(notebook_press_cb), win); |
4486 | 4228 g_signal_connect(G_OBJECT(gtkwin->notebook), "button_release_event", |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4229 G_CALLBACK(notebook_release_cb), win); |
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4230 |
4359 | 4231 testidea = gtk_vbox_new(FALSE, 0); |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4232 |
4359 | 4233 /* Setup the menubar. */ |
4234 menubar = setup_menubar(win); | |
4235 gtk_box_pack_start(GTK_BOX(testidea), menubar, FALSE, TRUE, 0); | |
4236 | |
4237 gtk_box_pack_start(GTK_BOX(testidea), gtkwin->notebook, TRUE, TRUE, 0); | |
4238 | |
4239 gtk_container_add(GTK_CONTAINER(gtkwin->window), testidea); | |
4240 | |
4241 gtk_widget_show(testidea); | |
4242 } | |
4243 | |
4244 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4245 gaim_gtk_destroy_window(GaimConvWindow *win) |
4359 | 4246 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4247 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4248 |
4249 gtk_widget_destroy(gtkwin->window); | |
4250 | |
4630 | 4251 g_object_unref(G_OBJECT(gtkwin->menu.item_factory)); |
4252 | |
4359 | 4253 g_free(gtkwin); |
4254 win->ui_data = NULL; | |
4255 } | |
4256 | |
4257 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4258 gaim_gtk_show(GaimConvWindow *win) |
4359 | 4259 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4260 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4261 |
4262 gtk_widget_show(gtkwin->window); | |
7413 | 4263 |
4264 #ifdef _WIN32 | |
7415 | 4265 /* This works around a win32 gtk+ bug, where it can't handle |
4266 * creating the button correctly before the window is shown. | |
4267 * That's why we get the appearance of a button, without all | |
4268 * the normal button-like properties, like being able to click | |
7413 | 4269 * it. ;-) --Nathan */ |
7414 | 4270 if (gaim_prefs_get_bool("/gaim/gtk/conversations/close_on_tabs")) { |
4271 GaimConversation *conv; | |
4272 GaimGtkConversation *gtkconv; | |
4273 | |
4274 conv = gaim_conv_window_get_conversation_at(win, 0); | |
4275 if(conv) { | |
4276 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7415 | 4277 gtk_widget_hide(gtkconv->close); |
7414 | 4278 gtk_widget_show_all(gtkconv->close); |
4279 } | |
4280 } | |
7413 | 4281 #endif |
4359 | 4282 } |
4283 | |
4284 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4285 gaim_gtk_hide(GaimConvWindow *win) |
4359 | 4286 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4287 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4288 |
4289 gtk_widget_hide(gtkwin->window); | |
4290 } | |
4291 | |
4292 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4293 gaim_gtk_raise(GaimConvWindow *win) |
4359 | 4294 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4295 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4296 |
5484 | 4297 gtk_widget_show(gtkwin->window); |
5103 | 4298 gtk_window_deiconify(GTK_WINDOW(gtkwin->window)); |
4526 | 4299 gdk_window_raise(gtkwin->window->window); |
4359 | 4300 } |
4301 | |
4302 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4303 gaim_gtk_flash(GaimConvWindow *win) |
4359 | 4304 { |
4305 #ifdef _WIN32 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4306 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4307 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4308 wgaim_conv_im_blink(gtkwin->window); |
4359 | 4309 #endif |
4310 } | |
4311 | |
4312 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4313 gaim_gtk_switch_conversation(GaimConvWindow *win, unsigned int index) |
4359 | 4314 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4315 GaimGtkWindow *gtkwin; |
4359 | 4316 |
4317 gtkwin = GAIM_GTK_WINDOW(win); | |
4318 | |
4319 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), index); | |
4320 } | |
4321 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4322 static const GtkTargetEntry te[] = |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4323 { |
7695 | 4324 {"text/plain", 0, 0}, |
4325 {"text/uri-list", 0, 1}, | |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4326 {"GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, 2}, |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4327 {"STRING", 0, 3}, |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4328 {"application/x-im-contact", 0, 4} |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4329 }; |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4330 |
4359 | 4331 static void |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4332 gaim_gtk_add_conversation(GaimConvWindow *win, GaimConversation *conv) |
4359 | 4333 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4334 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4335 GaimGtkConversation *gtkconv, *focus_gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4336 GaimConversation *focus_conv; |
4359 | 4337 GtkWidget *pane = NULL; |
4338 GtkWidget *tab_cont; | |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4339 GtkWidget *tabby, *menu_tabby; |
4359 | 4340 gboolean new_ui; |
4383
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4341 GaimConversationType conv_type; |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4342 const char *name; |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4343 |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4344 name = gaim_conversation_get_name(conv); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4345 conv_type = gaim_conversation_get_type(conv); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4346 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4347 |
4348 if (conv->ui_data != NULL) { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4349 gtkconv = (GaimGtkConversation *)conv->ui_data; |
4359 | 4350 |
4351 tab_cont = gtkconv->tab_cont; | |
4352 | |
4353 new_ui = FALSE; | |
4354 } | |
4355 else { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4356 gtkconv = g_malloc0(sizeof(GaimGtkConversation)); |
4359 | 4357 conv->ui_data = gtkconv; |
4358 | |
4359 /* Setup some initial variables. */ | |
4360 gtkconv->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
4361 gtkconv->tooltips = gtk_tooltips_new(); | |
4362 | |
7879 | 4363 if (conv_type == GAIM_CONV_IM) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4364 gtkconv->u.im = g_malloc0(sizeof(GaimGtkImPane)); |
4359 | 4365 gtkconv->u.im->a_virgin = TRUE; |
4366 | |
4367 pane = setup_im_pane(conv); | |
4368 } | |
7879 | 4369 else if (conv_type == GAIM_CONV_CHAT) { |
4370 gtkconv->u.chat = g_malloc0(sizeof(GaimGtkChatPane)); | |
4371 | |
4372 pane = setup_chat_pane(conv); | |
4373 } | |
4359 | 4374 |
4375 if (pane == NULL) { | |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4376 if (conv_type == GAIM_CONV_CHAT) g_free(gtkconv->u.chat); |
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4377 else if (conv_type == GAIM_CONV_IM) g_free(gtkconv->u.im); |
4359 | 4378 |
4379 g_free(gtkconv); | |
4380 conv->ui_data = NULL; | |
4381 | |
4382 return; | |
4383 } | |
4384 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4385 /* Setup drag-and-drop */ |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4386 gtk_drag_dest_set(pane, |
9300 | 4387 GTK_DEST_DEFAULT_MOTION | |
4388 GTK_DEST_DEFAULT_DROP, | |
4389 te, sizeof(te) / sizeof(GtkTargetEntry), | |
4390 GDK_ACTION_COPY); | |
4391 gtk_drag_dest_set(pane, | |
4392 GTK_DEST_DEFAULT_MOTION | | |
4393 GTK_DEST_DEFAULT_DROP, | |
4394 te, sizeof(te) / sizeof(GtkTargetEntry), | |
4395 GDK_ACTION_COPY); | |
4396 gtk_drag_dest_set(gtkconv->imhtml, 0, | |
4397 te, sizeof(te) / sizeof(GtkTargetEntry), | |
4398 GDK_ACTION_COPY); | |
4399 | |
4400 gtk_drag_dest_set(gtkconv->entry, 0, | |
4401 te, sizeof(te) / sizeof(GtkTargetEntry), | |
4402 GDK_ACTION_COPY); | |
4403 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4404 g_signal_connect(G_OBJECT(pane), "drag_data_received", |
9300 | 4405 G_CALLBACK(conv_dnd_recv), conv); |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4406 g_signal_connect(G_OBJECT(gtkconv->imhtml), "drag_data_received", |
9300 | 4407 G_CALLBACK(conv_dnd_recv), conv); |
8105 | 4408 g_signal_connect(G_OBJECT(gtkconv->entry), "drag_data_received", |
9300 | 4409 G_CALLBACK(conv_dnd_recv), conv); |
4410 | |
4359 | 4411 /* Setup the container for the tab. */ |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4412 gtkconv->tab_cont = tab_cont = gtk_vbox_new(FALSE, 6); |
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4413 gtk_container_set_border_width(GTK_CONTAINER(tab_cont), 6); |
4359 | 4414 gtk_container_add(GTK_CONTAINER(tab_cont), pane); |
4415 gtk_widget_show(pane); | |
4416 | |
4417 new_ui = TRUE; | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
4418 |
4359 | 4419 gtkconv->make_sound = TRUE; |
5902
6889b89cab90
[gaim-migrate @ 6334]
Christian Hammond <chipx86@chipx86.com>
parents:
5901
diff
changeset
|
4420 |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4421 gtkconv->show_formatting_toolbar = gaim_prefs_get_bool( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4422 "/gaim/gtk/conversations/show_formatting_toolbar"); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4423 |
8329
9dd7c75ed433
[gaim-migrate @ 9053]
Christian Hammond <chipx86@chipx86.com>
parents:
8319
diff
changeset
|
4424 if (gtkconv->show_formatting_toolbar) |
9dd7c75ed433
[gaim-migrate @ 9053]
Christian Hammond <chipx86@chipx86.com>
parents:
8319
diff
changeset
|
4425 gtk_widget_show(gtkconv->toolbar); |
9dd7c75ed433
[gaim-migrate @ 9053]
Christian Hammond <chipx86@chipx86.com>
parents:
8319
diff
changeset
|
4426 |
9188 | 4427 gtkconv->show_timestamps = gaim_prefs_get_bool( |
4428 "/gaim/gtk/conversations/show_timestamps"); | |
4429 | |
4430 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
4431 gtkconv->show_timestamps); | |
4432 | |
8176 | 4433 g_signal_connect_swapped(G_OBJECT(pane), "focus", |
9080 | 4434 G_CALLBACK(gtk_widget_grab_focus), |
4435 gtkconv->entry); | |
4359 | 4436 } |
4437 | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4438 gtkconv->tabby = tabby = gtk_hbox_new(FALSE, 6); |
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4439 gtkconv->menu_tabby = menu_tabby = gtk_hbox_new(FALSE, 6); |
4359 | 4440 |
4441 /* Close button. */ | |
4442 gtkconv->close = gtk_button_new(); | |
4443 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
|
4444 gtk_button_set_relief(GTK_BUTTON(gtkconv->close), GTK_RELIEF_NONE); |
4359 | 4445 gtk_container_add(GTK_CONTAINER(gtkconv->close), |
4445 | 4446 gtk_image_new_from_stock(GTK_STOCK_CLOSE, |
4447 GTK_ICON_SIZE_MENU)); | |
4359 | 4448 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->close, |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4449 _("Close conversation"), NULL); |
4359 | 4450 |
4451 g_signal_connect(G_OBJECT(gtkconv->close), "clicked", | |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4452 G_CALLBACK(close_conv_cb), conv); |
4359 | 4453 |
7446
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4454 /* |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4455 * 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
|
4456 * border bug. I love you guys! -- ChipX86 |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4457 */ |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4458 g_signal_connect(G_OBJECT(gtkconv->close), "state_changed", |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4459 G_CALLBACK(tab_close_button_state_changed_cb), NULL); |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4460 |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4461 /* Status icon. */ |
6440 | 4462 gtkconv->icon = gtk_image_new(); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4463 gtkconv->menu_icon = gtk_image_new(); |
6440 | 4464 update_tab_icon(conv); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4465 |
4359 | 4466 /* Tab label. */ |
4467 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
|
4468 gtkconv->menu_label = gtk_label_new(gaim_conversation_get_title(conv)); |
4359 | 4469 #if 0 |
4470 gtk_misc_set_alignment(GTK_MISC(gtkconv->tab_label), 0.00, 0.5); | |
4471 gtk_misc_set_padding(GTK_MISC(gtkconv->tab_label), 4, 0); | |
4472 #endif | |
4473 | |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
4474 |
4359 | 4475 /* Pack it all together. */ |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4476 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
|
4477 gtk_box_pack_start(GTK_BOX(menu_tabby), gtkconv->menu_icon, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4478 FALSE, FALSE, 0); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4479 |
8946 | 4480 gtk_widget_show_all(gtkconv->icon); |
4481 gtk_widget_show_all(gtkconv->menu_icon); | |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4482 |
4359 | 4483 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
|
4484 gtk_box_pack_start(GTK_BOX(menu_tabby), gtkconv->menu_label, TRUE, TRUE, 0); |
4445 | 4485 gtk_widget_show(gtkconv->tab_label); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4486 gtk_widget_show(gtkconv->menu_label); |
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4487 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
|
4488 |
4445 | 4489 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
|
4490 if (gaim_prefs_get_bool("/gaim/gtk/conversations/close_on_tabs")) |
4445 | 4491 gtk_widget_show_all(gtkconv->close); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4492 |
4445 | 4493 gtk_widget_show(tabby); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4494 gtk_widget_show(menu_tabby); |
4359 | 4495 |
7143 | 4496 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
4497 gaim_gtkconv_update_buddy_icon(conv); | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4498 |
9297 | 4499 /* Add this pane to the conversation's notebook. */ |
4359 | 4500 gtk_notebook_append_page(GTK_NOTEBOOK(gtkwin->notebook), tab_cont, tabby); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4501 gtk_notebook_set_menu_label(GTK_NOTEBOOK(gtkwin->notebook), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4502 tab_cont, menu_tabby); |
4359 | 4503 |
4504 gtk_widget_show(tab_cont); | |
4505 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4506 if (gaim_conv_window_get_conversation_count(win) == 1) { |
4818 | 4507 /* Er, bug in notebooks? Switch to the page manually. */ |
4359 | 4508 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), 0); |
4851 | 4509 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4510 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4511 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4512 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4513 else |
4818 | 4514 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), TRUE); |
4359 | 4515 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4516 focus_conv = g_list_nth_data(gaim_conv_window_get_conversations(win), |
5204 | 4517 gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook))); |
4518 focus_gtkconv = GAIM_GTK_CONVERSATION(focus_conv); | |
4519 gtk_widget_grab_focus(focus_gtkconv->entry); | |
4359 | 4520 |
4521 if (!new_ui) | |
4522 g_object_unref(gtkconv->tab_cont); | |
4523 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4524 if (gaim_conv_window_get_conversation_count(win) == 1) |
4685 | 4525 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); |
4359 | 4526 } |
4527 | |
4528 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4529 gaim_gtk_remove_conversation(GaimConvWindow *win, GaimConversation *conv) |
4359 | 4530 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4531 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4532 GaimGtkConversation *gtkconv; |
4359 | 4533 unsigned int index; |
4818 | 4534 GaimConversationType conv_type; |
4535 | |
4536 conv_type = gaim_conversation_get_type(conv); | |
4359 | 4537 index = gaim_conversation_get_index(conv); |
4538 | |
4539 gtkwin = GAIM_GTK_WINDOW(win); | |
4540 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4541 | |
4542 g_object_ref(gtkconv->tab_cont); | |
4543 gtk_object_sink(GTK_OBJECT(gtkconv->tab_cont)); | |
4544 | |
4545 gtk_notebook_remove_page(GTK_NOTEBOOK(gtkwin->notebook), index); | |
4546 | |
4818 | 4547 /* go back to tabless if need be */ |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4548 if (gaim_conv_window_get_conversation_count(win) <= 2) { |
4818 | 4549 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4550 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); |
4818 | 4551 } |
4552 | |
4553 | |
4359 | 4554 /* If this window is setup with an inactive gc, regenerate the menu. */ |
4818 | 4555 if (conv_type == GAIM_CONV_IM && |
4359 | 4556 gaim_conversation_get_gc(conv) == NULL) { |
4557 | |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
4558 generate_send_as_items(win, conv); |
4359 | 4559 } |
4560 } | |
4561 | |
4562 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4563 gaim_gtk_move_conversation(GaimConvWindow *win, GaimConversation *conv, |
4359 | 4564 unsigned int new_index) |
4565 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4566 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4567 GaimGtkConversation *gtkconv; |
4359 | 4568 |
4569 gtkwin = GAIM_GTK_WINDOW(win); | |
4570 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4571 | |
4415
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4572 if (new_index > gaim_conversation_get_index(conv)) |
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4573 new_index--; |
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4574 |
4359 | 4575 gtk_notebook_reorder_child(GTK_NOTEBOOK(gtkwin->notebook), |
4576 gtkconv->tab_cont, new_index); | |
4577 } | |
4578 | |
4579 static int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4580 gaim_gtk_get_active_index(const GaimConvWindow *win) |
4359 | 4581 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4582 GaimGtkWindow *gtkwin; |
5680
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4583 int index; |
4359 | 4584 |
4585 gtkwin = GAIM_GTK_WINDOW(win); | |
4586 | |
5680
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4587 index = gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook)); |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4588 |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4589 /* |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4590 * A fix, because the first conversation may be active, but not |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4591 * appear in the notebook just yet. -- ChipX86 |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4592 */ |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4593 return (index == -1 ? 0 : index); |
4359 | 4594 } |
4595 | |
9260
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4596 static gboolean |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4597 gaim_gtk_has_focus(GaimConvWindow *win) |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4598 { |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4599 GaimGtkWindow *gtkwin; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4600 gboolean has_focus = FALSE; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4601 |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4602 gtkwin = GAIM_GTK_WINDOW(win); |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4603 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
|
4604 |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4605 return has_focus; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4606 } |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4607 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4608 static GaimConvWindowUiOps window_ui_ops = |
4359 | 4609 { |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
4610 gaim_gtk_conversations_get_conv_ui_ops, |
4359 | 4611 gaim_gtk_new_window, |
4612 gaim_gtk_destroy_window, | |
4613 gaim_gtk_show, | |
4614 gaim_gtk_hide, | |
4615 gaim_gtk_raise, | |
4616 gaim_gtk_flash, | |
4617 gaim_gtk_switch_conversation, | |
4618 gaim_gtk_add_conversation, | |
4619 gaim_gtk_remove_conversation, | |
4620 gaim_gtk_move_conversation, | |
9260
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4621 gaim_gtk_get_active_index, |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4622 gaim_gtk_has_focus |
4359 | 4623 }; |
4624 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4625 GaimConvWindowUiOps * |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
4626 gaim_gtk_conversations_get_win_ui_ops(void) |
4359 | 4627 { |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4628 return &window_ui_ops; |
4359 | 4629 } |
4630 | |
4631 /************************************************************************** | |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4632 * Conversation UI operations |
4359 | 4633 **************************************************************************/ |
4634 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4635 gaim_gtkconv_destroy(GaimConversation *conv) |
4359 | 4636 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4637 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); |
4359 | 4638 |
4639 if (gtkconv->dialogs.log != NULL) | |
4640 gtk_widget_destroy(gtkconv->dialogs.log); | |
4641 | |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4642 gtk_widget_destroy(gtkconv->tab_cont); |
4892 | 4643 g_object_unref(gtkconv->tab_cont); |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4644 |
4359 | 4645 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
4755 | 4646 if (gtkconv->u.im->icon_timer != 0) |
4647 g_source_remove(gtkconv->u.im->icon_timer); | |
4648 | |
4359 | 4649 if (gtkconv->u.im->save_icon != NULL) |
4650 gtk_widget_destroy(gtkconv->u.im->save_icon); | |
4651 | |
4652 if (gtkconv->u.im->anim != NULL) | |
4793 | 4653 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); |
4359 | 4654 |
4655 g_free(gtkconv->u.im); | |
4656 } | |
4657 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
4658 g_free(gtkconv->u.chat); | |
4659 } | |
4660 | |
4633 | 4661 gtk_object_sink(GTK_OBJECT(gtkconv->tooltips)); |
4662 | |
4359 | 4663 g_free(gtkconv); |
4664 } | |
4665 | |
4666 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4667 gaim_gtkconv_write_im(GaimConversation *conv, const char *who, |
6982 | 4668 const char *message, GaimMessageFlags flags, |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4669 time_t mtime) |
4359 | 4670 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4671 GaimGtkConversation *gtkconv; |
8630 | 4672 GaimConvWindow *gaimwin; |
4673 GaimGtkWindow *gtkwin; | |
4674 gboolean has_focus; | |
4359 | 4675 |
4676 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
8630 | 4677 gaimwin = gaim_conversation_get_window(conv); |
4678 gtkwin = GAIM_GTK_WINDOW(gaimwin); | |
4679 | |
4680 g_object_get(G_OBJECT(gtkwin->window), "has-toplevel-focus", &has_focus, NULL); | |
4359 | 4681 |
6621 | 4682 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
9301 | 4683 gaim_prefs_get_bool("/gaim/gtk/conversations/im/raise_on_events")) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4684 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4685 gaim_conv_window_raise(gaim_conversation_get_window(conv)); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4686 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4687 |
4382
76223649765b
[gaim-migrate @ 4648]
Christian Hammond <chipx86@chipx86.com>
parents:
4378
diff
changeset
|
4688 /* Play a sound, if specified in prefs. */ |
8630 | 4689 if (gtkconv->make_sound && !((gaim_conv_window_get_active_conversation(gaimwin) == conv) && |
8633 | 4690 !gaim_prefs_get_bool("/gaim/gtk/sound/conv_focus") && has_focus)) { |
6621 | 4691 if (flags & GAIM_MESSAGE_RECV) { |
4359 | 4692 if (gtkconv->u.im->a_virgin && |
5820 | 4693 gaim_prefs_get_bool("/gaim/gtk/sound/enabled/first_im_recv")) { |
4359 | 4694 |
4561 | 4695 gaim_sound_play_event(GAIM_SOUND_FIRST_RECEIVE); |
4359 | 4696 } |
4697 else | |
4561 | 4698 gaim_sound_play_event(GAIM_SOUND_RECEIVE); |
4359 | 4699 } |
4700 else { | |
4561 | 4701 gaim_sound_play_event(GAIM_SOUND_SEND); |
4359 | 4702 } |
4703 } | |
4704 | |
4705 gtkconv->u.im->a_virgin = FALSE; | |
4706 | |
6982 | 4707 gaim_conversation_write(conv, who, message, flags, mtime); |
4359 | 4708 } |
4709 | |
4710 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4711 gaim_gtkconv_write_chat(GaimConversation *conv, const char *who, |
6621 | 4712 const char *message, GaimMessageFlags flags, time_t mtime) |
4359 | 4713 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4714 GaimGtkConversation *gtkconv; |
8630 | 4715 GaimConvWindow *gaimwin; |
4716 GaimGtkWindow *gtkwin; | |
4717 gboolean has_focus; | |
4359 | 4718 |
4719 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
8630 | 4720 gaimwin = gaim_conversation_get_window(conv); |
4721 gtkwin = GAIM_GTK_WINDOW(gaimwin); | |
4722 | |
4723 g_object_get(G_OBJECT(gtkwin->window), "has-toplevel-focus", &has_focus, NULL); | |
4359 | 4724 |
4382
76223649765b
[gaim-migrate @ 4648]
Christian Hammond <chipx86@chipx86.com>
parents:
4378
diff
changeset
|
4725 /* Play a sound, if specified in prefs. */ |
8630 | 4726 if (gtkconv->make_sound && !((gaim_conv_window_get_active_conversation(gaimwin) == conv) && |
8633 | 4727 !gaim_prefs_get_bool("/gaim/gtk/sound/conv_focus") && has_focus)) { |
6621 | 4728 if (!(flags & GAIM_MESSAGE_WHISPER) && (flags & GAIM_MESSAGE_SEND)) |
4561 | 4729 gaim_sound_play_event(GAIM_SOUND_CHAT_YOU_SAY); |
6621 | 4730 else if (flags & GAIM_MESSAGE_RECV) { |
4731 if ((flags & GAIM_MESSAGE_NICK) && | |
8573 | 4732 gaim_prefs_get_bool("/gaim/gtk/sound/enabled/nick_said") && |
4733 !(flags & GAIM_MESSAGE_SYSTEM)) { | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4734 |
4561 | 4735 gaim_sound_play_event(GAIM_SOUND_CHAT_NICK); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4736 } |
4359 | 4737 else |
4561 | 4738 gaim_sound_play_event(GAIM_SOUND_CHAT_SAY); |
4359 | 4739 } |
4740 } | |
4741 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4742 if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/color_nicks")) |
6621 | 4743 flags |= GAIM_MESSAGE_COLORIZE; |
4359 | 4744 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4745 /* Raise the window, if specified in prefs. */ |
6621 | 4746 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
9150 | 4747 /* we may want to change this */ |
9301 | 4748 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4749 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4750 gaim_conv_window_raise(gaim_conversation_get_window(conv)); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4751 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4752 |
6982 | 4753 gaim_conversation_write(conv, who, message, flags, mtime); |
4359 | 4754 } |
4755 | |
4756 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4757 gaim_gtkconv_write_conv(GaimConversation *conv, const char *who, |
6982 | 4758 const char *message, GaimMessageFlags flags, |
4359 | 4759 time_t mtime) |
4760 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4761 GaimGtkConversation *gtkconv; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4762 GaimConvWindow *win; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
4763 GaimConnection *gc; |
4359 | 4764 int gtk_font_options = 0; |
7440 | 4765 char buf[BUF_LONG]; |
4359 | 4766 char buf2[BUF_LONG]; |
4767 char mdate[64]; | |
4768 char color[10]; | |
4769 char *str; | |
4770 char *with_font_tag; | |
4896 | 4771 char *sml_attrib = NULL; |
6982 | 4772 size_t length = strlen(message) + 1; |
4895 | 4773 |
4359 | 4774 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4775 gc = gaim_conversation_get_gc(conv); | |
4776 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4777 win = gaim_conversation_get_window(conv); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4778 |
9301 | 4779 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
4780 ((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT && | |
4781 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) || | |
4782 (gaim_conversation_get_type(conv) == GAIM_CONV_IM && | |
4783 gaim_prefs_get_bool("/gaim/gtk/conversations/im/raise_on_events")))) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4784 gaim_conv_window_show(win); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4785 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4786 |
8677 | 4787 if (gtk_text_buffer_get_char_count(gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)))) |
4788 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", 0); | |
4789 | |
5133 | 4790 if(time(NULL) > mtime + 20*60) /* show date if older than 20 minutes */ |
4791 strftime(mdate, sizeof(mdate), "%Y-%m-%d %H:%M:%S", localtime(&mtime)); | |
4792 else | |
4793 strftime(mdate, sizeof(mdate), "%H:%M:%S", localtime(&mtime)); | |
4359 | 4794 |
4896 | 4795 if(gc) |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4796 sml_attrib = g_strdup_printf("sml=\"%s\"", gc->prpl->info->name); |
7440 | 4797 |
4359 | 4798 gtk_font_options ^= GTK_IMHTML_NO_COMMENTS; |
4799 | |
9049 | 4800 #if 1 /* PREFSLASH04 */ |
4801 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_colors")) | |
4802 gtk_font_options ^= GTK_IMHTML_NO_COLOURS; | |
4803 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_fonts")) | |
4804 gtk_font_options ^= GTK_IMHTML_NO_FONTS; | |
4805 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_font_sizes")) | |
4806 gtk_font_options ^= GTK_IMHTML_NO_SIZES; | |
4807 #else | |
8944 | 4808 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_formatting")) { |
4359 | 4809 gtk_font_options ^= GTK_IMHTML_NO_COLOURS; |
4810 gtk_font_options ^= GTK_IMHTML_NO_FONTS; | |
4811 gtk_font_options ^= GTK_IMHTML_NO_SIZES; | |
8944 | 4812 } |
9049 | 4813 #endif |
4359 | 4814 |
7956 | 4815 /* this is gonna crash one day, I can feel it. */ |
4816 if (GAIM_PLUGIN_PROTOCOL_INFO(gaim_find_prpl(gaim_account_get_protocol_id(conv->account)))->options & | |
7431 | 4817 OPT_PROTO_USE_POINTSIZE) { |
5367 | 4818 gtk_font_options ^= GTK_IMHTML_USE_POINTSIZE; |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4819 } |
4359 | 4820 |
6621 | 4821 if (flags & GAIM_MESSAGE_SYSTEM) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4822 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) |
8380 | 4823 g_snprintf(buf, BUF_LONG, "<FONT SIZE=\"2\">(%s)</FONT> <B>%s</B>", |
7431 | 4824 mdate, message); |
4359 | 4825 else |
4826 g_snprintf(buf, BUF_LONG, "<B>%s</B>", message); | |
7440 | 4827 |
4359 | 4828 g_snprintf(buf2, sizeof(buf2), |
8690 | 4829 "<FONT %s><FONT SIZE=\"2\"><!--(%s) --></FONT><B>%s</B></FONT>", |
7850 | 4830 sml_attrib, mdate, message); |
7440 | 4831 |
8962 | 4832 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, 0); |
7440 | 4833 |
7583 | 4834 /* Add the message to a conversations scrollback buffer */ |
4835 conv->history = g_string_append(conv->history, buf); | |
4836 conv->history = g_string_append(conv->history, "<BR>\n"); | |
7440 | 4837 |
8722 | 4838 } else if (flags & GAIM_MESSAGE_ERROR) { |
4839 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) | |
4840 g_snprintf(buf, BUF_LONG, "<FONT SIZE=\"2\">(%s)</FONT> <B>%s</B>", | |
4841 mdate, message); | |
4842 else | |
4843 g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"#ff0000\"><B>%s</B></FONT>", message); | |
4844 | |
4845 g_snprintf(buf2, sizeof(buf2), | |
4846 "<FONT %s><FONT SIZE=\"2\"><!--(%s) --></FONT><B>%s</B></FONT>", | |
4847 sml_attrib, mdate, message); | |
4848 | |
8962 | 4849 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, 0); |
4850 | |
8722 | 4851 /* Add the message to a conversations scrollback buffer */ |
4852 conv->history = g_string_append(conv->history, buf); | |
4853 conv->history = g_string_append(conv->history, "<BR>\n"); | |
7431 | 4854 } else if (flags & GAIM_MESSAGE_NO_LOG) { |
4359 | 4855 g_snprintf(buf, BUF_LONG, |
8690 | 4856 "<B><FONT %s COLOR=\"#777777\">%s</FONT></B>", |
7850 | 4857 sml_attrib, message); |
7440 | 4858 |
8962 | 4859 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf, 0); |
4359 | 4860 } |
4861 else { | |
4895 | 4862 char *new_message = g_memdup(message, length); |
8908 | 4863 char *who_escaped = g_markup_escape_text(who, strlen(who)); |
7440 | 4864 |
6621 | 4865 if (flags & GAIM_MESSAGE_WHISPER) { |
4359 | 4866 str = g_malloc(1024); |
7440 | 4867 |
4359 | 4868 /* If we're whispering, it's not an autoresponse. */ |
7564 | 4869 if (gaim_message_meify(new_message, length)) { |
8908 | 4870 g_snprintf(str, 1024, "***%s", who_escaped); |
4359 | 4871 strcpy(color, "#6C2585"); |
4872 } | |
4873 else { | |
8908 | 4874 g_snprintf(str, 1024, "*%s*:", who_escaped); |
4359 | 4875 strcpy(color, "#00FF00"); |
4876 } | |
7440 | 4877 } |
4359 | 4878 else { |
7564 | 4879 if (gaim_message_meify(new_message, length)) { |
4359 | 4880 str = g_malloc(1024); |
7440 | 4881 |
6621 | 4882 if (flags & GAIM_MESSAGE_AUTO_RESP) |
8908 | 4883 g_snprintf(str, 1024, "%s ***%s", AUTO_RESPONSE, who_escaped); |
4359 | 4884 else |
8908 | 4885 g_snprintf(str, 1024, "***%s", who_escaped); |
7440 | 4886 |
6621 | 4887 if (flags & GAIM_MESSAGE_NICK) |
4359 | 4888 strcpy(color, "#AF7F00"); |
4889 else | |
4890 strcpy(color, "#062585"); | |
4891 } | |
4892 else { | |
4893 str = g_malloc(1024); | |
6621 | 4894 if (flags & GAIM_MESSAGE_AUTO_RESP) |
8908 | 4895 g_snprintf(str, 1024, "%s %s", who_escaped, AUTO_RESPONSE); |
4359 | 4896 else |
8908 | 4897 g_snprintf(str, 1024, "%s:", who_escaped); |
6621 | 4898 if (flags & GAIM_MESSAGE_NICK) |
4359 | 4899 strcpy(color, "#AF7F00"); |
6621 | 4900 else if (flags & GAIM_MESSAGE_RECV) { |
4901 if (flags & GAIM_MESSAGE_COLORIZE) { | |
4359 | 4902 const char *u; |
4903 int m = 0; | |
7440 | 4904 |
4359 | 4905 for (u = who; *u != '\0'; u++) |
4906 m += *u; | |
7440 | 4907 |
4359 | 4908 m = m % NUM_NICK_COLORS; |
7440 | 4909 |
4359 | 4910 strcpy(color, nick_colors[m]); |
4911 } | |
4912 else | |
7854 | 4913 strcpy(color, RECV_COLOR); |
4359 | 4914 } |
6621 | 4915 else if (flags & GAIM_MESSAGE_SEND) |
7854 | 4916 strcpy(color, SEND_COLOR); |
4359 | 4917 } |
8908 | 4918 |
4919 if(who_escaped) | |
4920 g_free(who_escaped); | |
4359 | 4921 } |
7440 | 4922 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4923 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) |
4359 | 4924 g_snprintf(buf, BUF_LONG, |
8380 | 4925 "<FONT COLOR=\"%s\" %s><FONT SIZE=\"2\">(%s)</FONT> " |
7431 | 4926 "<B>%s</B></FONT> ", color, |
4927 sml_attrib ? sml_attrib : "", mdate, str); | |
4359 | 4928 else |
4929 g_snprintf(buf, BUF_LONG, | |
7431 | 4930 "<FONT COLOR=\"%s\" %s><B>%s</B></FONT> ", color, |
4931 sml_attrib ? sml_attrib : "", str); | |
7440 | 4932 |
4359 | 4933 g_snprintf(buf2, BUF_LONG, |
8380 | 4934 "<FONT COLOR=\"%s\" %s><FONT SIZE=\"2\"><!--(%s) --></FONT>" |
7431 | 4935 "<B>%s</B></FONT> ", |
4936 color, sml_attrib ? sml_attrib : "", mdate, str); | |
7440 | 4937 |
4359 | 4938 g_free(str); |
4939 | |
8962 | 4940 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), |
4941 buf2, 0); | |
4359 | 4942 |
4895 | 4943 if(gc){ |
4896 | 4944 char *pre = g_strdup_printf("<font %s>", sml_attrib ? sml_attrib : ""); |
4895 | 4945 char *post = "</font>"; |
4946 int pre_len = strlen(pre); | |
4947 int post_len = strlen(post); | |
7440 | 4948 |
4895 | 4949 with_font_tag = g_malloc(length + pre_len + post_len + 1); |
7440 | 4950 |
4895 | 4951 strcpy(with_font_tag, pre); |
4952 memcpy(with_font_tag + pre_len, new_message, length); | |
4953 strcpy(with_font_tag + pre_len + length, post); | |
7440 | 4954 |
4895 | 4955 length += pre_len + post_len; |
4956 g_free(pre); | |
4957 } | |
4608 | 4958 else |
4895 | 4959 with_font_tag = g_memdup(new_message, length); |
7440 | 4960 |
8962 | 4961 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), |
4962 with_font_tag, gtk_font_options); | |
7440 | 4963 |
8557 | 4964 conv->history = g_string_append(conv->history, buf); |
4965 conv->history = g_string_append(conv->history, new_message); | |
4966 conv->history = g_string_append(conv->history, "<BR>\n"); | |
7440 | 4967 |
4968 g_free(with_font_tag); | |
7447 | 4969 g_free(new_message); |
7440 | 4970 } |
4971 | |
6062 | 4972 |
5012 | 4973 if(sml_attrib) |
4974 g_free(sml_attrib); | |
4359 | 4975 } |
4976 | |
4977 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4978 gaim_gtkconv_chat_add_user(GaimConversation *conv, const char *user) |
4359 | 4979 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4980 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4981 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4982 GaimGtkChatPane *gtkchat; |
4359 | 4983 char tmp[BUF_LONG]; |
4984 int num_users; | |
4985 int pos; | |
4986 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4987 chat = GAIM_CONV_CHAT(conv); |
4359 | 4988 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4989 gtkchat = gtkconv->u.chat; | |
4990 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4991 num_users = g_list_length(gaim_conv_chat_get_users(chat)); |
4359 | 4992 |
4993 g_snprintf(tmp, sizeof(tmp), | |
4994 ngettext("%d person in room", "%d people in room", | |
4995 num_users), | |
4996 num_users); | |
4997 | |
4998 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); | |
4999 | |
5000 if (gtkconv->make_sound) | |
4561 | 5001 gaim_sound_play_event(GAIM_SOUND_CHAT_JOIN); |
4359 | 5002 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5003 pos = g_list_index(gaim_conv_chat_get_users(chat), user); |
4359 | 5004 |
5005 add_chat_buddy_common(conv, user, pos); | |
5006 } | |
5007 | |
5008 static void | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5009 gaim_gtkconv_chat_add_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 GList *l; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5015 char tmp[BUF_LONG]; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5016 int num_users; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5017 int pos; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5018 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5019 chat = GAIM_CONV_CHAT(conv); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5020 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5021 gtkchat = gtkconv->u.chat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5022 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5023 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
|
5024 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5025 g_snprintf(tmp, sizeof(tmp), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5026 ngettext("%d person in room", "%d people in room", |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5027 num_users), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5028 num_users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5029 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5030 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5031 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5032 for (l = users; l != NULL; l = l->next) { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5033 pos = g_list_index(gaim_conv_chat_get_users(chat), (char *)l->data); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5034 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5035 add_chat_buddy_common(conv, (char *)l->data, pos); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5036 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5037 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5038 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5039 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5040 gaim_gtkconv_chat_rename_user(GaimConversation *conv, const char *old_name, |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5041 const char *new_name) |
4359 | 5042 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5043 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5044 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5045 GaimGtkChatPane *gtkchat; |
4359 | 5046 GtkTreeIter iter; |
5047 GtkTreeModel *model; | |
5048 GList *names; | |
5049 int pos; | |
5050 int f = 1; | |
5051 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5052 chat = GAIM_CONV_CHAT(conv); |
4359 | 5053 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5054 gtkchat = gtkconv->u.chat; | |
5055 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5056 for (names = gaim_conv_chat_get_users(chat); |
4359 | 5057 names != NULL; |
5058 names = names->next) { | |
5059 | |
5060 char *u = (char *)names->data; | |
5061 | |
4793 | 5062 if (!gaim_utf8_strcasecmp(u, old_name)) { |
4359 | 5063 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
5064 | |
5065 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
5066 break; | |
5067 | |
5068 while (f != 0) { | |
5069 char *val; | |
5070 | |
5071 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &val, -1); | |
5072 | |
4793 | 5073 if (!gaim_utf8_strcasecmp(old_name, val)) { |
4359 | 5074 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
4640 | 5075 break; |
5076 } | |
4359 | 5077 |
5078 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
5079 | |
5080 g_free(val); | |
5081 } | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
5082 |
4359 | 5083 break; |
5084 } | |
5085 } | |
5086 | |
5087 if (!names) | |
5088 return; | |
5089 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5090 pos = g_list_index(gaim_conv_chat_get_users(chat), new_name); |
4359 | 5091 |
5092 add_chat_buddy_common(conv, new_name, pos); | |
5093 } | |
5094 | |
5095 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5096 gaim_gtkconv_chat_remove_user(GaimConversation *conv, const char *user) |
4359 | 5097 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5098 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5099 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5100 GaimGtkChatPane *gtkchat; |
4359 | 5101 GtkTreeIter iter; |
5102 GtkTreeModel *model; | |
5103 GList *names; | |
5104 char tmp[BUF_LONG]; | |
5105 int num_users; | |
5106 int f = 1; | |
5107 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5108 chat = GAIM_CONV_CHAT(conv); |
4359 | 5109 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5110 gtkchat = gtkconv->u.chat; | |
5111 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5112 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
|
5113 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5114 for (names = gaim_conv_chat_get_users(chat); |
4359 | 5115 names != NULL; |
5116 names = names->next) { | |
5117 | |
5118 char *u = (char *)names->data; | |
5119 | |
4793 | 5120 if (!gaim_utf8_strcasecmp(u, user)) { |
4359 | 5121 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
5122 | |
5123 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
5124 break; | |
5125 | |
5126 while (f != 0) { | |
5127 char *val; | |
5128 | |
5129 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &val, -1); | |
5130 | |
4793 | 5131 if (!gaim_utf8_strcasecmp(user, val)) |
4359 | 5132 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
5133 | |
5134 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
5135 | |
5136 g_free(val); | |
5137 } | |
5138 | |
5139 break; | |
5140 } | |
5141 } | |
5142 | |
5143 if (names == NULL) | |
5144 return; | |
5145 | |
5146 g_snprintf(tmp, sizeof(tmp), | |
5147 ngettext("%d person in room", "%d people in room", | |
5148 num_users), num_users); | |
5149 | |
5150 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); | |
5151 | |
5152 if (gtkconv->make_sound) | |
4561 | 5153 gaim_sound_play_event(GAIM_SOUND_CHAT_LEAVE); |
4359 | 5154 } |
5155 | |
5156 static void | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5157 gaim_gtkconv_chat_remove_users(GaimConversation *conv, GList *users) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5158 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5159 GaimConvChat *chat; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5160 GaimGtkConversation *gtkconv; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5161 GaimGtkChatPane *gtkchat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5162 GtkTreeIter iter; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5163 GtkTreeModel *model; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5164 GList *names = NULL; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5165 GList *l; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5166 char tmp[BUF_LONG]; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5167 int num_users; |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
5168 gboolean f; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5169 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5170 chat = GAIM_CONV_CHAT(conv); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5171 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5172 gtkchat = gtkconv->u.chat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5173 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5174 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
|
5175 g_list_length(users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5176 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5177 for (l = users; l != NULL; l = l->next) { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5178 for (names = gaim_conv_chat_get_users(chat); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5179 names != NULL; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5180 names = names->next) { |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5181 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5182 char *u = (char *)names->data; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5183 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5184 if (!gaim_utf8_strcasecmp(u, (char *)l->data)) { |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5185 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5186 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5187 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5188 &iter)) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5189 break; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5190 |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
5191 do { |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5192 char *val; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5193 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5194 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5195 1, &val, -1); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5196 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5197 if (!gaim_utf8_strcasecmp((char *)l->data, val)) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5198 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5199 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5200 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5201 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5202 g_free(val); |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
5203 } while (f); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
5204 |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5205 break; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5206 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5207 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5208 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5209 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5210 if (names == NULL) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5211 return; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5212 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5213 g_snprintf(tmp, sizeof(tmp), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5214 ngettext("%d person in room", "%d people in room", |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5215 num_users), num_users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5216 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5217 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5218 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5219 |
9260
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5220 static gboolean |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5221 gaim_gtkconv_has_focus(GaimConversation *conv) |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5222 { |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5223 GaimConvWindow *win; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5224 GaimGtkWindow *gtkwin; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5225 gboolean has_focus; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5226 |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5227 win = gaim_conversation_get_window(conv); |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5228 gtkwin = GAIM_GTK_WINDOW(win); |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5229 |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5230 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
|
5231 |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5232 return has_focus; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5233 } |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5234 |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5235 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5236 gaim_gtkconv_updated(GaimConversation *conv, GaimConvUpdateType type) |
4359 | 5237 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5238 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5239 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5240 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5241 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5242 GaimConvChat *chat; |
4359 | 5243 |
5244 win = gaim_conversation_get_window(conv); | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5245 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 5246 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5247 | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5248 if (type == GAIM_CONV_UPDATE_ACCOUNT) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5249 { |
4359 | 5250 gaim_conversation_autoset_title(conv); |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5251 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5252 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5253 gaim_gtkconv_update_buddy_icon(conv); |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5254 |
4359 | 5255 gaim_gtkconv_update_buttons_by_protocol(conv); |
5256 | |
4685 | 5257 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); |
4359 | 5258 |
5259 smiley_themeize(gtkconv->imhtml); | |
6394 | 5260 |
6395 | 5261 update_tab_icon(conv); |
4359 | 5262 } |
5263 else if (type == GAIM_CONV_UPDATE_TYPING || | |
8155
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5264 type == GAIM_CONV_UPDATE_UNSEEN || |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5265 type == GAIM_CONV_UPDATE_TITLE) |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5266 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5267 const char *title; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5268 GaimConvIm *im = NULL; |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5269 char color[8]; |
4736 | 5270 |
4359 | 5271 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5272 im = GAIM_CONV_IM(conv); |
4359 | 5273 |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5274 title = gaim_conversation_get_title(conv); |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5275 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5276 *color = '\0'; |
4359 | 5277 |
5278 if (!GTK_WIDGET_REALIZED(gtkconv->tab_label)) | |
5279 gtk_widget_realize(gtkconv->tab_label); | |
5280 | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5281 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
|
5282 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5283 strcpy(color, "#47A046"); |
4359 | 5284 } |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5285 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
|
5286 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5287 strcpy(color, "#D1940C"); |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5288 } |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5289 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_NICK) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5290 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5291 strcpy(color, "#314E6C"); |
4359 | 5292 } |
8252 | 5293 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_TEXT) |
5294 { | |
5295 strcpy(color, "#DF421E"); | |
5296 } | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5297 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_EVENT) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5298 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5299 strcpy(color, "#868272"); |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5300 } |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5301 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5302 if (*color != '\0') |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5303 { |
8536 | 5304 char *html_title,*label; |
5305 | |
5306 html_title = gaim_escape_html(title); | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5307 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5308 label = g_strdup_printf("<span color=\"%s\">%s</span>", |
8536 | 5309 color, html_title); |
5310 g_free(html_title); | |
7995
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
5311 gtk_label_set_markup(GTK_LABEL(gtkconv->tab_label), label); |
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
5312 g_free(label); |
4359 | 5313 } |
7995
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
5314 else |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5315 gtk_label_set_text(GTK_LABEL(gtkconv->tab_label), title); |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5316 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5317 if (conv == gaim_conv_window_get_active_conversation(win)) |
4736 | 5318 update_typing_icon(conv); |
8155
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5319 |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5320 if (type == GAIM_CONV_UPDATE_TITLE) { |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5321 gtk_label_set_text(GTK_LABEL(gtkconv->menu_label), title); |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5322 if (conv == gaim_conv_window_get_active_conversation(win)) |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5323 gtk_window_set_title(GTK_WINDOW(gtkwin->window), title); |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5324 } |
4359 | 5325 } |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5326 else if (type == GAIM_CONV_UPDATE_TOPIC) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5327 { |
7154 | 5328 const char *topic; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5329 chat = GAIM_CONV_CHAT(conv); |
4359 | 5330 gtkchat = gtkconv->u.chat; |
5331 | |
7154 | 5332 topic = gaim_conv_chat_get_topic(chat); |
5333 | |
5334 gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text),topic); | |
5335 gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->topic_text, | |
8155
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5336 topic, NULL); |
4359 | 5337 } |
5338 else if (type == GAIM_CONV_ACCOUNT_ONLINE || | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5339 type == GAIM_CONV_ACCOUNT_OFFLINE) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5340 { |
7929 | 5341 gray_stuff_out(gaim_conv_window_get_active_conversation(win)); |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
5342 generate_send_as_items(win, NULL); |
8946 | 5343 update_tab_icon(conv); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5344 } |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5345 else if (type == GAIM_CONV_UPDATE_AWAY) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5346 { |
8946 | 5347 update_tab_icon(conv); |
4359 | 5348 } |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
5349 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
|
5350 type == GAIM_CONV_UPDATE_CHATLEFT) |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5351 { |
7929 | 5352 gray_stuff_out(conv); |
4397
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
5353 } |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5354 else if (type == GAIM_CONV_UPDATE_ICON) |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5355 { |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5356 gaim_gtkconv_update_buddy_icon(conv); |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5357 } |
4359 | 5358 } |
5359 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5360 static GaimConversationUiOps conversation_ui_ops = |
4359 | 5361 { |
5362 gaim_gtkconv_destroy, /* destroy_conversation */ | |
5363 gaim_gtkconv_write_chat, /* write_chat */ | |
5364 gaim_gtkconv_write_im, /* write_im */ | |
5365 gaim_gtkconv_write_conv, /* write_conv */ | |
5366 gaim_gtkconv_chat_add_user, /* chat_add_user */ | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5367 gaim_gtkconv_chat_add_users, /* chat_add_users */ |
4359 | 5368 gaim_gtkconv_chat_rename_user, /* chat_rename_user */ |
5369 gaim_gtkconv_chat_remove_user, /* chat_remove_user */ | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5370 gaim_gtkconv_chat_remove_users, /* chat_remove_users */ |
4359 | 5371 NULL, /* update_progress */ |
9260
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5372 gaim_gtkconv_has_focus, /* has_focus */ |
4359 | 5373 gaim_gtkconv_updated /* updated */ |
5374 }; | |
5375 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5376 GaimConversationUiOps * |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
5377 gaim_gtk_conversations_get_conv_ui_ops(void) |
4359 | 5378 { |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
5379 return &conversation_ui_ops; |
4359 | 5380 } |
5381 | |
5382 /************************************************************************** | |
5383 * Public conversation utility functions | |
5384 **************************************************************************/ | |
5385 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5386 gaim_gtkconv_update_buddy_icon(GaimConversation *conv) |
4359 | 5387 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5388 GaimGtkConversation *gtkconv; |
7143 | 5389 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); |
4359 | 5390 |
5391 char filename[256]; | |
5392 FILE *file; | |
5393 GError *err = NULL; | |
5394 | |
6695 | 5395 GaimBuddy *buddy; |
4757 | 5396 |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5397 const void *data; |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5398 size_t len; |
4359 | 5399 |
5400 GdkPixbuf *buf; | |
5401 | |
8821 | 5402 GtkWidget *vbox; |
4359 | 5403 GtkWidget *event; |
5404 GtkWidget *frame; | |
5405 GdkPixbuf *scale; | |
5406 GdkPixmap *pm; | |
5407 GdkBitmap *bm; | |
5408 int sf = 0; | |
5409 | |
8821 | 5410 GaimButtonStyle button_type; |
5411 | |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5412 g_return_if_fail(conv != NULL); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5413 g_return_if_fail(GAIM_IS_GTK_CONVERSATION(conv)); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5414 g_return_if_fail(gaim_conversation_get_type(conv) == GAIM_CONV_IM); |
4359 | 5415 |
5416 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5417 | |
5418 remove_icon(gtkconv); | |
5419 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5420 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/im/show_buddy_icons")) |
4359 | 5421 return; |
5422 | |
5423 if (gaim_conversation_get_gc(conv) == NULL) | |
5424 return; | |
5425 | |
8189 | 5426 if (gtkconv->u.im->anim) |
4793 | 5427 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); |
5428 | |
4757 | 5429 if((buddy = gaim_find_buddy(gaim_conversation_get_account(conv), |
5430 gaim_conversation_get_name(conv))) != NULL) { | |
8374 | 5431 const char *iconfile; |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
5432 if((iconfile = gaim_blist_node_get_string((GaimBlistNode*)buddy, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
5433 "buddy_icon"))) { |
8374 | 5434 GaimBuddyIcon *icon = gaim_conv_im_get_icon(GAIM_CONV_IM(conv)); |
5435 struct stat st; | |
5436 if ((icon == NULL) && (!stat(iconfile, &st))) { | |
5437 FILE *file = fopen(iconfile, "rb"); | |
5438 if (file) { | |
5439 char *data = g_malloc(st.st_size); | |
5440 fread(data, 1, st.st_size, file); | |
5441 fclose(file); | |
5442 gaim_buddy_icons_set_for_user(gaim_conversation_get_account(conv), gaim_conversation_get_name(conv), data, st.st_size); | |
5443 g_free(data); | |
5444 } | |
5445 return; | |
5446 } | |
5447 else | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
5448 gtkconv->u.im->anim = |
8496 | 5449 gdk_pixbuf_animation_new_from_file(iconfile, &err); /* LEAK */ |
8374 | 5450 } |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5451 } |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5452 else |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5453 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5454 GaimBuddyIcon *icon = gaim_conv_im_get_icon(GAIM_CONV_IM(conv)); |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5455 |
6877
1b5b0cea6915
[gaim-migrate @ 7423]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
5456 if (icon == NULL) |
1b5b0cea6915
[gaim-migrate @ 7423]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
5457 return; |
1b5b0cea6915
[gaim-migrate @ 7423]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
5458 |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5459 data = gaim_buddy_icon_get_data(icon, &len); |
4757 | 5460 |
5461 /* this is such an evil hack, i don't know why i'm even considering it. | |
5462 * we'll do it differently when gdk-pixbuf-loader isn't leaky anymore. */ | |
5463 g_snprintf(filename, sizeof(filename), | |
5464 "%s" G_DIR_SEPARATOR_S "gaimicon-%s.%d", | |
5465 g_get_tmp_dir(), gaim_conversation_get_name(conv), getpid()); | |
5466 | |
5467 if (!(file = fopen(filename, "wb"))) | |
5468 return; | |
5469 | |
5470 fwrite(data, 1, len, file); | |
5471 fclose(file); | |
5472 | |
5473 gtkconv->u.im->anim = gdk_pixbuf_animation_new_from_file(filename, &err); | |
5474 /* make sure we remove the file as soon as possible */ | |
5475 unlink(filename); | |
5476 } | |
4359 | 5477 |
5478 if (err) { | |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5479 gaim_debug(GAIM_DEBUG_ERROR, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5480 "Buddy icon error: %s\n", err->message); |
4359 | 5481 g_error_free(err); |
5482 } | |
5483 | |
5484 if (!gtkconv->u.im->anim) | |
5485 return; | |
5486 | |
4793 | 5487 if(gtkconv->u.im->iter) |
5488 g_object_unref(G_OBJECT(gtkconv->u.im->iter)); | |
5489 | |
4359 | 5490 if (gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim)) { |
5491 gtkconv->u.im->iter = NULL; | |
5492 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); | |
5493 } else { | |
5494 gtkconv->u.im->iter = | |
8496 | 5495 gdk_pixbuf_animation_get_iter(gtkconv->u.im->anim, NULL); /* LEAK */ |
4359 | 5496 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); |
8189 | 5497 if (gtkconv->u.im->animate) |
5498 start_anim(NULL, conv); | |
4359 | 5499 } |
5500 | |
5501 sf = SCALE(gtkconv->u.im->anim); | |
5502 scale = gdk_pixbuf_scale_simple(buf, | |
5503 MAX(gdk_pixbuf_get_width(buf) * sf / | |
5504 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), | |
5505 MAX(gdk_pixbuf_get_height(buf) * sf / | |
5506 gdk_pixbuf_animation_get_height(gtkconv->u.im->anim), 1), | |
5507 GDK_INTERP_NEAREST); | |
5508 | |
5509 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); | |
4793 | 5510 g_object_unref(G_OBJECT(scale)); |
4359 | 5511 |
8821 | 5512 |
5513 vbox = gtk_vbox_new(FALSE, 0); | |
9150 | 5514 button_type = gaim_prefs_get_int("/gaim/gtk/conversations/button_type"); |
8821 | 5515 if(button_type == GAIM_BUTTON_NONE) { |
5516 gtk_box_pack_start(GTK_BOX(gtkconv->entrybox), vbox, FALSE, FALSE, 0); | |
5517 gtk_box_reorder_child(GTK_BOX(gtkconv->entrybox), vbox, 0); | |
5518 } else { | |
5519 gtk_box_pack_start(GTK_BOX(gtkconv->bbox), vbox, FALSE, FALSE, 0); | |
5520 gtk_box_reorder_child(GTK_BOX(gtkconv->bbox), vbox, 0); | |
5521 } | |
5522 | |
4359 | 5523 frame = gtk_frame_new(NULL); |
5524 gtk_frame_set_shadow_type(GTK_FRAME(frame), | |
5525 (bm ? GTK_SHADOW_NONE : GTK_SHADOW_IN)); | |
8821 | 5526 gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); |
5527 | |
5528 | |
5529 gtk_widget_show(vbox); | |
4359 | 5530 gtk_widget_show(frame); |
5531 | |
5532 event = gtk_event_box_new(); | |
5533 gtk_container_add(GTK_CONTAINER(frame), event); | |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
5534 g_signal_connect(G_OBJECT(event), "button-press-event", |
4359 | 5535 G_CALLBACK(icon_menu), conv); |
5536 gtk_widget_show(event); | |
5537 | |
4635 | 5538 gtkconv->u.im->icon = gtk_image_new_from_pixmap(pm, bm); |
4359 | 5539 gtk_widget_set_size_request(gtkconv->u.im->icon, sf, sf); |
5540 gtk_container_add(GTK_CONTAINER(event), gtkconv->u.im->icon); | |
5541 gtk_widget_show(gtkconv->u.im->icon); | |
5542 | |
4793 | 5543 g_object_unref(G_OBJECT(pm)); |
4359 | 5544 |
5545 if (bm) | |
4793 | 5546 g_object_unref(G_OBJECT(bm)); |
7143 | 5547 |
5548 /* The buddy icon code needs badly to be fixed. */ | |
5549 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); | |
8068 | 5550 if(conv == gaim_conv_window_get_active_conversation(gaim_conversation_get_window(conv))) |
5551 gtk_window_set_icon(GTK_WINDOW(gtkwin->window), buf); | |
4359 | 5552 } |
5553 | |
5554 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5555 gaim_gtkconv_update_buttons_by_protocol(GaimConversation *conv) |
4359 | 5556 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5557 GaimConvWindow *win; |
4359 | 5558 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5559 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
4359 | 5560 return; |
5561 | |
7887 | 5562 win = gaim_conversation_get_window(conv); |
5563 | |
5564 if (win != NULL && gaim_conv_window_get_active_conversation(win) == conv) | |
5565 gray_stuff_out(conv); | |
4359 | 5566 } |
5567 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5568 GaimConvWindow * |
4359 | 5569 gaim_gtkwin_get_at_xy(int x, int y) |
5570 { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5571 GaimConvWindow *win = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5572 GaimGtkWindow *gtkwin; |
4359 | 5573 GdkWindow *gdkwin; |
5574 GList *l; | |
5575 | |
5576 gdkwin = gdk_window_at_pointer(&x, &y); | |
5577 | |
5578 if (gdkwin) | |
5579 gdkwin = gdk_window_get_toplevel(gdkwin); | |
5580 | |
5581 for (l = gaim_get_windows(); l != NULL; l = l->next) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5582 win = (GaimConvWindow *)l->data; |
4359 | 5583 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5584 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5585 continue; |
5586 | |
5587 gtkwin = GAIM_GTK_WINDOW(win); | |
5588 | |
5589 if (gdkwin == gtkwin->window->window) | |
5590 return win; | |
5591 } | |
5592 | |
5593 return NULL; | |
5594 } | |
5595 | |
5596 int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5597 gaim_gtkconv_get_tab_at_xy(GaimConvWindow *win, int x, int y) |
4359 | 5598 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5599 GaimGtkWindow *gtkwin; |
4359 | 5600 GList *l; |
5601 gint nb_x, nb_y, x_rel, y_rel; | |
5602 GtkNotebook *notebook; | |
5603 GtkWidget *tab; | |
5604 gint i, page_num = 0; | |
5605 gboolean first_visible = TRUE; | |
5606 | |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5607 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5608 return -1; |
5609 | |
5610 gtkwin = GAIM_GTK_WINDOW(win); | |
5611 notebook = GTK_NOTEBOOK(gtkwin->notebook); | |
5612 | |
5613 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
5614 x_rel = x - nb_x; | |
5615 y_rel = y - nb_y; | |
5616 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5617 for (l = gaim_conv_window_get_conversations(win), i = 0; |
4359 | 5618 l != NULL; |
5619 l = l->next, i++) { | |
5620 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5621 GaimConversation *conv = l->data; |
4359 | 5622 tab = GAIM_GTK_CONVERSATION(conv)->tab_label; |
5623 | |
5624 if (!GTK_WIDGET_MAPPED(tab)) | |
5625 continue; | |
5626 | |
5627 if (first_visible) { | |
5628 first_visible = FALSE; | |
5629 | |
5630 if (x_rel < tab->allocation.x) x_rel = tab->allocation.x; | |
5631 if (y_rel < tab->allocation.y) y_rel = tab->allocation.y; | |
5632 } | |
5633 | |
5634 if (gtk_notebook_get_tab_pos(notebook) == GTK_POS_TOP || | |
5635 gtk_notebook_get_tab_pos(notebook) == GTK_POS_BOTTOM) { | |
5636 | |
5637 if (tab->allocation.x <= x_rel) { | |
5638 if (tab->allocation.x + tab->allocation.width <= x_rel) | |
5639 page_num = i + 1; | |
5640 else | |
5641 page_num = i; | |
5642 } | |
5643 else | |
5644 break; | |
5645 } | |
5646 else { | |
5647 if (tab->allocation.y <= y_rel) { | |
5648 if (tab->allocation.y + tab->allocation.height <= y_rel) | |
5649 page_num = i + 1; | |
5650 else | |
5651 page_num = i; | |
5652 } | |
5653 else | |
5654 break; | |
5655 } | |
5656 } | |
5657 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5658 if (i == gaim_conv_window_get_conversation_count(win) + 1) |
4359 | 5659 return -1; |
5660 | |
5661 return page_num; | |
5662 } | |
5663 | |
5664 int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5665 gaim_gtkconv_get_dest_tab_at_xy(GaimConvWindow *win, int x, int y) |
4359 | 5666 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5667 GaimGtkWindow *gtkwin; |
4359 | 5668 GList *l; |
5669 gint nb_x, nb_y, x_rel, y_rel; | |
5670 GtkNotebook *notebook; | |
5671 GtkWidget *tab; | |
5672 gint i, page_num = 0; | |
5673 | |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5674 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5675 return -1; |
5676 | |
5677 gtkwin = GAIM_GTK_WINDOW(win); | |
5678 notebook = GTK_NOTEBOOK(gtkwin->notebook); | |
5679 | |
5680 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
5681 x_rel = x - nb_x; | |
5682 y_rel = y - nb_y; | |
5683 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5684 for (l = gaim_conv_window_get_conversations(win), i = 0; |
4359 | 5685 l != NULL; |
5686 l = l->next, i++) { | |
5687 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5688 GaimConversation *conv = l->data; |
4359 | 5689 tab = GAIM_GTK_CONVERSATION(conv)->tab_label; |
5690 | |
5691 if (!GTK_WIDGET_MAPPED(tab)) | |
5692 continue; | |
5693 | |
5694 if (gtk_notebook_get_tab_pos(notebook) == GTK_POS_TOP || | |
5695 gtk_notebook_get_tab_pos(notebook) == GTK_POS_BOTTOM) { | |
5696 | |
5697 if (tab->allocation.x <= x_rel) { | |
5698 if (tab->allocation.x + (tab->allocation.width / 2) <= x_rel) | |
5699 page_num = i + 1; | |
5700 else | |
5701 page_num = i; | |
5702 } | |
5703 else | |
5704 break; | |
5705 } | |
5706 else { | |
5707 if (tab->allocation.y <= y_rel) { | |
5708 if (tab->allocation.y + (tab->allocation.height / 2) <= y_rel) | |
5709 page_num = i + 1; | |
5710 else | |
5711 page_num = i; | |
5712 } | |
5713 else | |
5714 break; | |
5715 } | |
5716 } | |
5717 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5718 if (i == gaim_conv_window_get_conversation_count(win) + 1) |
4359 | 5719 return -1; |
5720 | |
5721 return page_num; | |
5722 } | |
4940
3708545afe42
[gaim-migrate @ 5274]
Christian Hammond <chipx86@chipx86.com>
parents:
4939
diff
changeset
|
5723 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5724 static void |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5725 escape_closes_pref_cb(const char *name, GaimPrefType type, gpointer value, |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5726 gpointer data) |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5727 { |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5728 if (value) |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5729 gtk_accel_map_change_entry(N_("<main>/Conversation/Close"), |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5730 GDK_Escape, 0, TRUE); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5731 else |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5732 gtk_accel_map_change_entry(N_("<main>/Conversation/Close"), |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5733 GDK_W, GDK_CONTROL_MASK, TRUE); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5734 } |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5735 |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5736 static void |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5737 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
|
5738 gpointer data) |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5739 { |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5740 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5741 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5742 GaimGtkConversation *gtkconv; |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5743 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5744 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5745 conv = (GaimConversation *)l->data; |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5746 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5747 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5748 continue; |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5749 |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5750 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5751 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5752 if (value) |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5753 gtk_widget_show(gtkconv->close); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5754 else |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5755 gtk_widget_hide(gtkconv->close); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5756 } |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5757 } |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5758 |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5759 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5760 show_timestamps_pref_cb(const char *name, GaimPrefType type, gpointer value, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5761 gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5762 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5763 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5764 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5765 GaimGtkConversation *gtkconv; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5766 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5767 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5768 conv = (GaimConversation *)l->data; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5769 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5770 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5771 continue; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5772 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5773 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5774 |
7386 | 5775 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), (gboolean)GPOINTER_TO_INT(value)); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5776 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5777 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5778 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5779 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5780 spellcheck_pref_cb(const char *name, GaimPrefType type, gpointer value, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5781 gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5782 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5783 #ifdef USE_GTKSPELL |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5784 GList *cl; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5785 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5786 GaimGtkConversation *gtkconv; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5787 GtkSpell *spell; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5788 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5789 for (cl = gaim_get_conversations(); cl != NULL; cl = cl->next) { |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
5790 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5791 conv = (GaimConversation *)cl->data; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5792 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5793 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5794 continue; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5795 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5796 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5797 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5798 if (value) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
5799 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5800 else { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5801 spell = gtkspell_get_from_text_view(GTK_TEXT_VIEW(gtkconv->entry)); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5802 gtkspell_detach(spell); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5803 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5804 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5805 #endif |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5806 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5807 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5808 static void |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5809 tab_side_pref_cb(const char *name, GaimPrefType type, gpointer value, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5810 gpointer data) |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5811 { |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5812 GList *l; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5813 GtkPositionType pos; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5814 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5815 GaimGtkWindow *gtkwin; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5816 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5817 pos = GPOINTER_TO_INT(value); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5818 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5819 for (l = gaim_get_windows(); l != NULL; l = l->next) { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5820 win = (GaimConvWindow *)l->data; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5821 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5822 if (!GAIM_IS_GTK_WINDOW(win)) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5823 continue; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5824 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5825 gtkwin = GAIM_GTK_WINDOW(win); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5826 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5827 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5828 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5829 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5830 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5831 static void |
8456 | 5832 html_shortcuts_pref_cb(const char *name, GaimPrefType type, |
5833 gpointer value, gpointer data) | |
5834 { | |
5835 GList *l; | |
5836 GaimConversation *conv; | |
5837 GaimGtkConversation *gtkconv; | |
5838 | |
5839 for(l = gaim_get_conversations(); l != NULL; l = l->next) { | |
5840 conv = (GaimConversation *)l->data; | |
5841 | |
5842 if(!GAIM_IS_GTK_CONVERSATION(conv)) | |
5843 continue; | |
5844 | |
5845 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5846 | |
5847 gtk_imhtml_html_shortcuts(GTK_IMHTML(gtkconv->entry), | |
5848 (gboolean)GPOINTER_TO_INT(value)); | |
5849 } | |
5850 } | |
5851 | |
5852 static void | |
5853 smiley_shortcuts_pref_cb(const char *name, GaimPrefType type, | |
5854 gpointer value, gpointer data) | |
5855 { | |
5856 GList *l; | |
5857 GaimConversation *conv; | |
5858 GaimGtkConversation *gtkconv; | |
5859 | |
5860 for(l = gaim_get_conversations(); l != NULL; l = l->next) { | |
5861 conv = (GaimConversation *)l->data; | |
5862 | |
5863 if(!GAIM_IS_GTK_CONVERSATION(conv)) | |
5864 continue; | |
5865 | |
5866 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5867 | |
5868 gtk_imhtml_smiley_shortcuts(GTK_IMHTML(gtkconv->entry), | |
5869 (gboolean)GPOINTER_TO_INT(value)); | |
5870 } | |
5871 } | |
5872 | |
5873 static void | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5874 show_formatting_toolbar_pref_cb(const char *name, GaimPrefType type, |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5875 gpointer value, gpointer data) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5876 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5877 GList *l; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5878 GaimConversation *conv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5879 GaimGtkConversation *gtkconv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5880 GaimConvWindow *win; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5881 GaimGtkWindow *gtkwin; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5882 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5883 for (l = gaim_get_conversations(); l != NULL; l = l->next) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5884 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5885 conv = (GaimConversation *)l->data; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5886 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5887 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5888 continue; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5889 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5890 gtkconv = GAIM_GTK_CONVERSATION(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5891 win = gaim_conversation_get_window(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5892 gtkwin = GAIM_GTK_WINDOW(win); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5893 |
7386 | 5894 gtkconv->show_formatting_toolbar = (gboolean)GPOINTER_TO_INT(value); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5895 gtk_check_menu_item_set_active( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5896 GTK_CHECK_MENU_ITEM(gtkwin->menu.show_formatting_toolbar), |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5897 gtkconv->show_formatting_toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5898 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5899 if (gtkconv->show_formatting_toolbar) |
8317 | 5900 gtk_widget_show(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5901 else |
8317 | 5902 gtk_widget_hide(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5903 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5904 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5905 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5906 static void |
9150 | 5907 button_type_pref_cb(const char *name, GaimPrefType type, |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5908 gpointer value, gpointer data) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5909 { |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5910 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5911 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5912 GaimGtkConversation *gtkconv; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5913 |
9150 | 5914 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5915 conv = (GaimConversation *)l->data; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5916 gtkconv = GAIM_GTK_CONVERSATION(conv); |
9150 | 5917 switch (conv->type) { |
5918 case GAIM_CONV_IM: | |
5919 setup_im_buttons(conv, gtk_widget_get_parent(gtkconv->send)); | |
5920 gaim_gtkconv_update_buddy_icon(conv); | |
5921 break; | |
5922 case GAIM_CONV_CHAT: | |
5923 setup_chat_buttons(conv, gtk_widget_get_parent(gtkconv->send)); | |
5924 break; | |
5925 default: | |
5926 break; | |
5927 } | |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5928 } |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5929 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5930 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5931 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5932 animate_buddy_icons_pref_cb(const char *name, GaimPrefType type, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5933 gpointer value, gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5934 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5935 GList *l; |
8189 | 5936 GaimConversation *conv; |
5937 GaimGtkConversation *gtkconv; | |
5938 GaimConvWindow *win; | |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5939 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5940 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
|
5941 return; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5942 |
8189 | 5943 /* Set the "animate" flag for each icon based on the new preference */ |
5944 for (l = gaim_get_ims(); l != NULL; l = l->next) { | |
5945 conv = (GaimConversation *)l->data; | |
5946 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5947 gtkconv->u.im->animate = (gboolean)value; | |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5948 } |
8189 | 5949 |
5950 /* Now either stop or start animation for the active conversation in each window */ | |
5951 for (l = gaim_get_windows(); l != NULL; l = l->next) { | |
5952 win = (GaimConvWindow *)l->data; | |
5953 conv = gaim_conv_window_get_active_conversation(win); | |
5954 gaim_gtkconv_update_buddy_icon(conv); | |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5955 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5956 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5957 |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5958 static void |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5959 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
|
5960 gpointer data) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5961 { |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5962 GList *l; |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5963 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5964 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5965 GaimConversation *conv = l->data; |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5966 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5967 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5968 gaim_conversation_foreach(gaim_gtkconv_update_buddy_icon); |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5969 } |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5970 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5971 |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5680
diff
changeset
|
5972 static void |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5973 conv_placement_pref_cb(const char *name, GaimPrefType type, |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5974 gpointer value, gpointer data) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5975 { |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5976 GaimConvPlacementFunc func; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5977 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5978 if (strcmp(name, "/gaim/gtk/conversations/placement")) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5979 return; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5980 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5981 func = gaim_conv_placement_get_fnc(value); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5982 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5983 if (func == NULL) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5984 return; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5985 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5986 gaim_conv_placement_set_current_func(func); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5987 } |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5988 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5989 void * |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5990 gaim_gtk_conversations_get_handle(void) |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5991 { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5992 static int handle; |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5993 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5994 return &handle; |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5995 } |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5996 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5997 void |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
5998 gaim_gtk_conversations_init(void) |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5999 { |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6000 void *handle = gaim_gtk_conversations_get_handle(); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6001 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6002 /* Conversations */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6003 gaim_prefs_add_none("/gaim/gtk/conversations"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6004 gaim_prefs_add_bool("/gaim/gtk/conversations/close_on_tabs", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6005 gaim_prefs_add_bool("/gaim/gtk/conversations/ctrl_enter_sends", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6006 gaim_prefs_add_bool("/gaim/gtk/conversations/enter_sends", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6007 gaim_prefs_add_bool("/gaim/gtk/conversations/escape_closes", FALSE); |
9025 | 6008 gaim_prefs_add_bool("/gaim/gtk/conversations/send_formatting", FALSE); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6009 gaim_prefs_add_bool("/gaim/gtk/conversations/send_bold", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6010 gaim_prefs_add_bool("/gaim/gtk/conversations/send_italic", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6011 gaim_prefs_add_bool("/gaim/gtk/conversations/send_underline", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6012 gaim_prefs_add_bool("/gaim/gtk/conversations/show_timestamps", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6013 gaim_prefs_add_bool("/gaim/gtk/conversations/spellcheck", TRUE); |
9049 | 6014 #if 1 |
6015 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_colors", FALSE); | |
6016 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_fonts", FALSE); | |
6017 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_font_sizes", FALSE); | |
6018 #else | |
8944 | 6019 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_formatting", FALSE); |
9049 | 6020 #endif |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6021 gaim_prefs_add_bool("/gaim/gtk/conversations/html_shortcuts", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6022 gaim_prefs_add_bool("/gaim/gtk/conversations/smiley_shortcuts", FALSE); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6023 gaim_prefs_add_bool("/gaim/gtk/conversations/show_formatting_toolbar", TRUE); |
9130 | 6024 gaim_prefs_add_bool("/gaim/gtk/conversations/enable_commands", TRUE); |
6025 | |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6026 gaim_prefs_add_string("/gaim/gtk/conversations/placement", "last"); |
8998 | 6027 gaim_prefs_add_int("/gaim/gtk/conversations/placement_number", 1); |
9025 | 6028 gaim_prefs_add_string("/gaim/gtk/conversations/bgcolor", ""); |
6029 gaim_prefs_add_string("/gaim/gtk/conversations/fgcolor", ""); | |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6030 gaim_prefs_add_string("/gaim/gtk/conversations/font_face", ""); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6031 gaim_prefs_add_int("/gaim/gtk/conversations/font_size", 3); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6032 gaim_prefs_add_bool("/gaim/gtk/conversations/tabs", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6033 gaim_prefs_add_int("/gaim/gtk/conversations/tab_side", GTK_POS_TOP); |
9150 | 6034 gaim_prefs_add_int("/gaim/gtk/conversations/button_type", |
6035 GAIM_BUTTON_TEXT_IMAGE); | |
9301 | 6036 gaim_prefs_add_bool("/gaim/gtk/conversations/im/raise_on_events", FALSE); |
6037 gaim_prefs_add_bool("/gaim/gtk/conversations/chat/raise_on_events", FALSE); | |
9150 | 6038 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6039 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6040 /* Conversations -> Chat */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6041 gaim_prefs_add_none("/gaim/gtk/conversations/chat"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6042 gaim_prefs_add_bool("/gaim/gtk/conversations/chat/color_nicks", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6043 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_width", 410); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6044 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_height", 160); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6045 gaim_prefs_add_int("/gaim/gtk/conversations/chat/entry_height", 50); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6046 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6047 /* Conversations -> IM */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6048 gaim_prefs_add_none("/gaim/gtk/conversations/im"); |
9150 | 6049 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6050 gaim_prefs_add_bool("/gaim/gtk/conversations/im/animate_buddy_icons", TRUE); |
9150 | 6051 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6052 gaim_prefs_add_bool("/gaim/gtk/conversations/im/show_buddy_icons", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6053 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_width", 410); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6054 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_height", 160); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6055 gaim_prefs_add_int("/gaim/gtk/conversations/im/entry_height", 50); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6056 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6057 /* Connect callbacks. */ |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6058 gaim_prefs_connect_callback("/gaim/gtk/conversations/escape_closes", |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6059 escape_closes_pref_cb, NULL); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6060 gaim_prefs_connect_callback("/gaim/gtk/conversations/close_on_tabs", |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6061 close_on_tabs_pref_cb, NULL); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6062 gaim_prefs_connect_callback("/gaim/gtk/conversations/show_timestamps", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6063 show_timestamps_pref_cb, NULL); |
8456 | 6064 gaim_prefs_connect_callback("/gaim/gtk/conversations/html_shortcuts", |
6065 html_shortcuts_pref_cb, NULL); | |
6066 gaim_prefs_connect_callback("/gaim/gtk/conversations/smiley_shortcuts", | |
6067 smiley_shortcuts_pref_cb, NULL); | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6068 gaim_prefs_connect_callback("/gaim/gtk/conversations/show_formatting_toolbar", |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6069 show_formatting_toolbar_pref_cb, NULL); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6070 gaim_prefs_connect_callback("/gaim/gtk/conversations/spellcheck", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6071 spellcheck_pref_cb, NULL); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6072 gaim_prefs_connect_callback("/gaim/gtk/conversations/tab_side", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6073 tab_side_pref_cb, NULL); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6074 |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6075 gaim_prefs_connect_callback("/gaim/gtk/conversations/placement", |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6076 conv_placement_pref_cb, NULL); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6077 gaim_prefs_trigger_callback("/gaim/gtk/conversations/placement"); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6078 |
9150 | 6079 gaim_prefs_connect_callback("/gaim/gtk/conversations/button_type", |
6080 button_type_pref_cb, NULL); | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
6081 |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6082 /* IM callbacks */ |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6083 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/animate_buddy_icons", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6084 animate_buddy_icons_pref_cb, NULL); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6085 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/show_buddy_icons", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6086 show_buddy_icons_pref_cb, NULL); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6087 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6088 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6089 /********************************************************************** |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6090 * Register signals |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6091 **********************************************************************/ |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6092 gaim_signal_register(handle, "conversation-drag-ended", |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6093 gaim_marshal_VOID__POINTER_POINTER, NULL, 2, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6094 gaim_value_new(GAIM_TYPE_SUBTYPE, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6095 GAIM_SUBTYPE_CONV_WINDOW), |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6096 gaim_value_new(GAIM_TYPE_SUBTYPE, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6097 GAIM_SUBTYPE_CONV_WINDOW)); |
9167 | 6098 |
6099 /********************************************************************** | |
6100 * Register commands | |
6101 **********************************************************************/ | |
9213 | 6102 gaim_cmd_register("me", "S", GAIM_CMD_P_DEFAULT, |
6103 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, | |
9247 | 6104 me_command_cb, _("me <action>: Send an IRC style action to a buddy or chat.")); |
9213 | 6105 gaim_cmd_register("debug", "w", GAIM_CMD_P_DEFAULT, |
6106 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, | |
9247 | 6107 debug_command_cb, _("debug <option>: Send various debug information to the current conversation.")); |
9213 | 6108 |
6109 gaim_cmd_register("help", "", GAIM_CMD_P_DEFAULT, | |
6110 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, | |
9247 | 6111 help_command_cb, _("help: List available commands.")); |
9213 | 6112 |
6113 gaim_cmd_register("help", "w", GAIM_CMD_P_DEFAULT, | |
6114 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, | |
9247 | 6115 help_arg_command_cb, _("help <command>: Help on a specific command.")); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6116 } |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6117 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6118 void |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6119 gaim_gtk_conversations_uninit(void) |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6120 { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6121 gaim_signals_unregister_by_instance(gaim_gtk_conversations_get_handle()); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6122 } |