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