Mercurial > pidgin.yaz
annotate src/dialogs.c @ 4586:c7986b4d182a
[gaim-migrate @ 4870]
Matthew Smith (smigs) writes:
"- Some more i18n _() added. (ticker.c, timestamp.c)
- A couple of dialogs given titles (instead of
"Unnamed"). (dialogs.c)
- Lots more files added to POTFILES.in
- I cleaned up the file list in HACKING, removing files
that no longer exist, and changing names/locations for others."
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Tue, 18 Feb 2003 14:36:15 +0000 |
parents | 3196d9044a45 |
children | 221fb7143cd4 |
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 |
4491 | 139 struct gaim_account *account; |
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; |
4491 | 198 struct gaim_account *account; |
1 | 199 GtkWidget *text; |
200 GtkWidget *save; | |
201 GtkWidget *cancel; | |
202 }; | |
203 | |
2344 | 204 struct set_icon_dlg { |
205 GtkWidget *window; | |
4491 | 206 struct gaim_account *account; |
2344 | 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 | |
4586 | 408 w->window = gtk_dialog_new_with_buttons(_("Gaim - Warn User"), 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; |
4397
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4372
diff
changeset
|
455 gchar *name = g_strdup(b->name); /* b->name is null after remove_buddy */ |
2743 | 456 |
457 if (!b) | |
458 return; | |
459 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
460 g = find_group_by_buddy(b); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
461 |
4059 | 462 debug_printf(_("Removing '%s' from buddy list.\n"), b->name); |
4491 | 463 serv_remove_buddy(b->account->gc, name, g->name); |
4349 | 464 remove_buddy(b); |
465 gaim_blist_save(); | |
2743 | 466 |
4397
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4372
diff
changeset
|
467 c = gaim_find_conversation(name); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
468 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
469 if (c != NULL) |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
470 gaim_conversation_update(c, GAIM_CONV_UPDATE_REMOVE); |
4397
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4372
diff
changeset
|
471 |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4372
diff
changeset
|
472 g_free(name); |
2743 | 473 } |
474 | |
475 void show_confirm_del(struct gaim_connection *gc, gchar *name) | |
476 { | |
4491 | 477 struct buddy *bd = find_buddy(gc->account, name); |
3753 | 478 char *text; |
479 if (!bd) | |
480 return; | |
481 | |
4309 | 482 text = g_strdup_printf(_("You are about to remove %s from your buddy list. Do you want to continue?"), name); |
483 do_ask_dialog(_("Remove Buddy"), text, bd, _("Remove Buddy"), do_remove_buddy, _("Cancel"), NULL, NULL, FALSE); | |
3753 | 484 g_free(text); |
2743 | 485 } |
486 | |
487 | |
1 | 488 |
489 /*------------------------------------------------------------------------*/ | |
490 /* The dialog for getting an error */ | |
491 /*------------------------------------------------------------------------*/ | |
492 | |
3466 | 493 GtkWidget *do_error_dialog(const char *primary, const char *secondary, int type) |
1 | 494 { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
495 GtkWidget *d; |
1 | 496 GtkWidget *label; |
3374 | 497 GtkWidget *img = NULL; |
3427 | 498 GtkWidget *hbox; |
499 char labeltext[1024 * 2]; | |
500 char *filename = NULL; | |
501 | |
502 /* These are the GTK stock dialog icons with our little Gaim logo on top. | |
503 * Inspired by the GIMP. */ | |
3374 | 504 switch (type){ |
505 case GAIM_LOGO: | |
3427 | 506 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "gaim.png", NULL); |
507 break; | |
508 case GAIM_INFO: | |
509 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "dialogs", "gaim_info.png", NULL); | |
510 break; | |
3516 | 511 case GAIM_WARNING: |
3427 | 512 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "dialogs", "gaim_warning.png", NULL); |
513 break; | |
3516 | 514 case GAIM_ERROR: |
3427 | 515 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "dialogs", "gaim_error.png", NULL); |
516 break; | |
517 /* case GAIM_QUESTION: | |
518 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "dialogs", "gaim_question.png", NULL); | |
519 break; | |
520 */ | |
521 } | |
522 if (filename) { | |
523 img = gtk_image_new_from_file(filename); | |
3523 | 524 g_free(filename); |
3427 | 525 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); |
3374 | 526 } |
4272 | 527 d = gtk_dialog_new_with_buttons("", NULL, 0, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); |
3427 | 528 g_signal_connect(d, "response", G_CALLBACK(gtk_widget_destroy), NULL); |
529 | |
530 gtk_container_set_border_width (GTK_CONTAINER(d), 6); | |
531 gtk_window_set_resizable(GTK_WINDOW(d), FALSE); | |
532 gtk_dialog_set_has_separator(GTK_DIALOG(d), FALSE); | |
533 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(d)->vbox), 12); | |
534 gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(d)->vbox), 6); | |
535 | |
536 hbox = gtk_hbox_new(FALSE, 12); | |
537 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(d)->vbox), hbox); | |
538 if (filename) { | |
539 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
540 } | |
541 gtk_widget_show(img); | |
542 | |
543 g_snprintf(labeltext, sizeof(labeltext), "<span weight=\"bold\" size=\"larger\">%s</span>\n\n%s", primary, secondary ? secondary : ""); | |
544 | |
545 label = gtk_label_new(NULL); | |
546 gtk_label_set_markup(GTK_LABEL(label), labeltext); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
547 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); |
3427 | 548 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); |
1 | 549 gtk_widget_show(label); |
3427 | 550 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
551 | |
552 gtk_widget_show(hbox); | |
1 | 553 |
554 gtk_widget_show(d); | |
1817
b367beee6448
[gaim-migrate @ 1827]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
555 return d; |
1 | 556 } |
557 | |
558 | |
559 | |
3816 | 560 static void do_im(GtkWidget *widget, int resp, struct getuserinfo *info) |
1 | 561 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
562 const char *who; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
563 struct gaim_conversation *conv; |
4491 | 564 struct gaim_account *account; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
565 |
3802 | 566 if (resp == GTK_RESPONSE_OK) { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
567 who = gtk_entry_get_text(GTK_ENTRY(info->entry)); |
4476
62c1e5e656d0
[gaim-migrate @ 4751]
Christian Hammond <chipx86@chipx86.com>
parents:
4472
diff
changeset
|
568 |
3802 | 569 if (!g_strcasecmp(who, "")) { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
570 g_free(info); |
3802 | 571 return; |
572 } | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
573 |
4491 | 574 account = (info->gc ? info->gc->account : NULL); |
4476
62c1e5e656d0
[gaim-migrate @ 4751]
Christian Hammond <chipx86@chipx86.com>
parents:
4472
diff
changeset
|
575 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
576 conv = gaim_find_conversation(who); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
577 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
578 if (conv == NULL) |
4491 | 579 conv = gaim_conversation_new(GAIM_CONV_IM, account, who); |
4476
62c1e5e656d0
[gaim-migrate @ 4751]
Christian Hammond <chipx86@chipx86.com>
parents:
4472
diff
changeset
|
580 else { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
581 gaim_window_raise(gaim_conversation_get_window(conv)); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
582 |
4491 | 583 if (account) |
584 gaim_conversation_set_account(conv, account); | |
4476
62c1e5e656d0
[gaim-migrate @ 4751]
Christian Hammond <chipx86@chipx86.com>
parents:
4472
diff
changeset
|
585 } |
1 | 586 } |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
587 |
3816 | 588 destroy_dialog(NULL, imdialog); |
589 imdialog = NULL; | |
4138 | 590 g_free(info); |
1 | 591 } |
592 | |
3802 | 593 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
|
594 { |
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
934
diff
changeset
|
595 char *who; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
596 |
3802 | 597 if (resp == GTK_RESPONSE_OK) { |
598 who = g_strdup(normalize(gtk_entry_get_text(GTK_ENTRY(info->entry)))); | |
599 | |
600 if (!g_strcasecmp(who, "")) { | |
601 g_free(who); | |
602 return; | |
603 } | |
604 | |
605 /* what do we want to do about this case? */ | |
606 if (info->gc) | |
607 serv_get_info(info->gc, who); | |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
608 g_free(who); |
935
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
934
diff
changeset
|
609 } |
3802 | 610 gtk_widget_destroy(GTK_WIDGET(widget)); |
4138 | 611 g_free(info); |
935
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
934
diff
changeset
|
612 } |
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
934
diff
changeset
|
613 |
1 | 614 void show_ee_dialog(int ee) |
615 { | |
3767 | 616 GtkWidget *window; |
617 GtkWidget *hbox; | |
1 | 618 GtkWidget *label; |
3767 | 619 |
620 char *filename = g_build_filename(DATADIR, "pixmaps", "gaim", "dialogs", "gaim_cool.png", NULL); | |
621 GtkWidget *img = gtk_image_new_from_file(filename); | |
622 | |
623 label = gtk_label_new(NULL); | |
1 | 624 if (ee == 0) |
3767 | 625 gtk_label_set_markup(GTK_LABEL(label), |
626 "<span weight=\"bold\" size=\"large\" foreground=\"purple\">Amazing! Simply Amazing!</span>"); | |
1 | 627 else if (ee == 1) |
3767 | 628 gtk_label_set_markup(GTK_LABEL(label), |
629 "<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
|
630 else if (ee == 2) |
3767 | 631 gtk_label_set_markup(GTK_LABEL(label), |
632 "<span weight=\"bold\" size=\"large\" foreground=\"blue\">You should be me. I'm so cute!</span>"); | |
2472 | 633 else if (ee == 3) |
3767 | 634 gtk_label_set_markup(GTK_LABEL(label), |
635 "<span weight=\"bold\" size=\"large\" foreground=\"orange\">Now that's what I like!</span>"); | |
2993 | 636 else if (ee == 4) |
3767 | 637 gtk_label_set_markup(GTK_LABEL(label), |
638 "<span weight=\"bold\" size=\"large\" foreground=\"brown\">Ahh, and excellent choice!</span>"); | |
3043 | 639 else if (ee == 5) |
3767 | 640 gtk_label_set_markup(GTK_LABEL(label), |
641 "<span weight=\"bold\" size=\"large\" foreground=\"#009900\">Everytime you click my name, an angel gets its wings.</span>"); | |
3152 | 642 else if (ee == 6) |
3767 | 643 gtk_label_set_markup(GTK_LABEL(label), |
644 "<span weight=\"bold\" size=\"large\" foreground=\"red\">This sunflower seed taste like pizza.</span>"); | |
3508 | 645 else if (ee == 7) |
3767 | 646 gtk_label_set_markup(GTK_LABEL(label), |
647 "<span weight=\"bold\" size=\"large\" foreground=\"#6364B1\">Hey! I was in that tumbleweed!</span>"); | |
3508 | 648 else |
3767 | 649 gtk_label_set_markup(GTK_LABEL(label), |
650 "<span weight=\"bold\" size=\"large\" foreground=\"gray\">I'm not anything.</span>"); | |
651 | |
652 window = gtk_dialog_new_with_buttons("", GTK_WINDOW(blist), GTK_DIALOG_MODAL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); | |
653 gtk_dialog_set_default_response (GTK_DIALOG(window), GTK_RESPONSE_OK); | |
654 g_signal_connect(G_OBJECT(window), "response", G_CALLBACK(gtk_widget_destroy), NULL); | |
3152 | 655 |
3767 | 656 gtk_container_set_border_width (GTK_CONTAINER(window), 6); |
657 gtk_window_set_resizable(GTK_WINDOW(window), FALSE); | |
658 gtk_dialog_set_has_separator(GTK_DIALOG(window), FALSE); | |
659 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(window)->vbox), 12); | |
660 gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(window)->vbox), 6); | |
661 | |
662 hbox = gtk_hbox_new(FALSE, 12); | |
663 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(window)->vbox), hbox); | |
664 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
665 | |
666 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
667 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
668 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
669 | |
670 gtk_widget_show_all(window); | |
1 | 671 } |
672 | |
3816 | 673 void show_info_select_account(GtkObject *w, struct gaim_connection *gc) |
674 { | |
675 struct getuserinfo *info = gtk_object_get_user_data(w); | |
676 info->gc = gc; | |
677 } | |
678 | |
935
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
934
diff
changeset
|
679 void show_im_dialog() |
1 | 680 { |
3802 | 681 GtkWidget *hbox, *vbox; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
682 GtkWidget *label; |
3816 | 683 GtkWidget *table, *menu, *opt; |
684 GSList *g = connections; | |
685 struct gaim_connection *c; | |
686 char buf[256]; | |
3802 | 687 char *filename = g_build_filename(DATADIR, "pixmaps", "gaim", "dialogs", "gaim_question.png", NULL); |
688 GtkWidget *img = gtk_image_new_from_file(filename); | |
3816 | 689 struct getuserinfo *info = NULL; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
690 |
4138 | 691 g_free(filename); |
692 | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
693 if (!imdialog) { |
3816 | 694 info = g_new0(struct getuserinfo, 1); |
695 info->gc = connections->data; | |
4472 | 696 imdialog = gtk_dialog_new_with_buttons(_("Gaim - New Message"), blist ? GTK_WINDOW(blist) : NULL, GTK_DIALOG_MODAL, |
3802 | 697 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); |
698 gtk_dialog_set_default_response (GTK_DIALOG(imdialog), GTK_RESPONSE_OK); | |
699 gtk_container_set_border_width (GTK_CONTAINER(imdialog), 6); | |
700 gtk_window_set_resizable(GTK_WINDOW(imdialog), FALSE); | |
701 gtk_dialog_set_has_separator(GTK_DIALOG(imdialog), FALSE); | |
702 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(imdialog)->vbox), 12); | |
703 gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(imdialog)->vbox), 6); | |
704 | |
705 hbox = gtk_hbox_new(FALSE, 12); | |
706 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(imdialog)->vbox), hbox); | |
707 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
708 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
709 | |
710 vbox = gtk_vbox_new(FALSE, 0); | |
711 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
712 | |
713 label = gtk_label_new(_("Please enter the screenname of the person you would like to IM.\n")); | |
3825 | 714 gtk_widget_set_size_request(GTK_WIDGET(label), 350, -1); |
3802 | 715 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); |
716 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
717 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
718 | |
719 hbox = gtk_hbox_new(FALSE, 6); | |
720 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
721 | |
3816 | 722 table = gtk_table_new(2, 2, FALSE); |
723 gtk_table_set_row_spacings(GTK_TABLE(table), 6); | |
724 gtk_table_set_col_spacings(GTK_TABLE(table), 6); | |
725 gtk_container_set_border_width(GTK_CONTAINER(table), 12); | |
726 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); | |
727 | |
3802 | 728 label = gtk_label_new(NULL); |
3816 | 729 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Screenname:")); |
3823 | 730 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); |
3816 | 731 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); |
732 | |
733 info->entry = gtk_entry_new(); | |
734 gtk_table_attach_defaults(GTK_TABLE(table), info->entry, 1, 2, 0, 1); | |
735 gtk_entry_set_activates_default (GTK_ENTRY(info->entry), TRUE); | |
736 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(info->entry)); | |
737 | |
738 if (connections->next) { | |
739 | |
740 label = gtk_label_new(NULL); | |
741 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); | |
742 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Account:")); | |
743 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
744 | |
745 info->account = gtk_option_menu_new(); | |
746 gtk_table_attach_defaults(GTK_TABLE(table), info->account, 1, 2, 1, 2); | |
747 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(info->account)); | |
748 | |
749 menu = gtk_menu_new(); | |
750 | |
751 while (g) { | |
752 c = (struct gaim_connection *)g->data; | |
753 if (!c->prpl->send_im) { | |
754 g = g->next; | |
755 continue; | |
756 } | |
757 g_snprintf(buf, sizeof(buf), "%s (%s)", c->username, c->prpl->name); | |
758 opt = gtk_menu_item_new_with_label(buf); | |
759 gtk_object_set_user_data(GTK_OBJECT(opt), info); | |
760 | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
761 g_signal_connect(GTK_OBJECT(opt), "activate", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
762 G_CALLBACK(show_info_select_account), c); |
3816 | 763 |
764 gtk_menu_append(GTK_MENU(menu), opt); | |
765 g = g->next; | |
766 } | |
767 | |
768 gtk_option_menu_set_menu(GTK_OPTION_MENU(info->account), menu); | |
769 } | |
3802 | 770 |
3816 | 771 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
|
772 } |
3816 | 773 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
774 gtk_widget_show_all(imdialog); |
3816 | 775 if (info) |
776 gtk_widget_grab_focus(GTK_WIDGET(info->entry)); | |
3197 | 777 } |
778 | |
935
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
934
diff
changeset
|
779 void show_info_dialog() |
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
934
diff
changeset
|
780 { |
3802 | 781 GtkWidget *window, *hbox, *vbox; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
782 GtkWidget *label; |
3802 | 783 char *filename = g_build_filename(DATADIR, "pixmaps", "gaim", "dialogs", "gaim_question.png", NULL); |
784 GtkWidget *img = gtk_image_new_from_file(filename); | |
785 GtkWidget *table, *menu, *opt; | |
3197 | 786 GSList *g = connections; |
787 struct gaim_connection *c; | |
788 struct getuserinfo *info = g_new0(struct getuserinfo, 1); | |
3802 | 789 char buf[256]; |
790 | |
4138 | 791 g_free(filename); |
3197 | 792 info->gc = connections->data; |
793 | |
4472 | 794 window = gtk_dialog_new_with_buttons(_("Gaim - Get User Info"), blist ? GTK_WINDOW(blist) : NULL, GTK_DIALOG_MODAL, |
3802 | 795 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); |
796 gtk_dialog_set_default_response (GTK_DIALOG(window), GTK_RESPONSE_OK); | |
797 gtk_container_set_border_width (GTK_CONTAINER(window), 6); | |
798 gtk_window_set_resizable(GTK_WINDOW(window), FALSE); | |
799 gtk_dialog_set_has_separator(GTK_DIALOG(window), FALSE); | |
800 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(window)->vbox), 12); | |
801 gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(window)->vbox), 6); | |
802 | |
803 hbox = gtk_hbox_new(FALSE, 12); | |
804 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(window)->vbox), hbox); | |
805 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
806 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
807 | |
808 vbox = gtk_vbox_new(FALSE, 0); | |
809 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
810 | |
811 label = gtk_label_new(_("Please enter the screenname of the person whose info you would like to view.\n")); | |
812 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
813 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
814 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
815 | |
3197 | 816 table = gtk_table_new(2, 2, FALSE); |
3802 | 817 gtk_table_set_row_spacings(GTK_TABLE(table), 6); |
818 gtk_table_set_col_spacings(GTK_TABLE(table), 6); | |
819 gtk_container_set_border_width(GTK_CONTAINER(table), 12); | |
820 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); | |
821 | |
822 label = gtk_label_new(NULL); | |
823 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Screenname:")); | |
3822 | 824 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); |
3197 | 825 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); |
826 | |
827 info->entry = gtk_entry_new(); | |
828 gtk_table_attach_defaults(GTK_TABLE(table), info->entry, 1, 2, 0, 1); | |
3802 | 829 gtk_entry_set_activates_default (GTK_ENTRY(info->entry), TRUE); |
830 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(info->entry)); | |
831 | |
3197 | 832 if (connections->next) { |
833 | |
3802 | 834 label = gtk_label_new(NULL); |
3197 | 835 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); |
3802 | 836 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Account:")); |
837 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
1225 | 838 |
3197 | 839 info->account = gtk_option_menu_new(); |
840 gtk_table_attach_defaults(GTK_TABLE(table), info->account, 1, 2, 1, 2); | |
3802 | 841 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(info->account)); |
842 | |
3197 | 843 menu = gtk_menu_new(); |
844 | |
845 while (g) { | |
846 c = (struct gaim_connection *)g->data; | |
3802 | 847 if (!c->prpl->get_info) { |
848 g = g->next; | |
849 continue; | |
850 } | |
3572 | 851 g_snprintf(buf, sizeof(buf), "%s (%s)", c->username, c->prpl->name); |
3197 | 852 opt = gtk_menu_item_new_with_label(buf); |
853 gtk_object_set_user_data(GTK_OBJECT(opt), info); | |
854 | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
855 g_signal_connect(GTK_OBJECT(opt), "activate", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
856 G_CALLBACK(show_info_select_account), c); |
3197 | 857 |
858 gtk_menu_append(GTK_MENU(menu), opt); | |
859 g = g->next; | |
860 } | |
3802 | 861 |
3197 | 862 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
|
863 } |
3197 | 864 |
3802 | 865 g_signal_connect(G_OBJECT(window), "response", G_CALLBACK(do_info), info); |
866 | |
867 | |
868 gtk_widget_show_all(window); | |
869 if (info->entry) | |
870 gtk_widget_grab_focus(GTK_WIDGET(info->entry)); | |
935
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
934
diff
changeset
|
871 } |
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
934
diff
changeset
|
872 |
1 | 873 |
874 /*------------------------------------------------------------------------*/ | |
875 /* The dialog for adding buddies */ | |
876 /*------------------------------------------------------------------------*/ | |
877 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
878 extern void add_callback(GtkWidget *, struct gaim_conversation *); |
654
ea811c6dd3e0
[gaim-migrate @ 664]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
653
diff
changeset
|
879 |
4180 | 880 void do_add_buddy(GtkWidget *w, int resp, struct addbuddy *a) |
1 | 881 { |
3466 | 882 const char *grp, *who, *whoalias; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
883 struct gaim_conversation *c; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
884 |
4180 | 885 if (resp == GTK_RESPONSE_OK) { |
886 | |
887 who = gtk_entry_get_text(GTK_ENTRY(a->entry)); | |
888 grp = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(a->combo)->entry)); | |
889 whoalias = gtk_entry_get_text(GTK_ENTRY(a->entry_for_alias)); | |
890 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
891 c = gaim_find_conversation(who); |
4180 | 892 |
4491 | 893 add_buddy(a->gc->account, grp, who, whoalias); |
4180 | 894 serv_add_buddy(a->gc, who); |
895 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
896 if (c != NULL) |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
897 gaim_conversation_update(c, GAIM_CONV_UPDATE_ADD); |
4180 | 898 |
4349 | 899 gaim_blist_save(); |
654
ea811c6dd3e0
[gaim-migrate @ 664]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
653
diff
changeset
|
900 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
901 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
902 destroy_dialog(NULL, a->window); |
1 | 903 } |
904 | |
3819 | 905 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
|
906 { |
3466 | 907 const char *grp; |
4349 | 908 |
3819 | 909 if (resp == GTK_RESPONSE_OK) { |
910 grp = gtk_entry_get_text(GTK_ENTRY(a->entry)); | |
911 | |
912 if (!a->gc) | |
913 a->gc = connections->data; | |
914 | |
4349 | 915 add_group(grp); |
916 gaim_blist_save(); | |
3819 | 917 } |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
918 |
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
919 destroy_dialog(NULL, a->window); |
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
920 } |
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
921 |
1 | 922 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
923 static GList *groups_tree(struct gaim_connection *gc) |
1 | 924 { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
925 GList *tmp = NULL; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
926 char *tmp2; |
1 | 927 struct group *g; |
4349 | 928 GSList *grp = groups; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
929 |
1 | 930 if (!grp) { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
931 tmp2 = g_strdup(_("Buddies")); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
932 tmp = g_list_append(tmp, tmp2); |
1 | 933 } else { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
934 while (grp) { |
1 | 935 g = (struct group *)grp->data; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
936 tmp2 = g->name; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
937 tmp = g_list_append(tmp, tmp2); |
940 | 938 grp = g_slist_next(grp); |
1 | 939 } |
940 } | |
941 return tmp; | |
942 } | |
943 | |
825
9108277c95e9
[gaim-migrate @ 835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
804
diff
changeset
|
944 static void free_dialog(GtkWidget *w, struct addbuddy *a) |
9108277c95e9
[gaim-migrate @ 835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
804
diff
changeset
|
945 { |
9108277c95e9
[gaim-migrate @ 835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
804
diff
changeset
|
946 g_free(a); |
9108277c95e9
[gaim-migrate @ 835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
804
diff
changeset
|
947 } |
9108277c95e9
[gaim-migrate @ 835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
804
diff
changeset
|
948 |
1 | 949 |
1072
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
950 void show_add_group(struct gaim_connection *gc) |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
951 { |
3819 | 952 |
953 GtkWidget *hbox, *vbox; | |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
954 GtkWidget *label; |
3819 | 955 char *filename = g_build_filename(DATADIR, "pixmaps", "gaim", "dialogs", "gaim_question.png", NULL); |
956 GtkWidget *img = gtk_image_new_from_file(filename); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
957 struct addbuddy *a = g_new0(struct addbuddy, 1); |
4138 | 958 |
959 g_free(filename); | |
1072
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
960 a->gc = gc; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
961 |
4183 | 962 a->window = gtk_dialog_new_with_buttons(_("Gaim - Add Group"), GTK_WINDOW(blist), GTK_DIALOG_MODAL, |
3819 | 963 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_ADD, GTK_RESPONSE_OK, NULL); |
964 gtk_dialog_set_default_response (GTK_DIALOG(a->window), GTK_RESPONSE_OK); | |
965 gtk_container_set_border_width (GTK_CONTAINER(a->window), 6); | |
966 gtk_window_set_resizable(GTK_WINDOW(a->window), FALSE); | |
967 gtk_dialog_set_has_separator(GTK_DIALOG(a->window), FALSE); | |
968 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(a->window)->vbox), 12); | |
969 gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(a->window)->vbox), 6); | |
970 | |
971 hbox = gtk_hbox_new(FALSE, 12); | |
972 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(a->window)->vbox), hbox); | |
973 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
974 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
975 | |
976 vbox = gtk_vbox_new(FALSE, 0); | |
977 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
978 | |
979 label = gtk_label_new(_("Please enter the name of the group to be added.\n")); | |
980 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
981 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
982 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
983 | |
984 hbox = gtk_hbox_new(FALSE, 6); | |
985 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
986 | |
987 label = gtk_label_new(NULL); | |
988 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Group:")); | |
989 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
990 | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
991 a->entry = gtk_entry_new(); |
3819 | 992 gtk_entry_set_activates_default (GTK_ENTRY(a->entry), TRUE); |
993 gtk_box_pack_start(GTK_BOX(hbox), a->entry, FALSE, FALSE, 0); | |
994 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(a->entry)); | |
995 | |
996 g_signal_connect(G_OBJECT(a->window), "response", G_CALLBACK(do_add_group), a); | |
997 | |
998 gtk_widget_show_all(a->window); | |
999 gtk_widget_grab_focus(GTK_WIDGET(a->entry)); | |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
1000 } |
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
1001 |
2527 | 1002 static void addbuddy_select_account(GtkObject *w, struct gaim_connection *gc) |
1003 { | |
1004 struct addbuddy *b = gtk_object_get_user_data(w); | |
1005 | |
2561 | 1006 /* Save our account */ |
2527 | 1007 b->gc = gc; |
2561 | 1008 |
1009 /* We also want to update our group list */ | |
2598
b2800bca74fe
[gaim-migrate @ 2611]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2582
diff
changeset
|
1010 gtk_combo_set_popdown_strings(GTK_COMBO(b->combo), groups_tree(gc)); |
2527 | 1011 } |
1012 | |
1013 static void create_online_user_names(struct addbuddy *b) | |
1014 { | |
1015 char buf[2048]; /* Never hurts to be safe ;-) */ | |
1016 GSList *g = connections; | |
1017 struct gaim_connection *c; | |
1018 GtkWidget *menu, *opt; | |
1019 int count = 0; | |
1020 int place = 0; | |
1021 | |
1022 menu = gtk_menu_new(); | |
1023 | |
1024 while (g) { | |
1025 c = (struct gaim_connection *)g->data; | |
1026 g_snprintf(buf, sizeof(buf), "%s (%s)", | |
3572 | 1027 c->username, c->prpl->name); |
2527 | 1028 opt = gtk_menu_item_new_with_label(buf); |
1029 gtk_object_set_user_data(GTK_OBJECT(opt), b); | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
1030 g_signal_connect(GTK_OBJECT(opt), "activate", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
1031 G_CALLBACK(addbuddy_select_account), |
2527 | 1032 c); |
1033 gtk_widget_show(opt); | |
1034 gtk_menu_append(GTK_MENU(menu), opt); | |
1035 | |
1036 /* Now check to see if it's our current menu */ | |
1037 if (c == b->gc) { | |
1038 place = count; | |
1039 gtk_menu_item_activate(GTK_MENU_ITEM(opt)); | |
1040 gtk_option_menu_set_history(GTK_OPTION_MENU(b->account), count); | |
1041 | |
1042 /* Do the cha cha cha */ | |
1043 } | |
1044 | |
1045 count++; | |
1046 | |
1047 g = g->next; | |
1048 } | |
1049 | |
1050 gtk_option_menu_remove_menu(GTK_OPTION_MENU(b->account)); | |
1051 gtk_option_menu_set_menu(GTK_OPTION_MENU(b->account), menu); | |
1052 gtk_option_menu_set_history(GTK_OPTION_MENU(b->account), place); | |
1053 | |
1054 gtk_widget_show(b->account); | |
1055 gtk_widget_show(b->account->parent); | |
1056 | |
1057 } | |
1058 | |
2582
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2572
diff
changeset
|
1059 void show_add_buddy(struct gaim_connection *gc, char *buddy, char *group, char *alias) |
1 | 1060 { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1061 GtkWidget *table; |
1 | 1062 GtkWidget *label; |
4180 | 1063 GtkWidget *hbox; |
1064 GtkWidget *vbox; | |
1065 | |
1066 char *filename = g_build_filename(DATADIR, "pixmaps", "gaim", "dialogs", "gaim_question.png", NULL); | |
1067 GtkWidget *img = gtk_image_new_from_file(filename); | |
236 | 1068 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1069 struct addbuddy *a = g_new0(struct addbuddy, 1); |
2598
b2800bca74fe
[gaim-migrate @ 2611]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2582
diff
changeset
|
1070 a->gc = gc ? gc : connections->data; |
1210 | 1071 |
4180 | 1072 g_free(filename); |
1073 | |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
1074 GAIM_DIALOG(a->window); |
4180 | 1075 a->window = gtk_dialog_new_with_buttons(_("Gaim - Add Buddy"), blist ? GTK_WINDOW(blist) : NULL, GTK_DIALOG_MODAL, |
1076 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_ADD, GTK_RESPONSE_OK, NULL); | |
1077 | |
1078 gtk_dialog_set_default_response(GTK_DIALOG(a->window), GTK_RESPONSE_OK); | |
1079 gtk_container_set_border_width(GTK_CONTAINER(a->window), 6); | |
1080 gtk_window_set_resizable(GTK_WINDOW(a->window), FALSE); | |
1081 gtk_dialog_set_has_separator(GTK_DIALOG(a->window), FALSE); | |
1082 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(a->window)->vbox), 12); | |
1083 gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(a->window)->vbox), 6); | |
4074 | 1084 gtk_window_set_role(GTK_WINDOW(a->window), "add_buddy"); |
4180 | 1085 |
1086 hbox = gtk_hbox_new(FALSE, 12); | |
1087 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(a->window)->vbox), hbox); | |
1088 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
1089 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
1090 | |
1091 vbox = gtk_vbox_new(FALSE, 0); | |
1092 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
1093 | |
1094 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")); | |
1095 gtk_widget_set_size_request(GTK_WIDGET(label), 400, -1); | |
1096 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
1097 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
1098 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
1099 | |
1100 hbox = gtk_hbox_new(FALSE, 6); | |
1101 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
1102 | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
1103 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
|
1104 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
|
1105 dialogwindows = g_list_prepend(dialogwindows, a->window); |
428372cc1e39
[gaim-migrate @ 1161]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1144
diff
changeset
|
1106 |
2529 | 1107 table = gtk_table_new(4, 2, FALSE); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1108 gtk_table_set_row_spacings(GTK_TABLE(table), 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1109 gtk_table_set_col_spacings(GTK_TABLE(table), 5); |
4180 | 1110 gtk_container_set_border_width(GTK_CONTAINER(table), 0); |
1111 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); | |
1112 | |
1113 label = gtk_label_new(_("Screen Name")); | |
1114 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1115 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
|
1116 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1117 a->entry = gtk_entry_new(); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1118 gtk_table_attach_defaults(GTK_TABLE(table), a->entry, 1, 2, 0, 1); |
3333 | 1119 gtk_widget_grab_focus(a->entry); |
4183 | 1120 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1121 if (buddy != NULL) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1122 gtk_entry_set_text(GTK_ENTRY(a->entry), buddy); |
4183 | 1123 |
1124 gtk_entry_set_activates_default (GTK_ENTRY(a->entry), TRUE); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1125 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1126 label = gtk_label_new(_("Alias")); |
4180 | 1127 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1128 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
|
1129 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1130 a->entry_for_alias = gtk_entry_new(); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1131 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
|
1132 if (alias != NULL) |
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2572
diff
changeset
|
1133 gtk_entry_set_text(GTK_ENTRY(a->entry_for_alias), alias); |
4183 | 1134 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
|
1135 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1136 label = gtk_label_new(_("Group")); |
4180 | 1137 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1138 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
|
1139 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1140 a->combo = gtk_combo_new(); |
2598
b2800bca74fe
[gaim-migrate @ 2611]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2582
diff
changeset
|
1141 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
|
1142 gtk_table_attach_defaults(GTK_TABLE(table), a->combo, 1, 2, 2, 3); |
1210 | 1143 |
2527 | 1144 /* Set up stuff for the account box */ |
1145 label = gtk_label_new(_("Add To")); | |
4180 | 1146 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
2527 | 1147 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 3, 4); |
1148 | |
1149 a->account = gtk_option_menu_new(); | |
1150 gtk_table_attach_defaults(GTK_TABLE(table), a->account, 1, 2, 3, 4); | |
1151 | |
1152 create_online_user_names(a); | |
1153 | |
1154 /* End of account box */ | |
1155 | |
4180 | 1156 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
|
1157 |
1210 | 1158 gtk_widget_show_all(a->window); |
4180 | 1159 |
2995 | 1160 if (group != NULL) |
1161 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(a->combo)->entry), group); | |
1 | 1162 } |
1163 | |
1164 | |
3367 | 1165 /*------------------------------------------------------------------------* |
1166 * Privacy Settings * | |
1167 *------------------------------------------------------------------------*/ | |
1168 static GtkWidget *deny_type = NULL; | |
1169 static GtkWidget *deny_conn_hbox = NULL; | |
1170 static GtkWidget *deny_opt_menu = NULL; | |
1171 static struct gaim_connection *current_deny_gc = NULL; | |
1172 static gboolean current_is_deny = FALSE; | |
1173 static GtkWidget *allow_list = NULL; | |
1174 static GtkWidget *block_list = NULL; | |
1175 | |
4177 | 1176 static GtkListStore *block_store = NULL; |
1177 static GtkListStore *allow_store = NULL; | |
1178 | |
3367 | 1179 static void set_deny_mode(GtkWidget *w, int data) |
1180 { | |
1181 if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) | |
1182 return; | |
1183 debug_printf("setting deny mode %d\n", data); | |
4491 | 1184 current_deny_gc->account->permdeny = data; |
3367 | 1185 serv_set_permit_deny(current_deny_gc); |
4349 | 1186 gaim_blist_save(); |
3367 | 1187 } |
1188 | |
4178 | 1189 static GtkWidget *deny_opt(char *label, int which, GtkWidget *set) |
3367 | 1190 { |
1191 GtkWidget *opt; | |
1192 | |
1193 if (!set) | |
1194 opt = gtk_radio_button_new_with_label(NULL, label); | |
1195 else | |
1196 opt = | |
1197 gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(set)), | |
1198 label); | |
4178 | 1199 |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
1200 g_signal_connect(GTK_OBJECT(opt), "toggled", G_CALLBACK(set_deny_mode), (void *)which); |
3367 | 1201 gtk_widget_show(opt); |
4491 | 1202 if (current_deny_gc->account->permdeny == which) |
3367 | 1203 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE); |
1204 | |
1205 return opt; | |
1206 } | |
1207 | |
1208 static void des_deny_opt(GtkWidget *d, gpointer e) | |
1209 { | |
1210 gtk_widget_destroy(d); | |
1211 current_deny_gc = NULL; | |
1212 deny_conn_hbox = NULL; | |
1213 deny_type = NULL; | |
1214 deny_opt_menu = NULL; | |
1215 current_is_deny = FALSE; | |
1216 allow_list = NULL; | |
4177 | 1217 allow_store = NULL; |
1218 | |
3367 | 1219 block_list = NULL; |
4177 | 1220 block_store = NULL; |
3367 | 1221 } |
1222 | |
1223 static void set_deny_type() | |
1224 { | |
1225 GSList *bg = gtk_radio_button_group(GTK_RADIO_BUTTON(deny_type)); | |
1226 | |
4491 | 1227 switch (current_deny_gc->account->permdeny) { |
3786 | 1228 case 5: |
1229 bg = bg->next->next; | |
1230 break; | |
3367 | 1231 case 4: |
1232 break; | |
1233 case 3: | |
3786 | 1234 bg = bg->next->next->next; |
3367 | 1235 break; |
1236 case 2: | |
1237 bg = bg->next; | |
1238 break; | |
1239 case 1: | |
3786 | 1240 bg = bg->next->next->next->next; |
3367 | 1241 break; |
1242 } | |
1243 | |
1244 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(bg->data), TRUE); | |
1245 } | |
1246 | |
1247 void build_allow_list() | |
1248 { | |
1249 GSList *p; | |
4177 | 1250 GtkListStore *ls; |
1251 GtkTreeIter iter; | |
3367 | 1252 |
1253 if (!current_is_deny) | |
1254 return; | |
1255 | |
4491 | 1256 p = current_deny_gc->account->permit; |
3367 | 1257 |
4177 | 1258 gtk_list_store_clear(GTK_LIST_STORE(allow_store)); |
3367 | 1259 |
1260 while (p) { | |
4177 | 1261 ls = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(allow_list))); |
1262 | |
1263 gtk_list_store_append(ls, &iter); | |
1264 gtk_list_store_set(ls, &iter, 0, p->data, -1); | |
1265 | |
3367 | 1266 p = p->next; |
1267 } | |
1268 } | |
1269 | |
4177 | 1270 |
3367 | 1271 void build_block_list() |
1272 { | |
1273 GSList *d; | |
4177 | 1274 GtkListStore *ls; |
1275 GtkTreeIter iter; | |
3367 | 1276 |
1277 if (!current_is_deny) | |
1278 return; | |
1279 | |
4491 | 1280 d = current_deny_gc->account->deny; |
3367 | 1281 |
4177 | 1282 gtk_list_store_clear(GTK_LIST_STORE(block_store)); |
3367 | 1283 |
1284 while (d) { | |
4177 | 1285 ls = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(block_list))); |
1286 | |
1287 gtk_list_store_append(ls, &iter); | |
1288 gtk_list_store_set(ls, &iter, 0, d->data, -1); | |
1289 | |
3367 | 1290 d = d->next; |
1291 } | |
1292 } | |
1293 | |
1294 static void deny_gc_opt(GtkWidget *opt, struct gaim_connection *gc) | |
1295 { | |
1296 current_deny_gc = gc; | |
1297 set_deny_type(); | |
1298 build_allow_list(); | |
1299 build_block_list(); | |
1300 } | |
1301 | |
1302 static void build_deny_menu() | |
1303 { | |
1304 GtkWidget *menu; | |
1305 GtkWidget *opt; | |
1306 GSList *c = connections; | |
1307 struct gaim_connection *gc; | |
1308 int count = 0; | |
1309 gboolean found = FALSE; | |
1310 char buf[2048]; | |
1311 | |
1312 if (g_slist_length(connections) == 1) { | |
1313 gtk_widget_hide(deny_conn_hbox); | |
1314 return; | |
1315 } else | |
1316 gtk_widget_show(deny_conn_hbox); | |
1317 | |
1318 menu = gtk_menu_new(); | |
1319 | |
1320 while (c) { | |
1321 gc = (struct gaim_connection *)c->data; | |
1322 c = c->next; | |
1323 if (!gc->prpl->set_permit_deny) | |
1324 continue; | |
3572 | 1325 g_snprintf(buf, sizeof buf, "%s (%s)", gc->username, gc->prpl->name); |
3367 | 1326 opt = gtk_menu_item_new_with_label(buf); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
1327 g_signal_connect(GTK_OBJECT(opt), "activate", G_CALLBACK(deny_gc_opt), gc); |
3367 | 1328 gtk_widget_show(opt); |
1329 gtk_menu_append(GTK_MENU(menu), opt); | |
1330 if (gc == current_deny_gc) | |
1331 found = TRUE; | |
1332 else if (!found) | |
1333 count++; | |
1334 } | |
1335 | |
1336 if (!found) { | |
1337 current_deny_gc = connections->data; | |
1338 count = 0; | |
1339 } | |
1340 | |
1341 gtk_option_menu_remove_menu(GTK_OPTION_MENU(deny_opt_menu)); | |
1342 gtk_option_menu_set_menu(GTK_OPTION_MENU(deny_opt_menu), menu); | |
1343 gtk_option_menu_set_history(GTK_OPTION_MENU(deny_opt_menu), count); | |
1344 | |
1345 gtk_widget_show(menu); | |
1346 gtk_widget_show(deny_opt_menu); | |
1347 } | |
1348 | |
1349 static void pref_deny_add(GtkWidget *button, gboolean permit) | |
1350 { | |
1351 show_add_perm(current_deny_gc, NULL, permit); | |
1352 } | |
1353 | |
4177 | 1354 |
1355 gchar *find_permdeny_by_name(GSList *l, char *who) { | |
1356 gchar *name; | |
1357 | |
1358 while (l) { | |
1359 name = (gchar *)l->data; | |
1360 if (!strcmp(name, who)) { | |
1361 return name; | |
1362 } | |
1363 | |
1364 l = l->next; | |
1365 } | |
1366 | |
1367 return NULL; | |
1368 } | |
1369 | |
3367 | 1370 static void pref_deny_rem(GtkWidget *button, gboolean permit) |
1371 { | |
4177 | 1372 gchar *who; |
1373 GtkTreeIter iter; | |
1374 GtkTreeModel *mod; | |
1375 GtkTreeSelection *sel; | |
1376 | |
1377 if (permit) { | |
1378 mod = gtk_tree_view_get_model(GTK_TREE_VIEW(allow_list)); | |
1379 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(allow_list)); | |
1380 } else { | |
1381 mod = gtk_tree_view_get_model(GTK_TREE_VIEW(block_list)); | |
1382 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(block_list)); | |
1383 } | |
1384 | |
1385 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) | |
1386 gtk_tree_model_get(GTK_TREE_MODEL(mod), &iter, 0, &who, -1); | |
1387 else { | |
1388 return; | |
1389 } | |
3367 | 1390 |
1391 if (permit && !allow_list) | |
1392 return; | |
4177 | 1393 |
3367 | 1394 if (!permit && !block_list) |
1395 return; | |
1396 | |
1397 if (permit) { | |
4491 | 1398 char *name = find_permdeny_by_name(current_deny_gc->account->permit, who); |
4177 | 1399 |
1400 if (name) { | |
4491 | 1401 gaim_privacy_permit_remove(current_deny_gc->account, name); |
4308 | 1402 serv_rem_permit(current_deny_gc, who); |
4177 | 1403 build_allow_list(); |
1404 } | |
3367 | 1405 } else { |
4491 | 1406 char *name = find_permdeny_by_name(current_deny_gc->account->deny, who); |
4177 | 1407 |
1408 if (name) { | |
4491 | 1409 gaim_privacy_deny_remove(current_deny_gc->account, name); |
4177 | 1410 serv_rem_deny(current_deny_gc, who); |
1411 build_block_list(); | |
1412 } | |
3367 | 1413 } |
1414 | |
4349 | 1415 gaim_blist_save(); |
3367 | 1416 } |
1417 | |
1418 GtkWidget *privacy_win; | |
1419 void update_privacy_connections() { /* This is a slightly better name */ | |
1420 gboolean needdeny = FALSE; | |
1421 GSList *c = connections; | |
1422 struct gaim_connection *gc = NULL; | |
1423 | |
1424 if (!privacy_win) | |
1425 return; | |
1426 | |
1427 while (c) { | |
1428 gc = c->data; | |
1429 if (gc->prpl->set_permit_deny) | |
1430 break; | |
1431 gc = NULL; | |
1432 c = c->next; | |
1433 } | |
1434 needdeny = (gc != NULL); | |
1435 | |
1436 | |
1437 if (needdeny) { | |
1438 gtk_widget_set_sensitive(privacy_win, TRUE); | |
1439 build_deny_menu(); | |
1440 build_allow_list(); | |
1441 build_block_list(); | |
1442 } else { | |
1443 gtk_widget_set_sensitive(privacy_win, FALSE); | |
1444 } | |
1445 } | |
1446 static void destroy_privacy() { | |
1447 current_deny_gc = NULL; | |
1448 privacy_win = NULL; | |
1449 } | |
1450 | |
4177 | 1451 void show_privacy_options() { |
1452 GtkWidget *pwin; | |
1453 GtkWidget *box; | |
1454 GtkWidget *hbox; | |
1455 GtkWidget *label; | |
1456 GtkWidget *sw; | |
1457 GtkWidget *bbox; | |
1458 GtkWidget *button; | |
1459 GtkWidget *sep; | |
1460 GtkWidget *close_button; | |
1461 GtkSizeGroup *sg1 = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); | |
1462 GtkSizeGroup *sg2 = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); | |
1463 GtkCellRenderer *rend; | |
1464 GtkTreeViewColumn *col; | |
4178 | 1465 GtkWidget *table; |
4177 | 1466 |
1467 current_deny_gc = connections->data; /* this is safe because this screen will only be | |
1468 available when there are connections */ | |
1469 current_is_deny = TRUE; | |
1470 | |
1471 privacy_win = pwin = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
4179 | 1472 gtk_window_set_policy(GTK_WINDOW(pwin), FALSE, FALSE, TRUE); |
4177 | 1473 gtk_window_set_role(GTK_WINDOW(pwin), "privacy"); |
1474 gtk_window_set_title(GTK_WINDOW(pwin), _("Gaim - Privacy")); | |
1475 g_signal_connect(GTK_OBJECT(pwin), "destroy", G_CALLBACK(destroy_privacy), NULL); | |
1476 gtk_widget_realize(pwin); | |
1477 | |
1478 gtk_widget_set_usize(pwin, 0, 400); | |
1479 | |
1480 box = gtk_vbox_new(FALSE, 5); | |
1481 gtk_container_set_border_width(GTK_CONTAINER(box), 5); | |
1482 gtk_container_add(GTK_CONTAINER(pwin), box); | |
1483 gtk_widget_show(box); | |
1484 | |
1485 label = gtk_label_new(_("Changes to privacy settings take effect immediately.")); | |
1486 gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 5); | |
1487 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
1488 gtk_widget_show(label); | |
1489 | |
1490 deny_conn_hbox = gtk_hbox_new(FALSE, 5); | |
1491 gtk_box_pack_start(GTK_BOX(box), deny_conn_hbox, FALSE, FALSE, 0); | |
1492 gtk_widget_show(deny_conn_hbox); | |
1493 | |
1494 label = gtk_label_new(_("Set privacy for:")); | |
1495 gtk_box_pack_start(GTK_BOX(deny_conn_hbox), label, FALSE, FALSE, 5); | |
1496 gtk_widget_show(label); | |
1497 | |
1498 deny_opt_menu = gtk_option_menu_new(); | |
1499 gtk_box_pack_start(GTK_BOX(deny_conn_hbox), deny_opt_menu, FALSE, FALSE, 5); | |
1500 g_signal_connect(GTK_OBJECT(deny_opt_menu), "destroy", G_CALLBACK(des_deny_opt), NULL); | |
1501 gtk_widget_show(deny_opt_menu); | |
1502 | |
1503 build_deny_menu(); | |
1504 | |
4178 | 1505 table = gtk_table_new(5, 2, FALSE); |
1506 gtk_box_pack_start(GTK_BOX(box), table, TRUE, TRUE, 0); | |
1507 gtk_table_set_row_spacings(GTK_TABLE(table), 7); | |
1508 gtk_table_set_col_spacings(GTK_TABLE(table), 5); | |
1509 gtk_widget_show(table); | |
1510 | |
1511 deny_type = deny_opt(_("Allow all users to contact me"), 1, NULL); | |
4177 | 1512 gtk_size_group_add_widget(sg1, deny_type); |
4178 | 1513 gtk_table_attach(GTK_TABLE(table), deny_type, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); |
1514 | |
1515 deny_type = deny_opt(_("Allow only users on my buddy list"), 5, deny_type); | |
4177 | 1516 gtk_size_group_add_widget(sg1, deny_type); |
4178 | 1517 gtk_table_attach(GTK_TABLE(table), deny_type, 0, 1, 1, 2, GTK_FILL, 0, 0, 0); |
1518 | |
1519 deny_type = deny_opt(_("Allow only the users below"), 3, deny_type); | |
4177 | 1520 gtk_size_group_add_widget(sg1, deny_type); |
4178 | 1521 gtk_table_attach(GTK_TABLE(table), deny_type, 0, 1, 2, 3, GTK_FILL, 0, 0, 0); |
4177 | 1522 |
1523 sw = gtk_scrolled_window_new(NULL, NULL); | |
1524 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); | |
4178 | 1525 gtk_table_attach(GTK_TABLE(table), sw, 0, 1, 3, 4, GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); |
4177 | 1526 gtk_widget_show(sw); |
1527 | |
1528 allow_store = gtk_list_store_new(1, G_TYPE_STRING); | |
1529 allow_list = gtk_tree_view_new_with_model(GTK_TREE_MODEL(allow_store)); | |
1530 | |
1531 rend = gtk_cell_renderer_text_new(); | |
1532 col = gtk_tree_view_column_new_with_attributes(NULL, rend, "text", 0, NULL); | |
1533 gtk_tree_view_column_set_clickable(GTK_TREE_VIEW_COLUMN(col), TRUE); | |
1534 gtk_tree_view_append_column(GTK_TREE_VIEW(allow_list), col); | |
1535 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(allow_list), FALSE); | |
1536 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw), allow_list); | |
1537 gtk_widget_show(allow_list); | |
1538 | |
1539 build_allow_list(); | |
1540 | |
4179 | 1541 bbox = gtk_hbox_new(TRUE, 0); |
4177 | 1542 gtk_widget_show(bbox); |
4178 | 1543 gtk_table_attach(GTK_TABLE(table), bbox, 0, 1, 4, 5, GTK_FILL, 0, 0, 0); |
4177 | 1544 |
1545 button = gtk_button_new_from_stock(GTK_STOCK_ADD); | |
1546 gtk_size_group_add_widget(sg2, button); | |
1547 gtk_widget_show(button); | |
1548 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(pref_deny_add), (void *)TRUE); | |
4179 | 1549 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
4177 | 1550 |
1551 button = gtk_button_new_from_stock(GTK_STOCK_REMOVE); | |
1552 gtk_size_group_add_widget(sg2, button); | |
1553 gtk_widget_show(button); | |
1554 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(pref_deny_rem), (void *)TRUE); | |
4179 | 1555 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
4177 | 1556 |
4178 | 1557 deny_type = deny_opt(_("Deny all users"), 2, deny_type); |
4177 | 1558 gtk_size_group_add_widget(sg1, deny_type); |
4178 | 1559 gtk_table_attach(GTK_TABLE(table), deny_type, 1, 2, 1, 2, GTK_FILL, 0, 0, 0); |
1560 | |
1561 deny_type = deny_opt(_("Block the users below"), 4, deny_type); | |
4177 | 1562 gtk_size_group_add_widget(sg1, deny_type); |
4178 | 1563 gtk_table_attach(GTK_TABLE(table), deny_type, 1, 2, 2, 3, GTK_FILL, 0, 0, 0); |
4177 | 1564 |
1565 sw = gtk_scrolled_window_new(NULL, NULL); | |
1566 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); | |
4178 | 1567 gtk_table_attach(GTK_TABLE(table), sw, 1, 2, 3, 4, GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); |
4177 | 1568 gtk_widget_show(sw); |
1569 | |
1570 block_store = gtk_list_store_new(1, G_TYPE_STRING); | |
1571 block_list = gtk_tree_view_new_with_model(GTK_TREE_MODEL(block_store)); | |
1572 | |
1573 rend = gtk_cell_renderer_text_new(); | |
1574 col = gtk_tree_view_column_new_with_attributes(NULL, rend, "text", 0, NULL); | |
1575 gtk_tree_view_column_set_clickable(GTK_TREE_VIEW_COLUMN(col), TRUE); | |
1576 gtk_tree_view_append_column(GTK_TREE_VIEW(block_list), col); | |
1577 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(block_list), FALSE); | |
1578 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw), block_list); | |
1579 gtk_widget_show(block_list); | |
1580 | |
1581 build_block_list(); | |
1582 | |
4179 | 1583 bbox = gtk_hbox_new(TRUE, 0); |
4178 | 1584 gtk_table_attach(GTK_TABLE(table), bbox, 1, 2, 4, 5, GTK_FILL, 0, 0, 0); |
4177 | 1585 gtk_widget_show(bbox); |
1586 | |
1587 button = gtk_button_new_from_stock(GTK_STOCK_ADD); | |
1588 gtk_size_group_add_widget(sg2, button); | |
1589 gtk_widget_show(button); | |
1590 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(pref_deny_add), FALSE); | |
4179 | 1591 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
4177 | 1592 |
1593 button = gtk_button_new_from_stock(GTK_STOCK_REMOVE); | |
1594 gtk_size_group_add_widget(sg2, button); | |
1595 gtk_widget_show(button); | |
1596 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(pref_deny_rem), FALSE); | |
4179 | 1597 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
4177 | 1598 |
1599 sep = gtk_hseparator_new(); | |
1600 gtk_box_pack_start(GTK_BOX(box), sep, FALSE, FALSE, 5); | |
1601 gtk_widget_show(sep); | |
1602 | |
4178 | 1603 hbox = gtk_hbox_new(FALSE, 0); |
1604 gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0); | |
4177 | 1605 gtk_widget_show(hbox); |
4178 | 1606 |
4177 | 1607 close_button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); |
1608 gtk_box_pack_end(GTK_BOX(hbox), close_button, FALSE, FALSE, 0); | |
1609 g_signal_connect_swapped(GTK_OBJECT(close_button), "clicked", G_CALLBACK(gtk_widget_destroy), pwin); | |
4178 | 1610 gtk_widget_show(close_button); |
4177 | 1611 |
1612 gtk_widget_show(pwin); | |
1613 | |
1614 } | |
1615 | |
1 | 1616 /*------------------------------------------------------------------------*/ |
1617 /* The dialog for new buddy pounces */ | |
1618 /*------------------------------------------------------------------------*/ | |
1619 | |
1620 | |
1621 void do_new_bp(GtkWidget *w, struct addbp *b) | |
1622 { | |
2986 | 1623 struct buddy_pounce *bp; |
1624 | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1625 if (strlen(gtk_entry_get_text(GTK_ENTRY(b->nameentry))) == 0) { |
3427 | 1626 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
|
1627 return; |
1292 | 1628 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1629 |
2986 | 1630 if(!b->buddy_pounce) |
1631 bp = g_new0(struct buddy_pounce, 1); | |
1632 else | |
1633 bp = b->buddy_pounce; | |
1634 | |
1635 | |
26 | 1636 g_snprintf(bp->name, 80, "%s", gtk_entry_get_text(GTK_ENTRY(b->nameentry))); |
1637 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
|
1638 g_snprintf(bp->command, 2048, "%s", gtk_entry_get_text(GTK_ENTRY(b->commentry))); |
1694 | 1639 g_snprintf(bp->sound, 2048, "%s", gtk_entry_get_text(GTK_ENTRY(b->soundentry))); |
4491 | 1640 g_snprintf(bp->pouncer, 80, "%s", b->account->username); |
1641 | |
1642 bp->protocol = b->account->protocol; | |
1155 | 1643 |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1233
diff
changeset
|
1644 bp->options = 0; |
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1233
diff
changeset
|
1645 |
2550 | 1646 if (GTK_TOGGLE_BUTTON(b->popupnotify)->active) |
1647 bp->options |= OPT_POUNCE_NOTIFY; | |
1648 | |
1 | 1649 if (GTK_TOGGLE_BUTTON(b->openwindow)->active) |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1233
diff
changeset
|
1650 bp->options |= OPT_POUNCE_POPUP; |
1 | 1651 |
1652 if (GTK_TOGGLE_BUTTON(b->sendim)->active) | |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1233
diff
changeset
|
1653 bp->options |= OPT_POUNCE_SEND_IM; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1654 |
1229
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1225
diff
changeset
|
1655 if (GTK_TOGGLE_BUTTON(b->command)->active) |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1233
diff
changeset
|
1656 bp->options |= OPT_POUNCE_COMMAND; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1657 |
1694 | 1658 if (GTK_TOGGLE_BUTTON(b->sound)->active) |
1659 bp->options |= OPT_POUNCE_SOUND; | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1660 |
1137 | 1661 if (GTK_TOGGLE_BUTTON(b->p_signon)->active) |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1233
diff
changeset
|
1662 bp->options |= OPT_POUNCE_SIGNON; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1663 |
1137 | 1664 if (GTK_TOGGLE_BUTTON(b->p_unaway)->active) |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1233
diff
changeset
|
1665 bp->options |= OPT_POUNCE_UNAWAY; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1666 |
1137 | 1667 if (GTK_TOGGLE_BUTTON(b->p_unidle)->active) |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1233
diff
changeset
|
1668 bp->options |= OPT_POUNCE_UNIDLE; |
2993 | 1669 |
1670 if (GTK_TOGGLE_BUTTON(b->p_typing)->active) | |
1671 bp->options |= OPT_POUNCE_TYPING; | |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1233
diff
changeset
|
1672 |
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1233
diff
changeset
|
1673 if (GTK_TOGGLE_BUTTON(b->save)->active) |
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1233
diff
changeset
|
1674 bp->options |= OPT_POUNCE_SAVE; |
26 | 1675 |
2986 | 1676 if(!b->buddy_pounce) |
1677 buddy_pounces = g_list_append(buddy_pounces, bp); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1678 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1679 do_bp_menu(); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1680 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1681 destroy_dialog(NULL, b->window); |
1137 | 1682 |
786
ffb824f6cd24
[gaim-migrate @ 796]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
780
diff
changeset
|
1683 save_prefs(); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1684 g_free(b); |
1 | 1685 } |
1686 | |
1139 | 1687 static void pounce_choose(GtkWidget *opt, struct addbp *b) |
1688 { | |
4491 | 1689 struct gaim_account *account = gtk_object_get_user_data(GTK_OBJECT(opt)); |
1690 b->account = account; | |
1139 | 1691 } |
1692 | |
2564 | 1693 static GtkWidget *pounce_user_menu(struct addbp *b, struct gaim_connection *gc) |
1137 | 1694 { |
1695 GtkWidget *optmenu; | |
1696 GtkWidget *menu; | |
1697 GtkWidget *opt; | |
4491 | 1698 GSList *u = gaim_accounts; |
1699 struct gaim_account *account; | |
3082 | 1700 struct prpl *p; |
2564 | 1701 int count = 0; |
1702 int place = 0; | |
3082 | 1703 char buf[2048]; |
1137 | 1704 |
3795 | 1705 |
1137 | 1706 optmenu = gtk_option_menu_new(); |
1707 | |
1708 menu = gtk_menu_new(); | |
1709 | |
1710 while (u) { | |
4491 | 1711 account = (struct gaim_account *)u->data; |
1712 p = (struct prpl *)find_prpl(account->protocol); | |
1713 g_snprintf(buf, sizeof buf, "%s (%s)", account->username, (p && p->name)?p->name:_("Unknown")); | |
3082 | 1714 opt = gtk_menu_item_new_with_label(buf); |
4491 | 1715 gtk_object_set_user_data(GTK_OBJECT(opt), account); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
1716 g_signal_connect(GTK_OBJECT(opt), "activate", G_CALLBACK(pounce_choose), b); |
1137 | 1717 gtk_menu_append(GTK_MENU(menu), opt); |
1718 gtk_widget_show(opt); | |
2564 | 1719 |
4491 | 1720 if (b->account == account) { |
2564 | 1721 gtk_menu_item_activate(GTK_MENU_ITEM(opt)); |
1722 place = count; | |
1723 } | |
1724 | |
1725 count++; | |
4491 | 1726 |
1137 | 1727 u = u->next; |
1728 } | |
1729 | |
1730 gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), menu); | |
2564 | 1731 gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), place); |
1137 | 1732 |
1733 b->menu = optmenu; | |
2550 | 1734 |
1735 return optmenu; | |
1137 | 1736 } |
1737 | |
1 | 1738 |
2986 | 1739 void show_new_bp(char *name, struct gaim_connection *gc, int idle, int away, struct buddy_pounce *edit_bp) |
1 | 1740 { |
1741 GtkWidget *label; | |
1742 GtkWidget *bbox; | |
1743 GtkWidget *vbox; | |
443 | 1744 GtkWidget *button; |
2550 | 1745 GtkWidget *frame; |
1746 GtkWidget *table; | |
1747 GtkWidget *optmenu; | |
3795 | 1748 GtkWidget *sep; |
1749 GtkSizeGroup *sg; | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1750 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1751 struct addbp *b = g_new0(struct addbp, 1); |
2986 | 1752 |
1753 if(edit_bp) { | |
1754 b->buddy_pounce = edit_bp; | |
4491 | 1755 b->account = gaim_account_find(edit_bp->pouncer, edit_bp->protocol); |
2986 | 1756 } else { |
4491 | 1757 b->account = gc ? gc->account : gaim_accounts->data; |
2986 | 1758 b->buddy_pounce = NULL; |
1759 } | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1760 |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
1761 GAIM_DIALOG(b->window); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1762 dialogwindows = g_list_prepend(dialogwindows, b->window); |
1185 | 1763 gtk_window_set_policy(GTK_WINDOW(b->window), FALSE, TRUE, TRUE); |
4074 | 1764 gtk_window_set_role(GTK_WINDOW(b->window), "new_bp"); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1765 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
|
1766 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
|
1767 gtk_widget_realize(b->window); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1768 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1769 vbox = gtk_vbox_new(FALSE, 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1770 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1771 gtk_container_add(GTK_CONTAINER(b->window), vbox); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1772 gtk_widget_show(vbox); |
1229
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1225
diff
changeset
|
1773 |
2550 | 1774 /* <pounce type="who"> */ |
1775 frame = gtk_frame_new(_("Pounce Who")); | |
1776 gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); | |
1777 gtk_widget_show(GTK_WIDGET(frame)); | |
1778 | |
1779 table = gtk_table_new(2, 2, FALSE); | |
1780 gtk_container_add(GTK_CONTAINER(frame), table); | |
1781 gtk_container_set_border_width(GTK_CONTAINER(table), 5); | |
1782 gtk_table_set_col_spacings(GTK_TABLE(table), 5); | |
1783 gtk_table_set_row_spacings(GTK_TABLE(table), 5); | |
1784 gtk_widget_show(table); | |
1785 | |
1786 label = gtk_label_new(_("Account")); | |
1787 gtk_misc_set_alignment(GTK_MISC(label), 0, .5); | |
1788 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); | |
1789 gtk_widget_show(label); | |
1790 | |
2564 | 1791 optmenu = pounce_user_menu(b, gc); |
2550 | 1792 gtk_table_attach(GTK_TABLE(table), optmenu, 1, 2, 0, 1, GTK_FILL | GTK_EXPAND, 0, 0, 0); |
1793 gtk_widget_show(optmenu); | |
1794 | |
1795 label = gtk_label_new(_("Buddy")); | |
1796 gtk_misc_set_alignment(GTK_MISC(label), 0, .5); | |
1797 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
|
1798 gtk_widget_show(label); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1799 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1800 b->nameentry = gtk_entry_new(); |
2550 | 1801 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
|
1802 if (name !=NULL) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1803 gtk_entry_set_text(GTK_ENTRY(b->nameentry), name); |
2986 | 1804 else if(edit_bp) |
1805 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
|
1806 gtk_window_set_focus(GTK_WINDOW(b->window), b->nameentry); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1807 gtk_widget_show(b->nameentry); |
2550 | 1808 /* </pounce type="who"> */ |
1809 | |
1810 | |
1811 /* <pounce type="when"> */ | |
1812 frame = gtk_frame_new(_("Pounce When")); | |
1813 gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); | |
1814 gtk_widget_show(GTK_WIDGET(frame)); | |
1815 | |
1816 table = gtk_table_new(2, 2, FALSE); | |
1817 gtk_container_add(GTK_CONTAINER(frame), table); | |
1818 gtk_container_set_border_width(GTK_CONTAINER(table), 5); | |
1819 gtk_table_set_col_spacings(GTK_TABLE(table), 5); | |
1820 gtk_widget_show(table); | |
1821 | |
1229
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1225
diff
changeset
|
1822 b->p_signon = gtk_check_button_new_with_label(_("Pounce on sign on")); |
2986 | 1823 if(edit_bp) |
1824 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->p_signon), | |
1825 (edit_bp->options & OPT_POUNCE_SIGNON) ? TRUE : FALSE); | |
1826 else | |
1827 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->p_signon), TRUE); | |
2550 | 1828 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
|
1829 gtk_widget_show(b->p_signon); |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1225
diff
changeset
|
1830 |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1225
diff
changeset
|
1831 b->p_unaway = gtk_check_button_new_with_label(_("Pounce on return from away")); |
2564 | 1832 if (away) |
1833 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->p_unaway), TRUE); | |
2986 | 1834 else if(edit_bp) |
1835 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->p_unaway), | |
1836 (edit_bp->options & OPT_POUNCE_UNAWAY) ? TRUE : FALSE); | |
2550 | 1837 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
|
1838 gtk_widget_show(b->p_unaway); |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1225
diff
changeset
|
1839 |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1225
diff
changeset
|
1840 b->p_unidle = gtk_check_button_new_with_label(_("Pounce on return from idle")); |
2564 | 1841 if (idle) |
1842 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->p_unidle), TRUE); | |
2986 | 1843 else if(edit_bp) |
1844 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->p_unidle), | |
1845 (edit_bp->options & OPT_POUNCE_UNIDLE) ? TRUE : FALSE); | |
2550 | 1846 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
|
1847 gtk_widget_show(b->p_unidle); |
2993 | 1848 |
1849 b->p_typing = gtk_check_button_new_with_label(_("Pounce when buddy is typing to you")); | |
2996 | 1850 if (edit_bp) |
1851 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->p_typing), | |
1852 (edit_bp->options & OPT_POUNCE_TYPING) ? TRUE : FALSE); | |
2993 | 1853 gtk_table_attach(GTK_TABLE(table), b->p_typing,1,2,1,2, GTK_FILL | GTK_EXPAND, 0, 0, 0); |
1854 gtk_widget_show(b->p_typing); | |
1855 | |
2550 | 1856 /* </pounce type="when"> */ |
1857 | |
1858 /* <pounce type="action"> */ | |
1859 frame = gtk_frame_new(_("Pounce Action")); | |
1860 gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); | |
1861 gtk_widget_show(GTK_WIDGET(frame)); | |
1862 | |
1863 table = gtk_table_new(4, 2, FALSE); | |
1864 gtk_container_add(GTK_CONTAINER(frame), table); | |
1865 gtk_container_set_border_width(GTK_CONTAINER(table), 5); | |
1866 gtk_table_set_col_spacings(GTK_TABLE(table), 5); | |
1867 gtk_table_set_row_spacings(GTK_TABLE(table), 5); | |
1868 gtk_widget_show(table); | |
1869 | |
1870 b->openwindow = gtk_check_button_new_with_label(_("Open IM Window")); | |
2986 | 1871 if(edit_bp) |
1872 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->openwindow), | |
1873 (edit_bp->options & OPT_POUNCE_POPUP) ? TRUE : FALSE); | |
1874 else | |
1875 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->openwindow), FALSE); | |
2550 | 1876 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
|
1877 gtk_widget_show(b->openwindow); |
2986 | 1878 |
2550 | 1879 b->popupnotify = gtk_check_button_new_with_label(_("Popup Notification")); |
2986 | 1880 if(edit_bp) |
1881 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->popupnotify), | |
1882 (edit_bp->options & OPT_POUNCE_NOTIFY) ? TRUE : FALSE); | |
1883 else | |
1884 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->popupnotify), FALSE); | |
2550 | 1885 gtk_table_attach(GTK_TABLE(table), b->popupnotify, 1, 2, 0, 1, GTK_FILL, 0, 0, 0); |
1886 gtk_widget_show(b->popupnotify); | |
1887 | |
1888 b->sendim = gtk_check_button_new_with_label(_("Send Message")); | |
2986 | 1889 if(edit_bp) |
1890 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->sendim), | |
1891 (edit_bp->options & OPT_POUNCE_SEND_IM) ? TRUE : FALSE); | |
1892 else | |
1893 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->sendim), TRUE); | |
2550 | 1894 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
|
1895 gtk_widget_show(b->sendim); |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1225
diff
changeset
|
1896 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1897 b->messentry = gtk_entry_new(); |
2550 | 1898 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
|
1899 g_signal_connect(GTK_OBJECT(b->messentry), "activate", G_CALLBACK(do_new_bp), b); |
2986 | 1900 if(edit_bp) { |
1901 gtk_widget_set_sensitive(GTK_WIDGET(b->messentry), | |
1902 (edit_bp->options & OPT_POUNCE_SEND_IM) ? TRUE : FALSE); | |
1903 gtk_entry_set_text(GTK_ENTRY(b->messentry), edit_bp->message); | |
1904 } | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1905 gtk_widget_show(b->messentry); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1906 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
1907 g_signal_connect(GTK_OBJECT(b->sendim), "clicked", |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
1908 G_CALLBACK(gaim_gtk_toggle_sensitive), b->messentry); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1909 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1910 b->command = gtk_check_button_new_with_label(_("Execute command on pounce")); |
2550 | 1911 gtk_table_attach(GTK_TABLE(table), b->command, 0, 1, 2, 3, GTK_FILL, 0, 0, 0); |
2986 | 1912 if(edit_bp) |
1913 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->command), | |
1914 (edit_bp->options & OPT_POUNCE_COMMAND) ? TRUE : FALSE); | |
1915 else | |
1916 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
|
1917 gtk_widget_show(b->command); |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1225
diff
changeset
|
1918 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1919 b->commentry = gtk_entry_new(); |
2550 | 1920 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
|
1921 g_signal_connect(GTK_OBJECT(b->commentry), "activate", G_CALLBACK(do_new_bp), b); |
2986 | 1922 if(edit_bp) { |
1923 gtk_widget_set_sensitive(GTK_WIDGET(b->commentry), | |
1924 (edit_bp->options & OPT_POUNCE_COMMAND) ? TRUE : FALSE); | |
1925 gtk_entry_set_text(GTK_ENTRY(b->commentry), edit_bp->command); | |
1926 } | |
1927 else | |
1928 gtk_widget_set_sensitive(GTK_WIDGET(b->commentry), FALSE); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1929 gtk_widget_show(b->commentry); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
1930 g_signal_connect(GTK_OBJECT(b->command), "clicked", |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
1931 G_CALLBACK(gaim_gtk_toggle_sensitive), b->commentry); |
2986 | 1932 |
1694 | 1933 b->sound = gtk_check_button_new_with_label(_("Play sound on pounce")); |
2986 | 1934 if(edit_bp) |
1935 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->sound), | |
1936 (edit_bp->options & OPT_POUNCE_SOUND) ? TRUE : FALSE); | |
1937 else | |
1938 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->sound), FALSE); | |
2550 | 1939 gtk_table_attach(GTK_TABLE(table), b->sound, 0, 1, 3, 4, GTK_FILL, 0, 0, 0); |
1694 | 1940 gtk_widget_show(b->sound); |
1941 | |
1942 b->soundentry = gtk_entry_new(); | |
2550 | 1943 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
|
1944 g_signal_connect(GTK_OBJECT(b->soundentry), "activate", G_CALLBACK(do_new_bp), b); |
2986 | 1945 if(edit_bp) { |
1946 gtk_widget_set_sensitive(GTK_WIDGET(b->soundentry), | |
1947 (edit_bp->options & OPT_POUNCE_SOUND) ? TRUE : FALSE); | |
1948 gtk_entry_set_text(GTK_ENTRY(b->soundentry), edit_bp->sound); | |
1949 } else | |
1950 gtk_widget_set_sensitive(GTK_WIDGET(b->soundentry), FALSE); | |
1694 | 1951 gtk_widget_show(b->soundentry); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
1952 g_signal_connect(GTK_OBJECT(b->sound), "clicked", |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
1953 G_CALLBACK(gaim_gtk_toggle_sensitive), b->soundentry); |
2550 | 1954 /* </pounce type="action"> */ |
1229
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1225
diff
changeset
|
1955 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1956 b->save = gtk_check_button_new_with_label(_("Save this pounce after activation")); |
2550 | 1957 gtk_container_set_border_width(GTK_CONTAINER(b->save), 7); |
2986 | 1958 if(edit_bp) |
1959 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->save), | |
1960 (edit_bp->options & OPT_POUNCE_SAVE) ? TRUE : FALSE); | |
1961 else | |
1962 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
|
1963 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
|
1964 gtk_widget_show(b->save); |
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1233
diff
changeset
|
1965 |
3795 | 1966 sep = gtk_hseparator_new(); |
1967 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); | |
1968 gtk_widget_show(sep); | |
1969 | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1970 bbox = gtk_hbox_new(FALSE, 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1971 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1972 gtk_widget_show(bbox); |
443 | 1973 |
3795 | 1974 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
1975 | |
4011 | 1976 button = gaim_pixbuf_button_from_stock(_("_Save"), "gtk-execute", GAIM_BUTTON_HORIZONTAL); |
3795 | 1977 gtk_size_group_add_widget(sg, button); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
1978 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(do_new_bp), b); |
3795 | 1979 gtk_box_pack_end(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
1980 gtk_widget_show(button); | |
1981 | |
1982 button = gaim_pixbuf_button_from_stock(_("C_ancel"), "gtk-cancel", GAIM_BUTTON_HORIZONTAL); | |
1983 gtk_size_group_add_widget(sg, button); | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
1984 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(destroy_dialog), b->window); |
1185 | 1985 gtk_box_pack_end(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
3795 | 1986 gtk_widget_show(button); |
1987 | |
443 | 1988 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1989 gtk_widget_show(b->window); |
1 | 1990 } |
1991 | |
1992 | |
1993 | |
1994 /*------------------------------------------------------------------------*/ | |
1995 /* The dialog for SET INFO / SET DIR INFO */ | |
1996 /*------------------------------------------------------------------------*/ | |
1997 | |
1998 void do_save_info(GtkWidget *widget, struct set_info_dlg *b) | |
1999 { | |
2000 gchar *junk; | |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
2001 struct gaim_connection *gc; |
1 | 2002 |
4119 | 2003 junk = gtk_text_view_get_text(GTK_TEXT_VIEW(b->text), FALSE); |
1 | 2004 |
4491 | 2005 if (b->account) { |
2006 strncpy_withhtml(b->account->user_info, junk, sizeof b->account->user_info); | |
2007 gc = b->account->gc; | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2008 |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
2009 save_prefs(); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
2010 |
1292 | 2011 if (gc) |
4491 | 2012 serv_set_info(gc, b->account->user_info); |
122
521db4bf5f28
[gaim-migrate @ 132]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
84
diff
changeset
|
2013 } |
25 | 2014 g_free(junk); |
1 | 2015 destroy_dialog(NULL, b->window); |
2016 g_free(b); | |
2017 } | |
2018 | |
2019 void do_set_dir(GtkWidget *widget, struct set_dir_dlg *b) | |
2020 { | |
3466 | 2021 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
|
2022 int web = GTK_TOGGLE_BUTTON(b->web)->active; |
3466 | 2023 const char *middle = gtk_entry_get_text(GTK_ENTRY(b->middle)); |
2024 const char *last = gtk_entry_get_text(GTK_ENTRY(b->last)); | |
2025 const char *maiden = gtk_entry_get_text(GTK_ENTRY(b->maiden)); | |
2026 const char *city = gtk_entry_get_text(GTK_ENTRY(b->city)); | |
2027 const char *state = gtk_entry_get_text(GTK_ENTRY(b->state)); | |
2028 const char *country = gtk_entry_get_text(GTK_ENTRY(b->country)); | |
1 | 2029 |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2030 serv_set_dir(b->gc, first, middle, last, maiden, city, state, country, web); |
1 | 2031 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2032 destroy_dialog(NULL, b->window); |
1 | 2033 g_free(b); |
2034 } | |
2035 | |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2036 void show_set_dir(struct gaim_connection *gc) |
1 | 2037 { |
2038 GtkWidget *label; | |
2039 GtkWidget *bot; | |
484 | 2040 GtkWidget *vbox; |
2041 GtkWidget *hbox; | |
2042 GtkWidget *frame; | |
2043 GtkWidget *fbox; | |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2044 char buf[256]; |
1 | 2045 |
2046 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
|
2047 b->gc = gc; |
1 | 2048 |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
2049 GAIM_DIALOG(b->window); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2050 dialogwindows = g_list_prepend(dialogwindows, b->window); |
4074 | 2051 gtk_window_set_role(GTK_WINDOW(b->window), "set_dir"); |
1185 | 2052 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
|
2053 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
|
2054 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
|
2055 gtk_widget_realize(b->window); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2056 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2057 fbox = gtk_vbox_new(FALSE, 5); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2058 gtk_container_add(GTK_CONTAINER(b->window), fbox); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2059 gtk_widget_show(fbox); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2060 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2061 frame = gtk_frame_new(_("Directory Info")); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2062 gtk_container_set_border_width(GTK_CONTAINER(fbox), 5); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2063 gtk_box_pack_start(GTK_BOX(fbox), frame, FALSE, FALSE, 0); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2064 gtk_widget_show(frame); |
484 | 2065 |
2066 vbox = gtk_vbox_new(FALSE, 5); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2067 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2068 gtk_container_add(GTK_CONTAINER(frame), vbox); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2069 gtk_widget_show(vbox); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2070 |
4472 | 2071 g_snprintf(buf, sizeof(buf), _("Setting Dir Info for %s:"), gc->username); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2072 label = gtk_label_new(buf); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2073 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 5); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2074 gtk_widget_show(label); |
1 | 2075 |
2076 b->first = gtk_entry_new(); | |
2077 b->middle = gtk_entry_new(); | |
2078 b->last = gtk_entry_new(); | |
2079 b->maiden = gtk_entry_new(); | |
2080 b->city = gtk_entry_new(); | |
2081 b->state = gtk_entry_new(); | |
2082 b->country = gtk_entry_new(); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2083 b->web = gtk_check_button_new_with_label(_("Allow Web Searches To Find Your Info")); |
484 | 2084 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2085 /* Line 1 */ |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2086 label = gtk_label_new(_("First Name")); |
1 | 2087 gtk_widget_show(label); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2088 |
484 | 2089 hbox = gtk_hbox_new(FALSE, 5); |
1185 | 2090 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
2091 gtk_box_pack_end(GTK_BOX(hbox), b->first, FALSE, FALSE, 0); | |
2092 | |
2093 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
484 | 2094 gtk_widget_show(hbox); |
2095 | |
2096 /* Line 2 */ | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2097 label = gtk_label_new(_("Middle Name")); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2098 gtk_widget_show(label); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2099 |
484 | 2100 hbox = gtk_hbox_new(FALSE, 5); |
1185 | 2101 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
2102 gtk_box_pack_end(GTK_BOX(hbox), b->middle, FALSE, FALSE, 0); | |
2103 | |
2104 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
484 | 2105 gtk_widget_show(hbox); |
2106 | |
2107 | |
2108 /* Line 3 */ | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2109 label = gtk_label_new(_("Last Name")); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2110 gtk_widget_show(label); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2111 |
484 | 2112 hbox = gtk_hbox_new(FALSE, 5); |
1185 | 2113 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
2114 gtk_box_pack_end(GTK_BOX(hbox), b->last, FALSE, FALSE, 0); | |
2115 | |
2116 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
484 | 2117 gtk_widget_show(hbox); |
2118 | |
2119 /* Line 4 */ | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2120 label = gtk_label_new(_("Maiden Name")); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2121 gtk_widget_show(label); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2122 |
484 | 2123 hbox = gtk_hbox_new(FALSE, 5); |
1185 | 2124 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
2125 gtk_box_pack_end(GTK_BOX(hbox), b->maiden, FALSE, FALSE, 0); | |
2126 | |
2127 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
484 | 2128 gtk_widget_show(hbox); |
2129 | |
2130 /* Line 5 */ | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2131 label = gtk_label_new(_("City")); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2132 gtk_widget_show(label); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2133 |
484 | 2134 hbox = gtk_hbox_new(FALSE, 5); |
1185 | 2135 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
2136 gtk_box_pack_end(GTK_BOX(hbox), b->city, FALSE, FALSE, 0); | |
2137 | |
2138 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
484 | 2139 gtk_widget_show(hbox); |
2140 | |
2141 /* Line 6 */ | |
1185 | 2142 label = gtk_label_new(_("State")); |
1 | 2143 gtk_widget_show(label); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2144 |
484 | 2145 hbox = gtk_hbox_new(FALSE, 5); |
1185 | 2146 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
2147 gtk_box_pack_end(GTK_BOX(hbox), b->state, FALSE, FALSE, 0); | |
2148 | |
2149 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
484 | 2150 gtk_widget_show(hbox); |
2151 | |
2152 /* Line 7 */ | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2153 label = gtk_label_new(_("Country")); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2154 gtk_widget_show(label); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2155 |
484 | 2156 hbox = gtk_hbox_new(FALSE, 5); |
1185 | 2157 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
2158 gtk_box_pack_end(GTK_BOX(hbox), b->country, FALSE, FALSE, 0); | |
2159 | |
2160 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
484 | 2161 gtk_widget_show(hbox); |
2162 | |
2163 /* Line 8 */ | |
2164 | |
2165 hbox = gtk_hbox_new(FALSE, 5); | |
1185 | 2166 gtk_box_pack_start(GTK_BOX(hbox), b->web, TRUE, TRUE, 0); |
484 | 2167 gtk_widget_show(hbox); |
1185 | 2168 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
484 | 2169 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2170 gtk_widget_show(b->first); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2171 gtk_widget_show(b->middle); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2172 gtk_widget_show(b->last); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2173 gtk_widget_show(b->maiden); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2174 gtk_widget_show(b->city); |
1 | 2175 gtk_widget_show(b->state); |
2176 gtk_widget_show(b->country); | |
2177 gtk_widget_show(b->web); | |
2178 | |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2179 /* And add the buttons */ |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2180 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2181 bot = gtk_hbox_new(FALSE, 5); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2182 gtk_box_pack_start(GTK_BOX(fbox), bot, FALSE, FALSE, 0); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2183 gtk_widget_show(bot); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2184 |
4092 | 2185 b->save = picture_button(b->window, _("Save"), save_xpm); |
2186 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
|
2187 g_signal_connect(GTK_OBJECT(b->save), "clicked", G_CALLBACK(do_set_dir), b); |
4092 | 2188 |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2189 b->cancel = picture_button(b->window, _("Cancel"), cancel_xpm); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2190 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
|
2191 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
|
2192 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2193 gtk_window_set_focus(GTK_WINDOW(b->window), b->first); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2194 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2195 gtk_widget_show(b->window); |
1 | 2196 } |
2197 | |
149 | 2198 void do_change_password(GtkWidget *widget, struct passwddlg *b) |
2199 { | |
3466 | 2200 const gchar *orig, *new1, *new2; |
149 | 2201 |
2202 orig = gtk_entry_get_text(GTK_ENTRY(b->original)); | |
2203 new1 = gtk_entry_get_text(GTK_ENTRY(b->new1)); | |
2204 new2 = gtk_entry_get_text(GTK_ENTRY(b->new2)); | |
2205 | |
2048
3366311426df
[gaim-migrate @ 2058]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1979
diff
changeset
|
2206 if (g_strcasecmp(new1, new2)) { |
3427 | 2207 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
|
2208 return; |
149 | 2209 } |
2210 | |
2211 if ((strlen(orig) < 1) || (strlen(new1) < 1) || (strlen(new2) < 1)) { | |
3427 | 2212 do_error_dialog(_("Fill out all fields completely"), NULL, GAIM_ERROR); |
149 | 2213 return; |
2214 } | |
2215 | |
978
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
2216 serv_change_passwd(b->gc, orig, new1); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2217 |
149 | 2218 destroy_dialog(NULL, b->window); |
2219 g_free(b); | |
2220 } | |
2221 | |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2222 void show_change_passwd(struct gaim_connection *gc) |
146 | 2223 { |
2224 GtkWidget *hbox; | |
2225 GtkWidget *label; | |
2226 GtkWidget *vbox; | |
475 | 2227 GtkWidget *fbox; |
2228 GtkWidget *frame; | |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2229 char buf[256]; |
454 | 2230 |
146 | 2231 struct passwddlg *b = g_new0(struct passwddlg, 1); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2232 b->gc = gc; |
146 | 2233 |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
2234 GAIM_DIALOG(b->window); |
1185 | 2235 gtk_window_set_policy(GTK_WINDOW(b->window), FALSE, TRUE, TRUE); |
4074 | 2236 gtk_window_set_role(GTK_WINDOW(b->window), "change_passwd"); |
978
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
2237 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
|
2238 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
|
2239 gtk_widget_realize(b->window); |
146 | 2240 dialogwindows = g_list_prepend(dialogwindows, b->window); |
149 | 2241 |
978
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
2242 fbox = gtk_vbox_new(FALSE, 5); |
1185 | 2243 gtk_container_border_width(GTK_CONTAINER(fbox), 5); |
978
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
2244 gtk_container_add(GTK_CONTAINER(b->window), fbox); |
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
2245 gtk_widget_show(fbox); |
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
2246 |
475 | 2247 frame = gtk_frame_new(_("Change Password")); |
1185 | 2248 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
|
2249 gtk_widget_show(frame); |
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
2250 |
475 | 2251 vbox = gtk_vbox_new(FALSE, 5); |
1185 | 2252 gtk_container_border_width(GTK_CONTAINER(vbox), 5); |
978
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
2253 gtk_container_add(GTK_CONTAINER(frame), vbox); |
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
2254 gtk_widget_show(vbox); |
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
2255 |
4472 | 2256 g_snprintf(buf, sizeof(buf), _("Changing password for %s:"), gc->username); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2257 label = gtk_label_new(buf); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2258 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 5); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2259 gtk_widget_show(label); |
978
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
2260 |
475 | 2261 /* First Line */ |
2262 hbox = gtk_hbox_new(FALSE, 5); | |
1185 | 2263 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
|
2264 gtk_widget_show(hbox); |
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
2265 |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2266 label = gtk_label_new(_("Original Password")); |
1185 | 2267 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
146 | 2268 gtk_widget_show(label); |
475 | 2269 |
146 | 2270 b->original = gtk_entry_new(); |
160
aaa8f0a2140e
[gaim-migrate @ 170]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
149
diff
changeset
|
2271 gtk_entry_set_visibility(GTK_ENTRY(b->original), FALSE); |
1185 | 2272 gtk_box_pack_end(GTK_BOX(hbox), b->original, FALSE, FALSE, 0); |
149 | 2273 gtk_widget_show(b->original); |
475 | 2274 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2275 /* Next Line */ |
475 | 2276 hbox = gtk_hbox_new(FALSE, 5); |
1185 | 2277 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
|
2278 gtk_widget_show(hbox); |
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
2279 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2280 label = gtk_label_new(_("New Password")); |
1185 | 2281 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
|
2282 gtk_widget_show(label); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2283 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2284 b->new1 = gtk_entry_new(); |
160
aaa8f0a2140e
[gaim-migrate @ 170]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
149
diff
changeset
|
2285 gtk_entry_set_visibility(GTK_ENTRY(b->new1), FALSE); |
1185 | 2286 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
|
2287 gtk_widget_show(b->new1); |
475 | 2288 |
2289 /* Next Line */ | |
2290 hbox = gtk_hbox_new(FALSE, 5); | |
1185 | 2291 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
|
2292 gtk_widget_show(hbox); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2293 |
475 | 2294 label = gtk_label_new(_("New Password (again)")); |
1185 | 2295 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
|
2296 gtk_widget_show(label); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2297 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2298 b->new2 = gtk_entry_new(); |
160
aaa8f0a2140e
[gaim-migrate @ 170]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
149
diff
changeset
|
2299 gtk_entry_set_visibility(GTK_ENTRY(b->new2), FALSE); |
1185 | 2300 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
|
2301 gtk_widget_show(b->new2); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2302 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2303 /* Now do our row of buttons */ |
1185 | 2304 hbox = gtk_hbox_new(FALSE, 5); |
2305 gtk_box_pack_start(GTK_BOX(fbox), hbox, FALSE, FALSE, 0); | |
146 | 2306 gtk_widget_show(hbox); |
475 | 2307 |
4092 | 2308 b->ok = picture_button(b->window, _("OK"), ok_xpm); |
2309 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
|
2310 g_signal_connect(GTK_OBJECT(b->ok), "clicked", G_CALLBACK(do_change_password), b); |
4092 | 2311 |
1185 | 2312 b->cancel = picture_button(b->window, _("Cancel"), cancel_xpm); |
2313 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
|
2314 g_signal_connect(GTK_OBJECT(b->cancel), "clicked", G_CALLBACK(destroy_dialog), b->window); |
1185 | 2315 |
978
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
2316 gtk_widget_show(b->window); |
146 | 2317 } |
2318 | |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2319 void show_set_info(struct gaim_connection *gc) |
1 | 2320 { |
1185 | 2321 GtkWidget *buttons; |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2322 GtkWidget *label; |
1185 | 2323 GtkWidget *vbox; |
4119 | 2324 GtkTextBuffer *buffer; |
2325 GtkWidget *frame; | |
1292 | 2326 gchar *buf; |
4491 | 2327 struct gaim_account *account; |
1292 | 2328 |
1 | 2329 struct set_info_dlg *b = g_new0(struct set_info_dlg, 1); |
4491 | 2330 account = gc->account; |
2331 b->account = account; | |
1 | 2332 |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
2333 GAIM_DIALOG(b->window); |
4074 | 2334 gtk_window_set_role(GTK_WINDOW(b->window), "set_info"); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2335 dialogwindows = g_list_prepend(dialogwindows, b->window); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2336 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
|
2337 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
|
2338 gtk_widget_realize(b->window); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2339 |
1185 | 2340 vbox = gtk_vbox_new(FALSE, 5); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2341 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2342 gtk_container_add(GTK_CONTAINER(b->window), vbox); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2343 gtk_widget_show(vbox); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2344 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2345 buf = g_malloc(256); |
4491 | 2346 g_snprintf(buf, 256, _("Changing info for %s:"), account->username); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2347 label = gtk_label_new(buf); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2348 g_free(buf); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2349 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 5); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2350 gtk_widget_show(label); |
4491 | 2351 |
4119 | 2352 frame = gtk_frame_new(NULL); |
2353 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN); | |
2354 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); | |
2355 gtk_widget_show(frame); | |
2356 | |
2357 b->text = gtk_text_view_new(); | |
2358 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(b->text), GTK_WRAP_WORD); | |
2359 gtk_widget_set_size_request(b->text, 300, 200); | |
4491 | 2360 buf = g_malloc(strlen(account->user_info) + 1); |
2361 strncpy_nohtml(buf, account->user_info, strlen(account->user_info) + 1); | |
4119 | 2362 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(b->text)); |
2363 gtk_text_buffer_set_text(buffer, buf, -1); | |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2364 g_free(buf); |
4119 | 2365 gtk_container_add(GTK_CONTAINER(frame), b->text); |
1 | 2366 gtk_widget_show(b->text); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2367 gtk_window_set_focus(GTK_WINDOW(b->window), b->text); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2368 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2369 buttons = gtk_hbox_new(FALSE, 5); |
1185 | 2370 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
|
2371 gtk_widget_show(buttons); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2372 |
4092 | 2373 b->save = picture_button(b->window, _("Save"), save_xpm); |
2374 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
|
2375 g_signal_connect(GTK_OBJECT(b->save), "clicked", G_CALLBACK(do_save_info), b); |
4092 | 2376 |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2377 b->cancel = picture_button(b->window, _("Cancel"), cancel_xpm); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2378 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
|
2379 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
|
2380 |
1 | 2381 gtk_widget_show(b->window); |
2382 | |
2383 } | |
2384 | |
2385 /*------------------------------------------------------------------------*/ | |
2386 /* The dialog for the info requests */ | |
2387 /*------------------------------------------------------------------------*/ | |
2388 | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2389 static void info_dlg_free(GtkWidget *b, struct info_dlg *d) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2390 { |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2391 if (g_slist_find(info_dlgs, d)) |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2392 info_dlgs = g_slist_remove(info_dlgs, d); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2393 g_free(d->who); |
1051
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1049
diff
changeset
|
2394 g_free(d); |
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1049
diff
changeset
|
2395 } |
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1049
diff
changeset
|
2396 |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2785
diff
changeset
|
2397 /* 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
|
2398 * 1, don't show if regular info isn't shown |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2785
diff
changeset
|
2399 * 2, show regardless but don't try to get away message |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2785
diff
changeset
|
2400 * |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2785
diff
changeset
|
2401 * 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
|
2402 */ |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2785
diff
changeset
|
2403 void g_show_info_text(struct gaim_connection *gc, char *who, int away, char *info, ...) |
1 | 2404 { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2405 GtkWidget *ok; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2406 GtkWidget *label; |
1 | 2407 GtkWidget *text; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2408 GtkWidget *bbox; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2409 GtkWidget *sw; |
1428
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1399
diff
changeset
|
2410 gint options = 0; |
2137
18722ae5b882
[gaim-migrate @ 2147]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
2411 char *more_info; |
18722ae5b882
[gaim-migrate @ 2147]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
2412 va_list ap; |
1 | 2413 |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2414 struct info_dlg *b = find_info_dlg(gc, who); |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2785
diff
changeset
|
2415 if (!b && (away == 1)) |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2416 return; |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2417 if (!b) { |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2418 b = g_new0(struct info_dlg, 1); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2419 b->gc = gc; |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2420 b->who = who ? g_strdup(normalize(who)) : NULL; |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2421 info_dlgs = g_slist_append(info_dlgs, b); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2422 |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2423 GAIM_DIALOG(b->window); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2424 gtk_window_set_title(GTK_WINDOW(b->window), "Gaim"); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2425 gtk_container_border_width(GTK_CONTAINER(b->window), 5); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2426 gtk_widget_realize(GTK_WIDGET(b->window)); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2427 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
|
2428 |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2429 bbox = gtk_vbox_new(FALSE, 5); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2430 gtk_container_add(GTK_CONTAINER(b->window), bbox); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2431 |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2432 label = gtk_label_new(_("Below are the results of your search: ")); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2433 gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2434 |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2435 sw = gtk_scrolled_window_new(NULL, NULL); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2436 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); |
3926 | 2437 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
|
2438 gtk_box_pack_start(GTK_BOX(bbox), sw, TRUE, TRUE, 0); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2439 |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2440 text = gtk_imhtml_new(NULL, NULL); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2441 b->text = text; |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2442 gtk_container_add(GTK_CONTAINER(sw), text); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2443 gtk_widget_set_usize(sw, 300, 250); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2444 gaim_setup_imhtml(text); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2445 |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2446 ok = picture_button(b->window, _("OK"), ok_xpm); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2447 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
|
2448 GTK_OBJECT(b->window)); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2449 gtk_box_pack_start(GTK_BOX(bbox), ok, FALSE, FALSE, 0); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2450 |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2451 gtk_widget_show_all(b->window); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2452 } |
1 | 2453 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2228
diff
changeset
|
2454 if (convo_options & OPT_CONVO_IGNORE_COLOUR) |
1428
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1399
diff
changeset
|
2455 options ^= GTK_IMHTML_NO_COLOURS; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2228
diff
changeset
|
2456 if (convo_options & OPT_CONVO_IGNORE_FONTS) |
1428
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1399
diff
changeset
|
2457 options ^= GTK_IMHTML_NO_FONTS; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2228
diff
changeset
|
2458 if (convo_options & OPT_CONVO_IGNORE_SIZES) |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
2459 options ^= GTK_IMHTML_NO_SIZES; |
1428
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1399
diff
changeset
|
2460 options ^= GTK_IMHTML_NO_COMMENTS; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1399
diff
changeset
|
2461 options ^= GTK_IMHTML_NO_TITLE; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1399
diff
changeset
|
2462 options ^= GTK_IMHTML_NO_NEWLINE; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1399
diff
changeset
|
2463 options ^= GTK_IMHTML_NO_SCROLL; |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2464 |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2851
diff
changeset
|
2465 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
|
2466 |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2467 va_start(ap, info); |
2137
18722ae5b882
[gaim-migrate @ 2147]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
2468 while ((more_info = va_arg(ap, char *)) != NULL) |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2851
diff
changeset
|
2469 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
|
2470 va_end(ap); |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2471 |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2472 if (away) |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2473 info_dlgs = g_slist_remove(info_dlgs, b); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2474 else |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2475 serv_get_away(gc, who); |
247
f6e8ea29b24f
[gaim-migrate @ 257]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
245
diff
changeset
|
2476 } |
f6e8ea29b24f
[gaim-migrate @ 257]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
245
diff
changeset
|
2477 |
1 | 2478 /*------------------------------------------------------------------------*/ |
2479 /* The dialog for adding to permit/deny */ | |
2480 /*------------------------------------------------------------------------*/ | |
2481 | |
2482 | |
2483 static void do_add_perm(GtkWidget *w, struct addperm *p) | |
2484 { | |
2485 | |
3466 | 2486 const char *who; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2487 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2488 who = gtk_entry_get_text(GTK_ENTRY(p->entry)); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2489 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2490 if (!p->permit) { |
4491 | 2491 if (gaim_privacy_deny_add(p->gc->account, who)) { |
4349 | 2492 serv_add_deny(p->gc, who); |
2493 build_block_list(); | |
2494 gaim_blist_save(); | |
1126
c8118e7ec981
[gaim-migrate @ 1136]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1125
diff
changeset
|
2495 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2496 } else { |
4491 | 2497 if (gaim_privacy_permit_add(p->gc->account, who)) { |
4349 | 2498 serv_add_permit(p->gc, who); |
2499 build_allow_list(); | |
2500 gaim_blist_save(); | |
1126
c8118e7ec981
[gaim-migrate @ 1136]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1125
diff
changeset
|
2501 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2502 } |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2503 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2504 destroy_dialog(NULL, p->window); |
1 | 2505 } |
2506 | |
2507 | |
2508 | |
1144
b1454d019277
[gaim-migrate @ 1154]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1141
diff
changeset
|
2509 void show_add_perm(struct gaim_connection *gc, char *who, gboolean permit) |
1 | 2510 { |
2511 GtkWidget *cancel; | |
2512 GtkWidget *add; | |
2513 GtkWidget *label; | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2514 GtkWidget *bbox; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2515 GtkWidget *vbox; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2516 GtkWidget *topbox; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2517 |
486 | 2518 struct addperm *p = g_new0(struct addperm, 1); |
1072
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
2519 p->gc = gc; |
1144
b1454d019277
[gaim-migrate @ 1154]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1141
diff
changeset
|
2520 p->permit = permit; |
1 | 2521 |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
2522 GAIM_DIALOG(p->window); |
487 | 2523 gtk_container_set_border_width(GTK_CONTAINER(p->window), 5); |
2524 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
|
2525 gtk_widget_realize(p->window); |
487 | 2526 |
486 | 2527 dialogwindows = g_list_prepend(dialogwindows, p->window); |
2528 | |
4107 | 2529 bbox = gtk_hbox_new(FALSE, 5); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2530 topbox = gtk_hbox_new(FALSE, 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2531 vbox = gtk_vbox_new(FALSE, 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2532 p->entry = gtk_entry_new(); |
1 | 2533 |
486 | 2534 /* Build Add Button */ |
2535 | |
1144
b1454d019277
[gaim-migrate @ 1154]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1141
diff
changeset
|
2536 if (permit) |
b1454d019277
[gaim-migrate @ 1154]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1141
diff
changeset
|
2537 add = picture_button(p->window, _("Permit"), add_xpm); |
b1454d019277
[gaim-migrate @ 1154]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1141
diff
changeset
|
2538 else |
b1454d019277
[gaim-migrate @ 1154]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1141
diff
changeset
|
2539 add = picture_button(p->window, _("Deny"), add_xpm); |
603
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
2540 cancel = picture_button(p->window, _("Cancel"), cancel_xpm); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2541 |
486 | 2542 /* End of Cancel Button */ |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2543 if (who != NULL) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2544 gtk_entry_set_text(GTK_ENTRY(p->entry), who); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2545 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2546 /* Put the buttons in the box */ |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2547 |
4107 | 2548 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
|
2549 gtk_box_pack_end(GTK_BOX(bbox), cancel, FALSE, FALSE, 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2550 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2551 label = gtk_label_new(_("Add")); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2552 gtk_widget_show(label); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2553 gtk_box_pack_start(GTK_BOX(topbox), label, FALSE, FALSE, 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2554 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
|
2555 /* And the boxes in the box */ |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2556 gtk_box_pack_start(GTK_BOX(vbox), topbox, TRUE, TRUE, 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2557 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 5); |
4107 | 2558 gtk_widget_show(topbox); |
2559 topbox=gtk_hbox_new(FALSE, 5); | |
2560 gtk_box_pack_start(GTK_BOX(topbox), vbox, FALSE, FALSE, 5); | |
1 | 2561 |
2562 | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2563 /* Handle closes right */ |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2564 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
|
2565 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
|
2566 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
|
2567 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
|
2568 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2569 /* Finish up */ |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2570 gtk_widget_show(add); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2571 gtk_widget_show(cancel); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2572 gtk_widget_show(p->entry); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2573 gtk_widget_show(topbox); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2574 gtk_widget_show(bbox); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2575 gtk_widget_show(vbox); |
1144
b1454d019277
[gaim-migrate @ 1154]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1141
diff
changeset
|
2576 if (permit) |
b1454d019277
[gaim-migrate @ 1154]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1141
diff
changeset
|
2577 gtk_window_set_title(GTK_WINDOW(p->window), _("Gaim - Add Permit")); |
b1454d019277
[gaim-migrate @ 1154]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1141
diff
changeset
|
2578 else |
b1454d019277
[gaim-migrate @ 1154]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1141
diff
changeset
|
2579 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
|
2580 gtk_window_set_focus(GTK_WINDOW(p->window), p->entry); |
4107 | 2581 gtk_container_add(GTK_CONTAINER(p->window), topbox); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2582 gtk_widget_realize(p->window); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2583 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2584 gtk_widget_show(p->window); |
1 | 2585 } |
2586 | |
2587 | |
2588 /*------------------------------------------------------------------------*/ | |
608 | 2589 /* Functions Called To Add A Log */ |
1 | 2590 /*------------------------------------------------------------------------*/ |
2591 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2592 void cancel_log(GtkWidget *widget, struct gaim_conversation *c) |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2593 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2594 struct gaim_gtk_conversation *gtkconv; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2595 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2596 gtkconv = GAIM_GTK_CONVERSATION(c); |
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 if (gtkconv->toolbar.log) { |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2599 gaim_gtk_set_state_lock(TRUE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2600 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
|
2601 FALSE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2602 gaim_gtk_set_state_lock(FALSE); |
608 | 2603 } |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2604 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2605 dialogwindows = g_list_remove(dialogwindows, gtkconv->dialogs.log); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2606 gtk_widget_destroy(gtkconv->dialogs.log); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2607 gtkconv->dialogs.log = NULL; |
608 | 2608 } |
2609 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2610 void do_log(GtkWidget *w, struct gaim_conversation *c) |
1 | 2611 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2612 struct gaim_gtk_conversation *gtkconv; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2613 struct log_conversation *l; |
3466 | 2614 const char *file; |
1035
80a47e3b1bca
[gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1032
diff
changeset
|
2615 char path[PATHSIZE]; |
1 | 2616 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2617 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2618 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2619 if (!find_log_info(c->name)) { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2620 file = gtk_file_selection_get_filename( |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2621 GTK_FILE_SELECTION(gtkconv->dialogs.log)); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2622 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2623 strncpy(path, file, PATHSIZE - 1); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2624 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2625 if (file_is_dir(path, gtkconv->dialogs.log)) |
1035
80a47e3b1bca
[gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1032
diff
changeset
|
2626 return; |
80a47e3b1bca
[gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1032
diff
changeset
|
2627 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2628 l = (struct log_conversation *)g_new0(struct log_conversation, 1); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2629 strcpy(l->name, gaim_conversation_get_name(c)); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2630 strcpy(l->filename, file); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2631 log_conversations = g_list_append(log_conversations, l); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2632 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2633 if (c != NULL) |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2634 gaim_conversation_set_logging(c, TRUE); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2635 } |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2636 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2637 save_prefs(); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2638 cancel_log(NULL, c); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2639 } |
1 | 2640 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2641 void show_log_dialog(struct gaim_conversation *c) |
1 | 2642 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2643 struct gaim_gtk_conversation *gtkconv; |
1 | 2644 char *buf = g_malloc(BUF_LEN); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2645 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2646 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2647 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2648 if (!gtkconv->dialogs.log) { |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2649 gtkconv->dialogs.log = gtk_file_selection_new(_("Gaim - Log Conversation")); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2650 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2651 gtk_file_selection_hide_fileop_buttons( |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2652 GTK_FILE_SELECTION(gtkconv->dialogs.log)); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2653 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2654 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
|
2655 gaim_home_dir(), normalize(c->name)); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2656 gtk_object_set_user_data(GTK_OBJECT(gtkconv->dialogs.log), |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2657 "log dialog"); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2658 gtk_file_selection_set_filename(GTK_FILE_SELECTION(gtkconv->dialogs.log), |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2659 buf); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2660 g_signal_connect(G_OBJECT(gtkconv->dialogs.log), "delete_event", |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2661 G_CALLBACK(delete_event_dialog), c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2662 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
|
2663 G_CALLBACK(do_log), c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2664 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
|
2665 G_CALLBACK(cancel_log), c); |
1 | 2666 } |
2667 | |
25 | 2668 g_free(buf); |
2669 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2670 gtk_widget_show(gtkconv->dialogs.log); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2671 gdk_window_raise(gtkconv->dialogs.log->window); |
1 | 2672 } |
2673 | |
2674 /*------------------------------------------------------*/ | |
2675 /* Find Buddy By Email */ | |
2676 /*------------------------------------------------------*/ | |
2677 | |
2678 void do_find_info(GtkWidget *w, struct findbyinfo *b) | |
2679 { | |
3466 | 2680 const char *first; |
2681 const char *middle; | |
2682 const char *last; | |
2683 const char *maiden; | |
2684 const char *city; | |
2685 const char *state; | |
2686 const char *country; | |
1 | 2687 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2688 first = gtk_entry_get_text(GTK_ENTRY(b->firstentry)); |
1 | 2689 middle = gtk_entry_get_text(GTK_ENTRY(b->middleentry)); |
2690 last = gtk_entry_get_text(GTK_ENTRY(b->lastentry)); | |
2691 maiden = gtk_entry_get_text(GTK_ENTRY(b->maidenentry)); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2692 city = gtk_entry_get_text(GTK_ENTRY(b->cityentry)); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2693 state = gtk_entry_get_text(GTK_ENTRY(b->stateentry)); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2694 country = gtk_entry_get_text(GTK_ENTRY(b->countryentry)); |
1 | 2695 |
2393
a7ecfd3f7714
[gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2382
diff
changeset
|
2696 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
|
2697 destroy_dialog(NULL, b->window); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2698 } |
1 | 2699 |
2700 void do_find_email(GtkWidget *w, struct findbyemail *b) | |
2701 { | |
3466 | 2702 const char *email; |
1 | 2703 |
2704 email = gtk_entry_get_text(GTK_ENTRY(b->emailentry)); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2705 |
2598
b2800bca74fe
[gaim-migrate @ 2611]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2582
diff
changeset
|
2706 serv_dir_search(b->gc, "", "", "", "", "", "", "", email); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2707 |
1 | 2708 destroy_dialog(NULL, b->window); |
2709 } | |
2710 | |
2393
a7ecfd3f7714
[gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2382
diff
changeset
|
2711 void show_find_info(struct gaim_connection *gc) |
1 | 2712 { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2713 GtkWidget *cancel; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2714 GtkWidget *ok; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2715 GtkWidget *label; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2716 GtkWidget *bbox; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2717 GtkWidget *vbox; |
479 | 2718 GtkWidget *hbox; |
2719 GtkWidget *fbox; | |
2720 GtkWidget *frame; | |
1 | 2721 |
2722 struct findbyinfo *b = g_new0(struct findbyinfo, 1); | |
2393
a7ecfd3f7714
[gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2382
diff
changeset
|
2723 b->gc = gc; |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
2724 GAIM_DIALOG(b->window); |
1185 | 2725 gtk_window_set_policy(GTK_WINDOW(b->window), FALSE, TRUE, TRUE); |
4074 | 2726 gtk_window_set_role(GTK_WINDOW(b->window), "find_info"); |
479 | 2727 gtk_widget_show(b->window); |
2728 | |
2729 dialogwindows = g_list_prepend(dialogwindows, b->window); | |
2730 | |
2731 frame = gtk_frame_new(_("Search for Buddy")); | |
2732 fbox = gtk_vbox_new(FALSE, 5); | |
2733 | |
2734 /* Build OK Button */ | |
2735 | |
603
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
2736 ok = picture_button(b->window, _("OK"), ok_xpm); |
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
2737 cancel = picture_button(b->window, _("Cancel"), cancel_xpm); |
1 | 2738 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2739 bbox = gtk_hbox_new(FALSE, 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2740 vbox = gtk_vbox_new(FALSE, 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2741 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2742 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2743 b->firstentry = gtk_entry_new(); |
1 | 2744 b->middleentry = gtk_entry_new(); |
2745 b->lastentry = gtk_entry_new(); | |
2746 b->maidenentry = gtk_entry_new(); | |
2747 b->cityentry = gtk_entry_new(); | |
2748 b->stateentry = gtk_entry_new(); | |
2749 b->countryentry = gtk_entry_new(); | |
2750 | |
4333 | 2751 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
|
2752 gtk_box_pack_end(GTK_BOX(bbox), cancel, FALSE, FALSE, 0); |
1 | 2753 |
479 | 2754 /* Line 1 */ |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2755 label = gtk_label_new(_("First Name")); |
1 | 2756 gtk_widget_show(label); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2757 |
1185 | 2758 hbox = gtk_hbox_new(FALSE, 5); |
2759 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
2760 gtk_box_pack_end(GTK_BOX(hbox), b->firstentry, FALSE, FALSE, 0); | |
479 | 2761 |
2762 gtk_widget_show(hbox); | |
1185 | 2763 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
479 | 2764 |
2765 /* Line 2 */ | |
1 | 2766 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2767 label = gtk_label_new(_("Middle Name")); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2768 gtk_widget_show(label); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2769 |
1185 | 2770 hbox = gtk_hbox_new(FALSE, 5); |
2771 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
2772 gtk_box_pack_end(GTK_BOX(hbox), b->middleentry, FALSE, FALSE, 0); | |
479 | 2773 |
2774 gtk_widget_show(hbox); | |
1185 | 2775 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
479 | 2776 |
2777 /* Line 3 */ | |
2778 | |
2779 label = gtk_label_new(_("Last Name")); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2780 gtk_widget_show(label); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2781 |
1185 | 2782 hbox = gtk_hbox_new(FALSE, 5); |
2783 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
2784 gtk_box_pack_end(GTK_BOX(hbox), b->lastentry, FALSE, FALSE, 0); | |
479 | 2785 |
2786 gtk_widget_show(hbox); | |
1185 | 2787 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
479 | 2788 |
2789 /* Line 4 */ | |
2790 | |
2791 label = gtk_label_new(_("Maiden Name")); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2792 gtk_widget_show(label); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2793 |
1185 | 2794 hbox = gtk_hbox_new(FALSE, 5); |
2795 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
2796 gtk_box_pack_end(GTK_BOX(hbox), b->maidenentry, FALSE, FALSE, 0); | |
479 | 2797 |
2798 gtk_widget_show(hbox); | |
1185 | 2799 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
479 | 2800 |
2801 /* Line 5 */ | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2802 |
479 | 2803 label = gtk_label_new(_("City")); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2804 gtk_widget_show(label); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2805 |
1185 | 2806 hbox = gtk_hbox_new(FALSE, 5); |
2807 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
2808 gtk_box_pack_end(GTK_BOX(hbox), b->cityentry, FALSE, FALSE, 0); | |
479 | 2809 |
2810 gtk_widget_show(hbox); | |
1185 | 2811 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
479 | 2812 |
2813 /* Line 6 */ | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2814 label = gtk_label_new(_("State")); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2815 gtk_widget_show(label); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2816 |
1185 | 2817 hbox = gtk_hbox_new(FALSE, 5); |
2818 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
2819 gtk_box_pack_end(GTK_BOX(hbox), b->stateentry, FALSE, FALSE, 0); | |
479 | 2820 |
2821 gtk_widget_show(hbox); | |
1185 | 2822 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
479 | 2823 |
2824 /* Line 7 */ | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2825 label = gtk_label_new(_("Country")); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2826 gtk_widget_show(label); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2827 |
1185 | 2828 hbox = gtk_hbox_new(FALSE, 5); |
2829 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
2830 gtk_box_pack_end(GTK_BOX(hbox), b->countryentry, FALSE, FALSE, 0); | |
479 | 2831 |
2832 gtk_widget_show(hbox); | |
1185 | 2833 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
479 | 2834 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2835 /* Merge The Boxes */ |
479 | 2836 |
2837 gtk_container_add(GTK_CONTAINER(frame), vbox); | |
1185 | 2838 gtk_box_pack_start(GTK_BOX(fbox), frame, FALSE, FALSE, 0); |
2839 gtk_box_pack_start(GTK_BOX(fbox), bbox, FALSE, FALSE, 0); | |
1 | 2840 |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2841 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
|
2842 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
|
2843 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
|
2844 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2845 gtk_widget_show(ok); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2846 gtk_widget_show(cancel); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2847 gtk_widget_show(b->firstentry); |
1 | 2848 gtk_widget_show(b->middleentry); |
2849 gtk_widget_show(b->lastentry); | |
2850 gtk_widget_show(b->maidenentry); | |
2851 gtk_widget_show(b->cityentry); | |
2852 gtk_widget_show(b->stateentry); | |
2853 gtk_widget_show(b->countryentry); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2854 gtk_widget_show(bbox); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2855 gtk_widget_show(vbox); |
479 | 2856 gtk_widget_show(frame); |
2857 gtk_widget_show(fbox); | |
2858 | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2859 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
|
2860 gtk_window_set_focus(GTK_WINDOW(b->window), b->firstentry); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2861 gtk_container_add(GTK_CONTAINER(b->window), fbox); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2862 gtk_container_border_width(GTK_CONTAINER(b->window), 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2863 gtk_widget_realize(b->window); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2864 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2865 gtk_widget_show(b->window); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2866 } |
1 | 2867 |
1535
1e2cc8c8bf3c
[gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
2868 void show_find_email(struct gaim_connection *gc) |
1 | 2869 { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2870 GtkWidget *label; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2871 GtkWidget *bbox; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2872 GtkWidget *vbox; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2873 GtkWidget *frame; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2874 GtkWidget *topbox; |
444 | 2875 GtkWidget *button; |
1 | 2876 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2877 struct findbyemail *b = g_new0(struct findbyemail, 1); |
1535
1e2cc8c8bf3c
[gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
2878 if (g_slist_find(connections, gc)) |
1e2cc8c8bf3c
[gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
2879 b->gc = gc; |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
2880 GAIM_DIALOG(b->window); |
1185 | 2881 gtk_window_set_policy(GTK_WINDOW(b->window), FALSE, TRUE, TRUE); |
4074 | 2882 gtk_window_set_role(GTK_WINDOW(b->window), "find_email"); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2883 gtk_widget_realize(b->window); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2884 dialogwindows = g_list_prepend(dialogwindows, b->window); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2885 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
|
2886 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
|
2887 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2888 vbox = gtk_vbox_new(FALSE, 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2889 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2890 gtk_container_add(GTK_CONTAINER(b->window), vbox); |
1185 | 2891 |
444 | 2892 frame = gtk_frame_new(_("Search for Buddy")); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2893 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 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 topbox = gtk_hbox_new(FALSE, 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2896 gtk_container_add(GTK_CONTAINER(frame), topbox); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2897 gtk_container_set_border_width(GTK_CONTAINER(topbox), 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2898 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2899 label = gtk_label_new(_("Email")); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2900 gtk_box_pack_start(GTK_BOX(topbox), label, FALSE, FALSE, 0); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2901 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2902 b->emailentry = gtk_entry_new(); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2903 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
|
2904 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
|
2905 gtk_window_set_focus(GTK_WINDOW(b->window), b->emailentry); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2906 |
1185 | 2907 bbox = gtk_hbox_new(FALSE, 5); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2908 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); |
444 | 2909 |
4094 | 2910 button = picture_button(b->window, _("OK"), ok_xpm); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2911 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(do_find_email), b); |
4094 | 2912 gtk_box_pack_end(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
2913 | |
603
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
2914 button = picture_button(b->window, _("Cancel"), cancel_xpm); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2915 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(destroy_dialog), b->window); |
1185 | 2916 gtk_box_pack_end(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
2917 | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2918 gtk_widget_show_all(b->window); |
1 | 2919 } |
2920 | |
2921 /*------------------------------------------------------*/ | |
2922 /* Link Dialog */ | |
2923 /*------------------------------------------------------*/ | |
2924 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2925 void cancel_link(GtkWidget *widget, struct gaim_conversation *c) |
1 | 2926 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2927 struct gaim_gtk_conversation *gtkconv; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2928 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2929 gtkconv = GAIM_GTK_CONVERSATION(c); |
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 if (gtkconv->toolbar.link) { |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2932 gaim_gtk_set_state_lock(TRUE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2933 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(gtkconv->toolbar.link), |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2934 FALSE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2935 gaim_gtk_set_state_lock(FALSE); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2936 } |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2937 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2938 destroy_dialog(NULL, gtkconv->toolbar.link); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2939 gtkconv->toolbar.link = NULL; |
1 | 2940 } |
2941 | |
4262 | 2942 void do_insert_link(GtkWidget *w, int resp, struct linkdlg *b) |
1 | 2943 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2944 struct gaim_gtk_conversation *gtkconv; |
1 | 2945 char *open_tag; |
3466 | 2946 const char *urltext, *showtext; |
4262 | 2947 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2948 gtkconv = GAIM_GTK_CONVERSATION(b->c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2949 |
4262 | 2950 if (resp == GTK_RESPONSE_OK) { |
2951 | |
2952 open_tag = g_malloc(2048); | |
2953 | |
2954 urltext = gtk_entry_get_text(GTK_ENTRY(b->url)); | |
2955 showtext = gtk_entry_get_text(GTK_ENTRY(b->text)); | |
2956 | |
2957 if (!strlen(showtext)) | |
2958 showtext = urltext; | |
2959 | |
2960 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
|
2961 gaim_gtk_surround(gtkconv, open_tag, "</A>"); |
4262 | 2962 |
2963 g_free(open_tag); | |
2964 } | |
2965 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2966 if (gtkconv->toolbar.link) { |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2967 gaim_gtk_set_state_lock(TRUE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2968 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(gtkconv->toolbar.link), |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2969 FALSE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2970 gaim_gtk_set_state_lock(FALSE); |
4262 | 2971 } |
2972 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2973 gtkconv->dialogs.link = NULL; |
1 | 2974 destroy_dialog(NULL, b->window); |
2975 } | |
2976 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2977 void show_insert_link(GtkWidget *linky, struct gaim_conversation *c) |
1 | 2978 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2979 struct gaim_gtk_conversation *gtkconv; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2980 struct gaim_gtk_window *gtkwin; |
4262 | 2981 GtkWidget *table; |
2982 GtkWidget *label; | |
2983 GtkWidget *hbox; | |
1 | 2984 GtkWidget *vbox; |
2985 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2986 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2987 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(c)); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2988 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2989 if (gtkconv->dialogs.link == NULL) { |
4262 | 2990 struct linkdlg *a = g_new0(struct linkdlg, 1); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2991 char *filename = g_build_filename(DATADIR, "pixmaps", "gaim", |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2992 "dialogs", "gaim_question.png", NULL); |
4262 | 2993 GtkWidget *img = gtk_image_new_from_file(filename); |
2994 | |
2995 g_free(filename); | |
2996 | |
2997 a->c = c; | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2998 a->window = gtk_dialog_new_with_buttons(_("Gaim - Insert Link"), |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2999 GTK_WINDOW(gtkwin->window), GTK_DIALOG_MODAL, GTK_STOCK_CANCEL, |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3000 GTK_RESPONSE_CANCEL, _("Insert"), GTK_RESPONSE_OK, NULL); |
4262 | 3001 |
3002 gtk_dialog_set_default_response(GTK_DIALOG(a->window), GTK_RESPONSE_OK); | |
3003 gtk_container_set_border_width(GTK_CONTAINER(a->window), 6); | |
3004 gtk_window_set_resizable(GTK_WINDOW(a->window), FALSE); | |
3005 gtk_dialog_set_has_separator(GTK_DIALOG(a->window), FALSE); | |
3006 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
|
3007 gtk_container_set_border_width( |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3008 GTK_CONTAINER(GTK_DIALOG(a->window)->vbox), 6); |
4262 | 3009 gtk_window_set_role(GTK_WINDOW(a->window), "insert_link"); |
3010 | |
3011 hbox = gtk_hbox_new(FALSE, 12); | |
3012 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(a->window)->vbox), hbox); | |
3013 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
3014 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
3015 | |
3016 vbox = gtk_vbox_new(FALSE, 0); | |
3017 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
3018 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3019 label = gtk_label_new(_("Please enter the URL and description of " |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3020 "the link that you want to insert. The " |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3021 "description is optional.\n")); |
4262 | 3022 |
3023 gtk_widget_set_size_request(GTK_WIDGET(label), 335, -1); | |
3024 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
3025 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
3026 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
3027 | |
3028 hbox = gtk_hbox_new(FALSE, 6); | |
3029 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
3030 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3031 g_signal_connect(G_OBJECT(a->window), "destroy", |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3032 G_CALLBACK(destroy_dialog), a->window); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3033 g_signal_connect(G_OBJECT(a->window), "destroy", |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3034 G_CALLBACK(free_dialog), a); |
4262 | 3035 dialogwindows = g_list_prepend(dialogwindows, a->window); |
3036 | |
3037 table = gtk_table_new(4, 2, FALSE); | |
3038 gtk_table_set_row_spacings(GTK_TABLE(table), 5); | |
3039 gtk_table_set_col_spacings(GTK_TABLE(table), 5); | |
3040 gtk_container_set_border_width(GTK_CONTAINER(table), 0); | |
3041 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); | |
3042 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
3043 label = gtk_label_new(_("URL")); |
4262 | 3044 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
3045 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); | |
3046 | |
3047 a->url = gtk_entry_new(); | |
3048 gtk_table_attach_defaults(GTK_TABLE(table), a->url, 1, 2, 0, 1); | |
3049 gtk_widget_grab_focus(a->url); | |
3050 | |
3051 gtk_entry_set_activates_default (GTK_ENTRY(a->url), TRUE); | |
3052 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
3053 label = gtk_label_new(_("Description")); |
4262 | 3054 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
3055 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); | |
3056 | |
3057 a->text = gtk_entry_new(); | |
3058 gtk_table_attach_defaults(GTK_TABLE(table), a->text, 1, 2, 1, 2); | |
3059 gtk_entry_set_activates_default (GTK_ENTRY(a->text), TRUE); | |
3060 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3061 g_signal_connect(G_OBJECT(a->window), "response", |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3062 G_CALLBACK(do_insert_link), a); |
4262 | 3063 |
3064 a->toggle = linky; | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3065 gtkconv->dialogs.link = a->window; |
1 | 3066 } |
3067 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3068 gtk_widget_show_all(gtkconv->dialogs.link); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3069 gdk_window_raise(gtkconv->dialogs.link->window); |
1 | 3070 } |
3071 | |
3072 /*------------------------------------------------------*/ | |
3073 /* Color Selection Dialog */ | |
3074 /*------------------------------------------------------*/ | |
3075 | |
3367 | 3076 GtkWidget *fgcseld = NULL; |
3077 GtkWidget *bgcseld = NULL; | |
657
4bbc103a3294
[gaim-migrate @ 667]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
654
diff
changeset
|
3078 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3079 void cancel_fgcolor(GtkWidget *widget, struct gaim_conversation *c) |
1 | 3080 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3081 struct gaim_gtk_conversation *gtkconv; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3082 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3083 gtkconv = GAIM_GTK_CONVERSATION(c); |
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 if (gtkconv->toolbar.fgcolor && widget) { |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3086 gaim_gtk_set_state_lock(TRUE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3087 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(gtkconv->toolbar.fgcolor), |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3088 FALSE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3089 gaim_gtk_set_state_lock(FALSE); |
61 | 3090 } |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3091 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3092 dialogwindows = g_list_remove(dialogwindows, gtkconv->dialogs.fg_color); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3093 gtk_widget_destroy(gtkconv->dialogs.fg_color); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3094 gtkconv->dialogs.fg_color = NULL; |
1 | 3095 } |
3096 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3097 void cancel_bgcolor(GtkWidget *widget, struct gaim_conversation *c) |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3098 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3099 struct gaim_gtk_conversation *gtkconv; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3100 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3101 gtkconv = GAIM_GTK_CONVERSATION(c); |
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 if (gtkconv->toolbar.bgcolor && widget) { |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3104 gaim_gtk_set_state_lock(TRUE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3105 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(gtkconv->toolbar.bgcolor), |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3106 FALSE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3107 gaim_gtk_set_state_lock(FALSE); |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3108 } |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3109 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3110 dialogwindows = g_list_remove(dialogwindows, gtkconv->dialogs.bg_color); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3111 gtk_widget_destroy(gtkconv->dialogs.bg_color); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3112 gtkconv->dialogs.bg_color = NULL; |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3113 } |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3114 |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3115 void do_fgcolor(GtkWidget *widget, GtkColorSelection *colorsel) |
1 | 3116 { |
3117 GdkColor text_color; | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3118 struct gaim_conversation *c; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3119 struct gaim_gtk_conversation *gtkconv; |
1 | 3120 char *open_tag; |
3121 | |
3122 open_tag = g_malloc(30); | |
3123 | |
3557 | 3124 gtk_color_selection_get_current_color(colorsel, &text_color); |
1 | 3125 |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
3126 c = gtk_object_get_user_data(GTK_OBJECT(colorsel)); |
411
a330017b3aa4
[gaim-migrate @ 421]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
401
diff
changeset
|
3127 /* GTK_IS_EDITABLE(c->entry); huh? */ |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
3128 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3129 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3130 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3131 gtkconv->fg_color = text_color; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3132 g_snprintf(open_tag, 23, "<FONT COLOR=\"#%02X%02X%02X\">", |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3133 text_color.red / 256, |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3134 text_color.green / 256, |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3135 text_color.blue / 256); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3136 gaim_gtk_surround(gtkconv, open_tag, "</FONT>"); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3137 debug_printf("#%02X%02X%02X\n", |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3138 text_color.red / 256, |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3139 text_color.green / 256, |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3140 text_color.blue / 256); |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
3141 g_free(open_tag); |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3142 cancel_fgcolor(NULL, c); |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3143 } |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3144 |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3145 void do_bgcolor(GtkWidget *widget, GtkColorSelection *colorsel) |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3146 { |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3147 GdkColor text_color; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3148 struct gaim_conversation *c; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3149 struct gaim_gtk_conversation *gtkconv; |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3150 char *open_tag; |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3151 |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3152 open_tag = g_malloc(30); |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3153 |
3557 | 3154 gtk_color_selection_get_current_color(colorsel, &text_color); |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3155 |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3156 c = gtk_object_get_user_data(GTK_OBJECT(colorsel)); |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3157 /* GTK_IS_EDITABLE(c->entry); huh? */ |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3158 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3159 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3160 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3161 gtkconv->bg_color = text_color; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3162 g_snprintf(open_tag, 25, "<BODY BGCOLOR=\"#%02X%02X%02X\">", |
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); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3166 gaim_gtk_surround(gtkconv, open_tag, "</BODY>"); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3167 debug_printf("#%02X%02X%02X\n", |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3168 text_color.red / 256, |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3169 text_color.green / 256, |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3170 text_color.blue / 256); |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3171 g_free(open_tag); |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3172 cancel_bgcolor(NULL, c); |
1 | 3173 } |
3174 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3175 void show_fgcolor_dialog(struct gaim_conversation *c, GtkWidget *color) |
1 | 3176 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3177 struct gaim_gtk_conversation *gtkconv; |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
3178 GtkWidget *colorsel; |
1 | 3179 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3180 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3181 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3182 if (color == NULL) { /* we came from the prefs */ |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3183 if (fgcseld) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3184 return; |
2209
9b8b32ae3b41
[gaim-migrate @ 2219]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2143
diff
changeset
|
3185 |
657
4bbc103a3294
[gaim-migrate @ 667]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
654
diff
changeset
|
3186 fgcseld = gtk_color_selection_dialog_new(_("Select Text Color")); |
4198 | 3187 gtk_color_selection_set_current_color(GTK_COLOR_SELECTION |
3188 (GTK_COLOR_SELECTION_DIALOG(fgcseld)->colorsel), &fgcolor); | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3189 g_signal_connect(GTK_OBJECT(fgcseld), "delete_event", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3190 G_CALLBACK(destroy_colorsel), (void *)1); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3191 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
|
3192 "clicked", G_CALLBACK(destroy_colorsel), (void *)1); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3193 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
|
3194 G_CALLBACK(apply_color_dlg), (void *)1); |
657
4bbc103a3294
[gaim-migrate @ 667]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
654
diff
changeset
|
3195 gtk_widget_realize(fgcseld); |
4bbc103a3294
[gaim-migrate @ 667]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
654
diff
changeset
|
3196 gtk_widget_show(fgcseld); |
4bbc103a3294
[gaim-migrate @ 667]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
654
diff
changeset
|
3197 gdk_window_raise(fgcseld->window); |
4bbc103a3294
[gaim-migrate @ 667]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
654
diff
changeset
|
3198 return; |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3199 } |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3200 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3201 if (!gtkconv->dialogs.fg_color) { |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3202 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3203 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
|
3204 colorsel = GTK_COLOR_SELECTION_DIALOG(gtkconv->dialogs.fg_color)->colorsel; |
4198 | 3205 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
|
3206 gtk_object_set_user_data(GTK_OBJECT(colorsel), c); |
2209
9b8b32ae3b41
[gaim-migrate @ 2219]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2143
diff
changeset
|
3207 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3208 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
|
3209 G_CALLBACK(delete_event_dialog), c); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3210 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
|
3211 "clicked", G_CALLBACK(do_fgcolor), colorsel); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3212 g_signal_connect(GTK_OBJECT |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3213 (GTK_COLOR_SELECTION_DIALOG(gtkconv->dialogs.fg_color)->cancel_button), |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3214 "clicked", G_CALLBACK(cancel_fgcolor), c); |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3215 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3216 gtk_widget_realize(gtkconv->dialogs.fg_color); |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3217 } |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3218 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3219 gtk_widget_show(gtkconv->dialogs.fg_color); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3220 gdk_window_raise(gtkconv->dialogs.fg_color->window); |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3221 } |
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 void show_bgcolor_dialog(struct gaim_conversation *c, GtkWidget *color) |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3224 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3225 struct gaim_gtk_conversation *gtkconv; |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3226 GtkWidget *colorsel; |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3227 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3228 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3229 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3230 if (color == NULL) { /* we came from the prefs */ |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3231 if (bgcseld) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3232 return; |
2209
9b8b32ae3b41
[gaim-migrate @ 2219]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2143
diff
changeset
|
3233 |
657
4bbc103a3294
[gaim-migrate @ 667]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
654
diff
changeset
|
3234 bgcseld = gtk_color_selection_dialog_new(_("Select Background Color")); |
4198 | 3235 gtk_color_selection_set_current_color(GTK_COLOR_SELECTION |
3236 (GTK_COLOR_SELECTION_DIALOG(bgcseld)->colorsel), &bgcolor); | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3237 g_signal_connect(GTK_OBJECT(bgcseld), "delete_event", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3238 G_CALLBACK(destroy_colorsel), NULL); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3239 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
|
3240 "clicked", G_CALLBACK(destroy_colorsel), NULL); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3241 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
|
3242 G_CALLBACK(apply_color_dlg), (void *)2); |
657
4bbc103a3294
[gaim-migrate @ 667]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
654
diff
changeset
|
3243 gtk_widget_realize(bgcseld); |
4bbc103a3294
[gaim-migrate @ 667]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
654
diff
changeset
|
3244 gtk_widget_show(bgcseld); |
4bbc103a3294
[gaim-migrate @ 667]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
654
diff
changeset
|
3245 gdk_window_raise(bgcseld->window); |
4bbc103a3294
[gaim-migrate @ 667]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
654
diff
changeset
|
3246 return; |
4bbc103a3294
[gaim-migrate @ 667]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
654
diff
changeset
|
3247 } |
4bbc103a3294
[gaim-migrate @ 667]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
654
diff
changeset
|
3248 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3249 if (!gtkconv->dialogs.bg_color) { |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3250 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3251 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
|
3252 colorsel = GTK_COLOR_SELECTION_DIALOG(gtkconv->dialogs.bg_color)->colorsel; |
4198 | 3253 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
|
3254 gtk_object_set_user_data(GTK_OBJECT(colorsel), c); |
2209
9b8b32ae3b41
[gaim-migrate @ 2219]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2143
diff
changeset
|
3255 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3256 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
|
3257 G_CALLBACK(delete_event_dialog), c); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3258 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
|
3259 "clicked", G_CALLBACK(do_bgcolor), colorsel); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3260 g_signal_connect(GTK_OBJECT |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3261 (GTK_COLOR_SELECTION_DIALOG(gtkconv->dialogs.bg_color)->cancel_button), |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3262 "clicked", G_CALLBACK(cancel_bgcolor), c); |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
3263 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3264 gtk_widget_realize(gtkconv->dialogs.bg_color); |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
3265 } |
1 | 3266 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3267 gtk_widget_show(gtkconv->dialogs.bg_color); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3268 gdk_window_raise(gtkconv->dialogs.bg_color->window); |
1 | 3269 } |
3270 | |
3271 /*------------------------------------------------------------------------*/ | |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
3272 /* Font Selection Dialog */ |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
3273 /*------------------------------------------------------------------------*/ |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
3274 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3275 void cancel_font(GtkWidget *widget, struct gaim_conversation *c) |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3276 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3277 struct gaim_gtk_conversation *gtkconv; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3278 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3279 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3280 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3281 if (gtkconv->toolbar.normal_size && widget) { |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3282 gaim_gtk_set_state_lock(TRUE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3283 gtk_toggle_button_set_state( |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3284 GTK_TOGGLE_BUTTON(gtkconv->toolbar.normal_size), FALSE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3285 gaim_gtk_set_state_lock(FALSE); |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
3286 } |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3287 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3288 dialogwindows = g_list_remove(dialogwindows, gtkconv->dialogs.font); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3289 gtk_widget_destroy(gtkconv->dialogs.font); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3290 gtkconv->dialogs.font = NULL; |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
3291 } |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
3292 |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
3293 void apply_font(GtkWidget *widget, GtkFontSelection *fontsel) |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
3294 { |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
3295 /* this could be expanded to include font size, weight, etc. |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
3296 but for now only works with font face */ |
3473 | 3297 int i = 0; |
666
71ea550c22ac
[gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
657
diff
changeset
|
3298 char *fontname; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3299 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
|
3300 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3301 if (c) { |
666
71ea550c22ac
[gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
657
diff
changeset
|
3302 fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(fontsel)); |
3473 | 3303 while(fontname[i] && !isdigit(fontname[i])) { |
3304 i++; | |
3305 } | |
3306 fontname[i] = 0; | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3307 gaim_gtk_set_font_face(GAIM_GTK_CONVERSATION(c), fontname); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3308 } else { |
334
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
3309 fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(fontsel)); |
3473 | 3310 while(fontface[i] && !isdigit(fontname[i]) && i < sizeof(fontface)) { |
3311 fontface[i] = fontname[i]; | |
3312 i++; | |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
3313 } |
3473 | 3314 fontface[i] = 0; |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
3315 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3316 |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
3317 cancel_font(NULL, c); |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
3318 } |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
3319 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3320 void destroy_fontsel(GtkWidget *w, gpointer d) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3321 { |
334
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
3322 gtk_widget_destroy(fontseld); |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
3323 fontseld = NULL; |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
3324 } |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
3325 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3326 void show_font_dialog(struct gaim_conversation *c, GtkWidget *font) |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
3327 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3328 struct gaim_gtk_conversation *gtkconv; |
3473 | 3329 char fonttif[128]; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3330 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3331 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3332 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3333 if (!font) { /* we came from the prefs dialog */ |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3334 if (fontseld) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3335 return; |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
3336 fontseld = gtk_font_selection_dialog_new(_("Select Font")); |
3473 | 3337 if (fontface[0]) { |
3338 g_snprintf(fonttif, sizeof(fonttif), "%s 12", fontface); | |
2763
477a035d81e5
[gaim-migrate @ 2776]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2761
diff
changeset
|
3339 gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(fontseld), |
3473 | 3340 fonttif); |
2763
477a035d81e5
[gaim-migrate @ 2776]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2761
diff
changeset
|
3341 } else { |
477a035d81e5
[gaim-migrate @ 2776]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2761
diff
changeset
|
3342 gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(fontseld), |
3473 | 3343 DEFAULT_FONT_FACE " 12"); |
2763
477a035d81e5
[gaim-migrate @ 2776]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2761
diff
changeset
|
3344 } |
334
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
3345 |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
3346 gtk_object_set_user_data(GTK_OBJECT(fontseld), NULL); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3347 g_signal_connect(GTK_OBJECT(fontseld), "delete_event", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3348 G_CALLBACK(destroy_fontsel), NULL); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3349 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
|
3350 "clicked", G_CALLBACK(destroy_fontsel), NULL); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3351 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
|
3352 G_CALLBACK(apply_font_dlg), fontseld); |
334
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
3353 gtk_widget_realize(fontseld); |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
3354 gtk_widget_show(fontseld); |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
3355 gdk_window_raise(fontseld->window); |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
3356 return; |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
3357 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3358 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3359 if (!gtkconv->dialogs.font) { |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3360 gtkconv->dialogs.font = gtk_font_selection_dialog_new(_("Select Font")); |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
3361 |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
3362 if (font) |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3363 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
|
3364 else |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3365 gtk_object_set_user_data(GTK_OBJECT(gtkconv->dialogs.font), NULL); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3366 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3367 if (gtkconv->fontface[0]) { |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3368 g_snprintf(fonttif, sizeof(fonttif), "%s 12", gtkconv->fontface); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3369 gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(gtkconv->dialogs.font), |
3473 | 3370 fonttif); |
2763
477a035d81e5
[gaim-migrate @ 2776]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2761
diff
changeset
|
3371 } else { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3372 gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(gtkconv->dialogs.font), |
3473 | 3373 DEFAULT_FONT_FACE); |
2763
477a035d81e5
[gaim-migrate @ 2776]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2761
diff
changeset
|
3374 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3375 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3376 g_signal_connect(GTK_OBJECT(gtkconv->dialogs.font), "delete_event", |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3377 G_CALLBACK(delete_event_dialog), c); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3378 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
|
3379 "clicked", G_CALLBACK(apply_font), gtkconv->dialogs.font); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3380 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
|
3381 "clicked", G_CALLBACK(cancel_font), c); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3382 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3383 gtk_widget_realize(gtkconv->dialogs.font); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3384 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3385 } |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3386 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3387 gtk_widget_show(gtkconv->dialogs.font); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3388 gdk_window_raise(gtkconv->dialogs.font->window); |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
3389 } |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
3390 |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
3391 /*------------------------------------------------------------------------*/ |
1 | 3392 /* The dialog for import/export */ |
3393 /*------------------------------------------------------------------------*/ | |
3394 | |
4350 | 3395 static void do_import_dialog(GtkWidget *w, gpointer data) |
229 | 3396 { |
3466 | 3397 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
|
3398 if (file_is_dir(file, importdialog)) { |
569ae9f2bb89
[gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
3399 return; |
229 | 3400 } |
2598
b2800bca74fe
[gaim-migrate @ 2611]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2582
diff
changeset
|
3401 if (g_slist_find(connections, importgc)) { |
4491 | 3402 do_import(importgc->account, file); |
4349 | 3403 gaim_blist_save(); |
2598
b2800bca74fe
[gaim-migrate @ 2611]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2582
diff
changeset
|
3404 } |
2382
569ae9f2bb89
[gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
3405 destroy_dialog(NULL, importdialog); |
2493
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 set_import_gc(gpointer data, struct gaim_connection *gc) |
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 importgc = gc; |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3411 } |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3412 |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3413 static void create_import_dropdown(GtkFileSelection *fs) |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3414 { |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3415 GtkWidget *hbox; |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3416 GtkWidget *label; |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3417 GSList *g = connections; |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3418 struct gaim_connection *c; |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3419 GtkWidget *optmenu; |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3420 GtkWidget *menu; |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3421 char buf[256]; |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3422 GtkWidget *opt; |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3423 |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3424 if (!connections) |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3425 return; |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3426 importgc = connections->data; |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3427 if (!connections->next) |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3428 return; |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3429 |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3430 hbox = gtk_hbox_new(FALSE, 0); |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3431 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
|
3432 gtk_widget_show(hbox); |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3433 |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3434 optmenu = gtk_option_menu_new(); |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3435 gtk_box_pack_end(GTK_BOX(hbox), optmenu, FALSE, FALSE, 5); |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3436 gtk_widget_show(optmenu); |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3437 |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3438 label = gtk_label_new(_("Import to:")); |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3439 gtk_box_pack_end(GTK_BOX(hbox), label, FALSE, FALSE, 5); |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3440 gtk_widget_show(label); |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3441 |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3442 menu = gtk_menu_new(); |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3443 |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3444 while (g) { |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3445 c = (struct gaim_connection *)g->data; |
3572 | 3446 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
|
3447 opt = gtk_menu_item_new_with_label(buf); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3448 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
|
3449 gtk_widget_show(opt); |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3450 gtk_menu_append(GTK_MENU(menu), opt); |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3451 g = g->next; |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3452 } |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3453 |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3454 gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), menu); |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3455 gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), 0); |
229 | 3456 } |
3457 | |
2382
569ae9f2bb89
[gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
3458 void show_import_dialog() |
1 | 3459 { |
2382
569ae9f2bb89
[gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
3460 char *buf = g_malloc(BUF_LEN); |
569ae9f2bb89
[gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
3461 if (!importdialog) { |
569ae9f2bb89
[gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
3462 importdialog = gtk_file_selection_new(_("Gaim - Import Buddy List")); |
569ae9f2bb89
[gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
3463 |
569ae9f2bb89
[gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
3464 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(importdialog)); |
569ae9f2bb89
[gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
3465 |
3630 | 3466 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
|
3467 |
569ae9f2bb89
[gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
3468 gtk_file_selection_set_filename(GTK_FILE_SELECTION(importdialog), buf); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3469 g_signal_connect(GTK_OBJECT(importdialog), "destroy", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3470 G_CALLBACK(destroy_dialog), importdialog); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3471 |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3472 g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(importdialog)->ok_button), |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3473 "clicked", G_CALLBACK(do_import_dialog), NULL); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3474 g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(importdialog)->cancel_button), |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3475 "clicked", G_CALLBACK(destroy_dialog), importdialog); |
2382
569ae9f2bb89
[gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
3476 |
2493
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
3477 create_import_dropdown(GTK_FILE_SELECTION(importdialog)); |
228 | 3478 } |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
3479 |
2382
569ae9f2bb89
[gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
3480 g_free(buf); |
569ae9f2bb89
[gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
3481 gtk_widget_show(importdialog); |
569ae9f2bb89
[gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
3482 gdk_window_raise(importdialog->window); |
1 | 3483 } |
3484 | |
3485 /*------------------------------------------------------------------------*/ | |
3486 /* The dialog for new away messages */ | |
3487 /*------------------------------------------------------------------------*/ | |
3488 | |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3489 static struct away_message *save_away_message(struct create_away *ca) |
717 | 3490 { |
3491 struct away_message *am; | |
3492 gchar *away_message; | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3493 |
832
0142b4c66394
[gaim-migrate @ 842]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
825
diff
changeset
|
3494 if (!ca->mess) |
0142b4c66394
[gaim-migrate @ 842]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
825
diff
changeset
|
3495 am = g_new0(struct away_message, 1); |
2851
6eb5bf5089f0
[gaim-migrate @ 2864]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2827
diff
changeset
|
3496 else { |
832
0142b4c66394
[gaim-migrate @ 842]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
825
diff
changeset
|
3497 am = ca->mess; |
2851
6eb5bf5089f0
[gaim-migrate @ 2864]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2827
diff
changeset
|
3498 } |
1387 | 3499 |
4119 | 3500 |
717 | 3501 g_snprintf(am->name, sizeof(am->name), "%s", gtk_entry_get_text(GTK_ENTRY(ca->entry))); |
4119 | 3502 away_message = gtk_text_view_get_text(GTK_TEXT_VIEW(ca->text), FALSE); |
717 | 3503 |
3504 g_snprintf(am->message, sizeof(am->message), "%s", away_message); | |
3505 g_free(away_message); | |
3506 | |
832
0142b4c66394
[gaim-migrate @ 842]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
825
diff
changeset
|
3507 if (!ca->mess) { |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3508 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
|
3509 } |
0142b4c66394
[gaim-migrate @ 842]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
825
diff
changeset
|
3510 |
717 | 3511 save_prefs(); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3512 do_away_menu(); |
832
0142b4c66394
[gaim-migrate @ 842]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
825
diff
changeset
|
3513 if (prefs_away_list != NULL) |
940 | 3514 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
|
3515 |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3516 return am; |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3517 } |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3518 |
1387 | 3519 int check_away_mess(struct create_away *ca, int type) |
3520 { | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3521 if ((strlen(gtk_entry_get_text(GTK_ENTRY(ca->entry))) == 0) && (type == 1)) { |
1387 | 3522 /* We shouldn't allow a blank title */ |
3427 | 3523 do_error_dialog(_("You cannot save an away message with a blank title"), |
3524 _("Please give the message a title, or choose \"Make Away\" to use " | |
3525 "without saving."), GAIM_ERROR); | |
1387 | 3526 return 0; |
3527 } | |
3528 | |
4119 | 3529 if (!gtk_text_view_get_text(GTK_TEXT_VIEW(ca->text), FALSE) && (type <= 1)) { |
1387 | 3530 /* We shouldn't allow a blank message */ |
3427 | 3531 do_error_dialog(_("You cannot create an empty away message"), NULL, GAIM_ERROR); |
1387 | 3532 return 0; |
3533 } | |
3534 | |
3535 return 1; | |
3536 } | |
3537 | |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3538 void save_away_mess(GtkWidget *widget, struct create_away *ca) |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3539 { |
1387 | 3540 if (!check_away_mess(ca, 1)) |
3541 return; | |
3542 | |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3543 save_away_message(ca); |
717 | 3544 destroy_dialog(NULL, ca->window); |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3545 g_free(ca); |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3546 } |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3547 |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3548 void use_away_mess(GtkWidget *widget, struct create_away *ca) |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3549 { |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3550 static struct away_message am; |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3551 gchar *away_message; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3552 |
1387 | 3553 if (!check_away_mess(ca, 0)) |
3554 return; | |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3555 |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3556 g_snprintf(am.name, sizeof(am.name), "%s", gtk_entry_get_text(GTK_ENTRY(ca->entry))); |
4119 | 3557 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
|
3558 |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3559 g_snprintf(am.message, sizeof(am.message), "%s", away_message); |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3560 g_free(away_message); |
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 do_away_message(NULL, &am); |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3563 |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3564 destroy_dialog(NULL, ca->window); |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3565 g_free(ca); |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3566 } |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3567 |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3568 void su_away_mess(GtkWidget *widget, struct create_away *ca) |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3569 { |
1387 | 3570 if (!check_away_mess(ca, 1)) |
3571 return; | |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3572 do_away_message(NULL, save_away_message(ca)); |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3573 destroy_dialog(NULL, ca->window); |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3574 g_free(ca); |
717 | 3575 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3576 |
1 | 3577 void create_away_mess(GtkWidget *widget, void *dummy) |
3578 { | |
439 | 3579 GtkWidget *hbox; |
1 | 3580 GtkWidget *titlebox; |
3581 GtkWidget *tbox; | |
3582 GtkWidget *label; | |
439 | 3583 GtkWidget *frame; |
3584 GtkWidget *fbox; | |
441 | 3585 GtkWidget *button; |
1 | 3586 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3587 struct create_away *ca = g_new0(struct create_away, 1); |
1185 | 3588 |
1 | 3589 /* Set up window */ |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
3590 GAIM_DIALOG(ca->window); |
1369
0b4278a90323
[gaim-migrate @ 1379]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1365
diff
changeset
|
3591 gtk_widget_set_usize(ca->window, -1, 250); |
441 | 3592 gtk_container_border_width(GTK_CONTAINER(ca->window), 5); |
4074 | 3593 gtk_window_set_role(GTK_WINDOW(ca->window), "away_mess"); |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
3594 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
|
3595 g_signal_connect(GTK_OBJECT(ca->window), "delete_event", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3596 G_CALLBACK(destroy_dialog), ca->window); |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3597 gtk_widget_realize(ca->window); |
1185 | 3598 |
3599 tbox = gtk_vbox_new(FALSE, 5); | |
3600 gtk_container_add(GTK_CONTAINER(ca->window), tbox); | |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3601 gtk_widget_show(tbox); |
439 | 3602 |
3603 frame = gtk_frame_new(_("New away message")); | |
1185 | 3604 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
|
3605 gtk_widget_show(frame); |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3606 |
1172 | 3607 fbox = gtk_vbox_new(FALSE, 5); |
1224
0bbe3aaa6a3e
[gaim-migrate @ 1234]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1216
diff
changeset
|
3608 gtk_container_set_border_width(GTK_CONTAINER(fbox), 5); |
1185 | 3609 gtk_container_add(GTK_CONTAINER(frame), fbox); |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3610 gtk_widget_show(fbox); |
1185 | 3611 |
3612 titlebox = gtk_hbox_new(FALSE, 5); | |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3613 gtk_box_pack_start(GTK_BOX(fbox), titlebox, FALSE, FALSE, 0); |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3614 gtk_widget_show(titlebox); |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3615 |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
3616 label = gtk_label_new(_("Away title: ")); |
1172 | 3617 gtk_box_pack_start(GTK_BOX(titlebox), label, FALSE, FALSE, 0); |
441 | 3618 gtk_widget_show(label); |
1185 | 3619 |
1 | 3620 ca->entry = gtk_entry_new(); |
1172 | 3621 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
|
3622 gtk_widget_grab_focus(ca->entry); |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3623 gtk_widget_show(ca->entry); |
1 | 3624 |
4119 | 3625 frame = gtk_frame_new(NULL); |
3626 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN); | |
3627 gtk_box_pack_start(GTK_BOX(fbox), frame, TRUE, TRUE, 0); | |
3628 gtk_widget_show(frame); | |
3629 | |
3630 ca->text = gtk_text_view_new(); | |
3631 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(ca->text), GTK_WRAP_WORD); | |
3632 | |
3633 gtk_container_add(GTK_CONTAINER(frame), ca->text); | |
1 | 3634 gtk_widget_show(ca->text); |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3635 |
3374 | 3636 |
3637 if (dummy) { | |
3638 struct away_message *amt; | |
3639 GtkTreeIter iter; | |
3640 int pos = 0; | |
3641 GtkListStore *ls = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(dummy))); | |
3642 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(dummy)); | |
3643 GValue val = { 0, }; | |
4119 | 3644 GtkTextIter start; |
3645 GtkTextBuffer *buffer; | |
3374 | 3646 |
3716
d7e83b4db191
[gaim-migrate @ 3849]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3671
diff
changeset
|
3647 if (! gtk_tree_selection_get_selected (sel, (GtkTreeModel**)&ls, &iter)) |
3374 | 3648 return; |
3716
d7e83b4db191
[gaim-migrate @ 3849]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3671
diff
changeset
|
3649 gtk_tree_model_get_value (GTK_TREE_MODEL(ls), &iter, 1, &val); |
3374 | 3650 amt = g_value_get_pointer (&val); |
3651 gtk_entry_set_text(GTK_ENTRY(ca->entry), amt->name); | |
4119 | 3652 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(ca->text)); |
3653 gtk_text_buffer_get_iter_at_offset(buffer, &start, pos); | |
3654 gtk_text_buffer_insert(buffer, &start, amt->message, strlen(amt->message)); | |
3655 | |
3374 | 3656 ca->mess = amt; |
3657 } | |
832
0142b4c66394
[gaim-migrate @ 842]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
825
diff
changeset
|
3658 |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3659 hbox = gtk_hbox_new(FALSE, 5); |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3660 gtk_box_pack_start(GTK_BOX(tbox), hbox, FALSE, FALSE, 0); |
439 | 3661 gtk_widget_show(hbox); |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3662 |
4092 | 3663 button = picture_button(ca->window, _("Save"), ok_xpm); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3664 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(save_away_mess), ca); |
4092 | 3665 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); |
3666 | |
3667 button = picture_button(ca->window, _("Save & Use"), add_xpm); | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3668 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
|
3669 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
|
3670 |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3671 button = picture_button(ca->window, _("Use"), gnome_preferences_xpm); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3672 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
|
3673 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
|
3674 |
4092 | 3675 button = picture_button(ca->window, _("Cancel"), cancel_xpm); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3676 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
|
3677 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
|
3678 |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3679 gtk_widget_show(ca->window); |
1 | 3680 } |
555 | 3681 |
3682 /* smiley dialog */ | |
3683 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3684 void close_smiley_dialog(GtkWidget *widget, struct gaim_conversation *c) |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3685 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3686 struct gaim_gtk_conversation *gtkconv; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3687 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3688 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3689 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3690 if (gtkconv->toolbar.smiley) { |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3691 gaim_gtk_set_state_lock(TRUE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3692 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(gtkconv->toolbar.smiley), |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3693 FALSE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3694 gaim_gtk_set_state_lock(FALSE); |
570 | 3695 } |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3696 dialogwindows = g_list_remove(dialogwindows, gtkconv->dialogs.smiley); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3697 gtk_widget_destroy(gtkconv->dialogs.smiley); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3698 gtkconv->dialogs.smiley = NULL; |
555 | 3699 } |
3700 | |
3035 | 3701 void set_smiley(GtkWidget *w, char *face) |
3702 { | |
3703 current_smiley = face; | |
3704 } | |
3705 | |
555 | 3706 void set_smiley_array(GtkWidget *widget, int smiley_type) |
3707 { | |
3708 int i; | |
3709 | |
3710 for (i = 0; i < FACE_TOTAL; i++) | |
3711 smiley_array[i] = 0; | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3712 |
555 | 3713 smiley_array[smiley_type] = 1; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3714 |
555 | 3715 return; |
3716 } | |
3717 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3718 void insert_smiley_text(GtkWidget *widget, struct gaim_conversation *c) |
555 | 3719 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3720 struct gaim_gtk_conversation *gtkconv; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3721 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3722 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3723 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3724 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, current_smiley, -1); |
555 | 3725 close_smiley_dialog(NULL, c); |
3726 } | |
579
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
3727 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3728 static void toolbar_add_smiley(struct gaim_conversation *c, GtkWidget *bar, char* path, char *filename, char *face) |
4034 | 3729 { |
4061
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3730 GtkWidget *image; |
4034 | 3731 GtkWidget *button; |
4061
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3732 char *buf; |
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3733 |
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3734 buf = g_build_filename(path, filename, NULL); |
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3735 image = gtk_image_new_from_file(buf); |
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3736 g_free(buf); |
4034 | 3737 button = |
3738 gtk_toolbar_append_item(GTK_TOOLBAR(bar), NULL, NULL, NULL, | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3739 image, G_CALLBACK(set_smiley), (char *)face); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3740 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(insert_smiley_text), c); |
4034 | 3741 |
3742 /* these look really weird with borders */ | |
3743 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
3744 } | |
3745 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3746 void show_smiley_dialog(struct gaim_conversation *c, GtkWidget *widget) |
555 | 3747 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3748 struct gaim_gtk_conversation *gtkconv; |
555 | 3749 GtkWidget *dialog; |
3035 | 3750 GtkWidget *vbox, *smiley_box = NULL; |
555 | 3751 GtkWidget *win; |
582 | 3752 GtkWidget *bbox; |
4061
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3753 char *smiley_path = 0; |
555 | 3754 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3755 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3756 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3757 if (gtkconv->dialogs.smiley) |
558
f1b8f03db83f
[gaim-migrate @ 568]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
555
diff
changeset
|
3758 return; |
579
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
3759 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3760 win = GAIM_GTK_WINDOW(gaim_conversation_get_window(c))->window; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3761 |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
3762 GAIM_DIALOG(dialog); |
905 | 3763 gtk_window_set_policy(GTK_WINDOW(dialog), FALSE, FALSE, TRUE); |
4074 | 3764 gtk_window_set_role(GTK_WINDOW(dialog), "smiley_dialog"); |
934 | 3765 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
|
3766 |
555 | 3767 /* setup boxes */ |
582 | 3768 vbox = gtk_vbox_new(TRUE, 5); |
3769 bbox = gtk_hbox_new(FALSE, 5); | |
3770 | |
555 | 3771 |
3772 /* setup buttons */ | |
3773 | |
3774 /* pack buttons */ | |
3035 | 3775 |
4044 | 3776 smiley_box = gtk_toolbar_new(); |
3777 gtk_box_pack_start(GTK_BOX(vbox), smiley_box, TRUE, TRUE, 0); | |
4060 | 3778 |
4061
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3779 smiley_path = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", NULL); |
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3780 toolbar_add_smiley(c, smiley_box, smiley_path, "angel.png", "O:-)"); |
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3781 toolbar_add_smiley(c, smiley_box, smiley_path, "bigsmile.png", ":-D"); |
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3782 toolbar_add_smiley(c, smiley_box, smiley_path, "burp.png", ":-!"); |
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3783 toolbar_add_smiley(c, smiley_box, smiley_path, "crossedlips.png", ":-X"); |
4044 | 3784 |
3785 smiley_box = gtk_toolbar_new(); | |
3786 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
|
3787 toolbar_add_smiley(c, smiley_box, smiley_path, "cry.png", ":'("); |
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3788 toolbar_add_smiley(c, smiley_box, smiley_path, "embarrassed.png", ":-["); |
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3789 toolbar_add_smiley(c, smiley_box, smiley_path, "kiss.png", ":-*"); |
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3790 toolbar_add_smiley(c, smiley_box, smiley_path, "moneymouth.png", ":-$"); |
4044 | 3791 |
3792 smiley_box = gtk_toolbar_new(); | |
3793 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
|
3794 toolbar_add_smiley(c, smiley_box, smiley_path, "sad.png", ":-("); |
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3795 toolbar_add_smiley(c, smiley_box, smiley_path, "scream.png", "=-O"); |
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3796 toolbar_add_smiley(c, smiley_box, smiley_path, "smile.png", ":-)"); |
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3797 toolbar_add_smiley(c, smiley_box, smiley_path, "cool.png", "8-)"); |
4044 | 3798 |
3799 smiley_box = gtk_toolbar_new(); | |
3800 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
|
3801 toolbar_add_smiley(c, smiley_box, smiley_path, "think.png", ":-/"); |
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3802 toolbar_add_smiley(c, smiley_box, smiley_path, "tongue.png", ":-P"); |
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3803 toolbar_add_smiley(c, smiley_box, smiley_path, "wink.png", ";-)"); |
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3804 toolbar_add_smiley(c, smiley_box, smiley_path, "yell.png", ">:o"); |
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3805 |
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3806 g_free(smiley_path); |
582 | 3807 |
3808 gtk_container_add(GTK_CONTAINER(dialog), vbox); | |
579
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
3809 gtk_container_set_border_width(GTK_CONTAINER(dialog), 5); |
555 | 3810 |
605 | 3811 /* connect signals */ |
3812 gtk_object_set_user_data(GTK_OBJECT(dialog), "smiley dialog"); | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3813 g_signal_connect(G_OBJECT(dialog), "delete_event", |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3814 G_CALLBACK(delete_event_dialog), c); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3815 |
555 | 3816 /* show everything */ |
567
102afb84ce45
[gaim-migrate @ 577]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
558
diff
changeset
|
3817 gtk_window_set_title(GTK_WINDOW(dialog), _("Smile!")); |
584 | 3818 gtk_widget_show_all(dialog); |
555 | 3819 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3820 gtkconv->dialogs.smiley = dialog; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3821 |
555 | 3822 return; |
558
f1b8f03db83f
[gaim-migrate @ 568]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
555
diff
changeset
|
3823 } |
710
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
699
diff
changeset
|
3824 |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3825 static void do_alias_bud(GtkWidget *w, struct buddy *b) |
710
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
699
diff
changeset
|
3826 { |
3466 | 3827 const char *al = gtk_entry_get_text(GTK_ENTRY(aliasname)); |
4227 | 3828 if (al && strlen(al)) |
3829 g_snprintf(b->alias, sizeof(b->alias), "%s", al); | |
3830 else | |
3831 b->alias[0] = '\0'; | |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3832 handle_buddy_rename(b, b->name); |
3136 | 3833 serv_alias_buddy(b); |
4349 | 3834 gaim_blist_save(); |
710
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
699
diff
changeset
|
3835 destroy_dialog(aliasdlg, aliasdlg); |
1397
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3836 } |
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3837 |
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3838 void alias_dialog_bud(struct buddy *b) |
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3839 { |
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3840 GtkWidget *vbox; |
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3841 GtkWidget *bbox; |
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3842 GtkWidget *cancel; |
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3843 static GtkWidget *add = NULL; |
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3844 GtkWidget *label; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3845 GtkWidget *topbox; |
1397
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3846 static int a, c; |
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3847 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3848 if (aliasdlg) |
1397
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3849 gtk_widget_destroy(aliasdlg); |
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3850 |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
3851 GAIM_DIALOG(aliasdlg); |
1397
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3852 gtk_window_set_policy(GTK_WINDOW(aliasdlg), FALSE, FALSE, TRUE); |
4074 | 3853 gtk_window_set_role(GTK_WINDOW(aliasdlg), "alias_dialog"); |
1397
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3854 gtk_widget_realize(aliasdlg); |
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3855 dialogwindows = g_list_prepend(dialogwindows, aliasdlg); |
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3856 |
4092 | 3857 topbox = gtk_vbox_new(FALSE, 5); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3858 vbox = gtk_vbox_new(FALSE, 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3859 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3860 aliasentry = gtk_entry_new(); |
1397
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3861 aliasname = gtk_entry_new(); |
4092 | 3862 |
3863 /* Make the buddy name box */ | |
3864 bbox = gtk_hbox_new(FALSE, 5); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3865 label = gtk_label_new(_("Buddy")); |
4092 | 3866 gtk_widget_show(bbox); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3867 gtk_widget_show(label); |
4092 | 3868 gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 5); |
3869 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
|
3870 gtk_entry_set_editable(GTK_ENTRY(aliasentry), FALSE); |
4092 | 3871 gtk_box_pack_start(GTK_BOX(topbox), bbox, FALSE, FALSE, 0); |
3872 | |
3873 /* And the buddy alias box */ | |
3874 bbox = gtk_hbox_new(FALSE, 5); | |
1397
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3875 label = gtk_label_new(_("Alias")); |
4092 | 3876 gtk_widget_show(bbox); |
1397
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3877 gtk_widget_show(label); |
4092 | 3878 gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 5); |
3879 gtk_box_pack_end(GTK_BOX(bbox), aliasname, FALSE, FALSE, 5); | |
3880 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
|
3881 |
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3882 gtk_entry_set_text(GTK_ENTRY(aliasentry), b->name); |
4227 | 3883 gtk_entry_set_text(GTK_ENTRY(aliasname), b->alias); |
1397
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3884 |
4092 | 3885 /* Put the buttons in the box */ |
3886 bbox = gtk_hbox_new(FALSE, 5); | |
3887 | |
3888 add = picture_button(aliasdlg, _("Alias"), add_xpm); | |
3889 cancel = picture_button(aliasdlg, _("Cancel"), cancel_xpm); | |
3890 gtk_box_pack_end(GTK_BOX(bbox), add, FALSE, FALSE, 0); | |
3891 gtk_box_pack_end(GTK_BOX(bbox), cancel, FALSE, FALSE, 0); | |
3892 | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3893 /* And the boxes in the box */ |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3894 gtk_box_pack_start(GTK_BOX(vbox), topbox, TRUE, TRUE, 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3895 gtk_box_pack_start(GTK_BOX(vbox), bbox, TRUE, TRUE, 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3896 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3897 /* Handle closes right */ |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3898 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
|
3899 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
|
3900 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
|
3901 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
|
3902 /* Finish up */ |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3903 gtk_widget_show(add); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3904 gtk_widget_show(cancel); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3905 gtk_widget_show(aliasentry); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3906 gtk_widget_show(aliasname); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3907 gtk_widget_show(topbox); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3908 gtk_widget_show(bbox); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3909 gtk_widget_show(vbox); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3910 gtk_window_set_title(GTK_WINDOW(aliasdlg), _("Gaim - Alias Buddy")); |
4092 | 3911 gtk_window_set_focus(GTK_WINDOW(aliasdlg), aliasname); |
3912 gtk_container_add(GTK_CONTAINER(aliasdlg), vbox); | |
1397
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3913 gtk_container_set_border_width(GTK_CONTAINER(aliasdlg), 5); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3914 gtk_widget_realize(aliasdlg); |
1397
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3915 |
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3916 gtk_widget_show(aliasdlg); |
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3917 } |
1477
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 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3920 static gboolean dont_destroy(gpointer a, gpointer b, gpointer c) |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3921 { |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
3922 return TRUE; |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
3923 } |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
3924 |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3925 static void do_save_log(GtkWidget *w, GtkWidget *filesel) |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3926 { |
3716
d7e83b4db191
[gaim-migrate @ 3849]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3671
diff
changeset
|
3927 const char *file; |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3928 char path[PATHSIZE]; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3929 char buf[BUF_LONG]; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3930 char error[BUF_LEN]; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3931 FILE *fp_old, *fp_new; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3932 char filename[PATHSIZE]; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3933 char *name; |
1722
1edc8b545d6f
[gaim-migrate @ 1732]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
3934 char *tmp; |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3935 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3936 name = gtk_object_get_user_data(GTK_OBJECT(filesel)); |
1722
1edc8b545d6f
[gaim-migrate @ 1732]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
3937 tmp = gaim_user_dir(); |
3630 | 3938 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
|
3939 name ? normalize(name) : "system", name ? ".log" : ""); |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3940 |
3716
d7e83b4db191
[gaim-migrate @ 3849]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3671
diff
changeset
|
3941 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
|
3942 strncpy(path, file, PATHSIZE - 1); |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3943 if (file_is_dir(path, filesel)) |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3944 return; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3945 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3946 if ((fp_new = fopen(path, "w")) == NULL) { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3947 g_snprintf(error, BUF_LONG, |
3427 | 3948 _("Couldn't write to %s."), path); |
3949 do_error_dialog(error, strerror(errno), GAIM_ERROR); | |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3950 return; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3951 } |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3952 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3953 if ((fp_old = fopen(filename, "r")) == NULL) { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3954 g_snprintf(error, BUF_LONG, |
3427 | 3955 _("Couldn't write to %s."), filename); |
3956 do_error_dialog(error, strerror(errno), GAIM_ERROR); | |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3957 fclose(fp_new); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3958 return; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3959 } |
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 while (fgets(buf, BUF_LONG, fp_old)) |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3962 fputs(buf, fp_new); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3963 fclose(fp_old); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3964 fclose(fp_new); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3965 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3966 gtk_widget_destroy(filesel); |
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 return; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3969 } |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3970 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3971 static void show_save_log(GtkWidget *w, gchar *name) |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3972 { |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3973 GtkWidget *filesel; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3974 gchar buf[BUF_LEN]; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3975 |
3630 | 3976 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
|
3977 name ? normalize(name) : "system", name ? ".log" : ""); |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3978 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3979 filesel = gtk_file_selection_new(_("Gaim - Save Log File")); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3980 g_signal_connect(GTK_OBJECT(filesel), "delete_event", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3981 G_CALLBACK(destroy_dialog), filesel); |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3982 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3983 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(filesel)); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3984 gtk_file_selection_set_filename(GTK_FILE_SELECTION(filesel), buf); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3985 g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(filesel)->ok_button), |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3986 "clicked", G_CALLBACK(do_save_log), filesel); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3987 g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(filesel)->cancel_button), |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3988 "clicked", G_CALLBACK(destroy_dialog), filesel); |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3989 gtk_object_set_user_data(GTK_OBJECT(filesel), name); |
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 gtk_widget_realize(filesel); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3992 gtk_widget_show(filesel); |
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 return; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3995 } |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3996 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3997 static void do_clear_log_file(GtkWidget *w, gchar *name) |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3998 { |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3999 gchar buf[256]; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4000 gchar filename[256]; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4001 GtkWidget *window; |
1722
1edc8b545d6f
[gaim-migrate @ 1732]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
4002 char *tmp; |
1edc8b545d6f
[gaim-migrate @ 1732]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
4003 |
1edc8b545d6f
[gaim-migrate @ 1732]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
4004 tmp = gaim_user_dir(); |
3630 | 4005 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
|
4006 name ? normalize(name) : "system", name ? ".log" : ""); |
1488
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 if ((remove(filename)) == -1) { |
3427 | 4009 g_snprintf(buf, 256, _("Couldn't remove file %s." ), filename); |
4010 do_error_dialog(buf, strerror(errno), GAIM_ERROR); | |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4011 } |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4012 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4013 window = gtk_object_get_user_data(GTK_OBJECT(w)); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4014 destroy_dialog(NULL, window); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4015 } |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4016 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
4017 static void show_clear_log(GtkWidget *w, gchar *name) |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4018 { |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4019 GtkWidget *window; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4020 GtkWidget *box; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4021 GtkWidget *hbox; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4022 GtkWidget *button; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4023 GtkWidget *label; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4024 GtkWidget *hsep; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4025 |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
4026 GAIM_DIALOG(window); |
4074 | 4027 gtk_window_set_role(GTK_WINDOW(window), "dialog"); |
4586 | 4028 gtk_window_set_title(GTK_WINDOW(window), _("Gaim - Clear Log")); |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4029 gtk_container_set_border_width(GTK_CONTAINER(window), 10); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4030 gtk_window_set_policy(GTK_WINDOW(window), TRUE, TRUE, TRUE); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4031 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
|
4032 gtk_widget_realize(window); |
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 box = gtk_vbox_new(FALSE, 5); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4035 gtk_container_add(GTK_CONTAINER(window), box); |
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 label = gtk_label_new(_("Really clear log?")); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4038 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 15); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4039 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4040 hsep = gtk_hseparator_new(); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4041 gtk_box_pack_start(GTK_BOX(box), hsep, FALSE, FALSE, 0); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4042 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4043 hbox = gtk_hbox_new(FALSE, 0); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
4044 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
|
4045 gtk_widget_show(hbox); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4046 |
4333 | 4047 button = picture_button(window, _("Okay"), ok_xpm); |
4048 gtk_object_set_user_data(GTK_OBJECT(button), gtk_object_get_user_data(GTK_OBJECT(w))); | |
4049 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
|
4050 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
|
4051 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4052 gtk_widget_show(button); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4053 |
4333 | 4054 button = picture_button(window, _("Cancel"), cancel_xpm); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4055 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
|
4056 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4057 gtk_widget_show(button); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4058 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4059 gtk_widget_show_all(window); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4060 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4061 return; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4062 } |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4063 |
2621
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4064 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
|
4065 { |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4066 gchar buf[BUF_LONG]; |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4067 FILE *fp; |
2570 | 4068 char filename[256]; |
4069 int i=0; | |
4070 GString *string; | |
2602 | 4071 guint block; |
4072 | |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4073 string = g_string_new(""); |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4074 |
2621
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4075 if (view->name) { |
1634
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1535
diff
changeset
|
4076 char *tmp = gaim_user_dir(); |
3630 | 4077 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
|
4078 } else { |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1535
diff
changeset
|
4079 char *tmp = gaim_user_dir(); |
3630 | 4080 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
|
4081 } |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4082 if ((fp = fopen(filename, "r")) == NULL) { |
4472 | 4083 g_snprintf(buf, BUF_LONG, _("Couldn't open log file %s."), filename); |
3427 | 4084 do_error_dialog(buf, strerror(errno), GAIM_ERROR); |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4085 return; |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4086 } |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4087 |
2621
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4088 gtk_widget_set_sensitive(view->bbox, FALSE); |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4089 gtk_signal_disconnect_by_func(GTK_OBJECT(view->window), |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4090 G_CALLBACK(destroy_dialog), view->window); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4091 block = g_signal_connect(GTK_OBJECT(view->window), "delete_event", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4092 G_CALLBACK(dont_destroy), view->window); |
2621
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4093 |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4094 fseek(fp, view->offset, SEEK_SET); |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4095 gtk_imhtml_clear(GTK_IMHTML(view->layout)); |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4096 /* |
2570 | 4097 while (gtk_events_pending()) |
4098 gtk_main_iteration(); | |
2621
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4099 */ |
2570 | 4100 |
4101 while (fgets(buf, BUF_LONG, fp) && !strstr(buf, "---- New C")) { | |
4102 i++; | |
4103 if (strlen(buf) >= 5 && (!strncmp(buf + strlen(buf) - 5, "<BR>\n", 5))) | |
4104 /* take off the \n */ | |
4105 buf[strlen(buf) - 1] = '\0'; | |
4106 | |
2642
b6cf22276d4b
[gaim-migrate @ 2655]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2623
diff
changeset
|
4107 /* don't lose the thirtieth line of conversation. thanks FeRD */ |
b6cf22276d4b
[gaim-migrate @ 2655]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2623
diff
changeset
|
4108 g_string_append(string, buf); |
b6cf22276d4b
[gaim-migrate @ 2655]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2623
diff
changeset
|
4109 |
2570 | 4110 if (i == 30) { |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2851
diff
changeset
|
4111 gtk_imhtml_append_text(GTK_IMHTML(view->layout), string->str, -1, view->options); |
2570 | 4112 g_string_free(string, TRUE); |
4113 string = g_string_new(""); | |
2621
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4114 /* 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
|
4115 * drawing, it will try to move to that item, and that causes problems here. |
2570 | 4116 while (gtk_events_pending()) |
4117 gtk_main_iteration(); | |
2621
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4118 */ |
2570 | 4119 i = 0; |
4120 } | |
4121 | |
4122 } | |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2851
diff
changeset
|
4123 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
|
4124 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
|
4125 |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4126 gtk_widget_set_sensitive(view->bbox, TRUE); |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4127 gtk_signal_disconnect(GTK_OBJECT(view->window), block); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4128 g_signal_connect(GTK_OBJECT(view->window), "delete_event", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4129 G_CALLBACK(destroy_dialog), view->window); |
2570 | 4130 g_string_free(string, TRUE); |
4131 fclose(fp); | |
4132 } | |
4133 | |
2621
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4134 static void des_view_item(GtkObject *obj, struct view_log *view) |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4135 { |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4136 if (view->name) |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4137 g_free(view->name); |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4138 g_free(view); |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4139 } |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4140 |
2623
66164831c228
[gaim-migrate @ 2636]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2621
diff
changeset
|
4141 static void des_log_win(GtkObject *win, gpointer data) |
66164831c228
[gaim-migrate @ 2636]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2621
diff
changeset
|
4142 { |
66164831c228
[gaim-migrate @ 2636]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2621
diff
changeset
|
4143 char *x = gtk_object_get_user_data(win); |
66164831c228
[gaim-migrate @ 2636]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2621
diff
changeset
|
4144 if (x) |
66164831c228
[gaim-migrate @ 2636]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2621
diff
changeset
|
4145 g_free(x); |
66164831c228
[gaim-migrate @ 2636]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2621
diff
changeset
|
4146 } |
66164831c228
[gaim-migrate @ 2636]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2621
diff
changeset
|
4147 |
3484 | 4148 void conv_show_log(GtkWidget *w, gpointer data) |
4149 { | |
4150 char *name = g_strdup(data); | |
4151 show_log(name); | |
4152 g_free(name); | |
4153 } | |
4154 | |
3532 | 4155 void chat_show_log(GtkWidget *w, gpointer data) |
4156 { | |
3716
d7e83b4db191
[gaim-migrate @ 3849]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3671
diff
changeset
|
4157 char *name = g_strdup_printf("%s.chat", (char*)data); |
3532 | 4158 show_log(name); |
4159 g_free(name); | |
4160 } | |
4161 | |
2623
66164831c228
[gaim-migrate @ 2636]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2621
diff
changeset
|
4162 void show_log(char *nm) |
2570 | 4163 { |
4164 gchar filename[256]; | |
4165 gchar buf[BUF_LONG]; | |
4166 FILE *fp; | |
4167 GtkWidget *window; | |
4168 GtkWidget *box; | |
4169 GtkWidget *hbox; | |
2602 | 4170 GtkWidget *bbox; |
2570 | 4171 GtkWidget *sw; |
4172 GtkWidget *layout; | |
4173 GtkWidget *close_button; | |
4174 GtkWidget *clear_button; | |
4175 GtkWidget *save_button; | |
2572
ad0d7c423669
[gaim-migrate @ 2585]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2571
diff
changeset
|
4176 GtkWidget *list = NULL; |
2612 | 4177 GList *item_list = NULL; |
4178 GtkWidget *item = NULL; | |
4179 GtkWidget *last = NULL; | |
2570 | 4180 GtkWidget *frame; |
2621
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4181 struct view_log *view; |
2623
66164831c228
[gaim-migrate @ 2636]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2621
diff
changeset
|
4182 char *name = nm ? g_strdup(nm) : NULL; |
2570 | 4183 |
4184 int options; | |
4185 guint block; | |
4186 char convo_start[32]; | |
4187 long offset = 0; | |
2612 | 4188 unsigned int i = 0; |
2570 | 4189 |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4190 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
|
4191 if (convo_options & OPT_CONVO_IGNORE_COLOUR) |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4192 options ^= GTK_IMHTML_NO_COLOURS; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2228
diff
changeset
|
4193 if (convo_options & OPT_CONVO_IGNORE_FONTS) |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4194 options ^= GTK_IMHTML_NO_FONTS; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2228
diff
changeset
|
4195 if (convo_options & OPT_CONVO_IGNORE_SIZES) |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4196 options ^= GTK_IMHTML_NO_SIZES; |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4197 |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4198 window = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
2623
66164831c228
[gaim-migrate @ 2636]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2621
diff
changeset
|
4199 gtk_object_set_user_data(GTK_OBJECT(window), name); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4200 g_signal_connect(GTK_OBJECT(window), "destroy", G_CALLBACK(des_log_win), NULL); |
4074 | 4201 gtk_window_set_role(GTK_WINDOW(window), "log"); |
1648
09445224e2d9
[gaim-migrate @ 1658]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1634
diff
changeset
|
4202 if (name) |
4472 | 4203 g_snprintf(buf, BUF_LONG, _("Gaim - Conversations with %s"), name); |
1648
09445224e2d9
[gaim-migrate @ 1658]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1634
diff
changeset
|
4204 else |
4472 | 4205 g_snprintf(buf, BUF_LONG, _("Gaim - System Log")); |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4206 gtk_window_set_title(GTK_WINDOW(window), buf); |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4207 gtk_container_set_border_width(GTK_CONTAINER(window), 10); |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4208 gtk_window_set_policy(GTK_WINDOW(window), TRUE, TRUE, TRUE); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4209 block = g_signal_connect(GTK_OBJECT(window), "delete_event", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4210 G_CALLBACK(dont_destroy), window); |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4211 gtk_widget_realize(window); |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4212 |
2570 | 4213 layout = gtk_imhtml_new(NULL, NULL); |
2602 | 4214 bbox = gtk_hbox_new(FALSE, 0); |
4215 | |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4216 box = gtk_vbox_new(FALSE, 5); |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4217 gtk_container_add(GTK_CONTAINER(window), box); |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4218 |
2570 | 4219 hbox = gtk_hbox_new(FALSE, 5); |
4220 gtk_box_pack_start(GTK_BOX(box), hbox, TRUE, TRUE, 0); | |
4221 | |
4222 if (name) { | |
4223 char *tmp = gaim_user_dir(); | |
3630 | 4224 g_snprintf(filename, 256, "%s" G_DIR_SEPARATOR_S "logs" G_DIR_SEPARATOR_S "%s.log", tmp, normalize(name)); |
2570 | 4225 if ((fp = fopen(filename, "r")) == NULL) { |
4472 | 4226 g_snprintf(buf, BUF_LONG, _("Couldn't open log file %s"), filename); |
3427 | 4227 do_error_dialog(buf, strerror(errno), GAIM_ERROR); |
2570 | 4228 return; |
4229 } | |
4230 | |
4231 list = gtk_list_new(); | |
4232 | |
4233 frame = gtk_frame_new(_("Date")); | |
4234 gtk_widget_show(frame); | |
4235 | |
4236 sw = gtk_scrolled_window_new(NULL, NULL); | |
4237 gtk_container_set_border_width(GTK_CONTAINER(sw), 5); | |
4238 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
|
4239 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), |
6f7e1fc3e132
[gaim-migrate @ 2626]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2612
diff
changeset
|
4240 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
2571 | 4241 gtk_widget_set_usize(sw, 220, 220); |
2570 | 4242 gtk_container_add(GTK_CONTAINER(frame), sw); |
4243 gtk_box_pack_start(GTK_BOX(hbox), frame, TRUE, TRUE, 0); | |
4244 | |
4245 while (fgets(buf, BUF_LONG, fp)) { | |
4246 if (strstr(buf, "---- New C")) { | |
4247 int length; | |
4248 char *temp = strchr(buf, '@'); | |
2612 | 4249 |
2570 | 4250 if (temp == NULL || strlen(temp) < 2) |
4251 continue; | |
2612 | 4252 |
2613
6f7e1fc3e132
[gaim-migrate @ 2626]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2612
diff
changeset
|
4253 if (i == 1 && item_list) { |
6f7e1fc3e132
[gaim-migrate @ 2626]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2612
diff
changeset
|
4254 item_list = g_list_remove(item_list, last); |
6f7e1fc3e132
[gaim-migrate @ 2626]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2612
diff
changeset
|
4255 last = NULL; |
2612 | 4256 } |
4257 | |
4258 i = 0; | |
4259 | |
2570 | 4260 temp++; |
4261 length = strcspn(temp, "-"); | |
4262 if (length > 31) length = 31; | |
4263 | |
4264 offset = ftell(fp); | |
4265 g_snprintf(convo_start, length, "%s", temp); | |
4266 item = gtk_list_item_new_with_label(convo_start); | |
2621
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4267 view = g_new0(struct view_log, 1); |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4268 view->options = options; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4269 view->offset = offset; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4270 view->name = g_strdup(name); |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4271 view->bbox = bbox; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4272 view->window = window; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4273 view->layout = layout; |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4274 g_signal_connect(GTK_OBJECT(item), "select", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4275 G_CALLBACK(log_show_convo), view); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4276 g_signal_connect(GTK_OBJECT(item), "destroy", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4277 G_CALLBACK(des_view_item), view); |
2612 | 4278 last = item; |
4279 item_list = g_list_append(item_list, item); | |
2613
6f7e1fc3e132
[gaim-migrate @ 2626]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2612
diff
changeset
|
4280 |
2570 | 4281 gtk_widget_show(item); |
4282 } | |
2612 | 4283 i++; |
2570 | 4284 } |
4285 fclose(fp); | |
2613
6f7e1fc3e132
[gaim-migrate @ 2626]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2612
diff
changeset
|
4286 if (i == 1 && item_list) |
6f7e1fc3e132
[gaim-migrate @ 2626]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2612
diff
changeset
|
4287 item_list = g_list_remove(item_list, item); |
6f7e1fc3e132
[gaim-migrate @ 2626]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2612
diff
changeset
|
4288 |
2612 | 4289 if (item_list) |
2613
6f7e1fc3e132
[gaim-migrate @ 2626]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2612
diff
changeset
|
4290 gtk_list_insert_items(GTK_LIST(list), item_list, 0 ); |
2612 | 4291 } |
4292 | |
2602 | 4293 gtk_signal_disconnect(GTK_OBJECT(window), block); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4294 g_signal_connect(GTK_OBJECT(window), "delete_event", G_CALLBACK(destroy_dialog), window); |
2602 | 4295 |
2570 | 4296 frame = gtk_frame_new(_("Conversation")); |
4297 gtk_widget_show(frame); | |
4298 | |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4299 sw = gtk_scrolled_window_new(NULL, NULL); |
2570 | 4300 gtk_container_set_border_width(GTK_CONTAINER(sw), 5); |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4301 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
4333 | 4302 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
|
4303 gtk_widget_set_usize(sw, 390, 220); |
2570 | 4304 gtk_container_add(GTK_CONTAINER(frame), sw); |
4305 gtk_box_pack_start(GTK_BOX(hbox), frame, TRUE, TRUE, 0); | |
4306 | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4307 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
|
4308 gtk_container_add(GTK_CONTAINER(sw), layout); |
1815
f15d449b3167
[gaim-migrate @ 1825]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1805
diff
changeset
|
4309 gaim_setup_imhtml(layout); |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4310 |
2602 | 4311 gtk_box_pack_start(GTK_BOX(box), bbox, FALSE, FALSE, 0); |
4312 gtk_widget_set_sensitive(bbox, FALSE); | |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4313 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4314 close_button = picture_button(window, _("Close"), cancel_xpm); |
2602 | 4315 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
|
4316 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
|
4317 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4318 clear_button = picture_button(window, _("Clear"), close_xpm); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4319 gtk_object_set_user_data(GTK_OBJECT(clear_button), window); |
2602 | 4320 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
|
4321 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
|
4322 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
4323 save_button = picture_button(window, _("Save"), save_xpm); |
2602 | 4324 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
|
4325 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
|
4326 |
2570 | 4327 gtk_widget_show_all(window); |
4328 | |
4329 if (!name) { | |
2621
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4330 view = g_new0(struct view_log, 1); |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4331 view->options = options; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4332 view->name = NULL; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4333 view->bbox = bbox; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4334 view->window = window; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4335 view->layout = layout; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
4336 log_show_convo(layout, view); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4337 g_signal_connect(GTK_OBJECT(layout), "destroy", G_CALLBACK(des_view_item), view); |
2570 | 4338 } else { |
4339 gtk_list_select_item(GTK_LIST(list), 0); | |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4340 } |
2570 | 4341 |
2602 | 4342 gtk_widget_set_sensitive(bbox, TRUE); |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4343 |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4344 return; |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
4345 } |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4346 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4347 /*------------------------------------------------------------------------*/ |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4348 /* The dialog for renaming groups */ |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4349 /*------------------------------------------------------------------------*/ |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4350 |
4183 | 4351 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
|
4352 { |
3466 | 4353 const char *new_name; |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4354 struct group *g; |
1748
2eec724fdbcd
[gaim-migrate @ 1758]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1736
diff
changeset
|
4355 struct group *orig; |
4349 | 4356 GSList *accts; |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4357 |
4183 | 4358 if (resp == GTK_RESPONSE_OK) { |
4359 | |
4360 new_name = gtk_entry_get_text(GTK_ENTRY(entry)); | |
4361 g = gtk_object_get_user_data(GTK_OBJECT(entry)); | |
4362 | |
4363 if (new_name && (strlen(new_name) != 0) && strcmp(new_name, g->name)) { | |
4364 char *prevname; | |
4365 | |
4349 | 4366 if ((orig = find_group(new_name)) != NULL && g_strcasecmp(new_name, g->name)) { |
4183 | 4367 orig->members = g_slist_concat(orig->members, g->members); |
4368 handle_group_rename(orig, g->name); | |
4349 | 4369 groups = g_slist_remove(groups, g); |
4183 | 4370 /* FIXME, i don't like calling this. it's sloppy. */ build_edit_tree(); |
4349 | 4371 accts = gaim_group_get_accounts(g); |
4372 while(accts) { | |
4491 | 4373 struct gaim_account *account = accts->data; |
4374 serv_rename_group(account->gc, g, new_name); | |
4349 | 4375 accts = g_slist_remove(accts, accts->data); |
4376 } | |
4183 | 4377 g_free(g); |
4378 } else { | |
4379 prevname = g_strdup(g->name); | |
4349 | 4380 accts = gaim_group_get_accounts(g); |
4381 while(accts) { | |
4491 | 4382 struct gaim_account *account = accts->data; |
4383 serv_rename_group(account->gc, g, new_name); | |
4349 | 4384 accts = g_slist_remove(accts, accts->data); |
4385 } | |
4183 | 4386 g_snprintf(g->name, sizeof(g->name), "%s", new_name); |
4387 handle_group_rename(g, prevname); | |
4388 /* FIXME, i don't like calling this. it's sloppy. */ build_edit_tree(); | |
4389 g_free(prevname); | |
4390 } | |
4349 | 4391 gaim_blist_save(); |
1748
2eec724fdbcd
[gaim-migrate @ 1758]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1736
diff
changeset
|
4392 } |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4393 } |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4394 destroy_dialog(rename_dialog, rename_dialog); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4395 } |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4396 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4397 void show_rename_group(GtkWidget *unused, struct group *g) |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4398 { |
4183 | 4399 |
4400 GtkWidget *hbox, *vbox; | |
4401 GtkWidget *label; | |
4402 char *filename = g_build_filename(DATADIR, "pixmaps", "gaim", "dialogs", "gaim_question.png", NULL); | |
4403 GtkWidget *img = gtk_image_new_from_file(filename); | |
4201
511c2b63caa4
[gaim-migrate @ 4432]
Christian Hammond <chipx86@chipx86.com>
parents:
4198
diff
changeset
|
4404 GtkWidget *name_entry = NULL; |
4183 | 4405 |
4406 g_free(filename); | |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4407 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4408 if (!rename_dialog) { |
4183 | 4409 rename_dialog = gtk_dialog_new_with_buttons(_("Gaim - Rename Group"), GTK_WINDOW(blist), GTK_DIALOG_MODAL, |
4410 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); | |
4411 gtk_dialog_set_default_response (GTK_DIALOG(rename_dialog), GTK_RESPONSE_OK); | |
4412 gtk_container_set_border_width (GTK_CONTAINER(rename_dialog), 6); | |
4413 gtk_window_set_resizable(GTK_WINDOW(rename_dialog), FALSE); | |
4414 gtk_dialog_set_has_separator(GTK_DIALOG(rename_dialog), FALSE); | |
4415 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(rename_dialog)->vbox), 12); | |
4416 gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(rename_dialog)->vbox), 6); | |
4417 | |
4418 hbox = gtk_hbox_new(FALSE, 12); | |
4419 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(rename_dialog)->vbox), hbox); | |
4420 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
4421 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
4422 | |
4423 vbox = gtk_vbox_new(FALSE, 0); | |
4424 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
4425 | |
4426 label = gtk_label_new(_("Please enter a new name for the selected group.\n")); | |
4427 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
4428 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
4429 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
4430 | |
4431 hbox = gtk_hbox_new(FALSE, 6); | |
4432 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
4433 | |
4434 label = gtk_label_new(NULL); | |
4435 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Group:")); | |
4436 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
4437 | |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4438 name_entry = gtk_entry_new(); |
4183 | 4439 gtk_entry_set_activates_default (GTK_ENTRY(name_entry), TRUE); |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4440 gtk_object_set_user_data(GTK_OBJECT(name_entry), g); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4441 gtk_entry_set_text(GTK_ENTRY(name_entry), g->name); |
4183 | 4442 gtk_box_pack_start(GTK_BOX(hbox), name_entry, FALSE, FALSE, 0); |
4443 gtk_entry_set_activates_default (GTK_ENTRY(name_entry), TRUE); | |
4444 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(name_entry)); | |
4445 | |
4446 g_signal_connect(G_OBJECT(rename_dialog), "response", G_CALLBACK(do_rename_group), name_entry); | |
4182 | 4447 |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4448 } |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4449 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4450 gtk_widget_show_all(rename_dialog); |
4201
511c2b63caa4
[gaim-migrate @ 4432]
Christian Hammond <chipx86@chipx86.com>
parents:
4198
diff
changeset
|
4451 if(name_entry) |
511c2b63caa4
[gaim-migrate @ 4432]
Christian Hammond <chipx86@chipx86.com>
parents:
4198
diff
changeset
|
4452 gtk_widget_grab_focus(GTK_WIDGET(name_entry)); |
1729
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 |
2743 | 4455 |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4456 /*------------------------------------------------------------------------*/ |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4457 /* The dialog for renaming buddies */ |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4458 /*------------------------------------------------------------------------*/ |
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 static void do_rename_buddy(GtkObject *obj, GtkWidget *entry) |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4461 { |
3466 | 4462 const char *new_name; |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4463 struct buddy *b; |
2681
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2679
diff
changeset
|
4464 GSList *gr; |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4465 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4466 new_name = gtk_entry_get_text(GTK_ENTRY(entry)); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4467 b = gtk_object_get_user_data(obj); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4468 |
4491 | 4469 if (!g_slist_find(connections, b->account->gc)) { |
2681
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2679
diff
changeset
|
4470 destroy_dialog(rename_bud_dialog, rename_bud_dialog); |
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2679
diff
changeset
|
4471 return; |
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2679
diff
changeset
|
4472 } |
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2679
diff
changeset
|
4473 |
4349 | 4474 gr = groups; |
2681
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2679
diff
changeset
|
4475 while (gr) { |
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2679
diff
changeset
|
4476 if (g_slist_find(((struct group *)gr->data)->members, b)) |
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2679
diff
changeset
|
4477 break; |
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2679
diff
changeset
|
4478 gr = gr->next; |
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2679
diff
changeset
|
4479 } |
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2679
diff
changeset
|
4480 if (!gr) { |
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2679
diff
changeset
|
4481 destroy_dialog(rename_bud_dialog, rename_bud_dialog); |
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2679
diff
changeset
|
4482 return; |
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2679
diff
changeset
|
4483 } |
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2679
diff
changeset
|
4484 |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4485 if (new_name && (strlen(new_name) != 0) && strcmp(new_name, b->name)) { |
4349 | 4486 struct group *g = find_group_by_buddy(b); |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4487 char *prevname = g_strdup(b->name); |
2681
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2679
diff
changeset
|
4488 if (g) |
4491 | 4489 serv_remove_buddy(b->account->gc, b->name, g->name); |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4490 g_snprintf(b->name, sizeof(b->name), "%s", new_name); |
4491 | 4491 serv_add_buddy(b->account->gc, b->name); |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4492 handle_buddy_rename(b, prevname); |
4349 | 4493 gaim_blist_save(); |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4494 g_free(prevname); |
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 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4497 destroy_dialog(rename_bud_dialog, rename_bud_dialog); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4498 } |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4499 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4500 void show_rename_buddy(GtkWidget *unused, struct buddy *b) |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4501 { |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4502 GtkWidget *mainbox; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4503 GtkWidget *frame; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4504 GtkWidget *fbox; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4505 GtkWidget *bbox; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4506 GtkWidget *button; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4507 GtkWidget *name_entry; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4508 GtkWidget *label; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4509 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4510 if (!rename_bud_dialog) { |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
4511 GAIM_DIALOG(rename_bud_dialog); |
4074 | 4512 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
|
4513 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
|
4514 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
|
4515 g_signal_connect(GTK_OBJECT(rename_bud_dialog), "destroy", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4516 G_CALLBACK(destroy_dialog), rename_bud_dialog); |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4517 gtk_widget_realize(rename_bud_dialog); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4518 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4519 mainbox = gtk_vbox_new(FALSE, 5); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4520 gtk_container_set_border_width(GTK_CONTAINER(mainbox), 5); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4521 gtk_container_add(GTK_CONTAINER(rename_bud_dialog), mainbox); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4522 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4523 frame = gtk_frame_new(_("Rename Buddy")); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4524 gtk_box_pack_start(GTK_BOX(mainbox), frame, TRUE, TRUE, 0); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4525 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4526 fbox = gtk_hbox_new(FALSE, 5); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4527 gtk_container_set_border_width(GTK_CONTAINER(fbox), 5); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4528 gtk_container_add(GTK_CONTAINER(frame), fbox); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4529 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4530 label = gtk_label_new(_("New name:")); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4531 gtk_box_pack_start(GTK_BOX(fbox), label, FALSE, FALSE, 0); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4532 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4533 name_entry = gtk_entry_new(); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4534 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
|
4535 gtk_object_set_user_data(GTK_OBJECT(name_entry), b); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4536 gtk_entry_set_text(GTK_ENTRY(name_entry), b->name); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4537 g_signal_connect(GTK_OBJECT(name_entry), "activate", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4538 G_CALLBACK(do_rename_buddy), name_entry); |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4539 gtk_widget_grab_focus(name_entry); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4540 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4541 bbox = gtk_hbox_new(FALSE, 5); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4542 gtk_box_pack_start(GTK_BOX(mainbox), bbox, FALSE, FALSE, 0); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4543 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4544 button = picture_button(rename_bud_dialog, _("OK"), ok_xpm); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4545 gtk_object_set_user_data(GTK_OBJECT(button), b); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4546 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
|
4547 g_signal_connect(GTK_OBJECT(button), "clicked", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4548 G_CALLBACK(do_rename_buddy), name_entry); |
4236 | 4549 |
4550 button = picture_button(rename_bud_dialog, _("Cancel"), cancel_xpm); | |
4551 gtk_box_pack_end(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
4552 g_signal_connect(GTK_OBJECT(button), "clicked", | |
4553 G_CALLBACK(destroy_dialog), rename_bud_dialog); | |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4554 } |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4555 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4556 gtk_widget_show_all(rename_bud_dialog); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4557 } |
2370
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4558 |
2377
466b29d35b85
[gaim-migrate @ 2390]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
4559 #ifdef USE_PERL |
466b29d35b85
[gaim-migrate @ 2390]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
4560 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
4561 static GtkWidget *perl_config = NULL; |
2370
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4562 static char *perl_last_dir = NULL; |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4563 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
4564 static void cfdes(GtkWidget *m, gpointer n) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
4565 { |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
4566 if (perl_config) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
4567 gtk_widget_destroy(perl_config); |
2370
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4568 perl_config = NULL; |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4569 } |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4570 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
4571 static void do_load(GtkWidget *m, gpointer n) |
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 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
|
4574 gchar *f = NULL; |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4575 if (!file || !strlen(file)) { |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4576 return; |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4577 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
4578 |
2370
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4579 if (file_is_dir(file, perl_config)) { |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4580 return; |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4581 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
4582 |
2370
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4583 if (perl_last_dir) { |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4584 g_free(perl_last_dir); |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4585 } |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4586 perl_last_dir = g_dirname(file); |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4587 |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4588 debug_printf("Loading perl script: %s\n", file); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
4589 |
2370
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4590 f = g_strdup(file); |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4591 perl_load_file(f); |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4592 g_free(f); |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4593 cfdes(perl_config, NULL); |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4594 } |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4595 |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4596 void load_perl_script() |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4597 { |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4598 char *buf, *temp; |
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 if (perl_config) { |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4601 gtk_widget_show(perl_config); |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4602 gdk_window_raise(perl_config->window); |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4603 return; |
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 |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4606 /* Below is basically stolen from plugins.c */ |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4607 perl_config = gtk_file_selection_new(_("Gaim - Select Perl Script")); |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4608 |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4609 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(perl_config)); |
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 if (!perl_last_dir) { |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4612 temp = gaim_user_dir(); |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4613 buf = g_strconcat(temp, G_DIR_SEPARATOR_S, NULL); |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4614 } else { |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4615 buf = g_strconcat(perl_last_dir, G_DIR_SEPARATOR_S, NULL); |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4616 } |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4617 |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4618 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
|
4619 gtk_file_selection_complete(GTK_FILE_SELECTION(perl_config), "*.pl"); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4620 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
|
4621 |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4622 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
|
4623 "clicked", G_CALLBACK(do_load), NULL); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4624 |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4625 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
|
4626 "clicked", G_CALLBACK(cfdes), NULL); |
2370
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4627 |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4628 g_free(buf); |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4629 gtk_widget_show(perl_config); |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4630 gdk_window_raise(perl_config->window); |
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4631 } |
2377
466b29d35b85
[gaim-migrate @ 2390]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
4632 |
466b29d35b85
[gaim-migrate @ 2390]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
4633 #endif /* USE_PERL */ |
2379
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4634 |
3668 | 4635 GtkWidget *gaim_pixbuf_toolbar_button_from_stock(char *icon) |
4636 { | |
4637 GtkWidget *button, *image, *bbox; | |
4638 | |
4639 button = gtk_toggle_button_new(); | |
4640 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
4641 | |
4642 bbox = gtk_vbox_new(FALSE, 0); | |
4643 | |
4644 gtk_container_add (GTK_CONTAINER(button), bbox); | |
4645 | |
4646 image = gtk_image_new_from_stock(icon, GTK_ICON_SIZE_MENU); | |
4647 gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 0); | |
4648 | |
4649 gtk_widget_show_all(bbox); | |
4650 return button; | |
4651 } | |
4652 | |
3671 | 4653 GtkWidget *gaim_pixbuf_toolbar_button_from_file(char *icon) |
4654 { | |
4655 GtkWidget *button, *image, *bbox; | |
4656 char *filename; | |
4657 | |
4658 if (!icon) | |
4659 return NULL; | |
4660 | |
4661 button = gtk_toggle_button_new(); | |
4662 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
4663 | |
4664 bbox = gtk_vbox_new(FALSE, 0); | |
4665 | |
4666 gtk_container_add (GTK_CONTAINER(button), bbox); | |
4667 | |
4668 filename = g_build_filename (DATADIR, "pixmaps", "gaim", "buttons", icon, NULL); | |
4669 debug_printf("Loading: %s\n", filename); | |
4670 image = gtk_image_new_from_file(filename); | |
4671 g_free(filename); | |
4672 | |
4673 gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 0); | |
4674 | |
4675 gtk_widget_show_all(bbox); | |
4676 return button; | |
4677 } | |
4678 | |
4679 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
4680 GtkWidget * |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
4681 gaim_pixbuf_button_from_stock(const char *text, const char *icon, |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
4682 GaimButtonStyle style) |
3668 | 4683 { |
4684 GtkWidget *button, *image, *label, *bbox; | |
4685 button = gtk_button_new(); | |
4686 | |
4687 if (style == GAIM_BUTTON_HORIZONTAL) | |
4688 bbox = gtk_hbox_new(FALSE, 5); | |
4689 else | |
4690 bbox = gtk_vbox_new(FALSE, 0); | |
4691 | |
4692 gtk_container_add (GTK_CONTAINER(button), bbox); | |
4693 | |
4694 if (icon) { | |
4695 image = gtk_image_new_from_stock(icon, GTK_ICON_SIZE_BUTTON); | |
4696 gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 0); | |
4697 } | |
4698 | |
4699 if (text) { | |
4700 label = gtk_label_new(NULL); | |
4701 gtk_label_set_text_with_mnemonic(GTK_LABEL(label), text); | |
4702 gtk_label_set_mnemonic_widget(GTK_LABEL(label), button); | |
4703 gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0); | |
4704 } | |
4705 | |
4706 gtk_widget_show_all(bbox); | |
4707 return button; | |
4708 } | |
4709 | |
3649 | 4710 GtkWidget *gaim_pixbuf_button(char *text, char *iconfile, GaimButtonStyle style) |
3367 | 4711 { |
4712 GtkWidget *button, *image, *label, *bbox; | |
4713 button = gtk_button_new(); | |
3649 | 4714 |
4715 if (style == GAIM_BUTTON_HORIZONTAL) | |
4716 bbox = gtk_hbox_new(FALSE, 5); | |
4717 else | |
4718 bbox = gtk_vbox_new(FALSE, 0); | |
4719 | |
3367 | 4720 gtk_container_add (GTK_CONTAINER(button), bbox); |
3649 | 4721 |
3367 | 4722 if (iconfile) { |
4723 char *filename; | |
4724 filename = g_build_filename (DATADIR, "pixmaps", "gaim", "buttons", iconfile, NULL); | |
4725 debug_printf("Loading: %s\n", filename); | |
4726 image = gtk_image_new_from_file(filename); | |
4727 gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 0); | |
4728 g_free(filename); | |
4729 } | |
3649 | 4730 |
3367 | 4731 if (text) { |
4732 label = gtk_label_new(NULL); | |
4733 gtk_label_set_text_with_mnemonic(GTK_LABEL(label), text); | |
4734 gtk_label_set_mnemonic_widget(GTK_LABEL(label), button); | |
4735 gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0); | |
4736 } | |
4737 gtk_widget_show_all(bbox); | |
4738 return button; | |
4739 } | |
3427 | 4740 |
2379
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4741 GtkWidget *picture_button(GtkWidget *window, char *text, char **xpm) |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4742 { |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4743 GtkWidget *button; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4744 GtkWidget *button_box, *button_box_2, *button_box_3; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4745 GtkWidget *label; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4746 GdkBitmap *mask; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4747 GdkPixmap *pm; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4748 GtkWidget *pixmap; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4749 |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4750 button = gtk_button_new(); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4751 |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4752 button_box = gtk_hbox_new(FALSE, 5); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4753 gtk_container_add(GTK_CONTAINER(button), button_box); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4754 |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4755 button_box_2 = gtk_hbox_new(FALSE, 0); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4756 button_box_3 = gtk_hbox_new(FALSE, 0); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4757 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
|
4758 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
|
4759 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
|
4760 pixmap = gtk_pixmap_new(pm, mask); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4761 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
|
4762 |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4763 if (text) { |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4764 label = gtk_label_new(text); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4765 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
|
4766 gtk_widget_show(label); |
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 |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4769 gtk_widget_show(pixmap); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4770 gtk_widget_show(button_box_2); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4771 gtk_widget_show(button_box_3); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4772 gtk_widget_show(button_box); |
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 /* this causes clipping on lots of buttons with long text */ |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4775 /* gtk_widget_set_usize(button, 75, 30);*/ |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4776 gtk_widget_show(button); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4777 gdk_pixmap_unref(pm); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4778 gdk_bitmap_unref(mask); |
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 return button; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4781 } |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4782 |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4783 static GtkTooltips *button_tips = NULL; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4784 GtkWidget *picture_button2(GtkWidget *window, char *text, char **xpm, short dispstyle) |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4785 { |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4786 GtkWidget *button; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4787 GtkWidget *button_box, *button_box_2; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4788 GdkBitmap *mask; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4789 GdkPixmap *pm; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4790 GtkWidget *pixmap; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4791 GtkWidget *label; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4792 |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4793 if (!button_tips) |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4794 button_tips = gtk_tooltips_new(); |
3902 | 4795 |
2379
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4796 button = gtk_button_new(); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4797 |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4798 button_box = gtk_hbox_new(FALSE, 0); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4799 gtk_container_add(GTK_CONTAINER(button), button_box); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4800 |
3320 | 4801 button_box_2 = gtk_vbox_new(FALSE, 0); |
4802 | |
4803 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
|
4804 gtk_widget_show(button_box_2); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4805 gtk_widget_show(button_box); |
3327 | 4806 if (dispstyle == 2 || dispstyle == 0) { |
4807 pm = gdk_pixmap_create_from_xpm_d(window->window, &mask, NULL, xpm); | |
4808 pixmap = gtk_pixmap_new(pm, mask); | |
4809 gtk_box_pack_start(GTK_BOX(button_box_2), pixmap, FALSE, FALSE, 0); | |
4810 | |
4811 gtk_widget_show(pixmap); | |
4812 | |
4813 gdk_pixmap_unref(pm); | |
4814 gdk_bitmap_unref(mask); | |
4815 } | |
4816 | |
4817 if (dispstyle == 2 || dispstyle == 1) { | |
4818 label = gtk_label_new(text); | |
4819 gtk_widget_show(label); | |
4820 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
|
4821 } |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4822 |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4823 gtk_tooltips_set_tip(button_tips, button, text, "Gaim"); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4824 gtk_widget_show(button); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4825 return button; |
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 |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4828 int file_is_dir(const char *path, GtkWidget *w) |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4829 { |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4830 struct stat st; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4831 char *name; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4832 |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4833 if (stat(path, &st) == 0 && S_ISDIR(st.st_mode)) { |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4834 /* append a / if needed */ |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4835 if (path[strlen(path) - 1] != '/') { |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4836 name = g_strconcat(path, "/", NULL); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4837 } else { |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4838 name = g_strdup(path); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4839 } |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4840 gtk_file_selection_set_filename(GTK_FILE_SELECTION(w), name); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4841 g_free(name); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4842 return 1; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4843 } |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4844 |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4845 return 0; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4846 } |
2956 | 4847 |
4848 /*------------------------------------------------------------------------*/ | |
4849 /* The dialog for setting V-Card info */ | |
4850 /*------------------------------------------------------------------------*/ | |
4851 /* | |
4852 * There are actually two "chunks" of code following: generic "multi-entry dialog" | |
4853 * support and V-Card dialog specific support. | |
4854 * | |
4855 * At first blush, this may seem like an unnecessary duplication of effort given | |
4856 * that a "set dir info" dialog already exists. However, this is not so because: | |
4857 * | |
4858 * 1. V-Cards can have a lot more data in them than what the current | |
4859 * "set dir" dialog supports. | |
4860 * | |
4861 * 2. V-Card data, at least with respect to Jabber, is currently in a | |
4862 * state of flux. As the data and format changes, all that need be | |
4863 * changed with the V-Card support I've written is the "template" | |
4864 * data. | |
4865 * | |
4866 * 3. The "multi entry dialog" support itself was originally written | |
4867 * to support Jabber server user registration (TBD). A "dynamically | |
4868 * configurable" multi-entry dialog is needed for that, as different | |
4869 * servers may require different registration information. It just | |
4870 * turned out to be well-suited to adding V-Card setting support, as | |
4871 * well :-). | |
4872 * | |
4873 * TBD: Add check-box support to the generic multi-entry dialog support so that | |
4874 * it can be used to "replace" the "set dir info" support? | |
4875 * | |
4876 * Multiple-language support. Currently Not In There. I think this should | |
4877 * be easy. Note that when it's added: if anybody saved their data in | |
4878 * English, it'll be lost when MLS is added and they'll have to re-enter it. | |
4879 * | |
4880 * More "TBDs" noted in the code. | |
4881 */ | |
4882 | |
4883 | |
4884 /*------------------------------------*/ | |
4885 /* generic multi-entry dialog support */ | |
4886 /*------------------------------------*/ | |
4887 | |
4888 /* | |
4889 * Print all multi-entry items | |
4890 * | |
4891 * Note: Simply a debug helper | |
4892 */ | |
4893 void multi_entry_item_print_all(const GSList *list) { | |
4894 | |
4895 int cnt = 0; | |
4896 | |
4897 /* While there's something to print... */ | |
4898 while(list != NULL) { | |
4899 fprintf(stderr, "label %2d: \"%s\"", ++cnt, ((MultiEntryData *) (list->data))->label); | |
4900 if(((MultiEntryData *) (list->data))->text != NULL) { | |
4901 fprintf(stderr, ", text: \"%s\"", ((MultiEntryData *) (list->data))->text); | |
4902 } | |
4903 fputs("\n", stderr); | |
4904 list = list->next; | |
4905 } | |
4906 } | |
4907 | |
4908 /* | |
4909 * Print all multi-text items | |
4910 * | |
4911 * Note: Simply a debug helper | |
4912 */ | |
4913 void multi_text_item_print_all(const GSList *list) { | |
4914 | |
4915 int cnt = 0; | |
4916 | |
4917 /* While there's something to print... */ | |
4918 while(list != NULL) { | |
4919 fprintf(stderr, "label %2d: \"%s\"", ++cnt, ((MultiTextData *) (list->data))->label); | |
4920 if(((MultiTextData *) (list->data))->text != NULL) { | |
4921 fprintf(stderr, ", text: \"%s\"", ((MultiTextData *) (list->data))->text); | |
4922 } | |
4923 fputs("\n", stderr); | |
4924 list = list->next; | |
4925 } | |
4926 } | |
4927 | |
4928 | |
4929 /* | |
4930 * Free all multi-entry item allocs and NULL the list pointer | |
4931 */ | |
4932 void multi_entry_items_free_all(GSList **list) | |
4933 { | |
4934 | |
4935 GSList *next = *list; | |
4936 MultiEntryData *data; | |
4937 | |
4938 /* While there's something to free() ... */ | |
4939 while(next != NULL) { | |
4940 data = (MultiEntryData *) next->data; | |
4941 g_free(data->label); | |
4942 g_free(data->text); | |
4943 g_free(data); | |
4944 next = next->next; | |
4945 } | |
4946 g_slist_free(*list); | |
4947 *list = NULL; | |
4948 } | |
4949 | |
4950 /* | |
4951 * Free all multi-text item allocs and NULL the list pointer | |
4952 */ | |
4953 void multi_text_items_free_all(GSList **list) | |
4954 { | |
4955 | |
4956 GSList *next = *list; | |
4957 MultiTextData *data; | |
4958 | |
4959 /* While there's something to free() ... */ | |
4960 while(next != NULL) { | |
4961 data = (MultiTextData *) next->data; | |
4962 g_free(data->label); | |
4963 g_free(data->text); | |
4964 g_free(data); | |
4965 next = next->next; | |
4966 } | |
4967 g_slist_free(*list); | |
4968 *list = NULL; | |
4969 } | |
4970 | |
4971 /* | |
4972 * See if a MultiEntryData item contains a given label | |
4973 * | |
4974 * See: glib docs for g_slist_compare_custom() for details | |
4975 */ | |
4976 static gint multi_entry_data_label_compare(gconstpointer data, gconstpointer label) | |
4977 { | |
4978 return(strcmp(((MultiEntryData *) (data))->label, (char *) label)); | |
4979 } | |
4980 | |
4981 /* | |
4982 * Add a new multi-entry item to list | |
4983 * | |
4984 * If adding to existing list: will search the list for existence of | |
4985 * "label" and change/create "text" entry if necessary. | |
4986 */ | |
4987 | |
4988 MultiEntryData *multi_entry_list_update(GSList **list, const char *label, const char *text, int add_it) | |
4989 { | |
4990 GSList *found; | |
4991 MultiEntryData *data; | |
4992 | |
2975 | 4993 if((found = g_slist_find_custom(*list, (void *)label, multi_entry_data_label_compare)) == NULL) { |
2956 | 4994 if(add_it) { |
4995 data = (MultiEntryData *) g_slist_last(*list = | |
4996 g_slist_append(*list, g_malloc(sizeof(MultiEntryData))))->data; | |
4997 data->label = strcpy(g_malloc(strlen(label) +1), label); | |
4998 data->text = NULL; | |
4999 /* | |
5000 * default to setting "visible" and editable to TRUE - they can be | |
5001 * overridden later, of course. | |
5002 */ | |
5003 data->visible = TRUE; | |
5004 data->editable = TRUE; | |
5005 } else { | |
5006 data = NULL; | |
5007 } | |
5008 } else { | |
5009 data = found->data; | |
5010 } | |
5011 | |
5012 if(data != NULL && text != NULL && text[0] != '\0') { | |
5013 if(data->text == NULL) { | |
5014 data->text = g_malloc(strlen(text) + 1); | |
5015 } else { | |
5016 data->text = g_realloc(data->text, strlen(text) + 1); | |
5017 } | |
5018 strcpy(data->text, text); | |
5019 } | |
5020 | |
5021 return(data); | |
5022 } | |
5023 | |
5024 /* | |
5025 * See if a MultiTextData item contains a given label | |
5026 * | |
5027 * See: glib docs for g_slist_compare_custom() for details | |
5028 */ | |
5029 static gint multi_text_data_label_compare(gconstpointer data, gconstpointer label) | |
5030 { | |
5031 return(strcmp(((MultiTextData *) (data))->label, (char *) label)); | |
5032 } | |
5033 | |
5034 /* | |
5035 * Add a new multi-text item to list | |
5036 * | |
5037 * If adding to existing list: will search the list for existence of | |
5038 * "label" and change/create "text" text if necessary. | |
5039 */ | |
5040 | |
5041 MultiTextData *multi_text_list_update(GSList **list, const char *label, const char *text, int add_it) | |
5042 { | |
5043 GSList *found; | |
5044 MultiTextData *data; | |
5045 | |
2975 | 5046 if((found = g_slist_find_custom(*list, (void *)label, multi_text_data_label_compare)) == NULL) { |
2956 | 5047 if(add_it) { |
5048 data = (MultiTextData *) g_slist_last(*list = | |
5049 g_slist_append(*list, g_malloc(sizeof(MultiTextData))))->data; | |
5050 data->label = strcpy(g_malloc(strlen(label) +1), label); | |
5051 data->text = NULL; | |
5052 } else { | |
5053 data = NULL; | |
5054 } | |
5055 } else { | |
5056 data = found->data; | |
5057 } | |
5058 | |
5059 if(data != NULL && text != NULL && text[0] != '\0') { | |
5060 if(data->text == NULL) { | |
5061 data->text = g_malloc(strlen(text) + 1); | |
5062 } else { | |
5063 data->text = g_realloc(data->text, strlen(text) + 1); | |
5064 } | |
5065 strcpy(data->text, text); | |
5066 } | |
5067 | |
5068 return(data); | |
5069 } | |
5070 | |
5071 /* | |
5072 * Free-up the multi-entry item list and the MultiEntryDlg | |
5073 * struct alloc. | |
5074 */ | |
5075 void multi_entry_free(struct multi_entry_dlg *b) | |
5076 { | |
5077 multi_entry_items_free_all(&(b->multi_entry_items)); | |
5078 multi_text_items_free_all(&(b->multi_text_items)); | |
5079 g_free(b->instructions->text); | |
5080 g_free(b->instructions); | |
2975 | 5081 g_free(b->entries_title); |
2956 | 5082 g_free(b); |
5083 } | |
5084 | |
5085 /* | |
5086 * Multi-Entry dialog "destroyed" catcher | |
5087 * | |
5088 * Free-up the multi-entry item list, destroy the dialog widget | |
5089 * and free the MultiEntryDlg struct alloc. | |
5090 * | |
5091 */ | |
5092 void multi_entry_dialog_destroy(GtkWidget *widget, gpointer data) | |
5093 { | |
5094 MultiEntryDlg *b = data; | |
5095 | |
5096 multi_entry_free(b); | |
5097 } | |
5098 | |
5099 /* | |
5100 * Show/Re-show instructions | |
5101 */ | |
5102 void re_show_multi_entry_instr(MultiInstrData *instructions) | |
5103 { | |
5104 if(instructions->label != NULL) { | |
5105 if(instructions->text == NULL) { | |
5106 gtk_widget_hide(instructions->label); | |
5107 } else { | |
5108 gtk_label_set_text(GTK_LABEL (instructions->label), instructions->text); | |
5109 gtk_widget_show(instructions->label); | |
5110 } | |
5111 } | |
5112 } | |
5113 | |
5114 /* | |
5115 * Show/Re-show entry boxes | |
5116 */ | |
5117 void re_show_multi_entry_entries(GtkWidget **entries_table, | |
5118 GtkWidget *entries_frame, | |
5119 GSList *multi_entry_items) | |
5120 { | |
5121 GtkWidget *label; | |
5122 GSList *multi_entry; | |
5123 MultiEntryData *med; | |
2975 | 5124 int rows, row_num, col_num, col_offset; |
5125 int cols = 1; | |
2956 | 5126 |
5127 /* Figure-out number of rows needed for table */ | |
2975 | 5128 if((rows = g_slist_length(multi_entry_items)) > 9) { |
5129 rows /= 2; | |
5130 ++cols; | |
5131 } | |
2956 | 5132 |
5133 if(*entries_table != NULL) { | |
5134 gtk_widget_destroy(GTK_WIDGET (*entries_table)); | |
5135 } | |
2975 | 5136 *entries_table = gtk_table_new(rows, 3 * cols, FALSE); |
2956 | 5137 gtk_container_add(GTK_CONTAINER (entries_frame), *entries_table); |
5138 | |
2975 | 5139 for(col_num = 0, multi_entry = multi_entry_items; col_num < cols && multi_entry != NULL; |
5140 ++col_num) { | |
5141 col_offset = col_num * 3; | |
5142 for(row_num = 0; row_num < rows && multi_entry != NULL; | |
5143 ++row_num, multi_entry = multi_entry->next) { | |
5144 | |
5145 med = (MultiEntryData *) multi_entry->data; | |
5146 | |
5147 label = gtk_label_new(med->label); | |
5148 gtk_misc_set_alignment(GTK_MISC(label), (gfloat) 1.0, (gfloat) 0.5); | |
5149 gtk_table_attach_defaults(GTK_TABLE (*entries_table), label, | |
5150 col_offset, 1 + col_offset, row_num, row_num +1); | |
5151 gtk_widget_show(label); | |
5152 | |
5153 label = gtk_label_new(": "); | |
5154 gtk_misc_set_alignment(GTK_MISC(label), (gfloat) 0.0, (gfloat) 0.5); | |
5155 gtk_table_attach_defaults(GTK_TABLE (*entries_table), label, | |
5156 1 + col_offset, 2 + col_offset, row_num, row_num +1); | |
5157 gtk_widget_show(label); | |
5158 | |
5159 med->widget = gtk_entry_new_with_max_length(50); | |
5160 if(med->text != NULL) { | |
5161 gtk_entry_set_text(GTK_ENTRY (med->widget), med->text); | |
5162 } | |
5163 gtk_entry_set_visibility(GTK_ENTRY (med->widget), med->visible); | |
5164 gtk_entry_set_editable(GTK_ENTRY (med->widget), med->editable); | |
5165 gtk_table_attach(GTK_TABLE (*entries_table), med->widget, | |
5166 2 + col_offset, 3 + col_offset, row_num, row_num +1, | |
5167 GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 5, 0); | |
5168 gtk_widget_show(med->widget); | |
2956 | 5169 } |
5170 } | |
5171 | |
5172 gtk_widget_show(*entries_table); | |
5173 } | |
5174 | |
5175 /* | |
5176 * Show/Re-show textboxes | |
5177 */ | |
5178 void re_show_multi_entry_textboxes(GtkWidget **texts_ibox, | |
5179 GtkWidget *texts_obox, | |
5180 GSList *multi_text_items) | |
5181 { | |
5182 GSList *multi_text; | |
5183 MultiTextData *mtd; | |
5184 GtkWidget *frame; | |
5185 GtkWidget *hbox; | |
5186 GtkWidget *vscrollbar; | |
5187 | |
5188 if(*texts_ibox != NULL) { | |
5189 gtk_widget_destroy(GTK_WIDGET (*texts_ibox)); | |
5190 } | |
5191 *texts_ibox = gtk_vbox_new(FALSE, 5); | |
5192 gtk_container_add(GTK_CONTAINER (texts_obox), *texts_ibox); | |
5193 | |
5194 for(multi_text = multi_text_items; multi_text != NULL; multi_text = multi_text->next) { | |
5195 mtd = (MultiTextData *) multi_text->data; | |
5196 frame = gtk_frame_new(mtd->label); | |
5197 gtk_container_add(GTK_CONTAINER (*texts_ibox), frame); | |
5198 hbox = gtk_hbox_new(FALSE, 0); | |
5199 gtk_container_add(GTK_CONTAINER (frame), hbox); | |
5200 mtd->textbox = gtk_text_new(NULL, NULL); | |
5201 gtk_text_set_editable(GTK_TEXT(mtd->textbox), TRUE); | |
5202 gtk_text_set_word_wrap(GTK_TEXT(mtd->textbox), TRUE); | |
5203 gtk_widget_set_usize(mtd->textbox, 300, 100); | |
3542 | 5204 gtk_text_insert(GTK_TEXT(mtd->textbox), NULL, NULL, NULL, mtd->text?mtd->text:"", -1); |
2956 | 5205 gtk_box_pack_start(GTK_BOX (hbox), mtd->textbox, FALSE, FALSE, 0); |
5206 vscrollbar = gtk_vscrollbar_new (GTK_TEXT(mtd->textbox)->vadj); | |
5207 gtk_box_pack_start(GTK_BOX (hbox), vscrollbar, FALSE, FALSE, 0); | |
5208 gtk_widget_show(mtd->textbox); | |
5209 gtk_widget_show (vscrollbar); | |
5210 gtk_widget_show(hbox); | |
5211 gtk_widget_show(frame); | |
5212 } | |
5213 | |
5214 gtk_widget_show(*texts_ibox); | |
5215 } | |
5216 | |
5217 /* | |
5218 * Create and initialize a new Multi-Entry Dialog struct | |
5219 */ | |
5220 MultiEntryDlg *multi_entry_dialog_new() | |
5221 { | |
5222 MultiEntryDlg *b = g_new0(MultiEntryDlg, 1); | |
5223 b->instructions = g_new0(MultiInstrData, 1); | |
5224 b->multi_entry_items = NULL; | |
5225 b->multi_text_items = NULL; | |
5226 return(b); | |
5227 } | |
5228 | |
5229 /* | |
5230 * Instantiate a new multi-entry dialog | |
5231 * | |
5232 * data == pointer to MultiEntryDlg with the following | |
5233 * initialized: | |
5234 * | |
4074 | 5235 * role |
2956 | 5236 * title |
5237 * user | |
5238 * multi_entry_items - pointers to MultiEntryData list | |
5239 * and MultiTextData list | |
5240 * instructions (optional) | |
5241 * ok function pointer | |
5242 * cancel function pointer (actually used to set | |
5243 * window destroy signal--cancel asserts destroy) | |
5244 * | |
5245 * sets the following in the MultiEntryDialog struct: | |
5246 * | |
5247 * window | |
5248 */ | |
5249 void show_multi_entry_dialog(gpointer data) | |
5250 { | |
5251 GtkWidget *vbox, *hbox; | |
5252 GtkWidget *button; | |
5253 MultiEntryDlg *b = data; | |
5254 | |
5255 GAIM_DIALOG(b->window); | |
2969 | 5256 gtk_container_set_border_width(GTK_CONTAINER(b->window), 5); |
4074 | 5257 gtk_window_set_role(GTK_WINDOW(b->window), b->role); |
2956 | 5258 gtk_window_set_title(GTK_WINDOW (b->window), b->title); |
2969 | 5259 |
2956 | 5260 /* Clean up if user dismisses window via window manager! */ |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
5261 g_signal_connect(GTK_OBJECT(b->window), "destroy", G_CALLBACK(b->cancel), (gpointer) b); |
2956 | 5262 gtk_widget_realize(b->window); |
5263 | |
5264 vbox = gtk_vbox_new(FALSE, 5); | |
5265 gtk_container_add(GTK_CONTAINER (b->window), vbox); | |
5266 | |
5267 b->instructions->label = gtk_label_new(NULL); | |
5268 gtk_label_set_line_wrap(GTK_LABEL (b->instructions->label), TRUE); | |
5269 gtk_box_pack_start(GTK_BOX (vbox), b->instructions->label, TRUE, TRUE, 5); | |
5270 re_show_multi_entry_instr(b->instructions); | |
5271 | |
2975 | 5272 b->entries_frame = gtk_frame_new(b->entries_title); |
2956 | 5273 gtk_box_pack_start(GTK_BOX (vbox), b->entries_frame, TRUE, TRUE, 5); |
5274 gtk_widget_show(b->entries_frame); | |
5275 b->entries_table = NULL; | |
5276 re_show_multi_entry_entries(&(b->entries_table), b->entries_frame, b->multi_entry_items); | |
5277 | |
5278 b->texts_obox = gtk_vbox_new(FALSE, 0); | |
2969 | 5279 gtk_box_pack_start(GTK_BOX (vbox), b->texts_obox, TRUE, TRUE, 5); |
2956 | 5280 gtk_widget_show(b->texts_obox); |
5281 b->texts_ibox = NULL; | |
5282 re_show_multi_entry_textboxes(&(b->texts_ibox), b->texts_obox, b->multi_text_items); | |
5283 | |
5284 hbox = gtk_hbox_new(FALSE, 0); | |
2969 | 5285 gtk_box_pack_start(GTK_BOX (vbox), hbox, FALSE, FALSE, 5); |
2956 | 5286 gtk_widget_show(hbox); |
5287 | |
4236 | 5288 button = picture_button(b->window, _("Save"), save_xpm); |
5289 g_signal_connect(GTK_OBJECT (button), "clicked", | |
5290 G_CALLBACK (b->ok), (gpointer) b); | |
5291 gtk_box_pack_end(GTK_BOX (hbox), button, FALSE, FALSE, 5); | |
5292 gtk_widget_show(button); | |
5293 | |
2956 | 5294 button = picture_button(b->window, _("Cancel"), cancel_xpm); |
2969 | 5295 |
2956 | 5296 /* Let "destroy handling" (set above) handle cleanup */ |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
5297 g_signal_connect_swapped(GTK_OBJECT (button), "clicked", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
5298 G_CALLBACK (gtk_widget_destroy), GTK_OBJECT (b->window)); |
2969 | 5299 gtk_box_pack_end(GTK_BOX (hbox), button, FALSE, FALSE, 5); |
2956 | 5300 gtk_widget_show(button); |
5301 | |
5302 gtk_widget_show(vbox); | |
5303 gtk_widget_show(b->window); | |
5304 } | |
5305 | |
5306 | |
5307 /*------------------------------------*/ | |
5308 /* V-Card dialog specific support */ | |
5309 /*------------------------------------*/ | |
5310 | |
5311 /* | |
5312 * V-Card "set info" dialog "Save" clicked | |
5313 * | |
5314 * Copy data from GTK+ dialogs into GSLists, call protocol-specific | |
5315 * formatter and save the user info data. | |
5316 */ | |
5317 void set_vcard_dialog_ok_clicked(GtkWidget *widget, gpointer data) | |
5318 { | |
5319 MultiEntryDlg *b = (MultiEntryDlg *) data; | |
5320 struct gaim_connection *gc; | |
5321 gchar *tmp; | |
5322 GSList *list; | |
5323 | |
5324 for(list = b->multi_entry_items; list != NULL; list = list->next) { | |
5325 if(((MultiEntryData *) list->data)->text != NULL) { | |
5326 g_free(((MultiEntryData *) list->data)->text); | |
5327 } | |
5328 ((MultiEntryData *) list->data)->text = | |
5329 g_strdup(gtk_entry_get_text(GTK_ENTRY(((MultiEntryData *) list->data)->widget))); | |
5330 } | |
5331 | |
5332 for(list = b->multi_text_items; list != NULL; list = list->next) { | |
5333 if(((MultiTextData *) list->data)->text != NULL) { | |
5334 g_free(((MultiTextData *) list->data)->text); | |
5335 } | |
5336 ((MultiTextData *) list->data)->text = | |
5337 gtk_editable_get_chars((GtkEditable *) (((MultiTextData *) list->data)->textbox), | |
5338 0, -1); | |
5339 } | |
5340 | |
5341 | |
5342 tmp = b->custom(b); | |
5343 | |
5344 /* | |
5345 * Set the user info and (possibly) send to the server | |
5346 */ | |
4491 | 5347 if (b->account) { |
5348 strncpy(b->account->user_info, tmp, sizeof b->account->user_info); | |
5349 gc = b->account->gc; | |
2956 | 5350 |
5351 save_prefs(); | |
5352 | |
5353 if (gc) | |
4491 | 5354 serv_set_info(gc, b->account->user_info); |
2956 | 5355 } |
5356 | |
5357 g_free(tmp); | |
5358 | |
5359 /* Let multi-edit dialog window "destroy" event catching handle remaining cleanup */ | |
5360 gtk_widget_destroy(GTK_WIDGET (b->window)); | |
5361 } | |
5362 | |
5363 /* | |
5364 * Instantiate a v-card dialog | |
5365 */ | |
5366 void show_set_vcard(MultiEntryDlg *b) | |
5367 { | |
5368 b->ok = set_vcard_dialog_ok_clicked; | |
5369 b->cancel = multi_entry_dialog_destroy; | |
5370 | |
5371 show_multi_entry_dialog(b); | |
5372 } | |
5373 | |
5374 | |
5375 /*------------------------------------------------------------------------*/ | |
5376 /* End dialog for setting v-card info */ | |
5377 /*------------------------------------------------------------------------*/ | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
5378 |