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