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