Mercurial > pidgin
annotate src/dialogs.c @ 4386:29b67b8de743
[gaim-migrate @ 4652]
Baby steps to the ICQ server aliases...
Baby steps to the door...
Baby steps turn the knob
Baby steps open the door...
Baby steps down the hallway...
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Wed, 22 Jan 2003 05:43:30 +0000 |
parents | 00f4fa7a93ff |
children | ce3a0eba91ef |
rev | line source |
---|---|
1 | 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:
338
diff
changeset
|
22 #ifdef HAVE_CONFIG_H |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
23 #include <config.h> |
349
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
24 #endif |
1 | 25 #include <string.h> |
26 #include <stdio.h> | |
27 #include <stdlib.h> | |
28 #include <sys/types.h> | |
29 #include <sys/stat.h> | |
30 #include <fcntl.h> | |
967
17ff662183b2
[gaim-migrate @ 977]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
31 #include <ctype.h> |
3630 | 32 |
33 #ifdef _WIN32 | |
34 #include <winsock.h> | |
35 #else | |
1 | 36 #include <sys/socket.h> |
3630 | 37 #include <time.h> |
1 | 38 #include <netdb.h> |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
39 #include <netinet/in.h> |
1 | 40 #include <unistd.h> |
41 #include <arpa/inet.h> | |
3630 | 42 #endif |
43 | |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
44 #include <errno.h> |
3048 | 45 #include <math.h> |
1 | 46 |
47 #include <gtk/gtk.h> | |
48 #include "gaim.h" | |
1428
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1399
diff
changeset
|
49 #include "gtkimhtml.h" |
1270
babea41afa7e
[gaim-migrate @ 1280]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1267
diff
changeset
|
50 #include "prpl.h" |
1 | 51 |
3630 | 52 #ifdef _WIN32 |
53 #include "win32dep.h" | |
54 #endif | |
55 | |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
56 #include "pixmaps/gnome_preferences.xpm" |
441 | 57 #include "pixmaps/cancel.xpm" |
58 #include "pixmaps/save.xpm" | |
443 | 59 #include "pixmaps/ok.xpm" |
459 | 60 #include "pixmaps/add.xpm" |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
61 #include "pixmaps/close.xpm" |
441 | 62 |
1035
80a47e3b1bca
[gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1032
diff
changeset
|
63 #define PATHSIZE 1024 |
80a47e3b1bca
[gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1032
diff
changeset
|
64 |
555 | 65 int smiley_array[FACE_TOTAL]; |
3035 | 66 char *current_smiley; |
728 | 67 GdkColor bgcolor; |
68 GdkColor fgcolor; | |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
69 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
70 static GtkWidget *imdialog = NULL; /*I only want ONE of these :) */ |
1 | 71 static GList *dialogwindows = NULL; |
2493
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
72 static GtkWidget *importdialog; |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
73 static struct gaim_connection *importgc; |
2344 | 74 static GtkWidget *icondlg; |
710
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
699
diff
changeset
|
75 static GtkWidget *aliasdlg = NULL; |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
699
diff
changeset
|
76 static GtkWidget *aliasentry = NULL; |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
699
diff
changeset
|
77 static GtkWidget *aliasname = NULL; |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
78 static GtkWidget *rename_dialog = NULL; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
79 static GtkWidget *rename_bud_dialog = NULL; |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
80 |
3649 | 81 |
2743 | 82 struct confirm_del { |
83 GtkWidget *window; | |
84 GtkWidget *label; | |
85 GtkWidget *ok; | |
86 GtkWidget *cancel; | |
87 char name[1024]; | |
88 struct gaim_connection *gc; | |
89 }; | |
90 | |
1 | 91 struct create_away { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
92 GtkWidget *window; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
93 GtkWidget *entry; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
94 GtkWidget *text; |
832
0142b4c66394
[gaim-migrate @ 842]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
825
diff
changeset
|
95 struct away_message *mess; |
1 | 96 }; |
97 | |
98 struct warning { | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
99 GtkWidget *window; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
100 GtkWidget *anon; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
101 char *who; |
976
2586b2a3725e
[gaim-migrate @ 986]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
967
diff
changeset
|
102 struct gaim_connection *gc; |
1 | 103 }; |
104 | |
105 struct addbuddy { | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
106 GtkWidget *window; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
107 GtkWidget *combo; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
108 GtkWidget *entry; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
109 GtkWidget *entry_for_alias; |
2527 | 110 GtkWidget *account; |
1072
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
111 struct gaim_connection *gc; |
1 | 112 }; |
113 | |
114 struct addperm { | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
115 GtkWidget *window; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
116 GtkWidget *entry; |
1072
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
117 struct gaim_connection *gc; |
1144
b1454d019277
[gaim-migrate @ 1154]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1141
diff
changeset
|
118 gboolean permit; |
1 | 119 }; |
120 | |
121 struct addbp { | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
122 GtkWidget *window; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
123 GtkWidget *nameentry; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
124 GtkWidget *messentry; |
1229
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1225
diff
changeset
|
125 GtkWidget *commentry; |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1225
diff
changeset
|
126 GtkWidget *command; |
1 | 127 GtkWidget *sendim; |
128 GtkWidget *openwindow; | |
2550 | 129 GtkWidget *popupnotify; |
1137 | 130 GtkWidget *p_signon; |
131 GtkWidget *p_unaway; | |
132 GtkWidget *p_unidle; | |
2993 | 133 GtkWidget *p_typing; |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1233
diff
changeset
|
134 GtkWidget *save; |
1137 | 135 GtkWidget *menu; |
1694 | 136 GtkWidget *sound; |
137 GtkWidget *soundentry; | |
1139 | 138 |
139 struct aim_user *user; | |
2986 | 140 struct buddy_pounce *buddy_pounce; |
1 | 141 }; |
142 | |
143 struct findbyemail { | |
144 GtkWidget *window; | |
145 GtkWidget *emailentry; | |
1535
1e2cc8c8bf3c
[gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
146 struct gaim_connection *gc; |
1 | 147 }; |
148 | |
149 struct findbyinfo { | |
2393
a7ecfd3f7714
[gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2382
diff
changeset
|
150 struct gaim_connection *gc; |
1 | 151 GtkWidget *window; |
152 GtkWidget *firstentry; | |
153 GtkWidget *middleentry; | |
154 GtkWidget *lastentry; | |
155 GtkWidget *maidenentry; | |
156 GtkWidget *cityentry; | |
157 GtkWidget *stateentry; | |
158 GtkWidget *countryentry; | |
159 }; | |
160 | |
161 struct info_dlg { | |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
162 struct gaim_connection *gc; |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
163 char *who; |
1 | 164 GtkWidget *window; |
165 GtkWidget *text; | |
166 }; | |
3197 | 167 |
168 struct getuserinfo { | |
169 GtkWidget *window; | |
170 GtkWidget *entry; | |
171 GtkWidget *account; | |
172 struct gaim_connection *gc; | |
173 }; | |
174 | |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
175 static GSList *info_dlgs = NULL; |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
176 |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
177 static struct info_dlg *find_info_dlg(struct gaim_connection *gc, char *who) |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
178 { |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
179 GSList *i = info_dlgs; |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
180 while (i) { |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
181 struct info_dlg *d = i->data; |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
182 i = i->next; |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
183 if (d->gc != gc) |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
184 continue; |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
185 if (d->who == NULL) |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
186 continue; |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
187 if (!who) |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
188 continue; |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
189 if (!g_strcasecmp(normalize(who), d->who)) |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
190 return d; |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
191 } |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
192 return NULL; |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
193 } |
1 | 194 |
195 struct set_info_dlg { | |
196 GtkWidget *window; | |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
197 GtkWidget *menu; |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
198 struct aim_user *user; |
1 | 199 GtkWidget *text; |
200 GtkWidget *save; | |
201 GtkWidget *cancel; | |
202 }; | |
203 | |
2344 | 204 struct set_icon_dlg { |
205 GtkWidget *window; | |
206 struct aim_user *user; | |
207 GtkWidget *ok; | |
208 GtkWidget *cancel; | |
209 GtkWidget *entry; | |
210 }; | |
211 | |
1 | 212 struct set_dir_dlg { |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
213 struct gaim_connection *gc; |
1 | 214 GtkWidget *window; |
215 GtkWidget *first; | |
216 GtkWidget *middle; | |
217 GtkWidget *last; | |
218 GtkWidget *maiden; | |
219 GtkWidget *city; | |
220 GtkWidget *state; | |
221 GtkWidget *country; | |
222 GtkWidget *web; | |
223 GtkWidget *cancel; | |
224 GtkWidget *save; | |
225 }; | |
226 | |
227 struct linkdlg { | |
228 GtkWidget *ok; | |
229 GtkWidget *cancel; | |
230 GtkWidget *window; | |
231 GtkWidget *url; | |
232 GtkWidget *text; | |
233 GtkWidget *toggle; | |
234 GtkWidget *entry; | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
235 struct gaim_conversation *c; |
1 | 236 }; |
237 | |
146 | 238 struct passwddlg { |
239 GtkWidget *window; | |
240 GtkWidget *ok; | |
241 GtkWidget *cancel; | |
242 GtkWidget *original; | |
243 GtkWidget *new1; | |
244 GtkWidget *new2; | |
978
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
245 struct gaim_connection *gc; |
146 | 246 }; |
1 | 247 |
2621
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
248 struct view_log { |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
249 long offset; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
250 int options; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
251 char *name; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
252 GtkWidget *bbox; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
253 GtkWidget *window; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
254 GtkWidget *layout; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
255 }; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
256 |
4119 | 257 /* Wrapper to get all the text from a GtkTextView */ |
258 gchar* gtk_text_view_get_text(GtkTextView *text, gboolean include_hidden_chars) | |
259 { | |
260 GtkTextBuffer *buffer; | |
261 GtkTextIter start, end; | |
262 | |
263 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)); | |
264 gtk_text_buffer_get_start_iter(buffer, &start); | |
265 gtk_text_buffer_get_end_iter(buffer, &end); | |
266 | |
267 return gtk_text_buffer_get_text(buffer, &start, &end, include_hidden_chars); | |
268 } | |
269 | |
1 | 270 /*------------------------------------------------------------------------*/ |
271 /* Destroys */ | |
272 /*------------------------------------------------------------------------*/ | |
273 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
274 static gint delete_event_dialog(GtkWidget *w, GdkEventAny *e, struct gaim_conversation *c) |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
275 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
276 struct gaim_gtk_conversation *gtkconv; |
605 | 277 gchar *object_data; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
278 |
605 | 279 object_data = gtk_object_get_user_data(GTK_OBJECT(w)); |
280 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
281 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
282 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
283 if (GTK_IS_COLOR_SELECTION_DIALOG(w)) { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
284 gaim_gtk_set_state_lock(TRUE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
285 if (w == gtkconv->dialogs.fg_color) { |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
286 gtk_toggle_button_set_state( |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
287 GTK_TOGGLE_BUTTON(gtkconv->toolbar.fgcolor), FALSE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
288 gtkconv->dialogs.fg_color = NULL; |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
289 } else { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
290 gtk_toggle_button_set_state( |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
291 GTK_TOGGLE_BUTTON(gtkconv->toolbar.bgcolor), FALSE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
292 gtkconv->dialogs.bg_color = NULL; |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
293 } |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
294 gaim_gtk_set_state_lock(FALSE); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
295 } else if (GTK_IS_FONT_SELECTION_DIALOG(w)) { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
296 gaim_gtk_set_state_lock(TRUE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
297 gtk_toggle_button_set_state( |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
298 GTK_TOGGLE_BUTTON(gtkconv->toolbar.normal_size), FALSE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
299 gaim_gtk_set_state_lock(FALSE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
300 gtkconv->dialogs.font = NULL; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
301 } else if (!g_strcasecmp(object_data, "smiley dialog")) { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
302 gaim_gtk_set_state_lock(TRUE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
303 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(gtkconv->toolbar.smiley), |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
304 FALSE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
305 gaim_gtk_set_state_lock(FALSE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
306 gtkconv->dialogs.smiley = NULL; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
307 } else if (!g_strcasecmp(object_data, "log dialog")) { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
308 gaim_gtk_set_state_lock(TRUE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
309 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkconv->toolbar.log), |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
310 FALSE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
311 gaim_gtk_set_state_lock(FALSE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
312 gtkconv->dialogs.log = NULL; |
608 | 313 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
314 |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
315 dialogwindows = g_list_remove(dialogwindows, w); |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
316 gtk_widget_destroy(w); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
317 |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
318 return FALSE; |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
319 } |
1 | 320 |
321 static void destroy_dialog(GtkWidget *w, GtkWidget *w2) | |
322 { | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
323 GtkWidget *dest; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
324 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
325 if (!GTK_IS_WIDGET(w2)) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
326 dest = w; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
327 else |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
328 dest = w2; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
329 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
330 if (dest == imdialog) |
1 | 331 imdialog = NULL; |
332 | |
2493
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
333 if (dest == importdialog) { |
1 | 334 importdialog = NULL; |
2493
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
335 importgc = NULL; |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
336 } |
1 | 337 |
2344 | 338 if (dest == icondlg) |
339 icondlg = NULL; | |
340 | |
710
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
699
diff
changeset
|
341 if (dest == aliasdlg) { |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
699
diff
changeset
|
342 aliasdlg = NULL; |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
699
diff
changeset
|
343 aliasentry = NULL; |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
699
diff
changeset
|
344 aliasname = NULL; |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
699
diff
changeset
|
345 } |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
699
diff
changeset
|
346 |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
347 if (dest == rename_dialog) |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
348 rename_dialog = NULL; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
349 |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
350 if (dest == rename_bud_dialog) |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
351 rename_bud_dialog = NULL; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
352 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
353 dialogwindows = g_list_remove(dialogwindows, dest); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
354 gtk_widget_destroy(dest); |
1 | 355 |
356 } | |
357 | |
358 | |
359 void destroy_all_dialogs() | |
360 { | |
2621
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
361 while (dialogwindows) |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
362 destroy_dialog(NULL, dialogwindows->data); |
1 | 363 |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
364 if (awaymessage) |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
365 do_im_back(NULL, NULL); |
84 | 366 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
367 if (imdialog) { |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
368 destroy_dialog(NULL, imdialog); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
369 imdialog = NULL; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
370 } |
935
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
934
diff
changeset
|
371 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
372 if (importdialog) { |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
373 destroy_dialog(NULL, importdialog); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
374 importdialog = NULL; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
375 } |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
376 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
377 if (icondlg) { |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
378 destroy_dialog(NULL, icondlg); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
379 icondlg = NULL; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
380 } |
1 | 381 } |
382 | |
3757 | 383 static void do_warn(GtkWidget *widget, gint resp, struct warning *w) |
1 | 384 { |
3757 | 385 if (resp == GTK_RESPONSE_OK) |
386 serv_warn(w->gc, w->who, (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w->anon))) ? 1 : 0); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
387 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
388 destroy_dialog(NULL, w->window); |
1288
d8eaf65ca9c3
[gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1272
diff
changeset
|
389 g_free(w); |
d8eaf65ca9c3
[gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1272
diff
changeset
|
390 } |
1 | 391 |
976
2586b2a3725e
[gaim-migrate @ 986]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
967
diff
changeset
|
392 void show_warn_dialog(struct gaim_connection *gc, char *who) |
1 | 393 { |
3757 | 394 char *filename = g_build_filename(DATADIR, "pixmaps", "gaim", "dialogs", "gaim_warning.png", NULL); |
395 char *labeltext; | |
396 GtkWidget *hbox, *vbox; | |
1 | 397 GtkWidget *label; |
3757 | 398 GtkWidget *img = gtk_image_new_from_file(filename); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
399 struct gaim_conversation *c = gaim_find_conversation(who); |
441 | 400 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
401 struct warning *w = g_new0(struct warning, 1); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
402 w->who = who; |
1288
d8eaf65ca9c3
[gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1272
diff
changeset
|
403 w->gc = gc; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
404 |
3757 | 405 g_free(filename); |
406 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
407 | |
408 w->window = gtk_dialog_new_with_buttons("", GTK_WINDOW(c->window), GTK_DIALOG_MODAL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, "_Warn", GTK_RESPONSE_OK, NULL); | |
4118 | 409 gtk_dialog_set_default_response (GTK_DIALOG(w->window), GTK_RESPONSE_OK); |
3757 | 410 g_signal_connect(G_OBJECT(w->window), "response", G_CALLBACK(do_warn), w); |
411 | |
412 gtk_container_set_border_width (GTK_CONTAINER(w->window), 6); | |
413 gtk_window_set_resizable(GTK_WINDOW(w->window), FALSE); | |
414 gtk_dialog_set_has_separator(GTK_DIALOG(w->window), FALSE); | |
415 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(w->window)->vbox), 12); | |
416 gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(w->window)->vbox), 6); | |
417 | |
418 hbox = gtk_hbox_new(FALSE, 12); | |
419 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(w->window)->vbox), hbox); | |
420 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
421 | |
422 vbox = gtk_vbox_new(FALSE, 0); | |
423 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
424 labeltext = g_strdup_printf(_("<span weight=\"bold\" size=\"larger\">Warn %s?</span>\n\n" | |
425 "This will increase %s's warning level and he or she will be subject to harsher rate limiting.\n"), who, who); | |
426 label = gtk_label_new(NULL); | |
427 gtk_label_set_markup(GTK_LABEL(label), labeltext); | |
428 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
429 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
430 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
431 g_free(labeltext); | |
432 | |
433 w->anon = gtk_check_button_new_with_mnemonic(_("Warn _anonymously?")); | |
434 gtk_box_pack_start(GTK_BOX(vbox), w->anon, FALSE, FALSE, 0); | |
435 | |
436 hbox = gtk_hbox_new(FALSE, 6); | |
437 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
438 img = gtk_image_new_from_stock(GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_MENU); | |
439 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
440 labeltext = _("<b>Anonymous warnings are less severe.</b>"); | |
441 /* labeltext = _("Anonymous warnings are less severe."); */ | |
442 label = gtk_label_new(NULL); | |
443 gtk_label_set_markup(GTK_LABEL(label), labeltext); | |
444 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
445 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
446 | |
1288
d8eaf65ca9c3
[gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1272
diff
changeset
|
447 dialogwindows = g_list_prepend(dialogwindows, w->window); |
3757 | 448 gtk_widget_show_all(w->window); |
1 | 449 } |
450 | |
3753 | 451 void do_remove_buddy(struct buddy *b) |
2743 | 452 { |
4349 | 453 struct group *g = find_group_by_buddy(b); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
454 struct gaim_conversation *c; |
2743 | 455 |
456 if (!b) | |
457 return; | |
458 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
459 g = find_group_by_buddy(b); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
460 |
4059 | 461 debug_printf(_("Removing '%s' from buddy list.\n"), b->name); |
4349 | 462 serv_remove_buddy(b->user->gc, b->name, g->name); |
463 remove_buddy(b); | |
464 gaim_blist_save(); | |
2743 | 465 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
466 c = gaim_find_conversation(b->name); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
467 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
468 if (c != NULL) |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
469 gaim_conversation_update(c, GAIM_CONV_UPDATE_REMOVE); |
2743 | 470 } |
471 | |
472 void show_confirm_del(struct gaim_connection *gc, gchar *name) | |
473 { | |
4349 | 474 struct buddy *bd = find_buddy(gc->user, name); |
3753 | 475 char *text; |
476 if (!bd) | |
477 return; | |
478 | |
4309 | 479 text = g_strdup_printf(_("You are about to remove %s from your buddy list. Do you want to continue?"), name); |
480 do_ask_dialog(_("Remove Buddy"), text, bd, _("Remove Buddy"), do_remove_buddy, _("Cancel"), NULL, NULL, FALSE); | |
3753 | 481 g_free(text); |
2743 | 482 } |
483 | |
484 | |
1 | 485 |
486 /*------------------------------------------------------------------------*/ | |
487 /* The dialog for getting an error */ | |
488 /*------------------------------------------------------------------------*/ | |
489 | |
3466 | 490 GtkWidget *do_error_dialog(const char *primary, const char *secondary, int type) |
1 | 491 { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
492 GtkWidget *d; |
1 | 493 GtkWidget *label; |
3374 | 494 GtkWidget *img = NULL; |
3427 | 495 GtkWidget *hbox; |
496 char labeltext[1024 * 2]; | |
497 char *filename = NULL; | |
498 | |
499 /* These are the GTK stock dialog icons with our little Gaim logo on top. | |
500 * Inspired by the GIMP. */ | |
3374 | 501 switch (type){ |
502 case GAIM_LOGO: | |
3427 | 503 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "gaim.png", NULL); |
504 break; | |
505 case GAIM_INFO: | |
506 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "dialogs", "gaim_info.png", NULL); | |
507 break; | |
3516 | 508 case GAIM_WARNING: |
3427 | 509 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "dialogs", "gaim_warning.png", NULL); |
510 break; | |
3516 | 511 case GAIM_ERROR: |
3427 | 512 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "dialogs", "gaim_error.png", NULL); |
513 break; | |
514 /* case GAIM_QUESTION: | |
515 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "dialogs", "gaim_question.png", NULL); | |
516 break; | |
517 */ | |
518 } | |
519 if (filename) { | |
520 img = gtk_image_new_from_file(filename); | |
3523 | 521 g_free(filename); |
3427 | 522 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); |
3374 | 523 } |
4272 | 524 d = gtk_dialog_new_with_buttons("", NULL, 0, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); |
3427 | 525 g_signal_connect(d, "response", G_CALLBACK(gtk_widget_destroy), NULL); |
526 | |
527 gtk_container_set_border_width (GTK_CONTAINER(d), 6); | |
528 gtk_window_set_resizable(GTK_WINDOW(d), FALSE); | |
529 gtk_dialog_set_has_separator(GTK_DIALOG(d), FALSE); | |
530 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(d)->vbox), 12); | |
531 gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(d)->vbox), 6); | |
532 | |
533 hbox = gtk_hbox_new(FALSE, 12); | |
534 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(d)->vbox), hbox); | |
535 if (filename) { | |
536 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
537 } | |
538 gtk_widget_show(img); | |
539 | |
540 g_snprintf(labeltext, sizeof(labeltext), "<span weight=\"bold\" size=\"larger\">%s</span>\n\n%s", primary, secondary ? secondary : ""); | |
541 | |
542 label = gtk_label_new(NULL); | |
543 gtk_label_set_markup(GTK_LABEL(label), labeltext); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
544 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); |
3427 | 545 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); |
1 | 546 gtk_widget_show(label); |
3427 | 547 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
548 | |
549 gtk_widget_show(hbox); | |
1 | 550 |
551 gtk_widget_show(d); | |
1817
b367beee6448
[gaim-migrate @ 1827]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
552 return d; |
1 | 553 } |
554 | |
555 | |
556 | |
3816 | 557 static void do_im(GtkWidget *widget, int resp, struct getuserinfo *info) |
1 | 558 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
559 const char *who; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
560 struct gaim_conversation *conv; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
561 |
3802 | 562 if (resp == GTK_RESPONSE_OK) { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
563 who = gtk_entry_get_text(GTK_ENTRY(info->entry)); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
564 |
3802 | 565 if (!g_strcasecmp(who, "")) { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
566 g_free(info); |
3802 | 567 return; |
568 } | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
569 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
570 conv = gaim_find_conversation(who); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
571 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
572 if (conv == NULL) |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
573 conv = gaim_conversation_new(GAIM_CONV_IM, who); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
574 else |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
575 gaim_window_raise(gaim_conversation_get_window(conv)); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
576 |
3816 | 577 if (info->gc) |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
578 gaim_conversation_set_user(conv, info->gc->user); |
1 | 579 } |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
580 |
3816 | 581 destroy_dialog(NULL, imdialog); |
582 imdialog = NULL; | |
4138 | 583 g_free(info); |
1 | 584 } |
585 | |
3802 | 586 static void do_info(GtkWidget *widget, int resp, struct getuserinfo *info) |
935
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
934
diff
changeset
|
587 { |
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
934
diff
changeset
|
588 char *who; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
589 |
3802 | 590 if (resp == GTK_RESPONSE_OK) { |
591 who = g_strdup(normalize(gtk_entry_get_text(GTK_ENTRY(info->entry)))); | |
592 | |
593 if (!g_strcasecmp(who, "")) { | |
594 g_free(who); | |
595 return; | |
596 } | |
597 | |
598 /* what do we want to do about this case? */ | |
599 if (info->gc) | |
600 serv_get_info(info->gc, who); | |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
601 g_free(who); |
935
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
934
diff
changeset
|
602 } |
3802 | 603 gtk_widget_destroy(GTK_WIDGET(widget)); |
4138 | 604 g_free(info); |
935
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
934
diff
changeset
|
605 } |
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
934
diff
changeset
|
606 |
1 | 607 void show_ee_dialog(int ee) |
608 { | |
3767 | 609 GtkWidget *window; |
610 GtkWidget *hbox; | |
1 | 611 GtkWidget *label; |
3767 | 612 |
613 char *filename = g_build_filename(DATADIR, "pixmaps", "gaim", "dialogs", "gaim_cool.png", NULL); | |
614 GtkWidget *img = gtk_image_new_from_file(filename); | |
615 | |
616 label = gtk_label_new(NULL); | |
1 | 617 if (ee == 0) |
3767 | 618 gtk_label_set_markup(GTK_LABEL(label), |
619 "<span weight=\"bold\" size=\"large\" foreground=\"purple\">Amazing! Simply Amazing!</span>"); | |
1 | 620 else if (ee == 1) |
3767 | 621 gtk_label_set_markup(GTK_LABEL(label), |
622 "<span weight=\"bold\" size=\"large\" foreground=\"#1f6bad\">Pimpin\' Penguin Style! *Waddle Waddle*</span>"); | |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
337
diff
changeset
|
623 else if (ee == 2) |
3767 | 624 gtk_label_set_markup(GTK_LABEL(label), |
625 "<span weight=\"bold\" size=\"large\" foreground=\"blue\">You should be me. I'm so cute!</span>"); | |
2472 | 626 else if (ee == 3) |
3767 | 627 gtk_label_set_markup(GTK_LABEL(label), |
628 "<span weight=\"bold\" size=\"large\" foreground=\"orange\">Now that's what I like!</span>"); | |
2993 | 629 else if (ee == 4) |
3767 | 630 gtk_label_set_markup(GTK_LABEL(label), |
631 "<span weight=\"bold\" size=\"large\" foreground=\"brown\">Ahh, and excellent choice!</span>"); | |
3043 | 632 else if (ee == 5) |
3767 | 633 gtk_label_set_markup(GTK_LABEL(label), |
634 "<span weight=\"bold\" size=\"large\" foreground=\"#009900\">Everytime you click my name, an angel gets its wings.</span>"); | |
3152 | 635 else if (ee == 6) |
3767 | 636 gtk_label_set_markup(GTK_LABEL(label), |
637 "<span weight=\"bold\" size=\"large\" foreground=\"red\">This sunflower seed taste like pizza.</span>"); | |
3508 | 638 else if (ee == 7) |
3767 | 639 gtk_label_set_markup(GTK_LABEL(label), |
640 "<span weight=\"bold\" size=\"large\" foreground=\"#6364B1\">Hey! I was in that tumbleweed!</span>"); | |
3508 | 641 else |
3767 | 642 gtk_label_set_markup(GTK_LABEL(label), |
643 "<span weight=\"bold\" size=\"large\" foreground=\"gray\">I'm not anything.</span>"); | |
644 | |
645 window = gtk_dialog_new_with_buttons("", GTK_WINDOW(blist), GTK_DIALOG_MODAL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); | |
646 gtk_dialog_set_default_response (GTK_DIALOG(window), GTK_RESPONSE_OK); | |
647 g_signal_connect(G_OBJECT(window), "response", G_CALLBACK(gtk_widget_destroy), NULL); | |
3152 | 648 |
3767 | 649 gtk_container_set_border_width (GTK_CONTAINER(window), 6); |
650 gtk_window_set_resizable(GTK_WINDOW(window), FALSE); | |
651 gtk_dialog_set_has_separator(GTK_DIALOG(window), FALSE); | |
652 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(window)->vbox), 12); | |
653 gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(window)->vbox), 6); | |
654 | |
655 hbox = gtk_hbox_new(FALSE, 12); | |
656 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(window)->vbox), hbox); | |
657 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
658 | |
659 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
660 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
661 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
662 | |
663 gtk_widget_show_all(window); | |
1 | 664 } |
665 | |
3816 | 666 void show_info_select_account(GtkObject *w, struct gaim_connection *gc) |
667 { | |
668 struct getuserinfo *info = gtk_object_get_user_data(w); | |
669 info->gc = gc; | |
670 } | |
671 | |
935
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
934
diff
changeset
|
672 void show_im_dialog() |
1 | 673 { |
3802 | 674 GtkWidget *hbox, *vbox; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
675 GtkWidget *label; |
3816 | 676 GtkWidget *table, *menu, *opt; |
677 GSList *g = connections; | |
678 struct gaim_connection *c; | |
679 char buf[256]; | |
3802 | 680 char *filename = g_build_filename(DATADIR, "pixmaps", "gaim", "dialogs", "gaim_question.png", NULL); |
681 GtkWidget *img = gtk_image_new_from_file(filename); | |
3816 | 682 struct getuserinfo *info = NULL; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
683 |
4138 | 684 g_free(filename); |
685 | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
686 if (!imdialog) { |
3816 | 687 info = g_new0(struct getuserinfo, 1); |
688 info->gc = connections->data; | |
4142 | 689 imdialog = gtk_dialog_new_with_buttons("Gaim - New Message", blist ? GTK_WINDOW(blist) : NULL, GTK_DIALOG_MODAL, |
3802 | 690 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); |
691 gtk_dialog_set_default_response (GTK_DIALOG(imdialog), GTK_RESPONSE_OK); | |
692 gtk_container_set_border_width (GTK_CONTAINER(imdialog), 6); | |
693 gtk_window_set_resizable(GTK_WINDOW(imdialog), FALSE); | |
694 gtk_dialog_set_has_separator(GTK_DIALOG(imdialog), FALSE); | |
695 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(imdialog)->vbox), 12); | |
696 gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(imdialog)->vbox), 6); | |
697 | |
698 hbox = gtk_hbox_new(FALSE, 12); | |
699 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(imdialog)->vbox), hbox); | |
700 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
701 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
702 | |
703 vbox = gtk_vbox_new(FALSE, 0); | |
704 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
705 | |
706 label = gtk_label_new(_("Please enter the screenname of the person you would like to IM.\n")); | |
3825 | 707 gtk_widget_set_size_request(GTK_WIDGET(label), 350, -1); |
3802 | 708 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); |
709 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
710 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
711 | |
712 hbox = gtk_hbox_new(FALSE, 6); | |
713 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
714 | |
3816 | 715 table = gtk_table_new(2, 2, FALSE); |
716 gtk_table_set_row_spacings(GTK_TABLE(table), 6); | |
717 gtk_table_set_col_spacings(GTK_TABLE(table), 6); | |
718 gtk_container_set_border_width(GTK_CONTAINER(table), 12); | |
719 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); | |
720 | |
3802 | 721 label = gtk_label_new(NULL); |
3816 | 722 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Screenname:")); |
3823 | 723 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); |
3816 | 724 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); |
725 | |
726 info->entry = gtk_entry_new(); | |
727 gtk_table_attach_defaults(GTK_TABLE(table), info->entry, 1, 2, 0, 1); | |
728 gtk_entry_set_activates_default (GTK_ENTRY(info->entry), TRUE); | |
729 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(info->entry)); | |
730 | |
731 if (connections->next) { | |
732 | |
733 label = gtk_label_new(NULL); | |
734 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); | |
735 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Account:")); | |
736 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
737 | |
738 info->account = gtk_option_menu_new(); | |
739 gtk_table_attach_defaults(GTK_TABLE(table), info->account, 1, 2, 1, 2); | |
740 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(info->account)); | |
741 | |
742 menu = gtk_menu_new(); | |
743 | |
744 while (g) { | |
745 c = (struct gaim_connection *)g->data; | |
746 if (!c->prpl->send_im) { | |
747 g = g->next; | |
748 continue; | |
749 } | |
750 g_snprintf(buf, sizeof(buf), "%s (%s)", c->username, c->prpl->name); | |
751 opt = gtk_menu_item_new_with_label(buf); | |
752 gtk_object_set_user_data(GTK_OBJECT(opt), info); | |
753 | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
754 g_signal_connect(GTK_OBJECT(opt), "activate", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
755 G_CALLBACK(show_info_select_account), c); |
3816 | 756 |
757 gtk_menu_append(GTK_MENU(menu), opt); | |
758 g = g->next; | |
759 } | |
760 | |
761 gtk_option_menu_set_menu(GTK_OPTION_MENU(info->account), menu); | |
762 } | |
3802 | 763 |
3816 | 764 g_signal_connect(G_OBJECT(imdialog), "response", G_CALLBACK(do_im), info); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
765 } |
3816 | 766 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
767 gtk_widget_show_all(imdialog); |
3816 | 768 if (info) |
769 gtk_widget_grab_focus(GTK_WIDGET(info->entry)); | |
3197 | 770 } |
771 | |
935
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
934
diff
changeset
|
772 void show_info_dialog() |
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
934
diff
changeset
|
773 { |
3802 | 774 GtkWidget *window, *hbox, *vbox; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
775 GtkWidget *label; |
3802 | 776 char *filename = g_build_filename(DATADIR, "pixmaps", "gaim", "dialogs", "gaim_question.png", NULL); |
777 GtkWidget *img = gtk_image_new_from_file(filename); | |
778 GtkWidget *table, *menu, *opt; | |
3197 | 779 GSList *g = connections; |
780 struct gaim_connection *c; | |
781 struct getuserinfo *info = g_new0(struct getuserinfo, 1); | |
3802 | 782 char buf[256]; |
783 | |
4138 | 784 g_free(filename); |
3197 | 785 info->gc = connections->data; |
786 | |
4142 | 787 window = gtk_dialog_new_with_buttons("Gaim - Get User Info", blist ? GTK_WINDOW(blist) : NULL, GTK_DIALOG_MODAL, |
3802 | 788 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); |
789 gtk_dialog_set_default_response (GTK_DIALOG(window), GTK_RESPONSE_OK); | |
790 gtk_container_set_border_width (GTK_CONTAINER(window), 6); | |
791 gtk_window_set_resizable(GTK_WINDOW(window), FALSE); | |
792 gtk_dialog_set_has_separator(GTK_DIALOG(window), FALSE); | |
793 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(window)->vbox), 12); | |
794 gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(window)->vbox), 6); | |
795 | |
796 hbox = gtk_hbox_new(FALSE, 12); | |
797 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(window)->vbox), hbox); | |
798 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
799 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
800 | |
801 vbox = gtk_vbox_new(FALSE, 0); | |
802 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
803 | |
804 label = gtk_label_new(_("Please enter the screenname of the person whose info you would like to view.\n")); | |
805 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
806 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
807 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
808 | |
3197 | 809 table = gtk_table_new(2, 2, FALSE); |
3802 | 810 gtk_table_set_row_spacings(GTK_TABLE(table), 6); |
811 gtk_table_set_col_spacings(GTK_TABLE(table), 6); | |
812 gtk_container_set_border_width(GTK_CONTAINER(table), 12); | |
813 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); | |
814 | |
815 label = gtk_label_new(NULL); | |
816 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Screenname:")); | |
3822 | 817 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); |
3197 | 818 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); |
819 | |
820 info->entry = gtk_entry_new(); | |
821 gtk_table_attach_defaults(GTK_TABLE(table), info->entry, 1, 2, 0, 1); | |
3802 | 822 gtk_entry_set_activates_default (GTK_ENTRY(info->entry), TRUE); |
823 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(info->entry)); | |
824 | |
3197 | 825 if (connections->next) { |
826 | |
3802 | 827 label = gtk_label_new(NULL); |
3197 | 828 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); |
3802 | 829 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Account:")); |
830 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
1225 | 831 |
3197 | 832 info->account = gtk_option_menu_new(); |
833 gtk_table_attach_defaults(GTK_TABLE(table), info->account, 1, 2, 1, 2); | |
3802 | 834 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(info->account)); |
835 | |
3197 | 836 menu = gtk_menu_new(); |
837 | |
838 while (g) { | |
839 c = (struct gaim_connection *)g->data; | |
3802 | 840 if (!c->prpl->get_info) { |
841 g = g->next; | |
842 continue; | |
843 } | |
3572 | 844 g_snprintf(buf, sizeof(buf), "%s (%s)", c->username, c->prpl->name); |
3197 | 845 opt = gtk_menu_item_new_with_label(buf); |
846 gtk_object_set_user_data(GTK_OBJECT(opt), info); | |
847 | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
848 g_signal_connect(GTK_OBJECT(opt), "activate", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
849 G_CALLBACK(show_info_select_account), c); |
3197 | 850 |
851 gtk_menu_append(GTK_MENU(menu), opt); | |
852 g = g->next; | |
853 } | |
3802 | 854 |
3197 | 855 gtk_option_menu_set_menu(GTK_OPTION_MENU(info->account), menu); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
856 } |
3197 | 857 |
3802 | 858 g_signal_connect(G_OBJECT(window), "response", G_CALLBACK(do_info), info); |
859 | |
860 | |
861 gtk_widget_show_all(window); | |
862 if (info->entry) | |
863 gtk_widget_grab_focus(GTK_WIDGET(info->entry)); | |
935
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
934
diff
changeset
|
864 } |
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
934
diff
changeset
|
865 |
1 | 866 |
867 /*------------------------------------------------------------------------*/ | |
868 /* The dialog for adding buddies */ | |
869 /*------------------------------------------------------------------------*/ | |
870 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
871 extern void add_callback(GtkWidget *, struct gaim_conversation *); |
654
ea811c6dd3e0
[gaim-migrate @ 664]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
653
diff
changeset
|
872 |
4180 | 873 void do_add_buddy(GtkWidget *w, int resp, struct addbuddy *a) |
1 | 874 { |
3466 | 875 const char *grp, *who, *whoalias; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
876 struct gaim_conversation *c; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
877 |
4180 | 878 if (resp == GTK_RESPONSE_OK) { |
879 | |
880 who = gtk_entry_get_text(GTK_ENTRY(a->entry)); | |
881 grp = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(a->combo)->entry)); | |
882 whoalias = gtk_entry_get_text(GTK_ENTRY(a->entry_for_alias)); | |
883 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
884 c = gaim_find_conversation(who); |
4180 | 885 |
4349 | 886 add_buddy(a->gc->user, grp, who, whoalias); |
4180 | 887 serv_add_buddy(a->gc, who); |
888 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
889 if (c != NULL) |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
890 gaim_conversation_update(c, GAIM_CONV_UPDATE_ADD); |
4180 | 891 |
4349 | 892 gaim_blist_save(); |
654
ea811c6dd3e0
[gaim-migrate @ 664]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
653
diff
changeset
|
893 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
894 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
895 destroy_dialog(NULL, a->window); |
1 | 896 } |
897 | |
3819 | 898 void do_add_group(GtkWidget *w, int resp, struct addbuddy *a) |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
899 { |
3466 | 900 const char *grp; |
4349 | 901 |
3819 | 902 if (resp == GTK_RESPONSE_OK) { |
903 grp = gtk_entry_get_text(GTK_ENTRY(a->entry)); | |
904 | |
905 if (!a->gc) | |
906 a->gc = connections->data; | |
907 | |
4349 | 908 add_group(grp); |
909 gaim_blist_save(); | |
3819 | 910 } |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
911 |
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
912 destroy_dialog(NULL, a->window); |
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
913 } |
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
914 |
1 | 915 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
916 static GList *groups_tree(struct gaim_connection *gc) |
1 | 917 { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
918 GList *tmp = NULL; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
919 char *tmp2; |
1 | 920 struct group *g; |
4349 | 921 GSList *grp = groups; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
922 |
1 | 923 if (!grp) { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
924 tmp2 = g_strdup(_("Buddies")); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
925 tmp = g_list_append(tmp, tmp2); |
1 | 926 } else { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
927 while (grp) { |
1 | 928 g = (struct group *)grp->data; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
929 tmp2 = g->name; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
930 tmp = g_list_append(tmp, tmp2); |
940 | 931 grp = g_slist_next(grp); |
1 | 932 } |
933 } | |
934 return tmp; | |
935 } | |
936 | |
825
9108277c95e9
[gaim-migrate @ 835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
804
diff
changeset
|
937 static void free_dialog(GtkWidget *w, struct addbuddy *a) |
9108277c95e9
[gaim-migrate @ 835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
804
diff
changeset
|
938 { |
9108277c95e9
[gaim-migrate @ 835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
804
diff
changeset
|
939 g_free(a); |
9108277c95e9
[gaim-migrate @ 835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
804
diff
changeset
|
940 } |
9108277c95e9
[gaim-migrate @ 835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
804
diff
changeset
|
941 |
1 | 942 |
1072
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
943 void show_add_group(struct gaim_connection *gc) |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
944 { |
3819 | 945 |
946 GtkWidget *hbox, *vbox; | |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
947 GtkWidget *label; |
3819 | 948 char *filename = g_build_filename(DATADIR, "pixmaps", "gaim", "dialogs", "gaim_question.png", NULL); |
949 GtkWidget *img = gtk_image_new_from_file(filename); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
950 struct addbuddy *a = g_new0(struct addbuddy, 1); |
4138 | 951 |
952 g_free(filename); | |
1072
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
953 a->gc = gc; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
954 |
4183 | 955 a->window = gtk_dialog_new_with_buttons(_("Gaim - Add Group"), GTK_WINDOW(blist), GTK_DIALOG_MODAL, |
3819 | 956 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_ADD, GTK_RESPONSE_OK, NULL); |
957 gtk_dialog_set_default_response (GTK_DIALOG(a->window), GTK_RESPONSE_OK); | |
958 gtk_container_set_border_width (GTK_CONTAINER(a->window), 6); | |
959 gtk_window_set_resizable(GTK_WINDOW(a->window), FALSE); | |
960 gtk_dialog_set_has_separator(GTK_DIALOG(a->window), FALSE); | |
961 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(a->window)->vbox), 12); | |
962 gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(a->window)->vbox), 6); | |
963 | |
964 hbox = gtk_hbox_new(FALSE, 12); | |
965 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(a->window)->vbox), hbox); | |
966 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
967 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
968 | |
969 vbox = gtk_vbox_new(FALSE, 0); | |
970 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
971 | |
972 label = gtk_label_new(_("Please enter the name of the group to be added.\n")); | |
973 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
974 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
975 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
976 | |
977 hbox = gtk_hbox_new(FALSE, 6); | |
978 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
979 | |
980 label = gtk_label_new(NULL); | |
981 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Group:")); | |
982 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
983 | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
984 a->entry = gtk_entry_new(); |
3819 | 985 gtk_entry_set_activates_default (GTK_ENTRY(a->entry), TRUE); |
986 gtk_box_pack_start(GTK_BOX(hbox), a->entry, FALSE, FALSE, 0); | |
987 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(a->entry)); | |
988 | |
989 g_signal_connect(G_OBJECT(a->window), "response", G_CALLBACK(do_add_group), a); | |
990 | |
991 gtk_widget_show_all(a->window); | |
992 gtk_widget_grab_focus(GTK_WIDGET(a->entry)); | |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
993 } |
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
994 |
2527 | 995 static void addbuddy_select_account(GtkObject *w, struct gaim_connection *gc) |
996 { | |
997 struct addbuddy *b = gtk_object_get_user_data(w); | |
998 | |
2561 | 999 /* Save our account */ |
2527 | 1000 b->gc = gc; |
2561 | 1001 |
1002 /* We also want to update our group list */ | |
2598
b2800bca74fe
[gaim-migrate @ 2611]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2582
diff
changeset
|
1003 gtk_combo_set_popdown_strings(GTK_COMBO(b->combo), groups_tree(gc)); |
2527 | 1004 } |
1005 | |
1006 static void create_online_user_names(struct addbuddy *b) | |
1007 { | |
1008 char buf[2048]; /* Never hurts to be safe ;-) */ | |
1009 GSList *g = connections; | |
1010 struct gaim_connection *c; | |
1011 GtkWidget *menu, *opt; | |
1012 int count = 0; | |
1013 int place = 0; | |
1014 | |
1015 menu = gtk_menu_new(); | |
1016 | |
1017 while (g) { | |
1018 c = (struct gaim_connection *)g->data; | |
1019 g_snprintf(buf, sizeof(buf), "%s (%s)", | |
3572 | 1020 c->username, c->prpl->name); |
2527 | 1021 opt = gtk_menu_item_new_with_label(buf); |
1022 gtk_object_set_user_data(GTK_OBJECT(opt), b); | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
1023 g_signal_connect(GTK_OBJECT(opt), "activate", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
1024 G_CALLBACK(addbuddy_select_account), |
2527 | 1025 c); |
1026 gtk_widget_show(opt); | |
1027 gtk_menu_append(GTK_MENU(menu), opt); | |
1028 | |
1029 /* Now check to see if it's our current menu */ | |
1030 if (c == b->gc) { | |
1031 place = count; | |
1032 gtk_menu_item_activate(GTK_MENU_ITEM(opt)); | |
1033 gtk_option_menu_set_history(GTK_OPTION_MENU(b->account), count); | |
1034 | |
1035 /* Do the cha cha cha */ | |
1036 } | |
1037 | |
1038 count++; | |
1039 | |
1040 g = g->next; | |
1041 } | |
1042 | |
1043 gtk_option_menu_remove_menu(GTK_OPTION_MENU(b->account)); | |
1044 gtk_option_menu_set_menu(GTK_OPTION_MENU(b->account), menu); | |
1045 gtk_option_menu_set_history(GTK_OPTION_MENU(b->account), place); | |
1046 | |
1047 gtk_widget_show(b->account); | |
1048 gtk_widget_show(b->account->parent); | |
1049 | |
1050 } | |
1051 | |
2582
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2572
diff
changeset
|
1052 void show_add_buddy(struct gaim_connection *gc, char *buddy, char *group, char *alias) |
1 | 1053 { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1054 GtkWidget *table; |
1 | 1055 GtkWidget *label; |
4180 | 1056 GtkWidget *hbox; |
1057 GtkWidget *vbox; | |
1058 | |
1059 char *filename = g_build_filename(DATADIR, "pixmaps", "gaim", "dialogs", "gaim_question.png", NULL); | |
1060 GtkWidget *img = gtk_image_new_from_file(filename); | |
236 | 1061 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1062 struct addbuddy *a = g_new0(struct addbuddy, 1); |
2598
b2800bca74fe
[gaim-migrate @ 2611]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2582
diff
changeset
|
1063 a->gc = gc ? gc : connections->data; |
1210 | 1064 |
4180 | 1065 g_free(filename); |
1066 | |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
1067 GAIM_DIALOG(a->window); |
4180 | 1068 a->window = gtk_dialog_new_with_buttons(_("Gaim - Add Buddy"), blist ? GTK_WINDOW(blist) : NULL, GTK_DIALOG_MODAL, |
1069 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_ADD, GTK_RESPONSE_OK, NULL); | |
1070 | |
1071 gtk_dialog_set_default_response(GTK_DIALOG(a->window), GTK_RESPONSE_OK); | |
1072 gtk_container_set_border_width(GTK_CONTAINER(a->window), 6); | |
1073 gtk_window_set_resizable(GTK_WINDOW(a->window), FALSE); | |
1074 gtk_dialog_set_has_separator(GTK_DIALOG(a->window), FALSE); | |
1075 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(a->window)->vbox), 12); | |
1076 gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(a->window)->vbox), 6); | |
4074 | 1077 gtk_window_set_role(GTK_WINDOW(a->window), "add_buddy"); |
4180 | 1078 |
1079 hbox = gtk_hbox_new(FALSE, 12); | |
1080 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(a->window)->vbox), hbox); | |
1081 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
1082 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
1083 | |
1084 vbox = gtk_vbox_new(FALSE, 0); | |
1085 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
1086 | |
1087 label = gtk_label_new(_("Please enter the screen name of the person you would like to add to your buddylist. You may optionally enter an alias, or nickname, for the buddy. The alias will be displayed in place of the screen name whenever possible.\n")); | |
1088 gtk_widget_set_size_request(GTK_WIDGET(label), 400, -1); | |
1089 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
1090 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
1091 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
1092 | |
1093 hbox = gtk_hbox_new(FALSE, 6); | |
1094 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
1095 | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
1096 g_signal_connect(GTK_OBJECT(a->window), "destroy", G_CALLBACK(destroy_dialog), a->window); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
1097 g_signal_connect(GTK_OBJECT(a->window), "destroy", G_CALLBACK(free_dialog), a); |
1151
428372cc1e39
[gaim-migrate @ 1161]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1144
diff
changeset
|
1098 dialogwindows = g_list_prepend(dialogwindows, a->window); |
428372cc1e39
[gaim-migrate @ 1161]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1144
diff
changeset
|
1099 |
2529 | 1100 table = gtk_table_new(4, 2, FALSE); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1101 gtk_table_set_row_spacings(GTK_TABLE(table), 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1102 gtk_table_set_col_spacings(GTK_TABLE(table), 5); |
4180 | 1103 gtk_container_set_border_width(GTK_CONTAINER(table), 0); |
1104 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); | |
1105 | |
1106 label = gtk_label_new(_("Screen Name")); | |
1107 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1108 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1109 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1110 a->entry = gtk_entry_new(); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1111 gtk_table_attach_defaults(GTK_TABLE(table), a->entry, 1, 2, 0, 1); |
3333 | 1112 gtk_widget_grab_focus(a->entry); |
4183 | 1113 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1114 if (buddy != NULL) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1115 gtk_entry_set_text(GTK_ENTRY(a->entry), buddy); |
4183 | 1116 |
1117 gtk_entry_set_activates_default (GTK_ENTRY(a->entry), TRUE); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1118 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1119 label = gtk_label_new(_("Alias")); |
4180 | 1120 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1121 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1122 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1123 a->entry_for_alias = gtk_entry_new(); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1124 gtk_table_attach_defaults(GTK_TABLE(table), a->entry_for_alias, 1, 2, 1, 2); |
2582
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2572
diff
changeset
|
1125 if (alias != NULL) |
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2572
diff
changeset
|
1126 gtk_entry_set_text(GTK_ENTRY(a->entry_for_alias), alias); |
4183 | 1127 gtk_entry_set_activates_default (GTK_ENTRY(a->entry_for_alias), TRUE); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1128 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1129 label = gtk_label_new(_("Group")); |
4180 | 1130 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1131 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 2, 3); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1132 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1133 a->combo = gtk_combo_new(); |
2598
b2800bca74fe
[gaim-migrate @ 2611]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2582
diff
changeset
|
1134 gtk_combo_set_popdown_strings(GTK_COMBO(a->combo), groups_tree(a->gc)); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1135 gtk_table_attach_defaults(GTK_TABLE(table), a->combo, 1, 2, 2, 3); |
1210 | 1136 |
2527 | 1137 /* Set up stuff for the account box */ |
1138 label = gtk_label_new(_("Add To")); | |
4180 | 1139 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
2527 | 1140 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 3, 4); |
1141 | |
1142 a->account = gtk_option_menu_new(); | |
1143 gtk_table_attach_defaults(GTK_TABLE(table), a->account, 1, 2, 3, 4); | |
1144 | |
1145 create_online_user_names(a); | |
1146 | |
1147 /* End of account box */ | |
1148 | |
4180 | 1149 g_signal_connect(G_OBJECT(a->window), "response", G_CALLBACK(do_add_buddy), a); |
1151
428372cc1e39
[gaim-migrate @ 1161]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1144
diff
changeset
|
1150 |
1210 | 1151 gtk_widget_show_all(a->window); |
4180 | 1152 |
2995 | 1153 if (group != NULL) |
1154 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(a->combo)->entry), group); | |
1 | 1155 } |
1156 | |
1157 | |
3367 | 1158 /*------------------------------------------------------------------------* |
1159 * Privacy Settings * | |
1160 *------------------------------------------------------------------------*/ | |
1161 static GtkWidget *deny_type = NULL; | |
1162 static GtkWidget *deny_conn_hbox = NULL; | |
1163 static GtkWidget *deny_opt_menu = NULL; | |
1164 static struct gaim_connection *current_deny_gc = NULL; | |
1165 static gboolean current_is_deny = FALSE; | |
1166 static GtkWidget *allow_list = NULL; | |
1167 static GtkWidget *block_list = NULL; | |
1168 | |
4177 | 1169 static GtkListStore *block_store = NULL; |
1170 static GtkListStore *allow_store = NULL; | |
1171 | |
3367 | 1172 static void set_deny_mode(GtkWidget *w, int data) |
1173 { | |
1174 if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) | |
1175 return; | |
1176 debug_printf("setting deny mode %d\n", data); | |
4349 | 1177 current_deny_gc->user->permdeny = data; |
3367 | 1178 serv_set_permit_deny(current_deny_gc); |
4349 | 1179 gaim_blist_save(); |
3367 | 1180 } |
1181 | |
4178 | 1182 static GtkWidget *deny_opt(char *label, int which, GtkWidget *set) |
3367 | 1183 { |
1184 GtkWidget *opt; | |
1185 | |
1186 if (!set) | |
1187 opt = gtk_radio_button_new_with_label(NULL, label); | |
1188 else | |
1189 opt = | |
1190 gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(set)), | |
1191 label); | |
4178 | 1192 |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
1193 g_signal_connect(GTK_OBJECT(opt), "toggled", G_CALLBACK(set_deny_mode), (void *)which); |
3367 | 1194 gtk_widget_show(opt); |
4349 | 1195 if (current_deny_gc->user->permdeny == which) |
3367 | 1196 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE); |
1197 | |
1198 return opt; | |
1199 } | |
1200 | |
1201 static void des_deny_opt(GtkWidget *d, gpointer e) | |
1202 { | |
1203 gtk_widget_destroy(d); | |
1204 current_deny_gc = NULL; | |
1205 deny_conn_hbox = NULL; | |
1206 deny_type = NULL; | |
1207 deny_opt_menu = NULL; | |
1208 current_is_deny = FALSE; | |
1209 allow_list = NULL; | |
4177 | 1210 allow_store = NULL; |
1211 | |
3367 | 1212 block_list = NULL; |
4177 | 1213 block_store = NULL; |
3367 | 1214 } |
1215 | |
1216 static void set_deny_type() | |
1217 { | |
1218 GSList *bg = gtk_radio_button_group(GTK_RADIO_BUTTON(deny_type)); | |
1219 | |
4349 | 1220 switch (current_deny_gc->user->permdeny) { |
3786 | 1221 case 5: |
1222 bg = bg->next->next; | |
1223 break; | |
3367 | 1224 case 4: |
1225 break; | |
1226 case 3: | |
3786 | 1227 bg = bg->next->next->next; |
3367 | 1228 break; |
1229 case 2: | |
1230 bg = bg->next; | |
1231 break; | |
1232 case 1: | |
3786 | 1233 bg = bg->next->next->next->next; |
3367 | 1234 break; |
1235 } | |
1236 | |
1237 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(bg->data), TRUE); | |
1238 } | |
1239 | |
1240 void build_allow_list() | |
1241 { | |
1242 GSList *p; | |
4177 | 1243 GtkListStore *ls; |
1244 GtkTreeIter iter; | |
3367 | 1245 |
1246 if (!current_is_deny) | |
1247 return; | |
1248 | |
4349 | 1249 p = current_deny_gc->user->permit; |
3367 | 1250 |
4177 | 1251 gtk_list_store_clear(GTK_LIST_STORE(allow_store)); |
3367 | 1252 |
1253 while (p) { | |
4177 | 1254 ls = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(allow_list))); |
1255 | |
1256 gtk_list_store_append(ls, &iter); | |
1257 gtk_list_store_set(ls, &iter, 0, p->data, -1); | |
1258 | |
3367 | 1259 p = p->next; |
1260 } | |
1261 } | |
1262 | |
4177 | 1263 |
3367 | 1264 void build_block_list() |
1265 { | |
1266 GSList *d; | |
4177 | 1267 GtkListStore *ls; |
1268 GtkTreeIter iter; | |
3367 | 1269 |
1270 if (!current_is_deny) | |
1271 return; | |
1272 | |
4349 | 1273 d = current_deny_gc->user->deny; |
3367 | 1274 |
4177 | 1275 gtk_list_store_clear(GTK_LIST_STORE(block_store)); |
3367 | 1276 |
1277 while (d) { | |
4177 | 1278 ls = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(block_list))); |
1279 | |
1280 gtk_list_store_append(ls, &iter); | |
1281 gtk_list_store_set(ls, &iter, 0, d->data, -1); | |
1282 | |
3367 | 1283 d = d->next; |
1284 } | |
1285 } | |
1286 | |
1287 static void deny_gc_opt(GtkWidget *opt, struct gaim_connection *gc) | |
1288 { | |
1289 current_deny_gc = gc; | |
1290 set_deny_type(); | |
1291 build_allow_list(); | |
1292 build_block_list(); | |
1293 } | |
1294 | |
1295 static void build_deny_menu() | |
1296 { | |
1297 GtkWidget *menu; | |
1298 GtkWidget *opt; | |
1299 GSList *c = connections; | |
1300 struct gaim_connection *gc; | |
1301 int count = 0; | |
1302 gboolean found = FALSE; | |
1303 char buf[2048]; | |
1304 | |
1305 if (g_slist_length(connections) == 1) { | |
1306 gtk_widget_hide(deny_conn_hbox); | |
1307 return; | |
1308 } else | |
1309 gtk_widget_show(deny_conn_hbox); | |
1310 | |
1311 menu = gtk_menu_new(); | |
1312 | |
1313 while (c) { | |
1314 gc = (struct gaim_connection *)c->data; | |
1315 c = c->next; | |
1316 if (!gc->prpl->set_permit_deny) | |
1317 continue; | |
3572 | 1318 g_snprintf(buf, sizeof buf, "%s (%s)", gc->username, gc->prpl->name); |
3367 | 1319 opt = gtk_menu_item_new_with_label(buf); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
1320 g_signal_connect(GTK_OBJECT(opt), "activate", G_CALLBACK(deny_gc_opt), gc); |
3367 | 1321 gtk_widget_show(opt); |
1322 gtk_menu_append(GTK_MENU(menu), opt); | |
1323 if (gc == current_deny_gc) | |
1324 found = TRUE; | |
1325 else if (!found) | |
1326 count++; | |
1327 } | |
1328 | |
1329 if (!found) { | |
1330 current_deny_gc = connections->data; | |
1331 count = 0; | |
1332 } | |
1333 | |
1334 gtk_option_menu_remove_menu(GTK_OPTION_MENU(deny_opt_menu)); | |
1335 gtk_option_menu_set_menu(GTK_OPTION_MENU(deny_opt_menu), menu); | |
1336 gtk_option_menu_set_history(GTK_OPTION_MENU(deny_opt_menu), count); | |
1337 | |
1338 gtk_widget_show(menu); | |
1339 gtk_widget_show(deny_opt_menu); | |
1340 } | |
1341 | |
1342 static void pref_deny_add(GtkWidget *button, gboolean permit) | |
1343 { | |
1344 show_add_perm(current_deny_gc, NULL, permit); | |
1345 } | |
1346 | |
4177 | 1347 |
1348 gchar *find_permdeny_by_name(GSList *l, char *who) { | |
1349 gchar *name; | |
1350 | |
1351 while (l) { | |
1352 name = (gchar *)l->data; | |
1353 if (!strcmp(name, who)) { | |
1354 return name; | |
1355 } | |
1356 | |
1357 l = l->next; | |
1358 } | |
1359 | |
1360 return NULL; | |
1361 } | |
1362 | |
3367 | 1363 static void pref_deny_rem(GtkWidget *button, gboolean permit) |
1364 { | |
4177 | 1365 gchar *who; |
1366 GtkTreeIter iter; | |
1367 GtkTreeModel *mod; | |
1368 GtkTreeSelection *sel; | |
1369 | |
1370 if (permit) { | |
1371 mod = gtk_tree_view_get_model(GTK_TREE_VIEW(allow_list)); | |
1372 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(allow_list)); | |
1373 } else { | |
1374 mod = gtk_tree_view_get_model(GTK_TREE_VIEW(block_list)); | |
1375 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(block_list)); | |
1376 } | |
1377 | |
1378 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) | |
1379 gtk_tree_model_get(GTK_TREE_MODEL(mod), &iter, 0, &who, -1); | |
1380 else { | |
1381 return; | |
1382 } | |
3367 | 1383 |
1384 if (permit && !allow_list) | |
1385 return; | |
4177 | 1386 |
3367 | 1387 if (!permit && !block_list) |
1388 return; | |
1389 | |
1390 if (permit) { | |
4349 | 1391 char *name = find_permdeny_by_name(current_deny_gc->user->permit, who); |
4177 | 1392 |
1393 if (name) { | |
4349 | 1394 gaim_privacy_permit_remove(current_deny_gc->user, name); |
4308 | 1395 serv_rem_permit(current_deny_gc, who); |
4177 | 1396 build_allow_list(); |
1397 } | |
3367 | 1398 } else { |
4349 | 1399 char *name = find_permdeny_by_name(current_deny_gc->user->deny, who); |
4177 | 1400 |
1401 if (name) { | |
4349 | 1402 gaim_privacy_deny_remove(current_deny_gc->user, name); |
4177 | 1403 serv_rem_deny(current_deny_gc, who); |
1404 build_block_list(); | |
1405 } | |
3367 | 1406 } |
1407 | |
4349 | 1408 gaim_blist_save(); |
3367 | 1409 } |
1410 | |
1411 GtkWidget *privacy_win; | |
1412 void update_privacy_connections() { /* This is a slightly better name */ | |
1413 gboolean needdeny = FALSE; | |
1414 GSList *c = connections; | |
1415 struct gaim_connection *gc = NULL; | |
1416 | |
1417 if (!privacy_win) | |
1418 return; | |
1419 | |
1420 while (c) { | |
1421 gc = c->data; | |
1422 if (gc->prpl->set_permit_deny) | |
1423 break; | |
1424 gc = NULL; | |
1425 c = c->next; | |
1426 } | |
1427 needdeny = (gc != NULL); | |
1428 | |
1429 | |
1430 if (needdeny) { | |
1431 gtk_widget_set_sensitive(privacy_win, TRUE); | |
1432 build_deny_menu(); | |
1433 build_allow_list(); | |
1434 build_block_list(); | |
1435 } else { | |
1436 gtk_widget_set_sensitive(privacy_win, FALSE); | |
1437 } | |
1438 } | |
1439 static void destroy_privacy() { | |
1440 current_deny_gc = NULL; | |
1441 privacy_win = NULL; | |
1442 } | |
1443 | |
4177 | 1444 void show_privacy_options() { |
1445 GtkWidget *pwin; | |
1446 GtkWidget *box; | |
1447 GtkWidget *hbox; | |
1448 GtkWidget *label; | |
1449 GtkWidget *sw; | |
1450 GtkWidget *bbox; | |
1451 GtkWidget *button; | |
1452 GtkWidget *sep; | |
1453 GtkWidget *close_button; | |
1454 GtkSizeGroup *sg1 = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); | |
1455 GtkSizeGroup *sg2 = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); | |
1456 GtkCellRenderer *rend; | |
1457 GtkTreeViewColumn *col; | |
4178 | 1458 GtkWidget *table; |
4177 | 1459 |
1460 current_deny_gc = connections->data; /* this is safe because this screen will only be | |
1461 available when there are connections */ | |
1462 current_is_deny = TRUE; | |
1463 | |
1464 privacy_win = pwin = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
4179 | 1465 gtk_window_set_policy(GTK_WINDOW(pwin), FALSE, FALSE, TRUE); |
4177 | 1466 gtk_window_set_role(GTK_WINDOW(pwin), "privacy"); |
1467 gtk_window_set_title(GTK_WINDOW(pwin), _("Gaim - Privacy")); | |
1468 g_signal_connect(GTK_OBJECT(pwin), "destroy", G_CALLBACK(destroy_privacy), NULL); | |
1469 gtk_widget_realize(pwin); | |
1470 | |
1471 gtk_widget_set_usize(pwin, 0, 400); | |
1472 | |
1473 box = gtk_vbox_new(FALSE, 5); | |
1474 gtk_container_set_border_width(GTK_CONTAINER(box), 5); | |
1475 gtk_container_add(GTK_CONTAINER(pwin), box); | |
1476 gtk_widget_show(box); | |
1477 | |
1478 label = gtk_label_new(_("Changes to privacy settings take effect immediately.")); | |
1479 gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 5); | |
1480 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
1481 gtk_widget_show(label); | |
1482 | |
1483 deny_conn_hbox = gtk_hbox_new(FALSE, 5); | |
1484 gtk_box_pack_start(GTK_BOX(box), deny_conn_hbox, FALSE, FALSE, 0); | |
1485 gtk_widget_show(deny_conn_hbox); | |
1486 | |
1487 label = gtk_label_new(_("Set privacy for:")); | |
1488 gtk_box_pack_start(GTK_BOX(deny_conn_hbox), label, FALSE, FALSE, 5); | |
1489 gtk_widget_show(label); | |
1490 | |
1491 deny_opt_menu = gtk_option_menu_new(); | |
1492 gtk_box_pack_start(GTK_BOX(deny_conn_hbox), deny_opt_menu, FALSE, FALSE, 5); | |
1493 g_signal_connect(GTK_OBJECT(deny_opt_menu), "destroy", G_CALLBACK(des_deny_opt), NULL); | |
1494 gtk_widget_show(deny_opt_menu); | |
1495 | |
1496 build_deny_menu(); | |
1497 | |
4178 | 1498 table = gtk_table_new(5, 2, FALSE); |
1499 gtk_box_pack_start(GTK_BOX(box), table, TRUE, TRUE, 0); | |
1500 gtk_table_set_row_spacings(GTK_TABLE(table), 7); | |
1501 gtk_table_set_col_spacings(GTK_TABLE(table), 5); | |
1502 gtk_widget_show(table); | |
1503 | |
1504 deny_type = deny_opt(_("Allow all users to contact me"), 1, NULL); | |
4177 | 1505 gtk_size_group_add_widget(sg1, deny_type); |
4178 | 1506 gtk_table_attach(GTK_TABLE(table), deny_type, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); |
1507 | |
1508 deny_type = deny_opt(_("Allow only users on my buddy list"), 5, deny_type); | |
4177 | 1509 gtk_size_group_add_widget(sg1, deny_type); |
4178 | 1510 gtk_table_attach(GTK_TABLE(table), deny_type, 0, 1, 1, 2, GTK_FILL, 0, 0, 0); |
1511 | |
1512 deny_type = deny_opt(_("Allow only the users below"), 3, deny_type); | |
4177 | 1513 gtk_size_group_add_widget(sg1, deny_type); |
4178 | 1514 gtk_table_attach(GTK_TABLE(table), deny_type, 0, 1, 2, 3, GTK_FILL, 0, 0, 0); |
4177 | 1515 |
1516 sw = gtk_scrolled_window_new(NULL, NULL); | |
1517 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); | |
4178 | 1518 gtk_table_attach(GTK_TABLE(table), sw, 0, 1, 3, 4, GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); |
4177 | 1519 gtk_widget_show(sw); |
1520 | |
1521 allow_store = gtk_list_store_new(1, G_TYPE_STRING); | |
1522 allow_list = gtk_tree_view_new_with_model(GTK_TREE_MODEL(allow_store)); | |
1523 | |
1524 rend = gtk_cell_renderer_text_new(); | |
1525 col = gtk_tree_view_column_new_with_attributes(NULL, rend, "text", 0, NULL); | |
1526 gtk_tree_view_column_set_clickable(GTK_TREE_VIEW_COLUMN(col), TRUE); | |
1527 gtk_tree_view_append_column(GTK_TREE_VIEW(allow_list), col); | |
1528 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(allow_list), FALSE); | |
1529 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw), allow_list); | |
1530 gtk_widget_show(allow_list); | |
1531 | |
1532 build_allow_list(); | |
1533 | |
4179 | 1534 bbox = gtk_hbox_new(TRUE, 0); |
4177 | 1535 gtk_widget_show(bbox); |
4178 | 1536 gtk_table_attach(GTK_TABLE(table), bbox, 0, 1, 4, 5, GTK_FILL, 0, 0, 0); |
4177 | 1537 |
1538 button = gtk_button_new_from_stock(GTK_STOCK_ADD); | |
1539 gtk_size_group_add_widget(sg2, button); | |
1540 gtk_widget_show(button); | |
1541 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(pref_deny_add), (void *)TRUE); | |
4179 | 1542 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
4177 | 1543 |
1544 button = gtk_button_new_from_stock(GTK_STOCK_REMOVE); | |
1545 gtk_size_group_add_widget(sg2, button); | |
1546 gtk_widget_show(button); | |
1547 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(pref_deny_rem), (void *)TRUE); | |
4179 | 1548 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
4177 | 1549 |
4178 | 1550 deny_type = deny_opt(_("Deny all users"), 2, deny_type); |
4177 | 1551 gtk_size_group_add_widget(sg1, deny_type); |
4178 | 1552 gtk_table_attach(GTK_TABLE(table), deny_type, 1, 2, 1, 2, GTK_FILL, 0, 0, 0); |
1553 | |
1554 deny_type = deny_opt(_("Block the users below"), 4, deny_type); | |
4177 | 1555 gtk_size_group_add_widget(sg1, deny_type); |
4178 | 1556 gtk_table_attach(GTK_TABLE(table), deny_type, 1, 2, 2, 3, GTK_FILL, 0, 0, 0); |
4177 | 1557 |
1558 sw = gtk_scrolled_window_new(NULL, NULL); | |
1559 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); | |
4178 | 1560 gtk_table_attach(GTK_TABLE(table), sw, 1, 2, 3, 4, GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); |
4177 | 1561 gtk_widget_show(sw); |
1562 | |
1563 block_store = gtk_list_store_new(1, G_TYPE_STRING); | |
1564 block_list = gtk_tree_view_new_with_model(GTK_TREE_MODEL(block_store)); | |
1565 | |
1566 rend = gtk_cell_renderer_text_new(); | |
1567 col = gtk_tree_view_column_new_with_attributes(NULL, rend, "text", 0, NULL); | |
1568 gtk_tree_view_column_set_clickable(GTK_TREE_VIEW_COLUMN(col), TRUE); | |
1569 gtk_tree_view_append_column(GTK_TREE_VIEW(block_list), col); | |
1570 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(block_list), FALSE); | |
1571 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw), block_list); | |
1572 gtk_widget_show(block_list); | |
1573 | |
1574 build_block_list(); | |
1575 | |
4179 | 1576 bbox = gtk_hbox_new(TRUE, 0); |
4178 | 1577 gtk_table_attach(GTK_TABLE(table), bbox, 1, 2, 4, 5, GTK_FILL, 0, 0, 0); |
4177 | 1578 gtk_widget_show(bbox); |
1579 | |
1580 button = gtk_button_new_from_stock(GTK_STOCK_ADD); | |
1581 gtk_size_group_add_widget(sg2, button); | |
1582 gtk_widget_show(button); | |
1583 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(pref_deny_add), FALSE); | |
4179 | 1584 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
4177 | 1585 |
1586 button = gtk_button_new_from_stock(GTK_STOCK_REMOVE); | |
1587 gtk_size_group_add_widget(sg2, button); | |
1588 gtk_widget_show(button); | |
1589 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(pref_deny_rem), FALSE); | |
4179 | 1590 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
4177 | 1591 |
1592 sep = gtk_hseparator_new(); | |
1593 gtk_box_pack_start(GTK_BOX(box), sep, FALSE, FALSE, 5); | |
1594 gtk_widget_show(sep); | |
1595 | |
4178 | 1596 hbox = gtk_hbox_new(FALSE, 0); |
1597 gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0); | |
4177 | 1598 gtk_widget_show(hbox); |
4178 | 1599 |
4177 | 1600 close_button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); |
1601 gtk_box_pack_end(GTK_BOX(hbox), close_button, FALSE, FALSE, 0); | |
1602 g_signal_connect_swapped(GTK_OBJECT(close_button), "clicked", G_CALLBACK(gtk_widget_destroy), pwin); | |
4178 | 1603 gtk_widget_show(close_button); |
4177 | 1604 |
1605 gtk_widget_show(pwin); | |
1606 | |
1607 } | |
1608 | |
1 | 1609 /*------------------------------------------------------------------------*/ |
1610 /* The dialog for new buddy pounces */ | |
1611 /*------------------------------------------------------------------------*/ | |
1612 | |
1613 | |
1614 void do_new_bp(GtkWidget *w, struct addbp *b) | |
1615 { | |
2986 | 1616 struct buddy_pounce *bp; |
1617 | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1618 if (strlen(gtk_entry_get_text(GTK_ENTRY(b->nameentry))) == 0) { |
3427 | 1619 do_error_dialog(_("Please enter a buddy to pounce."), NULL, GAIM_ERROR); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1620 return; |
1292 | 1621 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1622 |
2986 | 1623 if(!b->buddy_pounce) |
1624 bp = g_new0(struct buddy_pounce, 1); | |
1625 else | |
1626 bp = b->buddy_pounce; | |
1627 | |
1628 | |
26 | 1629 g_snprintf(bp->name, 80, "%s", gtk_entry_get_text(GTK_ENTRY(b->nameentry))); |
1630 g_snprintf(bp->message, 2048, "%s", gtk_entry_get_text(GTK_ENTRY(b->messentry))); | |
1229
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1225
diff
changeset
|
1631 g_snprintf(bp->command, 2048, "%s", gtk_entry_get_text(GTK_ENTRY(b->commentry))); |
1694 | 1632 g_snprintf(bp->sound, 2048, "%s", gtk_entry_get_text(GTK_ENTRY(b->soundentry))); |
1139 | 1633 g_snprintf(bp->pouncer, 80, "%s", b->user->username); |
26 | 1634 |
1155 | 1635 bp->protocol = b->user->protocol; |
1636 | |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1233
diff
changeset
|
1637 bp->options = 0; |
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1233
diff
changeset
|
1638 |
2550 | 1639 if (GTK_TOGGLE_BUTTON(b->popupnotify)->active) |
1640 bp->options |= OPT_POUNCE_NOTIFY; | |
1641 | |
1 | 1642 if (GTK_TOGGLE_BUTTON(b->openwindow)->active) |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1233
diff
changeset
|
1643 bp->options |= OPT_POUNCE_POPUP; |
1 | 1644 |
1645 if (GTK_TOGGLE_BUTTON(b->sendim)->active) | |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1233
diff
changeset
|
1646 bp->options |= OPT_POUNCE_SEND_IM; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1647 |
1229
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1225
diff
changeset
|
1648 if (GTK_TOGGLE_BUTTON(b->command)->active) |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1233
diff
changeset
|
1649 bp->options |= OPT_POUNCE_COMMAND; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1650 |
1694 | 1651 if (GTK_TOGGLE_BUTTON(b->sound)->active) |
1652 bp->options |= OPT_POUNCE_SOUND; | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1653 |
1137 | 1654 if (GTK_TOGGLE_BUTTON(b->p_signon)->active) |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1233
diff
changeset
|
1655 bp->options |= OPT_POUNCE_SIGNON; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1656 |
1137 | 1657 if (GTK_TOGGLE_BUTTON(b->p_unaway)->active) |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1233
diff
changeset
|
1658 bp->options |= OPT_POUNCE_UNAWAY; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1659 |
1137 | 1660 if (GTK_TOGGLE_BUTTON(b->p_unidle)->active) |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1233
diff
changeset
|
1661 bp->options |= OPT_POUNCE_UNIDLE; |
2993 | 1662 |
1663 if (GTK_TOGGLE_BUTTON(b->p_typing)->active) | |
1664 bp->options |= OPT_POUNCE_TYPING; | |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1233
diff
changeset
|
1665 |
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1233
diff
changeset
|
1666 if (GTK_TOGGLE_BUTTON(b->save)->active) |
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1233
diff
changeset
|
1667 bp->options |= OPT_POUNCE_SAVE; |
26 | 1668 |
2986 | 1669 if(!b->buddy_pounce) |
1670 buddy_pounces = g_list_append(buddy_pounces, bp); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1671 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1672 do_bp_menu(); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1673 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1674 destroy_dialog(NULL, b->window); |
1137 | 1675 |
786
ffb824f6cd24
[gaim-migrate @ 796]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
780
diff
changeset
|
1676 save_prefs(); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1677 g_free(b); |
1 | 1678 } |
1679 | |
1139 | 1680 static void pounce_choose(GtkWidget *opt, struct addbp *b) |
1681 { | |
1682 struct aim_user *u = gtk_object_get_user_data(GTK_OBJECT(opt)); | |
1683 b->user = u; | |
1684 } | |
1685 | |
2564 | 1686 static GtkWidget *pounce_user_menu(struct addbp *b, struct gaim_connection *gc) |
1137 | 1687 { |
1688 GtkWidget *optmenu; | |
1689 GtkWidget *menu; | |
1690 GtkWidget *opt; | |
2397
520257562955
[gaim-migrate @ 2410]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2393
diff
changeset
|
1691 GSList *u = aim_users; |
1137 | 1692 struct aim_user *a; |
3082 | 1693 struct prpl *p; |
2564 | 1694 int count = 0; |
1695 int place = 0; | |
3082 | 1696 char buf[2048]; |
1137 | 1697 |
3795 | 1698 |
1137 | 1699 optmenu = gtk_option_menu_new(); |
1700 | |
1701 menu = gtk_menu_new(); | |
1702 | |
1703 while (u) { | |
1704 a = (struct aim_user *)u->data; | |
3082 | 1705 p = (struct prpl *)find_prpl(a->protocol); |
3572 | 1706 g_snprintf(buf, sizeof buf, "%s (%s)", a->username, (p && p->name)?p->name:"Unknown"); |
3082 | 1707 opt = gtk_menu_item_new_with_label(buf); |
1137 | 1708 gtk_object_set_user_data(GTK_OBJECT(opt), a); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
1709 g_signal_connect(GTK_OBJECT(opt), "activate", G_CALLBACK(pounce_choose), b); |
1137 | 1710 gtk_menu_append(GTK_MENU(menu), opt); |
1711 gtk_widget_show(opt); | |
2564 | 1712 |
2598
b2800bca74fe
[gaim-migrate @ 2611]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2582
diff
changeset
|
1713 if (b->user == a) { |
2564 | 1714 gtk_menu_item_activate(GTK_MENU_ITEM(opt)); |
1715 place = count; | |
1716 } | |
1717 | |
1718 count++; | |
1719 | |
1137 | 1720 u = u->next; |
1721 } | |
1722 | |
1723 gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), menu); | |
2564 | 1724 gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), place); |
1137 | 1725 |
1726 b->menu = optmenu; | |
2550 | 1727 |
1728 return optmenu; | |
1137 | 1729 } |
1730 | |
1 | 1731 |
2986 | 1732 void show_new_bp(char *name, struct gaim_connection *gc, int idle, int away, struct buddy_pounce *edit_bp) |
1 | 1733 { |
1734 GtkWidget *label; | |
1735 GtkWidget *bbox; | |
1736 GtkWidget *vbox; | |
443 | 1737 GtkWidget *button; |
2550 | 1738 GtkWidget *frame; |
1739 GtkWidget *table; | |
1740 GtkWidget *optmenu; | |
3795 | 1741 GtkWidget *sep; |
1742 GtkSizeGroup *sg; | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1743 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1744 struct addbp *b = g_new0(struct addbp, 1); |
2986 | 1745 |
1746 if(edit_bp) { | |
1747 b->buddy_pounce = edit_bp; | |
1748 b->user = find_user(edit_bp->pouncer, edit_bp->protocol); | |
1749 } else { | |
1750 b->user = gc ? gc->user : aim_users->data; | |
1751 b->buddy_pounce = NULL; | |
1752 } | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1753 |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
1754 GAIM_DIALOG(b->window); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1755 dialogwindows = g_list_prepend(dialogwindows, b->window); |
1185 | 1756 gtk_window_set_policy(GTK_WINDOW(b->window), FALSE, TRUE, TRUE); |
4074 | 1757 gtk_window_set_role(GTK_WINDOW(b->window), "new_bp"); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1758 gtk_window_set_title(GTK_WINDOW(b->window), _("Gaim - New Buddy Pounce")); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
1759 g_signal_connect(GTK_OBJECT(b->window), "destroy", G_CALLBACK(destroy_dialog), b->window); |
1141
8f4ce8b74901
[gaim-migrate @ 1151]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1140
diff
changeset
|
1760 gtk_widget_realize(b->window); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1761 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1762 vbox = gtk_vbox_new(FALSE, 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1763 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1764 gtk_container_add(GTK_CONTAINER(b->window), vbox); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1765 gtk_widget_show(vbox); |
1229
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1225
diff
changeset
|
1766 |
2550 | 1767 /* <pounce type="who"> */ |
1768 frame = gtk_frame_new(_("Pounce Who")); | |
1769 gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); | |
1770 gtk_widget_show(GTK_WIDGET(frame)); | |
1771 | |
1772 table = gtk_table_new(2, 2, FALSE); | |
1773 gtk_container_add(GTK_CONTAINER(frame), table); | |
1774 gtk_container_set_border_width(GTK_CONTAINER(table), 5); | |
1775 gtk_table_set_col_spacings(GTK_TABLE(table), 5); | |
1776 gtk_table_set_row_spacings(GTK_TABLE(table), 5); | |
1777 gtk_widget_show(table); | |
1778 | |
1779 label = gtk_label_new(_("Account")); | |
1780 gtk_misc_set_alignment(GTK_MISC(label), 0, .5); | |
1781 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); | |
1782 gtk_widget_show(label); | |
1783 | |
2564 | 1784 optmenu = pounce_user_menu(b, gc); |
2550 | 1785 gtk_table_attach(GTK_TABLE(table), optmenu, 1, 2, 0, 1, GTK_FILL | GTK_EXPAND, 0, 0, 0); |
1786 gtk_widget_show(optmenu); | |
1787 | |
1788 label = gtk_label_new(_("Buddy")); | |
1789 gtk_misc_set_alignment(GTK_MISC(label), 0, .5); | |
1790 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1791 gtk_widget_show(label); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1792 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1793 b->nameentry = gtk_entry_new(); |
2550 | 1794 gtk_table_attach(GTK_TABLE(table), b->nameentry, 1, 2, 1, 2, GTK_FILL | GTK_EXPAND, 0, 0, 0); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1795 if (name !=NULL) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1796 gtk_entry_set_text(GTK_ENTRY(b->nameentry), name); |
2986 | 1797 else if(edit_bp) |
1798 gtk_entry_set_text(GTK_ENTRY(b->nameentry), edit_bp->name); | |
1229
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1225
diff
changeset
|
1799 gtk_window_set_focus(GTK_WINDOW(b->window), b->nameentry); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1800 gtk_widget_show(b->nameentry); |
2550 | 1801 /* </pounce type="who"> */ |
1802 | |
1803 | |
1804 /* <pounce type="when"> */ | |
1805 frame = gtk_frame_new(_("Pounce When")); | |
1806 gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); | |
1807 gtk_widget_show(GTK_WIDGET(frame)); | |
1808 | |
1809 table = gtk_table_new(2, 2, FALSE); | |
1810 gtk_container_add(GTK_CONTAINER(frame), table); | |
1811 gtk_container_set_border_width(GTK_CONTAINER(table), 5); | |
1812 gtk_table_set_col_spacings(GTK_TABLE(table), 5); | |
1813 gtk_widget_show(table); | |
1814 | |
1229
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1225
diff
changeset
|
1815 b->p_signon = gtk_check_button_new_with_label(_("Pounce on sign on")); |
2986 | 1816 if(edit_bp) |
1817 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->p_signon), | |
1818 (edit_bp->options & OPT_POUNCE_SIGNON) ? TRUE : FALSE); | |
1819 else | |
1820 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->p_signon), TRUE); | |
2550 | 1821 gtk_table_attach(GTK_TABLE(table), b->p_signon, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); |
1229
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1225
diff
changeset
|
1822 gtk_widget_show(b->p_signon); |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1225
diff
changeset
|
1823 |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1225
diff
changeset
|
1824 b->p_unaway = gtk_check_button_new_with_label(_("Pounce on return from away")); |
2564 | 1825 if (away) |
1826 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->p_unaway), TRUE); | |
2986 | 1827 else if(edit_bp) |
1828 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->p_unaway), | |
1829 (edit_bp->options & OPT_POUNCE_UNAWAY) ? TRUE : FALSE); | |
2550 | 1830 gtk_table_attach(GTK_TABLE(table), b->p_unaway, 1, 2, 0, 1, GTK_FILL | GTK_EXPAND, 0, 0, 0); |
1229
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1225
diff
changeset
|
1831 gtk_widget_show(b->p_unaway); |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1225
diff
changeset
|
1832 |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1225
diff
changeset
|
1833 b->p_unidle = gtk_check_button_new_with_label(_("Pounce on return from idle")); |
2564 | 1834 if (idle) |
1835 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->p_unidle), TRUE); | |
2986 | 1836 else if(edit_bp) |
1837 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->p_unidle), | |
1838 (edit_bp->options & OPT_POUNCE_UNIDLE) ? TRUE : FALSE); | |
2550 | 1839 gtk_table_attach(GTK_TABLE(table), b->p_unidle, 0, 1, 1, 2, GTK_FILL, 0, 0, 0); |
1229
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1225
diff
changeset
|
1840 gtk_widget_show(b->p_unidle); |
2993 | 1841 |
1842 b->p_typing = gtk_check_button_new_with_label(_("Pounce when buddy is typing to you")); | |
2996 | 1843 if (edit_bp) |
1844 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->p_typing), | |
1845 (edit_bp->options & OPT_POUNCE_TYPING) ? TRUE : FALSE); | |
2993 | 1846 gtk_table_attach(GTK_TABLE(table), b->p_typing,1,2,1,2, GTK_FILL | GTK_EXPAND, 0, 0, 0); |
1847 gtk_widget_show(b->p_typing); | |
1848 | |
2550 | 1849 /* </pounce type="when"> */ |
1850 | |
1851 /* <pounce type="action"> */ | |
1852 frame = gtk_frame_new(_("Pounce Action")); | |
1853 gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); | |
1854 gtk_widget_show(GTK_WIDGET(frame)); | |
1855 | |
1856 table = gtk_table_new(4, 2, FALSE); | |
1857 gtk_container_add(GTK_CONTAINER(frame), table); | |
1858 gtk_container_set_border_width(GTK_CONTAINER(table), 5); | |
1859 gtk_table_set_col_spacings(GTK_TABLE(table), 5); | |
1860 gtk_table_set_row_spacings(GTK_TABLE(table), 5); | |
1861 gtk_widget_show(table); | |
1862 | |
1863 b->openwindow = gtk_check_button_new_with_label(_("Open IM Window")); | |
2986 | 1864 if(edit_bp) |
1865 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->openwindow), | |
1866 (edit_bp->options & OPT_POUNCE_POPUP) ? TRUE : FALSE); | |
1867 else | |
1868 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->openwindow), FALSE); | |
2550 | 1869 gtk_table_attach(GTK_TABLE(table), b->openwindow, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); |
1229
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1225
diff
changeset
|
1870 gtk_widget_show(b->openwindow); |
2986 | 1871 |
2550 | 1872 b->popupnotify = gtk_check_button_new_with_label(_("Popup Notification")); |
2986 | 1873 if(edit_bp) |
1874 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->popupnotify), | |
1875 (edit_bp->options & OPT_POUNCE_NOTIFY) ? TRUE : FALSE); | |
1876 else | |
1877 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->popupnotify), FALSE); | |
2550 | 1878 gtk_table_attach(GTK_TABLE(table), b->popupnotify, 1, 2, 0, 1, GTK_FILL, 0, 0, 0); |
1879 gtk_widget_show(b->popupnotify); | |
1880 | |
1881 b->sendim = gtk_check_button_new_with_label(_("Send Message")); | |
2986 | 1882 if(edit_bp) |
1883 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->sendim), | |
1884 (edit_bp->options & OPT_POUNCE_SEND_IM) ? TRUE : FALSE); | |
1885 else | |
1886 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->sendim), TRUE); | |
2550 | 1887 gtk_table_attach(GTK_TABLE(table), b->sendim, 0, 1, 1, 2, GTK_FILL, 0, 0, 0); |
1229
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1225
diff
changeset
|
1888 gtk_widget_show(b->sendim); |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1225
diff
changeset
|
1889 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1890 b->messentry = gtk_entry_new(); |
2550 | 1891 gtk_table_attach(GTK_TABLE(table), b->messentry, 1, 2, 1, 2, GTK_FILL | GTK_EXPAND, 0, 0, 0); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
1892 g_signal_connect(GTK_OBJECT(b->messentry), "activate", G_CALLBACK(do_new_bp), b); |
2986 | 1893 if(edit_bp) { |
1894 gtk_widget_set_sensitive(GTK_WIDGET(b->messentry), | |
1895 (edit_bp->options & OPT_POUNCE_SEND_IM) ? TRUE : FALSE); | |
1896 gtk_entry_set_text(GTK_ENTRY(b->messentry), edit_bp->message); | |
1897 } | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1898 gtk_widget_show(b->messentry); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1899 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
1900 g_signal_connect(GTK_OBJECT(b->sendim), "clicked", |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
1901 G_CALLBACK(gaim_gtk_toggle_sensitive), b->messentry); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1902 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1903 b->command = gtk_check_button_new_with_label(_("Execute command on pounce")); |
2550 | 1904 gtk_table_attach(GTK_TABLE(table), b->command, 0, 1, 2, 3, GTK_FILL, 0, 0, 0); |
2986 | 1905 if(edit_bp) |
1906 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->command), | |
1907 (edit_bp->options & OPT_POUNCE_COMMAND) ? TRUE : FALSE); | |
1908 else | |
1909 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->command), FALSE); | |
1229
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1225
diff
changeset
|
1910 gtk_widget_show(b->command); |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1225
diff
changeset
|
1911 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1912 b->commentry = gtk_entry_new(); |
2550 | 1913 gtk_table_attach(GTK_TABLE(table), b->commentry, 1, 2, 2, 3, GTK_FILL | GTK_EXPAND, 0, 0, 0); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
1914 g_signal_connect(GTK_OBJECT(b->commentry), "activate", G_CALLBACK(do_new_bp), b); |
2986 | 1915 if(edit_bp) { |
1916 gtk_widget_set_sensitive(GTK_WIDGET(b->commentry), | |
1917 (edit_bp->options & OPT_POUNCE_COMMAND) ? TRUE : FALSE); | |
1918 gtk_entry_set_text(GTK_ENTRY(b->commentry), edit_bp->command); | |
1919 } | |
1920 else | |
1921 gtk_widget_set_sensitive(GTK_WIDGET(b->commentry), FALSE); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1922 gtk_widget_show(b->commentry); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
1923 g_signal_connect(GTK_OBJECT(b->command), "clicked", |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
1924 G_CALLBACK(gaim_gtk_toggle_sensitive), b->commentry); |
2986 | 1925 |
1694 | 1926 b->sound = gtk_check_button_new_with_label(_("Play sound on pounce")); |
2986 | 1927 if(edit_bp) |
1928 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->sound), | |
1929 (edit_bp->options & OPT_POUNCE_SOUND) ? TRUE : FALSE); | |
1930 else | |
1931 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->sound), FALSE); | |
2550 | 1932 gtk_table_attach(GTK_TABLE(table), b->sound, 0, 1, 3, 4, GTK_FILL, 0, 0, 0); |
1694 | 1933 gtk_widget_show(b->sound); |
1934 | |
1935 b->soundentry = gtk_entry_new(); | |
2550 | 1936 gtk_table_attach(GTK_TABLE(table), b->soundentry, 1, 2, 3, 4, GTK_FILL | GTK_EXPAND, 0, 0, 0); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
1937 g_signal_connect(GTK_OBJECT(b->soundentry), "activate", G_CALLBACK(do_new_bp), b); |
2986 | 1938 if(edit_bp) { |
1939 gtk_widget_set_sensitive(GTK_WIDGET(b->soundentry), | |
1940 (edit_bp->options & OPT_POUNCE_SOUND) ? TRUE : FALSE); | |
1941 gtk_entry_set_text(GTK_ENTRY(b->soundentry), edit_bp->sound); | |
1942 } else | |
1943 gtk_widget_set_sensitive(GTK_WIDGET(b->soundentry), FALSE); | |
1694 | 1944 gtk_widget_show(b->soundentry); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
1945 g_signal_connect(GTK_OBJECT(b->sound), "clicked", |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
1946 G_CALLBACK(gaim_gtk_toggle_sensitive), b->soundentry); |
2550 | 1947 /* </pounce type="action"> */ |
1229
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1225
diff
changeset
|
1948 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1949 b->save = gtk_check_button_new_with_label(_("Save this pounce after activation")); |
2550 | 1950 gtk_container_set_border_width(GTK_CONTAINER(b->save), 7); |
2986 | 1951 if(edit_bp) |
1952 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->save), | |
1953 (edit_bp->options & OPT_POUNCE_SAVE) ? TRUE : FALSE); | |
1954 else | |
1955 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->save), FALSE); | |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1233
diff
changeset
|
1956 gtk_box_pack_start(GTK_BOX(vbox), b->save, FALSE, FALSE, 0); |
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1233
diff
changeset
|
1957 gtk_widget_show(b->save); |
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1233
diff
changeset
|
1958 |
3795 | 1959 sep = gtk_hseparator_new(); |
1960 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); | |
1961 gtk_widget_show(sep); | |
1962 | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1963 bbox = gtk_hbox_new(FALSE, 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1964 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1965 gtk_widget_show(bbox); |
443 | 1966 |
3795 | 1967 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
1968 | |
4011 | 1969 button = gaim_pixbuf_button_from_stock(_("_Save"), "gtk-execute", GAIM_BUTTON_HORIZONTAL); |
3795 | 1970 gtk_size_group_add_widget(sg, button); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
1971 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(do_new_bp), b); |
3795 | 1972 gtk_box_pack_end(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
1973 gtk_widget_show(button); | |
1974 | |
1975 button = gaim_pixbuf_button_from_stock(_("C_ancel"), "gtk-cancel", GAIM_BUTTON_HORIZONTAL); | |
1976 gtk_size_group_add_widget(sg, button); | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
1977 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(destroy_dialog), b->window); |
1185 | 1978 gtk_box_pack_end(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
3795 | 1979 gtk_widget_show(button); |
1980 | |
443 | 1981 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1982 gtk_widget_show(b->window); |
1 | 1983 } |
1984 | |
1985 | |
1986 | |
1987 /*------------------------------------------------------------------------*/ | |
1988 /* The dialog for SET INFO / SET DIR INFO */ | |
1989 /*------------------------------------------------------------------------*/ | |
1990 | |
1991 void do_save_info(GtkWidget *widget, struct set_info_dlg *b) | |
1992 { | |
1993 gchar *junk; | |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
1994 struct gaim_connection *gc; |
1 | 1995 |
4119 | 1996 junk = gtk_text_view_get_text(GTK_TEXT_VIEW(b->text), FALSE); |
1 | 1997 |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
1998 if (b->user) { |
1292 | 1999 strncpy_withhtml(b->user->user_info, junk, sizeof b->user->user_info); |
1074
2cff18c2f9c6
[gaim-migrate @ 1084]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1072
diff
changeset
|
2000 gc = b->user->gc; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2001 |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
2002 save_prefs(); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
2003 |
1292 | 2004 if (gc) |
2005 serv_set_info(gc, b->user->user_info); | |
122
521db4bf5f28
[gaim-migrate @ 132]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
84
diff
changeset
|
2006 } |
25 | 2007 g_free(junk); |
1 | 2008 destroy_dialog(NULL, b->window); |
2009 g_free(b); | |
2010 } | |
2011 | |
2012 void do_set_dir(GtkWidget *widget, struct set_dir_dlg *b) | |
2013 { | |
3466 | 2014 const char *first = gtk_entry_get_text(GTK_ENTRY(b->first)); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2015 int web = GTK_TOGGLE_BUTTON(b->web)->active; |
3466 | 2016 const char *middle = gtk_entry_get_text(GTK_ENTRY(b->middle)); |
2017 const char *last = gtk_entry_get_text(GTK_ENTRY(b->last)); | |
2018 const char *maiden = gtk_entry_get_text(GTK_ENTRY(b->maiden)); | |
2019 const char *city = gtk_entry_get_text(GTK_ENTRY(b->city)); | |
2020 const char *state = gtk_entry_get_text(GTK_ENTRY(b->state)); | |
2021 const char *country = gtk_entry_get_text(GTK_ENTRY(b->country)); | |
1 | 2022 |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2023 serv_set_dir(b->gc, first, middle, last, maiden, city, state, country, web); |
1 | 2024 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2025 destroy_dialog(NULL, b->window); |
1 | 2026 g_free(b); |
2027 } | |
2028 | |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2029 void show_set_dir(struct gaim_connection *gc) |
1 | 2030 { |
2031 GtkWidget *label; | |
2032 GtkWidget *bot; | |
484 | 2033 GtkWidget *vbox; |
2034 GtkWidget *hbox; | |
2035 GtkWidget *frame; | |
2036 GtkWidget *fbox; | |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2037 char buf[256]; |
1 | 2038 |
2039 struct set_dir_dlg *b = g_new0(struct set_dir_dlg, 1); | |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2040 b->gc = gc; |
1 | 2041 |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
2042 GAIM_DIALOG(b->window); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2043 dialogwindows = g_list_prepend(dialogwindows, b->window); |
4074 | 2044 gtk_window_set_role(GTK_WINDOW(b->window), "set_dir"); |
1185 | 2045 gtk_window_set_policy(GTK_WINDOW(b->window), FALSE, TRUE, TRUE); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2046 gtk_window_set_title(GTK_WINDOW(b->window), _("Gaim - Set Dir Info")); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2047 g_signal_connect(GTK_OBJECT(b->window), "destroy", G_CALLBACK(destroy_dialog), b->window); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2048 gtk_widget_realize(b->window); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2049 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2050 fbox = gtk_vbox_new(FALSE, 5); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2051 gtk_container_add(GTK_CONTAINER(b->window), fbox); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2052 gtk_widget_show(fbox); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2053 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2054 frame = gtk_frame_new(_("Directory Info")); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2055 gtk_container_set_border_width(GTK_CONTAINER(fbox), 5); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2056 gtk_box_pack_start(GTK_BOX(fbox), frame, FALSE, FALSE, 0); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2057 gtk_widget_show(frame); |
484 | 2058 |
2059 vbox = gtk_vbox_new(FALSE, 5); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2060 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2061 gtk_container_add(GTK_CONTAINER(frame), vbox); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2062 gtk_widget_show(vbox); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2063 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2064 g_snprintf(buf, sizeof(buf), "Setting Dir Info for %s:", gc->username); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2065 label = gtk_label_new(buf); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2066 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 5); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2067 gtk_widget_show(label); |
1 | 2068 |
2069 b->first = gtk_entry_new(); | |
2070 b->middle = gtk_entry_new(); | |
2071 b->last = gtk_entry_new(); | |
2072 b->maiden = gtk_entry_new(); | |
2073 b->city = gtk_entry_new(); | |
2074 b->state = gtk_entry_new(); | |
2075 b->country = gtk_entry_new(); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2076 b->web = gtk_check_button_new_with_label(_("Allow Web Searches To Find Your Info")); |
484 | 2077 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2078 /* Line 1 */ |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2079 label = gtk_label_new(_("First Name")); |
1 | 2080 gtk_widget_show(label); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2081 |
484 | 2082 hbox = gtk_hbox_new(FALSE, 5); |
1185 | 2083 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
2084 gtk_box_pack_end(GTK_BOX(hbox), b->first, FALSE, FALSE, 0); | |
2085 | |
2086 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
484 | 2087 gtk_widget_show(hbox); |
2088 | |
2089 /* Line 2 */ | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2090 label = gtk_label_new(_("Middle Name")); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2091 gtk_widget_show(label); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2092 |
484 | 2093 hbox = gtk_hbox_new(FALSE, 5); |
1185 | 2094 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
2095 gtk_box_pack_end(GTK_BOX(hbox), b->middle, FALSE, FALSE, 0); | |
2096 | |
2097 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
484 | 2098 gtk_widget_show(hbox); |
2099 | |
2100 | |
2101 /* Line 3 */ | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2102 label = gtk_label_new(_("Last Name")); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2103 gtk_widget_show(label); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2104 |
484 | 2105 hbox = gtk_hbox_new(FALSE, 5); |
1185 | 2106 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
2107 gtk_box_pack_end(GTK_BOX(hbox), b->last, FALSE, FALSE, 0); | |
2108 | |
2109 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
484 | 2110 gtk_widget_show(hbox); |
2111 | |
2112 /* Line 4 */ | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2113 label = gtk_label_new(_("Maiden Name")); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2114 gtk_widget_show(label); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2115 |
484 | 2116 hbox = gtk_hbox_new(FALSE, 5); |
1185 | 2117 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
2118 gtk_box_pack_end(GTK_BOX(hbox), b->maiden, FALSE, FALSE, 0); | |
2119 | |
2120 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
484 | 2121 gtk_widget_show(hbox); |
2122 | |
2123 /* Line 5 */ | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2124 label = gtk_label_new(_("City")); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2125 gtk_widget_show(label); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2126 |
484 | 2127 hbox = gtk_hbox_new(FALSE, 5); |
1185 | 2128 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
2129 gtk_box_pack_end(GTK_BOX(hbox), b->city, FALSE, FALSE, 0); | |
2130 | |
2131 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
484 | 2132 gtk_widget_show(hbox); |
2133 | |
2134 /* Line 6 */ | |
1185 | 2135 label = gtk_label_new(_("State")); |
1 | 2136 gtk_widget_show(label); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2137 |
484 | 2138 hbox = gtk_hbox_new(FALSE, 5); |
1185 | 2139 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
2140 gtk_box_pack_end(GTK_BOX(hbox), b->state, FALSE, FALSE, 0); | |
2141 | |
2142 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
484 | 2143 gtk_widget_show(hbox); |
2144 | |
2145 /* Line 7 */ | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2146 label = gtk_label_new(_("Country")); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2147 gtk_widget_show(label); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2148 |
484 | 2149 hbox = gtk_hbox_new(FALSE, 5); |
1185 | 2150 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
2151 gtk_box_pack_end(GTK_BOX(hbox), b->country, FALSE, FALSE, 0); | |
2152 | |
2153 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
484 | 2154 gtk_widget_show(hbox); |
2155 | |
2156 /* Line 8 */ | |
2157 | |
2158 hbox = gtk_hbox_new(FALSE, 5); | |
1185 | 2159 gtk_box_pack_start(GTK_BOX(hbox), b->web, TRUE, TRUE, 0); |
484 | 2160 gtk_widget_show(hbox); |
1185 | 2161 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
484 | 2162 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2163 gtk_widget_show(b->first); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2164 gtk_widget_show(b->middle); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2165 gtk_widget_show(b->last); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2166 gtk_widget_show(b->maiden); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2167 gtk_widget_show(b->city); |
1 | 2168 gtk_widget_show(b->state); |
2169 gtk_widget_show(b->country); | |
2170 gtk_widget_show(b->web); | |
2171 | |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2172 /* And add the buttons */ |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2173 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2174 bot = gtk_hbox_new(FALSE, 5); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2175 gtk_box_pack_start(GTK_BOX(fbox), bot, FALSE, FALSE, 0); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2176 gtk_widget_show(bot); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2177 |
4092 | 2178 b->save = picture_button(b->window, _("Save"), save_xpm); |
2179 gtk_box_pack_end(GTK_BOX(bot), b->save, FALSE, FALSE, 0); | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2180 g_signal_connect(GTK_OBJECT(b->save), "clicked", G_CALLBACK(do_set_dir), b); |
4092 | 2181 |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2182 b->cancel = picture_button(b->window, _("Cancel"), cancel_xpm); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2183 gtk_box_pack_end(GTK_BOX(bot), b->cancel, FALSE, FALSE, 0); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2184 g_signal_connect(GTK_OBJECT(b->cancel), "clicked", G_CALLBACK(destroy_dialog), b->window); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2185 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2186 gtk_window_set_focus(GTK_WINDOW(b->window), b->first); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2187 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2188 gtk_widget_show(b->window); |
1 | 2189 } |
2190 | |
149 | 2191 void do_change_password(GtkWidget *widget, struct passwddlg *b) |
2192 { | |
3466 | 2193 const gchar *orig, *new1, *new2; |
149 | 2194 |
2195 orig = gtk_entry_get_text(GTK_ENTRY(b->original)); | |
2196 new1 = gtk_entry_get_text(GTK_ENTRY(b->new1)); | |
2197 new2 = gtk_entry_get_text(GTK_ENTRY(b->new2)); | |
2198 | |
2048
3366311426df
[gaim-migrate @ 2058]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1979
diff
changeset
|
2199 if (g_strcasecmp(new1, new2)) { |
3427 | 2200 do_error_dialog(_("New Passwords Do Not Match"), NULL, GAIM_ERROR); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2201 return; |
149 | 2202 } |
2203 | |
2204 if ((strlen(orig) < 1) || (strlen(new1) < 1) || (strlen(new2) < 1)) { | |
3427 | 2205 do_error_dialog(_("Fill out all fields completely"), NULL, GAIM_ERROR); |
149 | 2206 return; |
2207 } | |
2208 | |
978
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
2209 serv_change_passwd(b->gc, orig, new1); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2210 |
149 | 2211 destroy_dialog(NULL, b->window); |
2212 g_free(b); | |
2213 } | |
2214 | |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2215 void show_change_passwd(struct gaim_connection *gc) |
146 | 2216 { |
2217 GtkWidget *hbox; | |
2218 GtkWidget *label; | |
2219 GtkWidget *vbox; | |
475 | 2220 GtkWidget *fbox; |
2221 GtkWidget *frame; | |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2222 char buf[256]; |
454 | 2223 |
146 | 2224 struct passwddlg *b = g_new0(struct passwddlg, 1); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2225 b->gc = gc; |
146 | 2226 |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
2227 GAIM_DIALOG(b->window); |
1185 | 2228 gtk_window_set_policy(GTK_WINDOW(b->window), FALSE, TRUE, TRUE); |
4074 | 2229 gtk_window_set_role(GTK_WINDOW(b->window), "change_passwd"); |
978
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
2230 gtk_window_set_title(GTK_WINDOW(b->window), _("Gaim - Password Change")); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2231 g_signal_connect(GTK_OBJECT(b->window), "destroy", G_CALLBACK(destroy_dialog), b->window); |
978
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
2232 gtk_widget_realize(b->window); |
146 | 2233 dialogwindows = g_list_prepend(dialogwindows, b->window); |
149 | 2234 |
978
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
2235 fbox = gtk_vbox_new(FALSE, 5); |
1185 | 2236 gtk_container_border_width(GTK_CONTAINER(fbox), 5); |
978
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
2237 gtk_container_add(GTK_CONTAINER(b->window), fbox); |
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
2238 gtk_widget_show(fbox); |
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
2239 |
475 | 2240 frame = gtk_frame_new(_("Change Password")); |
1185 | 2241 gtk_box_pack_start(GTK_BOX(fbox), frame, FALSE, FALSE, 0); |
978
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
2242 gtk_widget_show(frame); |
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
2243 |
475 | 2244 vbox = gtk_vbox_new(FALSE, 5); |
1185 | 2245 gtk_container_border_width(GTK_CONTAINER(vbox), 5); |
978
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
2246 gtk_container_add(GTK_CONTAINER(frame), vbox); |
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
2247 gtk_widget_show(vbox); |
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
2248 |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2249 g_snprintf(buf, sizeof(buf), "Changing password for %s:", gc->username); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2250 label = gtk_label_new(buf); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2251 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 5); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2252 gtk_widget_show(label); |
978
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
2253 |
475 | 2254 /* First Line */ |
2255 hbox = gtk_hbox_new(FALSE, 5); | |
1185 | 2256 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
978
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
2257 gtk_widget_show(hbox); |
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
2258 |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2259 label = gtk_label_new(_("Original Password")); |
1185 | 2260 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
146 | 2261 gtk_widget_show(label); |
475 | 2262 |
146 | 2263 b->original = gtk_entry_new(); |
160
aaa8f0a2140e
[gaim-migrate @ 170]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
149
diff
changeset
|
2264 gtk_entry_set_visibility(GTK_ENTRY(b->original), FALSE); |
1185 | 2265 gtk_box_pack_end(GTK_BOX(hbox), b->original, FALSE, FALSE, 0); |
149 | 2266 gtk_widget_show(b->original); |
475 | 2267 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2268 /* Next Line */ |
475 | 2269 hbox = gtk_hbox_new(FALSE, 5); |
1185 | 2270 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
978
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
2271 gtk_widget_show(hbox); |
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
2272 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2273 label = gtk_label_new(_("New Password")); |
1185 | 2274 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2275 gtk_widget_show(label); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2276 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2277 b->new1 = gtk_entry_new(); |
160
aaa8f0a2140e
[gaim-migrate @ 170]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
149
diff
changeset
|
2278 gtk_entry_set_visibility(GTK_ENTRY(b->new1), FALSE); |
1185 | 2279 gtk_box_pack_end(GTK_BOX(hbox), b->new1, FALSE, FALSE, 0); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2280 gtk_widget_show(b->new1); |
475 | 2281 |
2282 /* Next Line */ | |
2283 hbox = gtk_hbox_new(FALSE, 5); | |
1185 | 2284 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
978
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
2285 gtk_widget_show(hbox); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2286 |
475 | 2287 label = gtk_label_new(_("New Password (again)")); |
1185 | 2288 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2289 gtk_widget_show(label); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2290 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2291 b->new2 = gtk_entry_new(); |
160
aaa8f0a2140e
[gaim-migrate @ 170]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
149
diff
changeset
|
2292 gtk_entry_set_visibility(GTK_ENTRY(b->new2), FALSE); |
1185 | 2293 gtk_box_pack_end(GTK_BOX(hbox), b->new2, FALSE, FALSE, 0); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2294 gtk_widget_show(b->new2); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2295 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2296 /* Now do our row of buttons */ |
1185 | 2297 hbox = gtk_hbox_new(FALSE, 5); |
2298 gtk_box_pack_start(GTK_BOX(fbox), hbox, FALSE, FALSE, 0); | |
146 | 2299 gtk_widget_show(hbox); |
475 | 2300 |
4092 | 2301 b->ok = picture_button(b->window, _("OK"), ok_xpm); |
2302 gtk_box_pack_end(GTK_BOX(hbox), b->ok, FALSE, FALSE, 0); | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2303 g_signal_connect(GTK_OBJECT(b->ok), "clicked", G_CALLBACK(do_change_password), b); |
4092 | 2304 |
1185 | 2305 b->cancel = picture_button(b->window, _("Cancel"), cancel_xpm); |
2306 gtk_box_pack_end(GTK_BOX(hbox), b->cancel, FALSE, FALSE, 0); | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2307 g_signal_connect(GTK_OBJECT(b->cancel), "clicked", G_CALLBACK(destroy_dialog), b->window); |
1185 | 2308 |
978
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
2309 gtk_widget_show(b->window); |
146 | 2310 } |
2311 | |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2312 void show_set_info(struct gaim_connection *gc) |
1 | 2313 { |
1185 | 2314 GtkWidget *buttons; |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2315 GtkWidget *label; |
1185 | 2316 GtkWidget *vbox; |
4119 | 2317 GtkTextBuffer *buffer; |
2318 GtkWidget *frame; | |
1292 | 2319 gchar *buf; |
2320 struct aim_user *tmp; | |
2321 | |
1 | 2322 struct set_info_dlg *b = g_new0(struct set_info_dlg, 1); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2323 tmp = gc->user; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2324 b->user = tmp; |
1 | 2325 |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
2326 GAIM_DIALOG(b->window); |
4074 | 2327 gtk_window_set_role(GTK_WINDOW(b->window), "set_info"); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2328 dialogwindows = g_list_prepend(dialogwindows, b->window); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2329 gtk_window_set_title(GTK_WINDOW(b->window), _("Gaim - Set User Info")); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2330 g_signal_connect(GTK_OBJECT(b->window), "destroy", G_CALLBACK(destroy_dialog), b->window); |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
2331 gtk_widget_realize(b->window); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2332 |
1185 | 2333 vbox = gtk_vbox_new(FALSE, 5); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2334 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2335 gtk_container_add(GTK_CONTAINER(b->window), vbox); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2336 gtk_widget_show(vbox); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2337 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2338 buf = g_malloc(256); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2339 g_snprintf(buf, 256, "Changing info for %s:", tmp->username); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2340 label = gtk_label_new(buf); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2341 g_free(buf); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2342 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 5); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2343 gtk_widget_show(label); |
4119 | 2344 |
2345 frame = gtk_frame_new(NULL); | |
2346 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN); | |
2347 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); | |
2348 gtk_widget_show(frame); | |
2349 | |
2350 b->text = gtk_text_view_new(); | |
2351 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(b->text), GTK_WRAP_WORD); | |
2352 gtk_widget_set_size_request(b->text, 300, 200); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2353 buf = g_malloc(strlen(tmp->user_info) + 1); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2354 strncpy_nohtml(buf, tmp->user_info, strlen(tmp->user_info) + 1); |
4119 | 2355 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(b->text)); |
2356 gtk_text_buffer_set_text(buffer, buf, -1); | |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2357 g_free(buf); |
4119 | 2358 gtk_container_add(GTK_CONTAINER(frame), b->text); |
1 | 2359 gtk_widget_show(b->text); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2360 gtk_window_set_focus(GTK_WINDOW(b->window), b->text); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2361 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2362 buttons = gtk_hbox_new(FALSE, 5); |
1185 | 2363 gtk_box_pack_start(GTK_BOX(vbox), buttons, FALSE, FALSE, 0); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2364 gtk_widget_show(buttons); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2365 |
4092 | 2366 b->save = picture_button(b->window, _("Save"), save_xpm); |
2367 gtk_box_pack_end(GTK_BOX(buttons), b->save, FALSE, FALSE, 0); | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2368 g_signal_connect(GTK_OBJECT(b->save), "clicked", G_CALLBACK(do_save_info), b); |
4092 | 2369 |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2370 b->cancel = picture_button(b->window, _("Cancel"), cancel_xpm); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2371 gtk_box_pack_end(GTK_BOX(buttons), b->cancel, FALSE, FALSE, 0); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2372 g_signal_connect(GTK_OBJECT(b->cancel), "clicked", G_CALLBACK(destroy_dialog), b->window); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2373 |
1 | 2374 gtk_widget_show(b->window); |
2375 | |
2376 } | |
2377 | |
2378 /*------------------------------------------------------------------------*/ | |
2379 /* The dialog for the info requests */ | |
2380 /*------------------------------------------------------------------------*/ | |
2381 | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2382 static void info_dlg_free(GtkWidget *b, struct info_dlg *d) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2383 { |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2384 if (g_slist_find(info_dlgs, d)) |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2385 info_dlgs = g_slist_remove(info_dlgs, d); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2386 g_free(d->who); |
1051
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1049
diff
changeset
|
2387 g_free(d); |
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1049
diff
changeset
|
2388 } |
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1049
diff
changeset
|
2389 |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2785
diff
changeset
|
2390 /* if away is 0, show regardless and try to get away message |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2785
diff
changeset
|
2391 * 1, don't show if regular info isn't shown |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2785
diff
changeset
|
2392 * 2, show regardless but don't try to get away message |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2785
diff
changeset
|
2393 * |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2785
diff
changeset
|
2394 * i wish this were my client. if i were i wouldn't have to deal with this shit. |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2785
diff
changeset
|
2395 */ |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2785
diff
changeset
|
2396 void g_show_info_text(struct gaim_connection *gc, char *who, int away, char *info, ...) |
1 | 2397 { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2398 GtkWidget *ok; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2399 GtkWidget *label; |
1 | 2400 GtkWidget *text; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2401 GtkWidget *bbox; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2402 GtkWidget *sw; |
1428
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1399
diff
changeset
|
2403 gint options = 0; |
2137
18722ae5b882
[gaim-migrate @ 2147]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
2404 char *more_info; |
18722ae5b882
[gaim-migrate @ 2147]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
2405 va_list ap; |
1 | 2406 |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2407 struct info_dlg *b = find_info_dlg(gc, who); |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2785
diff
changeset
|
2408 if (!b && (away == 1)) |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2409 return; |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2410 if (!b) { |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2411 b = g_new0(struct info_dlg, 1); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2412 b->gc = gc; |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2413 b->who = who ? g_strdup(normalize(who)) : NULL; |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2414 info_dlgs = g_slist_append(info_dlgs, b); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2415 |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2416 GAIM_DIALOG(b->window); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2417 gtk_window_set_title(GTK_WINDOW(b->window), "Gaim"); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2418 gtk_container_border_width(GTK_CONTAINER(b->window), 5); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2419 gtk_widget_realize(GTK_WIDGET(b->window)); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2420 g_signal_connect(GTK_OBJECT(b->window), "destroy", G_CALLBACK(info_dlg_free), b); |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2421 |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2422 bbox = gtk_vbox_new(FALSE, 5); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2423 gtk_container_add(GTK_CONTAINER(b->window), bbox); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2424 |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2425 label = gtk_label_new(_("Below are the results of your search: ")); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2426 gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2427 |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2428 sw = gtk_scrolled_window_new(NULL, NULL); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2429 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); |
3926 | 2430 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2431 gtk_box_pack_start(GTK_BOX(bbox), sw, TRUE, TRUE, 0); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2432 |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2433 text = gtk_imhtml_new(NULL, NULL); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2434 b->text = text; |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2435 gtk_container_add(GTK_CONTAINER(sw), text); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2436 gtk_widget_set_usize(sw, 300, 250); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2437 gaim_setup_imhtml(text); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2438 |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2439 ok = picture_button(b->window, _("OK"), ok_xpm); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2440 g_signal_connect_swapped(GTK_OBJECT(ok), "clicked", G_CALLBACK(gtk_widget_destroy), |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2441 GTK_OBJECT(b->window)); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2442 gtk_box_pack_start(GTK_BOX(bbox), ok, FALSE, FALSE, 0); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2443 |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2444 gtk_widget_show_all(b->window); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2445 } |
1 | 2446 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2228
diff
changeset
|
2447 if (convo_options & OPT_CONVO_IGNORE_COLOUR) |
1428
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1399
diff
changeset
|
2448 options ^= GTK_IMHTML_NO_COLOURS; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2228
diff
changeset
|
2449 if (convo_options & OPT_CONVO_IGNORE_FONTS) |
1428
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1399
diff
changeset
|
2450 options ^= GTK_IMHTML_NO_FONTS; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2228
diff
changeset
|
2451 if (convo_options & OPT_CONVO_IGNORE_SIZES) |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
2452 options ^= GTK_IMHTML_NO_SIZES; |
1428
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1399
diff
changeset
|
2453 options ^= GTK_IMHTML_NO_COMMENTS; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1399
diff
changeset
|
2454 options ^= GTK_IMHTML_NO_TITLE; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1399
diff
changeset
|
2455 options ^= GTK_IMHTML_NO_NEWLINE; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1399
diff
changeset
|
2456 options ^= GTK_IMHTML_NO_SCROLL; |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2457 |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2851
diff
changeset
|
2458 gtk_imhtml_append_text(GTK_IMHTML(b->text), info, -1, options); |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2459 |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2460 va_start(ap, info); |
2137
18722ae5b882
[gaim-migrate @ 2147]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
2461 while ((more_info = va_arg(ap, char *)) != NULL) |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2851
diff
changeset
|
2462 gtk_imhtml_append_text(GTK_IMHTML(b->text), more_info, -1, options); |
2137
18722ae5b882
[gaim-migrate @ 2147]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
2463 va_end(ap); |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2464 |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2465 if (away) |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2466 info_dlgs = g_slist_remove(info_dlgs, b); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2467 else |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2468 serv_get_away(gc, who); |
247
f6e8ea29b24f
[gaim-migrate @ 257]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
245
diff
changeset
|
2469 } |
f6e8ea29b24f
[gaim-migrate @ 257]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
245
diff
changeset
|
2470 |
1 | 2471 /*------------------------------------------------------------------------*/ |
2472 /* The dialog for adding to permit/deny */ | |
2473 /*------------------------------------------------------------------------*/ | |
2474 | |
2475 | |
2476 static void do_add_perm(GtkWidget *w, struct addperm *p) | |
2477 { | |
2478 | |
3466 | 2479 const char *who; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2480 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2481 who = gtk_entry_get_text(GTK_ENTRY(p->entry)); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2482 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2483 if (!p->permit) { |
4349 | 2484 if (gaim_privacy_deny_add(p->gc->user, who)) { |
2485 serv_add_deny(p->gc, who); | |
2486 build_block_list(); | |
2487 gaim_blist_save(); | |
1126
c8118e7ec981
[gaim-migrate @ 1136]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1125
diff
changeset
|
2488 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2489 } else { |
4349 | 2490 if (gaim_privacy_permit_add(p->gc->user, who)) { |
2491 serv_add_permit(p->gc, who); | |
2492 build_allow_list(); | |
2493 gaim_blist_save(); | |
1126
c8118e7ec981
[gaim-migrate @ 1136]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1125
diff
changeset
|
2494 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2495 } |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2496 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2497 destroy_dialog(NULL, p->window); |
1 | 2498 } |
2499 | |
2500 | |
2501 | |
1144
b1454d019277
[gaim-migrate @ 1154]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1141
diff
changeset
|
2502 void show_add_perm(struct gaim_connection *gc, char *who, gboolean permit) |
1 | 2503 { |
2504 GtkWidget *cancel; | |
2505 GtkWidget *add; | |
2506 GtkWidget *label; | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2507 GtkWidget *bbox; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2508 GtkWidget *vbox; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2509 GtkWidget *topbox; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2510 |
486 | 2511 struct addperm *p = g_new0(struct addperm, 1); |
1072
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
2512 p->gc = gc; |
1144
b1454d019277
[gaim-migrate @ 1154]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1141
diff
changeset
|
2513 p->permit = permit; |
1 | 2514 |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
2515 GAIM_DIALOG(p->window); |
487 | 2516 gtk_container_set_border_width(GTK_CONTAINER(p->window), 5); |
2517 gtk_window_set_policy(GTK_WINDOW(p->window), FALSE, FALSE, TRUE); | |
1144
b1454d019277
[gaim-migrate @ 1154]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1141
diff
changeset
|
2518 gtk_widget_realize(p->window); |
487 | 2519 |
486 | 2520 dialogwindows = g_list_prepend(dialogwindows, p->window); |
2521 | |
4107 | 2522 bbox = gtk_hbox_new(FALSE, 5); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2523 topbox = gtk_hbox_new(FALSE, 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2524 vbox = gtk_vbox_new(FALSE, 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2525 p->entry = gtk_entry_new(); |
1 | 2526 |
486 | 2527 /* Build Add Button */ |
2528 | |
1144
b1454d019277
[gaim-migrate @ 1154]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1141
diff
changeset
|
2529 if (permit) |
b1454d019277
[gaim-migrate @ 1154]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1141
diff
changeset
|
2530 add = picture_button(p->window, _("Permit"), add_xpm); |
b1454d019277
[gaim-migrate @ 1154]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1141
diff
changeset
|
2531 else |
b1454d019277
[gaim-migrate @ 1154]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1141
diff
changeset
|
2532 add = picture_button(p->window, _("Deny"), add_xpm); |
603
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
2533 cancel = picture_button(p->window, _("Cancel"), cancel_xpm); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2534 |
486 | 2535 /* End of Cancel Button */ |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2536 if (who != NULL) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2537 gtk_entry_set_text(GTK_ENTRY(p->entry), who); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2538 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2539 /* Put the buttons in the box */ |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2540 |
4107 | 2541 gtk_box_pack_end(GTK_BOX(bbox), add, FALSE, FALSE, 5); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2542 gtk_box_pack_end(GTK_BOX(bbox), cancel, FALSE, FALSE, 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2543 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2544 label = gtk_label_new(_("Add")); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2545 gtk_widget_show(label); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2546 gtk_box_pack_start(GTK_BOX(topbox), label, FALSE, FALSE, 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2547 gtk_box_pack_start(GTK_BOX(topbox), p->entry, FALSE, FALSE, 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2548 /* And the boxes in the box */ |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2549 gtk_box_pack_start(GTK_BOX(vbox), topbox, TRUE, TRUE, 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2550 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 5); |
4107 | 2551 gtk_widget_show(topbox); |
2552 topbox=gtk_hbox_new(FALSE, 5); | |
2553 gtk_box_pack_start(GTK_BOX(topbox), vbox, FALSE, FALSE, 5); | |
1 | 2554 |
2555 | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2556 /* Handle closes right */ |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2557 g_signal_connect(GTK_OBJECT(p->window), "destroy", G_CALLBACK(destroy_dialog), p->window); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2558 g_signal_connect(GTK_OBJECT(cancel), "clicked", G_CALLBACK(destroy_dialog), p->window); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2559 g_signal_connect(GTK_OBJECT(add), "clicked", G_CALLBACK(do_add_perm), p); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2560 g_signal_connect(GTK_OBJECT(p->entry), "activate", G_CALLBACK(do_add_perm), p); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2561 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2562 /* Finish up */ |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2563 gtk_widget_show(add); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2564 gtk_widget_show(cancel); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2565 gtk_widget_show(p->entry); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2566 gtk_widget_show(topbox); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2567 gtk_widget_show(bbox); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2568 gtk_widget_show(vbox); |
1144
b1454d019277
[gaim-migrate @ 1154]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1141
diff
changeset
|
2569 if (permit) |
b1454d019277
[gaim-migrate @ 1154]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1141
diff
changeset
|
2570 gtk_window_set_title(GTK_WINDOW(p->window), _("Gaim - Add Permit")); |
b1454d019277
[gaim-migrate @ 1154]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1141
diff
changeset
|
2571 else |
b1454d019277
[gaim-migrate @ 1154]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1141
diff
changeset
|
2572 gtk_window_set_title(GTK_WINDOW(p->window), _("Gaim - Add Deny")); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2573 gtk_window_set_focus(GTK_WINDOW(p->window), p->entry); |
4107 | 2574 gtk_container_add(GTK_CONTAINER(p->window), topbox); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2575 gtk_widget_realize(p->window); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2576 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2577 gtk_widget_show(p->window); |
1 | 2578 } |
2579 | |
2580 | |
2581 /*------------------------------------------------------------------------*/ | |
608 | 2582 /* Functions Called To Add A Log */ |
1 | 2583 /*------------------------------------------------------------------------*/ |
2584 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2585 void cancel_log(GtkWidget *widget, struct gaim_conversation *c) |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2586 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2587 struct gaim_gtk_conversation *gtkconv; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2588 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2589 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2590 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2591 if (gtkconv->toolbar.log) { |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2592 gaim_gtk_set_state_lock(TRUE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2593 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkconv->toolbar.log), |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2594 FALSE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2595 gaim_gtk_set_state_lock(FALSE); |
608 | 2596 } |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2597 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2598 dialogwindows = g_list_remove(dialogwindows, gtkconv->dialogs.log); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2599 gtk_widget_destroy(gtkconv->dialogs.log); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2600 gtkconv->dialogs.log = NULL; |
608 | 2601 } |
2602 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2603 void do_log(GtkWidget *w, struct gaim_conversation *c) |
1 | 2604 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2605 struct gaim_gtk_conversation *gtkconv; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2606 struct log_conversation *l; |
3466 | 2607 const char *file; |
1035
80a47e3b1bca
[gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1032
diff
changeset
|
2608 char path[PATHSIZE]; |
1 | 2609 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2610 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2611 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2612 if (!find_log_info(c->name)) { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2613 file = gtk_file_selection_get_filename( |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2614 GTK_FILE_SELECTION(gtkconv->dialogs.log)); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2615 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2616 strncpy(path, file, PATHSIZE - 1); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2617 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2618 if (file_is_dir(path, gtkconv->dialogs.log)) |
1035
80a47e3b1bca
[gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1032
diff
changeset
|
2619 return; |
80a47e3b1bca
[gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1032
diff
changeset
|
2620 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2621 l = (struct log_conversation *)g_new0(struct log_conversation, 1); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2622 strcpy(l->name, gaim_conversation_get_name(c)); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2623 strcpy(l->filename, file); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2624 log_conversations = g_list_append(log_conversations, l); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2625 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2626 if (c != NULL) |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2627 gaim_conversation_set_logging(c, TRUE); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2628 } |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2629 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2630 save_prefs(); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2631 cancel_log(NULL, c); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2632 } |
1 | 2633 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2634 void show_log_dialog(struct gaim_conversation *c) |
1 | 2635 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2636 struct gaim_gtk_conversation *gtkconv; |
1 | 2637 char *buf = g_malloc(BUF_LEN); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2638 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2639 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2640 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2641 if (!gtkconv->dialogs.log) { |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2642 gtkconv->dialogs.log = gtk_file_selection_new(_("Gaim - Log Conversation")); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2643 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2644 gtk_file_selection_hide_fileop_buttons( |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2645 GTK_FILE_SELECTION(gtkconv->dialogs.log)); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2646 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2647 g_snprintf(buf, BUF_LEN - 1, "%s" G_DIR_SEPARATOR_S "%s.log", |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2648 gaim_home_dir(), normalize(c->name)); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2649 gtk_object_set_user_data(GTK_OBJECT(gtkconv->dialogs.log), |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2650 "log dialog"); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2651 gtk_file_selection_set_filename(GTK_FILE_SELECTION(gtkconv->dialogs.log), |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2652 buf); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2653 g_signal_connect(G_OBJECT(gtkconv->dialogs.log), "delete_event", |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2654 G_CALLBACK(delete_event_dialog), c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2655 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(gtkconv->dialogs.log)->ok_button), "clicked", |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2656 G_CALLBACK(do_log), c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2657 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(gtkconv->dialogs.log)->cancel_button), "clicked", |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2658 G_CALLBACK(cancel_log), c); |
1 | 2659 } |
2660 | |
25 | 2661 g_free(buf); |
2662 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2663 gtk_widget_show(gtkconv->dialogs.log); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2664 gdk_window_raise(gtkconv->dialogs.log->window); |
1 | 2665 } |
2666 | |
2667 /*------------------------------------------------------*/ | |
2668 /* Find Buddy By Email */ | |
2669 /*------------------------------------------------------*/ | |
2670 | |
2671 void do_find_info(GtkWidget *w, struct findbyinfo *b) | |
2672 { | |
3466 | 2673 const char *first; |
2674 const char *middle; | |
2675 const char *last; | |
2676 const char *maiden; | |
2677 const char *city; | |
2678 const char *state; | |
2679 const char *country; | |
1 | 2680 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2681 first = gtk_entry_get_text(GTK_ENTRY(b->firstentry)); |
1 | 2682 middle = gtk_entry_get_text(GTK_ENTRY(b->middleentry)); |
2683 last = gtk_entry_get_text(GTK_ENTRY(b->lastentry)); | |
2684 maiden = gtk_entry_get_text(GTK_ENTRY(b->maidenentry)); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2685 city = gtk_entry_get_text(GTK_ENTRY(b->cityentry)); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2686 state = gtk_entry_get_text(GTK_ENTRY(b->stateentry)); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2687 country = gtk_entry_get_text(GTK_ENTRY(b->countryentry)); |
1 | 2688 |
2393
a7ecfd3f7714
[gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2382
diff
changeset
|
2689 serv_dir_search(b->gc, first, middle, last, maiden, city, state, country, ""); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2690 destroy_dialog(NULL, b->window); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2691 } |
1 | 2692 |
2693 void do_find_email(GtkWidget *w, struct findbyemail *b) | |
2694 { | |
3466 | 2695 const char *email; |
1 | 2696 |
2697 email = gtk_entry_get_text(GTK_ENTRY(b->emailentry)); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2698 |
2598
b2800bca74fe
[gaim-migrate @ 2611]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2582
diff
changeset
|
2699 serv_dir_search(b->gc, "", "", "", "", "", "", "", email); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2700 |
1 | 2701 destroy_dialog(NULL, b->window); |
2702 } | |
2703 | |
2393
a7ecfd3f7714
[gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2382
diff
changeset
|
2704 void show_find_info(struct gaim_connection *gc) |
1 | 2705 { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2706 GtkWidget *cancel; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2707 GtkWidget *ok; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2708 GtkWidget *label; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2709 GtkWidget *bbox; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2710 GtkWidget *vbox; |
479 | 2711 GtkWidget *hbox; |
2712 GtkWidget *fbox; | |
2713 GtkWidget *frame; | |
1 | 2714 |
2715 struct findbyinfo *b = g_new0(struct findbyinfo, 1); | |
2393
a7ecfd3f7714
[gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2382
diff
changeset
|
2716 b->gc = gc; |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
2717 GAIM_DIALOG(b->window); |
1185 | 2718 gtk_window_set_policy(GTK_WINDOW(b->window), FALSE, TRUE, TRUE); |
4074 | 2719 gtk_window_set_role(GTK_WINDOW(b->window), "find_info"); |
479 | 2720 gtk_widget_show(b->window); |
2721 | |
2722 dialogwindows = g_list_prepend(dialogwindows, b->window); | |
2723 | |
2724 frame = gtk_frame_new(_("Search for Buddy")); | |
2725 fbox = gtk_vbox_new(FALSE, 5); | |
2726 | |
2727 /* Build OK Button */ | |
2728 | |
603
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
2729 ok = picture_button(b->window, _("OK"), ok_xpm); |
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
2730 cancel = picture_button(b->window, _("Cancel"), cancel_xpm); |
1 | 2731 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2732 bbox = gtk_hbox_new(FALSE, 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2733 vbox = gtk_vbox_new(FALSE, 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2734 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2735 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2736 b->firstentry = gtk_entry_new(); |
1 | 2737 b->middleentry = gtk_entry_new(); |
2738 b->lastentry = gtk_entry_new(); | |
2739 b->maidenentry = gtk_entry_new(); | |
2740 b->cityentry = gtk_entry_new(); | |
2741 b->stateentry = gtk_entry_new(); | |
2742 b->countryentry = gtk_entry_new(); | |
2743 | |
4333 | 2744 gtk_box_pack_end(GTK_BOX(bbox), ok, FALSE, FALSE, 0); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2745 gtk_box_pack_end(GTK_BOX(bbox), cancel, FALSE, FALSE, 0); |
1 | 2746 |
479 | 2747 /* Line 1 */ |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2748 label = gtk_label_new(_("First Name")); |
1 | 2749 gtk_widget_show(label); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2750 |
1185 | 2751 hbox = gtk_hbox_new(FALSE, 5); |
2752 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
2753 gtk_box_pack_end(GTK_BOX(hbox), b->firstentry, FALSE, FALSE, 0); | |
479 | 2754 |
2755 gtk_widget_show(hbox); | |
1185 | 2756 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
479 | 2757 |
2758 /* Line 2 */ | |
1 | 2759 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2760 label = gtk_label_new(_("Middle Name")); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2761 gtk_widget_show(label); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2762 |
1185 | 2763 hbox = gtk_hbox_new(FALSE, 5); |
2764 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
2765 gtk_box_pack_end(GTK_BOX(hbox), b->middleentry, FALSE, FALSE, 0); | |
479 | 2766 |
2767 gtk_widget_show(hbox); | |
1185 | 2768 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
479 | 2769 |
2770 /* Line 3 */ | |
2771 | |
2772 label = gtk_label_new(_("Last Name")); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2773 gtk_widget_show(label); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2774 |
1185 | 2775 hbox = gtk_hbox_new(FALSE, 5); |
2776 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
2777 gtk_box_pack_end(GTK_BOX(hbox), b->lastentry, FALSE, FALSE, 0); | |
479 | 2778 |
2779 gtk_widget_show(hbox); | |
1185 | 2780 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
479 | 2781 |
2782 /* Line 4 */ | |
2783 | |
2784 label = gtk_label_new(_("Maiden Name")); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2785 gtk_widget_show(label); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2786 |
1185 | 2787 hbox = gtk_hbox_new(FALSE, 5); |
2788 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
2789 gtk_box_pack_end(GTK_BOX(hbox), b->maidenentry, FALSE, FALSE, 0); | |
479 | 2790 |
2791 gtk_widget_show(hbox); | |
1185 | 2792 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
479 | 2793 |
2794 /* Line 5 */ | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2795 |
479 | 2796 label = gtk_label_new(_("City")); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2797 gtk_widget_show(label); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2798 |
1185 | 2799 hbox = gtk_hbox_new(FALSE, 5); |
2800 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
2801 gtk_box_pack_end(GTK_BOX(hbox), b->cityentry, FALSE, FALSE, 0); | |
479 | 2802 |
2803 gtk_widget_show(hbox); | |
1185 | 2804 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
479 | 2805 |
2806 /* Line 6 */ | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2807 label = gtk_label_new(_("State")); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2808 gtk_widget_show(label); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2809 |
1185 | 2810 hbox = gtk_hbox_new(FALSE, 5); |
2811 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
2812 gtk_box_pack_end(GTK_BOX(hbox), b->stateentry, FALSE, FALSE, 0); | |
479 | 2813 |
2814 gtk_widget_show(hbox); | |
1185 | 2815 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
479 | 2816 |
2817 /* Line 7 */ | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2818 label = gtk_label_new(_("Country")); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2819 gtk_widget_show(label); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2820 |
1185 | 2821 hbox = gtk_hbox_new(FALSE, 5); |
2822 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
2823 gtk_box_pack_end(GTK_BOX(hbox), b->countryentry, FALSE, FALSE, 0); | |
479 | 2824 |
2825 gtk_widget_show(hbox); | |
1185 | 2826 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
479 | 2827 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2828 /* Merge The Boxes */ |
479 | 2829 |
2830 gtk_container_add(GTK_CONTAINER(frame), vbox); | |
1185 | 2831 gtk_box_pack_start(GTK_BOX(fbox), frame, FALSE, FALSE, 0); |
2832 gtk_box_pack_start(GTK_BOX(fbox), bbox, FALSE, FALSE, 0); | |
1 | 2833 |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2834 g_signal_connect(GTK_OBJECT(b->window), "destroy", G_CALLBACK(destroy_dialog), b->window); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2835 g_signal_connect(GTK_OBJECT(cancel), "clicked", G_CALLBACK(destroy_dialog), b->window); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2836 g_signal_connect(GTK_OBJECT(ok), "clicked", G_CALLBACK(do_find_info), b); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2837 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2838 gtk_widget_show(ok); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2839 gtk_widget_show(cancel); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2840 gtk_widget_show(b->firstentry); |
1 | 2841 gtk_widget_show(b->middleentry); |
2842 gtk_widget_show(b->lastentry); | |
2843 gtk_widget_show(b->maidenentry); | |
2844 gtk_widget_show(b->cityentry); | |
2845 gtk_widget_show(b->stateentry); | |
2846 gtk_widget_show(b->countryentry); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2847 gtk_widget_show(bbox); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2848 gtk_widget_show(vbox); |
479 | 2849 gtk_widget_show(frame); |
2850 gtk_widget_show(fbox); | |
2851 | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2852 gtk_window_set_title(GTK_WINDOW(b->window), _("Gaim - Find Buddy By Info")); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2853 gtk_window_set_focus(GTK_WINDOW(b->window), b->firstentry); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2854 gtk_container_add(GTK_CONTAINER(b->window), fbox); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2855 gtk_container_border_width(GTK_CONTAINER(b->window), 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2856 gtk_widget_realize(b->window); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2857 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2858 gtk_widget_show(b->window); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2859 } |
1 | 2860 |
1535
1e2cc8c8bf3c
[gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
2861 void show_find_email(struct gaim_connection *gc) |
1 | 2862 { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2863 GtkWidget *label; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2864 GtkWidget *bbox; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2865 GtkWidget *vbox; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2866 GtkWidget *frame; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2867 GtkWidget *topbox; |
444 | 2868 GtkWidget *button; |
1 | 2869 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2870 struct findbyemail *b = g_new0(struct findbyemail, 1); |
1535
1e2cc8c8bf3c
[gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
2871 if (g_slist_find(connections, gc)) |
1e2cc8c8bf3c
[gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
2872 b->gc = gc; |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
2873 GAIM_DIALOG(b->window); |
1185 | 2874 gtk_window_set_policy(GTK_WINDOW(b->window), FALSE, TRUE, TRUE); |
4074 | 2875 gtk_window_set_role(GTK_WINDOW(b->window), "find_email"); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2876 gtk_widget_realize(b->window); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2877 dialogwindows = g_list_prepend(dialogwindows, b->window); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2878 g_signal_connect(GTK_OBJECT(b->window), "destroy", G_CALLBACK(destroy_dialog), b->window); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2879 gtk_window_set_title(GTK_WINDOW(b->window), _("Gaim - Find Buddy By Email")); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2880 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2881 vbox = gtk_vbox_new(FALSE, 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2882 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2883 gtk_container_add(GTK_CONTAINER(b->window), vbox); |
1185 | 2884 |
444 | 2885 frame = gtk_frame_new(_("Search for Buddy")); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2886 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2887 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2888 topbox = gtk_hbox_new(FALSE, 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2889 gtk_container_add(GTK_CONTAINER(frame), topbox); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2890 gtk_container_set_border_width(GTK_CONTAINER(topbox), 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2891 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2892 label = gtk_label_new(_("Email")); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2893 gtk_box_pack_start(GTK_BOX(topbox), label, FALSE, FALSE, 0); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2894 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2895 b->emailentry = gtk_entry_new(); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2896 gtk_box_pack_start(GTK_BOX(topbox), b->emailentry, TRUE, TRUE, 0); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2897 g_signal_connect(GTK_OBJECT(b->emailentry), "activate", G_CALLBACK(do_find_email), b); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2898 gtk_window_set_focus(GTK_WINDOW(b->window), b->emailentry); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2899 |
1185 | 2900 bbox = gtk_hbox_new(FALSE, 5); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2901 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); |
444 | 2902 |
4094 | 2903 button = picture_button(b->window, _("OK"), ok_xpm); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2904 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(do_find_email), b); |
4094 | 2905 gtk_box_pack_end(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
2906 | |
603
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
2907 button = picture_button(b->window, _("Cancel"), cancel_xpm); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2908 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(destroy_dialog), b->window); |
1185 | 2909 gtk_box_pack_end(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
2910 | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2911 gtk_widget_show_all(b->window); |
1 | 2912 } |
2913 | |
2914 /*------------------------------------------------------*/ | |
2915 /* Link Dialog */ | |
2916 /*------------------------------------------------------*/ | |
2917 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2918 void cancel_link(GtkWidget *widget, struct gaim_conversation *c) |
1 | 2919 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2920 struct gaim_gtk_conversation *gtkconv; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2921 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2922 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2923 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2924 if (gtkconv->toolbar.link) { |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2925 gaim_gtk_set_state_lock(TRUE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2926 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(gtkconv->toolbar.link), |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2927 FALSE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2928 gaim_gtk_set_state_lock(FALSE); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2929 } |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2930 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2931 destroy_dialog(NULL, gtkconv->toolbar.link); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2932 gtkconv->toolbar.link = NULL; |
1 | 2933 } |
2934 | |
4262 | 2935 void do_insert_link(GtkWidget *w, int resp, struct linkdlg *b) |
1 | 2936 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2937 struct gaim_gtk_conversation *gtkconv; |
1 | 2938 char *open_tag; |
3466 | 2939 const char *urltext, *showtext; |
4262 | 2940 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2941 gtkconv = GAIM_GTK_CONVERSATION(b->c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2942 |
4262 | 2943 if (resp == GTK_RESPONSE_OK) { |
2944 | |
2945 open_tag = g_malloc(2048); | |
2946 | |
2947 urltext = gtk_entry_get_text(GTK_ENTRY(b->url)); | |
2948 showtext = gtk_entry_get_text(GTK_ENTRY(b->text)); | |
2949 | |
2950 if (!strlen(showtext)) | |
2951 showtext = urltext; | |
2952 | |
2953 g_snprintf(open_tag, 2048, "<A HREF=\"%s\">%s", urltext, showtext); | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2954 gaim_gtk_surround(gtkconv, open_tag, "</A>"); |
4262 | 2955 |
2956 g_free(open_tag); | |
2957 } | |
2958 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2959 if (gtkconv->toolbar.link) { |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2960 gaim_gtk_set_state_lock(TRUE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2961 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(gtkconv->toolbar.link), |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2962 FALSE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2963 gaim_gtk_set_state_lock(FALSE); |
4262 | 2964 } |
2965 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2966 gtkconv->dialogs.link = NULL; |
1 | 2967 destroy_dialog(NULL, b->window); |
2968 } | |
2969 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2970 void show_insert_link(GtkWidget *linky, struct gaim_conversation *c) |
1 | 2971 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2972 struct gaim_gtk_conversation *gtkconv; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2973 struct gaim_gtk_window *gtkwin; |
4262 | 2974 GtkWidget *table; |
2975 GtkWidget *label; | |
2976 GtkWidget *hbox; | |
1 | 2977 GtkWidget *vbox; |
2978 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2979 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2980 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(c)); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2981 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2982 if (gtkconv->dialogs.link == NULL) { |
4262 | 2983 struct linkdlg *a = g_new0(struct linkdlg, 1); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2984 char *filename = g_build_filename(DATADIR, "pixmaps", "gaim", |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2985 "dialogs", "gaim_question.png", NULL); |
4262 | 2986 GtkWidget *img = gtk_image_new_from_file(filename); |
2987 | |
2988 g_free(filename); | |
2989 | |
2990 a->c = c; | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2991 a->window = gtk_dialog_new_with_buttons(_("Gaim - Insert Link"), |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2992 GTK_WINDOW(gtkwin->window), GTK_DIALOG_MODAL, GTK_STOCK_CANCEL, |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2993 GTK_RESPONSE_CANCEL, _("Insert"), GTK_RESPONSE_OK, NULL); |
4262 | 2994 |
2995 gtk_dialog_set_default_response(GTK_DIALOG(a->window), GTK_RESPONSE_OK); | |
2996 gtk_container_set_border_width(GTK_CONTAINER(a->window), 6); | |
2997 gtk_window_set_resizable(GTK_WINDOW(a->window), FALSE); | |
2998 gtk_dialog_set_has_separator(GTK_DIALOG(a->window), FALSE); | |
2999 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(a->window)->vbox), 12); | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3000 gtk_container_set_border_width( |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3001 GTK_CONTAINER(GTK_DIALOG(a->window)->vbox), 6); |
4262 | 3002 gtk_window_set_role(GTK_WINDOW(a->window), "insert_link"); |
3003 | |
3004 hbox = gtk_hbox_new(FALSE, 12); | |
3005 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(a->window)->vbox), hbox); | |
3006 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
3007 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
3008 | |
3009 vbox = gtk_vbox_new(FALSE, 0); | |
3010 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
3011 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3012 label = gtk_label_new(_("Please enter the URL and description of " |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3013 "the link that you want to insert. The " |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3014 "description is optional.\n")); |
4262 | 3015 |
3016 gtk_widget_set_size_request(GTK_WIDGET(label), 335, -1); | |
3017 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
3018 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
3019 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
3020 | |
3021 hbox = gtk_hbox_new(FALSE, 6); | |
3022 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
3023 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3024 g_signal_connect(G_OBJECT(a->window), "destroy", |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3025 G_CALLBACK(destroy_dialog), a->window); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3026 g_signal_connect(G_OBJECT(a->window), "destroy", |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3027 G_CALLBACK(free_dialog), a); |
4262 | 3028 dialogwindows = g_list_prepend(dialogwindows, a->window); |
3029 | |
3030 table = gtk_table_new(4, 2, FALSE); | |
3031 gtk_table_set_row_spacings(GTK_TABLE(table), 5); | |
3032 gtk_table_set_col_spacings(GTK_TABLE(table), 5); | |
3033 gtk_container_set_border_width(GTK_CONTAINER(table), 0); | |
3034 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); | |
3035 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
3036 label = gtk_label_new(_("URL")); |
4262 | 3037 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
3038 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); | |
3039 | |
3040 a->url = gtk_entry_new(); | |
3041 gtk_table_attach_defaults(GTK_TABLE(table), a->url, 1, 2, 0, 1); | |
3042 gtk_widget_grab_focus(a->url); | |
3043 | |
3044 gtk_entry_set_activates_default (GTK_ENTRY(a->url), TRUE); | |
3045 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
3046 label = gtk_label_new(_("Description")); |
4262 | 3047 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
3048 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); | |
3049 | |
3050 a->text = gtk_entry_new(); | |
3051 gtk_table_attach_defaults(GTK_TABLE(table), a->text, 1, 2, 1, 2); | |
3052 gtk_entry_set_activates_default (GTK_ENTRY(a->text), TRUE); | |
3053 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3054 g_signal_connect(G_OBJECT(a->window), "response", |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3055 G_CALLBACK(do_insert_link), a); |
4262 | 3056 |
3057 a->toggle = linky; | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3058 gtkconv->dialogs.link = a->window; |
1 | 3059 } |
3060 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3061 gtk_widget_show_all(gtkconv->dialogs.link); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3062 gdk_window_raise(gtkconv->dialogs.link->window); |
1 | 3063 } |
3064 | |
3065 /*------------------------------------------------------*/ | |
3066 /* Color Selection Dialog */ | |
3067 /*------------------------------------------------------*/ | |
3068 | |
3367 | 3069 GtkWidget *fgcseld = NULL; |
3070 GtkWidget *bgcseld = NULL; | |
657
4bbc103a3294
[gaim-migrate @ 667]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
654
diff
changeset
|
3071 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3072 void cancel_fgcolor(GtkWidget *widget, struct gaim_conversation *c) |
1 | 3073 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3074 struct gaim_gtk_conversation *gtkconv; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3075 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3076 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3077 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3078 if (gtkconv->toolbar.fgcolor && widget) { |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3079 gaim_gtk_set_state_lock(TRUE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3080 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(gtkconv->toolbar.fgcolor), |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3081 FALSE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3082 gaim_gtk_set_state_lock(FALSE); |
61 | 3083 } |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3084 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3085 dialogwindows = g_list_remove(dialogwindows, gtkconv->dialogs.fg_color); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3086 gtk_widget_destroy(gtkconv->dialogs.fg_color); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3087 gtkconv->dialogs.fg_color = NULL; |
1 | 3088 } |
3089 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3090 void cancel_bgcolor(GtkWidget *widget, struct gaim_conversation *c) |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3091 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3092 struct gaim_gtk_conversation *gtkconv; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3093 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3094 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3095 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3096 if (gtkconv->toolbar.bgcolor && widget) { |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3097 gaim_gtk_set_state_lock(TRUE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3098 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(gtkconv->toolbar.bgcolor), |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3099 FALSE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3100 gaim_gtk_set_state_lock(FALSE); |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3101 } |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3102 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3103 dialogwindows = g_list_remove(dialogwindows, gtkconv->dialogs.bg_color); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3104 gtk_widget_destroy(gtkconv->dialogs.bg_color); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3105 gtkconv->dialogs.bg_color = NULL; |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3106 } |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3107 |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3108 void do_fgcolor(GtkWidget *widget, GtkColorSelection *colorsel) |
1 | 3109 { |
3110 GdkColor text_color; | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3111 struct gaim_conversation *c; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3112 struct gaim_gtk_conversation *gtkconv; |
1 | 3113 char *open_tag; |
3114 | |
3115 open_tag = g_malloc(30); | |
3116 | |
3557 | 3117 gtk_color_selection_get_current_color(colorsel, &text_color); |
1 | 3118 |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
3119 c = gtk_object_get_user_data(GTK_OBJECT(colorsel)); |
411
a330017b3aa4
[gaim-migrate @ 421]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
401
diff
changeset
|
3120 /* GTK_IS_EDITABLE(c->entry); huh? */ |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
3121 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3122 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3123 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3124 gtkconv->fg_color = text_color; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3125 gtkconv->has_fg = TRUE; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3126 g_snprintf(open_tag, 23, "<FONT COLOR=\"#%02X%02X%02X\">", |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3127 text_color.red / 256, |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3128 text_color.green / 256, |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3129 text_color.blue / 256); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3130 gaim_gtk_surround(gtkconv, open_tag, "</FONT>"); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3131 debug_printf("#%02X%02X%02X\n", |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3132 text_color.red / 256, |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3133 text_color.green / 256, |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3134 text_color.blue / 256); |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
3135 g_free(open_tag); |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3136 cancel_fgcolor(NULL, c); |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3137 } |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3138 |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3139 void do_bgcolor(GtkWidget *widget, GtkColorSelection *colorsel) |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3140 { |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3141 GdkColor text_color; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3142 struct gaim_conversation *c; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3143 struct gaim_gtk_conversation *gtkconv; |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3144 char *open_tag; |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3145 |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3146 open_tag = g_malloc(30); |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3147 |
3557 | 3148 gtk_color_selection_get_current_color(colorsel, &text_color); |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3149 |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3150 c = gtk_object_get_user_data(GTK_OBJECT(colorsel)); |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3151 /* GTK_IS_EDITABLE(c->entry); huh? */ |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3152 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3153 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3154 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3155 gtkconv->bg_color = text_color; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3156 gtkconv->has_bg = TRUE; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3157 g_snprintf(open_tag, 25, "<BODY BGCOLOR=\"#%02X%02X%02X\">", |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3158 text_color.red / 256, |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3159 text_color.green / 256, |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3160 text_color.blue / 256); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3161 gaim_gtk_surround(gtkconv, open_tag, "</BODY>"); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3162 debug_printf("#%02X%02X%02X\n", |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3163 text_color.red / 256, |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3164 text_color.green / 256, |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3165 text_color.blue / 256); |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3166 g_free(open_tag); |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3167 cancel_bgcolor(NULL, c); |
1 | 3168 } |
3169 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3170 void show_fgcolor_dialog(struct gaim_conversation *c, GtkWidget *color) |
1 | 3171 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3172 struct gaim_gtk_conversation *gtkconv; |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
3173 GtkWidget *colorsel; |
1 | 3174 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3175 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3176 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3177 if (color == NULL) { /* we came from the prefs */ |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3178 if (fgcseld) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3179 return; |
2209
9b8b32ae3b41
[gaim-migrate @ 2219]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2143
diff
changeset
|
3180 |
657
4bbc103a3294
[gaim-migrate @ 667]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
654
diff
changeset
|
3181 fgcseld = gtk_color_selection_dialog_new(_("Select Text Color")); |
4198 | 3182 gtk_color_selection_set_current_color(GTK_COLOR_SELECTION |
3183 (GTK_COLOR_SELECTION_DIALOG(fgcseld)->colorsel), &fgcolor); | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3184 g_signal_connect(GTK_OBJECT(fgcseld), "delete_event", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3185 G_CALLBACK(destroy_colorsel), (void *)1); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3186 g_signal_connect(GTK_OBJECT(GTK_COLOR_SELECTION_DIALOG(fgcseld)->cancel_button), |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3187 "clicked", G_CALLBACK(destroy_colorsel), (void *)1); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3188 g_signal_connect(GTK_OBJECT(GTK_COLOR_SELECTION_DIALOG(fgcseld)->ok_button), "clicked", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3189 G_CALLBACK(apply_color_dlg), (void *)1); |
657
4bbc103a3294
[gaim-migrate @ 667]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
654
diff
changeset
|
3190 gtk_widget_realize(fgcseld); |
4bbc103a3294
[gaim-migrate @ 667]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
654
diff
changeset
|
3191 gtk_widget_show(fgcseld); |
4bbc103a3294
[gaim-migrate @ 667]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
654
diff
changeset
|
3192 gdk_window_raise(fgcseld->window); |
4bbc103a3294
[gaim-migrate @ 667]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
654
diff
changeset
|
3193 return; |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3194 } |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3195 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3196 if (!gtkconv->dialogs.fg_color) { |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3197 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3198 gtkconv->dialogs.fg_color = gtk_color_selection_dialog_new(_("Select Text Color")); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3199 colorsel = GTK_COLOR_SELECTION_DIALOG(gtkconv->dialogs.fg_color)->colorsel; |
4198 | 3200 gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(colorsel), &fgcolor); |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3201 gtk_object_set_user_data(GTK_OBJECT(colorsel), c); |
2209
9b8b32ae3b41
[gaim-migrate @ 2219]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2143
diff
changeset
|
3202 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3203 g_signal_connect(GTK_OBJECT(gtkconv->dialogs.fg_color), "delete_event", |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3204 G_CALLBACK(delete_event_dialog), c); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3205 g_signal_connect(GTK_OBJECT(GTK_COLOR_SELECTION_DIALOG(gtkconv->dialogs.fg_color)->ok_button), |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3206 "clicked", G_CALLBACK(do_fgcolor), colorsel); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3207 g_signal_connect(GTK_OBJECT |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3208 (GTK_COLOR_SELECTION_DIALOG(gtkconv->dialogs.fg_color)->cancel_button), |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3209 "clicked", G_CALLBACK(cancel_fgcolor), c); |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3210 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3211 gtk_widget_realize(gtkconv->dialogs.fg_color); |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3212 } |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3213 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3214 gtk_widget_show(gtkconv->dialogs.fg_color); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3215 gdk_window_raise(gtkconv->dialogs.fg_color->window); |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3216 } |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3217 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3218 void show_bgcolor_dialog(struct gaim_conversation *c, GtkWidget *color) |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3219 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3220 struct gaim_gtk_conversation *gtkconv; |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3221 GtkWidget *colorsel; |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3222 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3223 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3224 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3225 if (color == NULL) { /* we came from the prefs */ |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3226 if (bgcseld) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3227 return; |
2209
9b8b32ae3b41
[gaim-migrate @ 2219]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2143
diff
changeset
|
3228 |
657
4bbc103a3294
[gaim-migrate @ 667]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
654
diff
changeset
|
3229 bgcseld = gtk_color_selection_dialog_new(_("Select Background Color")); |
4198 | 3230 gtk_color_selection_set_current_color(GTK_COLOR_SELECTION |
3231 (GTK_COLOR_SELECTION_DIALOG(bgcseld)->colorsel), &bgcolor); | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3232 g_signal_connect(GTK_OBJECT(bgcseld), "delete_event", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3233 G_CALLBACK(destroy_colorsel), NULL); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3234 g_signal_connect(GTK_OBJECT(GTK_COLOR_SELECTION_DIALOG(bgcseld)->cancel_button), |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3235 "clicked", G_CALLBACK(destroy_colorsel), NULL); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3236 g_signal_connect(GTK_OBJECT(GTK_COLOR_SELECTION_DIALOG(bgcseld)->ok_button), "clicked", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3237 G_CALLBACK(apply_color_dlg), (void *)2); |
657
4bbc103a3294
[gaim-migrate @ 667]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
654
diff
changeset
|
3238 gtk_widget_realize(bgcseld); |
4bbc103a3294
[gaim-migrate @ 667]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
654
diff
changeset
|
3239 gtk_widget_show(bgcseld); |
4bbc103a3294
[gaim-migrate @ 667]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
654
diff
changeset
|
3240 gdk_window_raise(bgcseld->window); |
4bbc103a3294
[gaim-migrate @ 667]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
654
diff
changeset
|
3241 return; |
4bbc103a3294
[gaim-migrate @ 667]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
654
diff
changeset
|
3242 } |
4bbc103a3294
[gaim-migrate @ 667]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
654
diff
changeset
|
3243 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3244 if (!gtkconv->dialogs.bg_color) { |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3245 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3246 gtkconv->dialogs.bg_color = gtk_color_selection_dialog_new(_("Select Background Color")); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3247 colorsel = GTK_COLOR_SELECTION_DIALOG(gtkconv->dialogs.bg_color)->colorsel; |
4198 | 3248 gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(colorsel), &bgcolor); |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
3249 gtk_object_set_user_data(GTK_OBJECT(colorsel), c); |
2209
9b8b32ae3b41
[gaim-migrate @ 2219]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2143
diff
changeset
|
3250 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3251 g_signal_connect(GTK_OBJECT(gtkconv->dialogs.bg_color), "delete_event", |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3252 G_CALLBACK(delete_event_dialog), c); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3253 g_signal_connect(GTK_OBJECT(GTK_COLOR_SELECTION_DIALOG(gtkconv->dialogs.bg_color)->ok_button), |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3254 "clicked", G_CALLBACK(do_bgcolor), colorsel); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3255 g_signal_connect(GTK_OBJECT |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3256 (GTK_COLOR_SELECTION_DIALOG(gtkconv->dialogs.bg_color)->cancel_button), |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3257 "clicked", G_CALLBACK(cancel_bgcolor), c); |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3258 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3259 gtk_widget_realize(gtkconv->dialogs.bg_color); |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
3260 } |
1 | 3261 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3262 gtk_widget_show(gtkconv->dialogs.bg_color); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3263 gdk_window_raise(gtkconv->dialogs.bg_color->window); |
1 | 3264 } |
3265 | |
3266 /*------------------------------------------------------------------------*/ | |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
3267 /* Font Selection Dialog */ |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
3268 /*------------------------------------------------------------------------*/ |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
3269 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3270 void cancel_font(GtkWidget *widget, struct gaim_conversation *c) |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3271 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3272 struct gaim_gtk_conversation *gtkconv; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3273 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3274 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3275 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3276 if (gtkconv->toolbar.normal_size && widget) { |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3277 gaim_gtk_set_state_lock(TRUE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3278 gtk_toggle_button_set_state( |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3279 GTK_TOGGLE_BUTTON(gtkconv->toolbar.normal_size), FALSE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3280 gaim_gtk_set_state_lock(FALSE); |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
3281 } |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3282 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3283 dialogwindows = g_list_remove(dialogwindows, gtkconv->dialogs.font); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3284 gtk_widget_destroy(gtkconv->dialogs.font); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3285 gtkconv->dialogs.font = NULL; |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
3286 } |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
3287 |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
3288 void apply_font(GtkWidget *widget, GtkFontSelection *fontsel) |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
3289 { |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
3290 /* this could be expanded to include font size, weight, etc. |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
3291 but for now only works with font face */ |
3473 | 3292 int i = 0; |
666
71ea550c22ac
[gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
657
diff
changeset
|
3293 char *fontname; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3294 struct gaim_conversation *c = gtk_object_get_user_data(GTK_OBJECT(fontsel)); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3295 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3296 if (c) { |
666
71ea550c22ac
[gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
657
diff
changeset
|
3297 fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(fontsel)); |
3473 | 3298 while(fontname[i] && !isdigit(fontname[i])) { |
3299 i++; | |
3300 } | |
3301 fontname[i] = 0; | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3302 gaim_gtk_set_font_face(GAIM_GTK_CONVERSATION(c), fontname); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3303 } else { |
334
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
3304 fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(fontsel)); |
3473 | 3305 while(fontface[i] && !isdigit(fontname[i]) && i < sizeof(fontface)) { |
3306 fontface[i] = fontname[i]; | |
3307 i++; | |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
3308 } |
3473 | 3309 fontface[i] = 0; |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
3310 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3311 |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
3312 cancel_font(NULL, c); |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
3313 } |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
3314 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3315 void destroy_fontsel(GtkWidget *w, gpointer d) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3316 { |
334
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
3317 gtk_widget_destroy(fontseld); |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
3318 fontseld = NULL; |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
3319 } |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
3320 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3321 void show_font_dialog(struct gaim_conversation *c, GtkWidget *font) |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
3322 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3323 struct gaim_gtk_conversation *gtkconv; |
3473 | 3324 char fonttif[128]; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3325 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3326 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3327 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3328 if (!font) { /* we came from the prefs dialog */ |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3329 if (fontseld) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3330 return; |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
3331 fontseld = gtk_font_selection_dialog_new(_("Select Font")); |
3473 | 3332 if (fontface[0]) { |
3333 g_snprintf(fonttif, sizeof(fonttif), "%s 12", fontface); | |
2763
477a035d81e5
[gaim-migrate @ 2776]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2761
diff
changeset
|
3334 gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(fontseld), |
3473 | 3335 fonttif); |
2763
477a035d81e5
[gaim-migrate @ 2776]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2761
diff
changeset
|
3336 } else { |
477a035d81e5
[gaim-migrate @ 2776]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2761
diff
changeset
|
3337 gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(fontseld), |
3473 | 3338 DEFAULT_FONT_FACE " 12"); |
2763
477a035d81e5
[gaim-migrate @ 2776]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2761
diff
changeset
|
3339 } |
334
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
3340 |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
3341 gtk_object_set_user_data(GTK_OBJECT(fontseld), NULL); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3342 g_signal_connect(GTK_OBJECT(fontseld), "delete_event", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3343 G_CALLBACK(destroy_fontsel), NULL); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3344 g_signal_connect(GTK_OBJECT(GTK_FONT_SELECTION_DIALOG(fontseld)->cancel_button), |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3345 "clicked", G_CALLBACK(destroy_fontsel), NULL); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3346 g_signal_connect(GTK_OBJECT(GTK_FONT_SELECTION_DIALOG(fontseld)->ok_button), "clicked", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3347 G_CALLBACK(apply_font_dlg), fontseld); |
334
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
3348 gtk_widget_realize(fontseld); |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
3349 gtk_widget_show(fontseld); |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
3350 gdk_window_raise(fontseld->window); |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
3351 return; |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
3352 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3353 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3354 if (!gtkconv->dialogs.font) { |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3355 gtkconv->dialogs.font = gtk_font_selection_dialog_new(_("Select Font")); |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
3356 |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
3357 if (font) |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3358 gtk_object_set_user_data(GTK_OBJECT(gtkconv->dialogs.font), c); |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
3359 else |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3360 gtk_object_set_user_data(GTK_OBJECT(gtkconv->dialogs.font), NULL); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3361 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3362 if (gtkconv->fontface[0]) { |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3363 g_snprintf(fonttif, sizeof(fonttif), "%s 12", gtkconv->fontface); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3364 gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(gtkconv->dialogs.font), |
3473 | 3365 fonttif); |
2763
477a035d81e5
[gaim-migrate @ 2776]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2761
diff
changeset
|
3366 } else { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3367 gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(gtkconv->dialogs.font), |
3473 | 3368 DEFAULT_FONT_FACE); |
2763
477a035d81e5
[gaim-migrate @ 2776]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2761
diff
changeset
|
3369 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3370 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3371 g_signal_connect(GTK_OBJECT(gtkconv->dialogs.font), "delete_event", |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3372 G_CALLBACK(delete_event_dialog), c); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3373 g_signal_connect(GTK_OBJECT(GTK_FONT_SELECTION_DIALOG(gtkconv->dialogs.font)->ok_button), |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3374 "clicked", G_CALLBACK(apply_font), gtkconv->dialogs.font); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3375 g_signal_connect(GTK_OBJECT(GTK_FONT_SELECTION_DIALOG(gtkconv->dialogs.font)->cancel_button), |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3376 "clicked", G_CALLBACK(cancel_font), c); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3377 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3378 gtk_widget_realize(gtkconv->dialogs.font); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3379 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3380 } |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3381 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3382 gtk_widget_show(gtkconv->dialogs.font); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3383 gdk_window_raise(gtkconv->dialogs.font->window); |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
3384 } |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
3385 |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
3386 /*------------------------------------------------------------------------*/ |
1 | 3387 /* The dialog for import/export */ |
3388 /*------------------------------------------------------------------------*/ | |
3389 | |
4350 | 3390 static void do_import_dialog(GtkWidget *w, gpointer data) |
229 | 3391 { |
3466 | 3392 const char *file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(importdialog)); |
2382
569ae9f2bb89
[gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
3393 if (file_is_dir(file, importdialog)) { |
569ae9f2bb89
[gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
3394 return; |
229 | 3395 } |
2598
b2800bca74fe
[gaim-migrate @ 2611]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2582
diff
changeset
|
3396 if (g_slist_find(connections, importgc)) { |
4350 | 3397 do_import(importgc->user, file); |
4349 | 3398 gaim_blist_save(); |
2598
b2800bca74fe
[gaim-migrate @ 2611]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2582
diff
changeset
|
3399 } |
2382
569ae9f2bb89
[gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
3400 destroy_dialog(NULL, importdialog); |
2493
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3401 } |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3402 |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3403 static void set_import_gc(gpointer data, struct gaim_connection *gc) |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3404 { |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3405 importgc = gc; |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3406 } |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3407 |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3408 static void create_import_dropdown(GtkFileSelection *fs) |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3409 { |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3410 GtkWidget *hbox; |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3411 GtkWidget *label; |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3412 GSList *g = connections; |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3413 struct gaim_connection *c; |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3414 GtkWidget *optmenu; |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3415 GtkWidget *menu; |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3416 char buf[256]; |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3417 GtkWidget *opt; |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3418 |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3419 if (!connections) |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3420 return; |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3421 importgc = connections->data; |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3422 if (!connections->next) |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3423 return; |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3424 |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3425 hbox = gtk_hbox_new(FALSE, 0); |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3426 gtk_box_pack_end(GTK_BOX(fs->action_area), hbox, FALSE, FALSE, 0); |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3427 gtk_widget_show(hbox); |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3428 |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3429 optmenu = gtk_option_menu_new(); |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3430 gtk_box_pack_end(GTK_BOX(hbox), optmenu, FALSE, FALSE, 5); |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3431 gtk_widget_show(optmenu); |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3432 |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3433 label = gtk_label_new(_("Import to:")); |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3434 gtk_box_pack_end(GTK_BOX(hbox), label, FALSE, FALSE, 5); |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3435 gtk_widget_show(label); |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3436 |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3437 menu = gtk_menu_new(); |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3438 |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3439 while (g) { |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3440 c = (struct gaim_connection *)g->data; |
3572 | 3441 g_snprintf(buf, sizeof buf, "%s (%s)", c->username, c->prpl->name); |
2493
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3442 opt = gtk_menu_item_new_with_label(buf); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3443 g_signal_connect(GTK_OBJECT(opt), "activate", G_CALLBACK(set_import_gc), c); |
2493
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3444 gtk_widget_show(opt); |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3445 gtk_menu_append(GTK_MENU(menu), opt); |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3446 g = g->next; |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3447 } |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3448 |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3449 gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), menu); |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3450 gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), 0); |
229 | 3451 } |
3452 | |
2382
569ae9f2bb89
[gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
3453 void show_import_dialog() |
1 | 3454 { |
2382
569ae9f2bb89
[gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
3455 char *buf = g_malloc(BUF_LEN); |
569ae9f2bb89
[gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
3456 if (!importdialog) { |
569ae9f2bb89
[gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
3457 importdialog = gtk_file_selection_new(_("Gaim - Import Buddy List")); |
569ae9f2bb89
[gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
3458 |
569ae9f2bb89
[gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
3459 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(importdialog)); |
569ae9f2bb89
[gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
3460 |
3630 | 3461 g_snprintf(buf, BUF_LEN - 1, "%s" G_DIR_SEPARATOR_S, gaim_home_dir()); |
2382
569ae9f2bb89
[gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
3462 |
569ae9f2bb89
[gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
3463 gtk_file_selection_set_filename(GTK_FILE_SELECTION(importdialog), buf); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3464 g_signal_connect(GTK_OBJECT(importdialog), "destroy", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3465 G_CALLBACK(destroy_dialog), importdialog); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3466 |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3467 g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(importdialog)->ok_button), |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3468 "clicked", G_CALLBACK(do_import_dialog), NULL); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3469 g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(importdialog)->cancel_button), |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3470 "clicked", G_CALLBACK(destroy_dialog), importdialog); |
2382
569ae9f2bb89
[gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
3471 |
2493
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3472 create_import_dropdown(GTK_FILE_SELECTION(importdialog)); |
228 | 3473 } |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
3474 |
2382
569ae9f2bb89
[gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
3475 g_free(buf); |
569ae9f2bb89
[gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
3476 gtk_widget_show(importdialog); |
569ae9f2bb89
[gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
3477 gdk_window_raise(importdialog->window); |
1 | 3478 } |
3479 | |
3480 /*------------------------------------------------------------------------*/ | |
3481 /* The dialog for new away messages */ | |
3482 /*------------------------------------------------------------------------*/ | |
3483 | |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3484 static struct away_message *save_away_message(struct create_away *ca) |
717 | 3485 { |
3486 struct away_message *am; | |
3487 gchar *away_message; | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3488 |
832
0142b4c66394
[gaim-migrate @ 842]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
825
diff
changeset
|
3489 if (!ca->mess) |
0142b4c66394
[gaim-migrate @ 842]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
825
diff
changeset
|
3490 am = g_new0(struct away_message, 1); |
2851
6eb5bf5089f0
[gaim-migrate @ 2864]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2827
diff
changeset
|
3491 else { |
832
0142b4c66394
[gaim-migrate @ 842]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
825
diff
changeset
|
3492 am = ca->mess; |
2851
6eb5bf5089f0
[gaim-migrate @ 2864]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2827
diff
changeset
|
3493 } |
1387 | 3494 |
4119 | 3495 |
717 | 3496 g_snprintf(am->name, sizeof(am->name), "%s", gtk_entry_get_text(GTK_ENTRY(ca->entry))); |
4119 | 3497 away_message = gtk_text_view_get_text(GTK_TEXT_VIEW(ca->text), FALSE); |
717 | 3498 |
3499 g_snprintf(am->message, sizeof(am->message), "%s", away_message); | |
3500 g_free(away_message); | |
3501 | |
832
0142b4c66394
[gaim-migrate @ 842]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
825
diff
changeset
|
3502 if (!ca->mess) { |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3503 away_messages = g_slist_insert_sorted(away_messages, am, sort_awaymsg_list); |
832
0142b4c66394
[gaim-migrate @ 842]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
825
diff
changeset
|
3504 } |
0142b4c66394
[gaim-migrate @ 842]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
825
diff
changeset
|
3505 |
717 | 3506 save_prefs(); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3507 do_away_menu(); |
832
0142b4c66394
[gaim-migrate @ 842]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
825
diff
changeset
|
3508 if (prefs_away_list != NULL) |
940 | 3509 gtk_list_select_item(GTK_LIST(prefs_away_list), g_slist_index(away_messages, am)); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3510 |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3511 return am; |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3512 } |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3513 |
1387 | 3514 int check_away_mess(struct create_away *ca, int type) |
3515 { | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3516 if ((strlen(gtk_entry_get_text(GTK_ENTRY(ca->entry))) == 0) && (type == 1)) { |
1387 | 3517 /* We shouldn't allow a blank title */ |
3427 | 3518 do_error_dialog(_("You cannot save an away message with a blank title"), |
3519 _("Please give the message a title, or choose \"Make Away\" to use " | |
3520 "without saving."), GAIM_ERROR); | |
1387 | 3521 return 0; |
3522 } | |
3523 | |
4119 | 3524 if (!gtk_text_view_get_text(GTK_TEXT_VIEW(ca->text), FALSE) && (type <= 1)) { |
1387 | 3525 /* We shouldn't allow a blank message */ |
3427 | 3526 do_error_dialog(_("You cannot create an empty away message"), NULL, GAIM_ERROR); |
1387 | 3527 return 0; |
3528 } | |
3529 | |
3530 return 1; | |
3531 } | |
3532 | |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3533 void save_away_mess(GtkWidget *widget, struct create_away *ca) |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3534 { |
1387 | 3535 if (!check_away_mess(ca, 1)) |
3536 return; | |
3537 | |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3538 save_away_message(ca); |
717 | 3539 destroy_dialog(NULL, ca->window); |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3540 g_free(ca); |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3541 } |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3542 |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3543 void use_away_mess(GtkWidget *widget, struct create_away *ca) |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3544 { |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3545 static struct away_message am; |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3546 gchar *away_message; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3547 |
1387 | 3548 if (!check_away_mess(ca, 0)) |
3549 return; | |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3550 |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3551 g_snprintf(am.name, sizeof(am.name), "%s", gtk_entry_get_text(GTK_ENTRY(ca->entry))); |
4119 | 3552 away_message = gtk_text_view_get_text(GTK_TEXT_VIEW(ca->text), FALSE); |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3553 |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3554 g_snprintf(am.message, sizeof(am.message), "%s", away_message); |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3555 g_free(away_message); |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3556 |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3557 do_away_message(NULL, &am); |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3558 |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3559 destroy_dialog(NULL, ca->window); |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3560 g_free(ca); |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3561 } |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3562 |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3563 void su_away_mess(GtkWidget *widget, struct create_away *ca) |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3564 { |
1387 | 3565 if (!check_away_mess(ca, 1)) |
3566 return; | |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3567 do_away_message(NULL, save_away_message(ca)); |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3568 destroy_dialog(NULL, ca->window); |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3569 g_free(ca); |
717 | 3570 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3571 |
1 | 3572 void create_away_mess(GtkWidget *widget, void *dummy) |
3573 { | |
439 | 3574 GtkWidget *hbox; |
1 | 3575 GtkWidget *titlebox; |
3576 GtkWidget *tbox; | |
3577 GtkWidget *label; | |
439 | 3578 GtkWidget *frame; |
3579 GtkWidget *fbox; | |
441 | 3580 GtkWidget *button; |
1 | 3581 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3582 struct create_away *ca = g_new0(struct create_away, 1); |
1185 | 3583 |
1 | 3584 /* Set up window */ |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
3585 GAIM_DIALOG(ca->window); |
1369
0b4278a90323
[gaim-migrate @ 1379]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1365
diff
changeset
|
3586 gtk_widget_set_usize(ca->window, -1, 250); |
441 | 3587 gtk_container_border_width(GTK_CONTAINER(ca->window), 5); |
4074 | 3588 gtk_window_set_role(GTK_WINDOW(ca->window), "away_mess"); |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
3589 gtk_window_set_title(GTK_WINDOW(ca->window), _("Gaim - New away message")); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3590 g_signal_connect(GTK_OBJECT(ca->window), "delete_event", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3591 G_CALLBACK(destroy_dialog), ca->window); |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3592 gtk_widget_realize(ca->window); |
1185 | 3593 |
3594 tbox = gtk_vbox_new(FALSE, 5); | |
3595 gtk_container_add(GTK_CONTAINER(ca->window), tbox); | |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3596 gtk_widget_show(tbox); |
439 | 3597 |
3598 frame = gtk_frame_new(_("New away message")); | |
1185 | 3599 gtk_box_pack_start(GTK_BOX(tbox), frame, TRUE, TRUE, 0); |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3600 gtk_widget_show(frame); |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3601 |
1172 | 3602 fbox = gtk_vbox_new(FALSE, 5); |
1224
0bbe3aaa6a3e
[gaim-migrate @ 1234]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1216
diff
changeset
|
3603 gtk_container_set_border_width(GTK_CONTAINER(fbox), 5); |
1185 | 3604 gtk_container_add(GTK_CONTAINER(frame), fbox); |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3605 gtk_widget_show(fbox); |
1185 | 3606 |
3607 titlebox = gtk_hbox_new(FALSE, 5); | |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3608 gtk_box_pack_start(GTK_BOX(fbox), titlebox, FALSE, FALSE, 0); |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3609 gtk_widget_show(titlebox); |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3610 |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
3611 label = gtk_label_new(_("Away title: ")); |
1172 | 3612 gtk_box_pack_start(GTK_BOX(titlebox), label, FALSE, FALSE, 0); |
441 | 3613 gtk_widget_show(label); |
1185 | 3614 |
1 | 3615 ca->entry = gtk_entry_new(); |
1172 | 3616 gtk_box_pack_start(GTK_BOX(titlebox), ca->entry, TRUE, TRUE, 0); |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3617 gtk_widget_grab_focus(ca->entry); |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3618 gtk_widget_show(ca->entry); |
1 | 3619 |
4119 | 3620 frame = gtk_frame_new(NULL); |
3621 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN); | |
3622 gtk_box_pack_start(GTK_BOX(fbox), frame, TRUE, TRUE, 0); | |
3623 gtk_widget_show(frame); | |
3624 | |
3625 ca->text = gtk_text_view_new(); | |
3626 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(ca->text), GTK_WRAP_WORD); | |
3627 | |
3628 gtk_container_add(GTK_CONTAINER(frame), ca->text); | |
1 | 3629 gtk_widget_show(ca->text); |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3630 |
3374 | 3631 |
3632 if (dummy) { | |
3633 struct away_message *amt; | |
3634 GtkTreeIter iter; | |
3635 int pos = 0; | |
3636 GtkListStore *ls = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(dummy))); | |
3637 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(dummy)); | |
3638 GValue val = { 0, }; | |
4119 | 3639 GtkTextIter start; |
3640 GtkTextBuffer *buffer; | |
3374 | 3641 |
3716
d7e83b4db191
[gaim-migrate @ 3849]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3671
diff
changeset
|
3642 if (! gtk_tree_selection_get_selected (sel, (GtkTreeModel**)&ls, &iter)) |
3374 | 3643 return; |
3716
d7e83b4db191
[gaim-migrate @ 3849]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3671
diff
changeset
|
3644 gtk_tree_model_get_value (GTK_TREE_MODEL(ls), &iter, 1, &val); |
3374 | 3645 amt = g_value_get_pointer (&val); |
3646 gtk_entry_set_text(GTK_ENTRY(ca->entry), amt->name); | |
4119 | 3647 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(ca->text)); |
3648 gtk_text_buffer_get_iter_at_offset(buffer, &start, pos); | |
3649 gtk_text_buffer_insert(buffer, &start, amt->message, strlen(amt->message)); | |
3650 | |
3374 | 3651 ca->mess = amt; |
3652 } | |
832
0142b4c66394
[gaim-migrate @ 842]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
825
diff
changeset
|
3653 |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3654 hbox = gtk_hbox_new(FALSE, 5); |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3655 gtk_box_pack_start(GTK_BOX(tbox), hbox, FALSE, FALSE, 0); |
439 | 3656 gtk_widget_show(hbox); |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3657 |
4092 | 3658 button = picture_button(ca->window, _("Save"), ok_xpm); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3659 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(save_away_mess), ca); |
4092 | 3660 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); |
3661 | |
3662 button = picture_button(ca->window, _("Save & Use"), add_xpm); | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3663 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(su_away_mess), ca); |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3664 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3665 |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3666 button = picture_button(ca->window, _("Use"), gnome_preferences_xpm); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3667 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(use_away_mess), ca); |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3668 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3669 |
4092 | 3670 button = picture_button(ca->window, _("Cancel"), cancel_xpm); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3671 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(destroy_dialog), ca->window); |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3672 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3673 |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3674 gtk_widget_show(ca->window); |
1 | 3675 } |
555 | 3676 |
3677 /* smiley dialog */ | |
3678 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3679 void close_smiley_dialog(GtkWidget *widget, struct gaim_conversation *c) |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3680 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3681 struct gaim_gtk_conversation *gtkconv; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3682 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3683 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3684 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3685 if (gtkconv->toolbar.smiley) { |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3686 gaim_gtk_set_state_lock(TRUE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3687 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(gtkconv->toolbar.smiley), |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3688 FALSE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3689 gaim_gtk_set_state_lock(FALSE); |
570 | 3690 } |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3691 dialogwindows = g_list_remove(dialogwindows, gtkconv->dialogs.smiley); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3692 gtk_widget_destroy(gtkconv->dialogs.smiley); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3693 gtkconv->dialogs.smiley = NULL; |
555 | 3694 } |
3695 | |
3035 | 3696 void set_smiley(GtkWidget *w, char *face) |
3697 { | |
3698 current_smiley = face; | |
3699 } | |
3700 | |
555 | 3701 void set_smiley_array(GtkWidget *widget, int smiley_type) |
3702 { | |
3703 int i; | |
3704 | |
3705 for (i = 0; i < FACE_TOTAL; i++) | |
3706 smiley_array[i] = 0; | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3707 |
555 | 3708 smiley_array[smiley_type] = 1; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3709 |
555 | 3710 return; |
3711 } | |
3712 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3713 void insert_smiley_text(GtkWidget *widget, struct gaim_conversation *c) |
555 | 3714 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3715 struct gaim_gtk_conversation *gtkconv; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3716 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3717 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3718 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3719 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, current_smiley, -1); |
555 | 3720 close_smiley_dialog(NULL, c); |
3721 } | |
579
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
3722 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3723 static void toolbar_add_smiley(struct gaim_conversation *c, GtkWidget *bar, char* path, char *filename, char *face) |
4034 | 3724 { |
4061
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3725 GtkWidget *image; |
4034 | 3726 GtkWidget *button; |
4061
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3727 char *buf; |
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3728 |
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3729 buf = g_build_filename(path, filename, NULL); |
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3730 image = gtk_image_new_from_file(buf); |
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3731 g_free(buf); |
4034 | 3732 button = |
3733 gtk_toolbar_append_item(GTK_TOOLBAR(bar), NULL, NULL, NULL, | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3734 image, G_CALLBACK(set_smiley), (char *)face); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3735 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(insert_smiley_text), c); |
4034 | 3736 |
3737 /* these look really weird with borders */ | |
3738 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
3739 } | |
3740 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3741 void show_smiley_dialog(struct gaim_conversation *c, GtkWidget *widget) |
555 | 3742 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3743 struct gaim_gtk_conversation *gtkconv; |
555 | 3744 GtkWidget *dialog; |
3035 | 3745 GtkWidget *vbox, *smiley_box = NULL; |
555 | 3746 GtkWidget *win; |
582 | 3747 GtkWidget *bbox; |
4061
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3748 char *smiley_path = 0; |
555 | 3749 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3750 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3751 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3752 if (gtkconv->dialogs.smiley) |
558
f1b8f03db83f
[gaim-migrate @ 568]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
555
diff
changeset
|
3753 return; |
579
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
3754 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3755 win = GAIM_GTK_WINDOW(gaim_conversation_get_window(c))->window; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3756 |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
3757 GAIM_DIALOG(dialog); |
905 | 3758 gtk_window_set_policy(GTK_WINDOW(dialog), FALSE, FALSE, TRUE); |
4074 | 3759 gtk_window_set_role(GTK_WINDOW(dialog), "smiley_dialog"); |
934 | 3760 gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_MOUSE); |
579
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
3761 |
555 | 3762 /* setup boxes */ |
582 | 3763 vbox = gtk_vbox_new(TRUE, 5); |
3764 bbox = gtk_hbox_new(FALSE, 5); | |
3765 | |
555 | 3766 |
3767 /* setup buttons */ | |
3768 | |
3769 /* pack buttons */ | |
3035 | 3770 |
4044 | 3771 smiley_box = gtk_toolbar_new(); |
3772 gtk_box_pack_start(GTK_BOX(vbox), smiley_box, TRUE, TRUE, 0); | |
4060 | 3773 |
4061
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3774 smiley_path = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", NULL); |
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3775 toolbar_add_smiley(c, smiley_box, smiley_path, "angel.png", "O:-)"); |
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3776 toolbar_add_smiley(c, smiley_box, smiley_path, "bigsmile.png", ":-D"); |
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3777 toolbar_add_smiley(c, smiley_box, smiley_path, "burp.png", ":-!"); |
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3778 toolbar_add_smiley(c, smiley_box, smiley_path, "crossedlips.png", ":-X"); |
4044 | 3779 |
3780 smiley_box = gtk_toolbar_new(); | |
3781 gtk_box_pack_start(GTK_BOX(vbox), smiley_box, TRUE, TRUE, 0); | |
4061
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3782 toolbar_add_smiley(c, smiley_box, smiley_path, "cry.png", ":'("); |
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3783 toolbar_add_smiley(c, smiley_box, smiley_path, "embarrassed.png", ":-["); |
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3784 toolbar_add_smiley(c, smiley_box, smiley_path, "kiss.png", ":-*"); |
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3785 toolbar_add_smiley(c, smiley_box, smiley_path, "moneymouth.png", ":-$"); |
4044 | 3786 |
3787 smiley_box = gtk_toolbar_new(); | |
3788 gtk_box_pack_start(GTK_BOX(vbox), smiley_box, TRUE, TRUE, 0); | |
4061
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3789 toolbar_add_smiley(c, smiley_box, smiley_path, "sad.png", ":-("); |
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3790 toolbar_add_smiley(c, smiley_box, smiley_path, "scream.png", "=-O"); |
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3791 toolbar_add_smiley(c, smiley_box, smiley_path, "smile.png", ":-)"); |
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3792 toolbar_add_smiley(c, smiley_box, smiley_path, "cool.png", "8-)"); |
4044 | 3793 |
3794 smiley_box = gtk_toolbar_new(); | |
3795 gtk_box_pack_start(GTK_BOX(vbox), smiley_box, TRUE, TRUE, 0); | |
4061
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3796 toolbar_add_smiley(c, smiley_box, smiley_path, "think.png", ":-/"); |
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3797 toolbar_add_smiley(c, smiley_box, smiley_path, "tongue.png", ":-P"); |
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3798 toolbar_add_smiley(c, smiley_box, smiley_path, "wink.png", ";-)"); |
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3799 toolbar_add_smiley(c, smiley_box, smiley_path, "yell.png", ">:o"); |
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3800 |
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3801 g_free(smiley_path); |
582 | 3802 |
3803 gtk_container_add(GTK_CONTAINER(dialog), vbox); | |
579
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
3804 gtk_container_set_border_width(GTK_CONTAINER(dialog), 5); |
555 | 3805 |
605 | 3806 /* connect signals */ |
3807 gtk_object_set_user_data(GTK_OBJECT(dialog), "smiley dialog"); | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3808 g_signal_connect(G_OBJECT(dialog), "delete_event", |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3809 G_CALLBACK(delete_event_dialog), c); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3810 |
555 | 3811 /* show everything */ |
567
102afb84ce45
[gaim-migrate @ 577]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
558
diff
changeset
|
3812 gtk_window_set_title(GTK_WINDOW(dialog), _("Smile!")); |
584 | 3813 gtk_widget_show_all(dialog); |
555 | 3814 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3815 gtkconv->dialogs.smiley = dialog; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3816 |
555 | 3817 return; |
558
f1b8f03db83f
[gaim-migrate @ 568]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
555
diff
changeset
|
3818 } |
710
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
699
diff
changeset
|
3819 |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3820 static void do_alias_bud(GtkWidget *w, struct buddy *b) |
710
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
699
diff
changeset
|
3821 { |
3466 | 3822 const char *al = gtk_entry_get_text(GTK_ENTRY(aliasname)); |
4227 | 3823 if (al && strlen(al)) |
3824 g_snprintf(b->alias, sizeof(b->alias), "%s", al); | |
3825 else | |
3826 b->alias[0] = '\0'; | |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3827 handle_buddy_rename(b, b->name); |
3136 | 3828 serv_alias_buddy(b); |
4349 | 3829 gaim_blist_save(); |
710
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
699
diff
changeset
|
3830 destroy_dialog(aliasdlg, aliasdlg); |
1397
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3831 } |
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3832 |
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3833 void alias_dialog_bud(struct buddy *b) |
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3834 { |
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3835 GtkWidget *vbox; |
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3836 GtkWidget *bbox; |
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3837 GtkWidget *cancel; |
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3838 static GtkWidget *add = NULL; |
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3839 GtkWidget *label; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3840 GtkWidget *topbox; |
1397
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3841 static int a, c; |
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3842 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3843 if (aliasdlg) |
1397
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3844 gtk_widget_destroy(aliasdlg); |
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3845 |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
3846 GAIM_DIALOG(aliasdlg); |
1397
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3847 gtk_window_set_policy(GTK_WINDOW(aliasdlg), FALSE, FALSE, TRUE); |
4074 | 3848 gtk_window_set_role(GTK_WINDOW(aliasdlg), "alias_dialog"); |
1397
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3849 gtk_widget_realize(aliasdlg); |
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3850 dialogwindows = g_list_prepend(dialogwindows, aliasdlg); |
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3851 |
4092 | 3852 topbox = gtk_vbox_new(FALSE, 5); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3853 vbox = gtk_vbox_new(FALSE, 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3854 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3855 aliasentry = gtk_entry_new(); |
1397
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3856 aliasname = gtk_entry_new(); |
4092 | 3857 |
3858 /* Make the buddy name box */ | |
3859 bbox = gtk_hbox_new(FALSE, 5); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3860 label = gtk_label_new(_("Buddy")); |
4092 | 3861 gtk_widget_show(bbox); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3862 gtk_widget_show(label); |
4092 | 3863 gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 5); |
3864 gtk_box_pack_end(GTK_BOX(bbox), aliasentry, FALSE, FALSE, 5); | |
1397
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3865 gtk_entry_set_editable(GTK_ENTRY(aliasentry), FALSE); |
4092 | 3866 gtk_box_pack_start(GTK_BOX(topbox), bbox, FALSE, FALSE, 0); |
3867 | |
3868 /* And the buddy alias box */ | |
3869 bbox = gtk_hbox_new(FALSE, 5); | |
1397
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3870 label = gtk_label_new(_("Alias")); |
4092 | 3871 gtk_widget_show(bbox); |
1397
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3872 gtk_widget_show(label); |
4092 | 3873 gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 5); |
3874 gtk_box_pack_end(GTK_BOX(bbox), aliasname, FALSE, FALSE, 5); | |
3875 gtk_box_pack_start(GTK_BOX(topbox), bbox, FALSE, FALSE, 0); | |
1397
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3876 |
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3877 gtk_entry_set_text(GTK_ENTRY(aliasentry), b->name); |
4227 | 3878 gtk_entry_set_text(GTK_ENTRY(aliasname), b->alias); |
1397
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3879 |
4092 | 3880 /* Put the buttons in the box */ |
3881 bbox = gtk_hbox_new(FALSE, 5); | |
3882 | |
3883 add = picture_button(aliasdlg, _("Alias"), add_xpm); | |
3884 cancel = picture_button(aliasdlg, _("Cancel"), cancel_xpm); | |
3885 gtk_box_pack_end(GTK_BOX(bbox), add, FALSE, FALSE, 0); | |
3886 gtk_box_pack_end(GTK_BOX(bbox), cancel, FALSE, FALSE, 0); | |
3887 | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3888 /* And the boxes in the box */ |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3889 gtk_box_pack_start(GTK_BOX(vbox), topbox, TRUE, TRUE, 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3890 gtk_box_pack_start(GTK_BOX(vbox), bbox, TRUE, TRUE, 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3891 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3892 /* Handle closes right */ |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3893 g_signal_connect(GTK_OBJECT(aliasdlg), "destroy", G_CALLBACK(destroy_dialog), aliasdlg); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3894 g_signal_connect(GTK_OBJECT(cancel), "clicked", G_CALLBACK(destroy_dialog), aliasdlg); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3895 a = g_signal_connect(GTK_OBJECT(add), "clicked", G_CALLBACK(do_alias_bud), b); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3896 c = g_signal_connect(GTK_OBJECT(aliasname), "activate", G_CALLBACK(do_alias_bud), b); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3897 /* Finish up */ |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3898 gtk_widget_show(add); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3899 gtk_widget_show(cancel); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3900 gtk_widget_show(aliasentry); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3901 gtk_widget_show(aliasname); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3902 gtk_widget_show(topbox); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3903 gtk_widget_show(bbox); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3904 gtk_widget_show(vbox); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3905 gtk_window_set_title(GTK_WINDOW(aliasdlg), _("Gaim - Alias Buddy")); |
4092 | 3906 gtk_window_set_focus(GTK_WINDOW(aliasdlg), aliasname); |
3907 gtk_container_add(GTK_CONTAINER(aliasdlg), vbox); | |
1397
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3908 gtk_container_set_border_width(GTK_CONTAINER(aliasdlg), 5); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3909 gtk_widget_realize(aliasdlg); |
1397
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3910 |
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3911 gtk_widget_show(aliasdlg); |
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3912 } |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
3913 |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
3914 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3915 static gboolean dont_destroy(gpointer a, gpointer b, gpointer c) |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3916 { |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
3917 return TRUE; |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
3918 } |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
3919 |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3920 static void do_save_log(GtkWidget *w, GtkWidget *filesel) |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3921 { |
3716
d7e83b4db191
[gaim-migrate @ 3849]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3671
diff
changeset
|
3922 const char *file; |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3923 char path[PATHSIZE]; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3924 char buf[BUF_LONG]; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3925 char error[BUF_LEN]; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3926 FILE *fp_old, *fp_new; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3927 char filename[PATHSIZE]; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3928 char *name; |
1722
1edc8b545d6f
[gaim-migrate @ 1732]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
3929 char *tmp; |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3930 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3931 name = gtk_object_get_user_data(GTK_OBJECT(filesel)); |
1722
1edc8b545d6f
[gaim-migrate @ 1732]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
3932 tmp = gaim_user_dir(); |
3630 | 3933 g_snprintf(filename, PATHSIZE, "%s" G_DIR_SEPARATOR_S "logs" G_DIR_SEPARATOR_S "%s%s", tmp, |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3934 name ? normalize(name) : "system", name ? ".log" : ""); |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3935 |
3716
d7e83b4db191
[gaim-migrate @ 3849]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3671
diff
changeset
|
3936 file = (const char*)gtk_file_selection_get_filename(GTK_FILE_SELECTION(filesel)); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3937 strncpy(path, file, PATHSIZE - 1); |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3938 if (file_is_dir(path, filesel)) |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3939 return; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3940 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3941 if ((fp_new = fopen(path, "w")) == NULL) { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3942 g_snprintf(error, BUF_LONG, |
3427 | 3943 _("Couldn't write to %s."), path); |
3944 do_error_dialog(error, strerror(errno), GAIM_ERROR); | |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3945 return; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3946 } |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3947 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3948 if ((fp_old = fopen(filename, "r")) == NULL) { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3949 g_snprintf(error, BUF_LONG, |
3427 | 3950 _("Couldn't write to %s."), filename); |
3951 do_error_dialog(error, strerror(errno), GAIM_ERROR); | |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3952 fclose(fp_new); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3953 return; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3954 } |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3955 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3956 while (fgets(buf, BUF_LONG, fp_old)) |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3957 fputs(buf, fp_new); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3958 fclose(fp_old); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3959 fclose(fp_new); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3960 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3961 gtk_widget_destroy(filesel); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3962 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3963 return; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3964 } |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3965 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3966 static void show_save_log(GtkWidget *w, gchar *name) |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3967 { |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3968 GtkWidget *filesel; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3969 gchar buf[BUF_LEN]; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3970 |
3630 | 3971 g_snprintf(buf, BUF_LEN - 1, "%s" G_DIR_SEPARATOR_S "%s%s", gaim_home_dir(), |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3972 name ? normalize(name) : "system", name ? ".log" : ""); |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3973 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3974 filesel = gtk_file_selection_new(_("Gaim - Save Log File")); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3975 g_signal_connect(GTK_OBJECT(filesel), "delete_event", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3976 G_CALLBACK(destroy_dialog), filesel); |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3977 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3978 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(filesel)); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3979 gtk_file_selection_set_filename(GTK_FILE_SELECTION(filesel), buf); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3980 g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(filesel)->ok_button), |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3981 "clicked", G_CALLBACK(do_save_log), filesel); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3982 g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(filesel)->cancel_button), |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3983 "clicked", G_CALLBACK(destroy_dialog), filesel); |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3984 gtk_object_set_user_data(GTK_OBJECT(filesel), name); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3985 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3986 gtk_widget_realize(filesel); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3987 gtk_widget_show(filesel); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3988 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3989 return; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3990 } |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3991 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3992 static void do_clear_log_file(GtkWidget *w, gchar *name) |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3993 { |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3994 gchar buf[256]; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3995 gchar filename[256]; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3996 GtkWidget *window; |
1722
1edc8b545d6f
[gaim-migrate @ 1732]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
3997 char *tmp; |
1edc8b545d6f
[gaim-migrate @ 1732]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
3998 |
1edc8b545d6f
[gaim-migrate @ 1732]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
3999 tmp = gaim_user_dir(); |
3630 | 4000 g_snprintf(filename, 256, "%s" G_DIR_SEPARATOR_S "logs" G_DIR_SEPARATOR_S "%s%s", tmp, |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
4001 name ? normalize(name) : "system", name ? ".log" : ""); |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4002 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4003 if ((remove(filename)) == -1) { |
3427 | 4004 g_snprintf(buf, 256, _("Couldn't remove file %s." ), filename); |
4005 do_error_dialog(buf, strerror(errno), GAIM_ERROR); | |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4006 } |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4007 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4008 window = gtk_object_get_user_data(GTK_OBJECT(w)); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4009 destroy_dialog(NULL, window); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4010 } |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4011 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
4012 static void show_clear_log(GtkWidget *w, gchar *name) |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4013 { |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4014 GtkWidget *window; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4015 GtkWidget *box; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4016 GtkWidget *hbox; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4017 GtkWidget *button; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4018 GtkWidget *label; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4019 GtkWidget *hsep; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4020 |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
4021 GAIM_DIALOG(window); |
4074 | 4022 gtk_window_set_role(GTK_WINDOW(window), "dialog"); |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4023 gtk_container_set_border_width(GTK_CONTAINER(window), 10); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4024 gtk_window_set_policy(GTK_WINDOW(window), TRUE, TRUE, TRUE); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4025 g_signal_connect(GTK_OBJECT(window), "delete_event", G_CALLBACK(destroy_dialog), window); |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4026 gtk_widget_realize(window); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4027 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4028 box = gtk_vbox_new(FALSE, 5); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4029 gtk_container_add(GTK_CONTAINER(window), box); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4030 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4031 label = gtk_label_new(_("Really clear log?")); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4032 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 15); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4033 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4034 hsep = gtk_hseparator_new(); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4035 gtk_box_pack_start(GTK_BOX(box), hsep, FALSE, FALSE, 0); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4036 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4037 hbox = gtk_hbox_new(FALSE, 0); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
4038 gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0); |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4039 gtk_widget_show(hbox); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4040 |
4333 | 4041 button = picture_button(window, _("Okay"), ok_xpm); |
4042 gtk_object_set_user_data(GTK_OBJECT(button), gtk_object_get_user_data(GTK_OBJECT(w))); | |
4043 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(do_clear_log_file), name); | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4044 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(destroy_dialog), window); |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4045 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4046 gtk_widget_show(button); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4047 |
4333 | 4048 button = picture_button(window, _("Cancel"), cancel_xpm); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4049 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(destroy_dialog), window); |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4050 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4051 gtk_widget_show(button); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4052 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4053 gtk_widget_show_all(window); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4054 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4055 return; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4056 } |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4057 |
2621
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4058 static void log_show_convo(GtkWidget *w, struct view_log *view) |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4059 { |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4060 gchar buf[BUF_LONG]; |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4061 FILE *fp; |
2570 | 4062 char filename[256]; |
4063 int i=0; | |
4064 GString *string; | |
2602 | 4065 guint block; |
4066 | |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4067 string = g_string_new(""); |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4068 |
2621
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4069 if (view->name) { |
1634
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1535
diff
changeset
|
4070 char *tmp = gaim_user_dir(); |
3630 | 4071 g_snprintf(filename, 256, "%s" G_DIR_SEPARATOR_S "logs" G_DIR_SEPARATOR_S "%s.log", tmp, normalize(view->name)); |
1634
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1535
diff
changeset
|
4072 } else { |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1535
diff
changeset
|
4073 char *tmp = gaim_user_dir(); |
3630 | 4074 g_snprintf(filename, 256, "%s" G_DIR_SEPARATOR_S "logs" G_DIR_SEPARATOR_S "system", tmp); |
1634
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1535
diff
changeset
|
4075 } |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4076 if ((fp = fopen(filename, "r")) == NULL) { |
3427 | 4077 g_snprintf(buf, BUF_LONG, "Couldn't open log file %s.", filename); |
4078 do_error_dialog(buf, strerror(errno), GAIM_ERROR); | |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4079 return; |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4080 } |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4081 |
2621
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4082 gtk_widget_set_sensitive(view->bbox, FALSE); |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4083 gtk_signal_disconnect_by_func(GTK_OBJECT(view->window), |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4084 G_CALLBACK(destroy_dialog), view->window); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4085 block = g_signal_connect(GTK_OBJECT(view->window), "delete_event", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4086 G_CALLBACK(dont_destroy), view->window); |
2621
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4087 |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4088 fseek(fp, view->offset, SEEK_SET); |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4089 gtk_imhtml_clear(GTK_IMHTML(view->layout)); |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4090 /* |
2570 | 4091 while (gtk_events_pending()) |
4092 gtk_main_iteration(); | |
2621
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4093 */ |
2570 | 4094 |
4095 while (fgets(buf, BUF_LONG, fp) && !strstr(buf, "---- New C")) { | |
4096 i++; | |
4097 if (strlen(buf) >= 5 && (!strncmp(buf + strlen(buf) - 5, "<BR>\n", 5))) | |
4098 /* take off the \n */ | |
4099 buf[strlen(buf) - 1] = '\0'; | |
4100 | |
2642
b6cf22276d4b
[gaim-migrate @ 2655]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2623
diff
changeset
|
4101 /* don't lose the thirtieth line of conversation. thanks FeRD */ |
b6cf22276d4b
[gaim-migrate @ 2655]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2623
diff
changeset
|
4102 g_string_append(string, buf); |
b6cf22276d4b
[gaim-migrate @ 2655]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2623
diff
changeset
|
4103 |
2570 | 4104 if (i == 30) { |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2851
diff
changeset
|
4105 gtk_imhtml_append_text(GTK_IMHTML(view->layout), string->str, -1, view->options); |
2570 | 4106 g_string_free(string, TRUE); |
4107 string = g_string_new(""); | |
2621
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4108 /* you can't have these anymore. if someone clicks on another item while one is |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4109 * drawing, it will try to move to that item, and that causes problems here. |
2570 | 4110 while (gtk_events_pending()) |
4111 gtk_main_iteration(); | |
2621
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4112 */ |
2570 | 4113 i = 0; |
4114 } | |
4115 | |
4116 } | |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2851
diff
changeset
|
4117 gtk_imhtml_append_text(GTK_IMHTML(view->layout), string->str, -1, view->options); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2851
diff
changeset
|
4118 gtk_imhtml_append_text(GTK_IMHTML(view->layout), "<BR>", -1, view->options); |
2621
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4119 |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4120 gtk_widget_set_sensitive(view->bbox, TRUE); |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4121 gtk_signal_disconnect(GTK_OBJECT(view->window), block); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4122 g_signal_connect(GTK_OBJECT(view->window), "delete_event", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4123 G_CALLBACK(destroy_dialog), view->window); |
2570 | 4124 g_string_free(string, TRUE); |
4125 fclose(fp); | |
4126 } | |
4127 | |
2621
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4128 static void des_view_item(GtkObject *obj, struct view_log *view) |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4129 { |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4130 if (view->name) |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4131 g_free(view->name); |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4132 g_free(view); |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4133 } |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4134 |
2623
66164831c228
[gaim-migrate @ 2636]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2621
diff
changeset
|
4135 static void des_log_win(GtkObject *win, gpointer data) |
66164831c228
[gaim-migrate @ 2636]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2621
diff
changeset
|
4136 { |
66164831c228
[gaim-migrate @ 2636]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2621
diff
changeset
|
4137 char *x = gtk_object_get_user_data(win); |
66164831c228
[gaim-migrate @ 2636]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2621
diff
changeset
|
4138 if (x) |
66164831c228
[gaim-migrate @ 2636]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2621
diff
changeset
|
4139 g_free(x); |
66164831c228
[gaim-migrate @ 2636]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2621
diff
changeset
|
4140 } |
66164831c228
[gaim-migrate @ 2636]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2621
diff
changeset
|
4141 |
3484 | 4142 void conv_show_log(GtkWidget *w, gpointer data) |
4143 { | |
4144 char *name = g_strdup(data); | |
4145 show_log(name); | |
4146 g_free(name); | |
4147 } | |
4148 | |
3532 | 4149 void chat_show_log(GtkWidget *w, gpointer data) |
4150 { | |
3716
d7e83b4db191
[gaim-migrate @ 3849]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3671
diff
changeset
|
4151 char *name = g_strdup_printf("%s.chat", (char*)data); |
3532 | 4152 show_log(name); |
4153 g_free(name); | |
4154 } | |
4155 | |
2623
66164831c228
[gaim-migrate @ 2636]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2621
diff
changeset
|
4156 void show_log(char *nm) |
2570 | 4157 { |
4158 gchar filename[256]; | |
4159 gchar buf[BUF_LONG]; | |
4160 FILE *fp; | |
4161 GtkWidget *window; | |
4162 GtkWidget *box; | |
4163 GtkWidget *hbox; | |
2602 | 4164 GtkWidget *bbox; |
2570 | 4165 GtkWidget *sw; |
4166 GtkWidget *layout; | |
4167 GtkWidget *close_button; | |
4168 GtkWidget *clear_button; | |
4169 GtkWidget *save_button; | |
2572
ad0d7c423669
[gaim-migrate @ 2585]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2571
diff
changeset
|
4170 GtkWidget *list = NULL; |
2612 | 4171 GList *item_list = NULL; |
4172 GtkWidget *item = NULL; | |
4173 GtkWidget *last = NULL; | |
2570 | 4174 GtkWidget *frame; |
2621
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4175 struct view_log *view; |
2623
66164831c228
[gaim-migrate @ 2636]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2621
diff
changeset
|
4176 char *name = nm ? g_strdup(nm) : NULL; |
2570 | 4177 |
4178 int options; | |
4179 guint block; | |
4180 char convo_start[32]; | |
4181 long offset = 0; | |
2612 | 4182 unsigned int i = 0; |
2570 | 4183 |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4184 options = GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_TITLE | GTK_IMHTML_NO_SCROLL; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2228
diff
changeset
|
4185 if (convo_options & OPT_CONVO_IGNORE_COLOUR) |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4186 options ^= GTK_IMHTML_NO_COLOURS; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2228
diff
changeset
|
4187 if (convo_options & OPT_CONVO_IGNORE_FONTS) |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4188 options ^= GTK_IMHTML_NO_FONTS; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2228
diff
changeset
|
4189 if (convo_options & OPT_CONVO_IGNORE_SIZES) |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4190 options ^= GTK_IMHTML_NO_SIZES; |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4191 |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4192 window = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
2623
66164831c228
[gaim-migrate @ 2636]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2621
diff
changeset
|
4193 gtk_object_set_user_data(GTK_OBJECT(window), name); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4194 g_signal_connect(GTK_OBJECT(window), "destroy", G_CALLBACK(des_log_win), NULL); |
4074 | 4195 gtk_window_set_role(GTK_WINDOW(window), "log"); |
1648
09445224e2d9
[gaim-migrate @ 1658]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1634
diff
changeset
|
4196 if (name) |
09445224e2d9
[gaim-migrate @ 1658]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1634
diff
changeset
|
4197 g_snprintf(buf, BUF_LONG, "Gaim - Conversations with %s", name); |
09445224e2d9
[gaim-migrate @ 1658]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1634
diff
changeset
|
4198 else |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
4199 g_snprintf(buf, BUF_LONG, "Gaim - System Log"); |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4200 gtk_window_set_title(GTK_WINDOW(window), buf); |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4201 gtk_container_set_border_width(GTK_CONTAINER(window), 10); |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4202 gtk_window_set_policy(GTK_WINDOW(window), TRUE, TRUE, TRUE); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4203 block = g_signal_connect(GTK_OBJECT(window), "delete_event", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4204 G_CALLBACK(dont_destroy), window); |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4205 gtk_widget_realize(window); |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4206 |
2570 | 4207 layout = gtk_imhtml_new(NULL, NULL); |
2602 | 4208 bbox = gtk_hbox_new(FALSE, 0); |
4209 | |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4210 box = gtk_vbox_new(FALSE, 5); |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4211 gtk_container_add(GTK_CONTAINER(window), box); |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4212 |
2570 | 4213 hbox = gtk_hbox_new(FALSE, 5); |
4214 gtk_box_pack_start(GTK_BOX(box), hbox, TRUE, TRUE, 0); | |
4215 | |
4216 if (name) { | |
4217 char *tmp = gaim_user_dir(); | |
3630 | 4218 g_snprintf(filename, 256, "%s" G_DIR_SEPARATOR_S "logs" G_DIR_SEPARATOR_S "%s.log", tmp, normalize(name)); |
2570 | 4219 if ((fp = fopen(filename, "r")) == NULL) { |
3427 | 4220 g_snprintf(buf, BUF_LONG, "Couldn't open log file %s", filename); |
4221 do_error_dialog(buf, strerror(errno), GAIM_ERROR); | |
2570 | 4222 return; |
4223 } | |
4224 | |
4225 list = gtk_list_new(); | |
4226 | |
4227 frame = gtk_frame_new(_("Date")); | |
4228 gtk_widget_show(frame); | |
4229 | |
4230 sw = gtk_scrolled_window_new(NULL, NULL); | |
4231 gtk_container_set_border_width(GTK_CONTAINER(sw), 5); | |
4232 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw), list); | |
2613
6f7e1fc3e132
[gaim-migrate @ 2626]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2612
diff
changeset
|
4233 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), |
6f7e1fc3e132
[gaim-migrate @ 2626]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2612
diff
changeset
|
4234 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
2571 | 4235 gtk_widget_set_usize(sw, 220, 220); |
2570 | 4236 gtk_container_add(GTK_CONTAINER(frame), sw); |
4237 gtk_box_pack_start(GTK_BOX(hbox), frame, TRUE, TRUE, 0); | |
4238 | |
4239 while (fgets(buf, BUF_LONG, fp)) { | |
4240 if (strstr(buf, "---- New C")) { | |
4241 int length; | |
4242 char *temp = strchr(buf, '@'); | |
2612 | 4243 |
2570 | 4244 if (temp == NULL || strlen(temp) < 2) |
4245 continue; | |
2612 | 4246 |
2613
6f7e1fc3e132
[gaim-migrate @ 2626]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2612
diff
changeset
|
4247 if (i == 1 && item_list) { |
6f7e1fc3e132
[gaim-migrate @ 2626]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2612
diff
changeset
|
4248 item_list = g_list_remove(item_list, last); |
6f7e1fc3e132
[gaim-migrate @ 2626]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2612
diff
changeset
|
4249 last = NULL; |
2612 | 4250 } |
4251 | |
4252 i = 0; | |
4253 | |
2570 | 4254 temp++; |
4255 length = strcspn(temp, "-"); | |
4256 if (length > 31) length = 31; | |
4257 | |
4258 offset = ftell(fp); | |
4259 g_snprintf(convo_start, length, "%s", temp); | |
4260 item = gtk_list_item_new_with_label(convo_start); | |
2621
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4261 view = g_new0(struct view_log, 1); |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4262 view->options = options; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4263 view->offset = offset; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4264 view->name = g_strdup(name); |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4265 view->bbox = bbox; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4266 view->window = window; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4267 view->layout = layout; |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4268 g_signal_connect(GTK_OBJECT(item), "select", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4269 G_CALLBACK(log_show_convo), view); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4270 g_signal_connect(GTK_OBJECT(item), "destroy", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4271 G_CALLBACK(des_view_item), view); |
2612 | 4272 last = item; |
4273 item_list = g_list_append(item_list, item); | |
2613
6f7e1fc3e132
[gaim-migrate @ 2626]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2612
diff
changeset
|
4274 |
2570 | 4275 gtk_widget_show(item); |
4276 } | |
2612 | 4277 i++; |
2570 | 4278 } |
4279 fclose(fp); | |
2613
6f7e1fc3e132
[gaim-migrate @ 2626]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2612
diff
changeset
|
4280 if (i == 1 && item_list) |
6f7e1fc3e132
[gaim-migrate @ 2626]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2612
diff
changeset
|
4281 item_list = g_list_remove(item_list, item); |
6f7e1fc3e132
[gaim-migrate @ 2626]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2612
diff
changeset
|
4282 |
2612 | 4283 if (item_list) |
2613
6f7e1fc3e132
[gaim-migrate @ 2626]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2612
diff
changeset
|
4284 gtk_list_insert_items(GTK_LIST(list), item_list, 0 ); |
2612 | 4285 } |
4286 | |
2602 | 4287 gtk_signal_disconnect(GTK_OBJECT(window), block); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4288 g_signal_connect(GTK_OBJECT(window), "delete_event", G_CALLBACK(destroy_dialog), window); |
2602 | 4289 |
2570 | 4290 frame = gtk_frame_new(_("Conversation")); |
4291 gtk_widget_show(frame); | |
4292 | |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4293 sw = gtk_scrolled_window_new(NULL, NULL); |
2570 | 4294 gtk_container_set_border_width(GTK_CONTAINER(sw), 5); |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4295 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
4333 | 4296 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4297 gtk_widget_set_usize(sw, 390, 220); |
2570 | 4298 gtk_container_add(GTK_CONTAINER(frame), sw); |
4299 gtk_box_pack_start(GTK_BOX(hbox), frame, TRUE, TRUE, 0); | |
4300 | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4301 g_signal_connect(GTK_OBJECT(layout), "url_clicked", G_CALLBACK(open_url), NULL); |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4302 gtk_container_add(GTK_CONTAINER(sw), layout); |
1815
f15d449b3167
[gaim-migrate @ 1825]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1805
diff
changeset
|
4303 gaim_setup_imhtml(layout); |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4304 |
2602 | 4305 gtk_box_pack_start(GTK_BOX(box), bbox, FALSE, FALSE, 0); |
4306 gtk_widget_set_sensitive(bbox, FALSE); | |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4307 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4308 close_button = picture_button(window, _("Close"), cancel_xpm); |
2602 | 4309 gtk_box_pack_end(GTK_BOX(bbox), close_button, FALSE, FALSE, 5); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4310 g_signal_connect(GTK_OBJECT(close_button), "clicked", G_CALLBACK(destroy_dialog), window); |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4311 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4312 clear_button = picture_button(window, _("Clear"), close_xpm); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4313 gtk_object_set_user_data(GTK_OBJECT(clear_button), window); |
2602 | 4314 gtk_box_pack_end(GTK_BOX(bbox), clear_button, FALSE, FALSE, 5); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4315 g_signal_connect(GTK_OBJECT(clear_button), "clicked", G_CALLBACK(show_clear_log), name); |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4316 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4317 save_button = picture_button(window, _("Save"), save_xpm); |
2602 | 4318 gtk_box_pack_end(GTK_BOX(bbox), save_button, FALSE, FALSE, 5); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4319 g_signal_connect(GTK_OBJECT(save_button), "clicked", G_CALLBACK(show_save_log), name); |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4320 |
2570 | 4321 gtk_widget_show_all(window); |
4322 | |
4323 if (!name) { | |
2621
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4324 view = g_new0(struct view_log, 1); |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4325 view->options = options; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4326 view->name = NULL; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4327 view->bbox = bbox; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4328 view->window = window; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4329 view->layout = layout; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4330 log_show_convo(layout, view); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4331 g_signal_connect(GTK_OBJECT(layout), "destroy", G_CALLBACK(des_view_item), view); |
2570 | 4332 } else { |
4333 gtk_list_select_item(GTK_LIST(list), 0); | |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4334 } |
2570 | 4335 |
2602 | 4336 gtk_widget_set_sensitive(bbox, TRUE); |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4337 |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4338 return; |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4339 } |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4340 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4341 /*------------------------------------------------------------------------*/ |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4342 /* The dialog for renaming groups */ |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4343 /*------------------------------------------------------------------------*/ |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4344 |
4183 | 4345 static void do_rename_group(GtkObject *obj, int resp, GtkWidget *entry) |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4346 { |
3466 | 4347 const char *new_name; |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4348 struct group *g; |
1748
2eec724fdbcd
[gaim-migrate @ 1758]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1736
diff
changeset
|
4349 struct group *orig; |
4349 | 4350 GSList *accts; |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4351 |
4183 | 4352 if (resp == GTK_RESPONSE_OK) { |
4353 | |
4354 new_name = gtk_entry_get_text(GTK_ENTRY(entry)); | |
4355 g = gtk_object_get_user_data(GTK_OBJECT(entry)); | |
4356 | |
4357 if (new_name && (strlen(new_name) != 0) && strcmp(new_name, g->name)) { | |
4358 char *prevname; | |
4359 | |
4349 | 4360 if ((orig = find_group(new_name)) != NULL && g_strcasecmp(new_name, g->name)) { |
4183 | 4361 orig->members = g_slist_concat(orig->members, g->members); |
4362 handle_group_rename(orig, g->name); | |
4349 | 4363 groups = g_slist_remove(groups, g); |
4183 | 4364 /* FIXME, i don't like calling this. it's sloppy. */ build_edit_tree(); |
4349 | 4365 accts = gaim_group_get_accounts(g); |
4366 while(accts) { | |
4367 struct aim_user *au = accts->data; | |
4368 serv_rename_group(au->gc, g, new_name); | |
4369 accts = g_slist_remove(accts, accts->data); | |
4370 } | |
4183 | 4371 g_free(g); |
4372 } else { | |
4373 prevname = g_strdup(g->name); | |
4349 | 4374 accts = gaim_group_get_accounts(g); |
4375 while(accts) { | |
4376 struct aim_user *au = accts->data; | |
4377 serv_rename_group(au->gc, g, new_name); | |
4378 accts = g_slist_remove(accts, accts->data); | |
4379 } | |
4183 | 4380 g_snprintf(g->name, sizeof(g->name), "%s", new_name); |
4381 handle_group_rename(g, prevname); | |
4382 /* FIXME, i don't like calling this. it's sloppy. */ build_edit_tree(); | |
4383 g_free(prevname); | |
4384 } | |
4349 | 4385 gaim_blist_save(); |
1748
2eec724fdbcd
[gaim-migrate @ 1758]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1736
diff
changeset
|
4386 } |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4387 } |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4388 destroy_dialog(rename_dialog, rename_dialog); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4389 } |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4390 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4391 void show_rename_group(GtkWidget *unused, struct group *g) |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4392 { |
4183 | 4393 |
4394 GtkWidget *hbox, *vbox; | |
4395 GtkWidget *label; | |
4396 char *filename = g_build_filename(DATADIR, "pixmaps", "gaim", "dialogs", "gaim_question.png", NULL); | |
4397 GtkWidget *img = gtk_image_new_from_file(filename); | |
4201
511c2b63caa4
[gaim-migrate @ 4432]
Christian Hammond <chipx86@chipx86.com>
parents:
4198
diff
changeset
|
4398 GtkWidget *name_entry = NULL; |
4183 | 4399 |
4400 g_free(filename); | |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4401 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4402 if (!rename_dialog) { |
4183 | 4403 rename_dialog = gtk_dialog_new_with_buttons(_("Gaim - Rename Group"), GTK_WINDOW(blist), GTK_DIALOG_MODAL, |
4404 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); | |
4405 gtk_dialog_set_default_response (GTK_DIALOG(rename_dialog), GTK_RESPONSE_OK); | |
4406 gtk_container_set_border_width (GTK_CONTAINER(rename_dialog), 6); | |
4407 gtk_window_set_resizable(GTK_WINDOW(rename_dialog), FALSE); | |
4408 gtk_dialog_set_has_separator(GTK_DIALOG(rename_dialog), FALSE); | |
4409 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(rename_dialog)->vbox), 12); | |
4410 gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(rename_dialog)->vbox), 6); | |
4411 | |
4412 hbox = gtk_hbox_new(FALSE, 12); | |
4413 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(rename_dialog)->vbox), hbox); | |
4414 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
4415 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
4416 | |
4417 vbox = gtk_vbox_new(FALSE, 0); | |
4418 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
4419 | |
4420 label = gtk_label_new(_("Please enter a new name for the selected group.\n")); | |
4421 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
4422 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
4423 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
4424 | |
4425 hbox = gtk_hbox_new(FALSE, 6); | |
4426 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
4427 | |
4428 label = gtk_label_new(NULL); | |
4429 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Group:")); | |
4430 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
4431 | |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4432 name_entry = gtk_entry_new(); |
4183 | 4433 gtk_entry_set_activates_default (GTK_ENTRY(name_entry), TRUE); |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4434 gtk_object_set_user_data(GTK_OBJECT(name_entry), g); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4435 gtk_entry_set_text(GTK_ENTRY(name_entry), g->name); |
4183 | 4436 gtk_box_pack_start(GTK_BOX(hbox), name_entry, FALSE, FALSE, 0); |
4437 gtk_entry_set_activates_default (GTK_ENTRY(name_entry), TRUE); | |
4438 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(name_entry)); | |
4439 | |
4440 g_signal_connect(G_OBJECT(rename_dialog), "response", G_CALLBACK(do_rename_group), name_entry); | |
4182 | 4441 |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4442 } |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4443 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4444 gtk_widget_show_all(rename_dialog); |
4201
511c2b63caa4
[gaim-migrate @ 4432]
Christian Hammond <chipx86@chipx86.com>
parents:
4198
diff
changeset
|
4445 if(name_entry) |
511c2b63caa4
[gaim-migrate @ 4432]
Christian Hammond <chipx86@chipx86.com>
parents:
4198
diff
changeset
|
4446 gtk_widget_grab_focus(GTK_WIDGET(name_entry)); |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4447 } |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4448 |
2743 | 4449 |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4450 /*------------------------------------------------------------------------*/ |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4451 /* The dialog for renaming buddies */ |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4452 /*------------------------------------------------------------------------*/ |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4453 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4454 static void do_rename_buddy(GtkObject *obj, GtkWidget *entry) |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4455 { |
3466 | 4456 const char *new_name; |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4457 struct buddy *b; |
2681
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2679
diff
changeset
|
4458 GSList *gr; |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4459 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4460 new_name = gtk_entry_get_text(GTK_ENTRY(entry)); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4461 b = gtk_object_get_user_data(obj); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4462 |
4349 | 4463 if (!g_slist_find(connections, b->user->gc)) { |
2681
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2679
diff
changeset
|
4464 destroy_dialog(rename_bud_dialog, rename_bud_dialog); |
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2679
diff
changeset
|
4465 return; |
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2679
diff
changeset
|
4466 } |
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2679
diff
changeset
|
4467 |
4349 | 4468 gr = groups; |
2681
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2679
diff
changeset
|
4469 while (gr) { |
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2679
diff
changeset
|
4470 if (g_slist_find(((struct group *)gr->data)->members, b)) |
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2679
diff
changeset
|
4471 break; |
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2679
diff
changeset
|
4472 gr = gr->next; |
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2679
diff
changeset
|
4473 } |
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2679
diff
changeset
|
4474 if (!gr) { |
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2679
diff
changeset
|
4475 destroy_dialog(rename_bud_dialog, rename_bud_dialog); |
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2679
diff
changeset
|
4476 return; |
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2679
diff
changeset
|
4477 } |
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2679
diff
changeset
|
4478 |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4479 if (new_name && (strlen(new_name) != 0) && strcmp(new_name, b->name)) { |
4349 | 4480 struct group *g = find_group_by_buddy(b); |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4481 char *prevname = g_strdup(b->name); |
2681
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2679
diff
changeset
|
4482 if (g) |
4349 | 4483 serv_remove_buddy(b->user->gc, b->name, g->name); |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4484 g_snprintf(b->name, sizeof(b->name), "%s", new_name); |
4349 | 4485 serv_add_buddy(b->user->gc, b->name); |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4486 handle_buddy_rename(b, prevname); |
4349 | 4487 gaim_blist_save(); |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4488 g_free(prevname); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4489 } |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4490 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4491 destroy_dialog(rename_bud_dialog, rename_bud_dialog); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4492 } |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4493 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4494 void show_rename_buddy(GtkWidget *unused, struct buddy *b) |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4495 { |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4496 GtkWidget *mainbox; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4497 GtkWidget *frame; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4498 GtkWidget *fbox; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4499 GtkWidget *bbox; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4500 GtkWidget *button; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4501 GtkWidget *name_entry; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4502 GtkWidget *label; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4503 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4504 if (!rename_bud_dialog) { |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
4505 GAIM_DIALOG(rename_bud_dialog); |
4074 | 4506 gtk_window_set_role(GTK_WINDOW(rename_bud_dialog), "rename_bud_dialog"); |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4507 gtk_window_set_policy(GTK_WINDOW(rename_bud_dialog), FALSE, TRUE, TRUE); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
4508 gtk_window_set_title(GTK_WINDOW(rename_bud_dialog), _("Gaim - Rename Buddy")); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4509 g_signal_connect(GTK_OBJECT(rename_bud_dialog), "destroy", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4510 G_CALLBACK(destroy_dialog), rename_bud_dialog); |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4511 gtk_widget_realize(rename_bud_dialog); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4512 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4513 mainbox = gtk_vbox_new(FALSE, 5); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4514 gtk_container_set_border_width(GTK_CONTAINER(mainbox), 5); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4515 gtk_container_add(GTK_CONTAINER(rename_bud_dialog), mainbox); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4516 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4517 frame = gtk_frame_new(_("Rename Buddy")); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4518 gtk_box_pack_start(GTK_BOX(mainbox), frame, TRUE, TRUE, 0); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4519 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4520 fbox = gtk_hbox_new(FALSE, 5); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4521 gtk_container_set_border_width(GTK_CONTAINER(fbox), 5); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4522 gtk_container_add(GTK_CONTAINER(frame), fbox); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4523 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4524 label = gtk_label_new(_("New name:")); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4525 gtk_box_pack_start(GTK_BOX(fbox), label, FALSE, FALSE, 0); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4526 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4527 name_entry = gtk_entry_new(); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4528 gtk_box_pack_start(GTK_BOX(fbox), name_entry, TRUE, TRUE, 0); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4529 gtk_object_set_user_data(GTK_OBJECT(name_entry), b); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4530 gtk_entry_set_text(GTK_ENTRY(name_entry), b->name); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4531 g_signal_connect(GTK_OBJECT(name_entry), "activate", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4532 G_CALLBACK(do_rename_buddy), name_entry); |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4533 gtk_widget_grab_focus(name_entry); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4534 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4535 bbox = gtk_hbox_new(FALSE, 5); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4536 gtk_box_pack_start(GTK_BOX(mainbox), bbox, FALSE, FALSE, 0); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4537 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4538 button = picture_button(rename_bud_dialog, _("OK"), ok_xpm); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4539 gtk_object_set_user_data(GTK_OBJECT(button), b); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4540 gtk_box_pack_end(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4541 g_signal_connect(GTK_OBJECT(button), "clicked", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4542 G_CALLBACK(do_rename_buddy), name_entry); |
4236 | 4543 |
4544 button = picture_button(rename_bud_dialog, _("Cancel"), cancel_xpm); | |
4545 gtk_box_pack_end(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
4546 g_signal_connect(GTK_OBJECT(button), "clicked", | |
4547 G_CALLBACK(destroy_dialog), rename_bud_dialog); | |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4548 } |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4549 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4550 gtk_widget_show_all(rename_bud_dialog); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4551 } |
2370
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4552 |
2377
466b29d35b85
[gaim-migrate @ 2390]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
4553 #ifdef USE_PERL |
466b29d35b85
[gaim-migrate @ 2390]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
4554 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
4555 static GtkWidget *perl_config = NULL; |
2370
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4556 static char *perl_last_dir = NULL; |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4557 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
4558 static void cfdes(GtkWidget *m, gpointer n) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
4559 { |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
4560 if (perl_config) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
4561 gtk_widget_destroy(perl_config); |
2370
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4562 perl_config = NULL; |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4563 } |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4564 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
4565 static void do_load(GtkWidget *m, gpointer n) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
4566 { |
2370
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4567 const char *file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(perl_config)); |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4568 gchar *f = NULL; |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4569 if (!file || !strlen(file)) { |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4570 return; |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4571 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
4572 |
2370
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4573 if (file_is_dir(file, perl_config)) { |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4574 return; |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4575 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
4576 |
2370
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4577 if (perl_last_dir) { |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4578 g_free(perl_last_dir); |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4579 } |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4580 perl_last_dir = g_dirname(file); |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4581 |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4582 debug_printf("Loading perl script: %s\n", file); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
4583 |
2370
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4584 f = g_strdup(file); |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4585 perl_load_file(f); |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4586 g_free(f); |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4587 cfdes(perl_config, NULL); |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4588 } |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4589 |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4590 void load_perl_script() |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4591 { |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4592 char *buf, *temp; |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4593 |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4594 if (perl_config) { |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4595 gtk_widget_show(perl_config); |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4596 gdk_window_raise(perl_config->window); |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4597 return; |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4598 } |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4599 |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4600 /* Below is basically stolen from plugins.c */ |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4601 perl_config = gtk_file_selection_new(_("Gaim - Select Perl Script")); |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4602 |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4603 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(perl_config)); |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4604 |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4605 if (!perl_last_dir) { |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4606 temp = gaim_user_dir(); |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4607 buf = g_strconcat(temp, G_DIR_SEPARATOR_S, NULL); |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4608 } else { |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4609 buf = g_strconcat(perl_last_dir, G_DIR_SEPARATOR_S, NULL); |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4610 } |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4611 |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4612 gtk_file_selection_set_filename(GTK_FILE_SELECTION(perl_config), buf); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
4613 gtk_file_selection_complete(GTK_FILE_SELECTION(perl_config), "*.pl"); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4614 g_signal_connect(GTK_OBJECT(perl_config), "destroy", G_CALLBACK(cfdes), perl_config); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4615 |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4616 g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(perl_config)->ok_button), |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4617 "clicked", G_CALLBACK(do_load), NULL); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4618 |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4619 g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(perl_config)->cancel_button), |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4620 "clicked", G_CALLBACK(cfdes), NULL); |
2370
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4621 |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4622 g_free(buf); |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4623 gtk_widget_show(perl_config); |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4624 gdk_window_raise(perl_config->window); |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4625 } |
2377
466b29d35b85
[gaim-migrate @ 2390]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
4626 |
466b29d35b85
[gaim-migrate @ 2390]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
4627 #endif /* USE_PERL */ |
2379
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4628 |
3668 | 4629 GtkWidget *gaim_pixbuf_toolbar_button_from_stock(char *icon) |
4630 { | |
4631 GtkWidget *button, *image, *bbox; | |
4632 | |
4633 button = gtk_toggle_button_new(); | |
4634 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
4635 | |
4636 bbox = gtk_vbox_new(FALSE, 0); | |
4637 | |
4638 gtk_container_add (GTK_CONTAINER(button), bbox); | |
4639 | |
4640 image = gtk_image_new_from_stock(icon, GTK_ICON_SIZE_MENU); | |
4641 gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 0); | |
4642 | |
4643 gtk_widget_show_all(bbox); | |
4644 return button; | |
4645 } | |
4646 | |
3671 | 4647 GtkWidget *gaim_pixbuf_toolbar_button_from_file(char *icon) |
4648 { | |
4649 GtkWidget *button, *image, *bbox; | |
4650 char *filename; | |
4651 | |
4652 if (!icon) | |
4653 return NULL; | |
4654 | |
4655 button = gtk_toggle_button_new(); | |
4656 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
4657 | |
4658 bbox = gtk_vbox_new(FALSE, 0); | |
4659 | |
4660 gtk_container_add (GTK_CONTAINER(button), bbox); | |
4661 | |
4662 filename = g_build_filename (DATADIR, "pixmaps", "gaim", "buttons", icon, NULL); | |
4663 debug_printf("Loading: %s\n", filename); | |
4664 image = gtk_image_new_from_file(filename); | |
4665 g_free(filename); | |
4666 | |
4667 gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 0); | |
4668 | |
4669 gtk_widget_show_all(bbox); | |
4670 return button; | |
4671 } | |
4672 | |
4673 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
4674 GtkWidget * |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
4675 gaim_pixbuf_button_from_stock(const char *text, const char *icon, |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
4676 GaimButtonStyle style) |
3668 | 4677 { |
4678 GtkWidget *button, *image, *label, *bbox; | |
4679 button = gtk_button_new(); | |
4680 | |
4681 if (style == GAIM_BUTTON_HORIZONTAL) | |
4682 bbox = gtk_hbox_new(FALSE, 5); | |
4683 else | |
4684 bbox = gtk_vbox_new(FALSE, 0); | |
4685 | |
4686 gtk_container_add (GTK_CONTAINER(button), bbox); | |
4687 | |
4688 if (icon) { | |
4689 image = gtk_image_new_from_stock(icon, GTK_ICON_SIZE_BUTTON); | |
4690 gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 0); | |
4691 } | |
4692 | |
4693 if (text) { | |
4694 label = gtk_label_new(NULL); | |
4695 gtk_label_set_text_with_mnemonic(GTK_LABEL(label), text); | |
4696 gtk_label_set_mnemonic_widget(GTK_LABEL(label), button); | |
4697 gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0); | |
4698 } | |
4699 | |
4700 gtk_widget_show_all(bbox); | |
4701 return button; | |
4702 } | |
4703 | |
3649 | 4704 GtkWidget *gaim_pixbuf_button(char *text, char *iconfile, GaimButtonStyle style) |
3367 | 4705 { |
4706 GtkWidget *button, *image, *label, *bbox; | |
4707 button = gtk_button_new(); | |
3649 | 4708 |
4709 if (style == GAIM_BUTTON_HORIZONTAL) | |
4710 bbox = gtk_hbox_new(FALSE, 5); | |
4711 else | |
4712 bbox = gtk_vbox_new(FALSE, 0); | |
4713 | |
3367 | 4714 gtk_container_add (GTK_CONTAINER(button), bbox); |
3649 | 4715 |
3367 | 4716 if (iconfile) { |
4717 char *filename; | |
4718 filename = g_build_filename (DATADIR, "pixmaps", "gaim", "buttons", iconfile, NULL); | |
4719 debug_printf("Loading: %s\n", filename); | |
4720 image = gtk_image_new_from_file(filename); | |
4721 gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 0); | |
4722 g_free(filename); | |
4723 } | |
3649 | 4724 |
3367 | 4725 if (text) { |
4726 label = gtk_label_new(NULL); | |
4727 gtk_label_set_text_with_mnemonic(GTK_LABEL(label), text); | |
4728 gtk_label_set_mnemonic_widget(GTK_LABEL(label), button); | |
4729 gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0); | |
4730 } | |
4731 gtk_widget_show_all(bbox); | |
4732 return button; | |
4733 } | |
3427 | 4734 |
2379
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4735 GtkWidget *picture_button(GtkWidget *window, char *text, char **xpm) |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4736 { |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4737 GtkWidget *button; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4738 GtkWidget *button_box, *button_box_2, *button_box_3; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4739 GtkWidget *label; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4740 GdkBitmap *mask; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4741 GdkPixmap *pm; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4742 GtkWidget *pixmap; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4743 |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4744 button = gtk_button_new(); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4745 |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4746 button_box = gtk_hbox_new(FALSE, 5); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4747 gtk_container_add(GTK_CONTAINER(button), button_box); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4748 |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4749 button_box_2 = gtk_hbox_new(FALSE, 0); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4750 button_box_3 = gtk_hbox_new(FALSE, 0); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4751 gtk_box_pack_start(GTK_BOX(button_box), button_box_2, TRUE, TRUE, 0); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4752 gtk_box_pack_start(GTK_BOX(button_box), button_box_3, TRUE, TRUE, 0); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4753 pm = gdk_pixmap_create_from_xpm_d(window->window, &mask, NULL, xpm); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4754 pixmap = gtk_pixmap_new(pm, mask); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4755 gtk_box_pack_end(GTK_BOX(button_box_2), pixmap, FALSE, FALSE, 0); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4756 |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4757 if (text) { |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4758 label = gtk_label_new(text); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4759 gtk_box_pack_start(GTK_BOX(button_box_3), label, FALSE, FALSE, 2); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4760 gtk_widget_show(label); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4761 } |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4762 |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4763 gtk_widget_show(pixmap); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4764 gtk_widget_show(button_box_2); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4765 gtk_widget_show(button_box_3); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4766 gtk_widget_show(button_box); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4767 |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4768 /* this causes clipping on lots of buttons with long text */ |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4769 /* gtk_widget_set_usize(button, 75, 30);*/ |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4770 gtk_widget_show(button); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4771 gdk_pixmap_unref(pm); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4772 gdk_bitmap_unref(mask); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4773 |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4774 return button; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4775 } |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4776 |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4777 static GtkTooltips *button_tips = NULL; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4778 GtkWidget *picture_button2(GtkWidget *window, char *text, char **xpm, short dispstyle) |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4779 { |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4780 GtkWidget *button; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4781 GtkWidget *button_box, *button_box_2; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4782 GdkBitmap *mask; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4783 GdkPixmap *pm; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4784 GtkWidget *pixmap; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4785 GtkWidget *label; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4786 |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4787 if (!button_tips) |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4788 button_tips = gtk_tooltips_new(); |
3902 | 4789 |
2379
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4790 button = gtk_button_new(); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4791 |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4792 button_box = gtk_hbox_new(FALSE, 0); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4793 gtk_container_add(GTK_CONTAINER(button), button_box); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4794 |
3320 | 4795 button_box_2 = gtk_vbox_new(FALSE, 0); |
4796 | |
4797 gtk_box_pack_start(GTK_BOX(button_box), button_box_2, TRUE, TRUE, 0); | |
2379
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4798 gtk_widget_show(button_box_2); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4799 gtk_widget_show(button_box); |
3327 | 4800 if (dispstyle == 2 || dispstyle == 0) { |
4801 pm = gdk_pixmap_create_from_xpm_d(window->window, &mask, NULL, xpm); | |
4802 pixmap = gtk_pixmap_new(pm, mask); | |
4803 gtk_box_pack_start(GTK_BOX(button_box_2), pixmap, FALSE, FALSE, 0); | |
4804 | |
4805 gtk_widget_show(pixmap); | |
4806 | |
4807 gdk_pixmap_unref(pm); | |
4808 gdk_bitmap_unref(mask); | |
4809 } | |
4810 | |
4811 if (dispstyle == 2 || dispstyle == 1) { | |
4812 label = gtk_label_new(text); | |
4813 gtk_widget_show(label); | |
4814 gtk_box_pack_end(GTK_BOX(button_box_2), label, FALSE, FALSE, 0); | |
2379
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4815 } |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4816 |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4817 gtk_tooltips_set_tip(button_tips, button, text, "Gaim"); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4818 gtk_widget_show(button); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4819 return button; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4820 } |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4821 |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4822 int file_is_dir(const char *path, GtkWidget *w) |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4823 { |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4824 struct stat st; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4825 char *name; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4826 |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4827 if (stat(path, &st) == 0 && S_ISDIR(st.st_mode)) { |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4828 /* append a / if needed */ |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4829 if (path[strlen(path) - 1] != '/') { |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4830 name = g_strconcat(path, "/", NULL); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4831 } else { |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4832 name = g_strdup(path); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4833 } |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4834 gtk_file_selection_set_filename(GTK_FILE_SELECTION(w), name); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4835 g_free(name); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4836 return 1; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4837 } |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4838 |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4839 return 0; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4840 } |
2956 | 4841 |
4842 /*------------------------------------------------------------------------*/ | |
4843 /* The dialog for setting V-Card info */ | |
4844 /*------------------------------------------------------------------------*/ | |
4845 /* | |
4846 * There are actually two "chunks" of code following: generic "multi-entry dialog" | |
4847 * support and V-Card dialog specific support. | |
4848 * | |
4849 * At first blush, this may seem like an unnecessary duplication of effort given | |
4850 * that a "set dir info" dialog already exists. However, this is not so because: | |
4851 * | |
4852 * 1. V-Cards can have a lot more data in them than what the current | |
4853 * "set dir" dialog supports. | |
4854 * | |
4855 * 2. V-Card data, at least with respect to Jabber, is currently in a | |
4856 * state of flux. As the data and format changes, all that need be | |
4857 * changed with the V-Card support I've written is the "template" | |
4858 * data. | |
4859 * | |
4860 * 3. The "multi entry dialog" support itself was originally written | |
4861 * to support Jabber server user registration (TBD). A "dynamically | |
4862 * configurable" multi-entry dialog is needed for that, as different | |
4863 * servers may require different registration information. It just | |
4864 * turned out to be well-suited to adding V-Card setting support, as | |
4865 * well :-). | |
4866 * | |
4867 * TBD: Add check-box support to the generic multi-entry dialog support so that | |
4868 * it can be used to "replace" the "set dir info" support? | |
4869 * | |
4870 * Multiple-language support. Currently Not In There. I think this should | |
4871 * be easy. Note that when it's added: if anybody saved their data in | |
4872 * English, it'll be lost when MLS is added and they'll have to re-enter it. | |
4873 * | |
4874 * More "TBDs" noted in the code. | |
4875 */ | |
4876 | |
4877 | |
4878 /*------------------------------------*/ | |
4879 /* generic multi-entry dialog support */ | |
4880 /*------------------------------------*/ | |
4881 | |
4882 /* | |
4883 * Print all multi-entry items | |
4884 * | |
4885 * Note: Simply a debug helper | |
4886 */ | |
4887 void multi_entry_item_print_all(const GSList *list) { | |
4888 | |
4889 int cnt = 0; | |
4890 | |
4891 /* While there's something to print... */ | |
4892 while(list != NULL) { | |
4893 fprintf(stderr, "label %2d: \"%s\"", ++cnt, ((MultiEntryData *) (list->data))->label); | |
4894 if(((MultiEntryData *) (list->data))->text != NULL) { | |
4895 fprintf(stderr, ", text: \"%s\"", ((MultiEntryData *) (list->data))->text); | |
4896 } | |
4897 fputs("\n", stderr); | |
4898 list = list->next; | |
4899 } | |
4900 } | |
4901 | |
4902 /* | |
4903 * Print all multi-text items | |
4904 * | |
4905 * Note: Simply a debug helper | |
4906 */ | |
4907 void multi_text_item_print_all(const GSList *list) { | |
4908 | |
4909 int cnt = 0; | |
4910 | |
4911 /* While there's something to print... */ | |
4912 while(list != NULL) { | |
4913 fprintf(stderr, "label %2d: \"%s\"", ++cnt, ((MultiTextData *) (list->data))->label); | |
4914 if(((MultiTextData *) (list->data))->text != NULL) { | |
4915 fprintf(stderr, ", text: \"%s\"", ((MultiTextData *) (list->data))->text); | |
4916 } | |
4917 fputs("\n", stderr); | |
4918 list = list->next; | |
4919 } | |
4920 } | |
4921 | |
4922 | |
4923 /* | |
4924 * Free all multi-entry item allocs and NULL the list pointer | |
4925 */ | |
4926 void multi_entry_items_free_all(GSList **list) | |
4927 { | |
4928 | |
4929 GSList *next = *list; | |
4930 MultiEntryData *data; | |
4931 | |
4932 /* While there's something to free() ... */ | |
4933 while(next != NULL) { | |
4934 data = (MultiEntryData *) next->data; | |
4935 g_free(data->label); | |
4936 g_free(data->text); | |
4937 g_free(data); | |
4938 next = next->next; | |
4939 } | |
4940 g_slist_free(*list); | |
4941 *list = NULL; | |
4942 } | |
4943 | |
4944 /* | |
4945 * Free all multi-text item allocs and NULL the list pointer | |
4946 */ | |
4947 void multi_text_items_free_all(GSList **list) | |
4948 { | |
4949 | |
4950 GSList *next = *list; | |
4951 MultiTextData *data; | |
4952 | |
4953 /* While there's something to free() ... */ | |
4954 while(next != NULL) { | |
4955 data = (MultiTextData *) next->data; | |
4956 g_free(data->label); | |
4957 g_free(data->text); | |
4958 g_free(data); | |
4959 next = next->next; | |
4960 } | |
4961 g_slist_free(*list); | |
4962 *list = NULL; | |
4963 } | |
4964 | |
4965 /* | |
4966 * See if a MultiEntryData item contains a given label | |
4967 * | |
4968 * See: glib docs for g_slist_compare_custom() for details | |
4969 */ | |
4970 static gint multi_entry_data_label_compare(gconstpointer data, gconstpointer label) | |
4971 { | |
4972 return(strcmp(((MultiEntryData *) (data))->label, (char *) label)); | |
4973 } | |
4974 | |
4975 /* | |
4976 * Add a new multi-entry item to list | |
4977 * | |
4978 * If adding to existing list: will search the list for existence of | |
4979 * "label" and change/create "text" entry if necessary. | |
4980 */ | |
4981 | |
4982 MultiEntryData *multi_entry_list_update(GSList **list, const char *label, const char *text, int add_it) | |
4983 { | |
4984 GSList *found; | |
4985 MultiEntryData *data; | |
4986 | |
2975 | 4987 if((found = g_slist_find_custom(*list, (void *)label, multi_entry_data_label_compare)) == NULL) { |
2956 | 4988 if(add_it) { |
4989 data = (MultiEntryData *) g_slist_last(*list = | |
4990 g_slist_append(*list, g_malloc(sizeof(MultiEntryData))))->data; | |
4991 data->label = strcpy(g_malloc(strlen(label) +1), label); | |
4992 data->text = NULL; | |
4993 /* | |
4994 * default to setting "visible" and editable to TRUE - they can be | |
4995 * overridden later, of course. | |
4996 */ | |
4997 data->visible = TRUE; | |
4998 data->editable = TRUE; | |
4999 } else { | |
5000 data = NULL; | |
5001 } | |
5002 } else { | |
5003 data = found->data; | |
5004 } | |
5005 | |
5006 if(data != NULL && text != NULL && text[0] != '\0') { | |
5007 if(data->text == NULL) { | |
5008 data->text = g_malloc(strlen(text) + 1); | |
5009 } else { | |
5010 data->text = g_realloc(data->text, strlen(text) + 1); | |
5011 } | |
5012 strcpy(data->text, text); | |
5013 } | |
5014 | |
5015 return(data); | |
5016 } | |
5017 | |
5018 /* | |
5019 * See if a MultiTextData item contains a given label | |
5020 * | |
5021 * See: glib docs for g_slist_compare_custom() for details | |
5022 */ | |
5023 static gint multi_text_data_label_compare(gconstpointer data, gconstpointer label) | |
5024 { | |
5025 return(strcmp(((MultiTextData *) (data))->label, (char *) label)); | |
5026 } | |
5027 | |
5028 /* | |
5029 * Add a new multi-text item to list | |
5030 * | |
5031 * If adding to existing list: will search the list for existence of | |
5032 * "label" and change/create "text" text if necessary. | |
5033 */ | |
5034 | |
5035 MultiTextData *multi_text_list_update(GSList **list, const char *label, const char *text, int add_it) | |
5036 { | |
5037 GSList *found; | |
5038 MultiTextData *data; | |
5039 | |
2975 | 5040 if((found = g_slist_find_custom(*list, (void *)label, multi_text_data_label_compare)) == NULL) { |
2956 | 5041 if(add_it) { |
5042 data = (MultiTextData *) g_slist_last(*list = | |
5043 g_slist_append(*list, g_malloc(sizeof(MultiTextData))))->data; | |
5044 data->label = strcpy(g_malloc(strlen(label) +1), label); | |
5045 data->text = NULL; | |
5046 } else { | |
5047 data = NULL; | |
5048 } | |
5049 } else { | |
5050 data = found->data; | |
5051 } | |
5052 | |
5053 if(data != NULL && text != NULL && text[0] != '\0') { | |
5054 if(data->text == NULL) { | |
5055 data->text = g_malloc(strlen(text) + 1); | |
5056 } else { | |
5057 data->text = g_realloc(data->text, strlen(text) + 1); | |
5058 } | |
5059 strcpy(data->text, text); | |
5060 } | |
5061 | |
5062 return(data); | |
5063 } | |
5064 | |
5065 /* | |
5066 * Free-up the multi-entry item list and the MultiEntryDlg | |
5067 * struct alloc. | |
5068 */ | |
5069 void multi_entry_free(struct multi_entry_dlg *b) | |
5070 { | |
5071 multi_entry_items_free_all(&(b->multi_entry_items)); | |
5072 multi_text_items_free_all(&(b->multi_text_items)); | |
5073 g_free(b->instructions->text); | |
5074 g_free(b->instructions); | |
2975 | 5075 g_free(b->entries_title); |
2956 | 5076 g_free(b); |
5077 } | |
5078 | |
5079 /* | |
5080 * Multi-Entry dialog "destroyed" catcher | |
5081 * | |
5082 * Free-up the multi-entry item list, destroy the dialog widget | |
5083 * and free the MultiEntryDlg struct alloc. | |
5084 * | |
5085 */ | |
5086 void multi_entry_dialog_destroy(GtkWidget *widget, gpointer data) | |
5087 { | |
5088 MultiEntryDlg *b = data; | |
5089 | |
5090 multi_entry_free(b); | |
5091 } | |
5092 | |
5093 /* | |
5094 * Show/Re-show instructions | |
5095 */ | |
5096 void re_show_multi_entry_instr(MultiInstrData *instructions) | |
5097 { | |
5098 if(instructions->label != NULL) { | |
5099 if(instructions->text == NULL) { | |
5100 gtk_widget_hide(instructions->label); | |
5101 } else { | |
5102 gtk_label_set_text(GTK_LABEL (instructions->label), instructions->text); | |
5103 gtk_widget_show(instructions->label); | |
5104 } | |
5105 } | |
5106 } | |
5107 | |
5108 /* | |
5109 * Show/Re-show entry boxes | |
5110 */ | |
5111 void re_show_multi_entry_entries(GtkWidget **entries_table, | |
5112 GtkWidget *entries_frame, | |
5113 GSList *multi_entry_items) | |
5114 { | |
5115 GtkWidget *label; | |
5116 GSList *multi_entry; | |
5117 MultiEntryData *med; | |
2975 | 5118 int rows, row_num, col_num, col_offset; |
5119 int cols = 1; | |
2956 | 5120 |
5121 /* Figure-out number of rows needed for table */ | |
2975 | 5122 if((rows = g_slist_length(multi_entry_items)) > 9) { |
5123 rows /= 2; | |
5124 ++cols; | |
5125 } | |
2956 | 5126 |
5127 if(*entries_table != NULL) { | |
5128 gtk_widget_destroy(GTK_WIDGET (*entries_table)); | |
5129 } | |
2975 | 5130 *entries_table = gtk_table_new(rows, 3 * cols, FALSE); |
2956 | 5131 gtk_container_add(GTK_CONTAINER (entries_frame), *entries_table); |
5132 | |
2975 | 5133 for(col_num = 0, multi_entry = multi_entry_items; col_num < cols && multi_entry != NULL; |
5134 ++col_num) { | |
5135 col_offset = col_num * 3; | |
5136 for(row_num = 0; row_num < rows && multi_entry != NULL; | |
5137 ++row_num, multi_entry = multi_entry->next) { | |
5138 | |
5139 med = (MultiEntryData *) multi_entry->data; | |
5140 | |
5141 label = gtk_label_new(med->label); | |
5142 gtk_misc_set_alignment(GTK_MISC(label), (gfloat) 1.0, (gfloat) 0.5); | |
5143 gtk_table_attach_defaults(GTK_TABLE (*entries_table), label, | |
5144 col_offset, 1 + col_offset, row_num, row_num +1); | |
5145 gtk_widget_show(label); | |
5146 | |
5147 label = gtk_label_new(": "); | |
5148 gtk_misc_set_alignment(GTK_MISC(label), (gfloat) 0.0, (gfloat) 0.5); | |
5149 gtk_table_attach_defaults(GTK_TABLE (*entries_table), label, | |
5150 1 + col_offset, 2 + col_offset, row_num, row_num +1); | |
5151 gtk_widget_show(label); | |
5152 | |
5153 med->widget = gtk_entry_new_with_max_length(50); | |
5154 if(med->text != NULL) { | |
5155 gtk_entry_set_text(GTK_ENTRY (med->widget), med->text); | |
5156 } | |
5157 gtk_entry_set_visibility(GTK_ENTRY (med->widget), med->visible); | |
5158 gtk_entry_set_editable(GTK_ENTRY (med->widget), med->editable); | |
5159 gtk_table_attach(GTK_TABLE (*entries_table), med->widget, | |
5160 2 + col_offset, 3 + col_offset, row_num, row_num +1, | |
5161 GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 5, 0); | |
5162 gtk_widget_show(med->widget); | |
2956 | 5163 } |
5164 } | |
5165 | |
5166 gtk_widget_show(*entries_table); | |
5167 } | |
5168 | |
5169 /* | |
5170 * Show/Re-show textboxes | |
5171 */ | |
5172 void re_show_multi_entry_textboxes(GtkWidget **texts_ibox, | |
5173 GtkWidget *texts_obox, | |
5174 GSList *multi_text_items) | |
5175 { | |
5176 GSList *multi_text; | |
5177 MultiTextData *mtd; | |
5178 GtkWidget *frame; | |
5179 GtkWidget *hbox; | |
5180 GtkWidget *vscrollbar; | |
5181 | |
5182 if(*texts_ibox != NULL) { | |
5183 gtk_widget_destroy(GTK_WIDGET (*texts_ibox)); | |
5184 } | |
5185 *texts_ibox = gtk_vbox_new(FALSE, 5); | |
5186 gtk_container_add(GTK_CONTAINER (texts_obox), *texts_ibox); | |
5187 | |
5188 for(multi_text = multi_text_items; multi_text != NULL; multi_text = multi_text->next) { | |
5189 mtd = (MultiTextData *) multi_text->data; | |
5190 frame = gtk_frame_new(mtd->label); | |
5191 gtk_container_add(GTK_CONTAINER (*texts_ibox), frame); | |
5192 hbox = gtk_hbox_new(FALSE, 0); | |
5193 gtk_container_add(GTK_CONTAINER (frame), hbox); | |
5194 mtd->textbox = gtk_text_new(NULL, NULL); | |
5195 gtk_text_set_editable(GTK_TEXT(mtd->textbox), TRUE); | |
5196 gtk_text_set_word_wrap(GTK_TEXT(mtd->textbox), TRUE); | |
5197 gtk_widget_set_usize(mtd->textbox, 300, 100); | |
3542 | 5198 gtk_text_insert(GTK_TEXT(mtd->textbox), NULL, NULL, NULL, mtd->text?mtd->text:"", -1); |
2956 | 5199 gtk_box_pack_start(GTK_BOX (hbox), mtd->textbox, FALSE, FALSE, 0); |
5200 vscrollbar = gtk_vscrollbar_new (GTK_TEXT(mtd->textbox)->vadj); | |
5201 gtk_box_pack_start(GTK_BOX (hbox), vscrollbar, FALSE, FALSE, 0); | |
5202 gtk_widget_show(mtd->textbox); | |
5203 gtk_widget_show (vscrollbar); | |
5204 gtk_widget_show(hbox); | |
5205 gtk_widget_show(frame); | |
5206 } | |
5207 | |
5208 gtk_widget_show(*texts_ibox); | |
5209 } | |
5210 | |
5211 /* | |
5212 * Create and initialize a new Multi-Entry Dialog struct | |
5213 */ | |
5214 MultiEntryDlg *multi_entry_dialog_new() | |
5215 { | |
5216 MultiEntryDlg *b = g_new0(MultiEntryDlg, 1); | |
5217 b->instructions = g_new0(MultiInstrData, 1); | |
5218 b->multi_entry_items = NULL; | |
5219 b->multi_text_items = NULL; | |
5220 return(b); | |
5221 } | |
5222 | |
5223 /* | |
5224 * Instantiate a new multi-entry dialog | |
5225 * | |
5226 * data == pointer to MultiEntryDlg with the following | |
5227 * initialized: | |
5228 * | |
4074 | 5229 * role |
2956 | 5230 * title |
5231 * user | |
5232 * multi_entry_items - pointers to MultiEntryData list | |
5233 * and MultiTextData list | |
5234 * instructions (optional) | |
5235 * ok function pointer | |
5236 * cancel function pointer (actually used to set | |
5237 * window destroy signal--cancel asserts destroy) | |
5238 * | |
5239 * sets the following in the MultiEntryDialog struct: | |
5240 * | |
5241 * window | |
5242 */ | |
5243 void show_multi_entry_dialog(gpointer data) | |
5244 { | |
5245 GtkWidget *vbox, *hbox; | |
5246 GtkWidget *button; | |
5247 MultiEntryDlg *b = data; | |
5248 | |
5249 GAIM_DIALOG(b->window); | |
2969 | 5250 gtk_container_set_border_width(GTK_CONTAINER(b->window), 5); |
4074 | 5251 gtk_window_set_role(GTK_WINDOW(b->window), b->role); |
2956 | 5252 gtk_window_set_title(GTK_WINDOW (b->window), b->title); |
2969 | 5253 |
2956 | 5254 /* Clean up if user dismisses window via window manager! */ |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
5255 g_signal_connect(GTK_OBJECT(b->window), "destroy", G_CALLBACK(b->cancel), (gpointer) b); |
2956 | 5256 gtk_widget_realize(b->window); |
5257 | |
5258 vbox = gtk_vbox_new(FALSE, 5); | |
5259 gtk_container_add(GTK_CONTAINER (b->window), vbox); | |
5260 | |
5261 b->instructions->label = gtk_label_new(NULL); | |
5262 gtk_label_set_line_wrap(GTK_LABEL (b->instructions->label), TRUE); | |
5263 gtk_box_pack_start(GTK_BOX (vbox), b->instructions->label, TRUE, TRUE, 5); | |
5264 re_show_multi_entry_instr(b->instructions); | |
5265 | |
2975 | 5266 b->entries_frame = gtk_frame_new(b->entries_title); |
2956 | 5267 gtk_box_pack_start(GTK_BOX (vbox), b->entries_frame, TRUE, TRUE, 5); |
5268 gtk_widget_show(b->entries_frame); | |
5269 b->entries_table = NULL; | |
5270 re_show_multi_entry_entries(&(b->entries_table), b->entries_frame, b->multi_entry_items); | |
5271 | |
5272 b->texts_obox = gtk_vbox_new(FALSE, 0); | |
2969 | 5273 gtk_box_pack_start(GTK_BOX (vbox), b->texts_obox, TRUE, TRUE, 5); |
2956 | 5274 gtk_widget_show(b->texts_obox); |
5275 b->texts_ibox = NULL; | |
5276 re_show_multi_entry_textboxes(&(b->texts_ibox), b->texts_obox, b->multi_text_items); | |
5277 | |
5278 hbox = gtk_hbox_new(FALSE, 0); | |
2969 | 5279 gtk_box_pack_start(GTK_BOX (vbox), hbox, FALSE, FALSE, 5); |
2956 | 5280 gtk_widget_show(hbox); |
5281 | |
4236 | 5282 button = picture_button(b->window, _("Save"), save_xpm); |
5283 g_signal_connect(GTK_OBJECT (button), "clicked", | |
5284 G_CALLBACK (b->ok), (gpointer) b); | |
5285 gtk_box_pack_end(GTK_BOX (hbox), button, FALSE, FALSE, 5); | |
5286 gtk_widget_show(button); | |
5287 | |
2956 | 5288 button = picture_button(b->window, _("Cancel"), cancel_xpm); |
2969 | 5289 |
2956 | 5290 /* Let "destroy handling" (set above) handle cleanup */ |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
5291 g_signal_connect_swapped(GTK_OBJECT (button), "clicked", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
5292 G_CALLBACK (gtk_widget_destroy), GTK_OBJECT (b->window)); |
2969 | 5293 gtk_box_pack_end(GTK_BOX (hbox), button, FALSE, FALSE, 5); |
2956 | 5294 gtk_widget_show(button); |
5295 | |
5296 gtk_widget_show(vbox); | |
5297 gtk_widget_show(b->window); | |
5298 } | |
5299 | |
5300 | |
5301 /*------------------------------------*/ | |
5302 /* V-Card dialog specific support */ | |
5303 /*------------------------------------*/ | |
5304 | |
5305 /* | |
5306 * V-Card "set info" dialog "Save" clicked | |
5307 * | |
5308 * Copy data from GTK+ dialogs into GSLists, call protocol-specific | |
5309 * formatter and save the user info data. | |
5310 */ | |
5311 void set_vcard_dialog_ok_clicked(GtkWidget *widget, gpointer data) | |
5312 { | |
5313 MultiEntryDlg *b = (MultiEntryDlg *) data; | |
5314 struct gaim_connection *gc; | |
5315 gchar *tmp; | |
5316 GSList *list; | |
5317 | |
5318 for(list = b->multi_entry_items; list != NULL; list = list->next) { | |
5319 if(((MultiEntryData *) list->data)->text != NULL) { | |
5320 g_free(((MultiEntryData *) list->data)->text); | |
5321 } | |
5322 ((MultiEntryData *) list->data)->text = | |
5323 g_strdup(gtk_entry_get_text(GTK_ENTRY(((MultiEntryData *) list->data)->widget))); | |
5324 } | |
5325 | |
5326 for(list = b->multi_text_items; list != NULL; list = list->next) { | |
5327 if(((MultiTextData *) list->data)->text != NULL) { | |
5328 g_free(((MultiTextData *) list->data)->text); | |
5329 } | |
5330 ((MultiTextData *) list->data)->text = | |
5331 gtk_editable_get_chars((GtkEditable *) (((MultiTextData *) list->data)->textbox), | |
5332 0, -1); | |
5333 } | |
5334 | |
5335 | |
5336 tmp = b->custom(b); | |
5337 | |
5338 /* | |
5339 * Set the user info and (possibly) send to the server | |
5340 */ | |
5341 if (b->user) { | |
5342 strncpy(b->user->user_info, tmp, sizeof b->user->user_info); | |
5343 gc = b->user->gc; | |
5344 | |
5345 save_prefs(); | |
5346 | |
5347 if (gc) | |
5348 serv_set_info(gc, b->user->user_info); | |
5349 } | |
5350 | |
5351 g_free(tmp); | |
5352 | |
5353 /* Let multi-edit dialog window "destroy" event catching handle remaining cleanup */ | |
5354 gtk_widget_destroy(GTK_WIDGET (b->window)); | |
5355 } | |
5356 | |
5357 /* | |
5358 * Instantiate a v-card dialog | |
5359 */ | |
5360 void show_set_vcard(MultiEntryDlg *b) | |
5361 { | |
5362 b->ok = set_vcard_dialog_ok_clicked; | |
5363 b->cancel = multi_entry_dialog_destroy; | |
5364 | |
5365 show_multi_entry_dialog(b); | |
5366 } | |
5367 | |
5368 | |
5369 /*------------------------------------------------------------------------*/ | |
5370 /* End dialog for setting v-card info */ | |
5371 /*------------------------------------------------------------------------*/ | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
5372 |