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