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