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