Mercurial > pidgin
annotate src/dialogs.c @ 5116:c081a81ee013
[gaim-migrate @ 5479]
Bjoern Voigt writes:
"I have prepared some updates and patches:
1) File i18n5-de.patch
- updated German translation
2) File i18n5.patch
- new files in po/POTFILES.in
- new strings marked for translation
3) File i18n5-accelgroup.patch
- keyboard accelerators for conversation window
4) File i18n5-gaim-remote.patch
- i18n support for gaim-remote.c
- correct handling of "--help" option"
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Sat, 12 Apr 2003 23:31:41 +0000 |
parents | 4cfc49e31c2e |
children | 381da05cb5ed |
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" |
4687 | 51 #include "gtklist.h" |
1 | 52 |
3630 | 53 #ifdef _WIN32 |
54 #include "win32dep.h" | |
55 #endif | |
56 | |
1035
80a47e3b1bca
[gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1032
diff
changeset
|
57 #define PATHSIZE 1024 |
80a47e3b1bca
[gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1032
diff
changeset
|
58 |
728 | 59 GdkColor bgcolor; |
60 GdkColor fgcolor; | |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
61 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
62 static GtkWidget *imdialog = NULL; /*I only want ONE of these :) */ |
1 | 63 static GList *dialogwindows = NULL; |
2493
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
64 static GtkWidget *importdialog; |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
65 static struct gaim_connection *importgc; |
2344 | 66 static GtkWidget *icondlg; |
5050
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
67 static GtkWidget *alias_dialog = NULL; |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
68 static GtkWidget *rename_dialog = NULL; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
69 static GtkWidget *rename_bud_dialog = NULL; |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
70 |
3649 | 71 |
2743 | 72 struct confirm_del { |
73 GtkWidget *window; | |
74 GtkWidget *label; | |
75 GtkWidget *ok; | |
76 GtkWidget *cancel; | |
77 char name[1024]; | |
78 struct gaim_connection *gc; | |
79 }; | |
80 | |
1 | 81 struct create_away { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
82 GtkWidget *window; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
83 GtkWidget *entry; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
84 GtkWidget *text; |
832
0142b4c66394
[gaim-migrate @ 842]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
825
diff
changeset
|
85 struct away_message *mess; |
1 | 86 }; |
87 | |
88 struct warning { | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
89 GtkWidget *window; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
90 GtkWidget *anon; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
91 char *who; |
976
2586b2a3725e
[gaim-migrate @ 986]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
967
diff
changeset
|
92 struct gaim_connection *gc; |
1 | 93 }; |
94 | |
95 struct addbuddy { | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
96 GtkWidget *window; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
97 GtkWidget *combo; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
98 GtkWidget *entry; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
99 GtkWidget *entry_for_alias; |
2527 | 100 GtkWidget *account; |
1072
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
101 struct gaim_connection *gc; |
1 | 102 }; |
103 | |
104 struct addperm { | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
105 GtkWidget *window; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
106 GtkWidget *entry; |
1072
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
107 struct gaim_connection *gc; |
1144
b1454d019277
[gaim-migrate @ 1154]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1141
diff
changeset
|
108 gboolean permit; |
1 | 109 }; |
110 | |
111 struct findbyemail { | |
112 GtkWidget *window; | |
113 GtkWidget *emailentry; | |
1535
1e2cc8c8bf3c
[gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
114 struct gaim_connection *gc; |
1 | 115 }; |
116 | |
117 struct findbyinfo { | |
2393
a7ecfd3f7714
[gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2382
diff
changeset
|
118 struct gaim_connection *gc; |
1 | 119 GtkWidget *window; |
120 GtkWidget *firstentry; | |
121 GtkWidget *middleentry; | |
122 GtkWidget *lastentry; | |
123 GtkWidget *maidenentry; | |
124 GtkWidget *cityentry; | |
125 GtkWidget *stateentry; | |
126 GtkWidget *countryentry; | |
127 }; | |
128 | |
129 struct info_dlg { | |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
130 struct gaim_connection *gc; |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
131 char *who; |
1 | 132 GtkWidget *window; |
133 GtkWidget *text; | |
134 }; | |
3197 | 135 |
136 struct getuserinfo { | |
137 GtkWidget *window; | |
138 GtkWidget *entry; | |
139 GtkWidget *account; | |
140 struct gaim_connection *gc; | |
141 }; | |
142 | |
5050
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
143 struct alias_dialog_info |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
144 { |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
145 GtkWidget *window; |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
146 GtkWidget *name_entry; |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
147 GtkWidget *alias_entry; |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
148 struct buddy *buddy; |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
149 }; |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
150 |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
151 static GSList *info_dlgs = NULL; |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
152 |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
153 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
|
154 { |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
155 GSList *i = info_dlgs; |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
156 while (i) { |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
157 struct info_dlg *d = i->data; |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
158 i = i->next; |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
159 if (d->gc != gc) |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
160 continue; |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
161 if (d->who == NULL) |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
162 continue; |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
163 if (!who) |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
164 continue; |
4793 | 165 if (!gaim_utf8_strcasecmp(normalize(who), d->who)) |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
166 return d; |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
167 } |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
168 return NULL; |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
169 } |
1 | 170 |
171 struct set_info_dlg { | |
172 GtkWidget *window; | |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
173 GtkWidget *menu; |
4491 | 174 struct gaim_account *account; |
1 | 175 GtkWidget *text; |
176 GtkWidget *save; | |
177 GtkWidget *cancel; | |
178 }; | |
179 | |
2344 | 180 struct set_icon_dlg { |
181 GtkWidget *window; | |
4491 | 182 struct gaim_account *account; |
2344 | 183 GtkWidget *ok; |
184 GtkWidget *cancel; | |
185 GtkWidget *entry; | |
186 }; | |
187 | |
1 | 188 struct set_dir_dlg { |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
189 struct gaim_connection *gc; |
1 | 190 GtkWidget *window; |
191 GtkWidget *first; | |
192 GtkWidget *middle; | |
193 GtkWidget *last; | |
194 GtkWidget *maiden; | |
195 GtkWidget *city; | |
196 GtkWidget *state; | |
197 GtkWidget *country; | |
198 GtkWidget *web; | |
199 GtkWidget *cancel; | |
200 GtkWidget *save; | |
201 }; | |
202 | |
203 struct linkdlg { | |
204 GtkWidget *ok; | |
205 GtkWidget *cancel; | |
206 GtkWidget *window; | |
207 GtkWidget *url; | |
208 GtkWidget *text; | |
209 GtkWidget *toggle; | |
210 GtkWidget *entry; | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
211 struct gaim_conversation *c; |
1 | 212 }; |
213 | |
146 | 214 struct passwddlg { |
215 GtkWidget *window; | |
216 GtkWidget *ok; | |
217 GtkWidget *cancel; | |
218 GtkWidget *original; | |
219 GtkWidget *new1; | |
220 GtkWidget *new2; | |
978
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
221 struct gaim_connection *gc; |
146 | 222 }; |
1 | 223 |
2621
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
224 struct view_log { |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
225 long offset; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
226 int options; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
227 char *name; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
228 GtkWidget *bbox; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
229 GtkWidget *window; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
230 GtkWidget *layout; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
231 }; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
232 |
4119 | 233 /* Wrapper to get all the text from a GtkTextView */ |
234 gchar* gtk_text_view_get_text(GtkTextView *text, gboolean include_hidden_chars) | |
235 { | |
236 GtkTextBuffer *buffer; | |
237 GtkTextIter start, end; | |
238 | |
239 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)); | |
240 gtk_text_buffer_get_start_iter(buffer, &start); | |
241 gtk_text_buffer_get_end_iter(buffer, &end); | |
242 | |
243 return gtk_text_buffer_get_text(buffer, &start, &end, include_hidden_chars); | |
244 } | |
245 | |
1 | 246 /*------------------------------------------------------------------------*/ |
247 /* Destroys */ | |
248 /*------------------------------------------------------------------------*/ | |
249 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
250 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
|
251 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
252 struct gaim_gtk_conversation *gtkconv; |
605 | 253 gchar *object_data; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
254 |
4635 | 255 object_data = g_object_get_data(G_OBJECT(w), "dialog_type"); |
605 | 256 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
257 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
258 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
259 if (GTK_IS_COLOR_SELECTION_DIALOG(w)) { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
260 if (w == gtkconv->dialogs.fg_color) { |
4635 | 261 gtk_toggle_button_set_active( |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
262 GTK_TOGGLE_BUTTON(gtkconv->toolbar.fgcolor), FALSE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
263 gtkconv->dialogs.fg_color = NULL; |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
264 } else { |
4635 | 265 gtk_toggle_button_set_active( |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
266 GTK_TOGGLE_BUTTON(gtkconv->toolbar.bgcolor), FALSE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
267 gtkconv->dialogs.bg_color = NULL; |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
268 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
269 } else if (GTK_IS_FONT_SELECTION_DIALOG(w)) { |
4635 | 270 gtk_toggle_button_set_active( |
4685 | 271 GTK_TOGGLE_BUTTON(gtkconv->toolbar.font), FALSE); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
272 gtkconv->dialogs.font = NULL; |
4793 | 273 } else if (!g_ascii_strcasecmp(object_data, "smiley dialog")) { |
4635 | 274 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.smiley), |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
275 FALSE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
276 gtkconv->dialogs.smiley = NULL; |
4793 | 277 } else if (!g_ascii_strcasecmp(object_data, "log dialog")) { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
278 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
|
279 FALSE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
280 gtkconv->dialogs.log = NULL; |
608 | 281 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
282 |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
283 dialogwindows = g_list_remove(dialogwindows, w); |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
284 gtk_widget_destroy(w); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
285 |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
286 return FALSE; |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
287 } |
1 | 288 |
289 static void destroy_dialog(GtkWidget *w, GtkWidget *w2) | |
290 { | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
291 GtkWidget *dest; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
292 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
293 if (!GTK_IS_WIDGET(w2)) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
294 dest = w; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
295 else |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
296 dest = w2; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
297 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
298 if (dest == imdialog) |
1 | 299 imdialog = NULL; |
5050
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
300 else if (dest == importdialog) { |
1 | 301 importdialog = NULL; |
2493
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
302 importgc = NULL; |
1b7a1133962d
[gaim-migrate @ 2506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2472
diff
changeset
|
303 } |
5050
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
304 else if (dest == icondlg) |
2344 | 305 icondlg = NULL; |
5050
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
306 else if (dest == rename_dialog) |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
307 rename_dialog = NULL; |
5050
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
308 else if (dest == rename_bud_dialog) |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
309 rename_bud_dialog = NULL; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
310 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
311 dialogwindows = g_list_remove(dialogwindows, dest); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
312 gtk_widget_destroy(dest); |
1 | 313 } |
314 | |
315 | |
316 void destroy_all_dialogs() | |
317 { | |
2621
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
318 while (dialogwindows) |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
319 destroy_dialog(NULL, dialogwindows->data); |
1 | 320 |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
321 if (awaymessage) |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
322 do_im_back(NULL, NULL); |
84 | 323 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
324 if (imdialog) { |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
325 destroy_dialog(NULL, imdialog); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
326 imdialog = NULL; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
327 } |
935
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
934
diff
changeset
|
328 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
329 if (importdialog) { |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
330 destroy_dialog(NULL, importdialog); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
331 importdialog = NULL; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
332 } |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
333 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
334 if (icondlg) { |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
335 destroy_dialog(NULL, icondlg); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
336 icondlg = NULL; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
337 } |
1 | 338 } |
339 | |
3757 | 340 static void do_warn(GtkWidget *widget, gint resp, struct warning *w) |
1 | 341 { |
3757 | 342 if (resp == GTK_RESPONSE_OK) |
343 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
|
344 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
345 destroy_dialog(NULL, w->window); |
1288
d8eaf65ca9c3
[gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1272
diff
changeset
|
346 g_free(w); |
d8eaf65ca9c3
[gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1272
diff
changeset
|
347 } |
1 | 348 |
976
2586b2a3725e
[gaim-migrate @ 986]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
967
diff
changeset
|
349 void show_warn_dialog(struct gaim_connection *gc, char *who) |
1 | 350 { |
3757 | 351 char *labeltext; |
352 GtkWidget *hbox, *vbox; | |
1 | 353 GtkWidget *label; |
5024 | 354 GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
355 struct gaim_conversation *c = gaim_find_conversation(who); |
441 | 356 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
357 struct warning *w = g_new0(struct warning, 1); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
358 w->who = who; |
1288
d8eaf65ca9c3
[gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1272
diff
changeset
|
359 w->gc = gc; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
360 |
3757 | 361 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); |
362 | |
5092 | 363 w->window = gtk_dialog_new_with_buttons(_("Warn User"), GTK_WINDOW(c->window), 0, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, _("_Warn"), GTK_RESPONSE_OK, NULL); |
4118 | 364 gtk_dialog_set_default_response (GTK_DIALOG(w->window), GTK_RESPONSE_OK); |
3757 | 365 g_signal_connect(G_OBJECT(w->window), "response", G_CALLBACK(do_warn), w); |
366 | |
367 gtk_container_set_border_width (GTK_CONTAINER(w->window), 6); | |
368 gtk_window_set_resizable(GTK_WINDOW(w->window), FALSE); | |
369 gtk_dialog_set_has_separator(GTK_DIALOG(w->window), FALSE); | |
370 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(w->window)->vbox), 12); | |
371 gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(w->window)->vbox), 6); | |
372 | |
373 hbox = gtk_hbox_new(FALSE, 12); | |
374 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(w->window)->vbox), hbox); | |
375 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
376 | |
377 vbox = gtk_vbox_new(FALSE, 0); | |
378 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
379 labeltext = g_strdup_printf(_("<span weight=\"bold\" size=\"larger\">Warn %s?</span>\n\n" | |
380 "This will increase %s's warning level and he or she will be subject to harsher rate limiting.\n"), who, who); | |
381 label = gtk_label_new(NULL); | |
382 gtk_label_set_markup(GTK_LABEL(label), labeltext); | |
383 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
384 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
385 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
386 g_free(labeltext); | |
387 | |
388 w->anon = gtk_check_button_new_with_mnemonic(_("Warn _anonymously?")); | |
389 gtk_box_pack_start(GTK_BOX(vbox), w->anon, FALSE, FALSE, 0); | |
390 | |
391 hbox = gtk_hbox_new(FALSE, 6); | |
392 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
393 img = gtk_image_new_from_stock(GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_MENU); | |
394 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
395 labeltext = _("<b>Anonymous warnings are less severe.</b>"); | |
396 /* labeltext = _("Anonymous warnings are less severe."); */ | |
397 label = gtk_label_new(NULL); | |
398 gtk_label_set_markup(GTK_LABEL(label), labeltext); | |
399 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
400 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
401 | |
1288
d8eaf65ca9c3
[gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1272
diff
changeset
|
402 dialogwindows = g_list_prepend(dialogwindows, w->window); |
3757 | 403 gtk_widget_show_all(w->window); |
1 | 404 } |
405 | |
3753 | 406 void do_remove_buddy(struct buddy *b) |
2743 | 407 { |
4918
553d96cb9b26
[gaim-migrate @ 5252]
Christian Hammond <chipx86@chipx86.com>
parents:
4916
diff
changeset
|
408 struct group *g; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
409 struct gaim_conversation *c; |
4918
553d96cb9b26
[gaim-migrate @ 5252]
Christian Hammond <chipx86@chipx86.com>
parents:
4916
diff
changeset
|
410 gchar *name; |
2743 | 411 |
412 if (!b) | |
413 return; | |
414 | |
4687 | 415 g = gaim_find_buddys_group(b); |
4918
553d96cb9b26
[gaim-migrate @ 5252]
Christian Hammond <chipx86@chipx86.com>
parents:
4916
diff
changeset
|
416 name = g_strdup(b->name); /* b->name is null after remove_buddy */ |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
417 |
4059 | 418 debug_printf(_("Removing '%s' from buddy list.\n"), b->name); |
4491 | 419 serv_remove_buddy(b->account->gc, name, g->name); |
4687 | 420 gaim_blist_remove_buddy(b); |
4349 | 421 gaim_blist_save(); |
2743 | 422 |
4397
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4372
diff
changeset
|
423 c = gaim_find_conversation(name); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
424 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
425 if (c != NULL) |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
426 gaim_conversation_update(c, GAIM_CONV_UPDATE_REMOVE); |
4397
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4372
diff
changeset
|
427 |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4372
diff
changeset
|
428 g_free(name); |
2743 | 429 } |
430 | |
4916 | 431 void do_remove_group(struct group *g) |
432 { | |
433 GaimBlistNode *b = ((GaimBlistNode*)g)->child; | |
434 while (b) { | |
435 struct buddy *bd = (struct buddy *)b; | |
4936 | 436 struct gaim_conversation *c = gaim_find_conversation(bd->name); |
4938 | 437 if(bd->account->gc) { |
438 serv_remove_buddy(bd->account->gc, bd->name, g->name); | |
439 gaim_blist_remove_buddy(bd); | |
440 | |
441 if (c != NULL) | |
442 gaim_conversation_update(c, GAIM_CONV_UPDATE_REMOVE); | |
443 } | |
4916 | 444 b = b->next; |
445 } | |
446 gaim_blist_remove_group(g); | |
447 gaim_blist_save(); | |
448 } | |
449 | |
2743 | 450 void show_confirm_del(struct gaim_connection *gc, gchar *name) |
451 { | |
4687 | 452 struct buddy *bd = gaim_find_buddy(gc->account, name); |
3753 | 453 char *text; |
454 if (!bd) | |
455 return; | |
456 | |
4309 | 457 text = g_strdup_printf(_("You are about to remove %s from your buddy list. Do you want to continue?"), name); |
458 do_ask_dialog(_("Remove Buddy"), text, bd, _("Remove Buddy"), do_remove_buddy, _("Cancel"), NULL, NULL, FALSE); | |
3753 | 459 g_free(text); |
2743 | 460 } |
461 | |
4916 | 462 void show_confirm_del_group(struct group *g) |
463 { | |
4924 | 464 char *text = g_strdup_printf(_("You are about to remove the group %s and all its members from your buddy list. Do you want to continue?"), |
4916 | 465 g->name); |
4924 | 466 do_ask_dialog(_("Remove Group"), text, g, _("Remove Group"), do_remove_group, _("Cancel"), NULL, NULL, FALSE); |
4916 | 467 g_free(text); |
468 } | |
1 | 469 |
470 /*------------------------------------------------------------------------*/ | |
471 /* The dialog for getting an error */ | |
472 /*------------------------------------------------------------------------*/ | |
473 | |
3466 | 474 GtkWidget *do_error_dialog(const char *primary, const char *secondary, int type) |
1 | 475 { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
476 GtkWidget *d; |
1 | 477 GtkWidget *label; |
3374 | 478 GtkWidget *img = NULL; |
3427 | 479 GtkWidget *hbox; |
480 char labeltext[1024 * 2]; | |
5024 | 481 const char *name = NULL; |
3427 | 482 |
483 /* These are the GTK stock dialog icons with our little Gaim logo on top. | |
484 * Inspired by the GIMP. */ | |
3374 | 485 switch (type){ |
486 case GAIM_LOGO: | |
5024 | 487 name = GAIM_STOCK_ICON_ONLINE; |
488 break; | |
489 case GAIM_INFO: | |
490 name = GAIM_STOCK_DIALOG_INFO; | |
3427 | 491 break; |
3516 | 492 case GAIM_WARNING: |
5024 | 493 name = GAIM_STOCK_DIALOG_WARNING; |
494 break; | |
3516 | 495 case GAIM_ERROR: |
5024 | 496 name = GAIM_STOCK_DIALOG_ERROR; |
497 break; | |
3427 | 498 } |
5024 | 499 |
500 if (name) { | |
501 img = gtk_image_new_from_stock(name, GTK_ICON_SIZE_DIALOG); | |
3427 | 502 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); |
3374 | 503 } |
5024 | 504 |
4778 | 505 d = gtk_dialog_new_with_buttons("", NULL, 0, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); |
3427 | 506 g_signal_connect(d, "response", G_CALLBACK(gtk_widget_destroy), NULL); |
5024 | 507 |
3427 | 508 gtk_container_set_border_width (GTK_CONTAINER(d), 6); |
509 gtk_window_set_resizable(GTK_WINDOW(d), FALSE); | |
510 gtk_dialog_set_has_separator(GTK_DIALOG(d), FALSE); | |
511 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(d)->vbox), 12); | |
512 gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(d)->vbox), 6); | |
513 | |
514 hbox = gtk_hbox_new(FALSE, 12); | |
515 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(d)->vbox), hbox); | |
5024 | 516 if (img) { |
3427 | 517 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); |
518 } | |
519 | |
520 g_snprintf(labeltext, sizeof(labeltext), "<span weight=\"bold\" size=\"larger\">%s</span>\n\n%s", primary, secondary ? secondary : ""); | |
521 | |
522 label = gtk_label_new(NULL); | |
523 gtk_label_set_markup(GTK_LABEL(label), labeltext); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
524 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); |
3427 | 525 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); |
526 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
527 | |
5024 | 528 gtk_widget_show_all(d); |
529 | |
1817
b367beee6448
[gaim-migrate @ 1827]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
530 return d; |
1 | 531 } |
532 | |
3816 | 533 static void do_im(GtkWidget *widget, int resp, struct getuserinfo *info) |
1 | 534 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
535 const char *who; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
536 struct gaim_conversation *conv; |
4491 | 537 struct gaim_account *account; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
538 |
3802 | 539 if (resp == GTK_RESPONSE_OK) { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
540 who = gtk_entry_get_text(GTK_ENTRY(info->entry)); |
4476
62c1e5e656d0
[gaim-migrate @ 4751]
Christian Hammond <chipx86@chipx86.com>
parents:
4472
diff
changeset
|
541 |
4613 | 542 if (!who || !*who) { |
543 /* this shouldn't ever happen */ | |
3802 | 544 return; |
545 } | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
546 |
4491 | 547 account = (info->gc ? info->gc->account : NULL); |
4476
62c1e5e656d0
[gaim-migrate @ 4751]
Christian Hammond <chipx86@chipx86.com>
parents:
4472
diff
changeset
|
548 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
549 conv = gaim_find_conversation(who); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
550 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
551 if (conv == NULL) |
4491 | 552 conv = gaim_conversation_new(GAIM_CONV_IM, account, who); |
4476
62c1e5e656d0
[gaim-migrate @ 4751]
Christian Hammond <chipx86@chipx86.com>
parents:
4472
diff
changeset
|
553 else { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
554 gaim_window_raise(gaim_conversation_get_window(conv)); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
555 |
4491 | 556 if (account) |
557 gaim_conversation_set_account(conv, account); | |
4476
62c1e5e656d0
[gaim-migrate @ 4751]
Christian Hammond <chipx86@chipx86.com>
parents:
4472
diff
changeset
|
558 } |
1 | 559 } |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
560 |
3816 | 561 destroy_dialog(NULL, imdialog); |
562 imdialog = NULL; | |
4138 | 563 g_free(info); |
1 | 564 } |
565 | |
3802 | 566 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
|
567 { |
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
934
diff
changeset
|
568 char *who; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
569 |
3802 | 570 if (resp == GTK_RESPONSE_OK) { |
571 who = g_strdup(normalize(gtk_entry_get_text(GTK_ENTRY(info->entry)))); | |
572 | |
4793 | 573 if (!g_ascii_strcasecmp(who, "")) { |
3802 | 574 g_free(who); |
575 return; | |
576 } | |
577 | |
578 /* what do we want to do about this case? */ | |
579 if (info->gc) | |
580 serv_get_info(info->gc, who); | |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
581 g_free(who); |
935
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
934
diff
changeset
|
582 } |
3802 | 583 gtk_widget_destroy(GTK_WIDGET(widget)); |
4138 | 584 g_free(info); |
935
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
934
diff
changeset
|
585 } |
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
934
diff
changeset
|
586 |
1 | 587 void show_ee_dialog(int ee) |
588 { | |
3767 | 589 GtkWidget *window; |
590 GtkWidget *hbox; | |
1 | 591 GtkWidget *label; |
4695
4bdd9a5fd026
[gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
592 struct gaim_gtk_buddy_list *gtkblist; |
5024 | 593 GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_COOL, GTK_ICON_SIZE_DIALOG); |
4695
4bdd9a5fd026
[gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
594 |
4bdd9a5fd026
[gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
595 gtkblist = GAIM_GTK_BLIST(gaim_get_blist()); |
4bdd9a5fd026
[gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
596 |
3767 | 597 label = gtk_label_new(NULL); |
1 | 598 if (ee == 0) |
3767 | 599 gtk_label_set_markup(GTK_LABEL(label), |
600 "<span weight=\"bold\" size=\"large\" foreground=\"purple\">Amazing! Simply Amazing!</span>"); | |
1 | 601 else if (ee == 1) |
3767 | 602 gtk_label_set_markup(GTK_LABEL(label), |
603 "<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
|
604 else if (ee == 2) |
3767 | 605 gtk_label_set_markup(GTK_LABEL(label), |
606 "<span weight=\"bold\" size=\"large\" foreground=\"blue\">You should be me. I'm so cute!</span>"); | |
2472 | 607 else if (ee == 3) |
3767 | 608 gtk_label_set_markup(GTK_LABEL(label), |
609 "<span weight=\"bold\" size=\"large\" foreground=\"orange\">Now that's what I like!</span>"); | |
2993 | 610 else if (ee == 4) |
3767 | 611 gtk_label_set_markup(GTK_LABEL(label), |
612 "<span weight=\"bold\" size=\"large\" foreground=\"brown\">Ahh, and excellent choice!</span>"); | |
3043 | 613 else if (ee == 5) |
3767 | 614 gtk_label_set_markup(GTK_LABEL(label), |
615 "<span weight=\"bold\" size=\"large\" foreground=\"#009900\">Everytime you click my name, an angel gets its wings.</span>"); | |
3152 | 616 else if (ee == 6) |
3767 | 617 gtk_label_set_markup(GTK_LABEL(label), |
618 "<span weight=\"bold\" size=\"large\" foreground=\"red\">This sunflower seed taste like pizza.</span>"); | |
3508 | 619 else if (ee == 7) |
3767 | 620 gtk_label_set_markup(GTK_LABEL(label), |
621 "<span weight=\"bold\" size=\"large\" foreground=\"#6364B1\">Hey! I was in that tumbleweed!</span>"); | |
3508 | 622 else |
3767 | 623 gtk_label_set_markup(GTK_LABEL(label), |
624 "<span weight=\"bold\" size=\"large\" foreground=\"gray\">I'm not anything.</span>"); | |
625 | |
5092 | 626 window = gtk_dialog_new_with_buttons("", GTK_WINDOW(gtkblist->window), 0, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); |
3767 | 627 gtk_dialog_set_default_response (GTK_DIALOG(window), GTK_RESPONSE_OK); |
628 g_signal_connect(G_OBJECT(window), "response", G_CALLBACK(gtk_widget_destroy), NULL); | |
3152 | 629 |
3767 | 630 gtk_container_set_border_width (GTK_CONTAINER(window), 6); |
631 gtk_window_set_resizable(GTK_WINDOW(window), FALSE); | |
632 gtk_dialog_set_has_separator(GTK_DIALOG(window), FALSE); | |
633 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(window)->vbox), 12); | |
634 gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(window)->vbox), 6); | |
635 | |
636 hbox = gtk_hbox_new(FALSE, 12); | |
637 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(window)->vbox), hbox); | |
638 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
639 | |
640 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
641 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
642 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
4635 | 643 |
3767 | 644 gtk_widget_show_all(window); |
1 | 645 } |
646 | |
4635 | 647 void show_info_select_account(GObject *w, struct gaim_connection *gc) |
3816 | 648 { |
4635 | 649 struct getuserinfo *info = g_object_get_data(w, "getuserinfo"); |
3816 | 650 info->gc = gc; |
651 } | |
652 | |
4614 | 653 static void dialog_set_ok_sensitive(GtkWidget *entry, GtkWidget *dlg) { |
4613 | 654 const char *txt = gtk_entry_get_text(GTK_ENTRY(entry)); |
4614 | 655 gtk_dialog_set_response_sensitive(GTK_DIALOG(dlg), GTK_RESPONSE_OK, |
4613 | 656 (*txt != '\0')); |
657 } | |
658 | |
935
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
934
diff
changeset
|
659 void show_im_dialog() |
1 | 660 { |
3802 | 661 GtkWidget *hbox, *vbox; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
662 GtkWidget *label; |
3816 | 663 GtkWidget *table, *menu, *opt; |
664 GSList *g = connections; | |
665 struct gaim_connection *c; | |
4695
4bdd9a5fd026
[gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
666 struct gaim_gtk_buddy_list *gtkblist; |
3816 | 667 char buf[256]; |
5024 | 668 GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG); |
3816 | 669 struct getuserinfo *info = NULL; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
670 |
4695
4bdd9a5fd026
[gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
671 gtkblist = GAIM_GTK_BLIST(gaim_get_blist()); |
4bdd9a5fd026
[gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
672 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
673 if (!imdialog) { |
3816 | 674 info = g_new0(struct getuserinfo, 1); |
675 info->gc = connections->data; | |
5092 | 676 imdialog = gtk_dialog_new_with_buttons(_("New Message"), gtkblist ? GTK_WINDOW(gtkblist->window) : NULL, 0, |
3802 | 677 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); |
678 gtk_dialog_set_default_response (GTK_DIALOG(imdialog), GTK_RESPONSE_OK); | |
679 gtk_container_set_border_width (GTK_CONTAINER(imdialog), 6); | |
680 gtk_window_set_resizable(GTK_WINDOW(imdialog), FALSE); | |
681 gtk_dialog_set_has_separator(GTK_DIALOG(imdialog), FALSE); | |
682 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(imdialog)->vbox), 12); | |
683 gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(imdialog)->vbox), 6); | |
4613 | 684 gtk_dialog_set_response_sensitive(GTK_DIALOG(imdialog), GTK_RESPONSE_OK, FALSE); |
685 | |
3802 | 686 hbox = gtk_hbox_new(FALSE, 12); |
687 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(imdialog)->vbox), hbox); | |
688 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
689 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
690 | |
691 vbox = gtk_vbox_new(FALSE, 0); | |
692 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
4613 | 693 |
3802 | 694 label = gtk_label_new(_("Please enter the screenname of the person you would like to IM.\n")); |
3825 | 695 gtk_widget_set_size_request(GTK_WIDGET(label), 350, -1); |
3802 | 696 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); |
697 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
698 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
4613 | 699 |
3802 | 700 hbox = gtk_hbox_new(FALSE, 6); |
701 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
4613 | 702 |
3816 | 703 table = gtk_table_new(2, 2, FALSE); |
704 gtk_table_set_row_spacings(GTK_TABLE(table), 6); | |
705 gtk_table_set_col_spacings(GTK_TABLE(table), 6); | |
706 gtk_container_set_border_width(GTK_CONTAINER(table), 12); | |
707 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); | |
4613 | 708 |
3802 | 709 label = gtk_label_new(NULL); |
3816 | 710 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Screenname:")); |
3823 | 711 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); |
3816 | 712 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); |
713 | |
714 info->entry = gtk_entry_new(); | |
715 gtk_table_attach_defaults(GTK_TABLE(table), info->entry, 1, 2, 0, 1); | |
716 gtk_entry_set_activates_default (GTK_ENTRY(info->entry), TRUE); | |
717 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(info->entry)); | |
4613 | 718 g_signal_connect(G_OBJECT(info->entry), "changed", |
4614 | 719 G_CALLBACK(dialog_set_ok_sensitive), imdialog); |
3816 | 720 |
721 if (connections->next) { | |
722 | |
723 label = gtk_label_new(NULL); | |
724 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); | |
725 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Account:")); | |
726 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
4613 | 727 |
3816 | 728 info->account = gtk_option_menu_new(); |
729 gtk_table_attach_defaults(GTK_TABLE(table), info->account, 1, 2, 1, 2); | |
730 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(info->account)); | |
4613 | 731 |
3816 | 732 menu = gtk_menu_new(); |
4613 | 733 |
3816 | 734 while (g) { |
735 c = (struct gaim_connection *)g->data; | |
736 if (!c->prpl->send_im) { | |
737 g = g->next; | |
738 continue; | |
739 } | |
740 g_snprintf(buf, sizeof(buf), "%s (%s)", c->username, c->prpl->name); | |
741 opt = gtk_menu_item_new_with_label(buf); | |
4635 | 742 g_object_set_data(G_OBJECT(opt), "getuserinfo", info); |
4613 | 743 |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
744 g_signal_connect(GTK_OBJECT(opt), "activate", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
745 G_CALLBACK(show_info_select_account), c); |
4613 | 746 |
4635 | 747 gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt); |
3816 | 748 g = g->next; |
749 } | |
4613 | 750 |
3816 | 751 gtk_option_menu_set_menu(GTK_OPTION_MENU(info->account), menu); |
752 } | |
4613 | 753 |
3816 | 754 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
|
755 } |
4613 | 756 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
757 gtk_widget_show_all(imdialog); |
3816 | 758 if (info) |
759 gtk_widget_grab_focus(GTK_WIDGET(info->entry)); | |
3197 | 760 } |
761 | |
935
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
934
diff
changeset
|
762 void show_info_dialog() |
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
934
diff
changeset
|
763 { |
3802 | 764 GtkWidget *window, *hbox, *vbox; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
765 GtkWidget *label; |
5024 | 766 GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG); |
3802 | 767 GtkWidget *table, *menu, *opt; |
3197 | 768 GSList *g = connections; |
769 struct gaim_connection *c; | |
770 struct getuserinfo *info = g_new0(struct getuserinfo, 1); | |
4695
4bdd9a5fd026
[gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
771 struct gaim_gtk_buddy_list *gtkblist; |
3802 | 772 char buf[256]; |
773 | |
4695
4bdd9a5fd026
[gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
774 gtkblist = GAIM_GTK_BLIST(gaim_get_blist()); |
4bdd9a5fd026
[gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
775 |
3197 | 776 info->gc = connections->data; |
777 | |
5092 | 778 window = gtk_dialog_new_with_buttons(_("Get User Info"), gtkblist->window ? GTK_WINDOW(gtkblist->window) : NULL, 0, |
3802 | 779 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); |
780 gtk_dialog_set_default_response (GTK_DIALOG(window), GTK_RESPONSE_OK); | |
781 gtk_container_set_border_width (GTK_CONTAINER(window), 6); | |
782 gtk_window_set_resizable(GTK_WINDOW(window), FALSE); | |
783 gtk_dialog_set_has_separator(GTK_DIALOG(window), FALSE); | |
784 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(window)->vbox), 12); | |
785 gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(window)->vbox), 6); | |
4614 | 786 |
3802 | 787 hbox = gtk_hbox_new(FALSE, 12); |
788 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(window)->vbox), hbox); | |
789 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
790 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
4614 | 791 gtk_dialog_set_response_sensitive(GTK_DIALOG(window), GTK_RESPONSE_OK, |
792 FALSE); | |
793 | |
3802 | 794 vbox = gtk_vbox_new(FALSE, 0); |
795 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
796 | |
797 label = gtk_label_new(_("Please enter the screenname of the person whose info you would like to view.\n")); | |
798 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
799 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
800 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
801 | |
3197 | 802 table = gtk_table_new(2, 2, FALSE); |
3802 | 803 gtk_table_set_row_spacings(GTK_TABLE(table), 6); |
804 gtk_table_set_col_spacings(GTK_TABLE(table), 6); | |
805 gtk_container_set_border_width(GTK_CONTAINER(table), 12); | |
806 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); | |
807 | |
808 label = gtk_label_new(NULL); | |
809 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Screenname:")); | |
3822 | 810 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); |
3197 | 811 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); |
812 | |
813 info->entry = gtk_entry_new(); | |
814 gtk_table_attach_defaults(GTK_TABLE(table), info->entry, 1, 2, 0, 1); | |
3802 | 815 gtk_entry_set_activates_default (GTK_ENTRY(info->entry), TRUE); |
816 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(info->entry)); | |
4614 | 817 |
818 g_signal_connect(G_OBJECT(info->entry), "changed", | |
819 G_CALLBACK(dialog_set_ok_sensitive), window); | |
3802 | 820 |
3197 | 821 if (connections->next) { |
822 | |
3802 | 823 label = gtk_label_new(NULL); |
3197 | 824 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); |
3802 | 825 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Account:")); |
826 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
1225 | 827 |
3197 | 828 info->account = gtk_option_menu_new(); |
829 gtk_table_attach_defaults(GTK_TABLE(table), info->account, 1, 2, 1, 2); | |
3802 | 830 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(info->account)); |
831 | |
3197 | 832 menu = gtk_menu_new(); |
833 | |
834 while (g) { | |
835 c = (struct gaim_connection *)g->data; | |
3802 | 836 if (!c->prpl->get_info) { |
837 g = g->next; | |
838 continue; | |
839 } | |
3572 | 840 g_snprintf(buf, sizeof(buf), "%s (%s)", c->username, c->prpl->name); |
3197 | 841 opt = gtk_menu_item_new_with_label(buf); |
4635 | 842 g_object_set_data(G_OBJECT(opt), "getuserinfo", info); |
3197 | 843 |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
844 g_signal_connect(GTK_OBJECT(opt), "activate", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
845 G_CALLBACK(show_info_select_account), c); |
3197 | 846 |
4635 | 847 gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt); |
3197 | 848 g = g->next; |
849 } | |
3802 | 850 |
3197 | 851 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
|
852 } |
3197 | 853 |
3802 | 854 g_signal_connect(G_OBJECT(window), "response", G_CALLBACK(do_info), info); |
855 | |
856 | |
857 gtk_widget_show_all(window); | |
858 if (info->entry) | |
859 gtk_widget_grab_focus(GTK_WIDGET(info->entry)); | |
935
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
934
diff
changeset
|
860 } |
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
934
diff
changeset
|
861 |
1 | 862 |
863 /*------------------------------------------------------------------------*/ | |
864 /* The dialog for adding buddies */ | |
865 /*------------------------------------------------------------------------*/ | |
866 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
867 extern void add_callback(GtkWidget *, struct gaim_conversation *); |
654
ea811c6dd3e0
[gaim-migrate @ 664]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
653
diff
changeset
|
868 |
4180 | 869 void do_add_buddy(GtkWidget *w, int resp, struct addbuddy *a) |
1 | 870 { |
3466 | 871 const char *grp, *who, *whoalias; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
872 struct gaim_conversation *c; |
4687 | 873 struct buddy *b; |
874 struct group *g; | |
4769 | 875 void *icon_data; |
876 void *icon_data2; | |
877 int icon_len; | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
878 |
4180 | 879 if (resp == GTK_RESPONSE_OK) { |
880 | |
881 who = gtk_entry_get_text(GTK_ENTRY(a->entry)); | |
882 grp = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(a->combo)->entry)); | |
883 whoalias = gtk_entry_get_text(GTK_ENTRY(a->entry_for_alias)); | |
884 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
885 c = gaim_find_conversation(who); |
4775 | 886 if (!(g = gaim_find_group(grp))) { |
4687 | 887 g = gaim_group_new(grp); |
4775 | 888 gaim_blist_add_group(g, NULL); |
889 } | |
4687 | 890 b = gaim_buddy_new(a->gc->account, who, whoalias); |
891 gaim_blist_add_buddy(b, g, NULL); | |
4180 | 892 serv_add_buddy(a->gc, who); |
893 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
894 if (c != NULL) |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
895 gaim_conversation_update(c, GAIM_CONV_UPDATE_ADD); |
4180 | 896 |
4769 | 897 icon_data = get_icon_data(a->gc, normalize(who), &icon_len); |
898 | |
899 if(icon_data) { | |
900 icon_data2 = g_memdup(icon_data, icon_len); | |
901 set_icon_data(a->gc, who, icon_data2, icon_len); | |
902 g_free(icon_data2); | |
903 } | |
904 | |
4349 | 905 gaim_blist_save(); |
654
ea811c6dd3e0
[gaim-migrate @ 664]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
653
diff
changeset
|
906 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
907 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
908 destroy_dialog(NULL, a->window); |
1 | 909 } |
910 | |
3819 | 911 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
|
912 { |
3466 | 913 const char *grp; |
4687 | 914 struct group *g; |
4349 | 915 |
3819 | 916 if (resp == GTK_RESPONSE_OK) { |
917 grp = gtk_entry_get_text(GTK_ENTRY(a->entry)); | |
918 | |
919 if (!a->gc) | |
920 a->gc = connections->data; | |
921 | |
4687 | 922 g = gaim_group_new(grp); |
923 gaim_blist_add_group (g, NULL); | |
4349 | 924 gaim_blist_save(); |
3819 | 925 } |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
926 |
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
927 destroy_dialog(NULL, a->window); |
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
928 } |
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
929 |
1 | 930 |
4978 | 931 static GList *groups_tree() |
1 | 932 { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
933 GList *tmp = NULL; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
934 char *tmp2; |
1 | 935 struct group *g; |
4785 | 936 |
937 GaimBlistNode *gnode = gaim_get_blist()->root; | |
938 | |
939 if (!gnode) { | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
940 tmp2 = g_strdup(_("Buddies")); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
941 tmp = g_list_append(tmp, tmp2); |
1 | 942 } else { |
4785 | 943 while (gnode) { |
944 if(GAIM_BLIST_NODE_IS_GROUP(gnode)) { | |
945 g = (struct group *)gnode; | |
946 tmp2 = g->name; | |
947 tmp = g_list_append(tmp, tmp2); | |
948 } | |
949 gnode = gnode->next; | |
1 | 950 } |
951 } | |
952 return tmp; | |
953 } | |
954 | |
825
9108277c95e9
[gaim-migrate @ 835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
804
diff
changeset
|
955 static void free_dialog(GtkWidget *w, struct addbuddy *a) |
9108277c95e9
[gaim-migrate @ 835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
804
diff
changeset
|
956 { |
9108277c95e9
[gaim-migrate @ 835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
804
diff
changeset
|
957 g_free(a); |
9108277c95e9
[gaim-migrate @ 835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
804
diff
changeset
|
958 } |
9108277c95e9
[gaim-migrate @ 835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
804
diff
changeset
|
959 |
1 | 960 |
1072
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
961 void show_add_group(struct gaim_connection *gc) |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
962 { |
3819 | 963 |
964 GtkWidget *hbox, *vbox; | |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
965 GtkWidget *label; |
4695
4bdd9a5fd026
[gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
966 struct gaim_gtk_buddy_list *gtkblist; |
5024 | 967 GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
968 struct addbuddy *a = g_new0(struct addbuddy, 1); |
4138 | 969 |
4695
4bdd9a5fd026
[gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
970 gtkblist = GAIM_GTK_BLIST(gaim_get_blist()); |
4bdd9a5fd026
[gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
971 |
1072
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
972 a->gc = gc; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
973 |
5092 | 974 a->window = gtk_dialog_new_with_buttons(_("Add Group"), GTK_WINDOW(gtkblist->window), 0, |
3819 | 975 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_ADD, GTK_RESPONSE_OK, NULL); |
976 gtk_dialog_set_default_response (GTK_DIALOG(a->window), GTK_RESPONSE_OK); | |
977 gtk_container_set_border_width (GTK_CONTAINER(a->window), 6); | |
978 gtk_window_set_resizable(GTK_WINDOW(a->window), FALSE); | |
979 gtk_dialog_set_has_separator(GTK_DIALOG(a->window), FALSE); | |
980 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(a->window)->vbox), 12); | |
981 gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(a->window)->vbox), 6); | |
982 | |
983 hbox = gtk_hbox_new(FALSE, 12); | |
984 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(a->window)->vbox), hbox); | |
985 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
986 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
987 | |
988 vbox = gtk_vbox_new(FALSE, 0); | |
989 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
990 | |
991 label = gtk_label_new(_("Please enter the name of the group to be added.\n")); | |
992 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
993 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
994 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
995 | |
996 hbox = gtk_hbox_new(FALSE, 6); | |
997 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
998 | |
999 label = gtk_label_new(NULL); | |
1000 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Group:")); | |
1001 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
1002 | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1003 a->entry = gtk_entry_new(); |
3819 | 1004 gtk_entry_set_activates_default (GTK_ENTRY(a->entry), TRUE); |
1005 gtk_box_pack_start(GTK_BOX(hbox), a->entry, FALSE, FALSE, 0); | |
1006 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(a->entry)); | |
1007 | |
1008 g_signal_connect(G_OBJECT(a->window), "response", G_CALLBACK(do_add_group), a); | |
1009 | |
1010 gtk_widget_show_all(a->window); | |
1011 gtk_widget_grab_focus(GTK_WIDGET(a->entry)); | |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
1012 } |
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
1013 |
4635 | 1014 static void addbuddy_select_account(GObject *w, struct gaim_connection *gc) |
2527 | 1015 { |
4635 | 1016 struct addbuddy *b = g_object_get_data(w, "addbuddy"); |
2527 | 1017 |
2561 | 1018 /* Save our account */ |
2527 | 1019 b->gc = gc; |
1020 } | |
1021 | |
1022 static void create_online_user_names(struct addbuddy *b) | |
1023 { | |
1024 char buf[2048]; /* Never hurts to be safe ;-) */ | |
1025 GSList *g = connections; | |
1026 struct gaim_connection *c; | |
1027 GtkWidget *menu, *opt; | |
1028 int count = 0; | |
1029 int place = 0; | |
1030 | |
1031 menu = gtk_menu_new(); | |
1032 | |
1033 while (g) { | |
1034 c = (struct gaim_connection *)g->data; | |
1035 g_snprintf(buf, sizeof(buf), "%s (%s)", | |
3572 | 1036 c->username, c->prpl->name); |
2527 | 1037 opt = gtk_menu_item_new_with_label(buf); |
4635 | 1038 g_object_set_data(G_OBJECT(opt), "addbuddy", b); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
1039 g_signal_connect(GTK_OBJECT(opt), "activate", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
1040 G_CALLBACK(addbuddy_select_account), |
2527 | 1041 c); |
1042 gtk_widget_show(opt); | |
4635 | 1043 gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt); |
2527 | 1044 |
1045 /* Now check to see if it's our current menu */ | |
1046 if (c == b->gc) { | |
1047 place = count; | |
1048 gtk_menu_item_activate(GTK_MENU_ITEM(opt)); | |
1049 gtk_option_menu_set_history(GTK_OPTION_MENU(b->account), count); | |
1050 | |
1051 /* Do the cha cha cha */ | |
1052 } | |
1053 | |
1054 count++; | |
1055 | |
1056 g = g->next; | |
1057 } | |
1058 | |
1059 gtk_option_menu_remove_menu(GTK_OPTION_MENU(b->account)); | |
1060 gtk_option_menu_set_menu(GTK_OPTION_MENU(b->account), menu); | |
1061 gtk_option_menu_set_history(GTK_OPTION_MENU(b->account), place); | |
1062 | |
1063 gtk_widget_show(b->account); | |
1064 gtk_widget_show(b->account->parent); | |
1065 | |
1066 } | |
1067 | |
2582
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2572
diff
changeset
|
1068 void show_add_buddy(struct gaim_connection *gc, char *buddy, char *group, char *alias) |
1 | 1069 { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1070 GtkWidget *table; |
1 | 1071 GtkWidget *label; |
4180 | 1072 GtkWidget *hbox; |
1073 GtkWidget *vbox; | |
4695
4bdd9a5fd026
[gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
1074 struct gaim_gtk_buddy_list *gtkblist; |
5024 | 1075 GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1076 struct addbuddy *a = g_new0(struct addbuddy, 1); |
2598
b2800bca74fe
[gaim-migrate @ 2611]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2582
diff
changeset
|
1077 a->gc = gc ? gc : connections->data; |
1210 | 1078 |
4695
4bdd9a5fd026
[gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
1079 gtkblist = GAIM_GTK_BLIST(gaim_get_blist()); |
4bdd9a5fd026
[gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
1080 |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
1081 GAIM_DIALOG(a->window); |
5092 | 1082 a->window = gtk_dialog_new_with_buttons(_("Add Buddy"), gtkblist->window ? GTK_WINDOW(gtkblist->window) : NULL, 0, |
4180 | 1083 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_ADD, GTK_RESPONSE_OK, NULL); |
1084 | |
1085 gtk_dialog_set_default_response(GTK_DIALOG(a->window), GTK_RESPONSE_OK); | |
1086 gtk_container_set_border_width(GTK_CONTAINER(a->window), 6); | |
1087 gtk_window_set_resizable(GTK_WINDOW(a->window), FALSE); | |
1088 gtk_dialog_set_has_separator(GTK_DIALOG(a->window), FALSE); | |
1089 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(a->window)->vbox), 12); | |
1090 gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(a->window)->vbox), 6); | |
4074 | 1091 gtk_window_set_role(GTK_WINDOW(a->window), "add_buddy"); |
4180 | 1092 |
1093 hbox = gtk_hbox_new(FALSE, 12); | |
1094 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(a->window)->vbox), hbox); | |
1095 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
1096 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
1097 | |
1098 vbox = gtk_vbox_new(FALSE, 0); | |
1099 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
1100 | |
4599 | 1101 label = gtk_label_new(_("Please enter the screen name of the person you would like to add to your buddy list. 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")); |
4180 | 1102 gtk_widget_set_size_request(GTK_WIDGET(label), 400, -1); |
1103 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
1104 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
1105 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
1106 | |
1107 hbox = gtk_hbox_new(FALSE, 6); | |
1108 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
1109 | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
1110 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
|
1111 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
|
1112 dialogwindows = g_list_prepend(dialogwindows, a->window); |
428372cc1e39
[gaim-migrate @ 1161]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1144
diff
changeset
|
1113 |
2529 | 1114 table = gtk_table_new(4, 2, FALSE); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1115 gtk_table_set_row_spacings(GTK_TABLE(table), 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1116 gtk_table_set_col_spacings(GTK_TABLE(table), 5); |
4180 | 1117 gtk_container_set_border_width(GTK_CONTAINER(table), 0); |
1118 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); | |
1119 | |
1120 label = gtk_label_new(_("Screen Name")); | |
1121 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1122 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
|
1123 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1124 a->entry = gtk_entry_new(); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1125 gtk_table_attach_defaults(GTK_TABLE(table), a->entry, 1, 2, 0, 1); |
3333 | 1126 gtk_widget_grab_focus(a->entry); |
4183 | 1127 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1128 if (buddy != NULL) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1129 gtk_entry_set_text(GTK_ENTRY(a->entry), buddy); |
4183 | 1130 |
1131 gtk_entry_set_activates_default (GTK_ENTRY(a->entry), TRUE); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1132 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1133 label = gtk_label_new(_("Alias")); |
4180 | 1134 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1135 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
|
1136 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1137 a->entry_for_alias = gtk_entry_new(); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1138 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
|
1139 if (alias != NULL) |
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2572
diff
changeset
|
1140 gtk_entry_set_text(GTK_ENTRY(a->entry_for_alias), alias); |
4183 | 1141 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
|
1142 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1143 label = gtk_label_new(_("Group")); |
4180 | 1144 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1145 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
|
1146 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1147 a->combo = gtk_combo_new(); |
4978 | 1148 gtk_combo_set_popdown_strings(GTK_COMBO(a->combo), groups_tree()); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1149 gtk_table_attach_defaults(GTK_TABLE(table), a->combo, 1, 2, 2, 3); |
1210 | 1150 |
2527 | 1151 /* Set up stuff for the account box */ |
1152 label = gtk_label_new(_("Add To")); | |
4180 | 1153 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
2527 | 1154 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 3, 4); |
1155 | |
1156 a->account = gtk_option_menu_new(); | |
1157 gtk_table_attach_defaults(GTK_TABLE(table), a->account, 1, 2, 3, 4); | |
1158 | |
1159 create_online_user_names(a); | |
1160 | |
1161 /* End of account box */ | |
1162 | |
4180 | 1163 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
|
1164 |
1210 | 1165 gtk_widget_show_all(a->window); |
4180 | 1166 |
2995 | 1167 if (group != NULL) |
1168 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(a->combo)->entry), group); | |
1 | 1169 } |
1170 | |
1171 | |
3367 | 1172 /*------------------------------------------------------------------------* |
1173 * Privacy Settings * | |
1174 *------------------------------------------------------------------------*/ | |
1175 static GtkWidget *deny_type = NULL; | |
1176 static GtkWidget *deny_conn_hbox = NULL; | |
1177 static GtkWidget *deny_opt_menu = NULL; | |
1178 static struct gaim_connection *current_deny_gc = NULL; | |
1179 static gboolean current_is_deny = FALSE; | |
1180 static GtkWidget *allow_list = NULL; | |
1181 static GtkWidget *block_list = NULL; | |
1182 | |
4177 | 1183 static GtkListStore *block_store = NULL; |
1184 static GtkListStore *allow_store = NULL; | |
1185 | |
3367 | 1186 static void set_deny_mode(GtkWidget *w, int data) |
1187 { | |
1188 if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) | |
1189 return; | |
1190 debug_printf("setting deny mode %d\n", data); | |
4491 | 1191 current_deny_gc->account->permdeny = data; |
3367 | 1192 serv_set_permit_deny(current_deny_gc); |
4349 | 1193 gaim_blist_save(); |
3367 | 1194 } |
1195 | |
4178 | 1196 static GtkWidget *deny_opt(char *label, int which, GtkWidget *set) |
3367 | 1197 { |
1198 GtkWidget *opt; | |
1199 | |
1200 if (!set) | |
1201 opt = gtk_radio_button_new_with_label(NULL, label); | |
1202 else | |
1203 opt = | |
4635 | 1204 gtk_radio_button_new_with_label(gtk_radio_button_get_group( |
1205 GTK_RADIO_BUTTON(set)), | |
3367 | 1206 label); |
4178 | 1207 |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
1208 g_signal_connect(GTK_OBJECT(opt), "toggled", G_CALLBACK(set_deny_mode), (void *)which); |
3367 | 1209 gtk_widget_show(opt); |
4491 | 1210 if (current_deny_gc->account->permdeny == which) |
4635 | 1211 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(opt), TRUE); |
3367 | 1212 |
1213 return opt; | |
1214 } | |
1215 | |
1216 static void des_deny_opt(GtkWidget *d, gpointer e) | |
1217 { | |
1218 gtk_widget_destroy(d); | |
1219 current_deny_gc = NULL; | |
1220 deny_conn_hbox = NULL; | |
1221 deny_type = NULL; | |
1222 deny_opt_menu = NULL; | |
1223 current_is_deny = FALSE; | |
1224 allow_list = NULL; | |
4177 | 1225 allow_store = NULL; |
1226 | |
3367 | 1227 block_list = NULL; |
4177 | 1228 block_store = NULL; |
3367 | 1229 } |
1230 | |
1231 static void set_deny_type() | |
1232 { | |
4635 | 1233 GSList *bg = gtk_radio_button_get_group(GTK_RADIO_BUTTON(deny_type)); |
3367 | 1234 |
4491 | 1235 switch (current_deny_gc->account->permdeny) { |
3786 | 1236 case 5: |
1237 bg = bg->next->next; | |
1238 break; | |
3367 | 1239 case 4: |
1240 break; | |
1241 case 3: | |
3786 | 1242 bg = bg->next->next->next; |
3367 | 1243 break; |
1244 case 2: | |
1245 bg = bg->next; | |
1246 break; | |
1247 case 1: | |
3786 | 1248 bg = bg->next->next->next->next; |
3367 | 1249 break; |
1250 } | |
1251 | |
4635 | 1252 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(bg->data), TRUE); |
3367 | 1253 } |
1254 | |
1255 void build_allow_list() | |
1256 { | |
1257 GSList *p; | |
4177 | 1258 GtkListStore *ls; |
1259 GtkTreeIter iter; | |
3367 | 1260 |
1261 if (!current_is_deny) | |
1262 return; | |
1263 | |
4491 | 1264 p = current_deny_gc->account->permit; |
3367 | 1265 |
4177 | 1266 gtk_list_store_clear(GTK_LIST_STORE(allow_store)); |
3367 | 1267 |
1268 while (p) { | |
4177 | 1269 ls = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(allow_list))); |
1270 | |
1271 gtk_list_store_append(ls, &iter); | |
1272 gtk_list_store_set(ls, &iter, 0, p->data, -1); | |
1273 | |
3367 | 1274 p = p->next; |
1275 } | |
1276 } | |
1277 | |
4177 | 1278 |
3367 | 1279 void build_block_list() |
1280 { | |
1281 GSList *d; | |
4177 | 1282 GtkListStore *ls; |
1283 GtkTreeIter iter; | |
3367 | 1284 |
1285 if (!current_is_deny) | |
1286 return; | |
1287 | |
4491 | 1288 d = current_deny_gc->account->deny; |
3367 | 1289 |
4177 | 1290 gtk_list_store_clear(GTK_LIST_STORE(block_store)); |
3367 | 1291 |
1292 while (d) { | |
4177 | 1293 ls = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(block_list))); |
1294 | |
1295 gtk_list_store_append(ls, &iter); | |
1296 gtk_list_store_set(ls, &iter, 0, d->data, -1); | |
1297 | |
3367 | 1298 d = d->next; |
1299 } | |
1300 } | |
1301 | |
1302 static void deny_gc_opt(GtkWidget *opt, struct gaim_connection *gc) | |
1303 { | |
1304 current_deny_gc = gc; | |
1305 set_deny_type(); | |
1306 build_allow_list(); | |
1307 build_block_list(); | |
1308 } | |
1309 | |
1310 static void build_deny_menu() | |
1311 { | |
1312 GtkWidget *menu; | |
1313 GtkWidget *opt; | |
1314 GSList *c = connections; | |
1315 struct gaim_connection *gc; | |
1316 int count = 0; | |
1317 gboolean found = FALSE; | |
1318 char buf[2048]; | |
1319 | |
1320 if (g_slist_length(connections) == 1) { | |
1321 gtk_widget_hide(deny_conn_hbox); | |
1322 return; | |
1323 } else | |
1324 gtk_widget_show(deny_conn_hbox); | |
1325 | |
1326 menu = gtk_menu_new(); | |
1327 | |
1328 while (c) { | |
1329 gc = (struct gaim_connection *)c->data; | |
1330 c = c->next; | |
1331 if (!gc->prpl->set_permit_deny) | |
1332 continue; | |
3572 | 1333 g_snprintf(buf, sizeof buf, "%s (%s)", gc->username, gc->prpl->name); |
3367 | 1334 opt = gtk_menu_item_new_with_label(buf); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
1335 g_signal_connect(GTK_OBJECT(opt), "activate", G_CALLBACK(deny_gc_opt), gc); |
3367 | 1336 gtk_widget_show(opt); |
4635 | 1337 gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt); |
3367 | 1338 if (gc == current_deny_gc) |
1339 found = TRUE; | |
1340 else if (!found) | |
1341 count++; | |
1342 } | |
1343 | |
1344 if (!found) { | |
1345 current_deny_gc = connections->data; | |
1346 count = 0; | |
1347 } | |
1348 | |
1349 gtk_option_menu_remove_menu(GTK_OPTION_MENU(deny_opt_menu)); | |
1350 gtk_option_menu_set_menu(GTK_OPTION_MENU(deny_opt_menu), menu); | |
1351 gtk_option_menu_set_history(GTK_OPTION_MENU(deny_opt_menu), count); | |
1352 | |
1353 gtk_widget_show(menu); | |
1354 gtk_widget_show(deny_opt_menu); | |
1355 } | |
1356 | |
1357 static void pref_deny_add(GtkWidget *button, gboolean permit) | |
1358 { | |
1359 show_add_perm(current_deny_gc, NULL, permit); | |
1360 } | |
1361 | |
4177 | 1362 |
1363 gchar *find_permdeny_by_name(GSList *l, char *who) { | |
1364 gchar *name; | |
1365 | |
1366 while (l) { | |
1367 name = (gchar *)l->data; | |
1368 if (!strcmp(name, who)) { | |
1369 return name; | |
1370 } | |
1371 | |
1372 l = l->next; | |
1373 } | |
1374 | |
1375 return NULL; | |
1376 } | |
1377 | |
3367 | 1378 static void pref_deny_rem(GtkWidget *button, gboolean permit) |
1379 { | |
4177 | 1380 gchar *who; |
1381 GtkTreeIter iter; | |
1382 GtkTreeModel *mod; | |
1383 GtkTreeSelection *sel; | |
1384 | |
1385 if (permit) { | |
1386 mod = gtk_tree_view_get_model(GTK_TREE_VIEW(allow_list)); | |
1387 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(allow_list)); | |
1388 } else { | |
1389 mod = gtk_tree_view_get_model(GTK_TREE_VIEW(block_list)); | |
1390 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(block_list)); | |
1391 } | |
1392 | |
1393 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) | |
1394 gtk_tree_model_get(GTK_TREE_MODEL(mod), &iter, 0, &who, -1); | |
1395 else { | |
1396 return; | |
1397 } | |
3367 | 1398 |
1399 if (permit && !allow_list) | |
1400 return; | |
4177 | 1401 |
3367 | 1402 if (!permit && !block_list) |
1403 return; | |
1404 | |
1405 if (permit) { | |
4491 | 1406 char *name = find_permdeny_by_name(current_deny_gc->account->permit, who); |
4177 | 1407 |
1408 if (name) { | |
4491 | 1409 gaim_privacy_permit_remove(current_deny_gc->account, name); |
4308 | 1410 serv_rem_permit(current_deny_gc, who); |
4177 | 1411 build_allow_list(); |
1412 } | |
3367 | 1413 } else { |
4491 | 1414 char *name = find_permdeny_by_name(current_deny_gc->account->deny, who); |
4177 | 1415 |
1416 if (name) { | |
4491 | 1417 gaim_privacy_deny_remove(current_deny_gc->account, name); |
4177 | 1418 serv_rem_deny(current_deny_gc, who); |
1419 build_block_list(); | |
1420 } | |
3367 | 1421 } |
1422 | |
4349 | 1423 gaim_blist_save(); |
3367 | 1424 } |
1425 | |
1426 GtkWidget *privacy_win; | |
1427 void update_privacy_connections() { /* This is a slightly better name */ | |
1428 gboolean needdeny = FALSE; | |
1429 GSList *c = connections; | |
1430 struct gaim_connection *gc = NULL; | |
1431 | |
1432 if (!privacy_win) | |
1433 return; | |
1434 | |
1435 while (c) { | |
1436 gc = c->data; | |
1437 if (gc->prpl->set_permit_deny) | |
1438 break; | |
1439 gc = NULL; | |
1440 c = c->next; | |
1441 } | |
1442 needdeny = (gc != NULL); | |
1443 | |
1444 | |
1445 if (needdeny) { | |
1446 gtk_widget_set_sensitive(privacy_win, TRUE); | |
1447 build_deny_menu(); | |
1448 build_allow_list(); | |
1449 build_block_list(); | |
1450 } else { | |
1451 gtk_widget_set_sensitive(privacy_win, FALSE); | |
1452 } | |
1453 } | |
1454 static void destroy_privacy() { | |
1455 current_deny_gc = NULL; | |
1456 privacy_win = NULL; | |
1457 } | |
1458 | |
4177 | 1459 void show_privacy_options() { |
1460 GtkWidget *pwin; | |
1461 GtkWidget *box; | |
1462 GtkWidget *hbox; | |
1463 GtkWidget *label; | |
1464 GtkWidget *sw; | |
1465 GtkWidget *bbox; | |
1466 GtkWidget *button; | |
1467 GtkWidget *sep; | |
1468 GtkWidget *close_button; | |
1469 GtkSizeGroup *sg1 = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); | |
1470 GtkSizeGroup *sg2 = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); | |
1471 GtkCellRenderer *rend; | |
1472 GtkTreeViewColumn *col; | |
4178 | 1473 GtkWidget *table; |
4177 | 1474 |
1475 current_deny_gc = connections->data; /* this is safe because this screen will only be | |
1476 available when there are connections */ | |
1477 current_is_deny = TRUE; | |
1478 | |
1479 privacy_win = pwin = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
4635 | 1480 gtk_window_set_resizable(GTK_WINDOW(pwin), FALSE); |
4177 | 1481 gtk_window_set_role(GTK_WINDOW(pwin), "privacy"); |
4703 | 1482 gtk_window_set_title(GTK_WINDOW(pwin), _("Privacy")); |
4177 | 1483 g_signal_connect(GTK_OBJECT(pwin), "destroy", G_CALLBACK(destroy_privacy), NULL); |
1484 gtk_widget_realize(pwin); | |
1485 | |
4637 | 1486 gtk_widget_set_size_request(pwin, -1, 400); |
4177 | 1487 |
1488 box = gtk_vbox_new(FALSE, 5); | |
1489 gtk_container_set_border_width(GTK_CONTAINER(box), 5); | |
1490 gtk_container_add(GTK_CONTAINER(pwin), box); | |
1491 gtk_widget_show(box); | |
1492 | |
1493 label = gtk_label_new(_("Changes to privacy settings take effect immediately.")); | |
1494 gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 5); | |
1495 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
1496 gtk_widget_show(label); | |
1497 | |
1498 deny_conn_hbox = gtk_hbox_new(FALSE, 5); | |
1499 gtk_box_pack_start(GTK_BOX(box), deny_conn_hbox, FALSE, FALSE, 0); | |
1500 gtk_widget_show(deny_conn_hbox); | |
1501 | |
1502 label = gtk_label_new(_("Set privacy for:")); | |
1503 gtk_box_pack_start(GTK_BOX(deny_conn_hbox), label, FALSE, FALSE, 5); | |
1504 gtk_widget_show(label); | |
1505 | |
1506 deny_opt_menu = gtk_option_menu_new(); | |
1507 gtk_box_pack_start(GTK_BOX(deny_conn_hbox), deny_opt_menu, FALSE, FALSE, 5); | |
1508 g_signal_connect(GTK_OBJECT(deny_opt_menu), "destroy", G_CALLBACK(des_deny_opt), NULL); | |
1509 gtk_widget_show(deny_opt_menu); | |
1510 | |
1511 build_deny_menu(); | |
1512 | |
4178 | 1513 table = gtk_table_new(5, 2, FALSE); |
1514 gtk_box_pack_start(GTK_BOX(box), table, TRUE, TRUE, 0); | |
1515 gtk_table_set_row_spacings(GTK_TABLE(table), 7); | |
1516 gtk_table_set_col_spacings(GTK_TABLE(table), 5); | |
1517 gtk_widget_show(table); | |
1518 | |
1519 deny_type = deny_opt(_("Allow all users to contact me"), 1, NULL); | |
4177 | 1520 gtk_size_group_add_widget(sg1, deny_type); |
4178 | 1521 gtk_table_attach(GTK_TABLE(table), deny_type, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); |
1522 | |
1523 deny_type = deny_opt(_("Allow only users on my buddy list"), 5, deny_type); | |
4177 | 1524 gtk_size_group_add_widget(sg1, deny_type); |
4178 | 1525 gtk_table_attach(GTK_TABLE(table), deny_type, 0, 1, 1, 2, GTK_FILL, 0, 0, 0); |
1526 | |
1527 deny_type = deny_opt(_("Allow only the users below"), 3, deny_type); | |
4177 | 1528 gtk_size_group_add_widget(sg1, deny_type); |
4178 | 1529 gtk_table_attach(GTK_TABLE(table), deny_type, 0, 1, 2, 3, GTK_FILL, 0, 0, 0); |
4177 | 1530 |
1531 sw = gtk_scrolled_window_new(NULL, NULL); | |
1532 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); | |
4178 | 1533 gtk_table_attach(GTK_TABLE(table), sw, 0, 1, 3, 4, GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); |
4177 | 1534 gtk_widget_show(sw); |
1535 | |
1536 allow_store = gtk_list_store_new(1, G_TYPE_STRING); | |
1537 allow_list = gtk_tree_view_new_with_model(GTK_TREE_MODEL(allow_store)); | |
1538 | |
1539 rend = gtk_cell_renderer_text_new(); | |
1540 col = gtk_tree_view_column_new_with_attributes(NULL, rend, "text", 0, NULL); | |
1541 gtk_tree_view_column_set_clickable(GTK_TREE_VIEW_COLUMN(col), TRUE); | |
1542 gtk_tree_view_append_column(GTK_TREE_VIEW(allow_list), col); | |
1543 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(allow_list), FALSE); | |
1544 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw), allow_list); | |
1545 gtk_widget_show(allow_list); | |
1546 | |
1547 build_allow_list(); | |
1548 | |
4179 | 1549 bbox = gtk_hbox_new(TRUE, 0); |
4177 | 1550 gtk_widget_show(bbox); |
4178 | 1551 gtk_table_attach(GTK_TABLE(table), bbox, 0, 1, 4, 5, GTK_FILL, 0, 0, 0); |
4177 | 1552 |
1553 button = gtk_button_new_from_stock(GTK_STOCK_ADD); | |
1554 gtk_size_group_add_widget(sg2, button); | |
1555 gtk_widget_show(button); | |
1556 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(pref_deny_add), (void *)TRUE); | |
4179 | 1557 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
4177 | 1558 |
1559 button = gtk_button_new_from_stock(GTK_STOCK_REMOVE); | |
1560 gtk_size_group_add_widget(sg2, button); | |
1561 gtk_widget_show(button); | |
1562 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(pref_deny_rem), (void *)TRUE); | |
4179 | 1563 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
4177 | 1564 |
4178 | 1565 deny_type = deny_opt(_("Deny all users"), 2, deny_type); |
4177 | 1566 gtk_size_group_add_widget(sg1, deny_type); |
4178 | 1567 gtk_table_attach(GTK_TABLE(table), deny_type, 1, 2, 1, 2, GTK_FILL, 0, 0, 0); |
1568 | |
1569 deny_type = deny_opt(_("Block the users below"), 4, deny_type); | |
4177 | 1570 gtk_size_group_add_widget(sg1, deny_type); |
4178 | 1571 gtk_table_attach(GTK_TABLE(table), deny_type, 1, 2, 2, 3, GTK_FILL, 0, 0, 0); |
4177 | 1572 |
1573 sw = gtk_scrolled_window_new(NULL, NULL); | |
1574 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); | |
4178 | 1575 gtk_table_attach(GTK_TABLE(table), sw, 1, 2, 3, 4, GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); |
4177 | 1576 gtk_widget_show(sw); |
1577 | |
1578 block_store = gtk_list_store_new(1, G_TYPE_STRING); | |
1579 block_list = gtk_tree_view_new_with_model(GTK_TREE_MODEL(block_store)); | |
1580 | |
1581 rend = gtk_cell_renderer_text_new(); | |
1582 col = gtk_tree_view_column_new_with_attributes(NULL, rend, "text", 0, NULL); | |
1583 gtk_tree_view_column_set_clickable(GTK_TREE_VIEW_COLUMN(col), TRUE); | |
1584 gtk_tree_view_append_column(GTK_TREE_VIEW(block_list), col); | |
1585 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(block_list), FALSE); | |
1586 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw), block_list); | |
1587 gtk_widget_show(block_list); | |
1588 | |
1589 build_block_list(); | |
1590 | |
4179 | 1591 bbox = gtk_hbox_new(TRUE, 0); |
4178 | 1592 gtk_table_attach(GTK_TABLE(table), bbox, 1, 2, 4, 5, GTK_FILL, 0, 0, 0); |
4177 | 1593 gtk_widget_show(bbox); |
1594 | |
1595 button = gtk_button_new_from_stock(GTK_STOCK_ADD); | |
1596 gtk_size_group_add_widget(sg2, button); | |
1597 gtk_widget_show(button); | |
1598 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(pref_deny_add), FALSE); | |
4179 | 1599 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
4177 | 1600 |
1601 button = gtk_button_new_from_stock(GTK_STOCK_REMOVE); | |
1602 gtk_size_group_add_widget(sg2, button); | |
1603 gtk_widget_show(button); | |
1604 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(pref_deny_rem), FALSE); | |
4179 | 1605 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
4177 | 1606 |
1607 sep = gtk_hseparator_new(); | |
1608 gtk_box_pack_start(GTK_BOX(box), sep, FALSE, FALSE, 5); | |
1609 gtk_widget_show(sep); | |
1610 | |
4178 | 1611 hbox = gtk_hbox_new(FALSE, 0); |
1612 gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0); | |
4177 | 1613 gtk_widget_show(hbox); |
4178 | 1614 |
4177 | 1615 close_button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); |
1616 gtk_box_pack_end(GTK_BOX(hbox), close_button, FALSE, FALSE, 0); | |
1617 g_signal_connect_swapped(GTK_OBJECT(close_button), "clicked", G_CALLBACK(gtk_widget_destroy), pwin); | |
4178 | 1618 gtk_widget_show(close_button); |
4177 | 1619 |
1620 gtk_widget_show(pwin); | |
1621 | |
1622 } | |
1623 | |
1 | 1624 |
1625 /*------------------------------------------------------------------------*/ | |
1626 /* The dialog for SET INFO / SET DIR INFO */ | |
1627 /*------------------------------------------------------------------------*/ | |
1628 | |
1629 void do_save_info(GtkWidget *widget, struct set_info_dlg *b) | |
1630 { | |
1631 gchar *junk; | |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
1632 struct gaim_connection *gc; |
1 | 1633 |
4119 | 1634 junk = gtk_text_view_get_text(GTK_TEXT_VIEW(b->text), FALSE); |
1 | 1635 |
4491 | 1636 if (b->account) { |
1637 strncpy_withhtml(b->account->user_info, junk, sizeof b->account->user_info); | |
1638 gc = b->account->gc; | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1639 |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
1640 save_prefs(); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
1641 |
1292 | 1642 if (gc) |
4491 | 1643 serv_set_info(gc, b->account->user_info); |
122
521db4bf5f28
[gaim-migrate @ 132]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
84
diff
changeset
|
1644 } |
25 | 1645 g_free(junk); |
1 | 1646 destroy_dialog(NULL, b->window); |
1647 g_free(b); | |
1648 } | |
1649 | |
1650 void do_set_dir(GtkWidget *widget, struct set_dir_dlg *b) | |
1651 { | |
3466 | 1652 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
|
1653 int web = GTK_TOGGLE_BUTTON(b->web)->active; |
3466 | 1654 const char *middle = gtk_entry_get_text(GTK_ENTRY(b->middle)); |
1655 const char *last = gtk_entry_get_text(GTK_ENTRY(b->last)); | |
1656 const char *maiden = gtk_entry_get_text(GTK_ENTRY(b->maiden)); | |
1657 const char *city = gtk_entry_get_text(GTK_ENTRY(b->city)); | |
1658 const char *state = gtk_entry_get_text(GTK_ENTRY(b->state)); | |
1659 const char *country = gtk_entry_get_text(GTK_ENTRY(b->country)); | |
1 | 1660 |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
1661 serv_set_dir(b->gc, first, middle, last, maiden, city, state, country, web); |
1 | 1662 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1663 destroy_dialog(NULL, b->window); |
1 | 1664 g_free(b); |
1665 } | |
1666 | |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
1667 void show_set_dir(struct gaim_connection *gc) |
1 | 1668 { |
1669 GtkWidget *label; | |
1670 GtkWidget *bot; | |
484 | 1671 GtkWidget *vbox; |
1672 GtkWidget *hbox; | |
1673 GtkWidget *frame; | |
1674 GtkWidget *fbox; | |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
1675 char buf[256]; |
1 | 1676 |
1677 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
|
1678 b->gc = gc; |
1 | 1679 |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
1680 GAIM_DIALOG(b->window); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
1681 dialogwindows = g_list_prepend(dialogwindows, b->window); |
4074 | 1682 gtk_window_set_role(GTK_WINDOW(b->window), "set_dir"); |
4635 | 1683 gtk_window_set_resizable(GTK_WINDOW(b->window), TRUE); |
4703 | 1684 gtk_window_set_title(GTK_WINDOW(b->window), _("Set Directory Info")); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
1685 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
|
1686 gtk_widget_realize(b->window); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
1687 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
1688 fbox = gtk_vbox_new(FALSE, 5); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
1689 gtk_container_add(GTK_CONTAINER(b->window), fbox); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
1690 gtk_widget_show(fbox); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
1691 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
1692 frame = gtk_frame_new(_("Directory Info")); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1693 gtk_container_set_border_width(GTK_CONTAINER(fbox), 5); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
1694 gtk_box_pack_start(GTK_BOX(fbox), frame, FALSE, FALSE, 0); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
1695 gtk_widget_show(frame); |
484 | 1696 |
1697 vbox = gtk_vbox_new(FALSE, 5); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1698 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
1699 gtk_container_add(GTK_CONTAINER(frame), vbox); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
1700 gtk_widget_show(vbox); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
1701 |
4472 | 1702 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
|
1703 label = gtk_label_new(buf); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
1704 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 5); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
1705 gtk_widget_show(label); |
1 | 1706 |
1707 b->first = gtk_entry_new(); | |
1708 b->middle = gtk_entry_new(); | |
1709 b->last = gtk_entry_new(); | |
1710 b->maiden = gtk_entry_new(); | |
1711 b->city = gtk_entry_new(); | |
1712 b->state = gtk_entry_new(); | |
1713 b->country = gtk_entry_new(); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1714 b->web = gtk_check_button_new_with_label(_("Allow Web Searches To Find Your Info")); |
484 | 1715 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1716 /* Line 1 */ |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1717 label = gtk_label_new(_("First Name")); |
1 | 1718 gtk_widget_show(label); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1719 |
484 | 1720 hbox = gtk_hbox_new(FALSE, 5); |
1185 | 1721 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
1722 gtk_box_pack_end(GTK_BOX(hbox), b->first, FALSE, FALSE, 0); | |
1723 | |
1724 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
484 | 1725 gtk_widget_show(hbox); |
1726 | |
1727 /* Line 2 */ | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1728 label = gtk_label_new(_("Middle Name")); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1729 gtk_widget_show(label); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1730 |
484 | 1731 hbox = gtk_hbox_new(FALSE, 5); |
1185 | 1732 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
1733 gtk_box_pack_end(GTK_BOX(hbox), b->middle, FALSE, FALSE, 0); | |
1734 | |
1735 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
484 | 1736 gtk_widget_show(hbox); |
1737 | |
1738 | |
1739 /* Line 3 */ | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1740 label = gtk_label_new(_("Last Name")); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1741 gtk_widget_show(label); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1742 |
484 | 1743 hbox = gtk_hbox_new(FALSE, 5); |
1185 | 1744 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
1745 gtk_box_pack_end(GTK_BOX(hbox), b->last, FALSE, FALSE, 0); | |
1746 | |
1747 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
484 | 1748 gtk_widget_show(hbox); |
1749 | |
1750 /* Line 4 */ | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1751 label = gtk_label_new(_("Maiden Name")); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1752 gtk_widget_show(label); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1753 |
484 | 1754 hbox = gtk_hbox_new(FALSE, 5); |
1185 | 1755 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
1756 gtk_box_pack_end(GTK_BOX(hbox), b->maiden, FALSE, FALSE, 0); | |
1757 | |
1758 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
484 | 1759 gtk_widget_show(hbox); |
1760 | |
1761 /* Line 5 */ | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1762 label = gtk_label_new(_("City")); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1763 gtk_widget_show(label); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1764 |
484 | 1765 hbox = gtk_hbox_new(FALSE, 5); |
1185 | 1766 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
1767 gtk_box_pack_end(GTK_BOX(hbox), b->city, FALSE, FALSE, 0); | |
1768 | |
1769 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
484 | 1770 gtk_widget_show(hbox); |
1771 | |
1772 /* Line 6 */ | |
1185 | 1773 label = gtk_label_new(_("State")); |
1 | 1774 gtk_widget_show(label); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1775 |
484 | 1776 hbox = gtk_hbox_new(FALSE, 5); |
1185 | 1777 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
1778 gtk_box_pack_end(GTK_BOX(hbox), b->state, FALSE, FALSE, 0); | |
1779 | |
1780 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
484 | 1781 gtk_widget_show(hbox); |
1782 | |
1783 /* Line 7 */ | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1784 label = gtk_label_new(_("Country")); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1785 gtk_widget_show(label); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1786 |
484 | 1787 hbox = gtk_hbox_new(FALSE, 5); |
1185 | 1788 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
1789 gtk_box_pack_end(GTK_BOX(hbox), b->country, FALSE, FALSE, 0); | |
1790 | |
1791 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
484 | 1792 gtk_widget_show(hbox); |
1793 | |
1794 /* Line 8 */ | |
1795 | |
1796 hbox = gtk_hbox_new(FALSE, 5); | |
1185 | 1797 gtk_box_pack_start(GTK_BOX(hbox), b->web, TRUE, TRUE, 0); |
484 | 1798 gtk_widget_show(hbox); |
1185 | 1799 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
484 | 1800 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1801 gtk_widget_show(b->first); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1802 gtk_widget_show(b->middle); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1803 gtk_widget_show(b->last); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1804 gtk_widget_show(b->maiden); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1805 gtk_widget_show(b->city); |
1 | 1806 gtk_widget_show(b->state); |
1807 gtk_widget_show(b->country); | |
1808 gtk_widget_show(b->web); | |
1809 | |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
1810 /* And add the buttons */ |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
1811 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
1812 bot = gtk_hbox_new(FALSE, 5); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
1813 gtk_box_pack_start(GTK_BOX(fbox), bot, FALSE, FALSE, 0); |
5024 | 1814 |
1815 b->save = gaim_pixbuf_button_from_stock(_("Save"), GTK_STOCK_SAVE, GAIM_BUTTON_HORIZONTAL); | |
4092 | 1816 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
|
1817 g_signal_connect(GTK_OBJECT(b->save), "clicked", G_CALLBACK(do_set_dir), b); |
4092 | 1818 |
5024 | 1819 b->cancel = gaim_pixbuf_button_from_stock(_("Cancel"), GTK_STOCK_CANCEL, GAIM_BUTTON_HORIZONTAL); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
1820 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
|
1821 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
|
1822 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1823 gtk_window_set_focus(GTK_WINDOW(b->window), b->first); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1824 |
5024 | 1825 gtk_widget_show_all(b->window); |
1 | 1826 } |
1827 | |
149 | 1828 void do_change_password(GtkWidget *widget, struct passwddlg *b) |
1829 { | |
3466 | 1830 const gchar *orig, *new1, *new2; |
149 | 1831 |
1832 orig = gtk_entry_get_text(GTK_ENTRY(b->original)); | |
1833 new1 = gtk_entry_get_text(GTK_ENTRY(b->new1)); | |
1834 new2 = gtk_entry_get_text(GTK_ENTRY(b->new2)); | |
1835 | |
4793 | 1836 if (g_utf8_collate(new1, new2)) { |
3427 | 1837 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
|
1838 return; |
149 | 1839 } |
1840 | |
1841 if ((strlen(orig) < 1) || (strlen(new1) < 1) || (strlen(new2) < 1)) { | |
3427 | 1842 do_error_dialog(_("Fill out all fields completely"), NULL, GAIM_ERROR); |
149 | 1843 return; |
1844 } | |
1845 | |
978
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
1846 serv_change_passwd(b->gc, orig, new1); |
4977 | 1847 g_snprintf(b->gc->account->password, sizeof(b->gc->account->password), "%s", new1); |
1848 save_prefs(); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1849 |
149 | 1850 destroy_dialog(NULL, b->window); |
1851 g_free(b); | |
1852 } | |
1853 | |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
1854 void show_change_passwd(struct gaim_connection *gc) |
146 | 1855 { |
1856 GtkWidget *hbox; | |
1857 GtkWidget *label; | |
1858 GtkWidget *vbox; | |
475 | 1859 GtkWidget *fbox; |
1860 GtkWidget *frame; | |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
1861 char buf[256]; |
454 | 1862 |
146 | 1863 struct passwddlg *b = g_new0(struct passwddlg, 1); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
1864 b->gc = gc; |
146 | 1865 |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
1866 GAIM_DIALOG(b->window); |
4635 | 1867 gtk_window_set_resizable(GTK_WINDOW(b->window), TRUE); |
4074 | 1868 gtk_window_set_role(GTK_WINDOW(b->window), "change_passwd"); |
4703 | 1869 gtk_window_set_title(GTK_WINDOW(b->window), _("Change Password")); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
1870 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
|
1871 gtk_widget_realize(b->window); |
146 | 1872 dialogwindows = g_list_prepend(dialogwindows, b->window); |
149 | 1873 |
978
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
1874 fbox = gtk_vbox_new(FALSE, 5); |
4635 | 1875 gtk_container_set_border_width(GTK_CONTAINER(fbox), 5); |
978
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
1876 gtk_container_add(GTK_CONTAINER(b->window), fbox); |
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
1877 |
475 | 1878 frame = gtk_frame_new(_("Change Password")); |
1185 | 1879 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
|
1880 |
475 | 1881 vbox = gtk_vbox_new(FALSE, 5); |
4635 | 1882 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); |
978
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
1883 gtk_container_add(GTK_CONTAINER(frame), vbox); |
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
1884 |
4472 | 1885 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
|
1886 label = gtk_label_new(buf); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
1887 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 5); |
978
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
1888 |
475 | 1889 /* First Line */ |
1890 hbox = gtk_hbox_new(FALSE, 5); | |
1185 | 1891 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
|
1892 |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1893 label = gtk_label_new(_("Original Password")); |
1185 | 1894 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
475 | 1895 |
146 | 1896 b->original = gtk_entry_new(); |
160
aaa8f0a2140e
[gaim-migrate @ 170]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
149
diff
changeset
|
1897 gtk_entry_set_visibility(GTK_ENTRY(b->original), FALSE); |
1185 | 1898 gtk_box_pack_end(GTK_BOX(hbox), b->original, FALSE, FALSE, 0); |
475 | 1899 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1900 /* Next Line */ |
475 | 1901 hbox = gtk_hbox_new(FALSE, 5); |
1185 | 1902 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
|
1903 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1904 label = gtk_label_new(_("New Password")); |
1185 | 1905 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
|
1906 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1907 b->new1 = gtk_entry_new(); |
160
aaa8f0a2140e
[gaim-migrate @ 170]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
149
diff
changeset
|
1908 gtk_entry_set_visibility(GTK_ENTRY(b->new1), FALSE); |
1185 | 1909 gtk_box_pack_end(GTK_BOX(hbox), b->new1, FALSE, FALSE, 0); |
475 | 1910 |
1911 /* Next Line */ | |
1912 hbox = gtk_hbox_new(FALSE, 5); | |
1185 | 1913 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1914 |
475 | 1915 label = gtk_label_new(_("New Password (again)")); |
1185 | 1916 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
|
1917 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1918 b->new2 = gtk_entry_new(); |
160
aaa8f0a2140e
[gaim-migrate @ 170]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
149
diff
changeset
|
1919 gtk_entry_set_visibility(GTK_ENTRY(b->new2), FALSE); |
1185 | 1920 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
|
1921 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1922 /* Now do our row of buttons */ |
1185 | 1923 hbox = gtk_hbox_new(FALSE, 5); |
1924 gtk_box_pack_start(GTK_BOX(fbox), hbox, FALSE, FALSE, 0); | |
5024 | 1925 |
1926 b->ok = gaim_pixbuf_button_from_stock(_("OK"), GTK_STOCK_OK, GAIM_BUTTON_HORIZONTAL); | |
4092 | 1927 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
|
1928 g_signal_connect(GTK_OBJECT(b->ok), "clicked", G_CALLBACK(do_change_password), b); |
4092 | 1929 |
5024 | 1930 b->cancel = gaim_pixbuf_button_from_stock(_("Cancel"), GTK_STOCK_CANCEL, GAIM_BUTTON_HORIZONTAL); |
1185 | 1931 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
|
1932 g_signal_connect(GTK_OBJECT(b->cancel), "clicked", G_CALLBACK(destroy_dialog), b->window); |
1185 | 1933 |
5024 | 1934 gtk_widget_show_all(b->window); |
146 | 1935 } |
1936 | |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
1937 void show_set_info(struct gaim_connection *gc) |
1 | 1938 { |
1185 | 1939 GtkWidget *buttons; |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
1940 GtkWidget *label; |
1185 | 1941 GtkWidget *vbox; |
4119 | 1942 GtkTextBuffer *buffer; |
1943 GtkWidget *frame; | |
1292 | 1944 gchar *buf; |
4491 | 1945 struct gaim_account *account; |
1292 | 1946 |
1 | 1947 struct set_info_dlg *b = g_new0(struct set_info_dlg, 1); |
4491 | 1948 account = gc->account; |
1949 b->account = account; | |
1 | 1950 |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
1951 GAIM_DIALOG(b->window); |
4074 | 1952 gtk_window_set_role(GTK_WINDOW(b->window), "set_info"); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1953 dialogwindows = g_list_prepend(dialogwindows, b->window); |
4703 | 1954 gtk_window_set_title(GTK_WINDOW(b->window), _("Set User Info")); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
1955 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
|
1956 gtk_widget_realize(b->window); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
1957 |
1185 | 1958 vbox = gtk_vbox_new(FALSE, 5); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
1959 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
1960 gtk_container_add(GTK_CONTAINER(b->window), vbox); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
1961 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
1962 buf = g_malloc(256); |
4491 | 1963 g_snprintf(buf, 256, _("Changing info for %s:"), account->username); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
1964 label = gtk_label_new(buf); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
1965 g_free(buf); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
1966 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 5); |
4491 | 1967 |
4119 | 1968 frame = gtk_frame_new(NULL); |
1969 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN); | |
1970 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); | |
1971 | |
1972 b->text = gtk_text_view_new(); | |
5105 | 1973 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(b->text), GTK_WRAP_WORD_CHAR); |
4119 | 1974 gtk_widget_set_size_request(b->text, 300, 200); |
4491 | 1975 buf = g_malloc(strlen(account->user_info) + 1); |
1976 strncpy_nohtml(buf, account->user_info, strlen(account->user_info) + 1); | |
4119 | 1977 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(b->text)); |
1978 gtk_text_buffer_set_text(buffer, buf, -1); | |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
1979 g_free(buf); |
4119 | 1980 gtk_container_add(GTK_CONTAINER(frame), b->text); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
1981 gtk_window_set_focus(GTK_WINDOW(b->window), b->text); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
1982 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
1983 buttons = gtk_hbox_new(FALSE, 5); |
1185 | 1984 gtk_box_pack_start(GTK_BOX(vbox), buttons, FALSE, FALSE, 0); |
5024 | 1985 |
1986 b->save = gaim_pixbuf_button_from_stock(_("Save"), GTK_STOCK_SAVE, GAIM_BUTTON_HORIZONTAL); | |
4092 | 1987 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
|
1988 g_signal_connect(GTK_OBJECT(b->save), "clicked", G_CALLBACK(do_save_info), b); |
4092 | 1989 |
5024 | 1990 b->cancel = gaim_pixbuf_button_from_stock(_("Cancel"), GTK_STOCK_CANCEL, GAIM_BUTTON_HORIZONTAL); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
1991 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
|
1992 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
|
1993 |
5024 | 1994 gtk_widget_show_all(b->window); |
1 | 1995 } |
1996 | |
1997 /*------------------------------------------------------------------------*/ | |
1998 /* The dialog for the info requests */ | |
1999 /*------------------------------------------------------------------------*/ | |
2000 | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2001 static void info_dlg_free(GtkWidget *b, struct info_dlg *d) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2002 { |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2003 if (g_slist_find(info_dlgs, d)) |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2004 info_dlgs = g_slist_remove(info_dlgs, d); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2005 g_free(d->who); |
1051
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1049
diff
changeset
|
2006 g_free(d); |
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1049
diff
changeset
|
2007 } |
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1049
diff
changeset
|
2008 |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2785
diff
changeset
|
2009 /* 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
|
2010 * 1, don't show if regular info isn't shown |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2785
diff
changeset
|
2011 * 2, show regardless but don't try to get away message |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2785
diff
changeset
|
2012 * |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2785
diff
changeset
|
2013 * 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
|
2014 */ |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2785
diff
changeset
|
2015 void g_show_info_text(struct gaim_connection *gc, char *who, int away, char *info, ...) |
1 | 2016 { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2017 GtkWidget *ok; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2018 GtkWidget *label; |
1 | 2019 GtkWidget *text; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2020 GtkWidget *bbox; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2021 GtkWidget *sw; |
1428
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1399
diff
changeset
|
2022 gint options = 0; |
2137
18722ae5b882
[gaim-migrate @ 2147]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
2023 char *more_info; |
18722ae5b882
[gaim-migrate @ 2147]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
2024 va_list ap; |
1 | 2025 |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2026 struct info_dlg *b = find_info_dlg(gc, who); |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2785
diff
changeset
|
2027 if (!b && (away == 1)) |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2028 return; |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2029 if (!b) { |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2030 b = g_new0(struct info_dlg, 1); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2031 b->gc = gc; |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2032 b->who = who ? g_strdup(normalize(who)) : NULL; |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2033 info_dlgs = g_slist_append(info_dlgs, b); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2034 |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2035 GAIM_DIALOG(b->window); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2036 gtk_window_set_title(GTK_WINDOW(b->window), "Gaim"); |
4635 | 2037 gtk_container_set_border_width(GTK_CONTAINER(b->window), 5); |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2038 gtk_widget_realize(GTK_WIDGET(b->window)); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2039 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
|
2040 |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2041 bbox = gtk_vbox_new(FALSE, 5); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2042 gtk_container_add(GTK_CONTAINER(b->window), bbox); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2043 |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2044 label = gtk_label_new(_("Below are the results of your search: ")); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2045 gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2046 |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2047 sw = gtk_scrolled_window_new(NULL, NULL); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2048 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); |
3926 | 2049 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
|
2050 gtk_box_pack_start(GTK_BOX(bbox), sw, TRUE, TRUE, 0); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2051 |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2052 text = gtk_imhtml_new(NULL, NULL); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2053 b->text = text; |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2054 gtk_container_add(GTK_CONTAINER(sw), text); |
4635 | 2055 gtk_widget_set_size_request(sw, 300, 250); |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2056 gaim_setup_imhtml(text); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2057 |
5024 | 2058 ok = gaim_pixbuf_button_from_stock(_("OK"), GTK_STOCK_OK, GAIM_BUTTON_HORIZONTAL); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2059 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
|
2060 GTK_OBJECT(b->window)); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2061 gtk_box_pack_start(GTK_BOX(bbox), ok, FALSE, FALSE, 0); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2062 |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2063 gtk_widget_show_all(b->window); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2064 } |
1 | 2065 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2228
diff
changeset
|
2066 if (convo_options & OPT_CONVO_IGNORE_COLOUR) |
1428
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1399
diff
changeset
|
2067 options ^= GTK_IMHTML_NO_COLOURS; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2228
diff
changeset
|
2068 if (convo_options & OPT_CONVO_IGNORE_FONTS) |
1428
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1399
diff
changeset
|
2069 options ^= GTK_IMHTML_NO_FONTS; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2228
diff
changeset
|
2070 if (convo_options & OPT_CONVO_IGNORE_SIZES) |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
2071 options ^= GTK_IMHTML_NO_SIZES; |
1428
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1399
diff
changeset
|
2072 options ^= GTK_IMHTML_NO_COMMENTS; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1399
diff
changeset
|
2073 options ^= GTK_IMHTML_NO_TITLE; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1399
diff
changeset
|
2074 options ^= GTK_IMHTML_NO_NEWLINE; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1399
diff
changeset
|
2075 options ^= GTK_IMHTML_NO_SCROLL; |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2076 |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2851
diff
changeset
|
2077 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
|
2078 |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2079 va_start(ap, info); |
2137
18722ae5b882
[gaim-migrate @ 2147]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
2080 while ((more_info = va_arg(ap, char *)) != NULL) |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2851
diff
changeset
|
2081 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
|
2082 va_end(ap); |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2083 |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2084 if (away) |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2085 info_dlgs = g_slist_remove(info_dlgs, b); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2086 else |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2763
diff
changeset
|
2087 serv_get_away(gc, who); |
247
f6e8ea29b24f
[gaim-migrate @ 257]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
245
diff
changeset
|
2088 } |
f6e8ea29b24f
[gaim-migrate @ 257]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
245
diff
changeset
|
2089 |
1 | 2090 /*------------------------------------------------------------------------*/ |
2091 /* The dialog for adding to permit/deny */ | |
2092 /*------------------------------------------------------------------------*/ | |
2093 | |
2094 | |
2095 static void do_add_perm(GtkWidget *w, struct addperm *p) | |
2096 { | |
2097 | |
3466 | 2098 const char *who; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2099 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2100 who = gtk_entry_get_text(GTK_ENTRY(p->entry)); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2101 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2102 if (!p->permit) { |
4491 | 2103 if (gaim_privacy_deny_add(p->gc->account, who)) { |
4349 | 2104 serv_add_deny(p->gc, who); |
2105 build_block_list(); | |
2106 gaim_blist_save(); | |
1126
c8118e7ec981
[gaim-migrate @ 1136]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1125
diff
changeset
|
2107 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2108 } else { |
4491 | 2109 if (gaim_privacy_permit_add(p->gc->account, who)) { |
4349 | 2110 serv_add_permit(p->gc, who); |
2111 build_allow_list(); | |
2112 gaim_blist_save(); | |
1126
c8118e7ec981
[gaim-migrate @ 1136]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1125
diff
changeset
|
2113 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2114 } |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2115 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2116 destroy_dialog(NULL, p->window); |
1 | 2117 } |
2118 | |
2119 | |
2120 | |
1144
b1454d019277
[gaim-migrate @ 1154]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1141
diff
changeset
|
2121 void show_add_perm(struct gaim_connection *gc, char *who, gboolean permit) |
1 | 2122 { |
2123 GtkWidget *cancel; | |
2124 GtkWidget *add; | |
2125 GtkWidget *label; | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2126 GtkWidget *bbox; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2127 GtkWidget *vbox; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2128 GtkWidget *topbox; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2129 |
486 | 2130 struct addperm *p = g_new0(struct addperm, 1); |
1072
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
2131 p->gc = gc; |
1144
b1454d019277
[gaim-migrate @ 1154]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1141
diff
changeset
|
2132 p->permit = permit; |
1 | 2133 |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
2134 GAIM_DIALOG(p->window); |
487 | 2135 gtk_container_set_border_width(GTK_CONTAINER(p->window), 5); |
4635 | 2136 gtk_window_set_resizable(GTK_WINDOW(p->window), FALSE); |
1144
b1454d019277
[gaim-migrate @ 1154]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1141
diff
changeset
|
2137 gtk_widget_realize(p->window); |
487 | 2138 |
486 | 2139 dialogwindows = g_list_prepend(dialogwindows, p->window); |
2140 | |
4107 | 2141 bbox = gtk_hbox_new(FALSE, 5); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2142 topbox = gtk_hbox_new(FALSE, 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2143 vbox = gtk_vbox_new(FALSE, 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2144 p->entry = gtk_entry_new(); |
1 | 2145 |
486 | 2146 /* Build Add Button */ |
2147 | |
1144
b1454d019277
[gaim-migrate @ 1154]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1141
diff
changeset
|
2148 if (permit) |
5024 | 2149 add = gaim_pixbuf_button_from_stock(_("Permit"), GTK_STOCK_ADD, GAIM_BUTTON_HORIZONTAL); |
1144
b1454d019277
[gaim-migrate @ 1154]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1141
diff
changeset
|
2150 else |
5024 | 2151 add = gaim_pixbuf_button_from_stock(_("Deny"), GTK_STOCK_ADD, GAIM_BUTTON_HORIZONTAL); |
2152 cancel = gaim_pixbuf_button_from_stock(_("Cancel"), GTK_STOCK_CANCEL, GAIM_BUTTON_HORIZONTAL); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2153 |
486 | 2154 /* End of Cancel Button */ |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2155 if (who != NULL) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2156 gtk_entry_set_text(GTK_ENTRY(p->entry), who); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2157 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2158 /* Put the buttons in the box */ |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2159 |
4107 | 2160 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
|
2161 gtk_box_pack_end(GTK_BOX(bbox), cancel, FALSE, FALSE, 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2162 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2163 label = gtk_label_new(_("Add")); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2164 gtk_box_pack_start(GTK_BOX(topbox), label, FALSE, FALSE, 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2165 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
|
2166 /* And the boxes in the box */ |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2167 gtk_box_pack_start(GTK_BOX(vbox), topbox, TRUE, TRUE, 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2168 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 5); |
4107 | 2169 topbox=gtk_hbox_new(FALSE, 5); |
2170 gtk_box_pack_start(GTK_BOX(topbox), vbox, FALSE, FALSE, 5); | |
1 | 2171 |
2172 | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2173 /* Handle closes right */ |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2174 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
|
2175 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
|
2176 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
|
2177 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
|
2178 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2179 /* Finish up */ |
1144
b1454d019277
[gaim-migrate @ 1154]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1141
diff
changeset
|
2180 if (permit) |
4703 | 2181 gtk_window_set_title(GTK_WINDOW(p->window), _("Add Permit")); |
1144
b1454d019277
[gaim-migrate @ 1154]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1141
diff
changeset
|
2182 else |
4703 | 2183 gtk_window_set_title(GTK_WINDOW(p->window), _("Add Deny")); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2184 gtk_window_set_focus(GTK_WINDOW(p->window), p->entry); |
4107 | 2185 gtk_container_add(GTK_CONTAINER(p->window), topbox); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2186 gtk_widget_realize(p->window); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2187 |
5024 | 2188 gtk_widget_show_all(p->window); |
1 | 2189 } |
2190 | |
2191 | |
2192 /*------------------------------------------------------------------------*/ | |
608 | 2193 /* Functions Called To Add A Log */ |
1 | 2194 /*------------------------------------------------------------------------*/ |
2195 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2196 void cancel_log(GtkWidget *widget, struct gaim_conversation *c) |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2197 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2198 struct gaim_gtk_conversation *gtkconv; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2199 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2200 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2201 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2202 if (gtkconv->toolbar.log) { |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2203 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
|
2204 FALSE); |
608 | 2205 } |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2206 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2207 dialogwindows = g_list_remove(dialogwindows, gtkconv->dialogs.log); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2208 gtk_widget_destroy(gtkconv->dialogs.log); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2209 gtkconv->dialogs.log = NULL; |
608 | 2210 } |
2211 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2212 void do_log(GtkWidget *w, struct gaim_conversation *c) |
1 | 2213 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2214 struct gaim_gtk_conversation *gtkconv; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2215 struct log_conversation *l; |
3466 | 2216 const char *file; |
1035
80a47e3b1bca
[gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1032
diff
changeset
|
2217 char path[PATHSIZE]; |
1 | 2218 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2219 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2220 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2221 if (!find_log_info(c->name)) { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2222 file = gtk_file_selection_get_filename( |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2223 GTK_FILE_SELECTION(gtkconv->dialogs.log)); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2224 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2225 strncpy(path, file, PATHSIZE - 1); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2226 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2227 if (file_is_dir(path, gtkconv->dialogs.log)) |
1035
80a47e3b1bca
[gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1032
diff
changeset
|
2228 return; |
80a47e3b1bca
[gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1032
diff
changeset
|
2229 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2230 l = (struct log_conversation *)g_new0(struct log_conversation, 1); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2231 strcpy(l->name, gaim_conversation_get_name(c)); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2232 strcpy(l->filename, file); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2233 log_conversations = g_list_append(log_conversations, l); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2234 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2235 if (c != NULL) |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2236 gaim_conversation_set_logging(c, TRUE); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2237 } |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2238 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2239 save_prefs(); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2240 cancel_log(NULL, c); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2241 } |
1 | 2242 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2243 void show_log_dialog(struct gaim_conversation *c) |
1 | 2244 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2245 struct gaim_gtk_conversation *gtkconv; |
1 | 2246 char *buf = g_malloc(BUF_LEN); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2247 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2248 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2249 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2250 if (!gtkconv->dialogs.log) { |
4703 | 2251 gtkconv->dialogs.log = gtk_file_selection_new(_("Log Conversation")); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2252 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2253 gtk_file_selection_hide_fileop_buttons( |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2254 GTK_FILE_SELECTION(gtkconv->dialogs.log)); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2255 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2256 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
|
2257 gaim_home_dir(), normalize(c->name)); |
4635 | 2258 g_object_set_data(G_OBJECT(gtkconv->dialogs.log), "dialog_type", |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2259 "log dialog"); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2260 gtk_file_selection_set_filename(GTK_FILE_SELECTION(gtkconv->dialogs.log), |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2261 buf); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2262 g_signal_connect(G_OBJECT(gtkconv->dialogs.log), "delete_event", |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2263 G_CALLBACK(delete_event_dialog), c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2264 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
|
2265 G_CALLBACK(do_log), c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2266 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
|
2267 G_CALLBACK(cancel_log), c); |
1 | 2268 } |
2269 | |
25 | 2270 g_free(buf); |
2271 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2272 gtk_widget_show(gtkconv->dialogs.log); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2273 gdk_window_raise(gtkconv->dialogs.log->window); |
1 | 2274 } |
2275 | |
2276 /*------------------------------------------------------*/ | |
2277 /* Find Buddy By Email */ | |
2278 /*------------------------------------------------------*/ | |
2279 | |
2280 void do_find_info(GtkWidget *w, struct findbyinfo *b) | |
2281 { | |
3466 | 2282 const char *first; |
2283 const char *middle; | |
2284 const char *last; | |
2285 const char *maiden; | |
2286 const char *city; | |
2287 const char *state; | |
2288 const char *country; | |
1 | 2289 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2290 first = gtk_entry_get_text(GTK_ENTRY(b->firstentry)); |
1 | 2291 middle = gtk_entry_get_text(GTK_ENTRY(b->middleentry)); |
2292 last = gtk_entry_get_text(GTK_ENTRY(b->lastentry)); | |
2293 maiden = gtk_entry_get_text(GTK_ENTRY(b->maidenentry)); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2294 city = gtk_entry_get_text(GTK_ENTRY(b->cityentry)); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2295 state = gtk_entry_get_text(GTK_ENTRY(b->stateentry)); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2296 country = gtk_entry_get_text(GTK_ENTRY(b->countryentry)); |
1 | 2297 |
2393
a7ecfd3f7714
[gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2382
diff
changeset
|
2298 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
|
2299 destroy_dialog(NULL, b->window); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2300 } |
1 | 2301 |
2302 void do_find_email(GtkWidget *w, struct findbyemail *b) | |
2303 { | |
3466 | 2304 const char *email; |
1 | 2305 |
2306 email = gtk_entry_get_text(GTK_ENTRY(b->emailentry)); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2307 |
2598
b2800bca74fe
[gaim-migrate @ 2611]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2582
diff
changeset
|
2308 serv_dir_search(b->gc, "", "", "", "", "", "", "", email); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2309 |
1 | 2310 destroy_dialog(NULL, b->window); |
2311 } | |
2312 | |
2393
a7ecfd3f7714
[gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2382
diff
changeset
|
2313 void show_find_info(struct gaim_connection *gc) |
1 | 2314 { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2315 GtkWidget *cancel; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2316 GtkWidget *ok; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2317 GtkWidget *label; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2318 GtkWidget *bbox; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2319 GtkWidget *vbox; |
479 | 2320 GtkWidget *hbox; |
2321 GtkWidget *fbox; | |
2322 GtkWidget *frame; | |
1 | 2323 |
2324 struct findbyinfo *b = g_new0(struct findbyinfo, 1); | |
2393
a7ecfd3f7714
[gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2382
diff
changeset
|
2325 b->gc = gc; |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
2326 GAIM_DIALOG(b->window); |
4635 | 2327 gtk_window_set_resizable(GTK_WINDOW(b->window), TRUE); |
4074 | 2328 gtk_window_set_role(GTK_WINDOW(b->window), "find_info"); |
479 | 2329 |
2330 dialogwindows = g_list_prepend(dialogwindows, b->window); | |
2331 | |
2332 frame = gtk_frame_new(_("Search for Buddy")); | |
2333 fbox = gtk_vbox_new(FALSE, 5); | |
2334 | |
2335 /* Build OK Button */ | |
2336 | |
5024 | 2337 ok = gaim_pixbuf_button_from_stock(_("OK"), GTK_STOCK_OK, GAIM_BUTTON_HORIZONTAL); |
2338 cancel = gaim_pixbuf_button_from_stock(_("Cancel"), GTK_STOCK_CANCEL, GAIM_BUTTON_HORIZONTAL); | |
1 | 2339 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2340 bbox = gtk_hbox_new(FALSE, 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2341 vbox = gtk_vbox_new(FALSE, 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2342 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2343 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2344 b->firstentry = gtk_entry_new(); |
1 | 2345 b->middleentry = gtk_entry_new(); |
2346 b->lastentry = gtk_entry_new(); | |
2347 b->maidenentry = gtk_entry_new(); | |
2348 b->cityentry = gtk_entry_new(); | |
2349 b->stateentry = gtk_entry_new(); | |
2350 b->countryentry = gtk_entry_new(); | |
2351 | |
4333 | 2352 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
|
2353 gtk_box_pack_end(GTK_BOX(bbox), cancel, FALSE, FALSE, 0); |
1 | 2354 |
479 | 2355 /* Line 1 */ |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2356 label = gtk_label_new(_("First Name")); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2357 |
1185 | 2358 hbox = gtk_hbox_new(FALSE, 5); |
2359 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
2360 gtk_box_pack_end(GTK_BOX(hbox), b->firstentry, FALSE, FALSE, 0); | |
479 | 2361 |
1185 | 2362 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
479 | 2363 |
2364 /* Line 2 */ | |
1 | 2365 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2366 label = gtk_label_new(_("Middle Name")); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2367 |
1185 | 2368 hbox = gtk_hbox_new(FALSE, 5); |
2369 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
2370 gtk_box_pack_end(GTK_BOX(hbox), b->middleentry, FALSE, FALSE, 0); | |
479 | 2371 |
1185 | 2372 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
479 | 2373 |
2374 /* Line 3 */ | |
2375 | |
2376 label = gtk_label_new(_("Last Name")); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2377 |
1185 | 2378 hbox = gtk_hbox_new(FALSE, 5); |
2379 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
2380 gtk_box_pack_end(GTK_BOX(hbox), b->lastentry, FALSE, FALSE, 0); | |
479 | 2381 |
1185 | 2382 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
479 | 2383 |
2384 /* Line 4 */ | |
2385 | |
2386 label = gtk_label_new(_("Maiden Name")); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2387 |
1185 | 2388 hbox = gtk_hbox_new(FALSE, 5); |
2389 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
2390 gtk_box_pack_end(GTK_BOX(hbox), b->maidenentry, FALSE, FALSE, 0); | |
479 | 2391 |
1185 | 2392 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
479 | 2393 |
2394 /* Line 5 */ | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2395 |
479 | 2396 label = gtk_label_new(_("City")); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2397 |
1185 | 2398 hbox = gtk_hbox_new(FALSE, 5); |
2399 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
2400 gtk_box_pack_end(GTK_BOX(hbox), b->cityentry, FALSE, FALSE, 0); | |
479 | 2401 |
1185 | 2402 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
479 | 2403 |
2404 /* Line 6 */ | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2405 label = gtk_label_new(_("State")); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2406 |
1185 | 2407 hbox = gtk_hbox_new(FALSE, 5); |
2408 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
2409 gtk_box_pack_end(GTK_BOX(hbox), b->stateentry, FALSE, FALSE, 0); | |
479 | 2410 |
1185 | 2411 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
479 | 2412 |
2413 /* Line 7 */ | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2414 label = gtk_label_new(_("Country")); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2415 |
1185 | 2416 hbox = gtk_hbox_new(FALSE, 5); |
2417 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
2418 gtk_box_pack_end(GTK_BOX(hbox), b->countryentry, FALSE, FALSE, 0); | |
479 | 2419 |
1185 | 2420 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
479 | 2421 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2422 /* Merge The Boxes */ |
479 | 2423 |
2424 gtk_container_add(GTK_CONTAINER(frame), vbox); | |
1185 | 2425 gtk_box_pack_start(GTK_BOX(fbox), frame, FALSE, FALSE, 0); |
2426 gtk_box_pack_start(GTK_BOX(fbox), bbox, FALSE, FALSE, 0); | |
1 | 2427 |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2428 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
|
2429 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
|
2430 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
|
2431 |
4703 | 2432 gtk_window_set_title(GTK_WINDOW(b->window), _("Find Buddy By Info")); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2433 gtk_window_set_focus(GTK_WINDOW(b->window), b->firstentry); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2434 gtk_container_add(GTK_CONTAINER(b->window), fbox); |
4635 | 2435 gtk_container_set_border_width(GTK_CONTAINER(b->window), 5); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2436 gtk_widget_realize(b->window); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2437 |
5024 | 2438 gtk_widget_show_all(b->window); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2439 } |
1 | 2440 |
1535
1e2cc8c8bf3c
[gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
2441 void show_find_email(struct gaim_connection *gc) |
1 | 2442 { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2443 GtkWidget *label; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2444 GtkWidget *bbox; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2445 GtkWidget *vbox; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2446 GtkWidget *frame; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2447 GtkWidget *topbox; |
444 | 2448 GtkWidget *button; |
1 | 2449 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2450 struct findbyemail *b = g_new0(struct findbyemail, 1); |
1535
1e2cc8c8bf3c
[gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
2451 if (g_slist_find(connections, gc)) |
1e2cc8c8bf3c
[gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
2452 b->gc = gc; |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
2453 GAIM_DIALOG(b->window); |
4635 | 2454 gtk_window_set_resizable(GTK_WINDOW(b->window), TRUE); |
4074 | 2455 gtk_window_set_role(GTK_WINDOW(b->window), "find_email"); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2456 gtk_widget_realize(b->window); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2457 dialogwindows = g_list_prepend(dialogwindows, b->window); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2458 g_signal_connect(GTK_OBJECT(b->window), "destroy", G_CALLBACK(destroy_dialog), b->window); |
4703 | 2459 gtk_window_set_title(GTK_WINDOW(b->window), _("Find Buddy By Email")); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2460 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2461 vbox = gtk_vbox_new(FALSE, 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2462 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2463 gtk_container_add(GTK_CONTAINER(b->window), vbox); |
1185 | 2464 |
444 | 2465 frame = gtk_frame_new(_("Search for Buddy")); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2466 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2467 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2468 topbox = gtk_hbox_new(FALSE, 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2469 gtk_container_add(GTK_CONTAINER(frame), topbox); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2470 gtk_container_set_border_width(GTK_CONTAINER(topbox), 5); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2471 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2472 label = gtk_label_new(_("Email")); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2473 gtk_box_pack_start(GTK_BOX(topbox), label, FALSE, FALSE, 0); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2474 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2475 b->emailentry = gtk_entry_new(); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2476 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
|
2477 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
|
2478 gtk_window_set_focus(GTK_WINDOW(b->window), b->emailentry); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1488
diff
changeset
|
2479 |
1185 | 2480 bbox = gtk_hbox_new(FALSE, 5); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2481 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); |
444 | 2482 |
5024 | 2483 button = gaim_pixbuf_button_from_stock(_("OK"), GTK_STOCK_OK, GAIM_BUTTON_HORIZONTAL); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2484 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(do_find_email), b); |
4094 | 2485 gtk_box_pack_end(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
2486 | |
5024 | 2487 button = gaim_pixbuf_button_from_stock(_("Cancel"), GTK_STOCK_CANCEL, GAIM_BUTTON_HORIZONTAL); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2488 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(destroy_dialog), b->window); |
1185 | 2489 gtk_box_pack_end(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
2490 | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2491 gtk_widget_show_all(b->window); |
1 | 2492 } |
2493 | |
2494 /*------------------------------------------------------*/ | |
2495 /* Link Dialog */ | |
2496 /*------------------------------------------------------*/ | |
2497 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2498 void cancel_link(GtkWidget *widget, struct gaim_conversation *c) |
1 | 2499 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2500 struct gaim_gtk_conversation *gtkconv; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2501 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2502 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2503 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2504 if (gtkconv->toolbar.link) { |
4635 | 2505 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.link), |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2506 FALSE); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2507 } |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2508 |
4685 | 2509 destroy_dialog(NULL, gtkconv->dialogs.link); |
2510 gtkconv->dialogs.link = NULL; | |
1 | 2511 } |
2512 | |
4262 | 2513 void do_insert_link(GtkWidget *w, int resp, struct linkdlg *b) |
1 | 2514 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2515 struct gaim_gtk_conversation *gtkconv; |
1 | 2516 char *open_tag; |
3466 | 2517 const char *urltext, *showtext; |
4262 | 2518 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2519 gtkconv = GAIM_GTK_CONVERSATION(b->c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2520 |
4262 | 2521 if (resp == GTK_RESPONSE_OK) { |
2522 | |
2523 open_tag = g_malloc(2048); | |
2524 | |
2525 urltext = gtk_entry_get_text(GTK_ENTRY(b->url)); | |
2526 showtext = gtk_entry_get_text(GTK_ENTRY(b->text)); | |
2527 | |
2528 if (!strlen(showtext)) | |
2529 showtext = urltext; | |
2530 | |
2531 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
|
2532 gaim_gtk_surround(gtkconv, open_tag, "</A>"); |
4262 | 2533 |
2534 g_free(open_tag); | |
2535 } | |
2536 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2537 if (gtkconv->toolbar.link) { |
4635 | 2538 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.link), |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2539 FALSE); |
4262 | 2540 } |
2541 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2542 gtkconv->dialogs.link = NULL; |
1 | 2543 destroy_dialog(NULL, b->window); |
2544 } | |
2545 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2546 void show_insert_link(GtkWidget *linky, struct gaim_conversation *c) |
1 | 2547 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2548 struct gaim_gtk_conversation *gtkconv; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2549 struct gaim_gtk_window *gtkwin; |
4262 | 2550 GtkWidget *table; |
2551 GtkWidget *label; | |
2552 GtkWidget *hbox; | |
1 | 2553 GtkWidget *vbox; |
2554 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2555 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2556 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(c)); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2557 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2558 if (gtkconv->dialogs.link == NULL) { |
4262 | 2559 struct linkdlg *a = g_new0(struct linkdlg, 1); |
5024 | 2560 GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG); |
4262 | 2561 |
2562 a->c = c; | |
4703 | 2563 a->window = gtk_dialog_new_with_buttons(_("Insert Link"), |
5092 | 2564 GTK_WINDOW(gtkwin->window), 0, GTK_STOCK_CANCEL, |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2565 GTK_RESPONSE_CANCEL, _("Insert"), GTK_RESPONSE_OK, NULL); |
4262 | 2566 |
2567 gtk_dialog_set_default_response(GTK_DIALOG(a->window), GTK_RESPONSE_OK); | |
2568 gtk_container_set_border_width(GTK_CONTAINER(a->window), 6); | |
2569 gtk_window_set_resizable(GTK_WINDOW(a->window), FALSE); | |
2570 gtk_dialog_set_has_separator(GTK_DIALOG(a->window), FALSE); | |
2571 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
|
2572 gtk_container_set_border_width( |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2573 GTK_CONTAINER(GTK_DIALOG(a->window)->vbox), 6); |
4262 | 2574 gtk_window_set_role(GTK_WINDOW(a->window), "insert_link"); |
2575 | |
2576 hbox = gtk_hbox_new(FALSE, 12); | |
2577 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(a->window)->vbox), hbox); | |
2578 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
2579 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
2580 | |
2581 vbox = gtk_vbox_new(FALSE, 0); | |
2582 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
2583 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2584 label = gtk_label_new(_("Please enter the URL and description of " |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2585 "the link that you want to insert. The " |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2586 "description is optional.\n")); |
4262 | 2587 |
2588 gtk_widget_set_size_request(GTK_WIDGET(label), 335, -1); | |
2589 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
2590 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
2591 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
2592 | |
2593 hbox = gtk_hbox_new(FALSE, 6); | |
2594 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
2595 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2596 g_signal_connect(G_OBJECT(a->window), "destroy", |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2597 G_CALLBACK(destroy_dialog), a->window); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2598 g_signal_connect(G_OBJECT(a->window), "destroy", |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2599 G_CALLBACK(free_dialog), a); |
4262 | 2600 dialogwindows = g_list_prepend(dialogwindows, a->window); |
2601 | |
2602 table = gtk_table_new(4, 2, FALSE); | |
2603 gtk_table_set_row_spacings(GTK_TABLE(table), 5); | |
2604 gtk_table_set_col_spacings(GTK_TABLE(table), 5); | |
2605 gtk_container_set_border_width(GTK_CONTAINER(table), 0); | |
2606 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); | |
2607 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2608 label = gtk_label_new(_("URL")); |
4262 | 2609 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
2610 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); | |
2611 | |
2612 a->url = gtk_entry_new(); | |
2613 gtk_table_attach_defaults(GTK_TABLE(table), a->url, 1, 2, 0, 1); | |
2614 gtk_widget_grab_focus(a->url); | |
2615 | |
2616 gtk_entry_set_activates_default (GTK_ENTRY(a->url), TRUE); | |
2617 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2618 label = gtk_label_new(_("Description")); |
4262 | 2619 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
2620 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); | |
2621 | |
2622 a->text = gtk_entry_new(); | |
2623 gtk_table_attach_defaults(GTK_TABLE(table), a->text, 1, 2, 1, 2); | |
2624 gtk_entry_set_activates_default (GTK_ENTRY(a->text), TRUE); | |
2625 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2626 g_signal_connect(G_OBJECT(a->window), "response", |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2627 G_CALLBACK(do_insert_link), a); |
4262 | 2628 |
2629 a->toggle = linky; | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2630 gtkconv->dialogs.link = a->window; |
1 | 2631 } |
2632 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2633 gtk_widget_show_all(gtkconv->dialogs.link); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2634 gdk_window_raise(gtkconv->dialogs.link->window); |
1 | 2635 } |
2636 | |
2637 /*------------------------------------------------------*/ | |
2638 /* Color Selection Dialog */ | |
2639 /*------------------------------------------------------*/ | |
2640 | |
3367 | 2641 GtkWidget *fgcseld = NULL; |
2642 GtkWidget *bgcseld = NULL; | |
657
4bbc103a3294
[gaim-migrate @ 667]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
654
diff
changeset
|
2643 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2644 void cancel_fgcolor(GtkWidget *widget, struct gaim_conversation *c) |
1 | 2645 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2646 struct gaim_gtk_conversation *gtkconv; |
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 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2649 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2650 if (gtkconv->toolbar.fgcolor && widget) { |
4635 | 2651 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.fgcolor), |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2652 FALSE); |
61 | 2653 } |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2654 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2655 dialogwindows = g_list_remove(dialogwindows, gtkconv->dialogs.fg_color); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2656 gtk_widget_destroy(gtkconv->dialogs.fg_color); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2657 gtkconv->dialogs.fg_color = NULL; |
1 | 2658 } |
2659 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2660 void cancel_bgcolor(GtkWidget *widget, struct gaim_conversation *c) |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
2661 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2662 struct gaim_gtk_conversation *gtkconv; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2663 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2664 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2665 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2666 if (gtkconv->toolbar.bgcolor && widget) { |
4635 | 2667 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.bgcolor), |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2668 FALSE); |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
2669 } |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2670 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2671 dialogwindows = g_list_remove(dialogwindows, gtkconv->dialogs.bg_color); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2672 gtk_widget_destroy(gtkconv->dialogs.bg_color); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2673 gtkconv->dialogs.bg_color = NULL; |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
2674 } |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
2675 |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
2676 void do_fgcolor(GtkWidget *widget, GtkColorSelection *colorsel) |
1 | 2677 { |
2678 GdkColor text_color; | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2679 struct gaim_conversation *c; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2680 struct gaim_gtk_conversation *gtkconv; |
1 | 2681 char *open_tag; |
2682 | |
2683 open_tag = g_malloc(30); | |
2684 | |
3557 | 2685 gtk_color_selection_get_current_color(colorsel, &text_color); |
1 | 2686 |
4635 | 2687 c = g_object_get_data(G_OBJECT(colorsel), "gaim_conversation"); |
411
a330017b3aa4
[gaim-migrate @ 421]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
401
diff
changeset
|
2688 /* GTK_IS_EDITABLE(c->entry); huh? */ |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2689 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2690 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2691 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2692 gtkconv->fg_color = text_color; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2693 g_snprintf(open_tag, 23, "<FONT COLOR=\"#%02X%02X%02X\">", |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2694 text_color.red / 256, |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2695 text_color.green / 256, |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2696 text_color.blue / 256); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2697 gaim_gtk_surround(gtkconv, open_tag, "</FONT>"); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2698 debug_printf("#%02X%02X%02X\n", |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2699 text_color.red / 256, |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2700 text_color.green / 256, |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2701 text_color.blue / 256); |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2702 g_free(open_tag); |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
2703 cancel_fgcolor(NULL, c); |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
2704 } |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
2705 |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
2706 void do_bgcolor(GtkWidget *widget, GtkColorSelection *colorsel) |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
2707 { |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
2708 GdkColor text_color; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2709 struct gaim_conversation *c; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2710 struct gaim_gtk_conversation *gtkconv; |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
2711 char *open_tag; |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
2712 |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
2713 open_tag = g_malloc(30); |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
2714 |
3557 | 2715 gtk_color_selection_get_current_color(colorsel, &text_color); |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
2716 |
4635 | 2717 c = g_object_get_data(G_OBJECT(colorsel), "gaim_conversation"); |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
2718 /* GTK_IS_EDITABLE(c->entry); huh? */ |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
2719 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2720 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2721 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2722 gtkconv->bg_color = text_color; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2723 g_snprintf(open_tag, 25, "<BODY BGCOLOR=\"#%02X%02X%02X\">", |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2724 text_color.red / 256, |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2725 text_color.green / 256, |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2726 text_color.blue / 256); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2727 gaim_gtk_surround(gtkconv, open_tag, "</BODY>"); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2728 debug_printf("#%02X%02X%02X\n", |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2729 text_color.red / 256, |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2730 text_color.green / 256, |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2731 text_color.blue / 256); |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
2732 g_free(open_tag); |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
2733 cancel_bgcolor(NULL, c); |
1 | 2734 } |
2735 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2736 void show_fgcolor_dialog(struct gaim_conversation *c, GtkWidget *color) |
1 | 2737 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2738 struct gaim_gtk_conversation *gtkconv; |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2739 GtkWidget *colorsel; |
1 | 2740 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2741 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2742 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2743 if (color == NULL) { /* we came from the prefs */ |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2744 if (fgcseld) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2745 return; |
2209
9b8b32ae3b41
[gaim-migrate @ 2219]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2143
diff
changeset
|
2746 |
657
4bbc103a3294
[gaim-migrate @ 667]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
654
diff
changeset
|
2747 fgcseld = gtk_color_selection_dialog_new(_("Select Text Color")); |
4198 | 2748 gtk_color_selection_set_current_color(GTK_COLOR_SELECTION |
2749 (GTK_COLOR_SELECTION_DIALOG(fgcseld)->colorsel), &fgcolor); | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2750 g_signal_connect(GTK_OBJECT(fgcseld), "delete_event", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2751 G_CALLBACK(destroy_colorsel), (void *)1); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2752 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
|
2753 "clicked", G_CALLBACK(destroy_colorsel), (void *)1); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2754 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
|
2755 G_CALLBACK(apply_color_dlg), (void *)1); |
657
4bbc103a3294
[gaim-migrate @ 667]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
654
diff
changeset
|
2756 gtk_widget_realize(fgcseld); |
4bbc103a3294
[gaim-migrate @ 667]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
654
diff
changeset
|
2757 gtk_widget_show(fgcseld); |
4bbc103a3294
[gaim-migrate @ 667]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
654
diff
changeset
|
2758 gdk_window_raise(fgcseld->window); |
4bbc103a3294
[gaim-migrate @ 667]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
654
diff
changeset
|
2759 return; |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
2760 } |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
2761 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2762 if (!gtkconv->dialogs.fg_color) { |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2763 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2764 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
|
2765 colorsel = GTK_COLOR_SELECTION_DIALOG(gtkconv->dialogs.fg_color)->colorsel; |
4198 | 2766 gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(colorsel), &fgcolor); |
4635 | 2767 g_object_set_data(G_OBJECT(colorsel), "gaim_conversation", c); |
2209
9b8b32ae3b41
[gaim-migrate @ 2219]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2143
diff
changeset
|
2768 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2769 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
|
2770 G_CALLBACK(delete_event_dialog), c); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2771 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
|
2772 "clicked", G_CALLBACK(do_fgcolor), colorsel); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2773 g_signal_connect(GTK_OBJECT |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2774 (GTK_COLOR_SELECTION_DIALOG(gtkconv->dialogs.fg_color)->cancel_button), |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2775 "clicked", G_CALLBACK(cancel_fgcolor), c); |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
2776 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2777 gtk_widget_realize(gtkconv->dialogs.fg_color); |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
2778 } |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
2779 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2780 gtk_widget_show(gtkconv->dialogs.fg_color); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2781 gdk_window_raise(gtkconv->dialogs.fg_color->window); |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
2782 } |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
2783 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2784 void show_bgcolor_dialog(struct gaim_conversation *c, GtkWidget *color) |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
2785 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2786 struct gaim_gtk_conversation *gtkconv; |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
2787 GtkWidget *colorsel; |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
2788 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2789 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2790 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2791 if (color == NULL) { /* we came from the prefs */ |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2792 if (bgcseld) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2793 return; |
2209
9b8b32ae3b41
[gaim-migrate @ 2219]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2143
diff
changeset
|
2794 |
657
4bbc103a3294
[gaim-migrate @ 667]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
654
diff
changeset
|
2795 bgcseld = gtk_color_selection_dialog_new(_("Select Background Color")); |
4198 | 2796 gtk_color_selection_set_current_color(GTK_COLOR_SELECTION |
2797 (GTK_COLOR_SELECTION_DIALOG(bgcseld)->colorsel), &bgcolor); | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2798 g_signal_connect(GTK_OBJECT(bgcseld), "delete_event", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2799 G_CALLBACK(destroy_colorsel), NULL); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2800 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
|
2801 "clicked", G_CALLBACK(destroy_colorsel), NULL); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2802 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
|
2803 G_CALLBACK(apply_color_dlg), (void *)2); |
657
4bbc103a3294
[gaim-migrate @ 667]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
654
diff
changeset
|
2804 gtk_widget_realize(bgcseld); |
4bbc103a3294
[gaim-migrate @ 667]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
654
diff
changeset
|
2805 gtk_widget_show(bgcseld); |
4bbc103a3294
[gaim-migrate @ 667]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
654
diff
changeset
|
2806 gdk_window_raise(bgcseld->window); |
4bbc103a3294
[gaim-migrate @ 667]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
654
diff
changeset
|
2807 return; |
4bbc103a3294
[gaim-migrate @ 667]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
654
diff
changeset
|
2808 } |
4bbc103a3294
[gaim-migrate @ 667]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
654
diff
changeset
|
2809 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2810 if (!gtkconv->dialogs.bg_color) { |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2811 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2812 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
|
2813 colorsel = GTK_COLOR_SELECTION_DIALOG(gtkconv->dialogs.bg_color)->colorsel; |
4198 | 2814 gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(colorsel), &bgcolor); |
4635 | 2815 g_object_set_data(G_OBJECT(colorsel), "gaim_conversation", c); |
2209
9b8b32ae3b41
[gaim-migrate @ 2219]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2143
diff
changeset
|
2816 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2817 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
|
2818 G_CALLBACK(delete_event_dialog), c); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2819 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
|
2820 "clicked", G_CALLBACK(do_bgcolor), colorsel); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2821 g_signal_connect(GTK_OBJECT |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2822 (GTK_COLOR_SELECTION_DIALOG(gtkconv->dialogs.bg_color)->cancel_button), |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2823 "clicked", G_CALLBACK(cancel_bgcolor), c); |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
854
diff
changeset
|
2824 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2825 gtk_widget_realize(gtkconv->dialogs.bg_color); |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2826 } |
1 | 2827 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2828 gtk_widget_show(gtkconv->dialogs.bg_color); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2829 gdk_window_raise(gtkconv->dialogs.bg_color->window); |
1 | 2830 } |
2831 | |
2832 /*------------------------------------------------------------------------*/ | |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2833 /* Font Selection Dialog */ |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2834 /*------------------------------------------------------------------------*/ |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2835 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2836 void cancel_font(GtkWidget *widget, struct gaim_conversation *c) |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2837 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2838 struct gaim_gtk_conversation *gtkconv; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2839 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2840 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2841 |
4685 | 2842 if (gtkconv->toolbar.font && widget) { |
4635 | 2843 gtk_toggle_button_set_active( |
4685 | 2844 GTK_TOGGLE_BUTTON(gtkconv->toolbar.font), FALSE); |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2845 } |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2846 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2847 dialogwindows = g_list_remove(dialogwindows, gtkconv->dialogs.font); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2848 gtk_widget_destroy(gtkconv->dialogs.font); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2849 gtkconv->dialogs.font = NULL; |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2850 } |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2851 |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2852 void apply_font(GtkWidget *widget, GtkFontSelection *fontsel) |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2853 { |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2854 /* this could be expanded to include font size, weight, etc. |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2855 but for now only works with font face */ |
3473 | 2856 int i = 0; |
666
71ea550c22ac
[gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
657
diff
changeset
|
2857 char *fontname; |
4635 | 2858 struct gaim_conversation *c = g_object_get_data(G_OBJECT(fontsel), |
2859 "gaim_conversation"); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2860 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2861 if (c) { |
666
71ea550c22ac
[gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
657
diff
changeset
|
2862 fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(fontsel)); |
4635 | 2863 while(fontname[i] && !isdigit(fontname[i])) { |
3473 | 2864 i++; |
2865 } | |
2866 fontname[i] = 0; | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2867 gaim_gtk_set_font_face(GAIM_GTK_CONVERSATION(c), fontname); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2868 } else { |
334
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2869 fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(fontsel)); |
3473 | 2870 while(fontface[i] && !isdigit(fontname[i]) && i < sizeof(fontface)) { |
2871 fontface[i] = fontname[i]; | |
2872 i++; | |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2873 } |
3473 | 2874 fontface[i] = 0; |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2875 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2876 |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2877 cancel_font(NULL, c); |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2878 } |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2879 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2880 void destroy_fontsel(GtkWidget *w, gpointer d) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2881 { |
334
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2882 gtk_widget_destroy(fontseld); |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2883 fontseld = NULL; |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2884 } |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2885 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2886 void show_font_dialog(struct gaim_conversation *c, GtkWidget *font) |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2887 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2888 struct gaim_gtk_conversation *gtkconv; |
3473 | 2889 char fonttif[128]; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2890 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2891 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2892 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2893 if (!font) { /* we came from the prefs dialog */ |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2894 if (fontseld) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2895 return; |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2896 fontseld = gtk_font_selection_dialog_new(_("Select Font")); |
3473 | 2897 if (fontface[0]) { |
2898 g_snprintf(fonttif, sizeof(fonttif), "%s 12", fontface); | |
2763
477a035d81e5
[gaim-migrate @ 2776]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2761
diff
changeset
|
2899 gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(fontseld), |
3473 | 2900 fonttif); |
2763
477a035d81e5
[gaim-migrate @ 2776]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2761
diff
changeset
|
2901 } else { |
477a035d81e5
[gaim-migrate @ 2776]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2761
diff
changeset
|
2902 gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(fontseld), |
3473 | 2903 DEFAULT_FONT_FACE " 12"); |
2763
477a035d81e5
[gaim-migrate @ 2776]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2761
diff
changeset
|
2904 } |
334
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2905 |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2906 g_signal_connect(GTK_OBJECT(fontseld), "delete_event", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2907 G_CALLBACK(destroy_fontsel), NULL); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2908 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
|
2909 "clicked", G_CALLBACK(destroy_fontsel), NULL); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2910 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
|
2911 G_CALLBACK(apply_font_dlg), fontseld); |
334
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2912 gtk_widget_realize(fontseld); |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2913 gtk_widget_show(fontseld); |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2914 gdk_window_raise(fontseld->window); |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2915 return; |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2916 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2917 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2918 if (!gtkconv->dialogs.font) { |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2919 gtkconv->dialogs.font = gtk_font_selection_dialog_new(_("Select Font")); |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2920 |
4635 | 2921 g_object_set_data(G_OBJECT(gtkconv->dialogs.font), "gaim_conversation", c); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2922 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2923 if (gtkconv->fontface[0]) { |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2924 g_snprintf(fonttif, sizeof(fonttif), "%s 12", gtkconv->fontface); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2925 gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(gtkconv->dialogs.font), |
3473 | 2926 fonttif); |
2763
477a035d81e5
[gaim-migrate @ 2776]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2761
diff
changeset
|
2927 } else { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2928 gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(gtkconv->dialogs.font), |
3473 | 2929 DEFAULT_FONT_FACE); |
2763
477a035d81e5
[gaim-migrate @ 2776]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2761
diff
changeset
|
2930 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2931 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2932 g_signal_connect(GTK_OBJECT(gtkconv->dialogs.font), "delete_event", |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
2933 G_CALLBACK(delete_event_dialog), c); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2934 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
|
2935 "clicked", G_CALLBACK(apply_font), gtkconv->dialogs.font); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2936 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
|
2937 "clicked", G_CALLBACK(cancel_font), c); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2938 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2939 gtk_widget_realize(gtkconv->dialogs.font); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2940 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2941 } |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2942 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2943 gtk_widget_show(gtkconv->dialogs.font); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
2944 gdk_window_raise(gtkconv->dialogs.font->window); |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2945 } |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2946 |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2947 /*------------------------------------------------------------------------*/ |
1 | 2948 /* The dialog for new away messages */ |
2949 /*------------------------------------------------------------------------*/ | |
2950 | |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
2951 static struct away_message *save_away_message(struct create_away *ca) |
717 | 2952 { |
2953 struct away_message *am; | |
2954 gchar *away_message; | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2955 |
832
0142b4c66394
[gaim-migrate @ 842]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
825
diff
changeset
|
2956 if (!ca->mess) |
0142b4c66394
[gaim-migrate @ 842]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
825
diff
changeset
|
2957 am = g_new0(struct away_message, 1); |
2851
6eb5bf5089f0
[gaim-migrate @ 2864]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2827
diff
changeset
|
2958 else { |
832
0142b4c66394
[gaim-migrate @ 842]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
825
diff
changeset
|
2959 am = ca->mess; |
2851
6eb5bf5089f0
[gaim-migrate @ 2864]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2827
diff
changeset
|
2960 } |
1387 | 2961 |
4119 | 2962 |
717 | 2963 g_snprintf(am->name, sizeof(am->name), "%s", gtk_entry_get_text(GTK_ENTRY(ca->entry))); |
4119 | 2964 away_message = gtk_text_view_get_text(GTK_TEXT_VIEW(ca->text), FALSE); |
717 | 2965 |
2966 g_snprintf(am->message, sizeof(am->message), "%s", away_message); | |
2967 g_free(away_message); | |
2968 | |
832
0142b4c66394
[gaim-migrate @ 842]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
825
diff
changeset
|
2969 if (!ca->mess) { |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
2970 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
|
2971 } |
0142b4c66394
[gaim-migrate @ 842]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
825
diff
changeset
|
2972 |
717 | 2973 save_prefs(); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2974 do_away_menu(); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2975 |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
2976 return am; |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
2977 } |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
2978 |
1387 | 2979 int check_away_mess(struct create_away *ca, int type) |
2980 { | |
4630 | 2981 char *msg; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
2982 if ((strlen(gtk_entry_get_text(GTK_ENTRY(ca->entry))) == 0) && (type == 1)) { |
1387 | 2983 /* We shouldn't allow a blank title */ |
3427 | 2984 do_error_dialog(_("You cannot save an away message with a blank title"), |
2985 _("Please give the message a title, or choose \"Make Away\" to use " | |
2986 "without saving."), GAIM_ERROR); | |
1387 | 2987 return 0; |
2988 } | |
2989 | |
4630 | 2990 msg = gtk_text_view_get_text(GTK_TEXT_VIEW(ca->text), FALSE); |
2991 | |
2992 if (!msg && (type <= 1)) { | |
1387 | 2993 /* We shouldn't allow a blank message */ |
3427 | 2994 do_error_dialog(_("You cannot create an empty away message"), NULL, GAIM_ERROR); |
1387 | 2995 return 0; |
2996 } | |
2997 | |
4630 | 2998 g_free(msg); |
2999 | |
1387 | 3000 return 1; |
3001 } | |
3002 | |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3003 void save_away_mess(GtkWidget *widget, struct create_away *ca) |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3004 { |
1387 | 3005 if (!check_away_mess(ca, 1)) |
3006 return; | |
3007 | |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3008 save_away_message(ca); |
717 | 3009 destroy_dialog(NULL, ca->window); |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3010 g_free(ca); |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3011 } |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3012 |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3013 void use_away_mess(GtkWidget *widget, struct create_away *ca) |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3014 { |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3015 static struct away_message am; |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3016 gchar *away_message; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3017 |
1387 | 3018 if (!check_away_mess(ca, 0)) |
3019 return; | |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3020 |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3021 g_snprintf(am.name, sizeof(am.name), "%s", gtk_entry_get_text(GTK_ENTRY(ca->entry))); |
4119 | 3022 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
|
3023 |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3024 g_snprintf(am.message, sizeof(am.message), "%s", away_message); |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3025 g_free(away_message); |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3026 |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3027 do_away_message(NULL, &am); |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3028 |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3029 destroy_dialog(NULL, ca->window); |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3030 g_free(ca); |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3031 } |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3032 |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3033 void su_away_mess(GtkWidget *widget, struct create_away *ca) |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3034 { |
1387 | 3035 if (!check_away_mess(ca, 1)) |
3036 return; | |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3037 do_away_message(NULL, save_away_message(ca)); |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3038 destroy_dialog(NULL, ca->window); |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3039 g_free(ca); |
717 | 3040 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3041 |
1 | 3042 void create_away_mess(GtkWidget *widget, void *dummy) |
3043 { | |
439 | 3044 GtkWidget *hbox; |
1 | 3045 GtkWidget *titlebox; |
3046 GtkWidget *tbox; | |
3047 GtkWidget *label; | |
439 | 3048 GtkWidget *frame; |
3049 GtkWidget *fbox; | |
441 | 3050 GtkWidget *button; |
1 | 3051 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3052 struct create_away *ca = g_new0(struct create_away, 1); |
1185 | 3053 |
1 | 3054 /* Set up window */ |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
3055 GAIM_DIALOG(ca->window); |
4635 | 3056 gtk_widget_set_size_request(ca->window, -1, 250); |
3057 gtk_container_set_border_width(GTK_CONTAINER(ca->window), 5); | |
4074 | 3058 gtk_window_set_role(GTK_WINDOW(ca->window), "away_mess"); |
4703 | 3059 gtk_window_set_title(GTK_WINDOW(ca->window), _("New away message")); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3060 g_signal_connect(GTK_OBJECT(ca->window), "delete_event", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3061 G_CALLBACK(destroy_dialog), ca->window); |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3062 gtk_widget_realize(ca->window); |
1185 | 3063 |
3064 tbox = gtk_vbox_new(FALSE, 5); | |
3065 gtk_container_add(GTK_CONTAINER(ca->window), tbox); | |
439 | 3066 |
3067 frame = gtk_frame_new(_("New away message")); | |
1185 | 3068 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
|
3069 |
1172 | 3070 fbox = gtk_vbox_new(FALSE, 5); |
1224
0bbe3aaa6a3e
[gaim-migrate @ 1234]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1216
diff
changeset
|
3071 gtk_container_set_border_width(GTK_CONTAINER(fbox), 5); |
1185 | 3072 gtk_container_add(GTK_CONTAINER(frame), fbox); |
3073 | |
3074 titlebox = gtk_hbox_new(FALSE, 5); | |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3075 gtk_box_pack_start(GTK_BOX(fbox), titlebox, FALSE, FALSE, 0); |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3076 |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
3077 label = gtk_label_new(_("Away title: ")); |
1172 | 3078 gtk_box_pack_start(GTK_BOX(titlebox), label, FALSE, FALSE, 0); |
1185 | 3079 |
1 | 3080 ca->entry = gtk_entry_new(); |
1172 | 3081 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
|
3082 gtk_widget_grab_focus(ca->entry); |
1 | 3083 |
4119 | 3084 frame = gtk_frame_new(NULL); |
3085 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN); | |
3086 gtk_box_pack_start(GTK_BOX(fbox), frame, TRUE, TRUE, 0); | |
5024 | 3087 |
4119 | 3088 ca->text = gtk_text_view_new(); |
5105 | 3089 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(ca->text), GTK_WRAP_WORD_CHAR); |
5024 | 3090 |
4119 | 3091 gtk_container_add(GTK_CONTAINER(frame), ca->text); |
5024 | 3092 |
3374 | 3093 if (dummy) { |
3094 struct away_message *amt; | |
3095 GtkTreeIter iter; | |
3096 int pos = 0; | |
3097 GtkListStore *ls = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(dummy))); | |
3098 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(dummy)); | |
3099 GValue val = { 0, }; | |
4119 | 3100 GtkTextIter start; |
3101 GtkTextBuffer *buffer; | |
3374 | 3102 |
3716
d7e83b4db191
[gaim-migrate @ 3849]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3671
diff
changeset
|
3103 if (! gtk_tree_selection_get_selected (sel, (GtkTreeModel**)&ls, &iter)) |
3374 | 3104 return; |
3716
d7e83b4db191
[gaim-migrate @ 3849]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3671
diff
changeset
|
3105 gtk_tree_model_get_value (GTK_TREE_MODEL(ls), &iter, 1, &val); |
3374 | 3106 amt = g_value_get_pointer (&val); |
3107 gtk_entry_set_text(GTK_ENTRY(ca->entry), amt->name); | |
4119 | 3108 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(ca->text)); |
3109 gtk_text_buffer_get_iter_at_offset(buffer, &start, pos); | |
3110 gtk_text_buffer_insert(buffer, &start, amt->message, strlen(amt->message)); | |
3111 | |
3374 | 3112 ca->mess = amt; |
3113 } | |
832
0142b4c66394
[gaim-migrate @ 842]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
825
diff
changeset
|
3114 |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3115 hbox = gtk_hbox_new(FALSE, 5); |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
3116 gtk_box_pack_start(GTK_BOX(tbox), hbox, FALSE, FALSE, 0); |
5024 | 3117 |
3118 button = gaim_pixbuf_button_from_stock(_("Save"), GTK_STOCK_SAVE, GAIM_BUTTON_HORIZONTAL); | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3119 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(save_away_mess), ca); |
4092 | 3120 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); |
3121 | |
5024 | 3122 button = gaim_pixbuf_button_from_stock(_("Save & Use"), GTK_STOCK_OK, GAIM_BUTTON_HORIZONTAL); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3123 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
|
3124 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
|
3125 |
5024 | 3126 button = gaim_pixbuf_button_from_stock(_("Use"), GTK_STOCK_EXECUTE, GAIM_BUTTON_HORIZONTAL); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3127 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
|
3128 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
|
3129 |
5024 | 3130 button = gaim_pixbuf_button_from_stock(_("Cancel"), GTK_STOCK_CANCEL, GAIM_BUTTON_HORIZONTAL); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3131 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
|
3132 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
|
3133 |
5024 | 3134 gtk_widget_show_all(ca->window); |
1 | 3135 } |
555 | 3136 |
3137 /* smiley dialog */ | |
3138 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3139 void close_smiley_dialog(GtkWidget *widget, struct gaim_conversation *c) |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3140 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3141 struct gaim_gtk_conversation *gtkconv; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3142 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3143 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3144 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3145 if (gtkconv->toolbar.smiley) { |
4635 | 3146 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.smiley), |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3147 FALSE); |
570 | 3148 } |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3149 dialogwindows = g_list_remove(dialogwindows, gtkconv->dialogs.smiley); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3150 gtk_widget_destroy(gtkconv->dialogs.smiley); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3151 gtkconv->dialogs.smiley = NULL; |
555 | 3152 } |
3153 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3154 void insert_smiley_text(GtkWidget *widget, struct gaim_conversation *c) |
555 | 3155 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3156 struct gaim_gtk_conversation *gtkconv; |
4667 | 3157 char *smiley_text = g_object_get_data(G_OBJECT(widget), "smiley_text"); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3158 |
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 |
4667 | 3161 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, smiley_text, -1); |
555 | 3162 close_smiley_dialog(NULL, c); |
3163 } | |
579
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
3164 |
4667 | 3165 static void add_smiley(struct gaim_conversation *c, GtkWidget *table, int row, int col, char *filename, char *face) |
4034 | 3166 { |
4061
890b4f1318df
[gaim-migrate @ 4271]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4060
diff
changeset
|
3167 GtkWidget *image; |
4034 | 3168 GtkWidget *button; |
4667 | 3169 struct gaim_gtk_conversation *gtkconv = GAIM_GTK_CONVERSATION(c); |
3170 | |
3171 image = gtk_image_new_from_file(filename); | |
3172 button = gtk_button_new(); | |
3173 gtk_container_add(GTK_CONTAINER(button), image); | |
3174 g_object_set_data(G_OBJECT(button), "smiley_text", face); | |
3175 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(insert_smiley_text), c); | |
3176 | |
3177 gtk_tooltips_set_tip(gtkconv->tooltips, button, face, NULL); | |
3178 | |
3179 gtk_table_attach_defaults(GTK_TABLE(table), button, col, col+1, row, row+1); | |
4034 | 3180 |
3181 /* these look really weird with borders */ | |
3182 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
4667 | 3183 |
3184 gtk_widget_show(button); | |
3185 } | |
3186 | |
3187 static gboolean smiley_is_unique(GSList *list, GtkIMHtmlSmiley *smiley) { | |
3188 while(list) { | |
3189 GtkIMHtmlSmiley *cur = list->data; | |
3190 if(!strcmp(cur->file, smiley->file)) | |
3191 return FALSE; | |
3192 list = list->next; | |
3193 } | |
3194 return TRUE; | |
4034 | 3195 } |
3196 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3197 void show_smiley_dialog(struct gaim_conversation *c, GtkWidget *widget) |
555 | 3198 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3199 struct gaim_gtk_conversation *gtkconv; |
555 | 3200 GtkWidget *dialog; |
4667 | 3201 GtkWidget *smiley_table = NULL; |
3202 GSList *smileys, *unique_smileys = NULL; | |
3203 int width; | |
3204 int row = 0, col = 0; | |
555 | 3205 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3206 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3207 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3208 if (gtkconv->dialogs.smiley) |
558
f1b8f03db83f
[gaim-migrate @ 568]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
555
diff
changeset
|
3209 return; |
579
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
3210 |
4667 | 3211 if(c->account) |
3212 smileys = get_proto_smileys(c->account->protocol); | |
3213 else | |
3214 smileys = get_proto_smileys(DEFAULT_PROTO); | |
3215 | |
3216 while(smileys) { | |
3217 GtkIMHtmlSmiley *smiley = smileys->data; | |
3218 if(!smiley->hidden) { | |
3219 if(smiley_is_unique(unique_smileys, smiley)) | |
3220 unique_smileys = g_slist_append(unique_smileys, smiley); | |
3221 } | |
3222 smileys = smileys->next; | |
3223 } | |
3224 | |
3225 | |
3226 width = floor(sqrt(g_slist_length(unique_smileys))); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3227 |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
3228 GAIM_DIALOG(dialog); |
4635 | 3229 gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); |
4074 | 3230 gtk_window_set_role(GTK_WINDOW(dialog), "smiley_dialog"); |
934 | 3231 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
|
3232 |
4667 | 3233 smiley_table = gtk_table_new(width, width, TRUE); |
555 | 3234 |
3235 /* pack buttons */ | |
4667 | 3236 |
3237 while(unique_smileys) { | |
3238 GtkIMHtmlSmiley *smiley = unique_smileys->data; | |
3239 if(!smiley->hidden) { | |
3240 add_smiley(c, smiley_table, row, col, smiley->file, smiley->smile); | |
3241 if(++col >= width) { | |
3242 col = 0; | |
3243 row++; | |
3244 } | |
3245 } | |
3246 unique_smileys = unique_smileys->next; | |
3247 } | |
3248 | |
3249 gtk_container_add(GTK_CONTAINER(dialog), smiley_table); | |
3250 | |
3251 gtk_widget_show(smiley_table); | |
3252 | |
579
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
3253 gtk_container_set_border_width(GTK_CONTAINER(dialog), 5); |
555 | 3254 |
605 | 3255 /* connect signals */ |
4635 | 3256 g_object_set_data(G_OBJECT(dialog), "dialog_type", "smiley dialog"); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3257 g_signal_connect(G_OBJECT(dialog), "delete_event", |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3258 G_CALLBACK(delete_event_dialog), c); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3259 |
555 | 3260 /* show everything */ |
567
102afb84ce45
[gaim-migrate @ 577]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
558
diff
changeset
|
3261 gtk_window_set_title(GTK_WINDOW(dialog), _("Smile!")); |
584 | 3262 gtk_widget_show_all(dialog); |
555 | 3263 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
3264 gtkconv->dialogs.smiley = dialog; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3265 |
555 | 3266 return; |
558
f1b8f03db83f
[gaim-migrate @ 568]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
555
diff
changeset
|
3267 } |
710
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
699
diff
changeset
|
3268 |
5050
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3269 static void |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3270 do_alias_buddy(GtkWidget *w, int resp, struct alias_dialog_info *info) |
710
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
699
diff
changeset
|
3271 { |
5050
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3272 if (resp == GTK_RESPONSE_OK) { |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3273 const char *alias; |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3274 |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3275 alias = gtk_entry_get_text(GTK_ENTRY(info->alias_entry)); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3276 |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3277 gaim_blist_alias_buddy(info->buddy, (alias && *alias) ? alias : NULL); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3278 serv_alias_buddy(info->buddy); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3279 gaim_blist_save(); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3280 } |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3281 |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3282 destroy_dialog(NULL, alias_dialog); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3283 alias_dialog = NULL; |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3284 |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3285 g_free(info); |
1397
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3286 } |
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3287 |
5050
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3288 void |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3289 alias_dialog_bud(struct buddy *b) |
1397
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3290 { |
5050
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3291 struct alias_dialog_info *info = NULL; |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3292 struct gaim_gtk_buddy_list *gtkblist; |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3293 GtkWidget *hbox; |
1397
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3294 GtkWidget *vbox; |
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3295 GtkWidget *label; |
5050
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3296 GtkWidget *table; |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3297 GtkWidget *img; |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3298 |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3299 gtkblist = GAIM_GTK_BLIST(gaim_get_blist()); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3300 |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3301 if (!alias_dialog) { |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3302 info = g_new0(struct alias_dialog_info, 1); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3303 info->buddy = b; |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3304 |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3305 alias_dialog = gtk_dialog_new_with_buttons(_("Alias Buddy"), |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3306 (gtkblist ? GTK_WINDOW(gtkblist->window) : NULL), |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3307 GTK_DIALOG_NO_SEPARATOR, |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3308 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3309 GTK_STOCK_OK, GTK_RESPONSE_OK, |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3310 NULL); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3311 |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3312 gtk_dialog_set_default_response(GTK_DIALOG(alias_dialog), |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3313 GTK_RESPONSE_OK); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3314 gtk_container_set_border_width(GTK_CONTAINER(alias_dialog), 6); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3315 gtk_window_set_resizable(GTK_WINDOW(alias_dialog), FALSE); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3316 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(alias_dialog)->vbox), 12); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3317 gtk_container_set_border_width( |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3318 GTK_CONTAINER(GTK_DIALOG(alias_dialog)->vbox), 6); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3319 |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3320 /* The main hbox container. */ |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3321 hbox = gtk_hbox_new(FALSE, 12); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3322 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(alias_dialog)->vbox), hbox); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3323 |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3324 /* The dialog image. */ |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3325 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3326 GTK_ICON_SIZE_DIALOG); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3327 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3328 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3329 |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3330 /* The main vbox container. */ |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3331 vbox = gtk_vbox_new(FALSE, 0); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3332 gtk_container_add(GTK_CONTAINER(hbox), vbox); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3333 |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3334 /* Setup the label containing the description. */ |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3335 label = gtk_label_new(_("Please enter an aliased name for the " |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3336 "person below, or rename this contact " |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3337 "in your buddy list.\n")); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3338 gtk_widget_set_size_request(GTK_WIDGET(label), 350, -1); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3339 |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3340 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3341 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3342 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3343 |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3344 hbox = gtk_hbox_new(FALSE, 6); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3345 gtk_container_add(GTK_CONTAINER(vbox), hbox); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3346 |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3347 /* The table containing the entry widgets and labels. */ |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3348 table = gtk_table_new(2, 2, FALSE); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3349 gtk_table_set_row_spacings(GTK_TABLE(table), 6); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3350 gtk_table_set_col_spacings(GTK_TABLE(table), 6); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3351 gtk_container_set_border_width(GTK_CONTAINER(table), 12); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3352 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3353 |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3354 /* The "Screenname:" label. */ |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3355 label = gtk_label_new(NULL); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3356 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Screenname:")); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3357 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3358 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3359 |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3360 /* The Screen name entry field. */ |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3361 info->name_entry = gtk_entry_new(); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3362 gtk_table_attach_defaults(GTK_TABLE(table), info->name_entry, |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3363 1, 2, 0, 1); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3364 gtk_entry_set_activates_default(GTK_ENTRY(info->name_entry), TRUE); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3365 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->name_entry); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3366 gtk_entry_set_text(GTK_ENTRY(info->name_entry), info->buddy->name); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3367 |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3368 /* The "Alias:" label. */ |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3369 label = gtk_label_new(NULL); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3370 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Alias:")); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3371 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3372 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3373 |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3374 /* The alias entry field. */ |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3375 info->alias_entry = gtk_entry_new(); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3376 gtk_table_attach_defaults(GTK_TABLE(table), info->alias_entry, |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3377 1, 2, 1, 2); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3378 gtk_entry_set_activates_default(GTK_ENTRY(info->alias_entry), TRUE); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3379 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->alias_entry); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3380 |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3381 if (info->buddy->alias != NULL) |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3382 gtk_entry_set_text(GTK_ENTRY(info->alias_entry), |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3383 info->buddy->alias); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3384 |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3385 g_signal_connect(G_OBJECT(alias_dialog), "response", |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3386 G_CALLBACK(do_alias_buddy), info); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3387 } |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3388 |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3389 gtk_widget_show_all(alias_dialog); |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3390 |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3391 if (info) |
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
3392 gtk_widget_grab_focus(info->name_entry); |
1397
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
3393 } |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
3394 |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
3395 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3396 static gboolean dont_destroy(gpointer a, gpointer b, gpointer c) |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3397 { |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
3398 return TRUE; |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
3399 } |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
3400 |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3401 static void do_save_log(GtkWidget *w, GtkWidget *filesel) |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3402 { |
3716
d7e83b4db191
[gaim-migrate @ 3849]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3671
diff
changeset
|
3403 const char *file; |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3404 char path[PATHSIZE]; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3405 char buf[BUF_LONG]; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3406 char error[BUF_LEN]; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3407 FILE *fp_old, *fp_new; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3408 char filename[PATHSIZE]; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3409 char *name; |
1722
1edc8b545d6f
[gaim-migrate @ 1732]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
3410 char *tmp; |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3411 |
4635 | 3412 name = g_object_get_data(G_OBJECT(filesel), "name"); |
1722
1edc8b545d6f
[gaim-migrate @ 1732]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
3413 tmp = gaim_user_dir(); |
3630 | 3414 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
|
3415 name ? normalize(name) : "system", name ? ".log" : ""); |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3416 |
3716
d7e83b4db191
[gaim-migrate @ 3849]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3671
diff
changeset
|
3417 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
|
3418 strncpy(path, file, PATHSIZE - 1); |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3419 if (file_is_dir(path, filesel)) |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3420 return; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3421 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3422 if ((fp_new = fopen(path, "w")) == NULL) { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3423 g_snprintf(error, BUF_LONG, |
3427 | 3424 _("Couldn't write to %s."), path); |
3425 do_error_dialog(error, strerror(errno), GAIM_ERROR); | |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3426 return; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3427 } |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3428 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3429 if ((fp_old = fopen(filename, "r")) == NULL) { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3430 g_snprintf(error, BUF_LONG, |
3427 | 3431 _("Couldn't write to %s."), filename); |
3432 do_error_dialog(error, strerror(errno), GAIM_ERROR); | |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3433 fclose(fp_new); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3434 return; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3435 } |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3436 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3437 while (fgets(buf, BUF_LONG, fp_old)) |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3438 fputs(buf, fp_new); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3439 fclose(fp_old); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3440 fclose(fp_new); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3441 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3442 gtk_widget_destroy(filesel); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3443 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3444 return; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3445 } |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3446 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3447 static void show_save_log(GtkWidget *w, gchar *name) |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3448 { |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3449 GtkWidget *filesel; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3450 gchar buf[BUF_LEN]; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3451 |
3630 | 3452 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
|
3453 name ? normalize(name) : "system", name ? ".log" : ""); |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3454 |
4703 | 3455 filesel = gtk_file_selection_new(_("Save Log File")); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3456 g_signal_connect(GTK_OBJECT(filesel), "delete_event", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3457 G_CALLBACK(destroy_dialog), filesel); |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3458 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3459 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(filesel)); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3460 gtk_file_selection_set_filename(GTK_FILE_SELECTION(filesel), buf); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3461 g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(filesel)->ok_button), |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3462 "clicked", G_CALLBACK(do_save_log), filesel); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3463 g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(filesel)->cancel_button), |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3464 "clicked", G_CALLBACK(destroy_dialog), filesel); |
4635 | 3465 g_object_set_data(G_OBJECT(filesel), "name", name); |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3466 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3467 gtk_widget_realize(filesel); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3468 gtk_widget_show(filesel); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3469 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3470 return; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3471 } |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3472 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3473 static void do_clear_log_file(GtkWidget *w, gchar *name) |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3474 { |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3475 gchar buf[256]; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3476 gchar filename[256]; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3477 GtkWidget *window; |
1722
1edc8b545d6f
[gaim-migrate @ 1732]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
3478 char *tmp; |
1edc8b545d6f
[gaim-migrate @ 1732]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
3479 |
1edc8b545d6f
[gaim-migrate @ 1732]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
3480 tmp = gaim_user_dir(); |
3630 | 3481 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
|
3482 name ? normalize(name) : "system", name ? ".log" : ""); |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3483 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3484 if ((remove(filename)) == -1) { |
3427 | 3485 g_snprintf(buf, 256, _("Couldn't remove file %s." ), filename); |
3486 do_error_dialog(buf, strerror(errno), GAIM_ERROR); | |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3487 } |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3488 |
4635 | 3489 window = g_object_get_data(G_OBJECT(w), "log_window"); |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3490 destroy_dialog(NULL, window); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3491 } |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3492 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3493 static void show_clear_log(GtkWidget *w, gchar *name) |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3494 { |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3495 GtkWidget *window; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3496 GtkWidget *box; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3497 GtkWidget *hbox; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3498 GtkWidget *button; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3499 GtkWidget *label; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3500 GtkWidget *hsep; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3501 |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
3502 GAIM_DIALOG(window); |
4074 | 3503 gtk_window_set_role(GTK_WINDOW(window), "dialog"); |
4703 | 3504 gtk_window_set_title(GTK_WINDOW(window), _("Clear Log")); |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3505 gtk_container_set_border_width(GTK_CONTAINER(window), 10); |
4635 | 3506 gtk_window_set_resizable(GTK_WINDOW(window), TRUE); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3507 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
|
3508 gtk_widget_realize(window); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3509 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3510 box = gtk_vbox_new(FALSE, 5); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3511 gtk_container_add(GTK_CONTAINER(window), box); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3512 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3513 label = gtk_label_new(_("Really clear log?")); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3514 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 15); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3515 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3516 hsep = gtk_hseparator_new(); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3517 gtk_box_pack_start(GTK_BOX(box), hsep, FALSE, FALSE, 0); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3518 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3519 hbox = gtk_hbox_new(FALSE, 0); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
3520 gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0); |
5024 | 3521 |
3522 button = gaim_pixbuf_button_from_stock(_("OK"), GTK_STOCK_OK, GAIM_BUTTON_HORIZONTAL); | |
4635 | 3523 g_object_set_data(G_OBJECT(button), "log_window", g_object_get_data(G_OBJECT(w), |
3524 "log_window")); | |
4333 | 3525 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
|
3526 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
|
3527 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5); |
5024 | 3528 |
3529 button = gaim_pixbuf_button_from_stock(_("Cancel"), GTK_STOCK_CANCEL, GAIM_BUTTON_HORIZONTAL); | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3530 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
|
3531 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3532 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3533 gtk_widget_show_all(window); |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3534 |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3535 return; |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3536 } |
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3537 |
4635 | 3538 static void log_show_convo(struct view_log *view) |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
3539 { |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
3540 gchar buf[BUF_LONG]; |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
3541 FILE *fp; |
2570 | 3542 char filename[256]; |
3543 int i=0; | |
3544 GString *string; | |
2602 | 3545 guint block; |
3546 | |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
3547 string = g_string_new(""); |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
3548 |
2621
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
3549 if (view->name) { |
1634
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1535
diff
changeset
|
3550 char *tmp = gaim_user_dir(); |
3630 | 3551 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
|
3552 } else { |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1535
diff
changeset
|
3553 char *tmp = gaim_user_dir(); |
3630 | 3554 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
|
3555 } |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
3556 if ((fp = fopen(filename, "r")) == NULL) { |
4923
e96261d0dba8
[gaim-migrate @ 5257]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4918
diff
changeset
|
3557 if (view->name) { |
e96261d0dba8
[gaim-migrate @ 5257]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4918
diff
changeset
|
3558 g_snprintf(buf, BUF_LONG, _("Couldn't open log file %s."), filename); |
e96261d0dba8
[gaim-migrate @ 5257]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4918
diff
changeset
|
3559 do_error_dialog(buf, strerror(errno), GAIM_ERROR); |
e96261d0dba8
[gaim-migrate @ 5257]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4918
diff
changeset
|
3560 } |
e96261d0dba8
[gaim-migrate @ 5257]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4918
diff
changeset
|
3561 /* If the system log doesn't exist.. no message just show empty system log window. |
e96261d0dba8
[gaim-migrate @ 5257]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4918
diff
changeset
|
3562 That way user knows that the log is empty :) |
e96261d0dba8
[gaim-migrate @ 5257]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4918
diff
changeset
|
3563 */ |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
3564 return; |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
3565 } |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
3566 |
2621
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
3567 gtk_widget_set_sensitive(view->bbox, FALSE); |
4635 | 3568 g_signal_handlers_disconnect_by_func(G_OBJECT(view->window), |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3569 G_CALLBACK(destroy_dialog), view->window); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3570 block = g_signal_connect(GTK_OBJECT(view->window), "delete_event", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3571 G_CALLBACK(dont_destroy), view->window); |
2621
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
3572 |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
3573 fseek(fp, view->offset, SEEK_SET); |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
3574 gtk_imhtml_clear(GTK_IMHTML(view->layout)); |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
3575 /* |
2570 | 3576 while (gtk_events_pending()) |
3577 gtk_main_iteration(); | |
2621
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
3578 */ |
2570 | 3579 |
3580 while (fgets(buf, BUF_LONG, fp) && !strstr(buf, "---- New C")) { | |
3581 i++; | |
3582 if (strlen(buf) >= 5 && (!strncmp(buf + strlen(buf) - 5, "<BR>\n", 5))) | |
3583 /* take off the \n */ | |
3584 buf[strlen(buf) - 1] = '\0'; | |
3585 | |
2642
b6cf22276d4b
[gaim-migrate @ 2655]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2623
diff
changeset
|
3586 /* don't lose the thirtieth line of conversation. thanks FeRD */ |
b6cf22276d4b
[gaim-migrate @ 2655]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2623
diff
changeset
|
3587 g_string_append(string, buf); |
b6cf22276d4b
[gaim-migrate @ 2655]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2623
diff
changeset
|
3588 |
2570 | 3589 if (i == 30) { |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2851
diff
changeset
|
3590 gtk_imhtml_append_text(GTK_IMHTML(view->layout), string->str, -1, view->options); |
2570 | 3591 g_string_free(string, TRUE); |
3592 string = g_string_new(""); | |
2621
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
3593 /* 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
|
3594 * drawing, it will try to move to that item, and that causes problems here. |
2570 | 3595 while (gtk_events_pending()) |
3596 gtk_main_iteration(); | |
2621
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
3597 */ |
2570 | 3598 i = 0; |
3599 } | |
3600 | |
3601 } | |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2851
diff
changeset
|
3602 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
|
3603 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
|
3604 |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
3605 gtk_widget_set_sensitive(view->bbox, TRUE); |
4635 | 3606 g_signal_handler_disconnect(G_OBJECT(view->window), block); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3607 g_signal_connect(GTK_OBJECT(view->window), "delete_event", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3608 G_CALLBACK(destroy_dialog), view->window); |
2570 | 3609 g_string_free(string, TRUE); |
3610 fclose(fp); | |
3611 } | |
3612 | |
4635 | 3613 static void log_select_convo(GtkTreeSelection *sel, GtkTreeModel *model) |
3614 { | |
3615 GValue val = { 0, }; | |
3616 GtkTreeIter iter; | |
3617 | |
3618 if(!gtk_tree_selection_get_selected(sel, &model, &iter)) | |
3619 return; | |
3620 gtk_tree_model_get_value(model, &iter, 1, &val); | |
3621 log_show_convo(g_value_get_pointer(&val)); | |
3622 } | |
3623 | |
2621
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
3624 static void des_view_item(GtkObject *obj, struct view_log *view) |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
3625 { |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
3626 if (view->name) |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
3627 g_free(view->name); |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
3628 g_free(view); |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
3629 } |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
3630 |
4635 | 3631 static void des_log_win(GObject *win, gpointer data) |
2623
66164831c228
[gaim-migrate @ 2636]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2621
diff
changeset
|
3632 { |
4635 | 3633 char *x = g_object_get_data(win, "log_window"); |
2623
66164831c228
[gaim-migrate @ 2636]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2621
diff
changeset
|
3634 if (x) |
66164831c228
[gaim-migrate @ 2636]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2621
diff
changeset
|
3635 g_free(x); |
4874 | 3636 x = g_object_get_data(win, "name"); |
3637 if (x) | |
3638 g_free(x); | |
2623
66164831c228
[gaim-migrate @ 2636]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2621
diff
changeset
|
3639 } |
66164831c228
[gaim-migrate @ 2636]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2621
diff
changeset
|
3640 |
3484 | 3641 void conv_show_log(GtkWidget *w, gpointer data) |
3642 { | |
3643 char *name = g_strdup(data); | |
3644 show_log(name); | |
3645 g_free(name); | |
3646 } | |
3647 | |
3532 | 3648 void chat_show_log(GtkWidget *w, gpointer data) |
3649 { | |
3716
d7e83b4db191
[gaim-migrate @ 3849]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3671
diff
changeset
|
3650 char *name = g_strdup_printf("%s.chat", (char*)data); |
3532 | 3651 show_log(name); |
3652 g_free(name); | |
3653 } | |
3654 | |
2623
66164831c228
[gaim-migrate @ 2636]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2621
diff
changeset
|
3655 void show_log(char *nm) |
2570 | 3656 { |
3657 gchar filename[256]; | |
3658 gchar buf[BUF_LONG]; | |
3659 FILE *fp; | |
3660 GtkWidget *window; | |
3661 GtkWidget *box; | |
3662 GtkWidget *hbox; | |
2602 | 3663 GtkWidget *bbox; |
2570 | 3664 GtkWidget *sw; |
3665 GtkWidget *layout; | |
3666 GtkWidget *close_button; | |
3667 GtkWidget *clear_button; | |
3668 GtkWidget *save_button; | |
4635 | 3669 GtkListStore *list_store; |
3670 GtkWidget *tree_view; | |
3671 GtkTreeSelection *sel = NULL; | |
3672 GtkTreePath *path; | |
2612 | 3673 GtkWidget *item = NULL; |
3674 GtkWidget *last = NULL; | |
2570 | 3675 GtkWidget *frame; |
2621
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
3676 struct view_log *view; |
2623
66164831c228
[gaim-migrate @ 2636]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2621
diff
changeset
|
3677 char *name = nm ? g_strdup(nm) : NULL; |
2570 | 3678 |
3679 int options; | |
3680 guint block; | |
3681 char convo_start[32]; | |
3682 long offset = 0; | |
3683 | |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
3684 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
|
3685 if (convo_options & OPT_CONVO_IGNORE_COLOUR) |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
3686 options ^= GTK_IMHTML_NO_COLOURS; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2228
diff
changeset
|
3687 if (convo_options & OPT_CONVO_IGNORE_FONTS) |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
3688 options ^= GTK_IMHTML_NO_FONTS; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2228
diff
changeset
|
3689 if (convo_options & OPT_CONVO_IGNORE_SIZES) |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
3690 options ^= GTK_IMHTML_NO_SIZES; |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
3691 |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
3692 window = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
4635 | 3693 g_object_set_data(G_OBJECT(window), "name", name); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3694 g_signal_connect(GTK_OBJECT(window), "destroy", G_CALLBACK(des_log_win), NULL); |
4074 | 3695 gtk_window_set_role(GTK_WINDOW(window), "log"); |
1648
09445224e2d9
[gaim-migrate @ 1658]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1634
diff
changeset
|
3696 if (name) |
4703 | 3697 g_snprintf(buf, BUF_LONG, _("Conversations with %s"), name); |
1648
09445224e2d9
[gaim-migrate @ 1658]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1634
diff
changeset
|
3698 else |
4703 | 3699 g_snprintf(buf, BUF_LONG, _("System Log")); |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
3700 gtk_window_set_title(GTK_WINDOW(window), buf); |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3701 gtk_container_set_border_width(GTK_CONTAINER(window), 10); |
4635 | 3702 gtk_window_set_resizable(GTK_WINDOW(window), TRUE); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3703 block = g_signal_connect(GTK_OBJECT(window), "delete_event", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3704 G_CALLBACK(dont_destroy), window); |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
3705 gtk_widget_realize(window); |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
3706 |
2570 | 3707 layout = gtk_imhtml_new(NULL, NULL); |
2602 | 3708 bbox = gtk_hbox_new(FALSE, 0); |
3709 | |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3710 box = gtk_vbox_new(FALSE, 5); |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
3711 gtk_container_add(GTK_CONTAINER(window), box); |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
3712 |
2570 | 3713 hbox = gtk_hbox_new(FALSE, 5); |
3714 gtk_box_pack_start(GTK_BOX(box), hbox, TRUE, TRUE, 0); | |
3715 | |
3716 if (name) { | |
3717 char *tmp = gaim_user_dir(); | |
3630 | 3718 g_snprintf(filename, 256, "%s" G_DIR_SEPARATOR_S "logs" G_DIR_SEPARATOR_S "%s.log", tmp, normalize(name)); |
2570 | 3719 if ((fp = fopen(filename, "r")) == NULL) { |
4472 | 3720 g_snprintf(buf, BUF_LONG, _("Couldn't open log file %s"), filename); |
3427 | 3721 do_error_dialog(buf, strerror(errno), GAIM_ERROR); |
2570 | 3722 return; |
3723 } | |
3724 | |
4635 | 3725 list_store = gtk_list_store_new(2, |
3726 G_TYPE_STRING, | |
3727 G_TYPE_POINTER); | |
3728 | |
3729 tree_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(list_store)); | |
3730 | |
3731 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree_view), FALSE); | |
3732 | |
3733 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(tree_view), | |
3734 -1, "", gtk_cell_renderer_text_new(), "text", 0, NULL); | |
3735 | |
3736 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree_view)); | |
3737 g_signal_connect(G_OBJECT(sel), "changed", | |
3738 G_CALLBACK(log_select_convo), | |
3739 NULL); | |
2570 | 3740 |
3741 frame = gtk_frame_new(_("Date")); | |
3742 gtk_widget_show(frame); | |
3743 | |
3744 sw = gtk_scrolled_window_new(NULL, NULL); | |
3745 gtk_container_set_border_width(GTK_CONTAINER(sw), 5); | |
4635 | 3746 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw), tree_view); |
2613
6f7e1fc3e132
[gaim-migrate @ 2626]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2612
diff
changeset
|
3747 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), |
6f7e1fc3e132
[gaim-migrate @ 2626]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2612
diff
changeset
|
3748 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
4635 | 3749 gtk_widget_set_size_request(sw, 220, 220); |
2570 | 3750 gtk_container_add(GTK_CONTAINER(frame), sw); |
3751 gtk_box_pack_start(GTK_BOX(hbox), frame, TRUE, TRUE, 0); | |
3752 | |
3753 while (fgets(buf, BUF_LONG, fp)) { | |
3754 if (strstr(buf, "---- New C")) { | |
3755 int length; | |
3756 char *temp = strchr(buf, '@'); | |
4635 | 3757 GtkTreeIter iter; |
2612 | 3758 |
2570 | 3759 if (temp == NULL || strlen(temp) < 2) |
3760 continue; | |
2612 | 3761 |
2570 | 3762 temp++; |
3763 length = strcspn(temp, "-"); | |
3764 if (length > 31) length = 31; | |
3765 | |
3766 offset = ftell(fp); | |
3767 g_snprintf(convo_start, length, "%s", temp); | |
4635 | 3768 gtk_list_store_append(list_store, &iter); |
2621
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
3769 view = g_new0(struct view_log, 1); |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
3770 view->options = options; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
3771 view->offset = offset; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
3772 view->name = g_strdup(name); |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
3773 view->bbox = bbox; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
3774 view->window = window; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
3775 view->layout = layout; |
4635 | 3776 gtk_list_store_set(list_store, &iter, |
3777 0, convo_start, | |
3778 1, view, | |
3779 -1); | |
3780 g_signal_connect(G_OBJECT(window), "destroy", | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3781 G_CALLBACK(des_view_item), view); |
2612 | 3782 last = item; |
2570 | 3783 } |
3784 } | |
3785 fclose(fp); | |
4635 | 3786 |
3787 path = gtk_tree_path_new_first(); | |
3788 gtk_tree_selection_select_path(sel, path); | |
3789 gtk_tree_path_free(path); | |
3790 | |
3791 g_object_unref(G_OBJECT(list_store)); | |
2612 | 3792 } |
3793 | |
4635 | 3794 |
3795 g_signal_handler_disconnect(GTK_OBJECT(window), block); | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3796 g_signal_connect(GTK_OBJECT(window), "delete_event", G_CALLBACK(destroy_dialog), window); |
2602 | 3797 |
2570 | 3798 frame = gtk_frame_new(_("Conversation")); |
3799 gtk_widget_show(frame); | |
3800 | |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
3801 sw = gtk_scrolled_window_new(NULL, NULL); |
2570 | 3802 gtk_container_set_border_width(GTK_CONTAINER(sw), 5); |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
3803 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
4333 | 3804 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); |
4635 | 3805 gtk_widget_set_size_request(sw, 390, 220); |
2570 | 3806 gtk_container_add(GTK_CONTAINER(frame), sw); |
3807 gtk_box_pack_start(GTK_BOX(hbox), frame, TRUE, TRUE, 0); | |
3808 | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3809 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
|
3810 gtk_container_add(GTK_CONTAINER(sw), layout); |
1815
f15d449b3167
[gaim-migrate @ 1825]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1805
diff
changeset
|
3811 gaim_setup_imhtml(layout); |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
3812 |
2602 | 3813 gtk_box_pack_start(GTK_BOX(box), bbox, FALSE, FALSE, 0); |
3814 gtk_widget_set_sensitive(bbox, FALSE); | |
1488
55246babdeb3
[gaim-migrate @ 1498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1484
diff
changeset
|
3815 |
5024 | 3816 close_button = gaim_pixbuf_button_from_stock(_("Close"), GTK_STOCK_CLOSE, GAIM_BUTTON_HORIZONTAL); |
2602 | 3817 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
|
3818 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
|
3819 |
5024 | 3820 clear_button = gaim_pixbuf_button_from_stock(_("Clear"), GTK_STOCK_CLEAR, GAIM_BUTTON_HORIZONTAL); |
4635 | 3821 g_object_set_data(G_OBJECT(clear_button), "log_window", window); |
2602 | 3822 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
|
3823 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
|
3824 |
5024 | 3825 save_button = gaim_pixbuf_button_from_stock(_("Save"), GTK_STOCK_SAVE, GAIM_BUTTON_HORIZONTAL); |
2602 | 3826 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
|
3827 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
|
3828 |
4635 | 3829 gtk_widget_show_all(window); |
3830 | |
2570 | 3831 if (!name) { |
2621
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
3832 view = g_new0(struct view_log, 1); |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
3833 view->options = options; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
3834 view->name = NULL; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
3835 view->bbox = bbox; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
3836 view->window = window; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
3837 view->layout = layout; |
4635 | 3838 log_show_convo(view); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3839 g_signal_connect(GTK_OBJECT(layout), "destroy", G_CALLBACK(des_view_item), view); |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
3840 } |
4635 | 3841 |
2602 | 3842 gtk_widget_set_sensitive(bbox, TRUE); |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
3843 |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
3844 return; |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
3845 } |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3846 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3847 /*------------------------------------------------------------------------*/ |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3848 /* The dialog for renaming groups */ |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3849 /*------------------------------------------------------------------------*/ |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3850 |
4183 | 3851 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
|
3852 { |
3466 | 3853 const char *new_name; |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3854 struct group *g; |
1748
2eec724fdbcd
[gaim-migrate @ 1758]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1736
diff
changeset
|
3855 struct group *orig; |
4349 | 3856 GSList *accts; |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3857 |
4183 | 3858 if (resp == GTK_RESPONSE_OK) { |
3859 | |
3860 new_name = gtk_entry_get_text(GTK_ENTRY(entry)); | |
4635 | 3861 g = g_object_get_data(G_OBJECT(entry), "group"); |
4183 | 3862 |
3863 if (new_name && (strlen(new_name) != 0) && strcmp(new_name, g->name)) { | |
3864 char *prevname; | |
3865 | |
4793 | 3866 if ((orig = gaim_find_group(new_name)) != NULL && gaim_utf8_strcasecmp(new_name, g->name)) { |
4687 | 3867 gaim_blist_rename_group(orig, g->name); |
4349 | 3868 accts = gaim_group_get_accounts(g); |
3869 while(accts) { | |
4491 | 3870 struct gaim_account *account = accts->data; |
3871 serv_rename_group(account->gc, g, new_name); | |
4349 | 3872 accts = g_slist_remove(accts, accts->data); |
3873 } | |
4183 | 3874 g_free(g); |
3875 } else { | |
3876 prevname = g_strdup(g->name); | |
4349 | 3877 accts = gaim_group_get_accounts(g); |
3878 while(accts) { | |
4491 | 3879 struct gaim_account *account = accts->data; |
3880 serv_rename_group(account->gc, g, new_name); | |
4349 | 3881 accts = g_slist_remove(accts, accts->data); |
3882 } | |
4916 | 3883 gaim_blist_rename_group(g, new_name); |
4183 | 3884 g_free(prevname); |
3885 } | |
4349 | 3886 gaim_blist_save(); |
1748
2eec724fdbcd
[gaim-migrate @ 1758]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1736
diff
changeset
|
3887 } |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3888 } |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3889 destroy_dialog(rename_dialog, rename_dialog); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3890 } |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3891 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3892 void show_rename_group(GtkWidget *unused, struct group *g) |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3893 { |
4183 | 3894 |
3895 GtkWidget *hbox, *vbox; | |
3896 GtkWidget *label; | |
4695
4bdd9a5fd026
[gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3897 struct gaim_gtk_buddy_list *gtkblist; |
5024 | 3898 GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG); |
4201
511c2b63caa4
[gaim-migrate @ 4432]
Christian Hammond <chipx86@chipx86.com>
parents:
4198
diff
changeset
|
3899 GtkWidget *name_entry = NULL; |
4183 | 3900 |
4695
4bdd9a5fd026
[gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3901 gtkblist = GAIM_GTK_BLIST(gaim_get_blist()); |
4bdd9a5fd026
[gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3902 |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3903 if (!rename_dialog) { |
5092 | 3904 rename_dialog = gtk_dialog_new_with_buttons(_("Rename Group"), GTK_WINDOW(gtkblist->window), 0, |
4183 | 3905 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); |
3906 gtk_dialog_set_default_response (GTK_DIALOG(rename_dialog), GTK_RESPONSE_OK); | |
3907 gtk_container_set_border_width (GTK_CONTAINER(rename_dialog), 6); | |
3908 gtk_window_set_resizable(GTK_WINDOW(rename_dialog), FALSE); | |
3909 gtk_dialog_set_has_separator(GTK_DIALOG(rename_dialog), FALSE); | |
3910 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(rename_dialog)->vbox), 12); | |
3911 gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(rename_dialog)->vbox), 6); | |
4635 | 3912 |
4183 | 3913 hbox = gtk_hbox_new(FALSE, 12); |
3914 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(rename_dialog)->vbox), hbox); | |
3915 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
3916 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
3917 | |
3918 vbox = gtk_vbox_new(FALSE, 0); | |
3919 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
4635 | 3920 |
4183 | 3921 label = gtk_label_new(_("Please enter a new name for the selected group.\n")); |
3922 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
3923 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
3924 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
4635 | 3925 |
4183 | 3926 hbox = gtk_hbox_new(FALSE, 6); |
3927 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
4635 | 3928 |
4183 | 3929 label = gtk_label_new(NULL); |
3930 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Group:")); | |
3931 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
4635 | 3932 |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3933 name_entry = gtk_entry_new(); |
4183 | 3934 gtk_entry_set_activates_default (GTK_ENTRY(name_entry), TRUE); |
4635 | 3935 g_object_set_data(G_OBJECT(name_entry), "group", g); |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3936 gtk_entry_set_text(GTK_ENTRY(name_entry), g->name); |
4183 | 3937 gtk_box_pack_start(GTK_BOX(hbox), name_entry, FALSE, FALSE, 0); |
3938 gtk_entry_set_activates_default (GTK_ENTRY(name_entry), TRUE); | |
3939 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(name_entry)); | |
4635 | 3940 |
4183 | 3941 g_signal_connect(G_OBJECT(rename_dialog), "response", G_CALLBACK(do_rename_group), name_entry); |
4182 | 3942 |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3943 } |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3944 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3945 gtk_widget_show_all(rename_dialog); |
4201
511c2b63caa4
[gaim-migrate @ 4432]
Christian Hammond <chipx86@chipx86.com>
parents:
4198
diff
changeset
|
3946 if(name_entry) |
511c2b63caa4
[gaim-migrate @ 4432]
Christian Hammond <chipx86@chipx86.com>
parents:
4198
diff
changeset
|
3947 gtk_widget_grab_focus(GTK_WIDGET(name_entry)); |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3948 } |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3949 |
2743 | 3950 |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3951 /*------------------------------------------------------------------------*/ |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3952 /* The dialog for renaming buddies */ |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3953 /*------------------------------------------------------------------------*/ |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3954 |
4635 | 3955 static void do_rename_buddy(GObject *obj, GtkWidget *entry) |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3956 { |
3466 | 3957 const char *new_name; |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3958 struct buddy *b; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3959 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3960 new_name = gtk_entry_get_text(GTK_ENTRY(entry)); |
4635 | 3961 b = g_object_get_data(obj, "buddy"); |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3962 |
4491 | 3963 if (!g_slist_find(connections, b->account->gc)) { |
2681
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2679
diff
changeset
|
3964 destroy_dialog(rename_bud_dialog, rename_bud_dialog); |
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2679
diff
changeset
|
3965 return; |
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2679
diff
changeset
|
3966 } |
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2679
diff
changeset
|
3967 |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3968 if (new_name && (strlen(new_name) != 0) && strcmp(new_name, b->name)) { |
4687 | 3969 struct group *g = gaim_find_buddys_group(b); |
4785 | 3970 char *prevname = b->name; |
2681
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2679
diff
changeset
|
3971 if (g) |
4491 | 3972 serv_remove_buddy(b->account->gc, b->name, g->name); |
4785 | 3973 b->name = g_strdup(new_name); |
4491 | 3974 serv_add_buddy(b->account->gc, b->name); |
4687 | 3975 gaim_blist_rename_buddy(b, prevname); |
4349 | 3976 gaim_blist_save(); |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3977 g_free(prevname); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3978 } |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3979 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3980 destroy_dialog(rename_bud_dialog, rename_bud_dialog); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3981 } |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3982 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3983 void show_rename_buddy(GtkWidget *unused, struct buddy *b) |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3984 { |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3985 GtkWidget *mainbox; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3986 GtkWidget *frame; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3987 GtkWidget *fbox; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3988 GtkWidget *bbox; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3989 GtkWidget *button; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3990 GtkWidget *name_entry; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3991 GtkWidget *label; |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3992 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
3993 if (!rename_bud_dialog) { |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
3994 GAIM_DIALOG(rename_bud_dialog); |
4074 | 3995 gtk_window_set_role(GTK_WINDOW(rename_bud_dialog), "rename_bud_dialog"); |
4635 | 3996 gtk_window_set_resizable(GTK_WINDOW(rename_bud_dialog), TRUE); |
4703 | 3997 gtk_window_set_title(GTK_WINDOW(rename_bud_dialog), _("Rename Buddy")); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3998 g_signal_connect(GTK_OBJECT(rename_bud_dialog), "destroy", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
3999 G_CALLBACK(destroy_dialog), rename_bud_dialog); |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4000 gtk_widget_realize(rename_bud_dialog); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4001 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4002 mainbox = gtk_vbox_new(FALSE, 5); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4003 gtk_container_set_border_width(GTK_CONTAINER(mainbox), 5); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4004 gtk_container_add(GTK_CONTAINER(rename_bud_dialog), mainbox); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4005 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4006 frame = gtk_frame_new(_("Rename Buddy")); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4007 gtk_box_pack_start(GTK_BOX(mainbox), frame, TRUE, TRUE, 0); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4008 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4009 fbox = gtk_hbox_new(FALSE, 5); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4010 gtk_container_set_border_width(GTK_CONTAINER(fbox), 5); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4011 gtk_container_add(GTK_CONTAINER(frame), fbox); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4012 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4013 label = gtk_label_new(_("New name:")); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4014 gtk_box_pack_start(GTK_BOX(fbox), label, FALSE, FALSE, 0); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4015 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4016 name_entry = gtk_entry_new(); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4017 gtk_box_pack_start(GTK_BOX(fbox), name_entry, TRUE, TRUE, 0); |
4635 | 4018 g_object_set_data(G_OBJECT(name_entry), "buddy", b); |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4019 gtk_entry_set_text(GTK_ENTRY(name_entry), b->name); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4020 g_signal_connect(GTK_OBJECT(name_entry), "activate", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4021 G_CALLBACK(do_rename_buddy), name_entry); |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4022 gtk_widget_grab_focus(name_entry); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4023 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4024 bbox = gtk_hbox_new(FALSE, 5); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4025 gtk_box_pack_start(GTK_BOX(mainbox), bbox, FALSE, FALSE, 0); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4026 |
5024 | 4027 button = gaim_pixbuf_button_from_stock(_("OK"), GTK_STOCK_OK, GAIM_BUTTON_HORIZONTAL); |
4635 | 4028 g_object_set_data(G_OBJECT(button), "buddy", b); |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4029 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
|
4030 g_signal_connect(GTK_OBJECT(button), "clicked", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4031 G_CALLBACK(do_rename_buddy), name_entry); |
4236 | 4032 |
5024 | 4033 button = gaim_pixbuf_button_from_stock(_("Cancel"), GTK_STOCK_CANCEL, GAIM_BUTTON_HORIZONTAL); |
4236 | 4034 gtk_box_pack_end(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
4035 g_signal_connect(GTK_OBJECT(button), "clicked", | |
4036 G_CALLBACK(destroy_dialog), rename_bud_dialog); | |
1729
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4037 } |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4038 |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4039 gtk_widget_show_all(rename_bud_dialog); |
251c19bf5763
[gaim-migrate @ 1739]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1722
diff
changeset
|
4040 } |
2370
25e7c2a68ed2
[gaim-migrate @ 2383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2344
diff
changeset
|
4041 |
2379
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4042 |
3668 | 4043 GtkWidget *gaim_pixbuf_toolbar_button_from_stock(char *icon) |
4044 { | |
4045 GtkWidget *button, *image, *bbox; | |
4046 | |
4047 button = gtk_toggle_button_new(); | |
4048 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
4049 | |
4050 bbox = gtk_vbox_new(FALSE, 0); | |
4051 | |
4052 gtk_container_add (GTK_CONTAINER(button), bbox); | |
4053 | |
4054 image = gtk_image_new_from_stock(icon, GTK_ICON_SIZE_MENU); | |
4055 gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 0); | |
4056 | |
4057 gtk_widget_show_all(bbox); | |
4058 return button; | |
4059 } | |
4060 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
4061 GtkWidget * |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
4062 gaim_pixbuf_button_from_stock(const char *text, const char *icon, |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
4063 GaimButtonStyle style) |
3668 | 4064 { |
5024 | 4065 GtkWidget *button, *image, *label, *bbox, *ibox, *lbox; |
3668 | 4066 button = gtk_button_new(); |
4067 | |
5024 | 4068 if (style == GAIM_BUTTON_HORIZONTAL) { |
3668 | 4069 bbox = gtk_hbox_new(FALSE, 5); |
5024 | 4070 ibox = gtk_hbox_new(FALSE, 0); |
4071 lbox = gtk_hbox_new(FALSE, 0); | |
4072 } else { | |
4073 bbox = gtk_vbox_new(FALSE, 5); | |
4074 ibox = gtk_vbox_new(FALSE, 0); | |
4075 lbox = gtk_vbox_new(FALSE, 0); | |
4076 } | |
3668 | 4077 |
4078 gtk_container_add (GTK_CONTAINER(button), bbox); | |
4079 | |
5024 | 4080 gtk_box_pack_start_defaults(GTK_BOX(bbox), ibox); |
4081 gtk_box_pack_start_defaults(GTK_BOX(bbox), lbox); | |
4082 | |
3668 | 4083 if (icon) { |
4084 image = gtk_image_new_from_stock(icon, GTK_ICON_SIZE_BUTTON); | |
5024 | 4085 gtk_box_pack_end(GTK_BOX(ibox), image, FALSE, FALSE, 0); |
3668 | 4086 } |
5024 | 4087 |
3668 | 4088 if (text) { |
4089 label = gtk_label_new(NULL); | |
4090 gtk_label_set_text_with_mnemonic(GTK_LABEL(label), text); | |
4091 gtk_label_set_mnemonic_widget(GTK_LABEL(label), button); | |
5024 | 4092 gtk_box_pack_start(GTK_BOX(lbox), label, FALSE, FALSE, 0); |
3668 | 4093 } |
4094 | |
4095 gtk_widget_show_all(bbox); | |
4096 return button; | |
4097 } | |
4098 | |
3649 | 4099 GtkWidget *gaim_pixbuf_button(char *text, char *iconfile, GaimButtonStyle style) |
3367 | 4100 { |
5024 | 4101 GtkWidget *button, *image, *label, *bbox, *ibox, *lbox; |
3367 | 4102 button = gtk_button_new(); |
3649 | 4103 |
5024 | 4104 if (style == GAIM_BUTTON_HORIZONTAL) { |
3649 | 4105 bbox = gtk_hbox_new(FALSE, 5); |
5024 | 4106 ibox = gtk_hbox_new(FALSE, 0); |
4107 lbox = gtk_hbox_new(FALSE, 0); | |
4108 } else { | |
4109 bbox = gtk_vbox_new(FALSE, 5); | |
4110 ibox = gtk_vbox_new(FALSE, 0); | |
4111 lbox = gtk_vbox_new(FALSE, 0); | |
4112 } | |
3649 | 4113 |
3367 | 4114 gtk_container_add (GTK_CONTAINER(button), bbox); |
3649 | 4115 |
5024 | 4116 gtk_box_pack_start_defaults(GTK_BOX(bbox), ibox); |
4117 gtk_box_pack_start_defaults(GTK_BOX(bbox), lbox); | |
4118 | |
3367 | 4119 if (iconfile) { |
4120 char *filename; | |
4121 filename = g_build_filename (DATADIR, "pixmaps", "gaim", "buttons", iconfile, NULL); | |
4122 debug_printf("Loading: %s\n", filename); | |
4123 image = gtk_image_new_from_file(filename); | |
5024 | 4124 gtk_box_pack_end(GTK_BOX(ibox), image, FALSE, FALSE, 0); |
3367 | 4125 g_free(filename); |
4126 } | |
5024 | 4127 |
3367 | 4128 if (text) { |
4129 label = gtk_label_new(NULL); | |
4130 gtk_label_set_text_with_mnemonic(GTK_LABEL(label), text); | |
4131 gtk_label_set_mnemonic_widget(GTK_LABEL(label), button); | |
5024 | 4132 gtk_box_pack_start(GTK_BOX(lbox), label, FALSE, FALSE, 0); |
2379
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4133 } |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4134 |
5024 | 4135 gtk_widget_show_all(bbox); |
2379
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4136 return button; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4137 } |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4138 |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4139 int file_is_dir(const char *path, GtkWidget *w) |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4140 { |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4141 struct stat st; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4142 char *name; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4143 |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4144 if (stat(path, &st) == 0 && S_ISDIR(st.st_mode)) { |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4145 /* append a / if needed */ |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4146 if (path[strlen(path) - 1] != '/') { |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4147 name = g_strconcat(path, "/", NULL); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4148 } else { |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4149 name = g_strdup(path); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4150 } |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4151 gtk_file_selection_set_filename(GTK_FILE_SELECTION(w), name); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4152 g_free(name); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4153 return 1; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4154 } |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4155 |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4156 return 0; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2377
diff
changeset
|
4157 } |
2956 | 4158 |
4159 /*------------------------------------------------------------------------*/ | |
4160 /* The dialog for setting V-Card info */ | |
4161 /*------------------------------------------------------------------------*/ | |
4162 /* | |
4163 * There are actually two "chunks" of code following: generic "multi-entry dialog" | |
4164 * support and V-Card dialog specific support. | |
4165 * | |
4166 * At first blush, this may seem like an unnecessary duplication of effort given | |
4167 * that a "set dir info" dialog already exists. However, this is not so because: | |
4168 * | |
4169 * 1. V-Cards can have a lot more data in them than what the current | |
4170 * "set dir" dialog supports. | |
4171 * | |
4172 * 2. V-Card data, at least with respect to Jabber, is currently in a | |
4173 * state of flux. As the data and format changes, all that need be | |
4174 * changed with the V-Card support I've written is the "template" | |
4175 * data. | |
4176 * | |
4177 * 3. The "multi entry dialog" support itself was originally written | |
4178 * to support Jabber server user registration (TBD). A "dynamically | |
4179 * configurable" multi-entry dialog is needed for that, as different | |
4180 * servers may require different registration information. It just | |
4181 * turned out to be well-suited to adding V-Card setting support, as | |
4182 * well :-). | |
4183 * | |
4184 * TBD: Add check-box support to the generic multi-entry dialog support so that | |
4185 * it can be used to "replace" the "set dir info" support? | |
4186 * | |
4187 * Multiple-language support. Currently Not In There. I think this should | |
4188 * be easy. Note that when it's added: if anybody saved their data in | |
4189 * English, it'll be lost when MLS is added and they'll have to re-enter it. | |
4190 * | |
4191 * More "TBDs" noted in the code. | |
4192 */ | |
4193 | |
4194 | |
4195 /*------------------------------------*/ | |
4196 /* generic multi-entry dialog support */ | |
4197 /*------------------------------------*/ | |
4198 | |
4199 /* | |
4200 * Print all multi-entry items | |
4201 * | |
4202 * Note: Simply a debug helper | |
4203 */ | |
4204 void multi_entry_item_print_all(const GSList *list) { | |
4205 | |
4206 int cnt = 0; | |
4207 | |
4208 /* While there's something to print... */ | |
4209 while(list != NULL) { | |
4210 fprintf(stderr, "label %2d: \"%s\"", ++cnt, ((MultiEntryData *) (list->data))->label); | |
4211 if(((MultiEntryData *) (list->data))->text != NULL) { | |
4212 fprintf(stderr, ", text: \"%s\"", ((MultiEntryData *) (list->data))->text); | |
4213 } | |
4214 fputs("\n", stderr); | |
4215 list = list->next; | |
4216 } | |
4217 } | |
4218 | |
4219 /* | |
4220 * Print all multi-text items | |
4221 * | |
4222 * Note: Simply a debug helper | |
4223 */ | |
4224 void multi_text_item_print_all(const GSList *list) { | |
4225 | |
4226 int cnt = 0; | |
4227 | |
4228 /* While there's something to print... */ | |
4229 while(list != NULL) { | |
4230 fprintf(stderr, "label %2d: \"%s\"", ++cnt, ((MultiTextData *) (list->data))->label); | |
4231 if(((MultiTextData *) (list->data))->text != NULL) { | |
4232 fprintf(stderr, ", text: \"%s\"", ((MultiTextData *) (list->data))->text); | |
4233 } | |
4234 fputs("\n", stderr); | |
4235 list = list->next; | |
4236 } | |
4237 } | |
4238 | |
4239 | |
4240 /* | |
4241 * Free all multi-entry item allocs and NULL the list pointer | |
4242 */ | |
4243 void multi_entry_items_free_all(GSList **list) | |
4244 { | |
4245 | |
4246 GSList *next = *list; | |
4247 MultiEntryData *data; | |
4248 | |
4249 /* While there's something to free() ... */ | |
4250 while(next != NULL) { | |
4251 data = (MultiEntryData *) next->data; | |
4252 g_free(data->label); | |
4253 g_free(data->text); | |
4254 g_free(data); | |
4255 next = next->next; | |
4256 } | |
4257 g_slist_free(*list); | |
4258 *list = NULL; | |
4259 } | |
4260 | |
4261 /* | |
4262 * Free all multi-text item allocs and NULL the list pointer | |
4263 */ | |
4264 void multi_text_items_free_all(GSList **list) | |
4265 { | |
4266 | |
4267 GSList *next = *list; | |
4268 MultiTextData *data; | |
4269 | |
4270 /* While there's something to free() ... */ | |
4271 while(next != NULL) { | |
4272 data = (MultiTextData *) next->data; | |
4273 g_free(data->label); | |
4274 g_free(data->text); | |
4275 g_free(data); | |
4276 next = next->next; | |
4277 } | |
4278 g_slist_free(*list); | |
4279 *list = NULL; | |
4280 } | |
4281 | |
4282 /* | |
4283 * See if a MultiEntryData item contains a given label | |
4284 * | |
4285 * See: glib docs for g_slist_compare_custom() for details | |
4286 */ | |
4287 static gint multi_entry_data_label_compare(gconstpointer data, gconstpointer label) | |
4288 { | |
4289 return(strcmp(((MultiEntryData *) (data))->label, (char *) label)); | |
4290 } | |
4291 | |
4292 /* | |
4293 * Add a new multi-entry item to list | |
4294 * | |
4295 * If adding to existing list: will search the list for existence of | |
4296 * "label" and change/create "text" entry if necessary. | |
4297 */ | |
4298 | |
4299 MultiEntryData *multi_entry_list_update(GSList **list, const char *label, const char *text, int add_it) | |
4300 { | |
4301 GSList *found; | |
4302 MultiEntryData *data; | |
4303 | |
2975 | 4304 if((found = g_slist_find_custom(*list, (void *)label, multi_entry_data_label_compare)) == NULL) { |
2956 | 4305 if(add_it) { |
4306 data = (MultiEntryData *) g_slist_last(*list = | |
4307 g_slist_append(*list, g_malloc(sizeof(MultiEntryData))))->data; | |
4308 data->label = strcpy(g_malloc(strlen(label) +1), label); | |
4309 data->text = NULL; | |
4310 /* | |
4311 * default to setting "visible" and editable to TRUE - they can be | |
4312 * overridden later, of course. | |
4313 */ | |
4314 data->visible = TRUE; | |
4315 data->editable = TRUE; | |
4316 } else { | |
4317 data = NULL; | |
4318 } | |
4319 } else { | |
4320 data = found->data; | |
4321 } | |
4322 | |
4323 if(data != NULL && text != NULL && text[0] != '\0') { | |
4324 if(data->text == NULL) { | |
4325 data->text = g_malloc(strlen(text) + 1); | |
4326 } else { | |
4327 data->text = g_realloc(data->text, strlen(text) + 1); | |
4328 } | |
4329 strcpy(data->text, text); | |
4330 } | |
4331 | |
4332 return(data); | |
4333 } | |
4334 | |
4335 /* | |
4336 * See if a MultiTextData item contains a given label | |
4337 * | |
4338 * See: glib docs for g_slist_compare_custom() for details | |
4339 */ | |
4340 static gint multi_text_data_label_compare(gconstpointer data, gconstpointer label) | |
4341 { | |
4342 return(strcmp(((MultiTextData *) (data))->label, (char *) label)); | |
4343 } | |
4344 | |
4345 /* | |
4346 * Add a new multi-text item to list | |
4347 * | |
4348 * If adding to existing list: will search the list for existence of | |
4349 * "label" and change/create "text" text if necessary. | |
4350 */ | |
4351 | |
4352 MultiTextData *multi_text_list_update(GSList **list, const char *label, const char *text, int add_it) | |
4353 { | |
4354 GSList *found; | |
4355 MultiTextData *data; | |
4356 | |
2975 | 4357 if((found = g_slist_find_custom(*list, (void *)label, multi_text_data_label_compare)) == NULL) { |
2956 | 4358 if(add_it) { |
4359 data = (MultiTextData *) g_slist_last(*list = | |
4360 g_slist_append(*list, g_malloc(sizeof(MultiTextData))))->data; | |
4361 data->label = strcpy(g_malloc(strlen(label) +1), label); | |
4362 data->text = NULL; | |
4363 } else { | |
4364 data = NULL; | |
4365 } | |
4366 } else { | |
4367 data = found->data; | |
4368 } | |
4369 | |
4370 if(data != NULL && text != NULL && text[0] != '\0') { | |
4371 if(data->text == NULL) { | |
4372 data->text = g_malloc(strlen(text) + 1); | |
4373 } else { | |
4374 data->text = g_realloc(data->text, strlen(text) + 1); | |
4375 } | |
4376 strcpy(data->text, text); | |
4377 } | |
4378 | |
4379 return(data); | |
4380 } | |
4381 | |
4382 /* | |
4383 * Free-up the multi-entry item list and the MultiEntryDlg | |
4384 * struct alloc. | |
4385 */ | |
4386 void multi_entry_free(struct multi_entry_dlg *b) | |
4387 { | |
4388 multi_entry_items_free_all(&(b->multi_entry_items)); | |
4389 multi_text_items_free_all(&(b->multi_text_items)); | |
4390 g_free(b->instructions->text); | |
4391 g_free(b->instructions); | |
2975 | 4392 g_free(b->entries_title); |
2956 | 4393 g_free(b); |
4394 } | |
4395 | |
4396 /* | |
4397 * Multi-Entry dialog "destroyed" catcher | |
4398 * | |
4399 * Free-up the multi-entry item list, destroy the dialog widget | |
4400 * and free the MultiEntryDlg struct alloc. | |
4401 * | |
4402 */ | |
4403 void multi_entry_dialog_destroy(GtkWidget *widget, gpointer data) | |
4404 { | |
4405 MultiEntryDlg *b = data; | |
4406 | |
4407 multi_entry_free(b); | |
4408 } | |
4409 | |
4410 /* | |
4411 * Show/Re-show instructions | |
4412 */ | |
4413 void re_show_multi_entry_instr(MultiInstrData *instructions) | |
4414 { | |
4415 if(instructions->label != NULL) { | |
4416 if(instructions->text == NULL) { | |
4417 gtk_widget_hide(instructions->label); | |
4418 } else { | |
4419 gtk_label_set_text(GTK_LABEL (instructions->label), instructions->text); | |
4420 gtk_widget_show(instructions->label); | |
4421 } | |
4422 } | |
4423 } | |
4424 | |
4425 /* | |
4426 * Show/Re-show entry boxes | |
4427 */ | |
4428 void re_show_multi_entry_entries(GtkWidget **entries_table, | |
4429 GtkWidget *entries_frame, | |
4430 GSList *multi_entry_items) | |
4431 { | |
4432 GtkWidget *label; | |
4433 GSList *multi_entry; | |
4434 MultiEntryData *med; | |
2975 | 4435 int rows, row_num, col_num, col_offset; |
4436 int cols = 1; | |
2956 | 4437 |
4438 /* Figure-out number of rows needed for table */ | |
2975 | 4439 if((rows = g_slist_length(multi_entry_items)) > 9) { |
4440 rows /= 2; | |
4441 ++cols; | |
4442 } | |
2956 | 4443 |
4444 if(*entries_table != NULL) { | |
4445 gtk_widget_destroy(GTK_WIDGET (*entries_table)); | |
4446 } | |
2975 | 4447 *entries_table = gtk_table_new(rows, 3 * cols, FALSE); |
2956 | 4448 gtk_container_add(GTK_CONTAINER (entries_frame), *entries_table); |
4449 | |
2975 | 4450 for(col_num = 0, multi_entry = multi_entry_items; col_num < cols && multi_entry != NULL; |
4451 ++col_num) { | |
4452 col_offset = col_num * 3; | |
4453 for(row_num = 0; row_num < rows && multi_entry != NULL; | |
4454 ++row_num, multi_entry = multi_entry->next) { | |
4455 | |
4456 med = (MultiEntryData *) multi_entry->data; | |
4457 | |
4458 label = gtk_label_new(med->label); | |
4459 gtk_misc_set_alignment(GTK_MISC(label), (gfloat) 1.0, (gfloat) 0.5); | |
4460 gtk_table_attach_defaults(GTK_TABLE (*entries_table), label, | |
4461 col_offset, 1 + col_offset, row_num, row_num +1); | |
4462 gtk_widget_show(label); | |
4463 | |
4464 label = gtk_label_new(": "); | |
4465 gtk_misc_set_alignment(GTK_MISC(label), (gfloat) 0.0, (gfloat) 0.5); | |
4466 gtk_table_attach_defaults(GTK_TABLE (*entries_table), label, | |
4467 1 + col_offset, 2 + col_offset, row_num, row_num +1); | |
4468 gtk_widget_show(label); | |
4469 | |
4635 | 4470 med->widget = gtk_entry_new(); |
4471 gtk_entry_set_max_length(GTK_ENTRY(med->widget), 50); | |
2975 | 4472 if(med->text != NULL) { |
4473 gtk_entry_set_text(GTK_ENTRY (med->widget), med->text); | |
4474 } | |
4475 gtk_entry_set_visibility(GTK_ENTRY (med->widget), med->visible); | |
4635 | 4476 gtk_editable_set_editable(GTK_EDITABLE(med->widget), med->editable); |
2975 | 4477 gtk_table_attach(GTK_TABLE (*entries_table), med->widget, |
4478 2 + col_offset, 3 + col_offset, row_num, row_num +1, | |
4479 GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 5, 0); | |
4480 gtk_widget_show(med->widget); | |
2956 | 4481 } |
4482 } | |
4483 | |
4484 gtk_widget_show(*entries_table); | |
4485 } | |
4486 | |
4487 /* | |
4488 * Show/Re-show textboxes | |
4489 */ | |
4490 void re_show_multi_entry_textboxes(GtkWidget **texts_ibox, | |
4491 GtkWidget *texts_obox, | |
4492 GSList *multi_text_items) | |
4493 { | |
4494 GSList *multi_text; | |
4495 MultiTextData *mtd; | |
4635 | 4496 GtkWidget *frame; |
4497 GtkWidget *sw; | |
2956 | 4498 |
4499 if(*texts_ibox != NULL) { | |
4500 gtk_widget_destroy(GTK_WIDGET (*texts_ibox)); | |
4501 } | |
4502 *texts_ibox = gtk_vbox_new(FALSE, 5); | |
4503 gtk_container_add(GTK_CONTAINER (texts_obox), *texts_ibox); | |
4504 | |
4505 for(multi_text = multi_text_items; multi_text != NULL; multi_text = multi_text->next) { | |
4506 mtd = (MultiTextData *) multi_text->data; | |
4507 frame = gtk_frame_new(mtd->label); | |
4635 | 4508 sw = gtk_scrolled_window_new(NULL, NULL); |
4509 gtk_container_set_border_width(GTK_CONTAINER(sw), 5); | |
4510 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
4511 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); | |
4512 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), | |
4513 GTK_SHADOW_IN); | |
4514 gtk_widget_set_size_request(sw, 300, 100); | |
4515 gtk_container_add(GTK_CONTAINER (frame), sw); | |
2956 | 4516 gtk_container_add(GTK_CONTAINER (*texts_ibox), frame); |
4635 | 4517 mtd->textbox = gtk_text_view_new(); |
4518 gtk_text_view_set_editable(GTK_TEXT_VIEW(mtd->textbox), TRUE); | |
5105 | 4519 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(mtd->textbox), GTK_WRAP_WORD_CHAR); |
4635 | 4520 gtk_text_buffer_set_text( |
4521 gtk_text_view_get_buffer(GTK_TEXT_VIEW(mtd->textbox)), | |
4522 mtd->text?mtd->text:"", -1); | |
4523 gtk_container_add(GTK_CONTAINER (sw), mtd->textbox); | |
2956 | 4524 gtk_widget_show(mtd->textbox); |
4635 | 4525 gtk_widget_show(sw); |
2956 | 4526 gtk_widget_show(frame); |
4527 } | |
4528 | |
4529 gtk_widget_show(*texts_ibox); | |
4530 } | |
4531 | |
4532 /* | |
4533 * Create and initialize a new Multi-Entry Dialog struct | |
4534 */ | |
4535 MultiEntryDlg *multi_entry_dialog_new() | |
4536 { | |
4537 MultiEntryDlg *b = g_new0(MultiEntryDlg, 1); | |
4538 b->instructions = g_new0(MultiInstrData, 1); | |
4539 b->multi_entry_items = NULL; | |
4540 b->multi_text_items = NULL; | |
4541 return(b); | |
4542 } | |
4543 | |
4544 /* | |
4545 * Instantiate a new multi-entry dialog | |
4546 * | |
4547 * data == pointer to MultiEntryDlg with the following | |
4548 * initialized: | |
4549 * | |
4074 | 4550 * role |
2956 | 4551 * title |
4552 * user | |
4553 * multi_entry_items - pointers to MultiEntryData list | |
4554 * and MultiTextData list | |
4555 * instructions (optional) | |
4556 * ok function pointer | |
4557 * cancel function pointer (actually used to set | |
4558 * window destroy signal--cancel asserts destroy) | |
4559 * | |
4560 * sets the following in the MultiEntryDialog struct: | |
4561 * | |
4562 * window | |
4563 */ | |
4564 void show_multi_entry_dialog(gpointer data) | |
4565 { | |
4566 GtkWidget *vbox, *hbox; | |
4567 GtkWidget *button; | |
4568 MultiEntryDlg *b = data; | |
4569 | |
4570 GAIM_DIALOG(b->window); | |
2969 | 4571 gtk_container_set_border_width(GTK_CONTAINER(b->window), 5); |
4074 | 4572 gtk_window_set_role(GTK_WINDOW(b->window), b->role); |
2956 | 4573 gtk_window_set_title(GTK_WINDOW (b->window), b->title); |
2969 | 4574 |
2956 | 4575 /* Clean up if user dismisses window via window manager! */ |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4576 g_signal_connect(GTK_OBJECT(b->window), "destroy", G_CALLBACK(b->cancel), (gpointer) b); |
2956 | 4577 gtk_widget_realize(b->window); |
4578 | |
4579 vbox = gtk_vbox_new(FALSE, 5); | |
4580 gtk_container_add(GTK_CONTAINER (b->window), vbox); | |
4581 | |
4582 b->instructions->label = gtk_label_new(NULL); | |
4583 gtk_label_set_line_wrap(GTK_LABEL (b->instructions->label), TRUE); | |
4584 gtk_box_pack_start(GTK_BOX (vbox), b->instructions->label, TRUE, TRUE, 5); | |
4585 re_show_multi_entry_instr(b->instructions); | |
4586 | |
2975 | 4587 b->entries_frame = gtk_frame_new(b->entries_title); |
2956 | 4588 gtk_box_pack_start(GTK_BOX (vbox), b->entries_frame, TRUE, TRUE, 5); |
4589 b->entries_table = NULL; | |
4590 re_show_multi_entry_entries(&(b->entries_table), b->entries_frame, b->multi_entry_items); | |
4591 | |
4592 b->texts_obox = gtk_vbox_new(FALSE, 0); | |
2969 | 4593 gtk_box_pack_start(GTK_BOX (vbox), b->texts_obox, TRUE, TRUE, 5); |
2956 | 4594 b->texts_ibox = NULL; |
4595 re_show_multi_entry_textboxes(&(b->texts_ibox), b->texts_obox, b->multi_text_items); | |
4596 | |
4597 hbox = gtk_hbox_new(FALSE, 0); | |
2969 | 4598 gtk_box_pack_start(GTK_BOX (vbox), hbox, FALSE, FALSE, 5); |
5024 | 4599 |
4600 button = gaim_pixbuf_button_from_stock(_("Save"), GTK_STOCK_SAVE, GAIM_BUTTON_HORIZONTAL); | |
4236 | 4601 g_signal_connect(GTK_OBJECT (button), "clicked", |
4602 G_CALLBACK (b->ok), (gpointer) b); | |
4603 gtk_box_pack_end(GTK_BOX (hbox), button, FALSE, FALSE, 5); | |
5024 | 4604 |
4605 button = gaim_pixbuf_button_from_stock(_("Cancel"), GTK_STOCK_CANCEL, GAIM_BUTTON_HORIZONTAL); | |
2969 | 4606 |
2956 | 4607 /* Let "destroy handling" (set above) handle cleanup */ |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4608 g_signal_connect_swapped(GTK_OBJECT (button), "clicked", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4142
diff
changeset
|
4609 G_CALLBACK (gtk_widget_destroy), GTK_OBJECT (b->window)); |
2969 | 4610 gtk_box_pack_end(GTK_BOX (hbox), button, FALSE, FALSE, 5); |
5024 | 4611 |
4612 gtk_widget_show_all(b->window); | |
2956 | 4613 } |
4614 | |
4615 | |
4616 /*------------------------------------*/ | |
4617 /* V-Card dialog specific support */ | |
4618 /*------------------------------------*/ | |
4619 | |
4620 /* | |
4621 * V-Card "set info" dialog "Save" clicked | |
4622 * | |
4623 * Copy data from GTK+ dialogs into GSLists, call protocol-specific | |
4624 * formatter and save the user info data. | |
4625 */ | |
4626 void set_vcard_dialog_ok_clicked(GtkWidget *widget, gpointer data) | |
4627 { | |
4628 MultiEntryDlg *b = (MultiEntryDlg *) data; | |
4629 struct gaim_connection *gc; | |
4630 gchar *tmp; | |
4631 GSList *list; | |
4632 | |
4633 for(list = b->multi_entry_items; list != NULL; list = list->next) { | |
4634 if(((MultiEntryData *) list->data)->text != NULL) { | |
4635 g_free(((MultiEntryData *) list->data)->text); | |
4636 } | |
4637 ((MultiEntryData *) list->data)->text = | |
4638 g_strdup(gtk_entry_get_text(GTK_ENTRY(((MultiEntryData *) list->data)->widget))); | |
4639 } | |
4640 | |
4641 for(list = b->multi_text_items; list != NULL; list = list->next) { | |
4642 if(((MultiTextData *) list->data)->text != NULL) { | |
4643 g_free(((MultiTextData *) list->data)->text); | |
4644 } | |
4645 ((MultiTextData *) list->data)->text = | |
4635 | 4646 gtk_text_view_get_text(GTK_TEXT_VIEW(((MultiTextData *) list->data)->textbox), FALSE); |
2956 | 4647 } |
4648 | |
4649 | |
4650 tmp = b->custom(b); | |
4651 | |
4652 /* | |
4653 * Set the user info and (possibly) send to the server | |
4654 */ | |
4491 | 4655 if (b->account) { |
4656 strncpy(b->account->user_info, tmp, sizeof b->account->user_info); | |
4657 gc = b->account->gc; | |
2956 | 4658 |
4659 save_prefs(); | |
4660 | |
4661 if (gc) | |
4491 | 4662 serv_set_info(gc, b->account->user_info); |
2956 | 4663 } |
4664 | |
4665 g_free(tmp); | |
4666 | |
4667 /* Let multi-edit dialog window "destroy" event catching handle remaining cleanup */ | |
4668 gtk_widget_destroy(GTK_WIDGET (b->window)); | |
4669 } | |
4670 | |
4671 /* | |
4672 * Instantiate a v-card dialog | |
4673 */ | |
4674 void show_set_vcard(MultiEntryDlg *b) | |
4675 { | |
4676 b->ok = set_vcard_dialog_ok_clicked; | |
4677 b->cancel = multi_entry_dialog_destroy; | |
4678 | |
4679 show_multi_entry_dialog(b); | |
4680 } | |
4681 | |
4682 | |
4683 /*------------------------------------------------------------------------*/ | |
4684 /* End dialog for setting v-card info */ | |
4685 /*------------------------------------------------------------------------*/ | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
4686 |