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