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