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