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