Mercurial > pidgin.yaz
annotate src/gtkconv.c @ 9057:c55aa23bf56e
[gaim-migrate @ 9833]
We need this?
committer: Tailor Script <tailor@pidgin.im>
author | Ethan Blanton <elb@pidgin.im> |
---|---|
date | Tue, 25 May 2004 02:10:48 +0000 |
parents | f01eef2c264a |
children | 717d0e23f5fa |
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; | |
8143 | 3542 GList *focus_chain; |
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 | |
8143 | 3784 focus_chain = g_list_prepend (NULL, sw); |
3785 gtk_container_set_focus_chain (GTK_CONTAINER(vbox), focus_chain); | |
4359 | 3786 return vpaned; |
3787 } | |
3788 | |
3789 static GtkWidget * | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3790 setup_im_pane(GaimConversation *conv) |
4359 | 3791 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3792 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3793 GaimGtkImPane *gtkim; |
8456 | 3794 GaimPlugin *protocol; |
4359 | 3795 GtkWidget *paned; |
3796 GtkWidget *vbox; | |
3797 GtkWidget *vbox2; | |
7949 | 3798 GtkWidget *sw; |
8143 | 3799 GList *focus_chain; |
4359 | 3800 |
3801 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3802 gtkim = gtkconv->u.im; | |
3803 | |
3804 /* Setup the outer pane. */ | |
3805 paned = gtk_vpaned_new(); | |
3806 gtk_widget_show(paned); | |
3807 | |
3808 /* Setup the top part of the pane. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3809 vbox = gtk_vbox_new(FALSE, 6); |
4409
0521eec12c33
[gaim-migrate @ 4682]
Christian Hammond <chipx86@chipx86.com>
parents:
4398
diff
changeset
|
3810 gtk_paned_pack1(GTK_PANED(paned), vbox, TRUE, TRUE); |
4359 | 3811 gtk_widget_show(vbox); |
3812 | |
3813 /* Setup the gtkimhtml widget. */ | |
3814 gtkconv->sw = gtk_scrolled_window_new(NULL, NULL); | |
3815 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
8076 | 3816 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
4359 | 3817 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(gtkconv->sw), |
3818 GTK_SHADOW_IN); | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3819 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->sw, TRUE, TRUE, 0); |
4851 | 3820 |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3821 gtk_widget_set_size_request(gtkconv->sw, |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3822 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_width"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3823 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_height")); |
8914 | 3824 g_signal_connect(G_OBJECT(gtkconv->sw), "size-allocate", |
3825 G_CALLBACK(size_allocate_cb), conv); | |
4359 | 3826 gtk_widget_show(gtkconv->sw); |
3827 | |
3828 gtkconv->imhtml = gtk_imhtml_new(NULL, NULL); | |
9005 | 3829 gtk_widget_set_name(gtkconv->imhtml, "gaim_gtkconv_imhtml"); |
4359 | 3830 gtk_container_add(GTK_CONTAINER(gtkconv->sw), gtkconv->imhtml); |
3831 | |
3832 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", | |
3833 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
8105 | 3834 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_press_event", |
6057 | 3835 G_CALLBACK(refocus_entry_cb), gtkconv); |
8109 | 3836 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_release_event", |
3837 G_CALLBACK(refocus_entry_cb), gtkconv); | |
4359 | 3838 |
3839 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3840 gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); |
4359 | 3841 |
3842 gaim_setup_imhtml(gtkconv->imhtml); | |
3843 gtk_widget_show(gtkconv->imhtml); | |
3844 | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3845 vbox2 = gtk_vbox_new(FALSE, 6); |
8914 | 3846 gtk_paned_pack2(GTK_PANED(paned), vbox2, FALSE, TRUE); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3847 gtk_widget_show(vbox2); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3848 |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3849 /* Build the toolbar. */ |
8317 | 3850 gtkconv->toolbar = gtk_imhtmltoolbar_new(); |
3851 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
|
3852 |
8123 | 3853 /* Setup the entry widget. |
3854 * 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
|
3855 * lockups when typing text just as you type the character that would |
8123 | 3856 * cause both scrollbars to appear. Definitely seems like a gtk bug. |
3857 */ | |
8821 | 3858 gtkconv->entrybox = gtk_hbox_new(FALSE, 6); |
3859 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->entrybox, TRUE, TRUE, 0); | |
3860 gtk_widget_show(gtkconv->entrybox); | |
3861 | |
7949 | 3862 sw = gtk_scrolled_window_new(NULL, NULL); |
3863 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
8112 | 3864 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); |
8061 | 3865 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), |
3866 GTK_SHADOW_IN); | |
8821 | 3867 gtk_box_pack_start(GTK_BOX(gtkconv->entrybox), sw, TRUE, TRUE, 0); |
7949 | 3868 gtk_widget_show(sw); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3869 |
8061 | 3870 gtkconv->entry = gtk_imhtml_new(NULL, NULL); |
9005 | 3871 gtk_widget_set_name(gtkconv->entry, "gaim_gtkconv_entry"); |
8456 | 3872 |
3873 gtk_imhtml_smiley_shortcuts(GTK_IMHTML(gtkconv->entry), | |
3874 gaim_prefs_get_bool("/gaim/gtk/conversations/smiley_shortcuts")); | |
3875 gtk_imhtml_html_shortcuts(GTK_IMHTML(gtkconv->entry), | |
3876 gaim_prefs_get_bool("/gaim/gtk/conversations/html_shortcuts")); | |
3877 | |
3878 protocol = gaim_find_prpl(conv->account->protocol_id); | |
3879 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), | |
3880 protocol->info->name); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3881 gtkconv->entry_buffer = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3882 gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); |
8061 | 3883 gaim_setup_imhtml(gtkconv->entry); |
3884 gtk_imhtml_set_editable(GTK_IMHTML(gtkconv->entry), TRUE); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3885 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(gtkconv->entry), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3886 GTK_WRAP_WORD_CHAR); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3887 gtk_widget_set_size_request(gtkconv->entry, -1, |
8106 | 3888 gaim_prefs_get_int("/gaim/gtk/conversations/im/entry_height")); |
7949 | 3889 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
|
3890 |
4359 | 3891 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", |
8105 | 3892 G_CALLBACK(entry_key_press_cb), conv); |
4359 | 3893 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", |
3894 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
8914 | 3895 g_signal_connect(G_OBJECT(gtkconv->entry), "size-allocate", |
3896 G_CALLBACK(size_allocate_cb), conv); | |
4359 | 3897 |
3898 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "insert_text", | |
3899 G_CALLBACK(insert_text_cb), conv); | |
3900 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "delete_range", | |
3901 G_CALLBACK(delete_text_cb), conv); | |
3902 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3903 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
3904 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
4359 | 3905 |
7949 | 3906 gtk_container_add(GTK_CONTAINER(sw), GTK_WIDGET(gtkconv->entry)); |
4359 | 3907 gtk_widget_show(gtkconv->entry); |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
3908 gtk_imhtmltoolbar_attach(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), |
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
3909 gtkconv->entry); |
8481 | 3910 /* had to move this after the imtoolbar is attached so that the |
3911 * signals get fired to toggle the buttons on the toolbar as well. | |
3912 */ | |
3913 default_formatize(conv); | |
4359 | 3914 |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3915 gtkconv->bbox = gtk_hbox_new(FALSE, 6); |
4359 | 3916 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->bbox, FALSE, FALSE, 0); |
3917 gtk_widget_show(gtkconv->bbox); | |
3918 | |
3919 setup_im_buttons(conv, gtkconv->bbox); | |
8758 | 3920 gtkconv->u.im->animate = gaim_prefs_get_bool("/gaim/gtk/conversations/im/animate_buddy_icons"); |
4359 | 3921 |
8143 | 3922 focus_chain = g_list_prepend (NULL, sw); |
3923 gtk_container_set_focus_chain (GTK_CONTAINER(vbox2), focus_chain); | |
3924 | |
4359 | 3925 return paned; |
3926 } | |
3927 | |
3928 static void | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3929 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
|
3930 GtkSelectionData *sd, guint info, guint t, |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3931 GaimConversation *conv) |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3932 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3933 GaimConvWindow *win = conv->window; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3934 GaimConversation *c; |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3935 |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3936 if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE)) |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3937 { |
4781 | 3938 GaimBlistNode *n = NULL; |
6695 | 3939 GaimBuddy *b; |
4781 | 3940 memcpy(&n, sd->data, sizeof(n)); |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3941 |
6695 | 3942 if (GAIM_BLIST_NODE_IS_CONTACT(n)) |
3943 b = gaim_contact_get_priority_buddy((GaimContact*)n); | |
3944 else if (GAIM_BLIST_NODE_IS_BUDDY(n)) | |
3945 b = (GaimBuddy*)n; | |
3946 else | |
4781 | 3947 return; |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3948 |
7089
2cd3756a637b
[gaim-migrate @ 7654]
Christian Hammond <chipx86@chipx86.com>
parents:
7078
diff
changeset
|
3949 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
|
3950 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3951 gaim_conv_window_add_conversation(win, c); |
8802
1076cd8579ea
[gaim-migrate @ 9564]
Christian Hammond <chipx86@chipx86.com>
parents:
8758
diff
changeset
|
3952 |
1076cd8579ea
[gaim-migrate @ 9564]
Christian Hammond <chipx86@chipx86.com>
parents:
8758
diff
changeset
|
3953 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); |
4702 | 3954 } |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3955 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
|
3956 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3957 char *protocol = NULL; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3958 char *username = NULL; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3959 GaimAccount *account; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3960 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3961 if (gaim_gtk_parse_x_im_contact(sd->data, FALSE, &account, |
7718 | 3962 &protocol, &username, NULL)) |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3963 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3964 if (account == NULL) |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3965 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3966 gaim_notify_error(NULL, NULL, |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3967 _("You are not currently signed on with an account that " |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3968 "can add that buddy."), NULL); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3969 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3970 else |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3971 { |
7718 | 3972 c = gaim_conversation_new(GAIM_CONV_IM, account, username); |
3973 gaim_conv_window_add_conversation(win, c); | |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3974 } |
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 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3977 if (username != NULL) g_free(username); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3978 if (protocol != NULL) g_free(protocol); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3979 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3980 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3981 } |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3982 } |
4359 | 3983 |
3984 /************************************************************************** | |
3985 * GTK+ window ops | |
3986 **************************************************************************/ | |
3987 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3988 gaim_gtk_new_window(GaimConvWindow *win) |
4359 | 3989 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3990 GaimGtkWindow *gtkwin; |
4359 | 3991 GtkPositionType pos; |
3992 GtkWidget *testidea; | |
3993 GtkWidget *menubar; | |
3994 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3995 gtkwin = g_malloc0(sizeof(GaimGtkWindow)); |
4359 | 3996 |
3997 win->ui_data = gtkwin; | |
3998 | |
3999 /* Create the window. */ | |
4000 gtkwin->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
4001 gtk_window_set_role(GTK_WINDOW(gtkwin->window), "conversation"); | |
4635 | 4002 gtk_window_set_resizable(GTK_WINDOW(gtkwin->window), TRUE); |
4510
4c394222c732
[gaim-migrate @ 4786]
Christian Hammond <chipx86@chipx86.com>
parents:
4505
diff
changeset
|
4003 gtk_container_set_border_width(GTK_CONTAINER(gtkwin->window), 0); |
5173 | 4004 GTK_WINDOW(gtkwin->window)->allow_shrink = TRUE; |
4359 | 4005 gtk_widget_realize(gtkwin->window); |
4006 | |
4007 g_signal_connect(G_OBJECT(gtkwin->window), "delete_event", | |
4008 G_CALLBACK(close_win_cb), win); | |
4009 | |
4010 /* Create the notebook. */ | |
4011 gtkwin->notebook = gtk_notebook_new(); | |
4012 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4013 pos = gaim_prefs_get_int("/gaim/gtk/conversations/tab_side"); |
4359 | 4014 |
4015 #if 0 | |
4016 gtk_notebook_set_tab_hborder(GTK_NOTEBOOK(gtkwin->notebook), 0); | |
4017 gtk_notebook_set_tab_vborder(GTK_NOTEBOOK(gtkwin->notebook), 0); | |
4018 #endif | |
4019 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos); | |
4020 gtk_notebook_set_scrollable(GTK_NOTEBOOK(gtkwin->notebook), TRUE); | |
4021 gtk_notebook_popup_enable(GTK_NOTEBOOK(gtkwin->notebook)); | |
4818 | 4022 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), FALSE); |
4023 | |
4359 | 4024 gtk_widget_show(gtkwin->notebook); |
4025 | |
8189 | 4026 g_signal_connect(G_OBJECT(gtkwin->notebook), "switch_page", |
4027 G_CALLBACK(before_switch_conv_cb), win); | |
4359 | 4028 g_signal_connect_after(G_OBJECT(gtkwin->notebook), "switch_page", |
4029 G_CALLBACK(switch_conv_cb), win); | |
4030 | |
4031 /* Setup the tab drag and drop signals. */ | |
4486 | 4032 gtk_widget_add_events(gtkwin->notebook, |
4033 GDK_BUTTON1_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK); | |
4034 g_signal_connect(G_OBJECT(gtkwin->notebook), "button_press_event", | |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4035 G_CALLBACK(notebook_press_cb), win); |
4486 | 4036 g_signal_connect(G_OBJECT(gtkwin->notebook), "button_release_event", |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4037 G_CALLBACK(notebook_release_cb), win); |
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4038 |
4359 | 4039 testidea = gtk_vbox_new(FALSE, 0); |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4040 |
4359 | 4041 /* Setup the menubar. */ |
4042 menubar = setup_menubar(win); | |
4043 gtk_box_pack_start(GTK_BOX(testidea), menubar, FALSE, TRUE, 0); | |
4044 | |
4045 gtk_box_pack_start(GTK_BOX(testidea), gtkwin->notebook, TRUE, TRUE, 0); | |
4046 | |
4047 gtk_container_add(GTK_CONTAINER(gtkwin->window), testidea); | |
4048 | |
4049 gtk_widget_show(testidea); | |
4050 } | |
4051 | |
4052 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4053 gaim_gtk_destroy_window(GaimConvWindow *win) |
4359 | 4054 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4055 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4056 |
4057 gtk_widget_destroy(gtkwin->window); | |
4058 | |
4630 | 4059 g_object_unref(G_OBJECT(gtkwin->menu.item_factory)); |
4060 | |
4359 | 4061 g_free(gtkwin); |
4062 win->ui_data = NULL; | |
4063 } | |
4064 | |
4065 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4066 gaim_gtk_show(GaimConvWindow *win) |
4359 | 4067 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4068 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4069 |
4070 gtk_widget_show(gtkwin->window); | |
7413 | 4071 |
4072 #ifdef _WIN32 | |
7415 | 4073 /* This works around a win32 gtk+ bug, where it can't handle |
4074 * creating the button correctly before the window is shown. | |
4075 * That's why we get the appearance of a button, without all | |
4076 * the normal button-like properties, like being able to click | |
7413 | 4077 * it. ;-) --Nathan */ |
7414 | 4078 if (gaim_prefs_get_bool("/gaim/gtk/conversations/close_on_tabs")) { |
4079 GaimConversation *conv; | |
4080 GaimGtkConversation *gtkconv; | |
4081 | |
4082 conv = gaim_conv_window_get_conversation_at(win, 0); | |
4083 if(conv) { | |
4084 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7415 | 4085 gtk_widget_hide(gtkconv->close); |
7414 | 4086 gtk_widget_show_all(gtkconv->close); |
4087 } | |
4088 } | |
7413 | 4089 #endif |
4359 | 4090 } |
4091 | |
4092 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4093 gaim_gtk_hide(GaimConvWindow *win) |
4359 | 4094 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4095 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4096 |
4097 gtk_widget_hide(gtkwin->window); | |
4098 } | |
4099 | |
4100 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4101 gaim_gtk_raise(GaimConvWindow *win) |
4359 | 4102 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4103 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4104 |
5484 | 4105 gtk_widget_show(gtkwin->window); |
5103 | 4106 gtk_window_deiconify(GTK_WINDOW(gtkwin->window)); |
4526 | 4107 gdk_window_raise(gtkwin->window->window); |
4359 | 4108 } |
4109 | |
4110 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4111 gaim_gtk_flash(GaimConvWindow *win) |
4359 | 4112 { |
4113 #ifdef _WIN32 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4114 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4115 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4116 wgaim_conv_im_blink(gtkwin->window); |
4359 | 4117 #endif |
4118 } | |
4119 | |
4120 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4121 gaim_gtk_switch_conversation(GaimConvWindow *win, unsigned int index) |
4359 | 4122 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4123 GaimGtkWindow *gtkwin; |
4359 | 4124 |
4125 gtkwin = GAIM_GTK_WINDOW(win); | |
4126 | |
4127 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), index); | |
4128 } | |
4129 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4130 static const GtkTargetEntry te[] = |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4131 { |
7695 | 4132 {"text/plain", 0, 0}, |
4133 {"text/uri-list", 0, 1}, | |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4134 {"GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, 2}, |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4135 {"STRING", 0, 3}, |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4136 {"application/x-im-contact", 0, 4} |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4137 }; |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4138 |
4359 | 4139 static void |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4140 gaim_gtk_add_conversation(GaimConvWindow *win, GaimConversation *conv) |
4359 | 4141 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4142 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4143 GaimGtkConversation *gtkconv, *focus_gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4144 GaimConversation *focus_conv; |
4359 | 4145 GtkWidget *pane = NULL; |
4146 GtkWidget *tab_cont; | |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4147 GtkWidget *tabby, *menu_tabby; |
4359 | 4148 gboolean new_ui; |
4383
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4149 GaimConversationType conv_type; |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4150 const char *name; |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4151 |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4152 name = gaim_conversation_get_name(conv); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4153 conv_type = gaim_conversation_get_type(conv); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4154 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4155 |
4156 if (conv->ui_data != NULL) { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4157 gtkconv = (GaimGtkConversation *)conv->ui_data; |
4359 | 4158 |
4159 tab_cont = gtkconv->tab_cont; | |
4160 | |
4161 new_ui = FALSE; | |
4162 } | |
4163 else { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4164 gtkconv = g_malloc0(sizeof(GaimGtkConversation)); |
4359 | 4165 conv->ui_data = gtkconv; |
4166 | |
4167 /* Setup some initial variables. */ | |
4168 gtkconv->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
4169 gtkconv->tooltips = gtk_tooltips_new(); | |
4170 | |
7879 | 4171 if (conv_type == GAIM_CONV_IM) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4172 gtkconv->u.im = g_malloc0(sizeof(GaimGtkImPane)); |
4359 | 4173 gtkconv->u.im->a_virgin = TRUE; |
4174 | |
4175 pane = setup_im_pane(conv); | |
4176 } | |
7879 | 4177 else if (conv_type == GAIM_CONV_CHAT) { |
4178 gtkconv->u.chat = g_malloc0(sizeof(GaimGtkChatPane)); | |
4179 | |
4180 pane = setup_chat_pane(conv); | |
4181 } | |
4359 | 4182 |
4183 if (pane == NULL) { | |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4184 if (conv_type == GAIM_CONV_CHAT) g_free(gtkconv->u.chat); |
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4185 else if (conv_type == GAIM_CONV_IM) g_free(gtkconv->u.im); |
4359 | 4186 |
4187 g_free(gtkconv); | |
4188 conv->ui_data = NULL; | |
4189 | |
4190 return; | |
4191 } | |
4192 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4193 /* Setup drag-and-drop */ |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4194 gtk_drag_dest_set(pane, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4195 GTK_DEST_DEFAULT_MOTION | |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4196 GTK_DEST_DEFAULT_DROP, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4197 te, sizeof(te) / sizeof(GtkTargetEntry), |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4198 GDK_ACTION_COPY); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4199 gtk_drag_dest_set(gtkconv->imhtml, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4200 GTK_DEST_DEFAULT_MOTION | |
4702 | 4201 GTK_DEST_DEFAULT_DROP, |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4202 te, sizeof(te) / sizeof(GtkTargetEntry), |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4203 GDK_ACTION_DEFAULT | GDK_ACTION_COPY | |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4204 GDK_ACTION_MOVE); |
7695 | 4205 gtk_drag_dest_set(gtkconv->entry, |
4206 GTK_DEST_DEFAULT_MOTION | | |
4207 GTK_DEST_DEFAULT_DROP, | |
4208 te, sizeof(te) / sizeof(GtkTargetEntry), | |
4209 GDK_ACTION_COPY); | |
4210 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4211 g_signal_connect(G_OBJECT(pane), "drag_data_received", |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4212 G_CALLBACK(conv_dnd_recv), conv); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4213 g_signal_connect(G_OBJECT(gtkconv->imhtml), "drag_data_received", |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4214 G_CALLBACK(conv_dnd_recv), conv); |
8105 | 4215 #if 0 |
4216 g_signal_connect(G_OBJECT(gtkconv->entry), "drag_data_received", | |
4217 G_CALLBACK(conv_dnd_recv), conv); | |
4218 #endif | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4219 |
4359 | 4220 /* Setup the container for the tab. */ |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4221 gtkconv->tab_cont = tab_cont = gtk_vbox_new(FALSE, 6); |
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4222 gtk_container_set_border_width(GTK_CONTAINER(tab_cont), 6); |
4359 | 4223 gtk_container_add(GTK_CONTAINER(tab_cont), pane); |
4224 gtk_widget_show(pane); | |
4225 | |
4226 new_ui = TRUE; | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
4227 |
4359 | 4228 gtkconv->make_sound = TRUE; |
5902
6889b89cab90
[gaim-migrate @ 6334]
Christian Hammond <chipx86@chipx86.com>
parents:
5901
diff
changeset
|
4229 |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4230 gtkconv->show_formatting_toolbar = gaim_prefs_get_bool( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4231 "/gaim/gtk/conversations/show_formatting_toolbar"); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4232 |
8329
9dd7c75ed433
[gaim-migrate @ 9053]
Christian Hammond <chipx86@chipx86.com>
parents:
8319
diff
changeset
|
4233 if (gtkconv->show_formatting_toolbar) |
9dd7c75ed433
[gaim-migrate @ 9053]
Christian Hammond <chipx86@chipx86.com>
parents:
8319
diff
changeset
|
4234 gtk_widget_show(gtkconv->toolbar); |
9dd7c75ed433
[gaim-migrate @ 9053]
Christian Hammond <chipx86@chipx86.com>
parents:
8319
diff
changeset
|
4235 |
8176 | 4236 g_signal_connect_swapped(G_OBJECT(pane), "focus", |
4237 G_CALLBACK(gtk_widget_grab_focus), | |
4238 gtkconv->entry); | |
4359 | 4239 } |
4240 | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4241 gtkconv->tabby = tabby = gtk_hbox_new(FALSE, 6); |
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4242 gtkconv->menu_tabby = menu_tabby = gtk_hbox_new(FALSE, 6); |
4359 | 4243 |
4244 /* Close button. */ | |
4245 gtkconv->close = gtk_button_new(); | |
4246 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
|
4247 gtk_button_set_relief(GTK_BUTTON(gtkconv->close), GTK_RELIEF_NONE); |
4359 | 4248 gtk_container_add(GTK_CONTAINER(gtkconv->close), |
4445 | 4249 gtk_image_new_from_stock(GTK_STOCK_CLOSE, |
4250 GTK_ICON_SIZE_MENU)); | |
4359 | 4251 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->close, |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4252 _("Close conversation"), NULL); |
4359 | 4253 |
4254 g_signal_connect(G_OBJECT(gtkconv->close), "clicked", | |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4255 G_CALLBACK(close_conv_cb), conv); |
4359 | 4256 |
7446
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4257 /* |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4258 * 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
|
4259 * border bug. I love you guys! -- ChipX86 |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4260 */ |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4261 g_signal_connect(G_OBJECT(gtkconv->close), "state_changed", |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4262 G_CALLBACK(tab_close_button_state_changed_cb), NULL); |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4263 |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4264 /* Status icon. */ |
6440 | 4265 gtkconv->icon = gtk_image_new(); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4266 gtkconv->menu_icon = gtk_image_new(); |
6440 | 4267 update_tab_icon(conv); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4268 |
4359 | 4269 /* Tab label. */ |
4270 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
|
4271 gtkconv->menu_label = gtk_label_new(gaim_conversation_get_title(conv)); |
4359 | 4272 #if 0 |
4273 gtk_misc_set_alignment(GTK_MISC(gtkconv->tab_label), 0.00, 0.5); | |
4274 gtk_misc_set_padding(GTK_MISC(gtkconv->tab_label), 4, 0); | |
4275 #endif | |
4276 | |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
4277 |
4359 | 4278 /* Pack it all together. */ |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4279 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
|
4280 gtk_box_pack_start(GTK_BOX(menu_tabby), gtkconv->menu_icon, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4281 FALSE, FALSE, 0); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4282 |
8946 | 4283 gtk_widget_show_all(gtkconv->icon); |
4284 gtk_widget_show_all(gtkconv->menu_icon); | |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4285 |
4359 | 4286 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
|
4287 gtk_box_pack_start(GTK_BOX(menu_tabby), gtkconv->menu_label, TRUE, TRUE, 0); |
4445 | 4288 gtk_widget_show(gtkconv->tab_label); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4289 gtk_widget_show(gtkconv->menu_label); |
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4290 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
|
4291 |
4445 | 4292 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
|
4293 if (gaim_prefs_get_bool("/gaim/gtk/conversations/close_on_tabs")) |
4445 | 4294 gtk_widget_show_all(gtkconv->close); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4295 |
4445 | 4296 gtk_widget_show(tabby); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4297 gtk_widget_show(menu_tabby); |
4359 | 4298 |
7143 | 4299 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
4300 gaim_gtkconv_update_buddy_icon(conv); | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4301 |
4359 | 4302 /* Add this pane to the conversations notebook. */ |
4303 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
|
4304 gtk_notebook_set_menu_label(GTK_NOTEBOOK(gtkwin->notebook), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4305 tab_cont, menu_tabby); |
4359 | 4306 |
4307 gtk_widget_show(tab_cont); | |
4308 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4309 if (gaim_conv_window_get_conversation_count(win) == 1) { |
4818 | 4310 /* Er, bug in notebooks? Switch to the page manually. */ |
4359 | 4311 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), 0); |
4851 | 4312 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4313 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4314 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4315 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4316 else |
4818 | 4317 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), TRUE); |
4359 | 4318 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4319 focus_conv = g_list_nth_data(gaim_conv_window_get_conversations(win), |
5204 | 4320 gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook))); |
4321 focus_gtkconv = GAIM_GTK_CONVERSATION(focus_conv); | |
4322 gtk_widget_grab_focus(focus_gtkconv->entry); | |
4359 | 4323 |
4324 if (!new_ui) | |
4325 g_object_unref(gtkconv->tab_cont); | |
4326 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4327 if (gaim_conv_window_get_conversation_count(win) == 1) |
4685 | 4328 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); |
4359 | 4329 } |
4330 | |
4331 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4332 gaim_gtk_remove_conversation(GaimConvWindow *win, GaimConversation *conv) |
4359 | 4333 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4334 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4335 GaimGtkConversation *gtkconv; |
4359 | 4336 unsigned int index; |
4818 | 4337 GaimConversationType conv_type; |
4338 | |
4339 conv_type = gaim_conversation_get_type(conv); | |
4359 | 4340 index = gaim_conversation_get_index(conv); |
4341 | |
4342 gtkwin = GAIM_GTK_WINDOW(win); | |
4343 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4344 | |
4345 g_object_ref(gtkconv->tab_cont); | |
4346 gtk_object_sink(GTK_OBJECT(gtkconv->tab_cont)); | |
4347 | |
4348 gtk_notebook_remove_page(GTK_NOTEBOOK(gtkwin->notebook), index); | |
4349 | |
4818 | 4350 /* go back to tabless if need be */ |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4351 if (gaim_conv_window_get_conversation_count(win) <= 2) { |
4818 | 4352 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4353 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); |
4818 | 4354 } |
4355 | |
4356 | |
4359 | 4357 /* If this window is setup with an inactive gc, regenerate the menu. */ |
4818 | 4358 if (conv_type == GAIM_CONV_IM && |
4359 | 4359 gaim_conversation_get_gc(conv) == NULL) { |
4360 | |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
4361 generate_send_as_items(win, conv); |
4359 | 4362 } |
4363 } | |
4364 | |
4365 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4366 gaim_gtk_move_conversation(GaimConvWindow *win, GaimConversation *conv, |
4359 | 4367 unsigned int new_index) |
4368 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4369 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4370 GaimGtkConversation *gtkconv; |
4359 | 4371 |
4372 gtkwin = GAIM_GTK_WINDOW(win); | |
4373 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4374 | |
4415
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4375 if (new_index > gaim_conversation_get_index(conv)) |
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4376 new_index--; |
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4377 |
4359 | 4378 gtk_notebook_reorder_child(GTK_NOTEBOOK(gtkwin->notebook), |
4379 gtkconv->tab_cont, new_index); | |
4380 } | |
4381 | |
4382 static int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4383 gaim_gtk_get_active_index(const GaimConvWindow *win) |
4359 | 4384 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4385 GaimGtkWindow *gtkwin; |
5680
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4386 int index; |
4359 | 4387 |
4388 gtkwin = GAIM_GTK_WINDOW(win); | |
4389 | |
5680
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4390 index = gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook)); |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4391 |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4392 /* |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4393 * A fix, because the first conversation may be active, but not |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4394 * appear in the notebook just yet. -- ChipX86 |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4395 */ |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4396 return (index == -1 ? 0 : index); |
4359 | 4397 } |
4398 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4399 static GaimConvWindowUiOps window_ui_ops = |
4359 | 4400 { |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
4401 gaim_gtk_conversations_get_conv_ui_ops, |
4359 | 4402 gaim_gtk_new_window, |
4403 gaim_gtk_destroy_window, | |
4404 gaim_gtk_show, | |
4405 gaim_gtk_hide, | |
4406 gaim_gtk_raise, | |
4407 gaim_gtk_flash, | |
4408 gaim_gtk_switch_conversation, | |
4409 gaim_gtk_add_conversation, | |
4410 gaim_gtk_remove_conversation, | |
4411 gaim_gtk_move_conversation, | |
4412 gaim_gtk_get_active_index | |
4413 }; | |
4414 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4415 GaimConvWindowUiOps * |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
4416 gaim_gtk_conversations_get_win_ui_ops(void) |
4359 | 4417 { |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4418 return &window_ui_ops; |
4359 | 4419 } |
4420 | |
4421 /************************************************************************** | |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4422 * Conversation UI operations |
4359 | 4423 **************************************************************************/ |
4424 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4425 gaim_gtkconv_destroy(GaimConversation *conv) |
4359 | 4426 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4427 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); |
4359 | 4428 |
4429 if (gtkconv->dialogs.log != NULL) | |
4430 gtk_widget_destroy(gtkconv->dialogs.log); | |
4431 | |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4432 gtk_widget_destroy(gtkconv->tab_cont); |
4892 | 4433 g_object_unref(gtkconv->tab_cont); |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4434 |
4359 | 4435 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
4755 | 4436 if (gtkconv->u.im->icon_timer != 0) |
4437 g_source_remove(gtkconv->u.im->icon_timer); | |
4438 | |
4359 | 4439 if (gtkconv->u.im->save_icon != NULL) |
4440 gtk_widget_destroy(gtkconv->u.im->save_icon); | |
4441 | |
4442 if (gtkconv->u.im->anim != NULL) | |
4793 | 4443 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); |
4359 | 4444 |
4445 g_free(gtkconv->u.im); | |
4446 } | |
4447 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
4448 g_free(gtkconv->u.chat); | |
4449 } | |
4450 | |
4633 | 4451 gtk_object_sink(GTK_OBJECT(gtkconv->tooltips)); |
4452 | |
4359 | 4453 g_free(gtkconv); |
4454 } | |
4455 | |
4456 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4457 gaim_gtkconv_write_im(GaimConversation *conv, const char *who, |
6982 | 4458 const char *message, GaimMessageFlags flags, |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4459 time_t mtime) |
4359 | 4460 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4461 GaimGtkConversation *gtkconv; |
8630 | 4462 GaimConvWindow *gaimwin; |
4463 GaimGtkWindow *gtkwin; | |
4464 gboolean has_focus; | |
4359 | 4465 |
4466 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
8630 | 4467 gaimwin = gaim_conversation_get_window(conv); |
4468 gtkwin = GAIM_GTK_WINDOW(gaimwin); | |
4469 | |
4470 g_object_get(G_OBJECT(gtkwin->window), "has-toplevel-focus", &has_focus, NULL); | |
4359 | 4471 |
6621 | 4472 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4473 gaim_prefs_get_bool("/gaim/gtk/conversations/im/raise_on_events")) { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4474 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4475 gaim_conv_window_raise(gaim_conversation_get_window(conv)); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4476 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4477 |
4382
76223649765b
[gaim-migrate @ 4648]
Christian Hammond <chipx86@chipx86.com>
parents:
4378
diff
changeset
|
4478 /* Play a sound, if specified in prefs. */ |
8630 | 4479 if (gtkconv->make_sound && !((gaim_conv_window_get_active_conversation(gaimwin) == conv) && |
8633 | 4480 !gaim_prefs_get_bool("/gaim/gtk/sound/conv_focus") && has_focus)) { |
6621 | 4481 if (flags & GAIM_MESSAGE_RECV) { |
4359 | 4482 if (gtkconv->u.im->a_virgin && |
5820 | 4483 gaim_prefs_get_bool("/gaim/gtk/sound/enabled/first_im_recv")) { |
4359 | 4484 |
4561 | 4485 gaim_sound_play_event(GAIM_SOUND_FIRST_RECEIVE); |
4359 | 4486 } |
4487 else | |
4561 | 4488 gaim_sound_play_event(GAIM_SOUND_RECEIVE); |
4359 | 4489 } |
4490 else { | |
4561 | 4491 gaim_sound_play_event(GAIM_SOUND_SEND); |
4359 | 4492 } |
4493 } | |
4494 | |
4495 gtkconv->u.im->a_virgin = FALSE; | |
4496 | |
6982 | 4497 gaim_conversation_write(conv, who, message, flags, mtime); |
4359 | 4498 } |
4499 | |
4500 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4501 gaim_gtkconv_write_chat(GaimConversation *conv, const char *who, |
6621 | 4502 const char *message, GaimMessageFlags flags, time_t mtime) |
4359 | 4503 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4504 GaimGtkConversation *gtkconv; |
8630 | 4505 GaimConvWindow *gaimwin; |
4506 GaimGtkWindow *gtkwin; | |
4507 gboolean has_focus; | |
4359 | 4508 |
4509 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
8630 | 4510 gaimwin = gaim_conversation_get_window(conv); |
4511 gtkwin = GAIM_GTK_WINDOW(gaimwin); | |
4512 | |
4513 g_object_get(G_OBJECT(gtkwin->window), "has-toplevel-focus", &has_focus, NULL); | |
4359 | 4514 |
4382
76223649765b
[gaim-migrate @ 4648]
Christian Hammond <chipx86@chipx86.com>
parents:
4378
diff
changeset
|
4515 /* Play a sound, if specified in prefs. */ |
8630 | 4516 if (gtkconv->make_sound && !((gaim_conv_window_get_active_conversation(gaimwin) == conv) && |
8633 | 4517 !gaim_prefs_get_bool("/gaim/gtk/sound/conv_focus") && has_focus)) { |
6621 | 4518 if (!(flags & GAIM_MESSAGE_WHISPER) && (flags & GAIM_MESSAGE_SEND)) |
4561 | 4519 gaim_sound_play_event(GAIM_SOUND_CHAT_YOU_SAY); |
6621 | 4520 else if (flags & GAIM_MESSAGE_RECV) { |
4521 if ((flags & GAIM_MESSAGE_NICK) && | |
8573 | 4522 gaim_prefs_get_bool("/gaim/gtk/sound/enabled/nick_said") && |
4523 !(flags & GAIM_MESSAGE_SYSTEM)) { | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4524 |
4561 | 4525 gaim_sound_play_event(GAIM_SOUND_CHAT_NICK); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4526 } |
4359 | 4527 else |
4561 | 4528 gaim_sound_play_event(GAIM_SOUND_CHAT_SAY); |
4359 | 4529 } |
4530 } | |
4531 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4532 if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/color_nicks")) |
6621 | 4533 flags |= GAIM_MESSAGE_COLORIZE; |
4359 | 4534 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4535 /* Raise the window, if specified in prefs. */ |
6621 | 4536 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4537 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4538 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4539 gaim_conv_window_raise(gaim_conversation_get_window(conv)); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4540 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4541 |
6982 | 4542 gaim_conversation_write(conv, who, message, flags, mtime); |
4359 | 4543 } |
4544 | |
4545 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4546 gaim_gtkconv_write_conv(GaimConversation *conv, const char *who, |
6982 | 4547 const char *message, GaimMessageFlags flags, |
4359 | 4548 time_t mtime) |
4549 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4550 GaimGtkConversation *gtkconv; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4551 GaimConvWindow *win; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
4552 GaimConnection *gc; |
4359 | 4553 int gtk_font_options = 0; |
7440 | 4554 char buf[BUF_LONG]; |
4359 | 4555 char buf2[BUF_LONG]; |
4556 char mdate[64]; | |
4557 char color[10]; | |
4558 char *str; | |
4559 char *with_font_tag; | |
4896 | 4560 char *sml_attrib = NULL; |
6982 | 4561 size_t length = strlen(message) + 1; |
4895 | 4562 |
4359 | 4563 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4564 gc = gaim_conversation_get_gc(conv); | |
4565 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4566 win = gaim_conversation_get_window(conv); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4567 |
6621 | 4568 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
7431 | 4569 ((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT && |
4570 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) || | |
4571 (gaim_conversation_get_type(conv) == GAIM_CONV_IM && | |
8897 | 4572 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
|
4573 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4574 gaim_conv_window_show(win); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4575 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4576 |
8677 | 4577 if (gtk_text_buffer_get_char_count(gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)))) |
4578 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", 0); | |
4579 | |
5133 | 4580 if(time(NULL) > mtime + 20*60) /* show date if older than 20 minutes */ |
4581 strftime(mdate, sizeof(mdate), "%Y-%m-%d %H:%M:%S", localtime(&mtime)); | |
4582 else | |
4583 strftime(mdate, sizeof(mdate), "%H:%M:%S", localtime(&mtime)); | |
4359 | 4584 |
4896 | 4585 if(gc) |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4586 sml_attrib = g_strdup_printf("sml=\"%s\"", gc->prpl->info->name); |
7440 | 4587 |
4359 | 4588 gtk_font_options ^= GTK_IMHTML_NO_COMMENTS; |
4589 | |
9049 | 4590 #if 1 /* PREFSLASH04 */ |
4591 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_colors")) | |
4592 gtk_font_options ^= GTK_IMHTML_NO_COLOURS; | |
4593 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_fonts")) | |
4594 gtk_font_options ^= GTK_IMHTML_NO_FONTS; | |
4595 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_font_sizes")) | |
4596 gtk_font_options ^= GTK_IMHTML_NO_SIZES; | |
4597 #else | |
8944 | 4598 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_formatting")) { |
4359 | 4599 gtk_font_options ^= GTK_IMHTML_NO_COLOURS; |
4600 gtk_font_options ^= GTK_IMHTML_NO_FONTS; | |
4601 gtk_font_options ^= GTK_IMHTML_NO_SIZES; | |
8944 | 4602 } |
9049 | 4603 #endif |
4359 | 4604 |
7956 | 4605 /* this is gonna crash one day, I can feel it. */ |
4606 if (GAIM_PLUGIN_PROTOCOL_INFO(gaim_find_prpl(gaim_account_get_protocol_id(conv->account)))->options & | |
7431 | 4607 OPT_PROTO_USE_POINTSIZE) { |
5367 | 4608 gtk_font_options ^= GTK_IMHTML_USE_POINTSIZE; |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4609 } |
4359 | 4610 |
6621 | 4611 if (flags & GAIM_MESSAGE_SYSTEM) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4612 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) |
8380 | 4613 g_snprintf(buf, BUF_LONG, "<FONT SIZE=\"2\">(%s)</FONT> <B>%s</B>", |
7431 | 4614 mdate, message); |
4359 | 4615 else |
4616 g_snprintf(buf, BUF_LONG, "<B>%s</B>", message); | |
7440 | 4617 |
4359 | 4618 g_snprintf(buf2, sizeof(buf2), |
8690 | 4619 "<FONT %s><FONT SIZE=\"2\"><!--(%s) --></FONT><B>%s</B></FONT>", |
7850 | 4620 sml_attrib, mdate, message); |
7440 | 4621 |
8962 | 4622 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, 0); |
7440 | 4623 |
7583 | 4624 /* Add the message to a conversations scrollback buffer */ |
4625 conv->history = g_string_append(conv->history, buf); | |
4626 conv->history = g_string_append(conv->history, "<BR>\n"); | |
7440 | 4627 |
8722 | 4628 } else if (flags & GAIM_MESSAGE_ERROR) { |
4629 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) | |
4630 g_snprintf(buf, BUF_LONG, "<FONT SIZE=\"2\">(%s)</FONT> <B>%s</B>", | |
4631 mdate, message); | |
4632 else | |
4633 g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"#ff0000\"><B>%s</B></FONT>", message); | |
4634 | |
4635 g_snprintf(buf2, sizeof(buf2), | |
4636 "<FONT %s><FONT SIZE=\"2\"><!--(%s) --></FONT><B>%s</B></FONT>", | |
4637 sml_attrib, mdate, message); | |
4638 | |
8962 | 4639 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, 0); |
4640 | |
8722 | 4641 /* Add the message to a conversations scrollback buffer */ |
4642 conv->history = g_string_append(conv->history, buf); | |
4643 conv->history = g_string_append(conv->history, "<BR>\n"); | |
7431 | 4644 } else if (flags & GAIM_MESSAGE_NO_LOG) { |
4359 | 4645 g_snprintf(buf, BUF_LONG, |
8690 | 4646 "<B><FONT %s COLOR=\"#777777\">%s</FONT></B>", |
7850 | 4647 sml_attrib, message); |
7440 | 4648 |
8962 | 4649 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf, 0); |
4359 | 4650 } |
4651 else { | |
4895 | 4652 char *new_message = g_memdup(message, length); |
8908 | 4653 char *who_escaped = g_markup_escape_text(who, strlen(who)); |
7440 | 4654 |
6621 | 4655 if (flags & GAIM_MESSAGE_WHISPER) { |
4359 | 4656 str = g_malloc(1024); |
7440 | 4657 |
4359 | 4658 /* If we're whispering, it's not an autoresponse. */ |
7564 | 4659 if (gaim_message_meify(new_message, length)) { |
8908 | 4660 g_snprintf(str, 1024, "***%s", who_escaped); |
4359 | 4661 strcpy(color, "#6C2585"); |
4662 } | |
4663 else { | |
8908 | 4664 g_snprintf(str, 1024, "*%s*:", who_escaped); |
4359 | 4665 strcpy(color, "#00FF00"); |
4666 } | |
7440 | 4667 } |
4359 | 4668 else { |
7564 | 4669 if (gaim_message_meify(new_message, length)) { |
4359 | 4670 str = g_malloc(1024); |
7440 | 4671 |
6621 | 4672 if (flags & GAIM_MESSAGE_AUTO_RESP) |
8908 | 4673 g_snprintf(str, 1024, "%s ***%s", AUTO_RESPONSE, who_escaped); |
4359 | 4674 else |
8908 | 4675 g_snprintf(str, 1024, "***%s", who_escaped); |
7440 | 4676 |
6621 | 4677 if (flags & GAIM_MESSAGE_NICK) |
4359 | 4678 strcpy(color, "#AF7F00"); |
4679 else | |
4680 strcpy(color, "#062585"); | |
4681 } | |
4682 else { | |
4683 str = g_malloc(1024); | |
6621 | 4684 if (flags & GAIM_MESSAGE_AUTO_RESP) |
8908 | 4685 g_snprintf(str, 1024, "%s %s", who_escaped, AUTO_RESPONSE); |
4359 | 4686 else |
8908 | 4687 g_snprintf(str, 1024, "%s:", who_escaped); |
6621 | 4688 if (flags & GAIM_MESSAGE_NICK) |
4359 | 4689 strcpy(color, "#AF7F00"); |
6621 | 4690 else if (flags & GAIM_MESSAGE_RECV) { |
4691 if (flags & GAIM_MESSAGE_COLORIZE) { | |
4359 | 4692 const char *u; |
4693 int m = 0; | |
7440 | 4694 |
4359 | 4695 for (u = who; *u != '\0'; u++) |
4696 m += *u; | |
7440 | 4697 |
4359 | 4698 m = m % NUM_NICK_COLORS; |
7440 | 4699 |
4359 | 4700 strcpy(color, nick_colors[m]); |
4701 } | |
4702 else | |
7854 | 4703 strcpy(color, RECV_COLOR); |
4359 | 4704 } |
6621 | 4705 else if (flags & GAIM_MESSAGE_SEND) |
7854 | 4706 strcpy(color, SEND_COLOR); |
4359 | 4707 } |
8908 | 4708 |
4709 if(who_escaped) | |
4710 g_free(who_escaped); | |
4359 | 4711 } |
7440 | 4712 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4713 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) |
4359 | 4714 g_snprintf(buf, BUF_LONG, |
8380 | 4715 "<FONT COLOR=\"%s\" %s><FONT SIZE=\"2\">(%s)</FONT> " |
7431 | 4716 "<B>%s</B></FONT> ", color, |
4717 sml_attrib ? sml_attrib : "", mdate, str); | |
4359 | 4718 else |
4719 g_snprintf(buf, BUF_LONG, | |
7431 | 4720 "<FONT COLOR=\"%s\" %s><B>%s</B></FONT> ", color, |
4721 sml_attrib ? sml_attrib : "", str); | |
7440 | 4722 |
4359 | 4723 g_snprintf(buf2, BUF_LONG, |
8380 | 4724 "<FONT COLOR=\"%s\" %s><FONT SIZE=\"2\"><!--(%s) --></FONT>" |
7431 | 4725 "<B>%s</B></FONT> ", |
4726 color, sml_attrib ? sml_attrib : "", mdate, str); | |
7440 | 4727 |
4359 | 4728 g_free(str); |
4729 | |
8962 | 4730 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), |
4731 buf2, 0); | |
4359 | 4732 |
4895 | 4733 if(gc){ |
4896 | 4734 char *pre = g_strdup_printf("<font %s>", sml_attrib ? sml_attrib : ""); |
4895 | 4735 char *post = "</font>"; |
4736 int pre_len = strlen(pre); | |
4737 int post_len = strlen(post); | |
7440 | 4738 |
4895 | 4739 with_font_tag = g_malloc(length + pre_len + post_len + 1); |
7440 | 4740 |
4895 | 4741 strcpy(with_font_tag, pre); |
4742 memcpy(with_font_tag + pre_len, new_message, length); | |
4743 strcpy(with_font_tag + pre_len + length, post); | |
7440 | 4744 |
4895 | 4745 length += pre_len + post_len; |
4746 g_free(pre); | |
4747 } | |
4608 | 4748 else |
4895 | 4749 with_font_tag = g_memdup(new_message, length); |
7440 | 4750 |
8962 | 4751 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), |
4752 with_font_tag, gtk_font_options); | |
7440 | 4753 |
8557 | 4754 conv->history = g_string_append(conv->history, buf); |
4755 conv->history = g_string_append(conv->history, new_message); | |
4756 conv->history = g_string_append(conv->history, "<BR>\n"); | |
7440 | 4757 |
4758 g_free(with_font_tag); | |
7447 | 4759 g_free(new_message); |
7440 | 4760 } |
4761 | |
6062 | 4762 |
5012 | 4763 if(sml_attrib) |
4764 g_free(sml_attrib); | |
4359 | 4765 } |
4766 | |
4767 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4768 gaim_gtkconv_chat_add_user(GaimConversation *conv, const char *user) |
4359 | 4769 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4770 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4771 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4772 GaimGtkChatPane *gtkchat; |
4359 | 4773 char tmp[BUF_LONG]; |
4774 int num_users; | |
4775 int pos; | |
4776 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4777 chat = GAIM_CONV_CHAT(conv); |
4359 | 4778 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4779 gtkchat = gtkconv->u.chat; | |
4780 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4781 num_users = g_list_length(gaim_conv_chat_get_users(chat)); |
4359 | 4782 |
4783 g_snprintf(tmp, sizeof(tmp), | |
4784 ngettext("%d person in room", "%d people in room", | |
4785 num_users), | |
4786 num_users); | |
4787 | |
4788 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); | |
4789 | |
4790 if (gtkconv->make_sound) | |
4561 | 4791 gaim_sound_play_event(GAIM_SOUND_CHAT_JOIN); |
4359 | 4792 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4793 pos = g_list_index(gaim_conv_chat_get_users(chat), user); |
4359 | 4794 |
4795 add_chat_buddy_common(conv, user, pos); | |
4796 } | |
4797 | |
4798 static void | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4799 gaim_gtkconv_chat_add_users(GaimConversation *conv, GList *users) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4800 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4801 GaimConvChat *chat; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4802 GaimGtkConversation *gtkconv; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4803 GaimGtkChatPane *gtkchat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4804 GList *l; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4805 char tmp[BUF_LONG]; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4806 int num_users; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4807 int pos; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4808 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4809 chat = GAIM_CONV_CHAT(conv); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4810 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4811 gtkchat = gtkconv->u.chat; |
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 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
|
4814 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4815 g_snprintf(tmp, sizeof(tmp), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4816 ngettext("%d person in room", "%d people in room", |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4817 num_users), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4818 num_users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4819 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4820 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4821 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4822 for (l = users; l != NULL; l = l->next) { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4823 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
|
4824 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4825 add_chat_buddy_common(conv, (char *)l->data, pos); |
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 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4828 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4829 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4830 gaim_gtkconv_chat_rename_user(GaimConversation *conv, const char *old_name, |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4831 const char *new_name) |
4359 | 4832 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4833 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4834 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4835 GaimGtkChatPane *gtkchat; |
4359 | 4836 GtkTreeIter iter; |
4837 GtkTreeModel *model; | |
4838 GList *names; | |
4839 int pos; | |
4840 int f = 1; | |
4841 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4842 chat = GAIM_CONV_CHAT(conv); |
4359 | 4843 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4844 gtkchat = gtkconv->u.chat; | |
4845 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4846 for (names = gaim_conv_chat_get_users(chat); |
4359 | 4847 names != NULL; |
4848 names = names->next) { | |
4849 | |
4850 char *u = (char *)names->data; | |
4851 | |
4793 | 4852 if (!gaim_utf8_strcasecmp(u, old_name)) { |
4359 | 4853 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
4854 | |
4855 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
4856 break; | |
4857 | |
4858 while (f != 0) { | |
4859 char *val; | |
4860 | |
4861 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &val, -1); | |
4862 | |
4793 | 4863 if (!gaim_utf8_strcasecmp(old_name, val)) { |
4359 | 4864 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
4640 | 4865 break; |
4866 } | |
4359 | 4867 |
4868 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
4869 | |
4870 g_free(val); | |
4871 } | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
4872 |
4359 | 4873 break; |
4874 } | |
4875 } | |
4876 | |
4877 if (!names) | |
4878 return; | |
4879 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4880 pos = g_list_index(gaim_conv_chat_get_users(chat), new_name); |
4359 | 4881 |
4882 add_chat_buddy_common(conv, new_name, pos); | |
4883 } | |
4884 | |
4885 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4886 gaim_gtkconv_chat_remove_user(GaimConversation *conv, const char *user) |
4359 | 4887 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4888 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4889 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4890 GaimGtkChatPane *gtkchat; |
4359 | 4891 GtkTreeIter iter; |
4892 GtkTreeModel *model; | |
4893 GList *names; | |
4894 char tmp[BUF_LONG]; | |
4895 int num_users; | |
4896 int f = 1; | |
4897 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4898 chat = GAIM_CONV_CHAT(conv); |
4359 | 4899 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4900 gtkchat = gtkconv->u.chat; | |
4901 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4902 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
|
4903 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4904 for (names = gaim_conv_chat_get_users(chat); |
4359 | 4905 names != NULL; |
4906 names = names->next) { | |
4907 | |
4908 char *u = (char *)names->data; | |
4909 | |
4793 | 4910 if (!gaim_utf8_strcasecmp(u, user)) { |
4359 | 4911 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
4912 | |
4913 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
4914 break; | |
4915 | |
4916 while (f != 0) { | |
4917 char *val; | |
4918 | |
4919 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &val, -1); | |
4920 | |
4793 | 4921 if (!gaim_utf8_strcasecmp(user, val)) |
4359 | 4922 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
4923 | |
4924 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
4925 | |
4926 g_free(val); | |
4927 } | |
4928 | |
4929 break; | |
4930 } | |
4931 } | |
4932 | |
4933 if (names == NULL) | |
4934 return; | |
4935 | |
4936 g_snprintf(tmp, sizeof(tmp), | |
4937 ngettext("%d person in room", "%d people in room", | |
4938 num_users), num_users); | |
4939 | |
4940 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); | |
4941 | |
4942 if (gtkconv->make_sound) | |
4561 | 4943 gaim_sound_play_event(GAIM_SOUND_CHAT_LEAVE); |
4359 | 4944 } |
4945 | |
4946 static void | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4947 gaim_gtkconv_chat_remove_users(GaimConversation *conv, GList *users) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4948 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4949 GaimConvChat *chat; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4950 GaimGtkConversation *gtkconv; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4951 GaimGtkChatPane *gtkchat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4952 GtkTreeIter iter; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4953 GtkTreeModel *model; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4954 GList *names = NULL; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4955 GList *l; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4956 char tmp[BUF_LONG]; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4957 int num_users; |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
4958 gboolean f; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4959 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4960 chat = GAIM_CONV_CHAT(conv); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4961 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4962 gtkchat = gtkconv->u.chat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4963 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4964 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
|
4965 g_list_length(users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4966 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4967 for (l = users; l != NULL; l = l->next) { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4968 for (names = gaim_conv_chat_get_users(chat); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4969 names != NULL; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4970 names = names->next) { |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4971 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4972 char *u = (char *)names->data; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4973 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4974 if (!gaim_utf8_strcasecmp(u, (char *)l->data)) { |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4975 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4976 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4977 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4978 &iter)) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4979 break; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4980 |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
4981 do { |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4982 char *val; |
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 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4985 1, &val, -1); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4986 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4987 if (!gaim_utf8_strcasecmp((char *)l->data, val)) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4988 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4989 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4990 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4991 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4992 g_free(val); |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
4993 } while (f); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4994 |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4995 break; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4996 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4997 } |
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 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5000 if (names == NULL) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5001 return; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5002 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5003 g_snprintf(tmp, sizeof(tmp), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5004 ngettext("%d person in room", "%d people in room", |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5005 num_users), num_users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5006 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5007 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); |
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 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5011 gaim_gtkconv_updated(GaimConversation *conv, GaimConvUpdateType type) |
4359 | 5012 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5013 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5014 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5015 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5016 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5017 GaimConvChat *chat; |
4359 | 5018 |
5019 win = gaim_conversation_get_window(conv); | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5020 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 5021 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5022 | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5023 if (type == GAIM_CONV_UPDATE_ACCOUNT) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5024 { |
4359 | 5025 gaim_conversation_autoset_title(conv); |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5026 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5027 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5028 gaim_gtkconv_update_buddy_icon(conv); |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5029 |
4359 | 5030 gaim_gtkconv_update_buttons_by_protocol(conv); |
5031 | |
4685 | 5032 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); |
4359 | 5033 |
5034 smiley_themeize(gtkconv->imhtml); | |
6394 | 5035 |
6395 | 5036 update_tab_icon(conv); |
4359 | 5037 } |
5038 else if (type == GAIM_CONV_UPDATE_TYPING || | |
8155
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5039 type == GAIM_CONV_UPDATE_UNSEEN || |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5040 type == GAIM_CONV_UPDATE_TITLE) |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5041 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5042 const char *title; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5043 GaimConvIm *im = NULL; |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5044 char color[8]; |
4736 | 5045 |
4359 | 5046 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5047 im = GAIM_CONV_IM(conv); |
4359 | 5048 |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5049 title = gaim_conversation_get_title(conv); |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5050 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5051 *color = '\0'; |
4359 | 5052 |
5053 if (!GTK_WIDGET_REALIZED(gtkconv->tab_label)) | |
5054 gtk_widget_realize(gtkconv->tab_label); | |
5055 | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5056 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
|
5057 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5058 strcpy(color, "#47A046"); |
4359 | 5059 } |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5060 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
|
5061 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5062 strcpy(color, "#D1940C"); |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5063 } |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5064 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_NICK) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5065 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5066 strcpy(color, "#314E6C"); |
4359 | 5067 } |
8252 | 5068 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_TEXT) |
5069 { | |
5070 strcpy(color, "#DF421E"); | |
5071 } | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5072 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_EVENT) |
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, "#868272"); |
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 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5077 if (*color != '\0') |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5078 { |
8536 | 5079 char *html_title,*label; |
5080 | |
5081 html_title = gaim_escape_html(title); | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5082 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5083 label = g_strdup_printf("<span color=\"%s\">%s</span>", |
8536 | 5084 color, html_title); |
5085 g_free(html_title); | |
7995
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
5086 gtk_label_set_markup(GTK_LABEL(gtkconv->tab_label), label); |
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
5087 g_free(label); |
4359 | 5088 } |
7995
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
5089 else |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5090 gtk_label_set_text(GTK_LABEL(gtkconv->tab_label), title); |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5091 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5092 if (conv == gaim_conv_window_get_active_conversation(win)) |
4736 | 5093 update_typing_icon(conv); |
8155
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5094 |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5095 if (type == GAIM_CONV_UPDATE_TITLE) { |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5096 gtk_label_set_text(GTK_LABEL(gtkconv->menu_label), title); |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5097 if (conv == gaim_conv_window_get_active_conversation(win)) |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5098 gtk_window_set_title(GTK_WINDOW(gtkwin->window), title); |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5099 } |
4359 | 5100 } |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5101 else if (type == GAIM_CONV_UPDATE_TOPIC) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5102 { |
7154 | 5103 const char *topic; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5104 chat = GAIM_CONV_CHAT(conv); |
4359 | 5105 gtkchat = gtkconv->u.chat; |
5106 | |
7154 | 5107 topic = gaim_conv_chat_get_topic(chat); |
5108 | |
5109 gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text),topic); | |
5110 gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->topic_text, | |
8155
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5111 topic, NULL); |
4359 | 5112 } |
5113 else if (type == GAIM_CONV_ACCOUNT_ONLINE || | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5114 type == GAIM_CONV_ACCOUNT_OFFLINE) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5115 { |
7929 | 5116 gray_stuff_out(gaim_conv_window_get_active_conversation(win)); |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
5117 generate_send_as_items(win, NULL); |
8946 | 5118 update_tab_icon(conv); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5119 } |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5120 else if (type == GAIM_CONV_UPDATE_AWAY) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5121 { |
8946 | 5122 update_tab_icon(conv); |
4359 | 5123 } |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
5124 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
|
5125 type == GAIM_CONV_UPDATE_CHATLEFT) |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5126 { |
7929 | 5127 gray_stuff_out(conv); |
4397
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
5128 } |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5129 else if (type == GAIM_CONV_UPDATE_ICON) |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5130 { |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5131 gaim_gtkconv_update_buddy_icon(conv); |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5132 } |
4359 | 5133 } |
5134 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5135 static GaimConversationUiOps conversation_ui_ops = |
4359 | 5136 { |
5137 gaim_gtkconv_destroy, /* destroy_conversation */ | |
5138 gaim_gtkconv_write_chat, /* write_chat */ | |
5139 gaim_gtkconv_write_im, /* write_im */ | |
5140 gaim_gtkconv_write_conv, /* write_conv */ | |
5141 gaim_gtkconv_chat_add_user, /* chat_add_user */ | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5142 gaim_gtkconv_chat_add_users, /* chat_add_users */ |
4359 | 5143 gaim_gtkconv_chat_rename_user, /* chat_rename_user */ |
5144 gaim_gtkconv_chat_remove_user, /* chat_remove_user */ | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5145 gaim_gtkconv_chat_remove_users, /* chat_remove_users */ |
4359 | 5146 NULL, /* update_progress */ |
5147 gaim_gtkconv_updated /* updated */ | |
5148 }; | |
5149 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5150 GaimConversationUiOps * |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
5151 gaim_gtk_conversations_get_conv_ui_ops(void) |
4359 | 5152 { |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
5153 return &conversation_ui_ops; |
4359 | 5154 } |
5155 | |
5156 /************************************************************************** | |
5157 * Public conversation utility functions | |
5158 **************************************************************************/ | |
5159 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5160 gaim_gtkconv_update_buddy_icon(GaimConversation *conv) |
4359 | 5161 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5162 GaimGtkConversation *gtkconv; |
7143 | 5163 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); |
4359 | 5164 |
5165 char filename[256]; | |
5166 FILE *file; | |
5167 GError *err = NULL; | |
5168 | |
6695 | 5169 GaimBuddy *buddy; |
4757 | 5170 |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5171 const void *data; |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5172 size_t len; |
4359 | 5173 |
5174 GdkPixbuf *buf; | |
5175 | |
8821 | 5176 GtkWidget *vbox; |
4359 | 5177 GtkWidget *event; |
5178 GtkWidget *frame; | |
5179 GdkPixbuf *scale; | |
5180 GdkPixmap *pm; | |
5181 GdkBitmap *bm; | |
5182 int sf = 0; | |
5183 | |
8821 | 5184 GaimButtonStyle button_type; |
5185 | |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5186 g_return_if_fail(conv != NULL); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5187 g_return_if_fail(GAIM_IS_GTK_CONVERSATION(conv)); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5188 g_return_if_fail(gaim_conversation_get_type(conv) == GAIM_CONV_IM); |
4359 | 5189 |
5190 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5191 | |
5192 remove_icon(gtkconv); | |
5193 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5194 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/im/show_buddy_icons")) |
4359 | 5195 return; |
5196 | |
5197 if (gaim_conversation_get_gc(conv) == NULL) | |
5198 return; | |
5199 | |
8189 | 5200 if (gtkconv->u.im->anim) |
4793 | 5201 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); |
5202 | |
4757 | 5203 if((buddy = gaim_find_buddy(gaim_conversation_get_account(conv), |
5204 gaim_conversation_get_name(conv))) != NULL) { | |
8374 | 5205 const char *iconfile; |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
5206 if((iconfile = gaim_blist_node_get_string((GaimBlistNode*)buddy, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
5207 "buddy_icon"))) { |
8374 | 5208 GaimBuddyIcon *icon = gaim_conv_im_get_icon(GAIM_CONV_IM(conv)); |
5209 struct stat st; | |
5210 if ((icon == NULL) && (!stat(iconfile, &st))) { | |
5211 FILE *file = fopen(iconfile, "rb"); | |
5212 if (file) { | |
5213 char *data = g_malloc(st.st_size); | |
5214 fread(data, 1, st.st_size, file); | |
5215 fclose(file); | |
5216 gaim_buddy_icons_set_for_user(gaim_conversation_get_account(conv), gaim_conversation_get_name(conv), data, st.st_size); | |
5217 g_free(data); | |
5218 } | |
5219 return; | |
5220 } | |
5221 else | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
5222 gtkconv->u.im->anim = |
8496 | 5223 gdk_pixbuf_animation_new_from_file(iconfile, &err); /* LEAK */ |
8374 | 5224 } |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5225 } |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5226 else |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5227 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5228 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
|
5229 |
6877
1b5b0cea6915
[gaim-migrate @ 7423]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
5230 if (icon == NULL) |
1b5b0cea6915
[gaim-migrate @ 7423]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
5231 return; |
1b5b0cea6915
[gaim-migrate @ 7423]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
5232 |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5233 data = gaim_buddy_icon_get_data(icon, &len); |
4757 | 5234 |
5235 /* this is such an evil hack, i don't know why i'm even considering it. | |
5236 * we'll do it differently when gdk-pixbuf-loader isn't leaky anymore. */ | |
5237 g_snprintf(filename, sizeof(filename), | |
5238 "%s" G_DIR_SEPARATOR_S "gaimicon-%s.%d", | |
5239 g_get_tmp_dir(), gaim_conversation_get_name(conv), getpid()); | |
5240 | |
5241 if (!(file = fopen(filename, "wb"))) | |
5242 return; | |
5243 | |
5244 fwrite(data, 1, len, file); | |
5245 fclose(file); | |
5246 | |
5247 gtkconv->u.im->anim = gdk_pixbuf_animation_new_from_file(filename, &err); | |
5248 /* make sure we remove the file as soon as possible */ | |
5249 unlink(filename); | |
5250 } | |
4359 | 5251 |
5252 if (err) { | |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5253 gaim_debug(GAIM_DEBUG_ERROR, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5254 "Buddy icon error: %s\n", err->message); |
4359 | 5255 g_error_free(err); |
5256 } | |
5257 | |
5258 if (!gtkconv->u.im->anim) | |
5259 return; | |
5260 | |
4793 | 5261 if(gtkconv->u.im->iter) |
5262 g_object_unref(G_OBJECT(gtkconv->u.im->iter)); | |
5263 | |
4359 | 5264 if (gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim)) { |
5265 gtkconv->u.im->iter = NULL; | |
5266 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); | |
5267 } else { | |
5268 gtkconv->u.im->iter = | |
8496 | 5269 gdk_pixbuf_animation_get_iter(gtkconv->u.im->anim, NULL); /* LEAK */ |
4359 | 5270 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); |
8189 | 5271 if (gtkconv->u.im->animate) |
5272 start_anim(NULL, conv); | |
4359 | 5273 } |
5274 | |
5275 sf = SCALE(gtkconv->u.im->anim); | |
5276 scale = gdk_pixbuf_scale_simple(buf, | |
5277 MAX(gdk_pixbuf_get_width(buf) * sf / | |
5278 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), | |
5279 MAX(gdk_pixbuf_get_height(buf) * sf / | |
5280 gdk_pixbuf_animation_get_height(gtkconv->u.im->anim), 1), | |
5281 GDK_INTERP_NEAREST); | |
5282 | |
5283 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); | |
4793 | 5284 g_object_unref(G_OBJECT(scale)); |
4359 | 5285 |
8821 | 5286 |
5287 vbox = gtk_vbox_new(FALSE, 0); | |
5288 button_type = gaim_prefs_get_int("/gaim/gtk/conversations/im/button_type"); | |
5289 if(button_type == GAIM_BUTTON_NONE) { | |
5290 gtk_box_pack_start(GTK_BOX(gtkconv->entrybox), vbox, FALSE, FALSE, 0); | |
5291 gtk_box_reorder_child(GTK_BOX(gtkconv->entrybox), vbox, 0); | |
5292 } else { | |
5293 gtk_box_pack_start(GTK_BOX(gtkconv->bbox), vbox, FALSE, FALSE, 0); | |
5294 gtk_box_reorder_child(GTK_BOX(gtkconv->bbox), vbox, 0); | |
5295 } | |
5296 | |
4359 | 5297 frame = gtk_frame_new(NULL); |
5298 gtk_frame_set_shadow_type(GTK_FRAME(frame), | |
5299 (bm ? GTK_SHADOW_NONE : GTK_SHADOW_IN)); | |
8821 | 5300 gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); |
5301 | |
5302 | |
5303 gtk_widget_show(vbox); | |
4359 | 5304 gtk_widget_show(frame); |
5305 | |
5306 event = gtk_event_box_new(); | |
5307 gtk_container_add(GTK_CONTAINER(frame), event); | |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
5308 g_signal_connect(G_OBJECT(event), "button-press-event", |
4359 | 5309 G_CALLBACK(icon_menu), conv); |
5310 gtk_widget_show(event); | |
5311 | |
4635 | 5312 gtkconv->u.im->icon = gtk_image_new_from_pixmap(pm, bm); |
4359 | 5313 gtk_widget_set_size_request(gtkconv->u.im->icon, sf, sf); |
5314 gtk_container_add(GTK_CONTAINER(event), gtkconv->u.im->icon); | |
5315 gtk_widget_show(gtkconv->u.im->icon); | |
5316 | |
4793 | 5317 g_object_unref(G_OBJECT(pm)); |
4359 | 5318 |
5319 if (bm) | |
4793 | 5320 g_object_unref(G_OBJECT(bm)); |
7143 | 5321 |
5322 /* The buddy icon code needs badly to be fixed. */ | |
5323 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); | |
8068 | 5324 if(conv == gaim_conv_window_get_active_conversation(gaim_conversation_get_window(conv))) |
5325 gtk_window_set_icon(GTK_WINDOW(gtkwin->window), buf); | |
4359 | 5326 } |
5327 | |
5328 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5329 gaim_gtkconv_update_buttons_by_protocol(GaimConversation *conv) |
4359 | 5330 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5331 GaimConvWindow *win; |
4359 | 5332 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5333 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
4359 | 5334 return; |
5335 | |
7887 | 5336 win = gaim_conversation_get_window(conv); |
5337 | |
5338 if (win != NULL && gaim_conv_window_get_active_conversation(win) == conv) | |
5339 gray_stuff_out(conv); | |
4359 | 5340 } |
5341 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5342 GaimConvWindow * |
4359 | 5343 gaim_gtkwin_get_at_xy(int x, int y) |
5344 { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5345 GaimConvWindow *win = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5346 GaimGtkWindow *gtkwin; |
4359 | 5347 GdkWindow *gdkwin; |
5348 GList *l; | |
5349 | |
5350 gdkwin = gdk_window_at_pointer(&x, &y); | |
5351 | |
5352 if (gdkwin) | |
5353 gdkwin = gdk_window_get_toplevel(gdkwin); | |
5354 | |
5355 for (l = gaim_get_windows(); l != NULL; l = l->next) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5356 win = (GaimConvWindow *)l->data; |
4359 | 5357 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5358 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5359 continue; |
5360 | |
5361 gtkwin = GAIM_GTK_WINDOW(win); | |
5362 | |
5363 if (gdkwin == gtkwin->window->window) | |
5364 return win; | |
5365 } | |
5366 | |
5367 return NULL; | |
5368 } | |
5369 | |
5370 int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5371 gaim_gtkconv_get_tab_at_xy(GaimConvWindow *win, int x, int y) |
4359 | 5372 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5373 GaimGtkWindow *gtkwin; |
4359 | 5374 GList *l; |
5375 gint nb_x, nb_y, x_rel, y_rel; | |
5376 GtkNotebook *notebook; | |
5377 GtkWidget *tab; | |
5378 gint i, page_num = 0; | |
5379 gboolean first_visible = TRUE; | |
5380 | |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5381 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5382 return -1; |
5383 | |
5384 gtkwin = GAIM_GTK_WINDOW(win); | |
5385 notebook = GTK_NOTEBOOK(gtkwin->notebook); | |
5386 | |
5387 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
5388 x_rel = x - nb_x; | |
5389 y_rel = y - nb_y; | |
5390 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5391 for (l = gaim_conv_window_get_conversations(win), i = 0; |
4359 | 5392 l != NULL; |
5393 l = l->next, i++) { | |
5394 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5395 GaimConversation *conv = l->data; |
4359 | 5396 tab = GAIM_GTK_CONVERSATION(conv)->tab_label; |
5397 | |
5398 if (!GTK_WIDGET_MAPPED(tab)) | |
5399 continue; | |
5400 | |
5401 if (first_visible) { | |
5402 first_visible = FALSE; | |
5403 | |
5404 if (x_rel < tab->allocation.x) x_rel = tab->allocation.x; | |
5405 if (y_rel < tab->allocation.y) y_rel = tab->allocation.y; | |
5406 } | |
5407 | |
5408 if (gtk_notebook_get_tab_pos(notebook) == GTK_POS_TOP || | |
5409 gtk_notebook_get_tab_pos(notebook) == GTK_POS_BOTTOM) { | |
5410 | |
5411 if (tab->allocation.x <= x_rel) { | |
5412 if (tab->allocation.x + tab->allocation.width <= x_rel) | |
5413 page_num = i + 1; | |
5414 else | |
5415 page_num = i; | |
5416 } | |
5417 else | |
5418 break; | |
5419 } | |
5420 else { | |
5421 if (tab->allocation.y <= y_rel) { | |
5422 if (tab->allocation.y + tab->allocation.height <= y_rel) | |
5423 page_num = i + 1; | |
5424 else | |
5425 page_num = i; | |
5426 } | |
5427 else | |
5428 break; | |
5429 } | |
5430 } | |
5431 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5432 if (i == gaim_conv_window_get_conversation_count(win) + 1) |
4359 | 5433 return -1; |
5434 | |
5435 return page_num; | |
5436 } | |
5437 | |
5438 int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5439 gaim_gtkconv_get_dest_tab_at_xy(GaimConvWindow *win, int x, int y) |
4359 | 5440 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5441 GaimGtkWindow *gtkwin; |
4359 | 5442 GList *l; |
5443 gint nb_x, nb_y, x_rel, y_rel; | |
5444 GtkNotebook *notebook; | |
5445 GtkWidget *tab; | |
5446 gint i, page_num = 0; | |
5447 | |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5448 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5449 return -1; |
5450 | |
5451 gtkwin = GAIM_GTK_WINDOW(win); | |
5452 notebook = GTK_NOTEBOOK(gtkwin->notebook); | |
5453 | |
5454 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
5455 x_rel = x - nb_x; | |
5456 y_rel = y - nb_y; | |
5457 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5458 for (l = gaim_conv_window_get_conversations(win), i = 0; |
4359 | 5459 l != NULL; |
5460 l = l->next, i++) { | |
5461 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5462 GaimConversation *conv = l->data; |
4359 | 5463 tab = GAIM_GTK_CONVERSATION(conv)->tab_label; |
5464 | |
5465 if (!GTK_WIDGET_MAPPED(tab)) | |
5466 continue; | |
5467 | |
5468 if (gtk_notebook_get_tab_pos(notebook) == GTK_POS_TOP || | |
5469 gtk_notebook_get_tab_pos(notebook) == GTK_POS_BOTTOM) { | |
5470 | |
5471 if (tab->allocation.x <= x_rel) { | |
5472 if (tab->allocation.x + (tab->allocation.width / 2) <= x_rel) | |
5473 page_num = i + 1; | |
5474 else | |
5475 page_num = i; | |
5476 } | |
5477 else | |
5478 break; | |
5479 } | |
5480 else { | |
5481 if (tab->allocation.y <= y_rel) { | |
5482 if (tab->allocation.y + (tab->allocation.height / 2) <= y_rel) | |
5483 page_num = i + 1; | |
5484 else | |
5485 page_num = i; | |
5486 } | |
5487 else | |
5488 break; | |
5489 } | |
5490 } | |
5491 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5492 if (i == gaim_conv_window_get_conversation_count(win) + 1) |
4359 | 5493 return -1; |
5494 | |
5495 return page_num; | |
5496 } | |
4940
3708545afe42
[gaim-migrate @ 5274]
Christian Hammond <chipx86@chipx86.com>
parents:
4939
diff
changeset
|
5497 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5498 static void |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5499 escape_closes_pref_cb(const char *name, GaimPrefType type, gpointer value, |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5500 gpointer data) |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5501 { |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5502 if (value) |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5503 gtk_accel_map_change_entry(N_("<main>/Conversation/Close"), |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5504 GDK_Escape, 0, TRUE); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5505 else |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5506 gtk_accel_map_change_entry(N_("<main>/Conversation/Close"), |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5507 GDK_W, GDK_CONTROL_MASK, TRUE); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5508 } |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5509 |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5510 static void |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5511 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
|
5512 gpointer data) |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5513 { |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5514 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5515 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5516 GaimGtkConversation *gtkconv; |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5517 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5518 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5519 conv = (GaimConversation *)l->data; |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5520 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5521 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5522 continue; |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5523 |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5524 gtkconv = GAIM_GTK_CONVERSATION(conv); |
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 if (value) |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5527 gtk_widget_show(gtkconv->close); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5528 else |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5529 gtk_widget_hide(gtkconv->close); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5530 } |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5531 } |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5532 |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5533 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5534 show_timestamps_pref_cb(const char *name, GaimPrefType type, gpointer value, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5535 gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5536 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5537 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5538 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5539 GaimGtkConversation *gtkconv; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5540 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5541 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5542 conv = (GaimConversation *)l->data; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5543 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5544 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5545 continue; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5546 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5547 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5548 |
7386 | 5549 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
|
5550 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5551 } |
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 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5554 spellcheck_pref_cb(const char *name, GaimPrefType type, gpointer value, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5555 gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5556 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5557 #ifdef USE_GTKSPELL |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5558 GList *cl; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5559 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5560 GaimGtkConversation *gtkconv; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5561 GtkSpell *spell; |
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 for (cl = gaim_get_conversations(); cl != NULL; cl = cl->next) { |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
5564 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5565 conv = (GaimConversation *)cl->data; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5566 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5567 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5568 continue; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5569 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5570 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5571 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5572 if (value) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
5573 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5574 else { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5575 spell = gtkspell_get_from_text_view(GTK_TEXT_VIEW(gtkconv->entry)); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5576 gtkspell_detach(spell); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5577 } |
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 #endif |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5580 } |
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 static void |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5583 tab_side_pref_cb(const char *name, GaimPrefType type, gpointer value, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5584 gpointer data) |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5585 { |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5586 GList *l; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5587 GtkPositionType pos; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5588 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5589 GaimGtkWindow *gtkwin; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5590 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5591 pos = GPOINTER_TO_INT(value); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5592 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5593 for (l = gaim_get_windows(); l != NULL; l = l->next) { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5594 win = (GaimConvWindow *)l->data; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5595 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5596 if (!GAIM_IS_GTK_WINDOW(win)) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5597 continue; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5598 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5599 gtkwin = GAIM_GTK_WINDOW(win); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5600 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5601 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos); |
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 } |
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 static void |
8456 | 5606 html_shortcuts_pref_cb(const char *name, GaimPrefType type, |
5607 gpointer value, gpointer data) | |
5608 { | |
5609 GList *l; | |
5610 GaimConversation *conv; | |
5611 GaimGtkConversation *gtkconv; | |
5612 | |
5613 for(l = gaim_get_conversations(); l != NULL; l = l->next) { | |
5614 conv = (GaimConversation *)l->data; | |
5615 | |
5616 if(!GAIM_IS_GTK_CONVERSATION(conv)) | |
5617 continue; | |
5618 | |
5619 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5620 | |
5621 gtk_imhtml_html_shortcuts(GTK_IMHTML(gtkconv->entry), | |
5622 (gboolean)GPOINTER_TO_INT(value)); | |
5623 } | |
5624 } | |
5625 | |
5626 static void | |
5627 smiley_shortcuts_pref_cb(const char *name, GaimPrefType type, | |
5628 gpointer value, gpointer data) | |
5629 { | |
5630 GList *l; | |
5631 GaimConversation *conv; | |
5632 GaimGtkConversation *gtkconv; | |
5633 | |
5634 for(l = gaim_get_conversations(); l != NULL; l = l->next) { | |
5635 conv = (GaimConversation *)l->data; | |
5636 | |
5637 if(!GAIM_IS_GTK_CONVERSATION(conv)) | |
5638 continue; | |
5639 | |
5640 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5641 | |
5642 gtk_imhtml_smiley_shortcuts(GTK_IMHTML(gtkconv->entry), | |
5643 (gboolean)GPOINTER_TO_INT(value)); | |
5644 } | |
5645 } | |
5646 | |
5647 static void | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5648 show_formatting_toolbar_pref_cb(const char *name, GaimPrefType type, |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5649 gpointer value, gpointer data) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5650 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5651 GList *l; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5652 GaimConversation *conv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5653 GaimGtkConversation *gtkconv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5654 GaimConvWindow *win; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5655 GaimGtkWindow *gtkwin; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5656 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5657 for (l = gaim_get_conversations(); l != NULL; l = l->next) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5658 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5659 conv = (GaimConversation *)l->data; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5660 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5661 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5662 continue; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5663 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5664 gtkconv = GAIM_GTK_CONVERSATION(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5665 win = gaim_conversation_get_window(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5666 gtkwin = GAIM_GTK_WINDOW(win); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5667 |
7386 | 5668 gtkconv->show_formatting_toolbar = (gboolean)GPOINTER_TO_INT(value); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5669 gtk_check_menu_item_set_active( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5670 GTK_CHECK_MENU_ITEM(gtkwin->menu.show_formatting_toolbar), |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5671 gtkconv->show_formatting_toolbar); |
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 (gtkconv->show_formatting_toolbar) |
8317 | 5674 gtk_widget_show(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5675 else |
8317 | 5676 gtk_widget_hide(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5677 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5678 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5679 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5680 static void |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5681 im_button_type_pref_cb(const char *name, GaimPrefType type, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5682 gpointer value, gpointer data) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5683 { |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5684 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5685 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5686 GaimGtkConversation *gtkconv; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5687 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5688 for (l = gaim_get_ims(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5689 conv = (GaimConversation *)l->data; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5690 gtkconv = GAIM_GTK_CONVERSATION(conv); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5691 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5692 setup_im_buttons(conv, gtk_widget_get_parent(gtkconv->send)); |
8821 | 5693 gaim_gtkconv_update_buddy_icon(conv); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5694 } |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5695 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5696 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5697 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5698 animate_buddy_icons_pref_cb(const char *name, GaimPrefType type, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5699 gpointer value, gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5700 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5701 GList *l; |
8189 | 5702 GaimConversation *conv; |
5703 GaimGtkConversation *gtkconv; | |
5704 GaimConvWindow *win; | |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5705 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5706 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
|
5707 return; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5708 |
8189 | 5709 /* Set the "animate" flag for each icon based on the new preference */ |
5710 for (l = gaim_get_ims(); l != NULL; l = l->next) { | |
5711 conv = (GaimConversation *)l->data; | |
5712 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5713 gtkconv->u.im->animate = (gboolean)value; | |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5714 } |
8189 | 5715 |
5716 /* Now either stop or start animation for the active conversation in each window */ | |
5717 for (l = gaim_get_windows(); l != NULL; l = l->next) { | |
5718 win = (GaimConvWindow *)l->data; | |
5719 conv = gaim_conv_window_get_active_conversation(win); | |
5720 gaim_gtkconv_update_buddy_icon(conv); | |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5721 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5722 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5723 |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5724 static void |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5725 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
|
5726 gpointer data) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5727 { |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5728 GList *l; |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5729 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5730 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5731 GaimConversation *conv = l->data; |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5732 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5733 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5734 gaim_conversation_foreach(gaim_gtkconv_update_buddy_icon); |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5735 } |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5736 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5737 |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5680
diff
changeset
|
5738 static void |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
5739 chat_button_type_pref_cb(const char *name, GaimPrefType type, |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
5740 gpointer value, gpointer data) |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5741 { |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5742 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5743 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5744 GaimGtkConversation *gtkconv; |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
5745 |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
5746 for (l = gaim_get_chats(); l != NULL; l = l->next) { |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
5747 conv = (GaimConversation *)l->data; |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
5748 gtkconv = GAIM_GTK_CONVERSATION(conv); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
5749 |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
5750 setup_chat_buttons(conv, gtk_widget_get_parent(gtkconv->send)); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5751 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5752 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5753 |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5754 static void |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5755 conv_placement_pref_cb(const char *name, GaimPrefType type, |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5756 gpointer value, gpointer data) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5757 { |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5758 GaimConvPlacementFunc func; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5759 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5760 if (strcmp(name, "/gaim/gtk/conversations/placement")) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5761 return; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5762 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5763 func = gaim_conv_placement_get_fnc(value); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5764 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5765 if (func == NULL) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5766 return; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5767 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5768 gaim_conv_placement_set_current_func(func); |
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 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5771 void * |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5772 gaim_gtk_conversations_get_handle(void) |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5773 { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5774 static int handle; |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5775 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5776 return &handle; |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5777 } |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5778 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5779 void |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
5780 gaim_gtk_conversations_init(void) |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5781 { |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5782 void *handle = gaim_gtk_conversations_get_handle(); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5783 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5784 /* Conversations */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5785 gaim_prefs_add_none("/gaim/gtk/conversations"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5786 gaim_prefs_add_bool("/gaim/gtk/conversations/close_on_tabs", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5787 gaim_prefs_add_bool("/gaim/gtk/conversations/ctrl_enter_sends", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5788 gaim_prefs_add_bool("/gaim/gtk/conversations/enter_sends", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5789 gaim_prefs_add_bool("/gaim/gtk/conversations/escape_closes", FALSE); |
9025 | 5790 gaim_prefs_add_bool("/gaim/gtk/conversations/send_formatting", FALSE); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5791 gaim_prefs_add_bool("/gaim/gtk/conversations/send_bold", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5792 gaim_prefs_add_bool("/gaim/gtk/conversations/send_italic", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5793 gaim_prefs_add_bool("/gaim/gtk/conversations/send_underline", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5794 gaim_prefs_add_bool("/gaim/gtk/conversations/show_timestamps", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5795 gaim_prefs_add_bool("/gaim/gtk/conversations/spellcheck", TRUE); |
9049 | 5796 #if 1 |
5797 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_colors", FALSE); | |
5798 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_fonts", FALSE); | |
5799 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_font_sizes", FALSE); | |
5800 #else | |
8944 | 5801 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_formatting", FALSE); |
9049 | 5802 #endif |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5803 gaim_prefs_add_bool("/gaim/gtk/conversations/html_shortcuts", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5804 gaim_prefs_add_bool("/gaim/gtk/conversations/smiley_shortcuts", FALSE); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5805 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
|
5806 gaim_prefs_add_string("/gaim/gtk/conversations/placement", "last"); |
8998 | 5807 gaim_prefs_add_int("/gaim/gtk/conversations/placement_number", 1); |
9025 | 5808 gaim_prefs_add_string("/gaim/gtk/conversations/bgcolor", ""); |
5809 gaim_prefs_add_string("/gaim/gtk/conversations/fgcolor", ""); | |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5810 gaim_prefs_add_string("/gaim/gtk/conversations/font_face", ""); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5811 gaim_prefs_add_int("/gaim/gtk/conversations/font_size", 3); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5812 gaim_prefs_add_bool("/gaim/gtk/conversations/tabs", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5813 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
|
5814 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5815 /* Conversations -> Chat */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5816 gaim_prefs_add_none("/gaim/gtk/conversations/chat"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5817 gaim_prefs_add_int("/gaim/gtk/conversations/chat/button_type", |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5818 GAIM_BUTTON_TEXT_IMAGE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5819 gaim_prefs_add_bool("/gaim/gtk/conversations/chat/color_nicks", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5820 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
|
5821 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_width", 410); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5822 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_height", 160); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5823 gaim_prefs_add_int("/gaim/gtk/conversations/chat/entry_height", 50); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5824 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5825 /* Conversations -> IM */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5826 gaim_prefs_add_none("/gaim/gtk/conversations/im"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5827 gaim_prefs_add_int("/gaim/gtk/conversations/im/button_type", |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5828 GAIM_BUTTON_TEXT_IMAGE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5829 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
|
5830 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
|
5831 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
|
5832 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_width", 410); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5833 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_height", 160); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5834 gaim_prefs_add_int("/gaim/gtk/conversations/im/entry_height", 50); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5835 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5836 /* Connect callbacks. */ |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5837 gaim_prefs_connect_callback("/gaim/gtk/conversations/escape_closes", |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5838 escape_closes_pref_cb, NULL); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5839 gaim_prefs_connect_callback("/gaim/gtk/conversations/close_on_tabs", |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5840 close_on_tabs_pref_cb, NULL); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5841 gaim_prefs_connect_callback("/gaim/gtk/conversations/show_timestamps", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5842 show_timestamps_pref_cb, NULL); |
8456 | 5843 gaim_prefs_connect_callback("/gaim/gtk/conversations/html_shortcuts", |
5844 html_shortcuts_pref_cb, NULL); | |
5845 gaim_prefs_connect_callback("/gaim/gtk/conversations/smiley_shortcuts", | |
5846 smiley_shortcuts_pref_cb, NULL); | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5847 gaim_prefs_connect_callback("/gaim/gtk/conversations/show_formatting_toolbar", |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5848 show_formatting_toolbar_pref_cb, NULL); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5849 gaim_prefs_connect_callback("/gaim/gtk/conversations/spellcheck", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5850 spellcheck_pref_cb, NULL); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5851 gaim_prefs_connect_callback("/gaim/gtk/conversations/tab_side", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5852 tab_side_pref_cb, NULL); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5853 |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5854 gaim_prefs_connect_callback("/gaim/gtk/conversations/placement", |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5855 conv_placement_pref_cb, NULL); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5856 gaim_prefs_trigger_callback("/gaim/gtk/conversations/placement"); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5857 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5858 |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
5859 |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5860 /* IM callbacks */ |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5861 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/button_type", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5862 im_button_type_pref_cb, NULL); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5863 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/animate_buddy_icons", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5864 animate_buddy_icons_pref_cb, NULL); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5865 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/show_buddy_icons", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5866 show_buddy_icons_pref_cb, NULL); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5867 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5868 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5869 /* Chat callbacks */ |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5870 gaim_prefs_connect_callback("/gaim/gtk/conversations/chat/button_type", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5871 chat_button_type_pref_cb, NULL); |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5872 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5873 /********************************************************************** |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5874 * Register signals |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5875 **********************************************************************/ |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5876 gaim_signal_register(handle, "conversation-drag-ended", |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5877 gaim_marshal_VOID__POINTER_POINTER, NULL, 2, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5878 gaim_value_new(GAIM_TYPE_SUBTYPE, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5879 GAIM_SUBTYPE_CONV_WINDOW), |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5880 gaim_value_new(GAIM_TYPE_SUBTYPE, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5881 GAIM_SUBTYPE_CONV_WINDOW)); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5882 } |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5883 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5884 void |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5885 gaim_gtk_conversations_uninit(void) |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5886 { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5887 gaim_signals_unregister_by_instance(gaim_gtk_conversations_get_handle()); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5888 } |