Mercurial > pidgin
annotate src/conversation.c @ 4037:655080379e36
[gaim-migrate @ 4243]
revisions to reflect current status
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Tue, 03 Dec 2002 03:28:57 +0000 |
parents | 2b3a9d8f168e |
children | 6e383852ad4e |
rev | line source |
---|---|
66 | 1 /* |
2 * gaim | |
3 * | |
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net> | |
5 * | |
6 * This program is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * This program is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License | |
17 * along with this program; if not, write to the Free Software | |
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
19 * | |
20 */ | |
21 | |
349
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
344
diff
changeset
|
22 #ifdef HAVE_CONFIG_H |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2048
diff
changeset
|
23 #include <config.h> |
349
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
344
diff
changeset
|
24 #endif |
66 | 25 #include <string.h> |
3630 | 26 #ifndef _WIN32 |
66 | 27 #include <sys/time.h> |
3630 | 28 #include <unistd.h> |
29 #include <gdk/gdkx.h> | |
30 #include <X11/Xlib.h> | |
31 #else | |
32 #ifdef small | |
33 #undef small | |
34 #endif | |
35 #endif /*_WIN32*/ | |
66 | 36 #include <sys/types.h> |
37 #include <sys/stat.h> | |
38 #include <stdio.h> | |
39 #include <stdlib.h> | |
2123
56c4382f2909
[gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2111
diff
changeset
|
40 #include <errno.h> |
210
ec0686b3b03f
[gaim-migrate @ 220]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
209
diff
changeset
|
41 #include <ctype.h> |
66 | 42 #include <gtk/gtk.h> |
3802 | 43 #ifdef USE_GTKSPELL |
44 #include <gtkspell/gtkspell.h> | |
45 #endif | |
1428
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
46 #include "gtkimhtml.h" |
66 | 47 #include <gdk/gdkkeysyms.h> |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
48 #include "convo.h" |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1228
diff
changeset
|
49 #include "prpl.h" |
337 | 50 |
3630 | 51 #ifdef _WIN32 |
4026
a997156437b6
[gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3986
diff
changeset
|
52 #include <process.h> /* for getpid() */ |
3716
d7e83b4db191
[gaim-migrate @ 3849]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3705
diff
changeset
|
53 #include <io.h> |
3630 | 54 #include "win32dep.h" |
55 #endif | |
56 | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
57 int state_lock = 0; |
66 | 58 |
59 GdkPixmap *dark_icon_pm = NULL; | |
60 GdkBitmap *dark_icon_bm = NULL; | |
61 | |
1608
e19a2cb4190c
[gaim-migrate @ 1618]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1597
diff
changeset
|
62 GtkWidget *all_convos = NULL; |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
63 GtkWidget *convo_notebook = NULL; |
3677 | 64 GtkWidget *convo_menubar = NULL; |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
65 |
2763
477a035d81e5
[gaim-migrate @ 2776]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2761
diff
changeset
|
66 char fontface[128] = { 0 }; |
3473 | 67 |
1441
5c67b8794991
[gaim-migrate @ 1451]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1440
diff
changeset
|
68 int fontsize = 3; |
885
db5f5c33e83f
[gaim-migrate @ 895]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
876
diff
changeset
|
69 extern GdkColor bgcolor; |
db5f5c33e83f
[gaim-migrate @ 895]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
876
diff
changeset
|
70 extern GdkColor fgcolor; |
66 | 71 |
3790 | 72 void check_everything(GtkTextBuffer *buffer); |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
73 gboolean keypress_callback(GtkWidget *entry, GdkEventKey * event, struct conversation *c); |
3790 | 74 gboolean stop_rclick_callback(GtkWidget *widget, GdkEventButton *event, gpointer data); |
66 | 75 |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
76 static void update_icon(struct conversation *); |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
77 static void remove_icon(struct conversation *); |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
78 |
2231
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
79 static void update_checkbox(struct conversation *); |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
80 static void remove_checkbox(struct conversation *); |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
81 |
3035 | 82 static void update_smilies(struct conversation *c); |
83 | |
84 | |
66 | 85 /*------------------------------------------------------------------------*/ |
86 /* Helpers */ | |
87 /*------------------------------------------------------------------------*/ | |
88 | |
89 | |
3081 | 90 void gaim_setup_imhtml_smileys(GtkWidget *imhtml) |
1780
d7cbedd1d651
[gaim-migrate @ 1790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1772
diff
changeset
|
91 { |
4032 | 92 /* This is ugly right now--it will get better when the themable smileys come */ |
93 | |
94 | |
95 char *filename; | |
96 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "smile.png", NULL); | |
97 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":)", NULL, filename); | |
98 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-)", NULL, filename); | |
99 | |
100 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "sad.png", NULL); | |
101 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":(", NULL, filename); | |
102 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-(", NULL, filename); | |
103 | |
104 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "wink.png", NULL); | |
105 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ";)", NULL, filename); | |
106 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ";-)", NULL, filename); | |
107 | |
108 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "tounge.png", NULL); | |
109 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-p", NULL, filename); | |
110 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-P", NULL, filename); | |
111 | |
112 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "scream.png", NULL); | |
113 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), "=-O", NULL, filename); | |
114 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), "=-o", NULL, filename); | |
115 | |
116 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "kiss.png", NULL); | |
117 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-*", NULL, filename); | |
118 | |
119 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "yell.png", NULL); | |
120 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ">:o", NULL, filename); | |
121 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ">:O", NULL, filename); | |
122 | |
123 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "cool.png", NULL); | |
124 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), "8-)", NULL, filename); | |
125 | |
126 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "moneymouth.png", NULL); | |
127 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-$", NULL, filename); | |
128 | |
129 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "burp.png", NULL); | |
130 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-!", NULL, filename); | |
131 | |
132 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "embarrassed.png", NULL); | |
133 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-[", NULL, filename); | |
134 | |
135 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "cry.png", NULL); | |
136 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":'(", NULL, filename); | |
137 | |
138 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "think.png", NULL); | |
139 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-/", NULL, filename); | |
140 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-\\", NULL, filename); | |
141 | |
142 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "crossedlips.png", NULL); | |
143 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-x", NULL, filename); | |
144 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-X", NULL, filename); | |
145 | |
146 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "bigsmile.png", NULL); | |
147 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-d", NULL, filename); | |
148 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-D", NULL, filename); | |
149 | |
150 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "angel.png", NULL); | |
151 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), "O:-)", NULL, filename); | |
152 | |
153 | |
154 /* "Secret" smileys */ | |
155 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "luke.png", NULL); | |
156 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), "C:)", NULL, filename); | |
157 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), "C:-)", NULL, filename); | |
158 | |
159 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "oneeye.png", NULL); | |
160 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), "O-)", NULL, filename); | |
161 | |
162 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "crazy.png", NULL); | |
163 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ">:)", NULL, filename); | |
164 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ">:-)", NULL, filename); | |
165 | |
166 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "mrt.png", NULL); | |
167 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-o)))", NULL, filename); | |
168 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-O)))", NULL, filename); | |
169 | |
170 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "download.png", NULL); | |
171 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), "8-|)", NULL, filename); | |
172 | |
173 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "farted.png", NULL); | |
174 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-]", NULL, filename); | |
1780
d7cbedd1d651
[gaim-migrate @ 1790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1772
diff
changeset
|
175 } |
d7cbedd1d651
[gaim-migrate @ 1790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1772
diff
changeset
|
176 |
3081 | 177 void gaim_setup_imhtml(GtkWidget *imhtml) |
178 { | |
179 g_return_if_fail(imhtml != NULL); | |
180 g_return_if_fail(GTK_IS_IMHTML(imhtml)); | |
181 if (!(convo_options & OPT_CONVO_SHOW_SMILEY)) | |
182 gtk_imhtml_show_smileys(GTK_IMHTML(imhtml), FALSE); | |
183 | |
184 gtk_signal_connect(GTK_OBJECT(imhtml), "url_clicked", GTK_SIGNAL_FUNC(open_url), NULL); | |
185 gaim_setup_imhtml_smileys(imhtml); | |
186 } | |
187 | |
66 | 188 void quiet_set(GtkWidget *tb, int state) |
189 { | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
190 state_lock = 1; |
66 | 191 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(tb), state); |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
192 state_lock = 0; |
66 | 193 } |
194 | |
195 | |
196 void set_state_lock(int i) | |
197 { | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
198 state_lock = i; |
66 | 199 } |
200 | |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
201 void toggle_sensitive(GtkWidget *widget, GtkWidget *to_toggle) |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
202 { |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
203 gboolean sensitivity = GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(to_toggle)); |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
204 |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
205 if (sensitivity == TRUE) |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
206 gtk_widget_set_sensitive(GTK_WIDGET(to_toggle), FALSE); |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
207 else |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
208 gtk_widget_set_sensitive(GTK_WIDGET(to_toggle), TRUE); |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
209 |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
210 return; |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
211 } |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
212 |
2937 | 213 void set_convo_name(struct conversation *c, const char *nname) |
214 { | |
215 | |
216 g_snprintf(c->name, sizeof(c->name), "%s", nname); | |
217 | |
218 return; | |
219 } | |
220 | |
66 | 221 struct conversation *new_conversation(char *name) |
222 { | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
223 struct conversation *c; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
224 |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
225 c = find_conversation(name); |
66 | 226 |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
227 if (c != NULL) |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
228 return c; |
66 | 229 |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
230 c = (struct conversation *)g_new0(struct conversation, 1); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
231 g_snprintf(c->name, sizeof(c->name), "%s", name); |
66 | 232 |
3457 | 233 if ((logging_options & OPT_LOG_CONVOS) || find_log_info(c->name)) { |
66 | 234 FILE *fd; |
70 | 235 |
3457 | 236 fd = open_log_file(c->name, c->is_chat); |
2004
699ddd727a49
[gaim-migrate @ 2014]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1970
diff
changeset
|
237 if (fd) { |
1525
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1486
diff
changeset
|
238 if (!(logging_options & OPT_LOG_STRIP_HTML)) |
1437
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
239 fprintf(fd, |
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
240 "<HR><BR><H3 Align=Center> ---- New Conversation @ %s ----</H3><BR>\n", |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
241 full_date()); |
1437
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
242 else |
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
243 fprintf(fd, " ---- New Conversation @ %s ----\n", full_date()); |
1034
1d43fda97960
[gaim-migrate @ 1044]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1032
diff
changeset
|
244 fclose(fd); |
1d43fda97960
[gaim-migrate @ 1044]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1032
diff
changeset
|
245 } else |
1d43fda97960
[gaim-migrate @ 1044]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1032
diff
changeset
|
246 /* do we want to do something here? */ ; |
66 | 247 } |
248 | |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
249 if (connections) |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
250 c->gc = (struct gaim_connection *)connections->data; |
1479
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
251 c->history = g_string_new(""); |
3122 | 252 c->send_history = g_list_append(NULL, NULL); |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
253 conversations = g_list_append(conversations, c); |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
254 show_conv(c); |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
255 update_icon(c); |
3051 | 256 update_checkbox(c); |
3035 | 257 update_smilies(c); |
3517 | 258 plugin_event(event_new_conversation, name); |
3922 | 259 /*gtk_imhtml_to_bottom(c->text);*/ |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
260 return c; |
66 | 261 } |
262 | |
263 | |
3466 | 264 struct conversation *find_conversation(const char *name) |
66 | 265 { |
2138
cfa83a1b3d49
[gaim-migrate @ 2148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2124
diff
changeset
|
266 char *cuser = g_malloc(1024); |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
267 struct conversation *c; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
268 GList *cnv = conversations; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
269 |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
270 strcpy(cuser, normalize(name)); |
66 | 271 |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
272 while (cnv) { |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
273 c = (struct conversation *)cnv->data; |
2048
3366311426df
[gaim-migrate @ 2058]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2017
diff
changeset
|
274 if (!g_strcasecmp(cuser, normalize(c->name))) { |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
275 g_free(cuser); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
276 return c; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
277 } |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
278 cnv = cnv->next; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
279 } |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
280 g_free(cuser); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
281 return NULL; |
66 | 282 } |
283 | |
284 /* --------------------------------------------------- | |
285 * Function to remove a log file entry | |
286 * --------------------------------------------------- | |
287 */ | |
288 | |
289 void rm_log(struct log_conversation *a) | |
290 { | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
291 struct conversation *cnv = find_conversation(a->name); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
292 |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
293 log_conversations = g_list_remove(log_conversations, a); |
66 | 294 |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
295 save_prefs(); |
66 | 296 |
2787
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
297 if (cnv && !(im_options & OPT_IM_ONE_WINDOW)) |
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
298 set_convo_title(cnv); |
66 | 299 } |
300 | |
301 struct log_conversation *find_log_info(char *name) | |
302 { | |
2138
cfa83a1b3d49
[gaim-migrate @ 2148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2124
diff
changeset
|
303 char *pname = g_malloc(1024); |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
304 GList *lc = log_conversations; |
66 | 305 struct log_conversation *l; |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
306 |
66 | 307 |
308 strcpy(pname, normalize(name)); | |
309 | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
310 while (lc) { |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
311 l = (struct log_conversation *)lc->data; |
2048
3366311426df
[gaim-migrate @ 2058]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2017
diff
changeset
|
312 if (!g_strcasecmp(pname, normalize(l->name))) { |
66 | 313 g_free(pname); |
314 return l; | |
315 } | |
316 lc = lc->next; | |
317 } | |
318 g_free(pname); | |
319 return NULL; | |
320 } | |
321 | |
625
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
322 void delete_conversation(struct conversation *c) |
66 | 323 { |
3517 | 324 plugin_event(event_del_conversation, c); |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
325 conversations = g_list_remove(conversations, c); |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
326 if (c->fg_color_dialog) |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
327 gtk_widget_destroy(c->fg_color_dialog); |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
328 if (c->bg_color_dialog) |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
329 gtk_widget_destroy(c->bg_color_dialog); |
625
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
330 if (c->font_dialog) |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
331 gtk_widget_destroy(c->font_dialog); |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
332 if (c->smiley_dialog) |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
333 gtk_widget_destroy(c->smiley_dialog); |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
334 if (c->link_dialog) |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
335 gtk_widget_destroy(c->link_dialog); |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
336 if (c->log_dialog) |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
337 gtk_widget_destroy(c->log_dialog); |
2499
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
338 if (c->save_icon) |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
339 gtk_widget_destroy(c->save_icon); |
3122 | 340 c->send_history = g_list_first(c->send_history); |
341 while (c->send_history) { | |
342 if (c->send_history->data) | |
343 g_free(c->send_history->data); | |
344 c->send_history = c->send_history->next; | |
345 } | |
346 g_list_free(c->send_history); | |
2993 | 347 if (c->typing_timeout) |
348 gtk_timeout_remove(c->typing_timeout); | |
3596 | 349 if (c->type_again_timeout) |
350 gtk_timeout_remove(c->type_again_timeout); | |
1479
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
351 g_string_free(c->history, TRUE); |
625
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
352 g_free(c); |
66 | 353 } |
354 | |
355 void update_log_convs() | |
356 { | |
964
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
357 GSList *C = connections; |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
358 struct gaim_connection *g; |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
359 GSList *bcs; |
66 | 360 GList *cnv = conversations; |
361 struct conversation *c; | |
362 | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
363 while (cnv) { |
66 | 364 c = (struct conversation *)cnv->data; |
3457 | 365 if (c->log_button) { |
366 if (c->is_chat) | |
3671 | 367 gtk_widget_set_sensitive(GTK_WIDGET(c->log_button), |
3457 | 368 ((logging_options & OPT_LOG_CHATS)) ? FALSE : TRUE); |
369 else | |
3671 | 370 gtk_widget_set_sensitive(GTK_WIDGET(c->log_button), |
3457 | 371 ((logging_options & OPT_LOG_CONVOS)) ? FALSE : TRUE); |
372 } | |
66 | 373 |
374 cnv = cnv->next; | |
375 } | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
376 |
964
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
377 while (C) { |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
378 g = (struct gaim_connection *)C->data; |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
379 bcs = g->buddy_chats; |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
380 while (bcs) { |
964
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
381 c = (struct conversation *)bcs->data; |
3457 | 382 if (c->log_button) { |
383 if (c->is_chat) | |
3671 | 384 gtk_widget_set_sensitive(GTK_WIDGET(c->log_button), |
3457 | 385 ((logging_options & OPT_LOG_CHATS)) ? FALSE : |
386 TRUE); | |
387 else | |
3671 | 388 gtk_widget_set_sensitive(GTK_WIDGET(c->log_button), |
3457 | 389 ((logging_options & OPT_LOG_CONVOS)) ? FALSE : |
390 TRUE); | |
391 } | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
392 |
964
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
393 bcs = bcs->next; |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
394 } |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
395 C = C->next; |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
396 } |
66 | 397 } |
398 | |
399 void update_font_buttons() | |
400 { | |
401 GList *cnv = conversations; | |
402 struct conversation *c; | |
403 | |
404 while (cnv) { | |
405 c = (struct conversation *)cnv->data; | |
406 | |
407 if (c->bold) | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
408 gtk_widget_set_sensitive(c->bold, |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
409 ((font_options & OPT_FONT_BOLD)) ? FALSE : TRUE); |
66 | 410 |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
411 if (c->italic) |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
412 gtk_widget_set_sensitive(c->italic, |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
413 ((font_options & OPT_FONT_ITALIC)) ? FALSE : TRUE); |
66 | 414 |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
415 if (c->underline) |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
416 gtk_widget_set_sensitive(c->underline, |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
417 ((font_options & OPT_FONT_UNDERLINE)) ? FALSE : TRUE); |
66 | 418 |
419 cnv = cnv->next; | |
420 } | |
421 } | |
422 | |
423 /* | |
424 void update_transparency() | |
425 { | |
426 GList *cnv = conversations; | |
427 struct conversation *c; | |
428 | |
429 This func should be uncalled! | |
430 | |
431 while(cnv) { | |
432 c = (struct conversation *)cnv->data; | |
433 | |
434 if (c->text) | |
435 gtk_html_set_transparent(GTK_HTML(c->text), | |
436 (transparent) ? TRUE : FALSE); | |
437 | |
438 cnv = cnv->next; | |
439 } | |
440 } | |
441 */ | |
442 | |
443 | |
444 /*------------------------------------------------------------------------*/ | |
445 /* Callbacks */ | |
446 /*------------------------------------------------------------------------*/ | |
447 | |
608 | 448 void toggle_loggle(GtkWidget *loggle, struct conversation *c) |
66 | 449 { |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
450 if (state_lock) |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
451 return; |
3484 | 452 |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
453 if (find_log_info(c->name)) |
3484 | 454 rm_log(find_log_info(c->name)); |
3671 | 455 else if (GTK_CHECK_MENU_ITEM(c->log_button)->active) |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
456 show_log_dialog(c); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
457 else |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
458 cancel_log(NULL, c); |
66 | 459 } |
460 | |
3300 | 461 void toggle_sound(GtkWidget *widget, struct conversation *c) |
462 { | |
3681 | 463 if (state_lock) |
3682 | 464 return; |
3681 | 465 |
3300 | 466 c->makesound = !c->makesound; |
467 } | |
468 | |
1479
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
469 static void do_save_convo(GtkObject *obj, GtkWidget *wid) |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
470 { |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
471 struct conversation *c = gtk_object_get_user_data(obj); |
3466 | 472 const char *filename = gtk_file_selection_get_filename(GTK_FILE_SELECTION(wid)); |
1479
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
473 FILE *f; |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
474 if (file_is_dir(filename, wid)) |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
475 return; |
3466 | 476 if (!((!c->is_chat && g_list_find(conversations, c)) || |
477 (c->is_chat && g_slist_find(connections, c->gc) && g_slist_find(c->gc->buddy_chats, c)))) | |
478 filename = NULL; | |
1479
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
479 gtk_widget_destroy(wid); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
480 if (!filename) |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
481 return; |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
482 f = fopen(filename, "w+"); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
483 if (!f) |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
484 return; |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
485 fprintf(f, "%s", c->history->str); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
486 fclose(f); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
487 } |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
488 |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
489 void save_convo(GtkWidget *save, struct conversation *c) |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
490 { |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
491 char buf[BUF_LONG]; |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
492 GtkWidget *window = gtk_file_selection_new(_("Gaim - Save Conversation")); |
3630 | 493 g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S "%s.log", gaim_home_dir(), normalize(c->name)); |
1479
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
494 gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
495 gtk_object_set_user_data(GTK_OBJECT(GTK_FILE_SELECTION(window)->ok_button), c); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
496 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(window)->ok_button), |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
497 "clicked", GTK_SIGNAL_FUNC(do_save_convo), window); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
498 gtk_signal_connect_object(GTK_OBJECT(GTK_FILE_SELECTION(window)->cancel_button), |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
499 "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), (gpointer)window); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
500 gtk_widget_show(window); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
501 } |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
502 |
3044 | 503 static void do_insert_image(GtkObject *obj, GtkWidget *wid) |
504 { | |
505 struct conversation *c = gtk_object_get_user_data(obj); | |
3466 | 506 const char *name = gtk_file_selection_get_filename(GTK_FILE_SELECTION(wid)); |
507 const char *filename; | |
508 char *buf; | |
3044 | 509 struct stat st; |
510 int id = g_slist_length(c->images) + 1; | |
511 | |
512 if (file_is_dir(name, wid)) | |
513 return; | |
3466 | 514 if (!(!c->is_chat && g_list_find(conversations, c))) |
3044 | 515 name = NULL; |
516 gtk_widget_destroy(wid); | |
517 if (!name) | |
518 return; | |
519 | |
520 if (stat(name, &st) != 0) { | |
521 debug_printf("Could not stat %s\n", name); | |
522 return; | |
523 } | |
524 | |
525 filename = name; | |
526 while (strchr(filename, '/')) | |
527 filename = strchr(filename, '/') + 1; | |
528 | |
3466 | 529 buf = g_strdup_printf ("<IMG SRC=\"file://%s\" ID=\"%d\" DATASIZE=\"%d\">", |
530 filename, id, (int)st.st_size); | |
3044 | 531 c->images = g_slist_append(c->images, g_strdup(name)); |
3790 | 532 gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(c->entry_buffer), |
533 buf, -1); | |
3466 | 534 g_free(buf); |
3044 | 535 } |
536 | |
537 void insert_image(GtkWidget *save, struct conversation *c) | |
538 { | |
539 char buf[BUF_LONG]; | |
540 GtkWidget *window = gtk_file_selection_new(_("Gaim - Insert Image")); | |
3630 | 541 g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S, gaim_home_dir()); |
3044 | 542 gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf); |
543 gtk_object_set_user_data(GTK_OBJECT(GTK_FILE_SELECTION(window)->ok_button), c); | |
544 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(window)->ok_button), | |
545 "clicked", GTK_SIGNAL_FUNC(do_insert_image), window); | |
546 gtk_signal_connect_object(GTK_OBJECT(GTK_FILE_SELECTION(window)->cancel_button), | |
547 "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), (gpointer)window); | |
548 gtk_widget_show(window); | |
549 } | |
550 | |
551 | |
570 | 552 void insert_smiley(GtkWidget *smiley, struct conversation *c) |
555 | 553 { |
554 if (state_lock) | |
555 return; | |
3671 | 556 |
570 | 557 if (GTK_TOGGLE_BUTTON(smiley)->active) |
558 show_smiley_dialog(c, smiley); | |
559 else if (c->smiley_dialog) | |
560 close_smiley_dialog(smiley, c); | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
561 |
3671 | 562 gtk_widget_grab_focus(c->entry); |
563 | |
555 | 564 return; |
565 } | |
566 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
567 int close_callback(GtkWidget *widget, struct conversation *c) |
66 | 568 { |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
569 if (c->is_chat && (widget == c->close) && !(chat_options & OPT_CHAT_ONE_WINDOW)) { |
814
a636ac51d15b
[gaim-migrate @ 824]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
808
diff
changeset
|
570 GtkWidget *tmp = c->window; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1244
diff
changeset
|
571 debug_printf("chat clicked close button\n"); |
814
a636ac51d15b
[gaim-migrate @ 824]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
808
diff
changeset
|
572 c->window = NULL; |
a636ac51d15b
[gaim-migrate @ 824]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
808
diff
changeset
|
573 gtk_widget_destroy(tmp); |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
574 return FALSE; |
814
a636ac51d15b
[gaim-migrate @ 824]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
808
diff
changeset
|
575 } |
a636ac51d15b
[gaim-migrate @ 824]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
808
diff
changeset
|
576 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1244
diff
changeset
|
577 debug_printf("conversation close callback\n"); |
814
a636ac51d15b
[gaim-migrate @ 824]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
808
diff
changeset
|
578 |
1692
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
579 if (!c->is_chat) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2245
diff
changeset
|
580 GSList *cn = connections; |
3596 | 581 if (!(misc_options & OPT_MISC_STEALTH_TYPING)) |
582 serv_send_typing(c->gc, c->name, NOT_TYPING); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2245
diff
changeset
|
583 while (cn) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2245
diff
changeset
|
584 struct gaim_connection *gc = cn->data; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2245
diff
changeset
|
585 cn = cn->next; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2245
diff
changeset
|
586 if (gc->prpl->convo_closed) |
2662
b0c5770156e1
[gaim-migrate @ 2675]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2631
diff
changeset
|
587 gc->prpl->convo_closed(gc, c->name); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2245
diff
changeset
|
588 } |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
589 remove_icon(c); |
2231
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
590 remove_checkbox(c); |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
591 if (im_options & OPT_IM_ONE_WINDOW) { |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
592 if ((g_list_length(conversations) > 1) || |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
593 ((convo_options & OPT_CONVO_COMBINE) && |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
594 (chat_options & OPT_CHAT_ONE_WINDOW) && chats)) { |
1692
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
595 gtk_notebook_remove_page(GTK_NOTEBOOK(convo_notebook), |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
596 g_list_index(conversations, c)); |
1692
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
597 } else { |
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
598 if (c->window) |
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
599 gtk_widget_destroy(c->window); |
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
600 c->window = NULL; |
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
601 all_convos = NULL; |
1757
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
602 convo_notebook = NULL; |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
603 if (convo_options & OPT_CONVO_COMBINE) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
604 all_chats = NULL; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
605 chat_notebook = NULL; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
606 } |
1692
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
607 } |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
608 } else { |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
609 if (c->window) |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
610 gtk_widget_destroy(c->window); |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
611 c->window = NULL; |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
612 } |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
613 } else { |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
614 if (chat_options & OPT_CHAT_ONE_WINDOW) { |
2891
58baac124b0d
[gaim-migrate @ 2904]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2877
diff
changeset
|
615 if ((convo_options & OPT_CONVO_COMBINE) && (im_options & OPT_IM_ONE_WINDOW) |
58baac124b0d
[gaim-migrate @ 2904]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2877
diff
changeset
|
616 && (conversations || chats->next)) { |
1692
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
617 gtk_notebook_remove_page(GTK_NOTEBOOK(chat_notebook), |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
618 g_list_index(chats, c) + |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
619 g_list_length(conversations)); |
2891
58baac124b0d
[gaim-migrate @ 2904]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2877
diff
changeset
|
620 } else if (g_list_length(chats) > 1) { |
58baac124b0d
[gaim-migrate @ 2904]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2877
diff
changeset
|
621 gtk_notebook_remove_page(GTK_NOTEBOOK(chat_notebook), |
58baac124b0d
[gaim-migrate @ 2904]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2877
diff
changeset
|
622 g_list_index(chats, c)); |
1692
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
623 } else { |
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
624 if (c->window) |
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
625 gtk_widget_destroy(c->window); |
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
626 c->window = NULL; |
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
627 all_chats = NULL; |
1757
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
628 chat_notebook = NULL; |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
629 if (convo_options & OPT_CONVO_COMBINE) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
630 all_convos = NULL; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
631 convo_notebook = NULL; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
632 } |
1692
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
633 } |
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
634 } else { |
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
635 if (c->window) |
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
636 gtk_widget_destroy(c->window); |
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
637 c->window = NULL; |
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
638 } |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
639 } |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
640 |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
641 if (c->fg_color_dialog) |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
642 gtk_widget_destroy(c->fg_color_dialog); |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
643 c->fg_color_dialog = NULL; |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
644 if (c->bg_color_dialog) |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
645 gtk_widget_destroy(c->bg_color_dialog); |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
646 c->bg_color_dialog = NULL; |
625
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
647 if (c->font_dialog) |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
648 gtk_widget_destroy(c->font_dialog); |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
649 c->font_dialog = NULL; |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
650 if (c->smiley_dialog) |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
651 gtk_widget_destroy(c->smiley_dialog); |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
652 c->smiley_dialog = NULL; |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
653 if (c->link_dialog) |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
654 gtk_widget_destroy(c->link_dialog); |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
655 c->link_dialog = NULL; |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
656 if (c->log_dialog) |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
657 gtk_widget_destroy(c->log_dialog); |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
658 c->log_dialog = NULL; |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
659 |
511
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
502
diff
changeset
|
660 if (c->is_chat) { |
1692
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
661 chats = g_list_remove(chats, c); |
1063
e1408fb04c36
[gaim-migrate @ 1073]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1034
diff
changeset
|
662 if (c->gc) |
e1408fb04c36
[gaim-migrate @ 1073]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1034
diff
changeset
|
663 serv_chat_leave(c->gc, c->id); |
2017
eee309c0de93
[gaim-migrate @ 2027]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2004
diff
changeset
|
664 else |
eee309c0de93
[gaim-migrate @ 2027]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2004
diff
changeset
|
665 delete_chat(c); |
511
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
502
diff
changeset
|
666 } else { |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
667 delete_conversation(c); |
511
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
502
diff
changeset
|
668 } |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
669 |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
670 return TRUE; |
66 | 671 } |
672 | |
666
71ea550c22ac
[gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
661
diff
changeset
|
673 void set_font_face(char *newfont, struct conversation *c) |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
674 { |
666
71ea550c22ac
[gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
661
diff
changeset
|
675 char *pre_fontface; |
3473 | 676 |
677 sprintf(c->fontface, "%s", newfont && *newfont ? newfont : DEFAULT_FONT_FACE); | |
688
6b1345121dd3
[gaim-migrate @ 698]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
687
diff
changeset
|
678 c->hasfont = 1; |
2763
477a035d81e5
[gaim-migrate @ 2776]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2761
diff
changeset
|
679 |
477a035d81e5
[gaim-migrate @ 2776]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2761
diff
changeset
|
680 pre_fontface = g_strconcat("<FONT FACE=\"", c->fontface, "\">", NULL); |
3790 | 681 surround(c, pre_fontface, "</FONT>"); |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
682 gtk_widget_grab_focus(c->entry); |
2763
477a035d81e5
[gaim-migrate @ 2776]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2761
diff
changeset
|
683 g_free(pre_fontface); |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
684 } |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
685 |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
686 gint delete_all_convo(GtkWidget *w, GdkEventAny *e, gpointer d) |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
687 { |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
688 if (w == all_convos) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
689 while (conversations) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
690 struct conversation *c = conversations->data; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
691 close_callback(c->close, c); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
692 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
693 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
694 if (w == all_chats) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
695 while (chats) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
696 struct conversation *c = chats->data; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
697 close_callback(c->close, c); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
698 } |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
699 } |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
700 return FALSE; |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
701 } |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
702 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
703 static gint delete_event_convo(GtkWidget *w, GdkEventAny *e, struct conversation *c) |
66 | 704 { |
705 delete_conversation(c); | |
706 return FALSE; | |
707 } | |
708 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
709 void add_callback(GtkWidget *widget, struct conversation *c) |
66 | 710 { |
2681
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2662
diff
changeset
|
711 struct buddy *b = find_buddy(c->gc, c->name); |
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2662
diff
changeset
|
712 if (b) { |
2745 | 713 show_confirm_del(c->gc, c->name); |
2681
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2662
diff
changeset
|
714 } else if (c->gc) |
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2662
diff
changeset
|
715 show_add_buddy(c->gc, c->name, NULL, NULL); |
66 | 716 |
717 gtk_widget_grab_focus(c->entry); | |
718 } | |
719 | |
720 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
721 void block_callback(GtkWidget *widget, struct conversation *c) |
66 | 722 { |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
723 if (c->gc) |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
724 show_add_perm(c->gc, c->name, FALSE); |
66 | 725 gtk_widget_grab_focus(c->entry); |
726 } | |
727 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
728 void warn_callback(GtkWidget *widget, struct conversation *c) |
66 | 729 { |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
730 show_warn_dialog(c->gc, c->name); |
66 | 731 gtk_widget_grab_focus(c->entry); |
732 } | |
733 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
734 void info_callback(GtkWidget *w, struct conversation *c) |
66 | 735 { |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
736 if (c->is_chat) { |
3762 | 737 GtkTreeIter iter; |
738 GtkTreeModel *mod = gtk_tree_view_get_model(GTK_TREE_VIEW(c->list)); | |
739 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(c->list)); | |
740 gchar *name; | |
741 | |
742 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) { | |
743 gtk_tree_model_get(GTK_TREE_MODEL(mod), &iter, 1, &name, -1); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
744 } else { |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
745 return; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
746 } |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
747 |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
748 serv_get_info(c->gc, name); |
3762 | 749 |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
750 } else { |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
751 serv_get_info(c->gc, c->name); |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
752 gtk_widget_grab_focus(c->entry); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
753 } |
66 | 754 } |
755 | |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
756 static void move_next_tab(GtkNotebook *notebook, gboolean chat) |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
757 { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
758 int currpage = gtk_notebook_get_current_page(notebook); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
759 int convlen; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
760 GList *cnv; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
761 struct conversation *d = NULL; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
762 |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
763 if ((convo_options & OPT_CONVO_COMBINE) && |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
764 (im_options & OPT_IM_ONE_WINDOW) && |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
765 (chat_options & OPT_CHAT_ONE_WINDOW)) |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
766 convlen = g_list_length(conversations); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
767 else |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
768 convlen = 0; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
769 |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
770 if (chat) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
771 /* if chat, find next unread chat */ |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
772 cnv = g_list_nth(chats, currpage - convlen); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
773 while (cnv) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
774 d = cnv->data; |
2993 | 775 if (d->unseen > 0) |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
776 break; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
777 cnv = cnv->next; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
778 d = NULL; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
779 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
780 if (d) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
781 gtk_notebook_set_page(notebook, convlen + g_list_index(chats, d)); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
782 return; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
783 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
784 } else { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
785 /* else find next unread convo */ |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
786 cnv = g_list_nth(conversations, currpage); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
787 while (cnv) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
788 d = cnv->data; |
2993 | 789 if (d->unseen > 0) |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
790 break; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
791 cnv = cnv->next; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
792 d = NULL; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
793 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
794 if (d) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
795 gtk_notebook_set_page(notebook, g_list_index(conversations, d)); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
796 return; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
797 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
798 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
799 |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
800 if (convo_options & OPT_CONVO_COMBINE) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
801 if (chat && (im_options & OPT_IM_ONE_WINDOW)) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
802 /* if chat find next unread convo */ |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
803 cnv = conversations; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
804 while (cnv) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
805 d = cnv->data; |
2993 | 806 if (d->unseen > 0) |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
807 break; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
808 cnv = cnv->next; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
809 d = NULL; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
810 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
811 if (d) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
812 gtk_notebook_set_page(notebook, g_list_index(conversations, d)); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
813 return; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
814 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
815 } else if (!chat && (chat_options & OPT_CHAT_ONE_WINDOW)) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
816 /* else find next unread chat */ |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
817 cnv = chats; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
818 while (cnv) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
819 d = cnv->data; |
2993 | 820 if (d->unseen > 0) |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
821 break; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
822 cnv = cnv->next; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
823 d = NULL; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
824 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
825 if (d) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
826 gtk_notebook_set_page(notebook, convlen + g_list_index(chats, d)); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
827 return; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
828 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
829 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
830 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
831 |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
832 if (chat) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
833 /* if chat find first unread chat */ |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
834 cnv = chats; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
835 while (cnv) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
836 d = cnv->data; |
2993 | 837 if (d->unseen > 0) |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
838 break; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
839 cnv = cnv->next; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
840 d = NULL; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
841 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
842 if (d) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
843 gtk_notebook_set_page(notebook, convlen + g_list_index(chats, d)); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
844 return; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
845 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
846 } else { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
847 /* else find first unread convo */ |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
848 cnv = conversations; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
849 while (cnv) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
850 d = cnv->data; |
2993 | 851 if (d->unseen > 0) |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
852 break; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
853 cnv = cnv->next; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
854 d = NULL; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
855 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
856 if (d) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
857 gtk_notebook_set_page(notebook, g_list_index(conversations, d)); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
858 return; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
859 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
860 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
861 |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
862 /* go to next page */ |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
863 if (currpage + 1 == g_list_length(notebook->children)) |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
864 gtk_notebook_set_page(notebook, 0); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
865 else |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
866 gtk_notebook_next_page(notebook); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
867 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
868 |
3612 | 869 #define SEND_TYPED_TIMEOUT 5000 |
870 | |
3596 | 871 gboolean send_typed(gpointer data) |
872 { | |
873 struct conversation *c = (struct conversation*)data; | |
874 if (c && c->gc && c->name) { | |
875 c->type_again = 1; | |
876 serv_send_typing(c->gc, c->name, TYPED); | |
3790 | 877 debug_printf("typed...\n"); |
3596 | 878 } |
879 return FALSE; | |
880 } | |
881 | |
3790 | 882 gboolean keypress_callback(GtkWidget *entry, GdkEventKey *event, struct conversation *c) |
66 | 883 { |
1411
a3e472534370
[gaim-migrate @ 1421]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1403
diff
changeset
|
884 if (event->keyval == GDK_Escape) { |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
885 if (convo_options & OPT_CONVO_ESC_CAN_CLOSE) { |
1411
a3e472534370
[gaim-migrate @ 1421]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1403
diff
changeset
|
886 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); |
1464
ae075ecc7c34
[gaim-migrate @ 1474]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
887 close_callback(c->close, c); |
2993 | 888 c = NULL; |
1411
a3e472534370
[gaim-migrate @ 1421]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1403
diff
changeset
|
889 } |
2363
08c66712364c
[gaim-migrate @ 2376]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2345
diff
changeset
|
890 } else if (event->keyval == GDK_Page_Up) { |
2749
8ff0bd0f7347
[gaim-migrate @ 2762]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2748
diff
changeset
|
891 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); |
3626 | 892 if(!(event->state & GDK_CONTROL_MASK)) |
893 gtk_imhtml_page_up(GTK_IMHTML(c->text)); | |
2363
08c66712364c
[gaim-migrate @ 2376]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2345
diff
changeset
|
894 } else if (event->keyval == GDK_Page_Down) { |
2749
8ff0bd0f7347
[gaim-migrate @ 2762]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2748
diff
changeset
|
895 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); |
3626 | 896 if(!(event->state & GDK_CONTROL_MASK)) |
897 gtk_imhtml_page_down(GTK_IMHTML(c->text)); | |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
898 } else if ((event->keyval == GDK_F2) && (convo_options & OPT_CONVO_F2_TOGGLES)) { |
1455
d113c7e2c5f1
[gaim-migrate @ 1465]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1453
diff
changeset
|
899 gtk_imhtml_show_comments(GTK_IMHTML(c->text), !GTK_IMHTML(c->text)->comments); |
1872
efc899af4912
[gaim-migrate @ 1882]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1867
diff
changeset
|
900 } else if ((event->keyval == GDK_Return) || (event->keyval == GDK_KP_Enter)) { |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
901 if ((event->state & GDK_CONTROL_MASK) && (convo_options & OPT_CONVO_CTL_ENTER)) { |
3790 | 902 send_callback(NULL, c); |
1442
2f4e6269b001
[gaim-migrate @ 1452]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1441
diff
changeset
|
903 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); |
2748
497868102c90
[gaim-migrate @ 2761]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2745
diff
changeset
|
904 return TRUE; |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2767
diff
changeset
|
905 } else if (!(event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK)) && (convo_options & OPT_CONVO_ENTER_SENDS)) { |
3790 | 906 send_callback(NULL, c); |
573
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
907 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); |
2748
497868102c90
[gaim-migrate @ 2761]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2745
diff
changeset
|
908 return TRUE; |
573
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
909 } else { |
3790 | 910 return FALSE; |
573
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
911 } |
2483
e73ca8d8d358
[gaim-migrate @ 2496]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
912 } else if ((event->state & GDK_CONTROL_MASK) && (event->keyval == 'm')) { |
e73ca8d8d358
[gaim-migrate @ 2496]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
913 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); |
3790 | 914 gtk_text_buffer_insert_at_cursor(c->entry_buffer, "\n", 1); |
830
60284aef22f0
[gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
829
diff
changeset
|
915 } else if (event->state & GDK_CONTROL_MASK) { |
3122 | 916 switch (event->keyval) { |
917 case GDK_Up: | |
918 if (!c->send_history) | |
919 break; | |
920 if (!c->send_history->prev) { | |
3790 | 921 GtkTextIter start, end; |
3122 | 922 if (c->send_history->data) |
923 g_free(c->send_history->data); | |
3790 | 924 gtk_text_buffer_get_start_iter(c->entry_buffer, &start); |
925 gtk_text_buffer_get_end_iter(c->entry_buffer, &end); | |
926 c->send_history->data = gtk_text_buffer_get_text(c->entry_buffer, | |
927 &start, &end, FALSE); | |
3122 | 928 } |
929 if (c->send_history->next && c->send_history->next->data) { | |
930 c->send_history = c->send_history->next; | |
3790 | 931 gtk_text_buffer_set_text(c->entry_buffer, c->send_history->data, -1); |
3122 | 932 } |
933 | |
934 break; | |
935 case GDK_Down: | |
936 if (!c->send_history) | |
937 break; | |
938 if (c->send_history->prev) { | |
939 c->send_history = c->send_history->prev; | |
940 if (c->send_history->data) { | |
3790 | 941 gtk_text_buffer_set_text(c->entry_buffer, c->send_history->data, -1); |
3122 | 942 } |
943 } | |
944 break; | |
945 } | |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
946 if (convo_options & OPT_CONVO_CTL_CHARS) { |
830
60284aef22f0
[gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
829
diff
changeset
|
947 switch (event->keyval) { |
60284aef22f0
[gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
829
diff
changeset
|
948 case 'i': |
1621
cf2071b095ca
[gaim-migrate @ 1631]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1617
diff
changeset
|
949 case 'I': |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
950 quiet_set(c->italic, |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
951 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(c->italic))); |
3790 | 952 do_italic(c->italic, c); |
830
60284aef22f0
[gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
829
diff
changeset
|
953 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); |
60284aef22f0
[gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
829
diff
changeset
|
954 break; |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
955 case 'u': /* ctl-u is GDK_Clear, which clears the line */ |
1621
cf2071b095ca
[gaim-migrate @ 1631]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1617
diff
changeset
|
956 case 'U': |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
957 quiet_set(c->underline, |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
958 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
959 (c->underline))); |
3790 | 960 do_underline(c->underline, c); |
830
60284aef22f0
[gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
829
diff
changeset
|
961 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); |
60284aef22f0
[gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
829
diff
changeset
|
962 break; |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
963 case 'b': /* ctl-b is GDK_Left, which moves backwards */ |
1621
cf2071b095ca
[gaim-migrate @ 1631]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1617
diff
changeset
|
964 case 'B': |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
965 quiet_set(c->bold, |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
966 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(c->bold))); |
3790 | 967 do_bold(c->bold, c); |
830
60284aef22f0
[gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
829
diff
changeset
|
968 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); |
60284aef22f0
[gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
829
diff
changeset
|
969 break; |
3159 | 970 case '-': |
3790 | 971 do_small(NULL, c); |
3159 | 972 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); |
973 break; | |
974 case '=': | |
975 case '+': | |
3790 | 976 do_big(NULL, c); |
3159 | 977 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); |
978 break; | |
979 case '0': | |
3790 | 980 do_normal(NULL, c); |
3159 | 981 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); |
982 break; | |
983 case 'f': | |
984 case 'F': | |
985 quiet_set(c->font, | |
986 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(c->font))); | |
987 toggle_font(c->font, c); | |
988 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); | |
989 break; | |
830
60284aef22f0
[gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
829
diff
changeset
|
990 } |
60284aef22f0
[gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
829
diff
changeset
|
991 } |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
992 if (convo_options & OPT_CONVO_CTL_SMILEYS) { |
830
60284aef22f0
[gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
829
diff
changeset
|
993 char buf[7]; |
60284aef22f0
[gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
829
diff
changeset
|
994 buf[0] = '\0'; |
60284aef22f0
[gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
829
diff
changeset
|
995 switch (event->keyval) { |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
996 case '1': |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
997 sprintf(buf, ":-)"); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
998 break; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
999 case '2': |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1000 sprintf(buf, ":-("); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1001 break; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1002 case '3': |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1003 sprintf(buf, ";-)"); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1004 break; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1005 case '4': |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1006 sprintf(buf, ":-P"); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1007 break; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1008 case '5': |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1009 sprintf(buf, "=-O"); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1010 break; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1011 case '6': |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1012 sprintf(buf, ":-*"); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1013 break; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1014 case '7': |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1015 sprintf(buf, ">:o"); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1016 break; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1017 case '8': |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1018 sprintf(buf, "8-)"); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1019 break; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1020 case '!': |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1021 sprintf(buf, ":-$"); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1022 break; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1023 case '@': |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1024 sprintf(buf, ":-!"); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1025 break; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1026 case '#': |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1027 sprintf(buf, ":-["); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1028 break; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1029 case '$': |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1030 sprintf(buf, "O:-)"); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1031 break; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1032 case '%': |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1033 sprintf(buf, ":-/"); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1034 break; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1035 case '^': |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1036 sprintf(buf, ":'("); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1037 break; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1038 case '&': |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1039 sprintf(buf, ":-X"); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1040 break; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1041 case '*': |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1042 sprintf(buf, ":-D"); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1043 break; |
830
60284aef22f0
[gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
829
diff
changeset
|
1044 } |
60284aef22f0
[gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
829
diff
changeset
|
1045 if (buf[0]) { |
3790 | 1046 gtk_text_buffer_insert_at_cursor(c->entry_buffer, buf, -1); |
830
60284aef22f0
[gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
829
diff
changeset
|
1047 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); |
60284aef22f0
[gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
829
diff
changeset
|
1048 } |
573
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
1049 } |
2631
a2cf3cac7e66
[gaim-migrate @ 2644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2625
diff
changeset
|
1050 if (event->keyval == 'l') { |
2340
b16642ac87b2
[gaim-migrate @ 2353]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2335
diff
changeset
|
1051 gtk_imhtml_clear(GTK_IMHTML(c->text)); |
2631
a2cf3cac7e66
[gaim-migrate @ 2644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2625
diff
changeset
|
1052 g_string_free(c->history, TRUE); |
a2cf3cac7e66
[gaim-migrate @ 2644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2625
diff
changeset
|
1053 c->history = g_string_new(""); |
3168 | 1054 } else if ((event->keyval == 'w') && (convo_options & OPT_CONVO_CTL_W_CLOSES)) { |
3159 | 1055 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); |
1056 close_callback(c->close, c); | |
1057 c = NULL; | |
1058 return TRUE; | |
1059 } else if (event->keyval == 'n') { | |
1060 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); | |
1061 show_im_dialog(); | |
1062 } else if (event->keyval == 'z') { | |
1063 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); | |
3630 | 1064 #ifndef _WIN32 |
3159 | 1065 XIconifyWindow(GDK_DISPLAY(), |
1066 GDK_WINDOW_XWINDOW(c->window->window), | |
1067 ((_XPrivDisplay)GDK_DISPLAY())->default_screen); | |
3630 | 1068 #endif |
2631
a2cf3cac7e66
[gaim-migrate @ 2644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2625
diff
changeset
|
1069 } |
3159 | 1070 |
1071 | |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
1072 if ((!c->is_chat && (im_options & OPT_IM_ONE_WINDOW)) || |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
1073 (c->is_chat && (chat_options & OPT_CHAT_ONE_WINDOW))) { |
1692
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
1074 GtkWidget *notebook = (c->is_chat ? chat_notebook : convo_notebook); |
1595
f281f4d94973
[gaim-migrate @ 1605]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1594
diff
changeset
|
1075 if (event->keyval == '[') { |
1692
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
1076 gtk_notebook_prev_page(GTK_NOTEBOOK(notebook)); |
1587
69a004b5820a
[gaim-migrate @ 1597]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1583
diff
changeset
|
1077 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); |
1595
f281f4d94973
[gaim-migrate @ 1605]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1594
diff
changeset
|
1078 } else if (event->keyval == ']') { |
1692
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
1079 gtk_notebook_next_page(GTK_NOTEBOOK(notebook)); |
1587
69a004b5820a
[gaim-migrate @ 1597]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1583
diff
changeset
|
1080 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); |
1595
f281f4d94973
[gaim-migrate @ 1605]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1594
diff
changeset
|
1081 } else if (event->keyval == GDK_Tab) { |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
1082 move_next_tab(GTK_NOTEBOOK(notebook), c->is_chat); |
1587
69a004b5820a
[gaim-migrate @ 1597]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1583
diff
changeset
|
1083 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); |
2735
aeae739353d0
[gaim-migrate @ 2748]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
1084 return TRUE; |
1587
69a004b5820a
[gaim-migrate @ 1597]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1583
diff
changeset
|
1085 } |
69a004b5820a
[gaim-migrate @ 1597]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1583
diff
changeset
|
1086 } |
2385
bdc74764245c
[gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
1087 } else if ((event->keyval == GDK_Tab) && c->is_chat && (chat_options & OPT_CHAT_TAB_COMPLETE)) { |
bdc74764245c
[gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
1088 tab_complete(c); |
bdc74764245c
[gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
1089 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2722
diff
changeset
|
1090 return TRUE; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
1091 } else if (((!c->is_chat && (im_options & OPT_IM_ONE_WINDOW)) || |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
1092 (c->is_chat && (chat_options & OPT_CHAT_ONE_WINDOW))) && |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2386
diff
changeset
|
1093 (event->state & GDK_MOD1_MASK) && (event->keyval > '0') && (event->keyval <= '9')) { |
3629 | 1094 GtkWidget *notebook = NULL; |
3628 | 1095 notebook = (c->is_chat ? chat_notebook : convo_notebook); |
1692
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
1096 gtk_notebook_set_page(GTK_NOTEBOOK(notebook), event->keyval - '1'); |
1621
cf2071b095ca
[gaim-migrate @ 1631]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1617
diff
changeset
|
1097 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); |
573
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
1098 } |
66 | 1099 |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2722
diff
changeset
|
1100 return FALSE; |
66 | 1101 } |
1102 | |
3790 | 1103 /* This guy just kills a single right click from being propagated any |
1104 * further. I have no idea *why* we need this, but we do ... It | |
1105 * prevents right clicks on the GtkTextView in a convo dialog from | |
1106 * going all the way down to the notebook. I suspect a bug in | |
1107 * GtkTextView, but I'm not ready to point any fingers yet. */ | |
1108 gboolean stop_rclick_callback(GtkWidget *widget, GdkEventButton *event, gpointer data) | |
1109 { | |
1110 if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { | |
1111 /* right single click */ | |
1112 g_signal_stop_emission_by_name(G_OBJECT(widget), "button_press_event"); | |
1113 return TRUE; | |
1114 } | |
3867 | 1115 return FALSE; |
3790 | 1116 } |
1117 | |
3731 | 1118 static void got_typing_keypress(struct conversation *c, gboolean first) { |
1119 /* we know we got something, so we at least have to make sure we don't send | |
1120 * TYPED any time soon */ | |
1121 if(c->type_again_timeout) | |
1122 gtk_timeout_remove(c->type_again_timeout); | |
1123 c->type_again_timeout = gtk_timeout_add(SEND_TYPED_TIMEOUT, send_typed, c); | |
1124 | |
1125 /* we send typed if this is the first character typed, or if we're due | |
1126 * to send another one */ | |
1127 if(first || (c->type_again != 0 && time(NULL) > c->type_again)) { | |
1128 int timeout = serv_send_typing(c->gc, c->name, TYPING); | |
1129 if(timeout) | |
1130 c->type_again = time(NULL) + timeout; | |
1131 else | |
1132 c->type_again = 0; | |
1133 } | |
1134 } | |
1135 | |
3790 | 1136 void delete_text_callback(GtkTextBuffer *textbuffer, GtkTextIter *start_pos, GtkTextIter *end_pos, gpointer user_data) { |
3731 | 1137 struct conversation *c = user_data; |
1138 | |
1139 if(!c) | |
1140 return; | |
1141 | |
1142 if (misc_options & OPT_MISC_STEALTH_TYPING) | |
1143 return; | |
1144 | |
3790 | 1145 if(gtk_text_iter_is_start(start_pos) && gtk_text_iter_is_end(end_pos)) { |
3731 | 1146 if(c->type_again_timeout) |
1147 gtk_timeout_remove(c->type_again_timeout); | |
1148 serv_send_typing(c->gc, c->name, NOT_TYPING); | |
1149 } else { | |
1150 /* we're deleting, but not all of it, so it counts as typing */ | |
1151 got_typing_keypress(c, FALSE); | |
1152 } | |
1153 } | |
1154 | |
3790 | 1155 void insert_text_callback(GtkTextBuffer *textbuffer, GtkTextIter *position, gchar *new_text, gint new_text_length, gpointer user_data) { |
3731 | 1156 struct conversation *c = user_data; |
1157 | |
1158 if(!c) | |
1159 return; | |
1160 | |
1161 if (misc_options & OPT_MISC_STEALTH_TYPING) | |
1162 return; | |
1163 | |
3790 | 1164 got_typing_keypress(c, (gtk_text_iter_is_start(position) && gtk_text_iter_is_end(position))); |
3731 | 1165 } |
66 | 1166 |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1167 void send_callback(GtkWidget *widget, struct conversation *c) |
66 | 1168 { |
2102
899c22dcee42
[gaim-migrate @ 2112]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2094
diff
changeset
|
1169 char *buf, *buf2; |
3044 | 1170 int limit; |
1171 gulong length=0; | |
2123
56c4382f2909
[gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2111
diff
changeset
|
1172 int err = 0; |
3122 | 1173 GList *first; |
3790 | 1174 GtkTextIter start_iter, end_iter; |
66 | 1175 |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1176 if (!c->gc) |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1177 return; |
1100
f168625b63fe
[gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1078
diff
changeset
|
1178 |
3790 | 1179 gtk_text_buffer_get_start_iter(c->entry_buffer, &start_iter); |
1180 gtk_text_buffer_get_end_iter(c->entry_buffer, &end_iter); | |
1181 buf2 = gtk_text_buffer_get_text(c->entry_buffer, &start_iter, &end_iter, FALSE); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
1182 limit = 32 * 1024; /* you shouldn't be sending more than 32k in your messages. that's a book. */ |
738
97c7b2f61cb5
[gaim-migrate @ 748]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
700
diff
changeset
|
1183 buf = g_malloc(limit); |
97c7b2f61cb5
[gaim-migrate @ 748]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
700
diff
changeset
|
1184 g_snprintf(buf, limit, "%s", buf2); |
753
cd62f69d187e
[gaim-migrate @ 763]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
745
diff
changeset
|
1185 g_free(buf2); |
796
4783a3b6859d
[gaim-migrate @ 806]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
795
diff
changeset
|
1186 if (!strlen(buf)) { |
4783a3b6859d
[gaim-migrate @ 806]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
795
diff
changeset
|
1187 g_free(buf); |
4783a3b6859d
[gaim-migrate @ 806]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
795
diff
changeset
|
1188 return; |
4783a3b6859d
[gaim-migrate @ 806]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
795
diff
changeset
|
1189 } |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1190 |
3122 | 1191 first = g_list_first(c->send_history); |
1192 if (first->data) | |
1193 g_free(first->data); | |
1194 first->data = g_strdup(buf); | |
1195 c->send_history = g_list_prepend(first, NULL); | |
1196 | |
738
97c7b2f61cb5
[gaim-migrate @ 748]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
700
diff
changeset
|
1197 buf2 = g_malloc(limit); |
97c7b2f61cb5
[gaim-migrate @ 748]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
700
diff
changeset
|
1198 |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2699
diff
changeset
|
1199 if (c->gc->flags & OPT_CONN_HTML) { |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
1200 if (convo_options & OPT_CONVO_SEND_LINKS) |
1889
c81f3dd0e58e
[gaim-migrate @ 1899]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
1201 linkify_text(buf); |
c81f3dd0e58e
[gaim-migrate @ 1899]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
1202 |
1370
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1203 if (font_options & OPT_FONT_BOLD) { |
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1204 g_snprintf(buf2, limit, "<B>%s</B>", buf); |
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1205 strcpy(buf, buf2); |
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1206 } |
66 | 1207 |
1370
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1208 if (font_options & OPT_FONT_ITALIC) { |
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1209 g_snprintf(buf2, limit, "<I>%s</I>", buf); |
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1210 strcpy(buf, buf2); |
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1211 } |
66 | 1212 |
1370
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1213 if (font_options & OPT_FONT_UNDERLINE) { |
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1214 g_snprintf(buf2, limit, "<U>%s</U>", buf); |
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1215 strcpy(buf, buf2); |
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1216 } |
66 | 1217 |
1370
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1218 if (font_options & OPT_FONT_STRIKE) { |
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1219 g_snprintf(buf2, limit, "<STRIKE>%s</STRIKE>", buf); |
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1220 strcpy(buf, buf2); |
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1221 } |
101
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
1222 |
1370
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1223 if ((font_options & OPT_FONT_FACE) || c->hasfont) { |
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1224 g_snprintf(buf2, limit, "<FONT FACE=\"%s\">%s</FONT>", c->fontface, buf); |
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1225 strcpy(buf, buf2); |
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1226 } |
488
0fcb7e7a263c
[gaim-migrate @ 498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
474
diff
changeset
|
1227 |
2699
092c5a1ddf72
[gaim-migrate @ 2712]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
1228 if (font_options & OPT_FONT_SIZE) { |
092c5a1ddf72
[gaim-migrate @ 2712]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
1229 g_snprintf(buf2, limit, "<FONT SIZE=\"%d\">%s</FONT>", fontsize, buf); |
1441
5c67b8794991
[gaim-migrate @ 1451]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1440
diff
changeset
|
1230 strcpy(buf, buf2); |
5c67b8794991
[gaim-migrate @ 1451]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1440
diff
changeset
|
1231 } |
5c67b8794991
[gaim-migrate @ 1451]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1440
diff
changeset
|
1232 |
1370
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1233 if ((font_options & OPT_FONT_FGCOL) || c->hasfg) { |
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1234 g_snprintf(buf2, limit, "<FONT COLOR=\"#%02X%02X%02X\">%s</FONT>", c->fgcol.red, |
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1235 c->fgcol.green, c->fgcol.blue, buf); |
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1236 strcpy(buf, buf2); |
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1237 } |
666
71ea550c22ac
[gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
661
diff
changeset
|
1238 |
1370
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1239 if ((font_options & OPT_FONT_BGCOL) || c->hasbg) { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
1240 g_snprintf(buf2, limit, "<BODY BGCOLOR=\"#%02X%02X%02X\">%s</BODY>", |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
1241 c->bgcol.red, c->bgcol.green, c->bgcol.blue, buf); |
1370
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1242 strcpy(buf, buf2); |
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1243 } |
666
71ea550c22ac
[gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
661
diff
changeset
|
1244 } |
71ea550c22ac
[gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
661
diff
changeset
|
1245 |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1872
diff
changeset
|
1246 quiet_set(c->bold, FALSE); |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1872
diff
changeset
|
1247 quiet_set(c->italic, FALSE); |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1872
diff
changeset
|
1248 quiet_set(c->underline, FALSE); |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1872
diff
changeset
|
1249 quiet_set(c->font, FALSE); |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1872
diff
changeset
|
1250 quiet_set(c->fgcolorbtn, FALSE); |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1872
diff
changeset
|
1251 quiet_set(c->bgcolorbtn, FALSE); |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1872
diff
changeset
|
1252 quiet_set(c->link, FALSE); |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1872
diff
changeset
|
1253 gtk_widget_grab_focus(c->entry); |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1872
diff
changeset
|
1254 |
101
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
1255 { |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
389
diff
changeset
|
1256 char *buffy = g_strdup(buf); |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1257 enum gaim_event evnt = c->is_chat ? event_chat_send : event_im_send; |
2345
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2340
diff
changeset
|
1258 int plugin_return = plugin_event(evnt, c->gc, |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
1259 c->is_chat ? (void *)c->id : c->name, |
3517 | 1260 &buffy); |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
389
diff
changeset
|
1261 if (!buffy) { |
102
8c301530b2a3
[gaim-migrate @ 112]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
101
diff
changeset
|
1262 g_free(buf2); |
796
4783a3b6859d
[gaim-migrate @ 806]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
795
diff
changeset
|
1263 g_free(buf); |
102
8c301530b2a3
[gaim-migrate @ 112]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
101
diff
changeset
|
1264 return; |
8c301530b2a3
[gaim-migrate @ 112]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
101
diff
changeset
|
1265 } |
1100
f168625b63fe
[gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1078
diff
changeset
|
1266 if (plugin_return) { |
3790 | 1267 gtk_text_buffer_set_text(c->entry_buffer, "", -1); |
1100
f168625b63fe
[gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1078
diff
changeset
|
1268 g_free(buffy); |
f168625b63fe
[gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1078
diff
changeset
|
1269 g_free(buf2); |
f168625b63fe
[gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1078
diff
changeset
|
1270 g_free(buf); |
f168625b63fe
[gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1078
diff
changeset
|
1271 return; |
f168625b63fe
[gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1078
diff
changeset
|
1272 } |
738
97c7b2f61cb5
[gaim-migrate @ 748]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
700
diff
changeset
|
1273 g_snprintf(buf, limit, "%s", buffy); |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
389
diff
changeset
|
1274 g_free(buffy); |
101
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
1275 } |
3048 | 1276 |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1277 if (!c->is_chat) { |
2102
899c22dcee42
[gaim-migrate @ 2112]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2094
diff
changeset
|
1278 char *buffy; |
3048 | 1279 gboolean binary = FALSE; |
2102
899c22dcee42
[gaim-migrate @ 2112]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2094
diff
changeset
|
1280 |
899c22dcee42
[gaim-migrate @ 2112]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2094
diff
changeset
|
1281 buffy = g_strdup(buf); |
3517 | 1282 plugin_event(event_im_displayed_sent, c->gc, c->name, &buffy); |
2102
899c22dcee42
[gaim-migrate @ 2112]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2094
diff
changeset
|
1283 if (buffy) { |
2231
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
1284 int imflags = 0; |
2239
b7ff2ca1d653
[gaim-migrate @ 2249]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2231
diff
changeset
|
1285 if (c->check && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(c->check))) |
2231
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
1286 imflags = IM_FLAG_CHECKBOX; |
3048 | 1287 |
3033 | 1288 if (c->images) { |
3159 | 1289 int id = 0, offset = 0; |
1290 char *bigbuf = NULL; | |
3033 | 1291 GSList *tmplist = c->images; |
1292 id = 1; | |
3048 | 1293 |
3033 | 1294 while (tmplist) { |
3044 | 1295 FILE *imgfile; |
1296 char *filename; | |
1297 struct stat st; | |
3033 | 1298 char imgtag[1024]; |
3048 | 1299 |
3033 | 1300 if (stat(tmplist->data, &st) != 0) { |
1301 debug_printf("Could not stat %s\n", tmplist->data); | |
3048 | 1302 tmplist = tmplist->next; |
1303 continue; | |
3033 | 1304 } |
3044 | 1305 |
1306 /* Here we check to make sure the user still wants to send the | |
1307 * image. He may have deleted the <img> tag in which case we | |
1308 * don't want to send the binary data. */ | |
1309 filename = tmplist->data; | |
1310 while (strchr(filename, '/')) | |
1311 filename = strchr(filename, '/') + 1; | |
1312 g_snprintf(imgtag, sizeof(imgtag), | |
1313 "<IMG SRC=\"file://%s\" ID=\"%d\" DATASIZE=\"%d\">", | |
1314 filename, id, (int)st.st_size); | |
3048 | 1315 |
1316 if (strstr(buffy, imgtag) == 0) { | |
1317 debug_printf("Not sending image: %s\n", tmplist->data); | |
3044 | 1318 tmplist = tmplist->next; |
1319 continue; | |
1320 } | |
3048 | 1321 if (!binary) { |
1322 length = strlen(buffy) + strlen("<BINARY></BINARY>"); | |
1323 bigbuf = g_malloc(length + 1); | |
1324 g_snprintf(bigbuf, strlen(buffy) + strlen("<BINARY> ") + 1, | |
1325 "%s<BINARY>", buffy); | |
1326 offset = strlen(buffy) + strlen("<BINARY>"); | |
1327 binary = TRUE; | |
1328 } | |
3033 | 1329 g_snprintf(imgtag, sizeof(imgtag), |
1330 "<DATA ID=\"%d\" SIZE=\"%d\">", | |
3044 | 1331 id, (int)st.st_size); |
1332 | |
1333 length = length + strlen(imgtag) + st.st_size + strlen("</DATA>");; | |
3048 | 1334 bigbuf = g_realloc(bigbuf, length + 1); |
3044 | 1335 if (!(imgfile = fopen(tmplist->data, "r"))) { |
3033 | 1336 debug_printf("Could not open %s\n", tmplist->data); |
3048 | 1337 tmplist = tmplist->next; |
3044 | 1338 continue; |
3033 | 1339 } |
1340 g_snprintf(bigbuf + offset, strlen(imgtag) + 1, "%s", imgtag); | |
1341 offset = offset + strlen(imgtag); | |
3044 | 1342 offset = offset + fread(bigbuf + offset, 1, st.st_size, imgfile); |
1343 fclose(imgfile); | |
1344 g_snprintf(bigbuf + offset, strlen("</DATA>") + 1, "</DATA>"); | |
3033 | 1345 offset= offset + strlen("</DATA>"); |
1346 id++; | |
1347 tmplist = tmplist->next; | |
1348 } | |
3048 | 1349 if (binary) { |
1350 g_snprintf(bigbuf + offset, strlen("</BINARY>") + 1, "</BINARY>"); | |
1351 err =serv_send_im(c->gc, c->name, bigbuf, length, imflags); | |
1352 } else { | |
1353 err = serv_send_im(c->gc, c->name, buffy, -1, imflags); | |
1354 } | |
3044 | 1355 if (err > 0) { |
1356 GSList *tempy = c->images; | |
1357 while (tempy) { | |
1358 g_free(tempy->data); | |
1359 tempy = tempy->next; | |
1360 } | |
1361 g_slist_free(tempy); | |
1362 c->images = NULL; | |
3048 | 1363 if (binary) |
1364 write_to_conv(c, bigbuf, WFLAG_SEND, NULL, time(NULL), length); | |
1365 else | |
1366 write_to_conv(c, buffy, WFLAG_SEND, NULL, time(NULL), -1); | |
3060 | 1367 if (c->makesound) |
1368 play_sound(SND_SEND); | |
3033 | 1369 if (im_options & OPT_IM_POPDOWN) |
1370 gtk_widget_hide(c->window); | |
1371 | |
3044 | 1372 |
3033 | 1373 } |
3048 | 1374 if (binary) |
1375 g_free(bigbuf); | |
3033 | 1376 } else { |
3044 | 1377 err =serv_send_im(c->gc, c->name, buffy, -1, imflags); |
1378 if (err > 0) { | |
3033 | 1379 write_to_conv(c, buf, WFLAG_SEND, NULL, time(NULL), -1); |
3060 | 1380 if (c->makesound) |
1381 play_sound(SND_SEND); | |
3044 | 1382 if (im_options & OPT_IM_POPDOWN) |
1383 gtk_widget_hide(c->window); | |
1384 } | |
3033 | 1385 } |
2102
899c22dcee42
[gaim-migrate @ 2112]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2094
diff
changeset
|
1386 g_free(buffy); |
899c22dcee42
[gaim-migrate @ 2112]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2094
diff
changeset
|
1387 } |
3033 | 1388 |
502
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1389 } else { |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2160
diff
changeset
|
1390 err = serv_chat_send(c->gc, c->id, buf); |
502
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1391 |
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1392 /* no sound because we do that when we receive our message */ |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1393 } |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1394 |
2123
56c4382f2909
[gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2111
diff
changeset
|
1395 g_free(buf2); |
56c4382f2909
[gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2111
diff
changeset
|
1396 g_free(buf); |
56c4382f2909
[gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2111
diff
changeset
|
1397 |
56c4382f2909
[gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2111
diff
changeset
|
1398 if (err < 0) { |
56c4382f2909
[gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2111
diff
changeset
|
1399 if (err == -E2BIG) |
3427 | 1400 do_error_dialog(_("Unable to send message. The message is too large"), NULL, GAIM_ERROR); |
3044 | 1401 else if (err == -ENOTCONN) |
1402 debug_printf("Not yet connected\n"); | |
2123
56c4382f2909
[gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2111
diff
changeset
|
1403 else |
3427 | 1404 do_error_dialog(_("Unable to send message"), NULL, GAIM_ERROR); |
2832
e0eeda0a9ab9
[gaim-migrate @ 2845]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2831
diff
changeset
|
1405 } else { |
3790 | 1406 gtk_text_buffer_set_text(c->entry_buffer, "", -1); |
2123
56c4382f2909
[gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2111
diff
changeset
|
1407 |
2832
e0eeda0a9ab9
[gaim-migrate @ 2845]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2831
diff
changeset
|
1408 if ((err > 0) && (away_options & OPT_AWAY_BACK_ON_IM)) { |
2123
56c4382f2909
[gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2111
diff
changeset
|
1409 if (awaymessage != NULL) { |
56c4382f2909
[gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2111
diff
changeset
|
1410 do_im_back(); |
56c4382f2909
[gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2111
diff
changeset
|
1411 } else if (c->gc->away) { |
56c4382f2909
[gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2111
diff
changeset
|
1412 serv_set_away(c->gc, GAIM_AWAY_CUSTOM, NULL); |
56c4382f2909
[gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2111
diff
changeset
|
1413 } |
1403
c0aa7fdc0a93
[gaim-migrate @ 1413]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1401
diff
changeset
|
1414 } |
66 | 1415 } |
1416 } | |
1417 | |
3790 | 1418 gboolean entry_key_pressed(GtkTextBuffer *buffer) |
66 | 1419 { |
3790 | 1420 check_everything(buffer); |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2722
diff
changeset
|
1421 return FALSE; |
66 | 1422 } |
1423 | |
1424 /*------------------------------------------------------------------------*/ | |
1425 /* HTML-type stuff */ | |
1426 /*------------------------------------------------------------------------*/ | |
1427 | |
3790 | 1428 int count_tag(GtkTextBuffer *buffer, char *s1, char *s2) |
66 | 1429 { |
1430 char *p1, *p2; | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1431 int res = 0; |
3790 | 1432 GtkTextIter start, end; |
1433 char *tmp, *tmpo; | |
1434 | |
1435 gtk_text_buffer_get_start_iter(buffer, &start); | |
1436 gtk_text_buffer_get_iter_at_mark(buffer, &end, | |
1437 gtk_text_buffer_get_insert(buffer)); | |
1438 | |
1439 tmp = tmpo = gtk_text_buffer_get_text(buffer, &start, &end, FALSE); | |
66 | 1440 do { |
1441 p1 = strstr(tmp, s1); | |
1442 p2 = strstr(tmp, s2); | |
1443 if (p1 && p2) { | |
1444 if (p1 < p2) { | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1445 res = 1; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1446 tmp = p1 + strlen(s1); |
66 | 1447 } else if (p2 < p1) { |
1448 res = 0; | |
1449 tmp = p2 + strlen(s2); | |
1450 } | |
1451 } else { | |
1452 if (p1) { | |
1453 res = 1; | |
1454 tmp = p1 + strlen(s1); | |
1455 } else if (p2) { | |
1456 res = 0; | |
1457 tmp = p2 + strlen(s2); | |
1458 } | |
1459 } | |
1460 } while (p1 || p2); | |
1461 g_free(tmpo); | |
1462 return res; | |
1463 } | |
1464 | |
1465 | |
3790 | 1466 gboolean invert_tags(GtkTextBuffer *buffer, char *s1, char *s2, gboolean really) |
66 | 1467 { |
3790 | 1468 GtkTextIter start1, start2, end1, end2; |
1469 char *b1, *b2; | |
1470 | |
1471 if (gtk_text_buffer_get_selection_bounds(buffer, &start1, &end2)) { | |
1472 start2 = start1; end1 = end2; | |
1473 if (!gtk_text_iter_forward_chars(&start2, strlen(s1))) | |
1474 return FALSE; | |
1475 if (!gtk_text_iter_backward_chars(&end1, strlen(s2))) | |
1476 return FALSE; | |
1477 b1 = gtk_text_buffer_get_text(buffer, &start1, &start2, FALSE); | |
1478 b2 = gtk_text_buffer_get_text(buffer, &end1, &end2, FALSE); | |
1479 if (!g_strncasecmp(b1, s1, strlen(s1)) && | |
1480 !g_strncasecmp(b2, s2, strlen(s2))) { | |
1481 if (really) { | |
1482 GtkTextMark *m_end1, *m_end2; | |
1483 | |
1484 m_end1= gtk_text_buffer_create_mark(buffer, "m1", &end1, TRUE); | |
1485 m_end2= gtk_text_buffer_create_mark(buffer, "m2", &end2, TRUE); | |
1486 | |
1487 gtk_text_buffer_delete(buffer, &start1, &start2); | |
1488 gtk_text_buffer_get_iter_at_mark(buffer, &end1, m_end1); | |
1489 gtk_text_buffer_get_iter_at_mark(buffer, &end2, m_end2); | |
1490 gtk_text_buffer_delete(buffer, &end1, &end2); | |
1491 gtk_text_buffer_delete_mark(buffer, m_end1); | |
1492 gtk_text_buffer_delete_mark(buffer, m_end2); | |
1493 } | |
1494 g_free(b1); g_free(b2); | |
1495 return TRUE; | |
66 | 1496 } |
3790 | 1497 g_free(b1);g_free(b2); |
66 | 1498 } |
3790 | 1499 return FALSE; |
66 | 1500 } |
1501 | |
1502 | |
3790 | 1503 void remove_tags(struct conversation *c, char *tag) |
66 | 1504 { |
3790 | 1505 GtkTextIter start, end, m_start, m_end; |
1506 | |
1507 if (!gtk_text_buffer_get_selection_bounds(c->entry_buffer, | |
1508 &start, &end)) | |
1509 return; | |
1510 | |
1511 /* FIXMEif (strstr(tag, "<FONT SIZE=")) { | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1512 while ((t = strstr(t, "<FONT SIZE="))) { |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1513 if (((t - s) < finish) && ((t - s) >= start)) { |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1514 gtk_editable_delete_text(GTK_EDITABLE(entry), (t - s), |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1515 (t - s) + strlen(tag)); |
846
4b05985bae5e
[gaim-migrate @ 856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
843
diff
changeset
|
1516 g_free(s); |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
1517 s = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
1518 t = s; |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1519 } else |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1520 t++; |
68 | 1521 } |
3790 | 1522 } else*/ { |
1523 while (gtk_text_iter_forward_search(&start, tag, 0, &m_start, &m_end, &end)) { | |
1524 gtk_text_buffer_delete(c->entry_buffer, &m_start, &m_end); | |
1525 gtk_text_buffer_get_selection_bounds(c->entry_buffer, &start, &end); | |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
1526 } |
66 | 1527 } |
1528 } | |
1529 | |
1440
6330d0bb309f
[gaim-migrate @ 1450]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1439
diff
changeset
|
1530 static char *html_logize(char *p) |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1531 { |
1103
7aabbbaae829
[gaim-migrate @ 1113]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
1532 |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1533 char *temp_p = p; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1534 char *buffer_p; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1535 char *buffer_start; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1536 int num_cr = 0; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1537 int char_len = 0; |
1103
7aabbbaae829
[gaim-migrate @ 1113]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
1538 |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1539 while (*temp_p != '\0') { |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1540 char_len++; |
1440
6330d0bb309f
[gaim-migrate @ 1450]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1439
diff
changeset
|
1541 if ((*temp_p == '\n') || ((*temp_p == '<') && (*(temp_p + 1) == '!'))) |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1542 num_cr++; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1543 ++temp_p; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1544 } |
1103
7aabbbaae829
[gaim-migrate @ 1113]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
1545 |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1546 temp_p = p; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1547 buffer_p = g_malloc(char_len + (4 * num_cr) + 1); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1548 buffer_start = buffer_p; |
1103
7aabbbaae829
[gaim-migrate @ 1113]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
1549 |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1550 while (*temp_p != '\0') { |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1551 if (*temp_p == '\n') { |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1552 *buffer_p++ = '<'; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1553 *buffer_p++ = 'B'; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1554 *buffer_p++ = 'R'; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1555 *buffer_p++ = '>'; |
1440
6330d0bb309f
[gaim-migrate @ 1450]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1439
diff
changeset
|
1556 *buffer_p++ = '\n'; |
6330d0bb309f
[gaim-migrate @ 1450]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1439
diff
changeset
|
1557 } else if ((*temp_p == '<') && (*(temp_p + 1) == '!')) { |
6330d0bb309f
[gaim-migrate @ 1450]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1439
diff
changeset
|
1558 *buffer_p++ = '&'; |
2994 | 1559 *buffer_p++ = 'l'; |
1440
6330d0bb309f
[gaim-migrate @ 1450]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1439
diff
changeset
|
1560 *buffer_p++ = 't'; |
6330d0bb309f
[gaim-migrate @ 1450]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1439
diff
changeset
|
1561 *buffer_p++ = ';'; |
6330d0bb309f
[gaim-migrate @ 1450]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1439
diff
changeset
|
1562 } else |
6330d0bb309f
[gaim-migrate @ 1450]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1439
diff
changeset
|
1563 *buffer_p++ = *temp_p; |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1564 ++temp_p; |
1103
7aabbbaae829
[gaim-migrate @ 1113]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
1565 } |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1566 *buffer_p = '\0'; |
1103
7aabbbaae829
[gaim-migrate @ 1113]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
1567 |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1568 return buffer_start; |
1103
7aabbbaae829
[gaim-migrate @ 1113]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
1569 } |
7aabbbaae829
[gaim-migrate @ 1113]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
1570 |
3790 | 1571 void surround(struct conversation *c, char *pre, char *post) |
66 | 1572 { |
3790 | 1573 GtkTextIter start, end; |
1574 GtkTextMark *mark_start, *mark_end; | |
1575 | |
1576 if (gtk_text_buffer_get_selection_bounds(c->entry_buffer, &start, &end)) { | |
1577 remove_tags(c, pre); | |
1578 remove_tags(c, post); | |
1579 | |
1580 mark_start = gtk_text_buffer_create_mark(c->entry_buffer, "m1", &start, TRUE); | |
1581 mark_end = gtk_text_buffer_create_mark(c->entry_buffer, "m2", &end, FALSE); | |
1582 gtk_text_buffer_insert(c->entry_buffer, &start, pre, -1); | |
1583 gtk_text_buffer_get_selection_bounds(c->entry_buffer, &start, &end); | |
1584 gtk_text_buffer_insert(c->entry_buffer, &end, post, -1); | |
1585 gtk_text_buffer_get_iter_at_mark(c->entry_buffer, &start, mark_start); | |
1586 gtk_text_buffer_move_mark_by_name(c->entry_buffer, "selection_bound", &start); | |
66 | 1587 } else { |
3790 | 1588 gtk_text_buffer_insert(c->entry_buffer, &start, pre, -1); |
1589 gtk_text_buffer_insert(c->entry_buffer, &start, post, -1); | |
1590 mark_start = gtk_text_buffer_get_insert(c->entry_buffer); | |
1591 gtk_text_buffer_get_iter_at_mark(c->entry_buffer, &start, mark_start); | |
1592 gtk_text_iter_backward_chars(&start, strlen(post)); | |
1593 gtk_text_buffer_place_cursor(c->entry_buffer, &start); | |
66 | 1594 } |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1595 |
3790 | 1596 gtk_widget_grab_focus(c->entry); |
66 | 1597 } |
1598 | |
3790 | 1599 void advance_past(struct conversation *c, char *pre, char *post) |
66 | 1600 { |
3790 | 1601 GtkTextIter current_pos, start, end; |
1602 | |
1603 if (invert_tags(c->entry_buffer, pre, post, 1)) | |
66 | 1604 return; |
3790 | 1605 |
1606 gtk_text_buffer_get_iter_at_mark(c->entry_buffer, ¤t_pos, | |
1607 gtk_text_buffer_get_insert(c->entry_buffer)); | |
1608 if (gtk_text_iter_forward_search(¤t_pos, post, 0, &start, &end, NULL)) | |
1609 gtk_text_buffer_place_cursor(c->entry_buffer, &end); | |
1610 else | |
1611 gtk_text_buffer_insert_at_cursor(c->entry_buffer, post, -1); | |
1612 | |
1613 gtk_widget_grab_focus(c->entry); | |
66 | 1614 } |
1615 | |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
1616 void toggle_fg_color(GtkWidget *color, struct conversation *c) |
66 | 1617 { |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
1618 if (state_lock) |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1619 return; |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
1620 if (GTK_TOGGLE_BUTTON(color)->active) |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
1621 show_fgcolor_dialog(c, color); |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
1622 else if (c->fg_color_dialog) |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
1623 cancel_fgcolor(color, c); |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
1624 else |
3790 | 1625 advance_past(c, "<FONT COLOR>", "</FONT>"); |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
1626 } |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
1627 |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
1628 void toggle_bg_color(GtkWidget *color, struct conversation *c) |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
1629 { |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
1630 if (state_lock) |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1631 return; |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
1632 if (GTK_TOGGLE_BUTTON(color)->active) |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
1633 show_bgcolor_dialog(c, color); |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
1634 else if (c->bg_color_dialog) |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
1635 cancel_bgcolor(color, c); |
189
50dc3db25513
[gaim-migrate @ 199]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
187
diff
changeset
|
1636 else |
3790 | 1637 advance_past(c, "<BODY BGCOLOR>", "</BODY>"); |
66 | 1638 } |
1639 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1640 void toggle_font(GtkWidget *font, struct conversation *c) |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
1641 { |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
1642 if (state_lock) |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
1643 return; |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
1644 if (GTK_TOGGLE_BUTTON(font)->active) |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
1645 show_font_dialog(c, font); |
563
8d6e2de1fb64
[gaim-migrate @ 573]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
557
diff
changeset
|
1646 else if (c->font_dialog) |
8d6e2de1fb64
[gaim-migrate @ 573]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
557
diff
changeset
|
1647 cancel_font(font, c); |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
1648 else |
3790 | 1649 advance_past(c, "<FONT FACE>", "</FONT>"); |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
1650 } |
611
0f7e5ff95f71
[gaim-migrate @ 621]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
610
diff
changeset
|
1651 |
3671 | 1652 void insert_link_cb(GtkWidget *w, struct conversation *c) |
1653 { | |
1654 show_add_link(c->link, c); | |
1655 } | |
1656 | |
608 | 1657 void toggle_link(GtkWidget *linky, struct conversation *c) |
1658 { | |
1659 if (state_lock) | |
1660 return; | |
3671 | 1661 |
1662 if (GTK_TOGGLE_BUTTON(c->link)->active) | |
1663 show_add_link(c->link, c); | |
1664 | |
608 | 1665 else if (c->link_dialog) |
3671 | 1666 cancel_link(c->link, c); |
608 | 1667 else |
3790 | 1668 advance_past(c, "<A HREF>", "</A>"); |
3671 | 1669 |
1670 gtk_widget_grab_focus(c->entry); | |
608 | 1671 } |
66 | 1672 |
3790 | 1673 void do_strike(GtkWidget *strike, struct conversation *c) |
66 | 1674 { |
1675 if (state_lock) | |
1676 return; | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1677 |
66 | 1678 if (GTK_TOGGLE_BUTTON(strike)->active) |
3790 | 1679 surround(c, "<STRIKE>", "</STRIKE>"); |
66 | 1680 else |
3790 | 1681 advance_past(c, "<STRIKE>", "</STRIKE>"); |
1682 | |
1683 gtk_widget_grab_focus(c->entry); | |
66 | 1684 } |
1685 | |
3790 | 1686 void do_bold(GtkWidget *bold, struct conversation *c) |
66 | 1687 { |
1688 if (state_lock) | |
1689 return; | |
1690 if (GTK_TOGGLE_BUTTON(bold)->active) | |
3790 | 1691 surround(c, "<B>", "</B>"); |
66 | 1692 else |
3790 | 1693 advance_past(c, "<B>", "</B>"); |
1694 | |
1695 gtk_widget_grab_focus(c->entry); | |
66 | 1696 } |
1697 | |
3790 | 1698 void do_underline(GtkWidget *underline, struct conversation *c) |
66 | 1699 { |
1700 if (state_lock) | |
1701 return; | |
1702 if (GTK_TOGGLE_BUTTON(underline)->active) | |
3790 | 1703 surround(c, "<U>", "</U>"); |
66 | 1704 else |
3790 | 1705 advance_past(c, "<U>", "</U>"); |
1706 | |
1707 gtk_widget_grab_focus(c->entry); | |
66 | 1708 } |
1709 | |
3790 | 1710 void do_italic(GtkWidget *italic, struct conversation *c) |
66 | 1711 { |
1712 if (state_lock) | |
1713 return; | |
1714 if (GTK_TOGGLE_BUTTON(italic)->active) | |
3790 | 1715 surround(c, "<I>", "</I>"); |
66 | 1716 else |
3790 | 1717 advance_past(c, "<I>", "</I>"); |
1718 | |
1719 gtk_widget_grab_focus(c->entry); | |
66 | 1720 } |
1721 | |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
1722 /* html code to modify font sizes must all be the same length, */ |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
1723 /* currently set to 15 chars */ |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
1724 |
3790 | 1725 void do_small(GtkWidget *small, struct conversation *c) |
66 | 1726 { |
1727 if (state_lock) | |
1728 return; | |
3671 | 1729 |
3790 | 1730 surround(c, "<FONT SIZE=\"1\">", "</FONT>"); |
1731 | |
1732 gtk_widget_grab_focus(c->entry); | |
66 | 1733 } |
1734 | |
3790 | 1735 void do_normal(GtkWidget *normal, struct conversation *c) |
66 | 1736 { |
1737 if (state_lock) | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1738 return; |
3671 | 1739 |
3790 | 1740 surround(c, "<FONT SIZE=\"3\">", "</FONT>"); |
1741 | |
1742 gtk_widget_grab_focus(c->entry); | |
66 | 1743 } |
1744 | |
3790 | 1745 void do_big(GtkWidget *big, struct conversation *c) |
66 | 1746 { |
1747 if (state_lock) | |
1748 return; | |
3671 | 1749 |
3790 | 1750 surround(c, "<FONT SIZE=\"5\">", "</FONT>"); |
1751 | |
1752 gtk_widget_grab_focus(c->entry); | |
66 | 1753 } |
1754 | |
3790 | 1755 void check_everything(GtkTextBuffer *buffer) |
66 | 1756 { |
1757 struct conversation *c; | |
206 | 1758 |
3790 | 1759 c = (struct conversation *)g_object_get_data(G_OBJECT(buffer), "user_data"); |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1760 if (!c) |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1761 return; |
3790 | 1762 if (invert_tags(c->entry_buffer, "<B>", "</B>", 0)) |
66 | 1763 quiet_set(c->bold, TRUE); |
3790 | 1764 else if (count_tag(c->entry_buffer, "<B>", "</B>")) |
66 | 1765 quiet_set(c->bold, TRUE); |
1766 else | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1767 quiet_set(c->bold, FALSE); |
3790 | 1768 if (invert_tags(c->entry_buffer, "<I>", "</I>", 0)) |
66 | 1769 quiet_set(c->italic, TRUE); |
3790 | 1770 else if (count_tag(c->entry_buffer, "<I>", "</I>")) |
66 | 1771 quiet_set(c->italic, TRUE); |
1772 else | |
1773 quiet_set(c->italic, FALSE); | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1774 |
3790 | 1775 if (invert_tags(c->entry_buffer, "<FONT COLOR", "</FONT>", 0)) |
854 | 1776 quiet_set(c->fgcolorbtn, TRUE); |
3790 | 1777 else if (count_tag(c->entry_buffer, "<FONT COLOR", "</FONT>")) |
854 | 1778 quiet_set(c->fgcolorbtn, TRUE); |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
1779 else |
854 | 1780 quiet_set(c->fgcolorbtn, FALSE); |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1781 |
3790 | 1782 if (invert_tags(c->entry_buffer, "<BODY BGCOLOR", "</BODY>", 0)) |
861
00fb90babcb2
[gaim-migrate @ 871]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
860
diff
changeset
|
1783 quiet_set(c->bgcolorbtn, TRUE); |
3790 | 1784 else if (count_tag(c->entry_buffer, "<BODY BGCOLOR", "</BODY>")) |
861
00fb90babcb2
[gaim-migrate @ 871]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
860
diff
changeset
|
1785 quiet_set(c->bgcolorbtn, TRUE); |
00fb90babcb2
[gaim-migrate @ 871]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
860
diff
changeset
|
1786 else |
00fb90babcb2
[gaim-migrate @ 871]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
860
diff
changeset
|
1787 quiet_set(c->bgcolorbtn, FALSE); |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1788 |
3790 | 1789 if (invert_tags(c->entry_buffer, "<FONT FACE", "</FONT>", 0)) |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
1790 quiet_set(c->font, TRUE); |
3790 | 1791 else if (count_tag(c->entry_buffer, "<FONT FACE", "</FONT>")) |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
1792 quiet_set(c->font, TRUE); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
1793 else |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
1794 quiet_set(c->font, FALSE); |
66 | 1795 |
3790 | 1796 if (invert_tags(c->entry_buffer, "<A HREF", "</A>", 0)) |
66 | 1797 quiet_set(c->link, TRUE); |
3790 | 1798 else if (count_tag(c->entry_buffer, "<A HREF", "</A>")) |
66 | 1799 quiet_set(c->link, TRUE); |
1800 else | |
1801 quiet_set(c->link, FALSE); | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1802 |
3790 | 1803 if (invert_tags(c->entry_buffer, "<U>", "</U>", 0)) |
66 | 1804 quiet_set(c->underline, TRUE); |
3790 | 1805 else if (count_tag(c->entry_buffer, "<U>", "</U>")) |
66 | 1806 quiet_set(c->underline, TRUE); |
1807 else | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1808 quiet_set(c->underline, FALSE); |
66 | 1809 } |
1810 | |
1811 | |
1812 /*------------------------------------------------------------------------*/ | |
1813 /* Takin care of the window.. */ | |
1814 /*------------------------------------------------------------------------*/ | |
1815 | |
3431 | 1816 static char* nick_colors[] = { |
1817 "#ba55d3", /* Medium Orchid */ | |
1818 "#ee82ee", /* Violet */ | |
1819 "#c715b4", /* Medium Violet Red */ | |
1820 "#ff69b4", /* Hot Pink */ | |
1821 "#ff6347", /* Tomato */ | |
1822 "#fa8c00", /* Dark Orange */ | |
1823 "#fa8072" /* Salmon */ | |
1824 "#b22222", /* Fire Brick */ | |
1825 "#f4a460", /* Sandy Brown */ | |
1826 "#cd5c5c", /* Indian Red */ | |
1827 "#bc8f8f", /* Rosy Brown */ | |
1828 "#f0e68c", /* Khaki */ | |
1829 "#bdb76b", /* Dark Khaki */ | |
1830 "#228b22", /* Forest Green */ | |
1831 "#9acd32", /* Yellow Green */ | |
1832 "#32cd32", /* Lime Green */ | |
1833 "#3cb371", /* Medium Sea Green */ | |
1834 "#2e8b57", /* Sea Green */ | |
1835 "#8fbc8f", /* Dark Sea Green */ | |
1836 "#66cdaa", /* Medium Aquamarine */ | |
1837 "#5f9ea0", /* Cadet Blue */ | |
1838 "#48d1cc", /* Medium Turquoise */ | |
1839 "#00ced1", /* Dark Turquoise */ | |
1840 "#4682b4", /* Stell Blue */ | |
1841 "#00bfff", /* Deep Sky Blue */ | |
1842 "#1690ff", /* Dodger Blue */ | |
1843 "#4169ff", /* Royal Blue */ | |
1844 "#6a5acd", /* Slate Blue */ | |
1845 "#6495ed", /* Cornflower Blue */ | |
1846 "#708090", /* Slate gray */ | |
1847 "#ffdead", /* Navajo White */ | |
1848 }; | |
1849 #define NUM_NICK_COLORS (sizeof(nick_colors) / sizeof(char *)) | |
66 | 1850 |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1851 /* this is going to be interesting since the conversation could either be a |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1852 * normal IM conversation or a chat window. but hopefully it won't matter */ |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2855
diff
changeset
|
1853 void write_to_conv(struct conversation *c, char *what, int flags, char *who, time_t mtime, gint length) |
66 | 1854 { |
1735
00f74db70f2d
[gaim-migrate @ 1745]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1732
diff
changeset
|
1855 char buf[BUF_LONG]; |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1856 char *str; |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1857 FILE *fd; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1858 char colour[10]; |
741
58a6e6e26695
[gaim-migrate @ 751]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
738
diff
changeset
|
1859 struct buddy *b; |
1244 | 1860 int gtk_font_options = 0; |
1440
6330d0bb309f
[gaim-migrate @ 1450]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1439
diff
changeset
|
1861 GString *logstr; |
1735
00f74db70f2d
[gaim-migrate @ 1745]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1732
diff
changeset
|
1862 char buf2[BUF_LONG]; |
1764 | 1863 char mdate[64]; |
2993 | 1864 int unhighlight = 0; |
4032 | 1865 char *withfonttag; |
3799 | 1866 |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2855
diff
changeset
|
1867 if (c->is_chat && (!c->gc || !g_slist_find(c->gc->buddy_chats, c))) |
2267
837aa71710c5
[gaim-migrate @ 2277]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2264
diff
changeset
|
1868 return; |
837aa71710c5
[gaim-migrate @ 2277]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2264
diff
changeset
|
1869 |
2447
6bdeb91abe4e
[gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2426
diff
changeset
|
1870 if (!c->is_chat && !g_list_find(conversations, c)) |
6bdeb91abe4e
[gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2426
diff
changeset
|
1871 return; |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1872 |
2794
2d3f47783a22
[gaim-migrate @ 2807]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2788
diff
changeset
|
1873 gtk_widget_show(c->window); |
2d3f47783a22
[gaim-migrate @ 2807]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2788
diff
changeset
|
1874 |
1772
896432d66303
[gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1764
diff
changeset
|
1875 if (!c->is_chat || !(c->gc->prpl->options & OPT_PROTO_UNIQUE_CHATNAME)) { |
896432d66303
[gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1764
diff
changeset
|
1876 if (!who) { |
896432d66303
[gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1764
diff
changeset
|
1877 if (flags & WFLAG_SEND) { |
896432d66303
[gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1764
diff
changeset
|
1878 b = find_buddy(c->gc, c->gc->username); |
2213
a226ebf4be47
[gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2210
diff
changeset
|
1879 if (b && strcmp(b->name, b->show)) |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
1880 who = b->show; |
3205 | 1881 else if (c->gc->user->alias[0]) |
1882 who = c->gc->user->alias; | |
2210
3a6fd1e8f00a
[gaim-migrate @ 2220]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2202
diff
changeset
|
1883 else if (c->gc->displayname[0]) |
3a6fd1e8f00a
[gaim-migrate @ 2220]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2202
diff
changeset
|
1884 who = c->gc->displayname; |
1772
896432d66303
[gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1764
diff
changeset
|
1885 else |
896432d66303
[gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1764
diff
changeset
|
1886 who = c->gc->username; |
896432d66303
[gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1764
diff
changeset
|
1887 } else { |
896432d66303
[gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1764
diff
changeset
|
1888 b = find_buddy(c->gc, c->name); |
896432d66303
[gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1764
diff
changeset
|
1889 if (b) |
896432d66303
[gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1764
diff
changeset
|
1890 who = b->show; |
896432d66303
[gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1764
diff
changeset
|
1891 else |
896432d66303
[gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1764
diff
changeset
|
1892 who = c->name; |
896432d66303
[gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1764
diff
changeset
|
1893 } |
896432d66303
[gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1764
diff
changeset
|
1894 } else { |
896432d66303
[gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1764
diff
changeset
|
1895 b = find_buddy(c->gc, who); |
745
d693b83e4933
[gaim-migrate @ 755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
741
diff
changeset
|
1896 if (b) |
d693b83e4933
[gaim-migrate @ 755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
741
diff
changeset
|
1897 who = b->show; |
741
58a6e6e26695
[gaim-migrate @ 751]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
738
diff
changeset
|
1898 } |
474
7720d0f9da8e
[gaim-migrate @ 484]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
473
diff
changeset
|
1899 } |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1900 |
2447
6bdeb91abe4e
[gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2426
diff
changeset
|
1901 strftime(mdate, sizeof(mdate), "%H:%M:%S", localtime(&mtime)); |
6bdeb91abe4e
[gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2426
diff
changeset
|
1902 |
6bdeb91abe4e
[gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2426
diff
changeset
|
1903 gtk_font_options = gtk_font_options ^ GTK_IMHTML_NO_COMMENTS; |
6bdeb91abe4e
[gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2426
diff
changeset
|
1904 |
6bdeb91abe4e
[gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2426
diff
changeset
|
1905 if (convo_options & OPT_CONVO_IGNORE_COLOUR) |
6bdeb91abe4e
[gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2426
diff
changeset
|
1906 gtk_font_options = gtk_font_options ^ GTK_IMHTML_NO_COLOURS; |
6bdeb91abe4e
[gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2426
diff
changeset
|
1907 |
6bdeb91abe4e
[gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2426
diff
changeset
|
1908 if (convo_options & OPT_CONVO_IGNORE_FONTS) |
6bdeb91abe4e
[gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2426
diff
changeset
|
1909 gtk_font_options = gtk_font_options ^ GTK_IMHTML_NO_FONTS; |
6bdeb91abe4e
[gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2426
diff
changeset
|
1910 |
6bdeb91abe4e
[gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2426
diff
changeset
|
1911 if (convo_options & OPT_CONVO_IGNORE_SIZES) |
6bdeb91abe4e
[gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2426
diff
changeset
|
1912 gtk_font_options = gtk_font_options ^ GTK_IMHTML_NO_SIZES; |
6bdeb91abe4e
[gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2426
diff
changeset
|
1913 |
6bdeb91abe4e
[gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2426
diff
changeset
|
1914 if (!(logging_options & OPT_LOG_STRIP_HTML)) |
6bdeb91abe4e
[gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2426
diff
changeset
|
1915 gtk_font_options = gtk_font_options ^ GTK_IMHTML_RETURN_LOG; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
1916 |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1917 if (flags & WFLAG_SYSTEM) { |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
1918 if (convo_options & OPT_CONVO_SHOW_TIME) |
1764 | 1919 g_snprintf(buf, BUF_LONG, "<FONT SIZE=\"2\">(%s) </FONT><B>%s</B>", mdate, what); |
1735
00f74db70f2d
[gaim-migrate @ 1745]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1732
diff
changeset
|
1920 else |
1815
f15d449b3167
[gaim-migrate @ 1825]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1813
diff
changeset
|
1921 g_snprintf(buf, BUF_LONG, "<B>%s</B>", what); |
1735
00f74db70f2d
[gaim-migrate @ 1745]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1732
diff
changeset
|
1922 g_snprintf(buf2, sizeof(buf2), "<FONT SIZE=\"2\"><!--(%s) --></FONT><B>%s</B><BR>", |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
1923 mdate, what); |
66 | 1924 |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2855
diff
changeset
|
1925 gtk_imhtml_append_text(GTK_IMHTML(c->text), buf2, -1, 0); |
66 | 1926 |
1525
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1486
diff
changeset
|
1927 if (logging_options & OPT_LOG_STRIP_HTML) { |
1735
00f74db70f2d
[gaim-migrate @ 1745]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1732
diff
changeset
|
1928 char *t1 = strip_html(buf); |
1479
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
1929 c->history = g_string_append(c->history, t1); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
1930 c->history = g_string_append(c->history, "\n"); |
1486
b72a33d07ce8
[gaim-migrate @ 1496]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1479
diff
changeset
|
1931 g_free(t1); |
1479
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
1932 } else { |
1735
00f74db70f2d
[gaim-migrate @ 1745]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1732
diff
changeset
|
1933 c->history = g_string_append(c->history, buf); |
1479
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
1934 c->history = g_string_append(c->history, "<BR>\n"); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
1935 } |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
1936 |
3457 | 1937 if (!(flags & WFLAG_NOLOG) && ((c->is_chat && (logging_options & OPT_LOG_CHATS)) |
1938 || (!c->is_chat && (logging_options & OPT_LOG_CONVOS)) | |
1939 || find_log_info(c->name))) { | |
1437
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
1940 char *t1; |
699
f8acdd22065a
[gaim-migrate @ 709]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
698
diff
changeset
|
1941 char nm[256]; |
66 | 1942 |
1525
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1486
diff
changeset
|
1943 if (logging_options & OPT_LOG_STRIP_HTML) { |
1735
00f74db70f2d
[gaim-migrate @ 1745]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1732
diff
changeset
|
1944 t1 = strip_html(buf); |
1437
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
1945 } else { |
1735
00f74db70f2d
[gaim-migrate @ 1745]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1732
diff
changeset
|
1946 t1 = buf; |
1437
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
1947 } |
699
f8acdd22065a
[gaim-migrate @ 709]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
698
diff
changeset
|
1948 if (c->is_chat) |
f8acdd22065a
[gaim-migrate @ 709]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
698
diff
changeset
|
1949 g_snprintf(nm, 256, "%s.chat", c->name); |
f8acdd22065a
[gaim-migrate @ 709]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
698
diff
changeset
|
1950 else |
f8acdd22065a
[gaim-migrate @ 709]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
698
diff
changeset
|
1951 g_snprintf(nm, 256, "%s", c->name); |
3457 | 1952 fd = open_log_file(nm, c->is_chat); |
2004
699ddd727a49
[gaim-migrate @ 2014]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1970
diff
changeset
|
1953 if (fd) { |
1525
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1486
diff
changeset
|
1954 if (logging_options & OPT_LOG_STRIP_HTML) { |
1437
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
1955 fprintf(fd, "%s\n", t1); |
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
1956 } else { |
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
1957 fprintf(fd, "%s<BR>\n", t1); |
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
1958 } |
1067
649199f4730e
[gaim-migrate @ 1077]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1063
diff
changeset
|
1959 fclose(fd); |
936 | 1960 } |
1525
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1486
diff
changeset
|
1961 if (logging_options & OPT_LOG_STRIP_HTML) { |
1437
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
1962 g_free(t1); |
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
1963 } |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1964 } |
2385
bdc74764245c
[gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
1965 } else if (flags & WFLAG_NOLOG) { |
bdc74764245c
[gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
1966 g_snprintf(buf, BUF_LONG, "<B><FONT COLOR=\"#777777\">%s</FONT></B><BR>", what); |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2855
diff
changeset
|
1967 gtk_imhtml_append_text(GTK_IMHTML(c->text), buf, -1, 0); |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1968 } else { |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1969 if (flags & WFLAG_WHISPER) { |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1970 /* if we're whispering, it's not an autoresponse */ |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2855
diff
changeset
|
1971 if (meify(what, length)) { |
2138
cfa83a1b3d49
[gaim-migrate @ 2148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2124
diff
changeset
|
1972 str = g_malloc(1024); |
cfa83a1b3d49
[gaim-migrate @ 2148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2124
diff
changeset
|
1973 g_snprintf(str, 1024, "***%s", who); |
2374
9e9385cddcc6
[gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
1974 strcpy(colour, "#6C2585"); |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1975 } else { |
2138
cfa83a1b3d49
[gaim-migrate @ 2148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2124
diff
changeset
|
1976 str = g_malloc(1024); |
cfa83a1b3d49
[gaim-migrate @ 2148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2124
diff
changeset
|
1977 g_snprintf(str, 1024, "*%s*:", who); |
2374
9e9385cddcc6
[gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
1978 strcpy(colour, "#00ff00"); |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1979 } |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1980 } else { |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2855
diff
changeset
|
1981 if (meify(what, length)) { |
2138
cfa83a1b3d49
[gaim-migrate @ 2148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2124
diff
changeset
|
1982 str = g_malloc(1024); |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1983 if (flags & WFLAG_AUTO) |
2138
cfa83a1b3d49
[gaim-migrate @ 2148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2124
diff
changeset
|
1984 g_snprintf(str, 1024, "%s ***%s", AUTO_RESPONSE, who); |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1985 else |
2138
cfa83a1b3d49
[gaim-migrate @ 2148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2124
diff
changeset
|
1986 g_snprintf(str, 1024, "***%s", who); |
2374
9e9385cddcc6
[gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
1987 if (flags & WFLAG_NICK) |
2375
09fe1b00d31f
[gaim-migrate @ 2388]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2374
diff
changeset
|
1988 strcpy(colour, "#af7f00"); |
2374
9e9385cddcc6
[gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
1989 else |
9e9385cddcc6
[gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
1990 strcpy(colour, "#062585"); |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1991 } else { |
2138
cfa83a1b3d49
[gaim-migrate @ 2148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2124
diff
changeset
|
1992 str = g_malloc(1024); |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1993 if (flags & WFLAG_AUTO) |
2138
cfa83a1b3d49
[gaim-migrate @ 2148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2124
diff
changeset
|
1994 g_snprintf(str, 1024, "%s %s", who, AUTO_RESPONSE); |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1995 else |
2138
cfa83a1b3d49
[gaim-migrate @ 2148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2124
diff
changeset
|
1996 g_snprintf(str, 1024, "%s:", who); |
2374
9e9385cddcc6
[gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
1997 if (flags & WFLAG_NICK) |
2375
09fe1b00d31f
[gaim-migrate @ 2388]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2374
diff
changeset
|
1998 strcpy(colour, "#af7f00"); |
3367 | 1999 else if (flags & WFLAG_RECV) { |
2000 if (flags & WFLAG_COLORIZE) { | |
2001 char *u = who; | |
2002 int m = 0; | |
2003 while (*u) { | |
2004 m = m + *u; | |
2005 u++; | |
2006 } | |
2007 m = m % NUM_NICK_COLORS; | |
2008 strcpy(colour, nick_colors[m]); | |
2009 } else { | |
3846 | 2010 strcpy(colour, "#ff0000"); |
3367 | 2011 } |
3807 | 2012 } else if (flags & WFLAG_SEND) |
3846 | 2013 strcpy(colour, "#0000ff"); |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
2014 } |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
2015 } |
66 | 2016 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
2017 if (convo_options & OPT_CONVO_SHOW_TIME) |
1437
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
2018 g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"%s\"><FONT SIZE=\"2\">(%s) </FONT>" |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
2019 "<B>%s</B></FONT> ", colour, mdate, str); |
1437
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
2020 else |
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
2021 g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"%s\"><B>%s</B></FONT> ", colour, str); |
1439
06a21ec0e269
[gaim-migrate @ 1449]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1438
diff
changeset
|
2022 g_snprintf(buf2, BUF_LONG, "<FONT COLOR=\"%s\"><FONT SIZE=\"2\"><!--(%s) --></FONT>" |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
2023 "<B>%s</B></FONT> ", colour, mdate, str); |
66 | 2024 |
473
f9bb7761c52b
[gaim-migrate @ 483]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
472
diff
changeset
|
2025 g_free(str); |
f9bb7761c52b
[gaim-migrate @ 483]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
472
diff
changeset
|
2026 |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2855
diff
changeset
|
2027 gtk_imhtml_append_text(GTK_IMHTML(c->text), buf2, -1, 0); |
4032 | 2028 |
2029 withfonttag = g_strdup_printf("<font sml=\"%s\">%s</font>", c->gc->prpl->name, what); | |
2030 logstr = gtk_imhtml_append_text(GTK_IMHTML(c->text), withfonttag, length, gtk_font_options); | |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2855
diff
changeset
|
2031 |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2855
diff
changeset
|
2032 gtk_imhtml_append_text(GTK_IMHTML(c->text), "<BR>", -1, 0); |
66 | 2033 |
2857
7a6f33cd6721
[gaim-migrate @ 2870]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2856
diff
changeset
|
2034 /* XXX this needs to be updated for the new length argument */ |
1525
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1486
diff
changeset
|
2035 if (logging_options & OPT_LOG_STRIP_HTML) { |
1479
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
2036 char *t1, *t2; |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
2037 t1 = strip_html(buf); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
2038 t2 = strip_html(what); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
2039 c->history = g_string_append(c->history, t1); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
2040 c->history = g_string_append(c->history, t2); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
2041 c->history = g_string_append(c->history, "\n"); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
2042 g_free(t1); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
2043 g_free(t2); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
2044 } else { |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
2045 char *t1, *t2; |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
2046 t1 = html_logize(buf); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
2047 t2 = html_logize(what); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
2048 c->history = g_string_append(c->history, t1); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
2049 c->history = g_string_append(c->history, t2); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
2050 c->history = g_string_append(c->history, "\n"); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
2051 c->history = g_string_append(c->history, logstr->str); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
2052 c->history = g_string_append(c->history, "<BR>\n"); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
2053 g_free(t1); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
2054 g_free(t2); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
2055 } |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
2056 |
2857
7a6f33cd6721
[gaim-migrate @ 2870]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2856
diff
changeset
|
2057 /* XXX this needs to be updated for the new length argument */ |
3457 | 2058 if ((c->is_chat && (logging_options & OPT_LOG_CHATS)) |
2059 || (!c->is_chat && (logging_options & OPT_LOG_CONVOS)) || find_log_info(c->name)) { | |
1437
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
2060 char *t1, *t2; |
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
2061 char *nm = g_malloc(256); |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
2062 if (c->is_chat) |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
2063 g_snprintf(nm, 256, "%s.chat", c->name); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
2064 else |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
2065 g_snprintf(nm, 256, "%s", c->name); |
66 | 2066 |
1525
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1486
diff
changeset
|
2067 if (logging_options & OPT_LOG_STRIP_HTML) { |
1437
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
2068 t1 = strip_html(buf); |
4032 | 2069 t2 = strip_html(withfonttag); |
1437
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
2070 } else { |
1440
6330d0bb309f
[gaim-migrate @ 1450]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1439
diff
changeset
|
2071 t1 = html_logize(buf); |
4032 | 2072 t2 = html_logize(withfonttag); |
1437
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
2073 } |
3457 | 2074 fd = open_log_file(nm, c->is_chat); |
2004
699ddd727a49
[gaim-migrate @ 2014]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1970
diff
changeset
|
2075 if (fd) { |
1525
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1486
diff
changeset
|
2076 if (logging_options & OPT_LOG_STRIP_HTML) { |
1437
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
2077 fprintf(fd, "%s%s\n", t1, t2); |
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
2078 } else { |
1440
6330d0bb309f
[gaim-migrate @ 1450]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1439
diff
changeset
|
2079 fprintf(fd, "%s%s%s<BR>\n", t1, t2, logstr->str); |
6330d0bb309f
[gaim-migrate @ 1450]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1439
diff
changeset
|
2080 g_string_free(logstr, TRUE); |
1437
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
2081 } |
1067
649199f4730e
[gaim-migrate @ 1077]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1063
diff
changeset
|
2082 fclose(fd); |
936 | 2083 } |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
2084 g_free(t1); |
1437
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
2085 g_free(t2); |
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
2086 g_free(nm); |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
2087 } |
4032 | 2088 |
2089 g_free(withfonttag); | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
2090 } |
66 | 2091 |
4032 | 2092 |
3801 | 2093 if (!(flags & WFLAG_NOLOG) && ((c->is_chat && (chat_options & OPT_CHAT_POPUP)) || |
2094 (!c->is_chat && (im_options & OPT_IM_POPUP)))) | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
2095 gdk_window_show(c->window->window); |
66 | 2096 |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2097 /* tab highlighting */ |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2098 if (c->is_chat && !(chat_options & OPT_CHAT_ONE_WINDOW)) /* if chat but not tabbed chat */ |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2099 return; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2100 if (!(flags & WFLAG_RECV) && !(flags & WFLAG_SYSTEM)) |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2101 return; |
3799 | 2102 if (im_options & OPT_IM_ONE_WINDOW && ((c->unseen == 2) || ((c->unseen == 1) && !(flags & WFLAG_NICK)))) |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2103 return; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2104 |
3787 | 2105 if (flags & WFLAG_RECV) |
2106 c->typing_state = NOT_TYPING; | |
2107 | |
3768 | 2108 |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2109 if (c->is_chat) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2110 int offs; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2111 if ((convo_options & OPT_CONVO_COMBINE) && (im_options & OPT_IM_ONE_WINDOW)) |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2112 offs = g_list_length(conversations); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2113 else |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2114 offs = 0; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2115 if (gtk_notebook_get_current_page(GTK_NOTEBOOK(chat_notebook)) == |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2116 g_list_index(chats, c) + offs) |
2993 | 2117 unhighlight = 1; |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2118 } else { |
3812 | 2119 if (im_options & OPT_IM_ONE_WINDOW) |
2120 if (gtk_notebook_get_current_page(GTK_NOTEBOOK(convo_notebook)) == | |
2121 g_list_index(conversations, c)) | |
2122 unhighlight = 1; | |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2123 } |
3768 | 2124 |
2125 if (!unhighlight && flags & WFLAG_NICK) { | |
2126 c->unseen = 2; | |
2127 } else if (!unhighlight) { | |
2128 c->unseen = 1; | |
2129 } else { | |
2130 c->unseen = 0; | |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2131 } |
3787 | 2132 update_convo_status(c); |
66 | 2133 } |
2134 | |
2993 | 2135 void update_progress(struct conversation *c, float percent) { |
3044 | 2136 |
2993 | 2137 if (percent >= 1 && !(c->progress)) |
2138 return; | |
2139 | |
2140 if (percent >= 1) { | |
2141 gtk_widget_destroy(c->progress); | |
2142 c->progress = NULL; | |
2143 return; | |
2144 } | |
2145 | |
2146 if (!c->progress) { | |
2147 GtkBox *box = GTK_BOX(c->text->parent->parent); | |
2148 c->progress = gtk_progress_bar_new(); | |
2149 gtk_box_pack_end(box, c->progress, FALSE, FALSE, 0); | |
2150 gtk_widget_set_usize (c->progress, 1, 8); | |
2151 gtk_widget_show (c->progress); | |
2152 } | |
2153 | |
2154 if (percent < 1) | |
2155 gtk_progress_set_percentage(GTK_PROGRESS(c->progress), percent); | |
2156 } | |
66 | 2157 |
3671 | 2158 GtkWidget *build_conv_menubar(struct conversation *c) |
2159 { | |
3704 | 2160 GtkWidget *hb; |
3671 | 2161 GtkWidget *menubar; |
2162 GtkWidget *menu; | |
2163 GtkWidget *menuitem; | |
2164 | |
3704 | 2165 |
2166 hb = gtk_handle_box_new(); | |
2167 | |
3671 | 2168 menubar = gtk_menu_bar_new(); |
2169 | |
3704 | 2170 gtk_container_add(GTK_CONTAINER(hb), menubar); |
2171 | |
3671 | 2172 menu = gtk_menu_new(); |
2173 | |
2174 /* The file menu */ | |
2175 menuitem = gaim_new_item(NULL, _("File")); | |
2176 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), menu); | |
2177 gtk_menu_bar_append(GTK_MENU_BAR(menubar), menuitem); | |
2178 | |
2179 gaim_new_item_from_stock(menu, _("_Save Conversation"), "gtk-save-as", GTK_SIGNAL_FUNC(save_convo), c, 0, 0, NULL); | |
2180 | |
2181 gaim_new_item_from_stock(menu, _("View _History"), NULL, GTK_SIGNAL_FUNC(conv_show_log), GINT_TO_POINTER(c->name), 0, 0, NULL); | |
2182 | |
2183 menuitem = gtk_menu_item_new(); | |
2184 gtk_menu_append(GTK_MENU(menu), menuitem); | |
2185 /* | |
2186 c->sendfile_btn = gaim_new_item_from_pixbuf(menu, _("Send File"), "send-file-small.png", NULL, NULL, 0, 0, NULL); */ | |
2187 | |
3897 | 2188 gaim_new_item_from_pixbuf(menu, _("Insert _URL"), "insert-link-small.png", GTK_SIGNAL_FUNC(insert_link_cb), c, 0, 0, NULL); |
2189 c->image_menubtn = gaim_new_item_from_pixbuf(menu, _("Insert _Image"), "insert-image-small.png", GTK_SIGNAL_FUNC(insert_image), c, 0, 0, NULL); | |
3671 | 2190 |
2191 menuitem = gtk_menu_item_new(); | |
2192 gtk_menu_append(GTK_MENU(menu), menuitem); | |
2193 | |
2194 gaim_new_item_from_stock(menu, _("_Close"), "gtk-close", GTK_SIGNAL_FUNC(close_callback), c, 0, 0, NULL); | |
2195 | |
2196 /* The Options menu */ | |
2197 menu = gtk_menu_new(); | |
2198 | |
2199 menuitem = gaim_new_item(NULL, _("Options")); | |
2200 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), menu); | |
2201 gtk_menu_bar_append(GTK_MENU_BAR(menubar), menuitem); | |
2202 | |
2203 /* Logging */ | |
2204 menuitem = gtk_check_menu_item_new_with_mnemonic(_("Enable _Logging")); | |
2205 c->log_button = menuitem; /* We should save this */ | |
2206 | |
2207 state_lock = 1; | |
3699 | 2208 |
3671 | 2209 if (find_log_info(c->name)) |
3699 | 2210 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE); |
3671 | 2211 else |
3699 | 2212 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), FALSE); |
2213 | |
3671 | 2214 state_lock = 0; |
2215 | |
2216 gtk_signal_connect(GTK_OBJECT(menuitem), "toggled", GTK_SIGNAL_FUNC(toggle_loggle), c); | |
2217 | |
2218 /* Sounds */ | |
2219 | |
2220 gtk_menu_append(GTK_MENU(menu), menuitem); | |
2221 | |
2222 menuitem = gtk_check_menu_item_new_with_mnemonic(_("Enable _Sounds")); | |
2223 c->makesound = 1; | |
2224 gtk_signal_connect(GTK_OBJECT(menuitem), "toggled", GTK_SIGNAL_FUNC(toggle_sound), c); | |
3679 | 2225 state_lock = 1; |
3671 | 2226 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE); |
3679 | 2227 state_lock = 0; |
3671 | 2228 gtk_menu_append(GTK_MENU(menu), menuitem); |
2229 | |
2230 | |
2231 | |
2232 /* Now set the current values or something */ | |
2233 gtk_widget_set_sensitive(GTK_WIDGET(c->log_button), (logging_options & OPT_LOG_CONVOS) ? FALSE : TRUE); | |
2234 | |
3704 | 2235 gtk_widget_show_all(hb); |
2236 | |
2237 return hb; | |
3671 | 2238 |
2239 } | |
2240 | |
3689 | 2241 GtkWidget *build_conv_toolbar(struct conversation *c) |
3671 | 2242 { |
2243 GtkWidget *vbox; | |
2244 GtkWidget *hbox; | |
2245 GtkWidget *button; | |
2246 GtkWidget *sep; | |
2247 GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); | |
2248 /* | |
2249 c->toolbar = toolbar; | |
2250 c->bold = bold; | |
2251 c->strike = strike; | |
2252 c->italic = italic; | |
2253 c->underline = underline; | |
2254 c->log_button = wood; | |
2255 c->viewer_button = viewer; | |
2256 c->fgcolorbtn = fgcolorbtn; | |
2257 c->bgcolorbtn = bgcolorbtn; | |
2258 c->link = link; | |
2259 c->wood = wood; | |
2260 c->font = font; | |
2261 c->smiley = smiley; | |
2262 c->imagebtn = image; | |
2263 c->speaker = speaker; | |
2264 c->speaker_p = speaker_p; | |
2265 */ | |
2266 | |
2267 vbox = gtk_vbox_new(FALSE, 0); | |
2268 sep = gtk_hseparator_new(); | |
2269 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); | |
2270 | |
2271 hbox = gtk_hbox_new(FALSE, 5); | |
2272 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
2273 | |
2274 /* Bold */ | |
2275 button = gaim_pixbuf_toolbar_button_from_stock("gtk-bold"); | |
2276 gtk_size_group_add_widget(sg, button); | |
2277 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3790 | 2278 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(do_bold), c); |
3671 | 2279 c->bold = button; /* We should remember this */ |
2280 | |
2281 /* Italic */ | |
2282 button = gaim_pixbuf_toolbar_button_from_stock("gtk-italic"); | |
2283 gtk_size_group_add_widget(sg, button); | |
2284 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3790 | 2285 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(do_italic), c); |
3671 | 2286 c->italic = button; /* We should remember this */ |
2287 | |
2288 /* Underline */ | |
2289 button = gaim_pixbuf_toolbar_button_from_stock("gtk-underline"); | |
2290 gtk_size_group_add_widget(sg, button); | |
2291 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3790 | 2292 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(do_underline), c); |
3671 | 2293 c->underline = button; /* We should remember this */ |
2294 | |
2295 /* Sep */ | |
2296 sep = gtk_vseparator_new(); | |
2297 gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 0); | |
2298 | |
2299 /* Increase font size */ | |
2300 button = gaim_pixbuf_toolbar_button_from_file("text_bigger.png"); | |
2301 gtk_size_group_add_widget(sg, button); | |
2302 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3790 | 2303 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(do_big), c); |
3671 | 2304 |
2305 /* Normal Font Size */ | |
2306 button = gaim_pixbuf_toolbar_button_from_file("text_normal.png"); | |
2307 gtk_size_group_add_widget(sg, button); | |
2308 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3790 | 2309 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(do_normal), c); |
3671 | 2310 c->font = button; /* We should remember this */ |
2311 | |
2312 /* Decrease font size */ | |
2313 button = gaim_pixbuf_toolbar_button_from_file("text_smaller.png"); | |
2314 gtk_size_group_add_widget(sg, button); | |
2315 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3790 | 2316 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(do_small), c); |
3671 | 2317 |
2318 /* Sep */ | |
2319 sep = gtk_vseparator_new(); | |
2320 gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 0); | |
2321 | |
2322 /* Font Color */ | |
3923 | 2323 button = gaim_pixbuf_toolbar_button_from_file("change-fgcolor-small.png"); |
3671 | 2324 gtk_size_group_add_widget(sg, button); |
2325 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
2326 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_fg_color), c); | |
2327 c->fgcolorbtn = button; /* We should remember this */ | |
2328 | |
2329 /* Font Color */ | |
3923 | 2330 button = gaim_pixbuf_toolbar_button_from_file("change-bgcolor-small.png"); |
3671 | 2331 gtk_size_group_add_widget(sg, button); |
2332 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
2333 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_bg_color), c); | |
2334 c->bgcolorbtn = button; /* We should remember this */ | |
2335 | |
2336 | |
2337 /* Sep */ | |
2338 sep = gtk_vseparator_new(); | |
2339 gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 0); | |
2340 | |
2341 /* Insert IM Image */ | |
2342 button = gaim_pixbuf_toolbar_button_from_file("insert-image-small.png"); | |
2343 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(insert_image), c); | |
2344 gtk_size_group_add_widget(sg, button); | |
2345 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
2346 c->imagebtn = button; | |
2347 | |
2348 /* Insert Link */ | |
2349 button = gaim_pixbuf_toolbar_button_from_file("insert-link-small.png"); | |
2350 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_link), c); | |
2351 gtk_size_group_add_widget(sg, button); | |
2352 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
2353 c->link = button; | |
2354 | |
2355 /* Insert Smiley */ | |
2356 button = gaim_pixbuf_toolbar_button_from_file("insert-smiley-small.png"); | |
2357 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(insert_smiley), c); | |
2358 gtk_size_group_add_widget(sg, button); | |
2359 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
2360 c->smiley = button; | |
2361 | |
2362 sep = gtk_hseparator_new(); | |
2363 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); | |
2364 | |
2365 gtk_widget_show_all(vbox); | |
2366 | |
2367 return vbox; | |
2368 } | |
2369 | |
1898
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2370 static void convo_sel_send(GtkObject *m, struct gaim_connection *c) |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2371 { |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2372 struct conversation *cnv = gtk_object_get_user_data(m); |
1898
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2373 |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2374 if (cnv->gc == c) |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2375 return; |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2376 |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2377 cnv->gc = c; |
1340 | 2378 |
2787
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
2379 set_convo_title(cnv); |
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
2380 |
1342 | 2381 update_buttons_by_protocol(cnv); |
1898
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2382 |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
2383 update_icon(cnv); |
2231
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
2384 update_checkbox(cnv); |
3050 | 2385 update_smilies(cnv); |
3081 | 2386 gaim_setup_imhtml_smileys(cnv->text); |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2387 } |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2388 |
2379
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2389 int set_dispstyle(int chat) |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2390 { |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2391 int dispstyle; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2392 |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2393 if (chat) { |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2394 switch (chat_options & (OPT_CHAT_BUTTON_TEXT | OPT_CHAT_BUTTON_XPM)) { |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2395 case OPT_CHAT_BUTTON_TEXT: |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2396 dispstyle = 1; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2397 break; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2398 case OPT_CHAT_BUTTON_XPM: |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2399 dispstyle = 0; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2400 break; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2401 default: /* both or neither */ |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2402 dispstyle = 2; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2403 break; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2404 } |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2405 } else { |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2406 switch (im_options & (OPT_IM_BUTTON_TEXT | OPT_IM_BUTTON_XPM)) { |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2407 case OPT_IM_BUTTON_TEXT: |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2408 dispstyle = 1; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2409 break; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2410 case OPT_IM_BUTTON_XPM: |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2411 dispstyle = 0; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2412 break; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2413 default: /* both or neither */ |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2414 dispstyle = 2; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2415 break; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2416 } |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2417 } |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2418 return dispstyle; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2419 } |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2420 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2421 void update_convo_add_button(struct conversation *c) |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2422 { |
3716
d7e83b4db191
[gaim-migrate @ 3849]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3705
diff
changeset
|
2423 /*int dispstyle = set_dispstyle(0);*/ |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2424 GtkWidget *parent = c->add->parent; |
1663
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
2425 gboolean rebuild = FALSE; |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
2426 |
1352 | 2427 if (find_buddy(c->gc, c->name)) { |
1663
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
2428 if (!gtk_object_get_user_data(GTK_OBJECT(c->add))) { |
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
2429 gtk_widget_destroy(c->add); |
3671 | 2430 c->add = gaim_pixbuf_button_from_stock(_("Remove"), "gtk-remove", GAIM_BUTTON_VERTICAL); |
1663
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
2431 rebuild = TRUE; |
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
2432 } |
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
2433 if (c->gc) { |
1352 | 2434 if (c->gc->prpl->remove_buddy == NULL) |
2435 gtk_widget_set_sensitive(c->add, FALSE); | |
2436 else | |
2437 gtk_widget_set_sensitive(c->add, TRUE); | |
1663
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
2438 } else |
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
2439 gtk_widget_set_sensitive(c->add, FALSE); |
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
2440 gtk_object_set_user_data(GTK_OBJECT(c->add), c); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2441 } else { |
1663
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
2442 if (gtk_object_get_user_data(GTK_OBJECT(c->add))) { |
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
2443 gtk_widget_destroy(c->add); |
3671 | 2444 c->add = gaim_pixbuf_button_from_stock(_("Add"), "gtk-add", GAIM_BUTTON_VERTICAL); |
1663
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
2445 rebuild = TRUE; |
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
2446 } |
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
2447 if (c->gc) { |
1352 | 2448 if (c->gc->prpl->add_buddy == NULL) |
2449 gtk_widget_set_sensitive(c->add, FALSE); | |
2450 else | |
2451 gtk_widget_set_sensitive(c->add, TRUE); | |
1663
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
2452 } else |
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
2453 gtk_widget_set_sensitive(c->add, FALSE); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2454 } |
1352 | 2455 |
1663
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
2456 if (rebuild) { |
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
2457 gtk_signal_connect(GTK_OBJECT(c->add), "clicked", GTK_SIGNAL_FUNC(add_callback), c); |
3671 | 2458 gtk_box_pack_start(GTK_BOX(parent), c->add, FALSE, FALSE, 0); |
2459 gtk_box_reorder_child(GTK_BOX(parent), c->add, 3); | |
2460 gtk_button_set_relief(GTK_BUTTON(c->add), GTK_RELIEF_NONE); | |
2461 gtk_size_group_add_widget(c->sg, c->add); | |
1663
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
2462 gtk_widget_show(c->add); |
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
2463 } |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2464 } |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2465 |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2466 static void create_convo_menu(struct conversation *cnv) |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2467 { |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2468 GtkWidget *menu, *opt; |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2469 GSList *g = connections; |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2470 struct gaim_connection *c; |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1228
diff
changeset
|
2471 char buf[2048]; |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2472 |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2473 if (g_slist_length(g) < 2) |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2474 gtk_widget_hide(cnv->menu->parent); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2475 else { |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2476 menu = gtk_menu_new(); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2477 |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2478 while (g) { |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2479 c = (struct gaim_connection *)g->data; |
3572 | 2480 g_snprintf(buf, sizeof buf, "%s (%s)", c->username, c->prpl->name); |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1228
diff
changeset
|
2481 opt = gtk_menu_item_new_with_label(buf); |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2482 gtk_object_set_user_data(GTK_OBJECT(opt), cnv); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2483 gtk_signal_connect(GTK_OBJECT(opt), "activate", |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2484 GTK_SIGNAL_FUNC(convo_sel_send), c); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2485 gtk_widget_show(opt); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2486 gtk_menu_append(GTK_MENU(menu), opt); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2487 g = g->next; |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2488 } |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2489 |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2490 gtk_option_menu_remove_menu(GTK_OPTION_MENU(cnv->menu)); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2491 gtk_option_menu_set_menu(GTK_OPTION_MENU(cnv->menu), menu); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2492 gtk_option_menu_set_history(GTK_OPTION_MENU(cnv->menu), 0); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2493 |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2494 gtk_widget_show(cnv->menu); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2495 gtk_widget_show(cnv->menu->parent); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2496 } |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2497 } |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2498 |
2111
109669b3887e
[gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2109
diff
changeset
|
2499 void redo_convo_menus() |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2500 { |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2501 GList *c = conversations; |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2502 struct conversation *C; |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2503 |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2504 while (c) { |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2505 C = (struct conversation *)c->data; |
1898
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2506 c = c->next; |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2507 |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2508 create_convo_menu(C); |
993
eacd93d0089a
[gaim-migrate @ 1003]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
2509 |
2111
109669b3887e
[gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2109
diff
changeset
|
2510 if (g_slist_find(connections, C->gc)) |
2487
43a75ca5b909
[gaim-migrate @ 2500]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2483
diff
changeset
|
2511 set_convo_gc(C, C->gc); |
43a75ca5b909
[gaim-migrate @ 2500]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2483
diff
changeset
|
2512 else |
43a75ca5b909
[gaim-migrate @ 2500]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2483
diff
changeset
|
2513 set_convo_gc(C, connections ? connections->data : NULL); |
2111
109669b3887e
[gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2109
diff
changeset
|
2514 } |
109669b3887e
[gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2109
diff
changeset
|
2515 } |
109669b3887e
[gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2109
diff
changeset
|
2516 |
109669b3887e
[gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2109
diff
changeset
|
2517 void convo_menu_remove(struct gaim_connection *gc) |
109669b3887e
[gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2109
diff
changeset
|
2518 { |
109669b3887e
[gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2109
diff
changeset
|
2519 GList *c = conversations; |
109669b3887e
[gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2109
diff
changeset
|
2520 struct conversation *C; |
109669b3887e
[gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2109
diff
changeset
|
2521 |
109669b3887e
[gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2109
diff
changeset
|
2522 while (c) { |
109669b3887e
[gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2109
diff
changeset
|
2523 C = (struct conversation *)c->data; |
109669b3887e
[gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2109
diff
changeset
|
2524 c = c->next; |
2109
3110ea142888
[gaim-migrate @ 2119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2104
diff
changeset
|
2525 |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
2526 remove_icon(C); |
2231
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
2527 remove_checkbox(C); |
1898
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2528 } |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2529 } |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2530 |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2531 void set_convo_gc(struct conversation *c, struct gaim_connection *gc) |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2532 { |
2722
abecab600451
[gaim-migrate @ 2735]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2706
diff
changeset
|
2533 if (gc) |
abecab600451
[gaim-migrate @ 2735]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2706
diff
changeset
|
2534 gtk_option_menu_set_history(GTK_OPTION_MENU(c->menu), g_slist_index(connections, gc)); |
abecab600451
[gaim-migrate @ 2735]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2706
diff
changeset
|
2535 |
1898
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2536 if (c->gc == gc) |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2537 return; |
993
eacd93d0089a
[gaim-migrate @ 1003]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
2538 |
1898
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2539 c->gc = gc; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2540 |
2787
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
2541 set_convo_title(c); |
1898
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2542 update_buttons_by_protocol(c); |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2543 |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
2544 update_icon(c); |
2231
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
2545 update_checkbox(c); |
3051 | 2546 update_smilies(c); |
3081 | 2547 gaim_setup_imhtml_smileys(c->text); |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2548 } |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
2549 |
1340 | 2550 void update_buttons_by_protocol(struct conversation *c) |
2551 { | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
2552 if (!c->gc) { |
2619
536198196dc6
[gaim-migrate @ 2632]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2582
diff
changeset
|
2553 if (c->info) |
536198196dc6
[gaim-migrate @ 2632]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2582
diff
changeset
|
2554 gtk_widget_set_sensitive(c->info, FALSE); |
536198196dc6
[gaim-migrate @ 2632]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2582
diff
changeset
|
2555 if (c->send) |
536198196dc6
[gaim-migrate @ 2632]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2582
diff
changeset
|
2556 gtk_widget_set_sensitive(c->send, FALSE); |
536198196dc6
[gaim-migrate @ 2632]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2582
diff
changeset
|
2557 if (c->warn) |
536198196dc6
[gaim-migrate @ 2632]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2582
diff
changeset
|
2558 gtk_widget_set_sensitive(c->warn, FALSE); |
536198196dc6
[gaim-migrate @ 2632]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2582
diff
changeset
|
2559 if (c->block) |
536198196dc6
[gaim-migrate @ 2632]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2582
diff
changeset
|
2560 gtk_widget_set_sensitive(c->block, FALSE); |
536198196dc6
[gaim-migrate @ 2632]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2582
diff
changeset
|
2561 if (c->add) |
536198196dc6
[gaim-migrate @ 2632]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2582
diff
changeset
|
2562 gtk_widget_set_sensitive(c->add, FALSE); |
2546
d392e9b867e9
[gaim-migrate @ 2559]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2541
diff
changeset
|
2563 if (c->whisper) |
d392e9b867e9
[gaim-migrate @ 2559]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2541
diff
changeset
|
2564 gtk_widget_set_sensitive(c->whisper, FALSE); |
d392e9b867e9
[gaim-migrate @ 2559]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2541
diff
changeset
|
2565 if (c->invite) |
d392e9b867e9
[gaim-migrate @ 2559]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2541
diff
changeset
|
2566 gtk_widget_set_sensitive(c->invite, FALSE); |
1352 | 2567 return; |
2568 } | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
2569 |
1532
249a770bebd7
[gaim-migrate @ 1542]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
2570 if (c->gc->prpl->get_info == NULL && c->info) |
1340 | 2571 gtk_widget_set_sensitive(c->info, FALSE); |
1398
f6b0cf1f4c3b
[gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1370
diff
changeset
|
2572 else if (c->info) |
1340 | 2573 gtk_widget_set_sensitive(c->info, TRUE); |
3671 | 2574 /* |
2575 if (!c->is_chat && c->gc->prpl->file_transfer_out) | |
2576 gtk_widget_set_sensitive(c->sendfile_btn, TRUE); | |
2577 else | |
2578 gtk_widget_set_sensitive(c->sendfile_btn, FALSE); | |
2579 */ | |
2094
be10a1243ed7
[gaim-migrate @ 2104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
2580 if (c->is_chat) { |
be10a1243ed7
[gaim-migrate @ 2104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
2581 if (c->gc->prpl->chat_send == NULL && c->send) |
be10a1243ed7
[gaim-migrate @ 2104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
2582 gtk_widget_set_sensitive(c->send, FALSE); |
be10a1243ed7
[gaim-migrate @ 2104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
2583 else |
be10a1243ed7
[gaim-migrate @ 2104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
2584 gtk_widget_set_sensitive(c->send, TRUE); |
3671 | 2585 |
3044 | 2586 gtk_widget_set_sensitive(c->imagebtn, FALSE); |
3671 | 2587 gtk_widget_set_sensitive(c->image_menubtn, FALSE); |
2094
be10a1243ed7
[gaim-migrate @ 2104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
2588 } else { |
be10a1243ed7
[gaim-migrate @ 2104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
2589 if (c->gc->prpl->send_im == NULL && c->send) |
be10a1243ed7
[gaim-migrate @ 2104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
2590 gtk_widget_set_sensitive(c->send, FALSE); |
be10a1243ed7
[gaim-migrate @ 2104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
2591 else |
be10a1243ed7
[gaim-migrate @ 2104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
2592 gtk_widget_set_sensitive(c->send, TRUE); |
3671 | 2593 if (c->gc->prpl->options & OPT_PROTO_IM_IMAGE) { |
3888 | 2594 if (c->imagebtn) |
2595 gtk_widget_set_sensitive(c->imagebtn, TRUE); | |
2596 if (c->image_menubtn) | |
2597 gtk_widget_set_sensitive(c->image_menubtn, TRUE); | |
3671 | 2598 } |
2599 else { | |
3888 | 2600 |
2601 if (c->image_menubtn) | |
2602 gtk_widget_set_sensitive(c->image_menubtn, FALSE); | |
2603 if (c->imagebtn) | |
2604 gtk_widget_set_sensitive(c->imagebtn, FALSE); | |
3671 | 2605 } |
2094
be10a1243ed7
[gaim-migrate @ 2104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
2606 } |
1341 | 2607 |
1343 | 2608 if (c->gc->prpl->warn == NULL && c->warn) |
1341 | 2609 gtk_widget_set_sensitive(c->warn, FALSE); |
1398
f6b0cf1f4c3b
[gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1370
diff
changeset
|
2610 else if (c->warn) |
1341 | 2611 gtk_widget_set_sensitive(c->warn, TRUE); |
2612 | |
1343 | 2613 if (c->gc->prpl->add_permit == NULL && c->block) |
1341 | 2614 gtk_widget_set_sensitive(c->block, FALSE); |
1398
f6b0cf1f4c3b
[gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1370
diff
changeset
|
2615 else if (c->block) |
1341 | 2616 gtk_widget_set_sensitive(c->block, TRUE); |
2617 | |
1343 | 2618 if (c->add) |
2619 update_convo_add_button(c); | |
2620 | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
2621 if (c->whisper) { |
1343 | 2622 if (c->gc->prpl->chat_whisper == NULL) |
2623 gtk_widget_set_sensitive(c->whisper, FALSE); | |
2624 else | |
2625 gtk_widget_set_sensitive(c->whisper, TRUE); | |
2626 } | |
2627 | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
2628 if (c->invite) { |
1343 | 2629 if (c->gc->prpl->chat_invite == NULL) |
2630 gtk_widget_set_sensitive(c->invite, FALSE); | |
2631 else | |
2632 gtk_widget_set_sensitive(c->invite, TRUE); | |
2633 } | |
1340 | 2634 } |
2635 | |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2636 void convo_switch(GtkNotebook *notebook, GtkWidget *page, gint page_num, gpointer data) |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2637 { |
3866 | 2638 GtkWidget *label = NULL; |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2639 GtkStyle *style; |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2640 struct conversation *c; |
3677 | 2641 |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2642 if ((convo_options & OPT_CONVO_COMBINE) && |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2643 (im_options & OPT_IM_ONE_WINDOW) && |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2644 (chat_options & OPT_CHAT_ONE_WINDOW)) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2645 int len = g_list_length(conversations); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2646 if (page_num < len) |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2647 c = g_list_nth_data(conversations, page_num); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2648 else |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2649 c = g_list_nth_data(chats, page_num - len); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2650 } else if (GTK_WIDGET(notebook) == convo_notebook) |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2651 c = g_list_nth_data(conversations, page_num); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2652 else |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2653 c = g_list_nth_data(chats, page_num); |
3951 | 2654 |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2655 if (c && c->window && c->entry) |
3951 | 2656 gtk_widget_grab_focus(c->entry); |
2657 | |
3866 | 2658 label = c->tab_label; |
2659 | |
2660 if (!label) | |
2661 return; | |
2662 | |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2663 if (!GTK_WIDGET_REALIZED(label)) |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2664 return; |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2665 style = gtk_style_new(); |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2722
diff
changeset
|
2666 gtk_style_set_font(style, gdk_font_ref(gtk_style_get_font(label->style))); |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2667 gtk_widget_set_style(label, style); |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2668 gtk_style_unref(style); |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2669 if (c) |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2670 c->unseen = 0; |
3677 | 2671 |
2672 if (!c->is_chat) { | |
2673 GtkWidget *menubar; | |
3683 | 2674 GtkWidget *parent = convo_notebook->parent; |
3677 | 2675 |
2676 gtk_widget_freeze_child_notify(GTK_WIDGET(c->window)); | |
3787 | 2677 |
3683 | 2678 if (convo_menubar != NULL) |
2679 gtk_widget_destroy(convo_menubar); | |
2680 | |
3677 | 2681 menubar = build_conv_menubar(c); |
2682 gtk_box_pack_start(GTK_BOX(parent), menubar, FALSE, TRUE, 0); | |
2683 gtk_box_reorder_child(GTK_BOX(parent), menubar, 0); | |
2684 convo_menubar = menubar; | |
2685 | |
2686 gtk_widget_thaw_child_notify(GTK_WIDGET(c->window)); | |
2687 } else { | |
2688 gtk_widget_destroy(convo_menubar); | |
3683 | 2689 convo_menubar = NULL; |
3677 | 2690 } |
3705 | 2691 |
3787 | 2692 update_convo_status(c); |
2693 | |
3922 | 2694 /*gtk_imhtml_to_bottom(c->text);*/ |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2695 } |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2696 |
3787 | 2697 void update_convo_status(struct conversation *c) { |
3768 | 2698 if(!c) |
2993 | 2699 return; |
3768 | 2700 debug_printf("update_convo_status called for %s\n", c->name); |
2993 | 2701 if (im_options & OPT_IM_ONE_WINDOW) { /* We'll make the tab green */ |
3003 | 2702 GtkStyle *style; |
3866 | 2703 GtkWidget *label = c->tab_label; |
2993 | 2704 style = gtk_style_new(); |
2705 if (!GTK_WIDGET_REALIZED(label)) | |
2706 gtk_widget_realize(label); | |
2707 gtk_style_set_font(style, gdk_font_ref(gtk_style_get_font(label->style))); | |
3787 | 2708 if(c->typing_state == TYPING) { |
3768 | 2709 style->fg[0].red = 0x0000; |
2710 style->fg[0].green = 0x9999; | |
2711 style->fg[0].blue = 0x0000; | |
3787 | 2712 } else if(c->typing_state == TYPED) { |
3789 | 2713 style->fg[0].red = 0xffff; |
3768 | 2714 style->fg[0].green = 0xbbbb; |
2715 style->fg[0].blue = 0x2222; | |
2716 } else if(c->unseen == 2) { | |
2717 style->fg[0].red = 0x0000; | |
2718 style->fg[0].green = 0x0000; | |
2719 style->fg[0].blue = 0xcccc; | |
2720 } else if(c->unseen == 1) { | |
2721 style->fg[0].red = 0xcccc; | |
2722 style->fg[0].green = 0x0000; | |
2723 style->fg[0].blue = 0x0000; | |
2724 } | |
2993 | 2725 gtk_widget_set_style(label, style); |
2726 debug_printf("setting style\n"); | |
2727 gtk_style_unref(style); | |
2728 } else { | |
2729 GtkWindow *win = (GtkWindow *)c->window; | |
3768 | 2730 char *buf, *buf2; |
2731 int len; | |
2732 if(strstr(win->title, _(" [TYPING]"))) { | |
2733 debug_printf("title had TYPING in it\n"); | |
2734 len = strlen(win->title) - strlen(_(" [TYPING]")); | |
2735 } else if(strstr(win->title, _(" [TYPED]"))) { | |
2736 debug_printf("title had TYPED in it\n"); | |
2737 len = strlen(win->title) - strlen(_(" [TYPED]")); | |
2738 } else { | |
2739 debug_printf("title was free of typing information\n"); | |
2740 len = strlen(win->title); | |
2741 } | |
2742 buf = g_malloc(len+1); | |
2743 g_snprintf(buf, len+1, win->title); | |
3787 | 2744 if(c->typing_state == TYPING) { |
3775 | 2745 buf2 = g_strconcat(buf,_(" [TYPING]"), NULL); |
3768 | 2746 g_free(buf); |
2747 buf = buf2; | |
3787 | 2748 } else if(c->typing_state == TYPED) { |
3775 | 2749 buf2 = g_strconcat(buf,_(" [TYPED]"), NULL); |
3768 | 2750 g_free(buf); |
2751 buf = buf2; | |
2752 } | |
2993 | 2753 gtk_window_set_title(win, buf); |
2754 g_free(buf); | |
2755 } | |
2756 } | |
2757 | |
2758 /* This returns a boolean, so that it can timeout */ | |
2759 gboolean reset_typing(char *name) { | |
2760 struct conversation *c = find_conversation(name); | |
2761 if (!c) { | |
2762 g_free(name); | |
2763 return FALSE; | |
2764 } | |
3768 | 2765 |
2766 /* Reset the title (if necessary) */ | |
3787 | 2767 c->typing_state = NOT_TYPING; |
2768 update_convo_status(c); | |
3768 | 2769 |
2993 | 2770 g_free(name); |
2771 c->typing_timeout = 0; | |
2772 return FALSE; | |
2773 } | |
1340 | 2774 |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
2775 void show_conv(struct conversation *c) |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
2776 { |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
2777 GtkWidget *win; |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2778 GtkWidget *cont; |
615 | 2779 GtkWidget *text; |
2780 GtkWidget *sw; | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
2781 GtkWidget *send; |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
2782 GtkWidget *info; |
615 | 2783 GtkWidget *warn; |
2784 GtkWidget *block; | |
3716
d7e83b4db191
[gaim-migrate @ 3849]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3705
diff
changeset
|
2785 /*GtkWidget *close;*/ |
3790 | 2786 GtkWidget *frame; |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
2787 GtkWidget *entry; |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
2788 GtkWidget *bbox; |
615 | 2789 GtkWidget *vbox; |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
2790 GtkWidget *vbox2; |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
2791 GtkWidget *paned; |
615 | 2792 GtkWidget *add; |
623 | 2793 GtkWidget *toolbar; |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2794 GtkWidget *hbox; |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2795 GtkWidget *label; |
3671 | 2796 GtkWidget *menubar; |
3866 | 2797 GtkWidget *tabby; |
3671 | 2798 |
2799 c->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
2800 |
1219
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2801 c->font_dialog = NULL; |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
2802 c->fg_color_dialog = NULL; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
2803 c->bg_color_dialog = NULL; |
1219
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2804 c->smiley_dialog = NULL; |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2805 c->link_dialog = NULL; |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2806 c->log_dialog = NULL; |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2807 sprintf(c->fontface, "%s", fontface); |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2808 c->hasfont = 0; |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2809 c->bgcol = bgcolor; |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2810 c->hasbg = 0; |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2811 c->fgcol = fgcolor; |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2812 c->hasfg = 0; |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2813 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
2814 if (im_options & OPT_IM_ONE_WINDOW) { |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2815 if (!all_convos) { |
3677 | 2816 GtkWidget *testidea; |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2817 win = all_convos = c->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2818 if ((convo_options & OPT_CONVO_COMBINE) && (chat_options & OPT_CHAT_ONE_WINDOW)) |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2819 all_chats = all_convos; |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2820 gtk_window_set_wmclass(GTK_WINDOW(win), "conversation", "Gaim"); |
2335
2c595fc5f1f8
[gaim-migrate @ 2348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2821 gtk_window_set_policy(GTK_WINDOW(win), TRUE, TRUE, FALSE); |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2822 gtk_container_border_width(GTK_CONTAINER(win), 0); |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2823 gtk_widget_realize(win); |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2824 gtk_window_set_title(GTK_WINDOW(win), _("Gaim - Conversations")); |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2825 gtk_signal_connect(GTK_OBJECT(win), "delete_event", |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2826 GTK_SIGNAL_FUNC(delete_all_convo), NULL); |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2827 |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2828 convo_notebook = gtk_notebook_new(); |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2829 if ((convo_options & OPT_CONVO_COMBINE) && (chat_options & OPT_CHAT_ONE_WINDOW)) |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2830 chat_notebook = convo_notebook; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
2831 if (im_options & OPT_IM_SIDE_TAB) { |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
2832 if (im_options & OPT_IM_BR_TAB) { |
1757
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
2833 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(convo_notebook), |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
2834 GTK_POS_RIGHT); |
1757
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
2835 } else { |
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
2836 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(convo_notebook), |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
2837 GTK_POS_LEFT); |
1757
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
2838 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
2839 } else { |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
2840 if (im_options & OPT_IM_BR_TAB) { |
1757
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
2841 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(convo_notebook), |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
2842 GTK_POS_BOTTOM); |
1757
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
2843 } else { |
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
2844 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(convo_notebook), |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
2845 GTK_POS_TOP); |
1757
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
2846 } |
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
2847 } |
1596
f5845007e3bc
[gaim-migrate @ 1606]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1595
diff
changeset
|
2848 gtk_notebook_set_scrollable(GTK_NOTEBOOK(convo_notebook), TRUE); |
1597
c1a8a7c40424
[gaim-migrate @ 1607]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1596
diff
changeset
|
2849 gtk_notebook_popup_enable(GTK_NOTEBOOK(convo_notebook)); |
3677 | 2850 |
2851 testidea = gtk_vbox_new(FALSE, 0); | |
2852 | |
2853 menubar = build_conv_menubar(c); | |
2854 gtk_box_pack_start(GTK_BOX(testidea), menubar, FALSE, TRUE, 0); | |
3683 | 2855 gtk_box_pack_start(GTK_BOX(testidea), convo_notebook, TRUE, TRUE, 0); |
4026
a997156437b6
[gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3986
diff
changeset
|
2856 #ifdef _WIN32 |
a997156437b6
[gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3986
diff
changeset
|
2857 /* Windows transparency slider */ |
a997156437b6
[gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3986
diff
changeset
|
2858 if ((wgaim_options & OPT_WGAIM_IMTRANS) && |
a997156437b6
[gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3986
diff
changeset
|
2859 (wgaim_options & OPT_WGAIM_SHOW_IMTRANS)) { |
a997156437b6
[gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3986
diff
changeset
|
2860 gtk_box_pack_start(GTK_BOX(testidea), |
a997156437b6
[gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3986
diff
changeset
|
2861 wgaim_wintrans_slider(win), |
a997156437b6
[gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3986
diff
changeset
|
2862 FALSE, FALSE, 0); |
a997156437b6
[gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3986
diff
changeset
|
2863 } else if(wgaim_options & OPT_WGAIM_IMTRANS) { |
a997156437b6
[gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3986
diff
changeset
|
2864 wgaim_set_wintrans(win, wgaim_get_imalpha()); |
a997156437b6
[gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3986
diff
changeset
|
2865 } |
a997156437b6
[gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3986
diff
changeset
|
2866 #endif |
3683 | 2867 gtk_widget_show(testidea); |
2868 gtk_widget_show(convo_notebook); | |
3677 | 2869 convo_menubar = menubar; |
2870 | |
2871 gtk_container_add(GTK_CONTAINER(win), testidea); | |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2872 gtk_signal_connect(GTK_OBJECT(convo_notebook), "switch-page", |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2873 GTK_SIGNAL_FUNC(convo_switch), NULL); |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2874 } else |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2875 win = c->window = all_convos; |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2876 |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2877 cont = gtk_vbox_new(FALSE, 5); |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2878 gtk_container_set_border_width(GTK_CONTAINER(cont), 5); |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2879 /* this doesn't matter since we're resetting the name once we're out of the if */ |
3866 | 2880 /* gtk_notebook_insert_page(GTK_NOTEBOOK(convo_notebook), cont, gtk_label_new(c->name),*/ |
3986
4faf2a9753cb
[gaim-migrate @ 4177]
Christian Hammond <chipx86@chipx86.com>
parents:
3985
diff
changeset
|
2881 tabby = gtk_hbox_new(FALSE, 5); |
3866 | 2882 c->close = gtk_button_new(); |
3985 | 2883 gtk_widget_set_size_request(GTK_WIDGET(c->close), 16, 16); |
3866 | 2884 gtk_container_add(GTK_CONTAINER(c->close), gtk_image_new_from_stock(GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU)); |
2885 gtk_button_set_relief(GTK_BUTTON(c->close), GTK_RELIEF_NONE); | |
2886 c->tab_label = gtk_label_new(c->name); | |
2887 | |
2888 gtk_signal_connect(GTK_OBJECT(c->close), "clicked", GTK_SIGNAL_FUNC(close_callback), c); | |
2889 | |
3868 | 2890 gtk_box_pack_start(GTK_BOX(tabby), c->tab_label, FALSE, FALSE, 0); |
3866 | 2891 gtk_box_pack_start(GTK_BOX(tabby), c->close, FALSE, FALSE, 0); |
2892 gtk_widget_show_all(tabby); | |
2893 gtk_notebook_insert_page(GTK_NOTEBOOK(convo_notebook), cont, tabby, | |
4026
a997156437b6
[gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3986
diff
changeset
|
2894 g_list_index(conversations, c)); |
a997156437b6
[gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3986
diff
changeset
|
2895 |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2896 gtk_widget_show(cont); |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2897 } else { |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2898 cont = win = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2899 c->window = win; |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2900 gtk_object_set_user_data(GTK_OBJECT(win), c); |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2901 gtk_window_set_wmclass(GTK_WINDOW(win), "conversation", "Gaim"); |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2902 gtk_window_set_policy(GTK_WINDOW(win), TRUE, TRUE, TRUE); |
3671 | 2903 gtk_container_border_width(GTK_CONTAINER(win), 0); |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2904 gtk_widget_realize(win); |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2905 gtk_signal_connect(GTK_OBJECT(win), "delete_event", |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2906 GTK_SIGNAL_FUNC(delete_event_convo), c); |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2907 } |
2787
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
2908 set_convo_title(c); |
623 | 2909 |
1219
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2910 paned = gtk_vpaned_new(); |
1228
6773043cf9f6
[gaim-migrate @ 1238]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1227
diff
changeset
|
2911 gtk_paned_set_gutter_size(GTK_PANED(paned), 15); |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2912 gtk_container_add(GTK_CONTAINER(cont), paned); |
1219
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2913 gtk_widget_show(paned); |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2914 |
1228
6773043cf9f6
[gaim-migrate @ 1238]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1227
diff
changeset
|
2915 vbox = gtk_vbox_new(FALSE, 5); |
1219
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2916 gtk_paned_pack1(GTK_PANED(paned), vbox, FALSE, TRUE); |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2917 gtk_widget_show(vbox); |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
2918 |
3677 | 2919 if (!(im_options & OPT_IM_ONE_WINDOW)) { |
2920 menubar = build_conv_menubar(c); | |
2921 gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, TRUE, 0); | |
2922 } | |
3671 | 2923 |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
2924 sw = gtk_scrolled_window_new(NULL, NULL); |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2925 c->sw = sw; |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
2926 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); |
3925 | 2927 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); |
1228
6773043cf9f6
[gaim-migrate @ 1238]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1227
diff
changeset
|
2928 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); |
1813
998a6a032874
[gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1780
diff
changeset
|
2929 gtk_widget_set_usize(sw, conv_size.width, conv_size.height); |
1219
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2930 gtk_widget_show(sw); |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2931 |
1428
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
2932 text = gtk_imhtml_new(NULL, NULL); |
1219
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2933 c->text = text; |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2934 gtk_container_add(GTK_CONTAINER(sw), text); |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
2935 if (convo_options & OPT_CONVO_SHOW_TIME) |
1428
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
2936 gtk_imhtml_show_comments(GTK_IMHTML(text), TRUE); |
1815
f15d449b3167
[gaim-migrate @ 1825]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1813
diff
changeset
|
2937 gaim_setup_imhtml(text); |
1219
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2938 gtk_widget_show(text); |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2939 |
1228
6773043cf9f6
[gaim-migrate @ 1238]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1227
diff
changeset
|
2940 vbox2 = gtk_vbox_new(FALSE, 5); |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
2941 gtk_paned_pack2(GTK_PANED(paned), vbox2, FALSE, FALSE); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
2942 gtk_widget_show(vbox2); |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2943 |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2944 hbox = gtk_hbox_new(FALSE, 0); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2945 gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2946 gtk_widget_show(hbox); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2947 |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2948 label = gtk_label_new(_("Send message as: ")); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2949 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2950 gtk_widget_show(label); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2951 |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2952 c->menu = gtk_option_menu_new(); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2953 gtk_box_pack_start(GTK_BOX(hbox), c->menu, FALSE, FALSE, 5); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2954 gtk_widget_show(c->menu); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2955 |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2956 create_convo_menu(c); |
1219
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2957 |
1898
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2958 c->lbox = gtk_hbox_new(FALSE, 0); |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2959 gtk_box_pack_start(GTK_BOX(vbox2), c->lbox, FALSE, FALSE, 0); |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2960 gtk_widget_show(c->lbox); |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2961 |
3790 | 2962 toolbar = build_conv_toolbar(c); |
2963 gtk_box_pack_start(GTK_BOX(vbox2), toolbar, FALSE, FALSE, 0); | |
2964 | |
2965 frame = gtk_frame_new(NULL); | |
2966 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN); | |
2967 gtk_box_pack_start(GTK_BOX(vbox2), frame, TRUE, TRUE, 0); | |
2968 gtk_widget_show(frame); | |
2969 | |
2970 c->entry_buffer = gtk_text_buffer_new(NULL); | |
2971 g_object_set_data(G_OBJECT(c->entry_buffer), "user_data", c); | |
2972 entry = gtk_text_view_new_with_buffer(c->entry_buffer); | |
1227
25611364a504
[gaim-migrate @ 1237]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1219
diff
changeset
|
2973 c->entry = entry; |
25611364a504
[gaim-migrate @ 1237]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1219
diff
changeset
|
2974 |
3790 | 2975 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(c->entry), GTK_WRAP_WORD); |
3304 | 2976 |
3338 | 2977 gtk_widget_set_usize(entry, conv_size.width - 20, MAX(conv_size.entry_height, 25)); |
1813
998a6a032874
[gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1780
diff
changeset
|
2978 |
3790 | 2979 g_signal_connect_swapped(G_OBJECT(c->entry), "key_press_event", |
2980 G_CALLBACK(entry_key_pressed), c->entry_buffer); | |
2981 g_signal_connect(G_OBJECT(c->entry), "key_press_event", G_CALLBACK(keypress_callback), c); | |
2982 g_signal_connect_after(G_OBJECT(c->entry), "button_press_event", | |
2983 G_CALLBACK(stop_rclick_callback), NULL); | |
2984 g_signal_connect(G_OBJECT(c->entry_buffer), "insert_text", | |
2985 G_CALLBACK(insert_text_callback), c); | |
2986 g_signal_connect(G_OBJECT(c->entry_buffer), "delete_range", | |
2987 G_CALLBACK(delete_text_callback), c); | |
2988 | |
3802 | 2989 #ifdef USE_GTKSPELL |
2990 if (convo_options & OPT_CONVO_CHECK_SPELLING) | |
2991 gtkspell_new_attach(GTK_TEXT_VIEW(c->entry), NULL, NULL); | |
2992 #endif | |
2993 | |
3790 | 2994 gtk_container_add(GTK_CONTAINER(frame), GTK_WIDGET(entry)); |
1219
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2995 gtk_widget_show(entry); |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2996 |
1898
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2997 c->bbox = bbox = gtk_hbox_new(FALSE, 5); |
1228
6773043cf9f6
[gaim-migrate @ 1238]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1227
diff
changeset
|
2998 gtk_box_pack_start(GTK_BOX(vbox2), bbox, FALSE, FALSE, 0); |
1219
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2999 gtk_widget_show(bbox); |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
3000 |
4026
a997156437b6
[gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3986
diff
changeset
|
3001 #ifdef _WIN32 |
a997156437b6
[gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3986
diff
changeset
|
3002 /* Windows transparency slider */ |
a997156437b6
[gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3986
diff
changeset
|
3003 if ((wgaim_options & OPT_WGAIM_IMTRANS) && |
a997156437b6
[gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3986
diff
changeset
|
3004 (wgaim_options & OPT_WGAIM_SHOW_IMTRANS) && |
a997156437b6
[gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3986
diff
changeset
|
3005 !(im_options & OPT_IM_ONE_WINDOW)) { |
a997156437b6
[gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3986
diff
changeset
|
3006 GtkWidget *wsep = gtk_hseparator_new(); |
a997156437b6
[gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3986
diff
changeset
|
3007 gtk_box_pack_start(GTK_BOX(vbox2), wsep, FALSE, FALSE, 0); |
a997156437b6
[gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3986
diff
changeset
|
3008 gtk_widget_show(wsep); |
a997156437b6
[gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3986
diff
changeset
|
3009 gtk_box_pack_start(GTK_BOX(vbox2), |
a997156437b6
[gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3986
diff
changeset
|
3010 wgaim_wintrans_slider(c->window), |
a997156437b6
[gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3986
diff
changeset
|
3011 FALSE, FALSE, 0); |
a997156437b6
[gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3986
diff
changeset
|
3012 } else if((wgaim_options & OPT_WGAIM_IMTRANS) && |
a997156437b6
[gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3986
diff
changeset
|
3013 !(im_options & OPT_IM_ONE_WINDOW)) { |
a997156437b6
[gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3986
diff
changeset
|
3014 wgaim_set_wintrans(win, wgaim_get_imalpha()); |
a997156437b6
[gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3986
diff
changeset
|
3015 } |
a997156437b6
[gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3986
diff
changeset
|
3016 #endif |
a997156437b6
[gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3986
diff
changeset
|
3017 |
3671 | 3018 /* I'm leaving this here just incase we want to bring this back. I'd rather not have the close |
3019 * button any more. If we do, though, it needs to be on the left side. I might bring it back and put | |
3020 * it on that side. */ | |
3021 | |
3022 /* | |
1219
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
3023 close = picture_button2(win, _("Close"), cancel_xpm, dispstyle); |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
3024 c->close = close; |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
3025 gtk_object_set_user_data(GTK_OBJECT(close), c); |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
3026 gtk_signal_connect(GTK_OBJECT(close), "clicked", GTK_SIGNAL_FUNC(close_callback), c); |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
3027 gtk_box_pack_end(GTK_BOX(bbox), close, dispstyle, dispstyle, 0); |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
3028 gtk_widget_show(close); |
3671 | 3029 |
1219
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
3030 c->sep1 = gtk_vseparator_new(); |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
3031 gtk_box_pack_end(GTK_BOX(bbox), c->sep1, dispstyle, dispstyle, 0); |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
3032 gtk_widget_show(c->sep1); |
3671 | 3033 */ |
3034 | |
3035 /* Put the send button on the right */ | |
3036 send = gaim_pixbuf_button_from_stock(_("Send"), "gtk-convert", GAIM_BUTTON_VERTICAL); | |
3037 c->send = send; | |
3038 gtk_signal_connect(GTK_OBJECT(send), "clicked", GTK_SIGNAL_FUNC(send_callback), c); | |
3039 gtk_box_pack_end(GTK_BOX(bbox), send, FALSE, FALSE, 0); | |
3040 gtk_widget_show(send); | |
3041 | |
3042 c->sep2 = gtk_vseparator_new(); | |
3043 gtk_box_pack_end(GTK_BOX(bbox), c->sep2, FALSE, TRUE, 0); | |
3044 gtk_widget_show(c->sep2); | |
3045 | |
3046 /* And put the other buttons on the left */ | |
1219
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
3047 |
1663
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
3048 if (c->gc && find_buddy(c->gc, c->name) != NULL) { |
3671 | 3049 add = gaim_pixbuf_button_from_stock(_("Remove"), "gtk-remove", GAIM_BUTTON_VERTICAL); |
1663
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
3050 gtk_object_set_user_data(GTK_OBJECT(add), c); |
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
3051 } else |
3671 | 3052 add = gaim_pixbuf_button_from_stock(_("Add"), "gtk-add", GAIM_BUTTON_VERTICAL); |
3053 | |
1219
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
3054 c->add = add; |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
3055 gtk_signal_connect(GTK_OBJECT(add), "clicked", GTK_SIGNAL_FUNC(add_callback), c); |
3671 | 3056 gtk_box_pack_start(GTK_BOX(bbox), add, FALSE, FALSE, 0); |
1219
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
3057 gtk_widget_show(add); |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
3058 |
3671 | 3059 warn = gaim_pixbuf_button_from_stock(_("Warn"), "gtk-dialog-warning", GAIM_BUTTON_VERTICAL); |
1219
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
3060 c->warn = warn; |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
3061 gtk_signal_connect(GTK_OBJECT(warn), "clicked", GTK_SIGNAL_FUNC(warn_callback), c); |
3671 | 3062 gtk_box_pack_start(GTK_BOX(bbox), warn, FALSE, FALSE, 0); |
1219
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
3063 gtk_widget_show(warn); |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
3064 |
3671 | 3065 info = gaim_pixbuf_button_from_stock(_("Info"), "gtk-find", GAIM_BUTTON_VERTICAL); |
1219
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
3066 c->info = info; |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
3067 gtk_signal_connect(GTK_OBJECT(info), "clicked", GTK_SIGNAL_FUNC(info_callback), c); |
3671 | 3068 gtk_box_pack_start(GTK_BOX(bbox), info, FALSE, FALSE, 0); |
1219
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
3069 gtk_widget_show(info); |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
3070 |
3671 | 3071 |
3072 block = gaim_pixbuf_button_from_stock(_("Block"), "gtk-stop", GAIM_BUTTON_VERTICAL); | |
3073 c->block = block; | |
3074 gtk_signal_connect(GTK_OBJECT(block), "clicked", GTK_SIGNAL_FUNC(block_callback), c); | |
3075 gtk_box_pack_start(GTK_BOX(bbox), block, FALSE, FALSE, 0); | |
3076 gtk_widget_show(block); | |
3077 | |
3078 /* I don't know if these should have borders. They look kind of dumb | |
3079 * with borders. */ | |
3080 gtk_button_set_relief(GTK_BUTTON(info), GTK_RELIEF_NONE); | |
3081 gtk_button_set_relief(GTK_BUTTON(add), GTK_RELIEF_NONE); | |
3082 gtk_button_set_relief(GTK_BUTTON(warn), GTK_RELIEF_NONE); | |
3083 gtk_button_set_relief(GTK_BUTTON(send), GTK_RELIEF_NONE); | |
3084 gtk_button_set_relief(GTK_BUTTON(block), GTK_RELIEF_NONE); | |
3085 | |
3086 gtk_size_group_add_widget(c->sg, info); | |
3087 gtk_size_group_add_widget(c->sg, add); | |
3088 gtk_size_group_add_widget(c->sg, warn); | |
3089 gtk_size_group_add_widget(c->sg, send); | |
3090 gtk_size_group_add_widget(c->sg, block); | |
3091 | |
3092 gtk_box_reorder_child(GTK_BOX(bbox), c->warn, 1); | |
3093 gtk_box_reorder_child(GTK_BOX(bbox), c->block, 2); | |
3094 gtk_box_reorder_child(GTK_BOX(bbox), c->add, 3); | |
3095 gtk_box_reorder_child(GTK_BOX(bbox), c->info, 4); | |
3951 | 3096 |
666
71ea550c22ac
[gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
661
diff
changeset
|
3097 |
1340 | 3098 update_buttons_by_protocol(c); |
3671 | 3099 |
3951 | 3100 gtk_widget_show(win); |
3101 | |
3102 if (!(im_options & OPT_IM_ONE_WINDOW) | |
4028 | 3103 || ((gtk_notebook_get_current_page(GTK_NOTEBOOK(convo_notebook)) == 0) |
3104 && (c == g_list_nth_data(conversations, 0)))) | |
3470 | 3105 gtk_widget_grab_focus(c->entry); |
66 | 3106 } |
3107 | |
3108 | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
3109 void toggle_spellchk() |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
3110 { |
3802 | 3111 #ifdef USE_GTKSPELL |
1117
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3112 GList *cnv = conversations; |
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3113 GSList *cht; |
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3114 struct conversation *c; |
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3115 GSList *con = connections; |
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3116 struct gaim_connection *gc; |
3802 | 3117 GtkSpell *spell; |
3118 | |
1117
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3119 while (cnv) { |
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3120 c = (struct conversation *)cnv->data; |
3802 | 3121 if (convo_options & OPT_CONVO_CHECK_SPELLING) { |
3122 gtkspell_new_attach(GTK_TEXT_VIEW(c->entry), NULL, NULL); | |
3123 } else { | |
3124 spell = gtkspell_get_from_text_view(GTK_TEXT_VIEW(c->entry)); | |
3125 gtkspell_detach(spell); | |
3126 } | |
1117
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3127 cnv = cnv->next; |
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3128 } |
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3129 |
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3130 while (con) { |
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3131 gc = (struct gaim_connection *)con->data; |
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3132 cht = gc->buddy_chats; |
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3133 while (cht) { |
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3134 c = (struct conversation *)cht->data; |
3802 | 3135 if (convo_options & OPT_CONVO_CHECK_SPELLING) { |
3136 gtkspell_new_attach(GTK_TEXT_VIEW(c->entry), NULL, NULL); | |
3137 } else { | |
3138 spell = gtkspell_get_from_text_view(GTK_TEXT_VIEW(c->entry)); | |
3139 gtkspell_detach(spell); | |
3140 } | |
1117
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3141 cht = cht->next; |
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3142 } |
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3143 con = con->next; |
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3144 } |
3802 | 3145 #endif |
1117
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3146 } |
1428
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3147 |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3148 void toggle_timestamps() |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3149 { |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3150 GList *cnv = conversations; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3151 GSList *cht; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3152 struct conversation *c; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3153 GSList *con = connections; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3154 struct gaim_connection *gc; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3155 |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3156 while (cnv) { |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3157 c = (struct conversation *)cnv->data; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
3158 if (convo_options & OPT_CONVO_SHOW_TIME) |
1428
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3159 gtk_imhtml_show_comments(GTK_IMHTML(c->text), TRUE); |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3160 else |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3161 gtk_imhtml_show_comments(GTK_IMHTML(c->text), FALSE); |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3162 cnv = cnv->next; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3163 } |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3164 |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3165 while (con) { |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3166 gc = (struct gaim_connection *)con->data; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3167 cht = gc->buddy_chats; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3168 while (cht) { |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3169 c = (struct conversation *)cht->data; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
3170 if (convo_options & OPT_CONVO_SHOW_TIME) |
1428
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3171 gtk_imhtml_show_comments(GTK_IMHTML(c->text), TRUE); |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3172 else |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3173 gtk_imhtml_show_comments(GTK_IMHTML(c->text), FALSE); |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3174 cht = cht->next; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3175 } |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3176 con = con->next; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3177 } |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3178 } |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3179 |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3180 void toggle_smileys() |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3181 { |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3182 GList *cnv = conversations; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3183 GSList *cht; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3184 struct conversation *c; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3185 GSList *con = connections; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3186 struct gaim_connection *gc; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3187 |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3188 while (cnv) { |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3189 c = (struct conversation *)cnv->data; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
3190 if (convo_options & OPT_CONVO_SHOW_SMILEY) |
1428
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3191 gtk_imhtml_show_smileys(GTK_IMHTML(c->text), TRUE); |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3192 else |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3193 gtk_imhtml_show_smileys(GTK_IMHTML(c->text), FALSE); |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3194 cnv = cnv->next; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3195 } |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3196 |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3197 while (con) { |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3198 gc = (struct gaim_connection *)con->data; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3199 cht = gc->buddy_chats; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3200 while (cht) { |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3201 c = (struct conversation *)cht->data; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
3202 if (convo_options & OPT_CONVO_SHOW_SMILEY) |
1428
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3203 gtk_imhtml_show_smileys(GTK_IMHTML(c->text), TRUE); |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3204 else |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3205 gtk_imhtml_show_smileys(GTK_IMHTML(c->text), FALSE); |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3206 cht = cht->next; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3207 } |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3208 con = con->next; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3209 } |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3210 } |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3211 |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3212 void im_tabize() |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3213 { |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3214 /* evil, evil i tell you! evil! */ |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
3215 if (im_options & OPT_IM_ONE_WINDOW) { |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3216 GList *x = conversations; |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3217 if ((convo_options & OPT_CONVO_COMBINE) && (chat_options & OPT_CHAT_ONE_WINDOW)) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3218 all_convos = all_chats; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3219 convo_notebook = chat_notebook; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3220 } |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3221 while (x) { |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3222 struct conversation *c = x->data; |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3223 GtkWidget *imhtml, *win; |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3224 |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3225 imhtml = c->text; |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3226 win = c->window; |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3227 remove_icon(c); |
2231
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3228 remove_checkbox(c); |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3229 show_conv(c); |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3230 gtk_widget_destroy(c->text); |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3231 gtk_widget_reparent(imhtml, c->sw); |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3232 c->text = imhtml; |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3233 gtk_widget_destroy(win); |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3234 update_icon(c); |
2231
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3235 update_checkbox(c); |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3236 set_convo_title(c); |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3237 |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3238 x = x->next; |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3239 } |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3240 } else { |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3241 GList *x, *m; |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3242 x = m = conversations; |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3243 conversations = NULL; |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3244 while (x) { |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3245 struct conversation *c = x->data; |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3246 GtkWidget *imhtml; |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3247 |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3248 imhtml = c->text; |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3249 remove_icon(c); |
2231
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3250 remove_checkbox(c); |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3251 show_conv(c); |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3252 gtk_container_remove(GTK_CONTAINER(c->sw), c->text); |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3253 gtk_widget_reparent(imhtml, c->sw); |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3254 c->text = imhtml; |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3255 update_icon(c); |
2231
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3256 update_checkbox(c); |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3257 set_convo_title(c); |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3258 |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3259 x = x->next; |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3260 } |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3261 conversations = m; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3262 if ((convo_options & OPT_CONVO_COMBINE) && (chat_options & OPT_CHAT_ONE_WINDOW)) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3263 if (chats) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3264 struct conversation *c; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3265 while (m) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3266 gtk_notebook_remove_page(GTK_NOTEBOOK(chat_notebook), 0); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3267 m = m->next; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3268 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3269 c = chats->data; |
3951 | 3270 gtk_widget_grab_focus(c->entry); |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3271 } else { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3272 if (all_convos) |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3273 gtk_widget_destroy(all_convos); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3274 all_chats = NULL; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3275 chat_notebook = NULL; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3276 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3277 } else if (all_convos) |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3278 gtk_widget_destroy(all_convos); |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3279 all_convos = NULL; |
1757
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
3280 convo_notebook = NULL; |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3281 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3282 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3283 |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3284 void convo_tabize() |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3285 { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3286 GList *x, *m; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3287 GtkWidget *tmp; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3288 |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3289 if (!chats && !conversations) |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3290 return; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3291 |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3292 if (convo_options & OPT_CONVO_COMBINE) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3293 if (!chats) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3294 all_chats = all_convos; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3295 chat_notebook = convo_notebook; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3296 return; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3297 } else if (!conversations) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3298 all_convos = all_chats; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3299 convo_notebook = chat_notebook; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3300 return; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3301 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3302 } else { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3303 if (!chats) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3304 all_chats = NULL; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3305 chat_notebook = NULL; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3306 return; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3307 } else if (!conversations) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3308 all_convos = NULL; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3309 convo_notebook = NULL; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3310 return; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3311 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3312 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3313 |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3314 tmp = all_convos; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3315 if (convo_options & OPT_CONVO_COMBINE) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3316 all_convos = all_chats; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3317 convo_notebook = chat_notebook; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3318 } else { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3319 all_convos = NULL; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3320 convo_notebook = NULL; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3321 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3322 x = m = conversations; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3323 while (x) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3324 struct conversation *c = x->data; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3325 GtkWidget *imhtml; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3326 |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3327 imhtml = c->text; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3328 remove_icon(c); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3329 remove_checkbox(c); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3330 show_conv(c); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3331 gtk_container_remove(GTK_CONTAINER(c->sw), c->text); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3332 gtk_widget_reparent(imhtml, c->sw); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3333 c->text = imhtml; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3334 update_icon(c); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3335 update_checkbox(c); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3336 |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3337 x = x->next; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3338 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3339 |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3340 conversations = m; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3341 if (convo_options & OPT_CONVO_COMBINE) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3342 if (tmp) |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3343 gtk_widget_destroy(tmp); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3344 } else { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3345 while (m) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3346 gtk_notebook_remove_page(GTK_NOTEBOOK(chat_notebook), 0); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3347 m = m->next; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3348 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3349 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3350 m = conversations; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3351 while (m) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3352 set_convo_title(m->data); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3353 m = m->next; |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3354 } |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3355 } |
1587
69a004b5820a
[gaim-migrate @ 1597]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1583
diff
changeset
|
3356 |
2787
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
3357 void set_convo_title(struct conversation *c) |
1587
69a004b5820a
[gaim-migrate @ 1597]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1583
diff
changeset
|
3358 { |
2787
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
3359 struct buddy *b; |
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
3360 char *text; |
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
3361 int index; |
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
3362 GtkNotebook *nb; |
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
3363 |
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
3364 if ((im_options & OPT_IM_ALIAS_TAB) && c->gc && ((b = find_buddy(c->gc, c->name)) != NULL)) |
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
3365 text = b->show; |
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
3366 else |
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
3367 text = c->name; |
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
3368 |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3369 if (im_options & OPT_IM_ONE_WINDOW) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3370 nb = GTK_NOTEBOOK(convo_notebook); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3371 index = g_list_index(conversations, c); |
3866 | 3372 gtk_label_set_text(GTK_LABEL(c->tab_label), text); |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3373 } else { |
2834
66b1112d948f
[gaim-migrate @ 2847]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2832
diff
changeset
|
3374 char buf[256]; |
3457 | 3375 if ((find_log_info(c->name)) || (c->is_chat && (logging_options & OPT_LOG_CHATS)) |
3376 || (!c->is_chat && (logging_options & OPT_LOG_CONVOS))) | |
2834
66b1112d948f
[gaim-migrate @ 2847]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2832
diff
changeset
|
3377 g_snprintf(buf, sizeof(buf), LOG_CONVERSATION_TITLE, text); |
66b1112d948f
[gaim-migrate @ 2847]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2832
diff
changeset
|
3378 else |
66b1112d948f
[gaim-migrate @ 2847]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2832
diff
changeset
|
3379 g_snprintf(buf, sizeof(buf), CONVERSATION_TITLE, text); |
66b1112d948f
[gaim-migrate @ 2847]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2832
diff
changeset
|
3380 gtk_window_set_title(GTK_WINDOW(c->window), buf); |
66b1112d948f
[gaim-migrate @ 2847]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2832
diff
changeset
|
3381 } |
2787
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
3382 } |
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
3383 |
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
3384 void set_convo_titles() |
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
3385 { |
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
3386 GList *c = conversations; |
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
3387 while (c) { |
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
3388 set_convo_title(c->data); |
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
3389 c = c->next; |
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
3390 } |
1587
69a004b5820a
[gaim-migrate @ 1597]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1583
diff
changeset
|
3391 } |
1590
b4e54a752676
[gaim-migrate @ 1600]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1587
diff
changeset
|
3392 |
b4e54a752676
[gaim-migrate @ 1600]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1587
diff
changeset
|
3393 void raise_convo_tab(struct conversation *c) |
b4e54a752676
[gaim-migrate @ 1600]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1587
diff
changeset
|
3394 { |
b4e54a752676
[gaim-migrate @ 1600]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1587
diff
changeset
|
3395 gtk_notebook_set_page(GTK_NOTEBOOK(convo_notebook), g_list_index(conversations, c)); |
1617
f30f719e5933
[gaim-migrate @ 1627]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1608
diff
changeset
|
3396 gdk_window_show(c->window->window); |
1590
b4e54a752676
[gaim-migrate @ 1600]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1587
diff
changeset
|
3397 } |
1757
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
3398 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
3399 void update_im_tabs() |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
3400 { |
1757
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
3401 if (!convo_notebook || !all_convos) |
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
3402 return; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
3403 if (im_options & OPT_IM_SIDE_TAB) { |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
3404 if (im_options & OPT_IM_BR_TAB) { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
3405 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(convo_notebook), GTK_POS_RIGHT); |
1757
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
3406 } else { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
3407 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(convo_notebook), GTK_POS_LEFT); |
1757
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
3408 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
3409 } else { |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
3410 if (im_options & OPT_IM_BR_TAB) { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
3411 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(convo_notebook), GTK_POS_BOTTOM); |
1757
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
3412 } else { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
3413 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(convo_notebook), GTK_POS_TOP); |
1757
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
3414 } |
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
3415 } |
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
3416 } |
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
3417 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
3418 void update_chat_tabs() |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
3419 { |
1757
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
3420 if (!chat_notebook || !all_chats) |
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
3421 return; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
3422 if (chat_options & OPT_CHAT_SIDE_TAB) { |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
3423 if (chat_options & OPT_CHAT_BR_TAB) { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
3424 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(chat_notebook), GTK_POS_RIGHT); |
1757
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
3425 } else { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
3426 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(chat_notebook), GTK_POS_LEFT); |
1757
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
3427 } |
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
3428 } else { |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
3429 if (chat_options & OPT_CHAT_BR_TAB) { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
3430 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(chat_notebook), GTK_POS_BOTTOM); |
1757
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
3431 } else { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
3432 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(chat_notebook), GTK_POS_TOP); |
1757
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
3433 } |
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
3434 } |
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
3435 } |
1759
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3436 |
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3437 void update_convo_color(gboolean fg) |
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3438 { |
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3439 GList *c = conversations; |
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3440 struct conversation *b; |
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3441 |
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3442 while (c) { |
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3443 b = c->data; |
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3444 c = c->next; |
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3445 if (fg) { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
3446 if (b->hasfg) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
3447 continue; |
1759
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3448 b->fgcol = fgcolor; |
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3449 } else { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
3450 if (b->hasbg) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
3451 continue; |
1759
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3452 b->bgcol = bgcolor; |
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3453 } |
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3454 } |
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3455 } |
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3456 |
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3457 void update_convo_font() |
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3458 { |
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3459 GList *c = conversations; |
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3460 struct conversation *b; |
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3461 |
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3462 while (c) { |
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3463 b = c->data; |
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3464 c = c->next; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
3465 if (b->hasfont) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
3466 continue; |
1759
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3467 sprintf(b->fontface, "%s", fontface); |
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3468 } |
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3469 } |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3470 |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3471 #include <gdk-pixbuf/gdk-pixbuf.h> |
2227
a93a6fe22330
[gaim-migrate @ 2237]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2213
diff
changeset
|
3472 |
a93a6fe22330
[gaim-migrate @ 2237]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2213
diff
changeset
|
3473 #define SCALE(x) ((gdk_pixbuf_animation_get_width(x) <= 48 && gdk_pixbuf_animation_get_height(x) <= 48) \ |
a93a6fe22330
[gaim-migrate @ 2237]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2213
diff
changeset
|
3474 ? 48 : 50) |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3475 |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3476 static gboolean redraw_icon(gpointer data) |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3477 { |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3478 struct conversation *c = data; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3479 |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3480 GdkPixbuf *buf; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3481 GdkPixbuf *scale; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3482 GdkPixmap *pm; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3483 GdkBitmap *bm; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3484 gint delay; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3485 |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3486 if (!g_list_find(conversations, c)) { |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3487 debug_printf("I think this is a bug.\n"); |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3488 return FALSE; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3489 } |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3490 |
3367 | 3491 gdk_pixbuf_animation_iter_advance(c->iter, NULL); |
3492 buf = gdk_pixbuf_animation_iter_get_pixbuf(c->iter); | |
3493 scale = gdk_pixbuf_scale_simple(buf, | |
3494 MAX(gdk_pixbuf_get_width(buf) * SCALE(c->anim) / | |
3495 gdk_pixbuf_animation_get_width(c->anim), 1), | |
3496 MAX(gdk_pixbuf_get_height(buf) * SCALE(c->anim) / | |
3497 gdk_pixbuf_animation_get_height(c->anim), 1), | |
3498 GDK_INTERP_NEAREST); | |
3499 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); | |
3500 gdk_pixbuf_unref(scale); | |
3501 gtk_pixmap_set(GTK_PIXMAP(c->icon), pm, bm); | |
3502 gdk_pixmap_unref(pm); | |
3380 | 3503 gtk_widget_queue_draw(c->icon); |
3367 | 3504 if (bm) |
3505 gdk_bitmap_unref(bm); | |
3380 | 3506 delay = gdk_pixbuf_animation_iter_get_delay_time(c->iter) / 10; |
3367 | 3507 |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3508 c->icon_timer = gtk_timeout_add(delay * 10, redraw_icon, c); |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3509 return FALSE; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3510 } |
2499
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3511 |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3512 static void stop_anim(GtkObject *obj, struct conversation *c) |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3513 { |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3514 if (c->icon_timer) |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3515 gtk_timeout_remove(c->icon_timer); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3516 c->icon_timer = 0; |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3517 } |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3518 |
2513
6e52448f352a
[gaim-migrate @ 2526]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2502
diff
changeset
|
3519 static void start_anim(GtkObject *obj, struct conversation *c) |
6e52448f352a
[gaim-migrate @ 2526]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2502
diff
changeset
|
3520 { |
6e52448f352a
[gaim-migrate @ 2526]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2502
diff
changeset
|
3521 int delay; |
3380 | 3522 delay = gdk_pixbuf_animation_iter_get_delay_time(c->iter) / 10; |
3097 | 3523 if (c->anim) |
3524 c->icon_timer = gtk_timeout_add(delay * 10, redraw_icon, c); | |
2513
6e52448f352a
[gaim-migrate @ 2526]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2502
diff
changeset
|
3525 } |
6e52448f352a
[gaim-migrate @ 2526]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2502
diff
changeset
|
3526 |
2499
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3527 static int des_save_icon(GtkObject *obj, GdkEvent *e, struct conversation *c) |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3528 { |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3529 gtk_widget_destroy(c->save_icon); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3530 c->save_icon = NULL; |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3531 return TRUE; |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3532 } |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3533 |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3534 static void do_save_icon(GtkObject *obj, struct conversation *c) |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3535 { |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3536 FILE *file; |
3466 | 3537 const char *f = gtk_file_selection_get_filename(GTK_FILE_SELECTION(c->save_icon)); |
2499
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3538 if (file_is_dir(f, c->save_icon)) |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3539 return; |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3540 |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3541 file = fopen(f, "w"); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3542 if (file) { |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3543 int len; |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3544 void *data = get_icon_data(c->gc, normalize(c->name), &len); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3545 if (data) |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3546 fwrite(data, 1, len, file); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3547 fclose(file); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3548 } else { |
3427 | 3549 do_error_dialog("Can't save icon file to disk", strerror(errno), GAIM_ERROR); |
2499
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3550 } |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3551 |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3552 gtk_widget_destroy(c->save_icon); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3553 c->save_icon = NULL; |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3554 } |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3555 |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3556 static void cancel_save_icon(GtkObject *obj, struct conversation *c) |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3557 { |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3558 gtk_widget_destroy(c->save_icon); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3559 c->save_icon = NULL; |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3560 } |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3561 |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3562 static void save_icon(GtkObject *obj, struct conversation *c) |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3563 { |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3564 char buf[BUF_LEN]; |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3565 |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3566 if (c->save_icon) { |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3567 gdk_window_raise(c->save_icon->window); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3568 return; |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3569 } |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3570 |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3571 c->save_icon = gtk_file_selection_new(_("Gaim - Save Icon")); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3572 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(c->save_icon)); |
3630 | 3573 g_snprintf(buf, BUF_LEN - 1, "%s" G_DIR_SEPARATOR_S "%s.icon", gaim_home_dir(), c->name); |
2499
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3574 gtk_file_selection_set_filename(GTK_FILE_SELECTION(c->save_icon), buf); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3575 gtk_signal_connect(GTK_OBJECT(c->save_icon), "delete_event", |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3576 GTK_SIGNAL_FUNC(des_save_icon), c); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3577 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(c->save_icon)->ok_button), "clicked", |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3578 GTK_SIGNAL_FUNC(do_save_icon), c); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3579 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(c->save_icon)->cancel_button), "clicked", |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3580 GTK_SIGNAL_FUNC(cancel_save_icon), c); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3581 |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3582 gtk_widget_show(c->save_icon); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3583 } |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3584 |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3585 static gboolean icon_menu(GtkObject *obj, GdkEventButton *e, struct conversation *c) |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3586 { |
3250 | 3587 static GtkWidget *menu = NULL; |
2499
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3588 GtkWidget *button; |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3589 |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3590 if (e->button != 3) |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3591 return FALSE; |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3592 if (e->type != GDK_BUTTON_PRESS) |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3593 return FALSE; |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3594 |
3250 | 3595 /* |
3596 * If a menu already exists, destroy it before creating a new one, | |
3597 * thus freeing-up the memory it occupied. | |
3598 */ | |
3599 if(menu) | |
3600 gtk_widget_destroy(menu); | |
3601 | |
2499
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3602 menu = gtk_menu_new(); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3603 |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3604 if (c->icon_timer) { |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3605 button = gtk_menu_item_new_with_label(_("Disable Animation")); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3606 gtk_signal_connect(GTK_OBJECT(button), "activate", GTK_SIGNAL_FUNC(stop_anim), c); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3607 gtk_menu_append(GTK_MENU(menu), button); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3608 gtk_widget_show(button); |
3367 | 3609 } |
3610 else if (c->anim && !(gdk_pixbuf_animation_is_static_image(c->anim))) | |
3611 { | |
2513
6e52448f352a
[gaim-migrate @ 2526]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2502
diff
changeset
|
3612 button = gtk_menu_item_new_with_label(_("Enable Animation")); |
6e52448f352a
[gaim-migrate @ 2526]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2502
diff
changeset
|
3613 gtk_signal_connect(GTK_OBJECT(button), "activate", GTK_SIGNAL_FUNC(start_anim), c); |
6e52448f352a
[gaim-migrate @ 2526]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2502
diff
changeset
|
3614 gtk_menu_append(GTK_MENU(menu), button); |
6e52448f352a
[gaim-migrate @ 2526]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2502
diff
changeset
|
3615 gtk_widget_show(button); |
2499
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3616 } |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3617 |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3618 button = gtk_menu_item_new_with_label(_("Hide Icon")); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3619 gtk_signal_connect_object(GTK_OBJECT(button), "activate", |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3620 GTK_SIGNAL_FUNC(remove_icon), (void *)c); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3621 gtk_menu_append(GTK_MENU(menu), button); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3622 gtk_widget_show(button); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3623 |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3624 button = gtk_menu_item_new_with_label(_("Save Icon As...")); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3625 gtk_signal_connect(GTK_OBJECT(button), "activate", GTK_SIGNAL_FUNC(save_icon), c); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3626 gtk_menu_append(GTK_MENU(menu), button); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3627 gtk_widget_show(button); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3628 |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3629 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, e->button, e->time); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3630 |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3631 return TRUE; |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3632 } |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3633 |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3634 void remove_icon(struct conversation *c) |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3635 { |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3636 if (c->icon) |
2895
63cdece2348d
[gaim-migrate @ 2908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2891
diff
changeset
|
3637 gtk_container_remove(GTK_CONTAINER(c->bbox), c->icon->parent->parent); |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3638 c->icon = NULL; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3639 if (c->anim) |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3640 gdk_pixbuf_animation_unref(c->anim); |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3641 c->anim = NULL; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3642 if (c->icon_timer) |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3643 gtk_timeout_remove(c->icon_timer); |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3644 c->icon_timer = 0; |
3374 | 3645 if(c->iter) |
3699 | 3646 g_object_unref(G_OBJECT(c->iter)); |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3647 } |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3648 |
3035 | 3649 void update_smilies(struct conversation *c) |
3650 { | |
3651 GSList *smilies; | |
3652 | |
3056 | 3653 if (!c) |
3654 return; | |
3655 | |
3656 if (!c->gc) | |
3657 return; | |
3658 | |
3035 | 3659 if (c->gc->prpl->smiley_list) { |
3050 | 3660 gtk_imhtml_remove_smileys(GTK_IMHTML(c->text)); |
3035 | 3661 smilies = c->gc->prpl->smiley_list(); |
3662 | |
3663 while (smilies) { | |
3664 struct _prpl_smiley *smile = | |
3665 (struct _prpl_smiley *)smilies->data; | |
3666 | |
4032 | 3667 //gtk_imhtml_associate_smiley(GTK_IMHTML(c->text), smile->key, smile->xpm); |
3035 | 3668 smilies = g_slist_next(smilies); |
3669 } | |
3050 | 3670 } else { |
3671 gtk_imhtml_reset_smileys(GTK_IMHTML(c->text)); | |
3035 | 3672 } |
3673 } | |
3674 | |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3675 void update_icon(struct conversation *c) |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3676 { |
2521
f42fceb6a9ea
[gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2513
diff
changeset
|
3677 char filename[256]; |
f42fceb6a9ea
[gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2513
diff
changeset
|
3678 FILE *file; |
3380 | 3679 GError *err = NULL; |
3466 | 3680 |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3681 void *data; |
3367 | 3682 int len, delay; |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3683 |
2521
f42fceb6a9ea
[gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2513
diff
changeset
|
3684 GdkPixbuf *buf; |
f42fceb6a9ea
[gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2513
diff
changeset
|
3685 |
2499
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3686 GtkWidget *event; |
2895
63cdece2348d
[gaim-migrate @ 2908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2891
diff
changeset
|
3687 GtkWidget *frame; |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3688 GdkPixbuf *scale; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3689 GdkPixmap *pm; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3690 GdkBitmap *bm; |
2264
2993b6091a53
[gaim-migrate @ 2274]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
3691 int sf = 0; |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3692 |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3693 if (!c) |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3694 return; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3695 |
2231
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3696 remove_icon(c); |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3697 |
2323
bde2481bb4db
[gaim-migrate @ 2333]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
3698 if (im_options & OPT_IM_HIDE_ICONS) |
bde2481bb4db
[gaim-migrate @ 2333]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
3699 return; |
bde2481bb4db
[gaim-migrate @ 2333]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
3700 |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3701 if (!c->gc) |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3702 return; |
2195
d615f7e2d8c4
[gaim-migrate @ 2205]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2191
diff
changeset
|
3703 |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3704 data = get_icon_data(c->gc, normalize(c->name), &len); |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3705 if (!data) |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3706 return; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3707 |
2521
f42fceb6a9ea
[gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2513
diff
changeset
|
3708 /* this is such an evil hack, i don't know why i'm even considering it. |
f42fceb6a9ea
[gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2513
diff
changeset
|
3709 * we'll do it differently when gdk-pixbuf-loader isn't leaky anymore. */ |
3630 | 3710 g_snprintf(filename, sizeof(filename), "%s" G_DIR_SEPARATOR_S "gaimicon-%s.%d", g_get_tmp_dir(), c->name, getpid()); |
2521
f42fceb6a9ea
[gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2513
diff
changeset
|
3711 file = fopen(filename, "w"); |
f42fceb6a9ea
[gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2513
diff
changeset
|
3712 if (!file) |
f42fceb6a9ea
[gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2513
diff
changeset
|
3713 return; |
f42fceb6a9ea
[gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2513
diff
changeset
|
3714 fwrite(data, 1, len, file); |
f42fceb6a9ea
[gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2513
diff
changeset
|
3715 fclose(file); |
f42fceb6a9ea
[gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2513
diff
changeset
|
3716 |
3367 | 3717 c->anim = gdk_pixbuf_animation_new_from_file(filename, &err); |
3380 | 3718 if (err) { |
3719 debug_printf("Buddy icon error: %s\n", err->message); | |
3720 g_error_free(err); | |
3721 } | |
2521
f42fceb6a9ea
[gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2513
diff
changeset
|
3722 /* make sure we remove the file as soon as possible */ |
f42fceb6a9ea
[gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2513
diff
changeset
|
3723 unlink(filename); |
f42fceb6a9ea
[gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2513
diff
changeset
|
3724 |
f42fceb6a9ea
[gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2513
diff
changeset
|
3725 if (!c->anim) |
f42fceb6a9ea
[gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2513
diff
changeset
|
3726 return; |
f42fceb6a9ea
[gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2513
diff
changeset
|
3727 |
3380 | 3728 if (gdk_pixbuf_animation_is_static_image(c->anim)) { |
3729 c->iter = NULL; | |
3730 delay = 0; | |
3731 buf = gdk_pixbuf_animation_get_static_image(c->anim); | |
3732 } else { | |
3367 | 3733 c->iter = gdk_pixbuf_animation_get_iter(c->anim, NULL); |
3734 buf = gdk_pixbuf_animation_iter_get_pixbuf(c->iter); | |
3380 | 3735 delay = gdk_pixbuf_animation_iter_get_delay_time(c->iter); |
3736 delay = delay / 10; | |
3737 } | |
3738 sf = SCALE(c->anim); | |
3367 | 3739 scale = gdk_pixbuf_scale_simple(buf, |
3740 MAX(gdk_pixbuf_get_width(buf) * sf / | |
3741 gdk_pixbuf_animation_get_width(c->anim), 1), | |
3742 MAX(gdk_pixbuf_get_height(buf) * sf / | |
3743 gdk_pixbuf_animation_get_height(c->anim), 1), | |
3744 GDK_INTERP_NEAREST); | |
3380 | 3745 |
3746 if (delay) | |
3747 c->icon_timer = gtk_timeout_add(delay * 10, redraw_icon, c); | |
3367 | 3748 |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3749 |
2936 | 3750 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3751 gdk_pixbuf_unref(scale); |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3752 |
2895
63cdece2348d
[gaim-migrate @ 2908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2891
diff
changeset
|
3753 frame = gtk_frame_new(NULL); |
2936 | 3754 gtk_frame_set_shadow_type(GTK_FRAME(frame), bm ? GTK_SHADOW_NONE : GTK_SHADOW_IN); |
2895
63cdece2348d
[gaim-migrate @ 2908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2891
diff
changeset
|
3755 gtk_box_pack_start(GTK_BOX(c->bbox), frame, FALSE, FALSE, 5); |
3671 | 3756 gtk_box_reorder_child(GTK_BOX(c->bbox), frame, 0); |
2895
63cdece2348d
[gaim-migrate @ 2908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2891
diff
changeset
|
3757 gtk_widget_show(frame); |
63cdece2348d
[gaim-migrate @ 2908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2891
diff
changeset
|
3758 |
2499
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3759 event = gtk_event_box_new(); |
2895
63cdece2348d
[gaim-migrate @ 2908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2891
diff
changeset
|
3760 gtk_container_add(GTK_CONTAINER(frame), event); |
2499
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3761 gtk_signal_connect(GTK_OBJECT(event), "button-press-event", GTK_SIGNAL_FUNC(icon_menu), c); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3762 gtk_widget_show(event); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3763 |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3764 c->icon = gtk_pixmap_new(pm, bm); |
2264
2993b6091a53
[gaim-migrate @ 2274]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
3765 gtk_widget_set_usize(c->icon, sf, sf); |
2499
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3766 gtk_container_add(GTK_CONTAINER(event), c->icon); |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3767 gtk_widget_show(c->icon); |
3012 | 3768 if(im_options & OPT_IM_NO_ANIMATION) |
3013 | 3769 stop_anim(NULL, c); |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3770 gdk_pixmap_unref(pm); |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3771 if (bm) |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3772 gdk_bitmap_unref(bm); |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3773 } |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3774 |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3775 void got_new_icon(struct gaim_connection *gc, char *who) |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3776 { |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3777 struct conversation *c = find_conversation(who); |
2245
31157c54fe6e
[gaim-migrate @ 2255]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2239
diff
changeset
|
3778 if (c && (c->gc == gc)) |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3779 update_icon(c); |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3780 } |
2231
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3781 |
2323
bde2481bb4db
[gaim-migrate @ 2333]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
3782 void set_hide_icons() |
bde2481bb4db
[gaim-migrate @ 2333]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
3783 { |
bde2481bb4db
[gaim-migrate @ 2333]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
3784 GList *c = conversations; |
bde2481bb4db
[gaim-migrate @ 2333]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
3785 while (c) { |
bde2481bb4db
[gaim-migrate @ 2333]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
3786 update_icon(c->data); |
bde2481bb4db
[gaim-migrate @ 2333]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
3787 c = c->next; |
bde2481bb4db
[gaim-migrate @ 2333]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
3788 } |
bde2481bb4db
[gaim-migrate @ 2333]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
3789 } |
bde2481bb4db
[gaim-migrate @ 2333]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
3790 |
3013 | 3791 void set_anim() |
3792 { | |
3793 GList *c = conversations; | |
3097 | 3794 if (im_options & OPT_IM_HIDE_ICONS) |
3795 return; | |
3013 | 3796 while (c) { |
3797 if(im_options & OPT_IM_NO_ANIMATION) | |
3798 stop_anim(NULL, c->data); | |
3799 else | |
3800 start_anim(NULL, c->data); | |
3801 c = c->next; | |
3802 } | |
3803 } | |
3804 | |
2231
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3805 static void remove_checkbox(struct conversation *c) |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3806 { |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3807 if (c->check) |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3808 gtk_container_remove(GTK_CONTAINER(c->lbox), c->check); |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3809 c->check = NULL; |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3810 } |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3811 |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3812 static void update_checkbox(struct conversation *c) |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3813 { |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3814 if (!c) |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3815 return; |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3816 |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3817 remove_checkbox(c); |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3818 |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3819 if (!c->gc) |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3820 return; |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3821 |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2699
diff
changeset
|
3822 if (!c->gc->checkbox) |
2231
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3823 return; |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3824 |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2699
diff
changeset
|
3825 c->check = gtk_check_button_new_with_label(c->gc->checkbox); |
2231
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3826 gtk_box_pack_start(GTK_BOX(c->lbox), c->check, FALSE, FALSE, 5); |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3827 gtk_widget_show(c->check); |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3828 } |