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