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