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