Mercurial > pidgin.yaz
annotate src/dialogs.c @ 9358:5a9155e564d6
[gaim-migrate @ 10166]
updated
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Wed, 23 Jun 2004 15:12:02 +0000 |
parents | 7a8aa87164ae |
children | a88c8ca91518 |
rev | line source |
---|---|
1 | 1 /* |
2 * gaim | |
3 * | |
8046 | 4 * Gaim is the legal property of its developers, whose names are too numerous |
5 * to list here. Please refer to the COPYRIGHT file distributed with this | |
6 * source distribution. | |
6465
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6431
diff
changeset
|
7 * |
1 | 8 * This program is free software; you can redistribute it and/or modify |
9 * it under the terms of the GNU General Public License as published by | |
10 * the Free Software Foundation; either version 2 of the License, or | |
11 * (at your option) any later version. | |
12 * | |
13 * This program is distributed in the hope that it will be useful, | |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 * GNU General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU General Public License | |
19 * along with this program; if not, write to the Free Software | |
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
21 */ | |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6352
diff
changeset
|
22 #include "gtkinternal.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
23 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
24 #include "debug.h" |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5411
diff
changeset
|
25 #include "notify.h" |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
26 #include "prefs.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
27 #include "prpl.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
28 #include "request.h" |
6065 | 29 #include "status.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
30 #include "util.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
31 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
32 #include "gtkimhtml.h" |
8317 | 33 #include "gtkimhtmltoolbar.h" |
9285 | 34 #include "gtklog.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
35 #include "gtkutils.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
36 #include "stock.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
37 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
38 #include "ui.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
39 |
6646
b89d98f0bf79
[gaim-migrate @ 7171]
Christian Hammond <chipx86@chipx86.com>
parents:
6640
diff
changeset
|
40 /* XXX */ |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
41 #include "gaim.h" |
1035
80a47e3b1bca
[gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1032
diff
changeset
|
42 |
1 | 43 static GList *dialogwindows = NULL; |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
44 |
2743 | 45 struct confirm_del { |
46 GtkWidget *window; | |
47 GtkWidget *label; | |
48 GtkWidget *ok; | |
49 GtkWidget *cancel; | |
50 char name[1024]; | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
51 GaimConnection *gc; |
2743 | 52 }; |
53 | |
1 | 54 struct create_away { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
55 GtkWidget *window; |
8317 | 56 GtkWidget *toolbar; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
57 GtkWidget *entry; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
58 GtkWidget *text; |
832
0142b4c66394
[gaim-migrate @ 842]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
825
diff
changeset
|
59 struct away_message *mess; |
1 | 60 }; |
61 | |
62 struct warning { | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
63 GtkWidget *window; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
64 GtkWidget *anon; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
65 char *who; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
66 GaimConnection *gc; |
1 | 67 }; |
68 | |
3197 | 69 struct getuserinfo { |
70 GtkWidget *window; | |
71 GtkWidget *entry; | |
72 GtkWidget *account; | |
6465
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6431
diff
changeset
|
73 GaimConnection *gc; |
3197 | 74 }; |
75 | |
2621
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
76 struct view_log { |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
77 long offset; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
78 int options; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
79 char *name; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
80 GtkWidget *bbox; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
81 GtkWidget *window; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
82 GtkWidget *layout; |
7330 | 83 void *clear_handle; |
2621
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
84 }; |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
85 |
4119 | 86 /* Wrapper to get all the text from a GtkTextView */ |
87 gchar* gtk_text_view_get_text(GtkTextView *text, gboolean include_hidden_chars) | |
88 { | |
89 GtkTextBuffer *buffer; | |
90 GtkTextIter start, end; | |
91 | |
92 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)); | |
93 gtk_text_buffer_get_start_iter(buffer, &start); | |
94 gtk_text_buffer_get_end_iter(buffer, &end); | |
95 | |
96 return gtk_text_buffer_get_text(buffer, &start, &end, include_hidden_chars); | |
97 } | |
98 | |
1 | 99 /*------------------------------------------------------------------------*/ |
100 /* Destroys */ | |
101 /*------------------------------------------------------------------------*/ | |
102 | |
103 static void destroy_dialog(GtkWidget *w, GtkWidget *w2) | |
104 { | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
105 GtkWidget *dest; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
106 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
107 if (!GTK_IS_WIDGET(w2)) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
108 dest = w; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
109 else |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
110 dest = w2; |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
111 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
112 dialogwindows = g_list_remove(dialogwindows, dest); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
113 gtk_widget_destroy(dest); |
1 | 114 } |
115 | |
116 void destroy_all_dialogs() | |
117 { | |
2621
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
118 while (dialogwindows) |
f8b02cf4af94
[gaim-migrate @ 2634]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2613
diff
changeset
|
119 destroy_dialog(NULL, dialogwindows->data); |
1 | 120 |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
121 if (awaymessage) |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
122 do_im_back(NULL, NULL); |
1 | 123 } |
124 | |
3757 | 125 static void do_warn(GtkWidget *widget, gint resp, struct warning *w) |
1 | 126 { |
3757 | 127 if (resp == GTK_RESPONSE_OK) |
128 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
|
129 |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
130 destroy_dialog(NULL, w->window); |
7879 | 131 g_free(w->who); |
1288
d8eaf65ca9c3
[gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1272
diff
changeset
|
132 g_free(w); |
d8eaf65ca9c3
[gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1272
diff
changeset
|
133 } |
1 | 134 |
7879 | 135 void show_warn_dialog(GaimConnection *gc, const char *who) |
1 | 136 { |
3757 | 137 char *labeltext; |
138 GtkWidget *hbox, *vbox; | |
1 | 139 GtkWidget *label; |
5024 | 140 GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG); |
6640
314111e7b601
[gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents:
6623
diff
changeset
|
141 GaimConversation *c = gaim_find_conversation_with_account(who, gc->account); |
441 | 142 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
143 struct warning *w = g_new0(struct warning, 1); |
7879 | 144 w->who = g_strdup(who); |
1288
d8eaf65ca9c3
[gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1272
diff
changeset
|
145 w->gc = gc; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
146 |
3757 | 147 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); |
148 | |
6112 | 149 w->window = gtk_dialog_new_with_buttons(_("Warn User"), |
150 GTK_WINDOW(GAIM_GTK_WINDOW(c->window)->window), 0, | |
151 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, | |
8300
0f5cb0d93b11
[gaim-migrate @ 9024]
Christian Hammond <chipx86@chipx86.com>
parents:
8293
diff
changeset
|
152 GAIM_STOCK_WARN, GTK_RESPONSE_OK, NULL); |
4118 | 153 gtk_dialog_set_default_response (GTK_DIALOG(w->window), GTK_RESPONSE_OK); |
3757 | 154 g_signal_connect(G_OBJECT(w->window), "response", G_CALLBACK(do_warn), w); |
155 | |
156 gtk_container_set_border_width (GTK_CONTAINER(w->window), 6); | |
157 gtk_window_set_resizable(GTK_WINDOW(w->window), FALSE); | |
158 gtk_dialog_set_has_separator(GTK_DIALOG(w->window), FALSE); | |
159 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(w->window)->vbox), 12); | |
160 gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(w->window)->vbox), 6); | |
161 | |
162 hbox = gtk_hbox_new(FALSE, 12); | |
163 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(w->window)->vbox), hbox); | |
164 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
6465
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6431
diff
changeset
|
165 |
3757 | 166 vbox = gtk_vbox_new(FALSE, 0); |
167 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
168 labeltext = g_strdup_printf(_("<span weight=\"bold\" size=\"larger\">Warn %s?</span>\n\n" | |
169 "This will increase %s's warning level and he or she will be subject to harsher rate limiting.\n"), who, who); | |
170 label = gtk_label_new(NULL); | |
171 gtk_label_set_markup(GTK_LABEL(label), labeltext); | |
172 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
173 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
174 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
175 g_free(labeltext); | |
176 | |
177 w->anon = gtk_check_button_new_with_mnemonic(_("Warn _anonymously?")); | |
178 gtk_box_pack_start(GTK_BOX(vbox), w->anon, FALSE, FALSE, 0); | |
6465
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6431
diff
changeset
|
179 |
3757 | 180 hbox = gtk_hbox_new(FALSE, 6); |
181 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
182 img = gtk_image_new_from_stock(GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_MENU); | |
183 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
184 labeltext = _("<b>Anonymous warnings are less severe.</b>"); | |
185 label = gtk_label_new(NULL); | |
186 gtk_label_set_markup(GTK_LABEL(label), labeltext); | |
187 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
188 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
189 | |
1288
d8eaf65ca9c3
[gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1272
diff
changeset
|
190 dialogwindows = g_list_prepend(dialogwindows, w->window); |
3757 | 191 gtk_widget_show_all(w->window); |
1 | 192 } |
193 | |
6334
930708df05dd
[gaim-migrate @ 6833]
Christian Hammond <chipx86@chipx86.com>
parents:
6331
diff
changeset
|
194 static void |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
195 do_remove_chat(GaimChat *chat) |
5234 | 196 { |
197 gaim_blist_remove_chat(chat); | |
198 } | |
199 | |
6334
930708df05dd
[gaim-migrate @ 6833]
Christian Hammond <chipx86@chipx86.com>
parents:
6331
diff
changeset
|
200 static void |
9285 | 201 do_remove_buddy(GaimBuddy *buddy) |
2743 | 202 { |
9285 | 203 GaimGroup *group; |
204 GaimConversation *conv; | |
4918
553d96cb9b26
[gaim-migrate @ 5252]
Christian Hammond <chipx86@chipx86.com>
parents:
4916
diff
changeset
|
205 gchar *name; |
6640
314111e7b601
[gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents:
6623
diff
changeset
|
206 GaimAccount *account; |
2743 | 207 |
9285 | 208 if (!buddy) |
2743 | 209 return; |
210 | |
9285 | 211 group = gaim_find_buddys_group(buddy); |
212 name = g_strdup(buddy->name); /* b->name is a crasher after remove_buddy */ | |
213 account = buddy->account; | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
214 |
5213
1cf4eb75e3ee
[gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
215 gaim_debug(GAIM_DEBUG_INFO, "blist", |
9285 | 216 "Removing '%s' from buddy list.\n", buddy->name); |
217 /* XXX - Should remove from blist first... then call serv_remove_buddy()? */ | |
218 serv_remove_buddy(buddy->account->gc, buddy, group); | |
219 gaim_blist_remove_buddy(buddy); | |
2743 | 220 |
9285 | 221 conv = gaim_find_conversation_with_account(name, account); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4350
diff
changeset
|
222 |
9285 | 223 if (conv != NULL) |
224 gaim_conversation_update(conv, GAIM_CONV_UPDATE_REMOVE); | |
4397
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4372
diff
changeset
|
225 |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4372
diff
changeset
|
226 g_free(name); |
2743 | 227 } |
228 | |
9285 | 229 static void do_remove_contact(GaimContact *contact) |
6742 | 230 { |
231 GaimBlistNode *bnode, *cnode; | |
9285 | 232 GaimGroup *group; |
6742 | 233 |
9285 | 234 if (!contact) |
6742 | 235 return; |
236 | |
9285 | 237 cnode = (GaimBlistNode *)contact; |
238 group = (GaimGroup*)cnode->parent; | |
239 for (bnode = cnode->child; bnode; bnode = bnode->next) { | |
240 GaimBuddy *buddy = (GaimBuddy*)bnode; | |
241 if (gaim_account_is_connected(buddy->account)) | |
242 serv_remove_buddy(buddy->account->gc, buddy, group); | |
6742 | 243 } |
9285 | 244 gaim_blist_remove_contact(contact); |
6742 | 245 } |
246 | |
9285 | 247 void do_remove_group(GaimGroup *group) |
4916 | 248 { |
6695 | 249 GaimBlistNode *cnode, *bnode; |
6885
66dd420d3d23
[gaim-migrate @ 7431]
Christian Hammond <chipx86@chipx86.com>
parents:
6878
diff
changeset
|
250 |
9285 | 251 cnode = ((GaimBlistNode*)group)->child; |
6885
66dd420d3d23
[gaim-migrate @ 7431]
Christian Hammond <chipx86@chipx86.com>
parents:
6878
diff
changeset
|
252 |
9285 | 253 while (cnode) { |
254 if (GAIM_BLIST_NODE_IS_CONTACT(cnode)) { | |
6695 | 255 bnode = cnode->child; |
256 cnode = cnode->next; | |
9285 | 257 while (bnode) { |
258 GaimBuddy *buddy; | |
259 if (GAIM_BLIST_NODE_IS_BUDDY(bnode)) { | |
260 GaimConversation *conv; | |
261 buddy = (GaimBuddy*)bnode; | |
6695 | 262 bnode = bnode->next; |
9285 | 263 conv = gaim_find_conversation_with_account(buddy->name, buddy->account); |
264 if (gaim_account_is_connected(buddy->account)) { | |
265 serv_remove_buddy(buddy->account->gc, buddy, group); | |
266 gaim_blist_remove_buddy(buddy); | |
267 if (conv) | |
268 gaim_conversation_update(conv, | |
6695 | 269 GAIM_CONV_UPDATE_REMOVE); |
270 } | |
271 } else { | |
272 bnode = bnode->next; | |
273 } | |
5234 | 274 } |
9285 | 275 } else if (GAIM_BLIST_NODE_IS_CHAT(cnode)) { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
276 GaimChat *chat = (GaimChat *)cnode; |
6695 | 277 cnode = cnode->next; |
9285 | 278 if (gaim_account_is_connected(chat->account)) |
6088 | 279 gaim_blist_remove_chat(chat); |
6695 | 280 } else { |
281 cnode = cnode->next; | |
4938 | 282 } |
4916 | 283 } |
6885
66dd420d3d23
[gaim-migrate @ 7431]
Christian Hammond <chipx86@chipx86.com>
parents:
6878
diff
changeset
|
284 |
9285 | 285 gaim_blist_remove_group(group); |
4916 | 286 } |
287 | |
9285 | 288 void show_confirm_del(GaimBuddy *buddy) |
2743 | 289 { |
3753 | 290 char *text; |
9285 | 291 |
292 if (!buddy) | |
3753 | 293 return; |
294 | |
9285 | 295 text = g_strdup_printf(_("You are about to remove %s from your buddy list. Do you want to continue?"), buddy->name); |
5975 | 296 |
9285 | 297 gaim_request_action(NULL, NULL, _("Remove Buddy"), text, -1, buddy, 2, |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
298 _("Remove Buddy"), G_CALLBACK(do_remove_buddy), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
299 _("Cancel"), NULL); |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
300 |
3753 | 301 g_free(text); |
2743 | 302 } |
303 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
304 void show_confirm_del_blist_chat(GaimChat *chat) |
5234 | 305 { |
7125 | 306 char *name = gaim_chat_get_display_name(chat); |
6034 | 307 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
|
308 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
309 gaim_request_action(NULL, NULL, _("Remove Chat"), text, -1, chat, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
310 _("Remove Chat"), G_CALLBACK(do_remove_chat), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
311 _("Cancel"), NULL); |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
312 |
6034 | 313 g_free(name); |
5234 | 314 g_free(text); |
315 } | |
316 | |
9285 | 317 void show_confirm_del_group(GaimGroup *group) |
4916 | 318 { |
6465
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6431
diff
changeset
|
319 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?"), |
9285 | 320 group->name); |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
321 |
9285 | 322 gaim_request_action(NULL, NULL, _("Remove Group"), text, -1, group, 2, |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
323 _("Remove Group"), G_CALLBACK(do_remove_group), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
324 _("Cancel"), NULL); |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
325 |
4916 | 326 g_free(text); |
327 } | |
1 | 328 |
9285 | 329 void show_confirm_del_contact(GaimContact *contact) |
6742 | 330 { |
9285 | 331 GaimBuddy *buddy = gaim_contact_get_priority_buddy(contact); |
6742 | 332 |
9285 | 333 if (!buddy) |
6742 | 334 return; |
335 | |
9285 | 336 if (((GaimBlistNode*)contact)->child == (GaimBlistNode*)buddy && |
337 !((GaimBlistNode*)buddy)->next) { | |
338 show_confirm_del(buddy); | |
6742 | 339 } else { |
340 char *text = g_strdup_printf(_("You are about to remove the contact containing %s and %d other buddies from your buddy list. Do you want to continue?"), | |
9285 | 341 buddy->name, contact->totalsize - 1); |
6742 | 342 |
9285 | 343 gaim_request_action(NULL, NULL, _("Remove Contact"), text, -1, contact, 2, |
6742 | 344 _("Remove Contact"), G_CALLBACK(do_remove_contact), |
345 _("Cancel"), NULL); | |
346 | |
347 g_free(text); | |
348 } | |
349 } | |
350 | |
7757 | 351 static gboolean show_ee_dialog(const char *ee) |
1 | 352 { |
3767 | 353 GtkWidget *window; |
354 GtkWidget *hbox; | |
1 | 355 GtkWidget *label; |
5024 | 356 GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_COOL, GTK_ICON_SIZE_DIALOG); |
7757 | 357 gchar *norm = gaim_strreplace(ee, "rocksmyworld", ""); |
4695
4bdd9a5fd026
[gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
358 |
3767 | 359 label = gtk_label_new(NULL); |
7757 | 360 if (!strcmp(norm, "zilding")) |
6465
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6431
diff
changeset
|
361 gtk_label_set_markup(GTK_LABEL(label), |
3767 | 362 "<span weight=\"bold\" size=\"large\" foreground=\"purple\">Amazing! Simply Amazing!</span>"); |
7757 | 363 else if (!strcmp(norm, "robflynn")) |
6465
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6431
diff
changeset
|
364 gtk_label_set_markup(GTK_LABEL(label), |
3767 | 365 "<span weight=\"bold\" size=\"large\" foreground=\"#1f6bad\">Pimpin\' Penguin Style! *Waddle Waddle*</span>"); |
7757 | 366 else if (!strcmp(norm, "flynorange")) |
6465
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6431
diff
changeset
|
367 gtk_label_set_markup(GTK_LABEL(label), |
3767 | 368 "<span weight=\"bold\" size=\"large\" foreground=\"blue\">You should be me. I'm so cute!</span>"); |
7757 | 369 else if (!strcmp(norm, "ewarmenhoven")) |
6465
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6431
diff
changeset
|
370 gtk_label_set_markup(GTK_LABEL(label), |
3767 | 371 "<span weight=\"bold\" size=\"large\" foreground=\"orange\">Now that's what I like!</span>"); |
7757 | 372 else if (!strcmp(norm, "markster97")) |
6465
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6431
diff
changeset
|
373 gtk_label_set_markup(GTK_LABEL(label), |
3767 | 374 "<span weight=\"bold\" size=\"large\" foreground=\"brown\">Ahh, and excellent choice!</span>"); |
7757 | 375 else if (!strcmp(norm, "seanegn")) |
6465
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6431
diff
changeset
|
376 gtk_label_set_markup(GTK_LABEL(label), |
3767 | 377 "<span weight=\"bold\" size=\"large\" foreground=\"#009900\">Everytime you click my name, an angel gets its wings.</span>"); |
7757 | 378 else if (!strcmp(norm, "chipx86")) |
6465
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6431
diff
changeset
|
379 gtk_label_set_markup(GTK_LABEL(label), |
3767 | 380 "<span weight=\"bold\" size=\"large\" foreground=\"red\">This sunflower seed taste like pizza.</span>"); |
7757 | 381 else if (!strcmp(norm, "markdoliner")) |
6465
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6431
diff
changeset
|
382 gtk_label_set_markup(GTK_LABEL(label), |
3767 | 383 "<span weight=\"bold\" size=\"large\" foreground=\"#6364B1\">Hey! I was in that tumbleweed!</span>"); |
7757 | 384 else if (!strcmp(norm, "lschiere")) |
6465
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6431
diff
changeset
|
385 gtk_label_set_markup(GTK_LABEL(label), |
3767 | 386 "<span weight=\"bold\" size=\"large\" foreground=\"gray\">I'm not anything.</span>"); |
7757 | 387 g_free(norm); |
388 | |
389 if (strlen(gtk_label_get_label(GTK_LABEL(label))) <= 0) | |
390 return FALSE; | |
6465
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6431
diff
changeset
|
391 |
9285 | 392 window = gtk_dialog_new_with_buttons(GAIM_ALERT_TITLE, NULL, 0, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); |
3767 | 393 gtk_dialog_set_default_response (GTK_DIALOG(window), GTK_RESPONSE_OK); |
394 g_signal_connect(G_OBJECT(window), "response", G_CALLBACK(gtk_widget_destroy), NULL); | |
6465
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6431
diff
changeset
|
395 |
3767 | 396 gtk_container_set_border_width (GTK_CONTAINER(window), 6); |
397 gtk_window_set_resizable(GTK_WINDOW(window), FALSE); | |
398 gtk_dialog_set_has_separator(GTK_DIALOG(window), FALSE); | |
399 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(window)->vbox), 12); | |
400 gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(window)->vbox), 6); | |
401 | |
402 hbox = gtk_hbox_new(FALSE, 12); | |
403 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(window)->vbox), hbox); | |
404 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
6465
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6431
diff
changeset
|
405 |
3767 | 406 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); |
407 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
408 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
4635 | 409 |
3767 | 410 gtk_widget_show_all(window); |
7757 | 411 return TRUE; |
412 } | |
413 | |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8152
diff
changeset
|
414 static void |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8152
diff
changeset
|
415 new_im_cb(gpointer data, GaimRequestFields *fields) |
1 | 416 { |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8152
diff
changeset
|
417 const char *username; |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8152
diff
changeset
|
418 GaimAccount *account; |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8152
diff
changeset
|
419 GaimConversation *conv; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
420 |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8152
diff
changeset
|
421 username = gaim_request_fields_get_string(fields, "screenname"); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8152
diff
changeset
|
422 account = gaim_request_fields_get_account(fields, "account"); |
4695
4bdd9a5fd026
[gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
423 |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8152
diff
changeset
|
424 conv = gaim_find_conversation_with_account(username, account); |
4613 | 425 |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8152
diff
changeset
|
426 if (conv == NULL) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8152
diff
changeset
|
427 conv = gaim_conversation_new(GAIM_CONV_IM, account, username); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8152
diff
changeset
|
428 else |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8152
diff
changeset
|
429 gaim_conv_window_raise(gaim_conversation_get_window(conv)); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8152
diff
changeset
|
430 } |
7755 | 431 |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8152
diff
changeset
|
432 void |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8152
diff
changeset
|
433 show_im_dialog(void) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8152
diff
changeset
|
434 { |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8152
diff
changeset
|
435 GaimRequestFields *fields; |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8152
diff
changeset
|
436 GaimRequestFieldGroup *group; |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8152
diff
changeset
|
437 GaimRequestField *field; |
4613 | 438 |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8152
diff
changeset
|
439 fields = gaim_request_fields_new(); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8152
diff
changeset
|
440 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8152
diff
changeset
|
441 group = gaim_request_field_group_new(NULL); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8152
diff
changeset
|
442 gaim_request_fields_add_group(fields, group); |
4613 | 443 |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8152
diff
changeset
|
444 field = gaim_request_field_string_new("screenname", _("_Screen name"), |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8152
diff
changeset
|
445 NULL, FALSE); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8152
diff
changeset
|
446 gaim_request_field_set_required(field, TRUE); |
8293
a1b7c7f3d9a7
[gaim-migrate @ 9017]
Christian Hammond <chipx86@chipx86.com>
parents:
8290
diff
changeset
|
447 gaim_request_field_set_type_hint(field, "screenname"); |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8152
diff
changeset
|
448 gaim_request_field_group_add_field(group, field); |
7755 | 449 |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8152
diff
changeset
|
450 field = gaim_request_field_account_new("account", _("_Account"), NULL); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8152
diff
changeset
|
451 gaim_request_field_set_visible(field, |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8152
diff
changeset
|
452 (gaim_connections_get_all() != NULL && |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8152
diff
changeset
|
453 gaim_connections_get_all()->next != NULL)); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8152
diff
changeset
|
454 gaim_request_field_set_required(field, TRUE); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8152
diff
changeset
|
455 gaim_request_field_group_add_field(group, field); |
4613 | 456 |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8152
diff
changeset
|
457 gaim_request_fields(gaim_get_blist(), _("New Instant Message"), |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8152
diff
changeset
|
458 NULL, |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8152
diff
changeset
|
459 _("Please enter the screen name of the person you " |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8152
diff
changeset
|
460 "would like to IM."), |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8152
diff
changeset
|
461 fields, |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8152
diff
changeset
|
462 _("OK"), G_CALLBACK(new_im_cb), |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8152
diff
changeset
|
463 _("Cancel"), NULL, |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8152
diff
changeset
|
464 NULL); |
3197 | 465 } |
466 | |
8290
84ec38c3efcc
[gaim-migrate @ 9014]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
467 static void |
84ec38c3efcc
[gaim-migrate @ 9014]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
468 get_info_cb(gpointer data, GaimRequestFields *fields) |
935
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
934
diff
changeset
|
469 { |
8290
84ec38c3efcc
[gaim-migrate @ 9014]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
470 char *username; |
84ec38c3efcc
[gaim-migrate @ 9014]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
471 gboolean found = FALSE; |
84ec38c3efcc
[gaim-migrate @ 9014]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
472 GaimAccount *account; |
3197 | 473 |
8290
84ec38c3efcc
[gaim-migrate @ 9014]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
474 account = gaim_request_fields_get_account(fields, "account"); |
6465
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6431
diff
changeset
|
475 |
8290
84ec38c3efcc
[gaim-migrate @ 9014]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
476 username = g_strdup(gaim_normalize(account, |
84ec38c3efcc
[gaim-migrate @ 9014]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
477 gaim_request_fields_get_string(fields, "screenname"))); |
5880
1b85ff65be57
[gaim-migrate @ 6312]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
478 |
8290
84ec38c3efcc
[gaim-migrate @ 9014]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
479 if (username != NULL && gaim_str_has_suffix(username, "rocksmyworld")) |
84ec38c3efcc
[gaim-migrate @ 9014]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
480 found = show_ee_dialog(username); |
1 | 481 |
8290
84ec38c3efcc
[gaim-migrate @ 9014]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
482 if (!found && username != NULL && *username != '\0' && account != NULL) |
84ec38c3efcc
[gaim-migrate @ 9014]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
483 serv_get_info(gaim_account_get_connection(account), username); |
1 | 484 |
8290
84ec38c3efcc
[gaim-migrate @ 9014]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
485 g_free(username); |
1 | 486 } |
487 | |
8290
84ec38c3efcc
[gaim-migrate @ 9014]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
488 void |
84ec38c3efcc
[gaim-migrate @ 9014]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
489 show_info_dialog(void) |
1 | 490 { |
8290
84ec38c3efcc
[gaim-migrate @ 9014]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
491 GaimRequestFields *fields; |
84ec38c3efcc
[gaim-migrate @ 9014]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
492 GaimRequestFieldGroup *group; |
84ec38c3efcc
[gaim-migrate @ 9014]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
493 GaimRequestField *field; |
7927 | 494 |
8290
84ec38c3efcc
[gaim-migrate @ 9014]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
495 fields = gaim_request_fields_new(); |
1 | 496 |
8290
84ec38c3efcc
[gaim-migrate @ 9014]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
497 group = gaim_request_field_group_new(NULL); |
84ec38c3efcc
[gaim-migrate @ 9014]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
498 gaim_request_fields_add_group(fields, group); |
4262 | 499 |
8290
84ec38c3efcc
[gaim-migrate @ 9014]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
500 field = gaim_request_field_string_new("screenname", _("_Screen name"), |
84ec38c3efcc
[gaim-migrate @ 9014]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
501 NULL, FALSE); |
8293
a1b7c7f3d9a7
[gaim-migrate @ 9017]
Christian Hammond <chipx86@chipx86.com>
parents:
8290
diff
changeset
|
502 gaim_request_field_set_type_hint(field, "screenname"); |
8290
84ec38c3efcc
[gaim-migrate @ 9014]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
503 gaim_request_field_set_required(field, TRUE); |
84ec38c3efcc
[gaim-migrate @ 9014]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
504 gaim_request_field_group_add_field(group, field); |
6465
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6431
diff
changeset
|
505 |
8290
84ec38c3efcc
[gaim-migrate @ 9014]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
506 field = gaim_request_field_account_new("account", _("_Account"), NULL); |
84ec38c3efcc
[gaim-migrate @ 9014]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
507 gaim_request_field_set_visible(field, |
84ec38c3efcc
[gaim-migrate @ 9014]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
508 (gaim_connections_get_all() != NULL && |
84ec38c3efcc
[gaim-migrate @ 9014]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
509 gaim_connections_get_all()->next != NULL)); |
84ec38c3efcc
[gaim-migrate @ 9014]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
510 gaim_request_field_set_required(field, TRUE); |
84ec38c3efcc
[gaim-migrate @ 9014]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
511 gaim_request_field_group_add_field(group, field); |
6465
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6431
diff
changeset
|
512 |
8290
84ec38c3efcc
[gaim-migrate @ 9014]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
513 gaim_request_fields(gaim_get_blist(), _("Get User Info"), |
84ec38c3efcc
[gaim-migrate @ 9014]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
514 NULL, |
84ec38c3efcc
[gaim-migrate @ 9014]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
515 _("Please enter the screen name of the person whose " |
84ec38c3efcc
[gaim-migrate @ 9014]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
516 "info you would like to view."), |
84ec38c3efcc
[gaim-migrate @ 9014]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
517 fields, |
84ec38c3efcc
[gaim-migrate @ 9014]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
518 _("OK"), G_CALLBACK(get_info_cb), |
84ec38c3efcc
[gaim-migrate @ 9014]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
519 _("Cancel"), NULL, |
84ec38c3efcc
[gaim-migrate @ 9014]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
520 NULL); |
1 | 521 } |
522 | |
8911 | 523 static void |
524 get_log_cb(gpointer data, GaimRequestFields *fields) | |
525 { | |
526 char *username; | |
527 GaimAccount *account; | |
528 | |
529 account = gaim_request_fields_get_account(fields, "account"); | |
530 | |
531 username = g_strdup(gaim_normalize(account, | |
532 gaim_request_fields_get_string(fields, "screenname"))); | |
533 | |
534 if( username != NULL && *username != '\0' && account != NULL ) | |
535 gaim_gtk_log_show( username, account ); | |
536 | |
537 g_free(username); | |
538 } | |
539 | |
540 void | |
541 show_log_dialog(void) | |
542 { | |
543 GaimRequestFields *fields; | |
544 GaimRequestFieldGroup *group; | |
545 GaimRequestField *field; | |
546 | |
547 fields = gaim_request_fields_new(); | |
548 | |
549 group = gaim_request_field_group_new(NULL); | |
550 gaim_request_fields_add_group(fields, group); | |
551 | |
552 field = gaim_request_field_string_new("screenname", _("_Screen name"), | |
553 NULL, FALSE); | |
554 gaim_request_field_set_type_hint(field, "screenname"); | |
555 gaim_request_field_set_required(field, TRUE); | |
556 gaim_request_field_group_add_field(group, field); | |
557 | |
558 field = gaim_request_field_account_new("account", _("_Account"), NULL); | |
8936 | 559 gaim_request_field_account_set_show_all(field, TRUE); |
8911 | 560 gaim_request_field_set_visible(field, |
8936 | 561 (gaim_accounts_get_all() != NULL && |
562 gaim_accounts_get_all()->next != NULL)); | |
8911 | 563 gaim_request_field_set_required(field, TRUE); |
564 gaim_request_field_group_add_field(group, field); | |
565 | |
566 gaim_request_fields(gaim_get_blist(), _("Get User Log"), | |
567 NULL, | |
568 _("Please enter the screen name of the person whose " | |
569 "log you would like to view."), | |
570 fields, | |
571 _("OK"), G_CALLBACK(get_log_cb), | |
572 _("Cancel"), NULL, | |
573 NULL); | |
574 } | |
575 | |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
576 /*------------------------------------------------------------------------*/ |
1 | 577 /* The dialog for new away messages */ |
578 /*------------------------------------------------------------------------*/ | |
579 | |
8502 | 580 static void away_mess_destroy(GtkWidget *widget, struct create_away *ca) |
581 { | |
582 destroy_dialog(NULL, ca->window); | |
583 g_free(ca); | |
584 } | |
585 | |
586 static void away_mess_destroy_ca(GtkWidget *widget, GdkEvent *event, struct create_away *ca) | |
587 { | |
588 away_mess_destroy(NULL, ca); | |
589 } | |
590 | |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
591 static struct away_message *save_away_message(struct create_away *ca) |
717 | 592 { |
593 struct away_message *am; | |
594 gchar *away_message; | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
595 |
832
0142b4c66394
[gaim-migrate @ 842]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
825
diff
changeset
|
596 if (!ca->mess) |
0142b4c66394
[gaim-migrate @ 842]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
825
diff
changeset
|
597 am = g_new0(struct away_message, 1); |
2851
6eb5bf5089f0
[gaim-migrate @ 2864]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2827
diff
changeset
|
598 else { |
832
0142b4c66394
[gaim-migrate @ 842]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
825
diff
changeset
|
599 am = ca->mess; |
2851
6eb5bf5089f0
[gaim-migrate @ 2864]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2827
diff
changeset
|
600 } |
1387 | 601 |
717 | 602 g_snprintf(am->name, sizeof(am->name), "%s", gtk_entry_get_text(GTK_ENTRY(ca->entry))); |
8317 | 603 away_message = gtk_imhtml_get_markup(GTK_IMHTML(ca->text)); |
717 | 604 |
605 g_snprintf(am->message, sizeof(am->message), "%s", away_message); | |
606 g_free(away_message); | |
607 | |
7942 | 608 if (!ca->mess) |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
609 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
|
610 |
5560
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
611 do_away_menu(NULL); |
6065 | 612 gaim_status_sync(); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
613 |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
614 return am; |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
615 } |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
616 |
1387 | 617 int check_away_mess(struct create_away *ca, int type) |
618 { | |
8502 | 619 gchar *msg; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
620 if ((strlen(gtk_entry_get_text(GTK_ENTRY(ca->entry))) == 0) && (type == 1)) { |
1387 | 621 /* We shouldn't allow a blank title */ |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5411
diff
changeset
|
622 gaim_notify_error(NULL, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5411
diff
changeset
|
623 _("You cannot save an away message with a " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5411
diff
changeset
|
624 "blank title"), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5411
diff
changeset
|
625 _("Please give the message a title, or choose " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5411
diff
changeset
|
626 "\"Use\" to use without saving.")); |
1387 | 627 return 0; |
628 } | |
629 | |
8677 | 630 msg = gtk_imhtml_get_text(GTK_IMHTML(ca->text), NULL, NULL); |
4630 | 631 |
8502 | 632 if ((type <= 1) && ((msg == NULL) || (*msg == '\0'))) { |
1387 | 633 /* We shouldn't allow a blank message */ |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5411
diff
changeset
|
634 gaim_notify_error(NULL, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5411
diff
changeset
|
635 _("You cannot create an empty away message"), NULL); |
1387 | 636 return 0; |
637 } | |
638 | |
4630 | 639 g_free(msg); |
640 | |
1387 | 641 return 1; |
642 } | |
643 | |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
644 void save_away_mess(GtkWidget *widget, struct create_away *ca) |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
645 { |
1387 | 646 if (!check_away_mess(ca, 1)) |
647 return; | |
648 | |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
649 save_away_message(ca); |
8502 | 650 |
651 away_mess_destroy(NULL, ca); | |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
652 } |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
653 |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
654 void use_away_mess(GtkWidget *widget, struct create_away *ca) |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
655 { |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
656 static struct away_message am; |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
657 gchar *away_message; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
658 |
1387 | 659 if (!check_away_mess(ca, 0)) |
660 return; | |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
661 |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
662 g_snprintf(am.name, sizeof(am.name), "%s", gtk_entry_get_text(GTK_ENTRY(ca->entry))); |
8317 | 663 away_message = gtk_imhtml_get_markup(GTK_IMHTML(ca->text)); |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
664 |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
665 g_snprintf(am.message, sizeof(am.message), "%s", away_message); |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
666 g_free(away_message); |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
667 |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
668 do_away_message(NULL, &am); |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
669 |
8502 | 670 away_mess_destroy(NULL, ca); |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
671 } |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
672 |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
673 void su_away_mess(GtkWidget *widget, struct create_away *ca) |
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
674 { |
1387 | 675 if (!check_away_mess(ca, 1)) |
676 return; | |
8502 | 677 |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
678 do_away_message(NULL, save_away_message(ca)); |
8502 | 679 |
680 away_mess_destroy(NULL, ca); | |
717 | 681 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
682 |
1 | 683 void create_away_mess(GtkWidget *widget, void *dummy) |
684 { | |
7949 | 685 GtkWidget *vbox, *hbox; |
1 | 686 GtkWidget *label; |
7949 | 687 GtkWidget *sw; |
441 | 688 GtkWidget *button; |
9079 | 689 GList *focus_chain = NULL; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
690 struct create_away *ca = g_new0(struct create_away, 1); |
1185 | 691 |
1 | 692 /* Set up window */ |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
693 GAIM_DIALOG(ca->window); |
4635 | 694 gtk_widget_set_size_request(ca->window, -1, 250); |
7949 | 695 gtk_container_set_border_width(GTK_CONTAINER(ca->window), 6); |
4074 | 696 gtk_window_set_role(GTK_WINDOW(ca->window), "away_mess"); |
4703 | 697 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
|
698 g_signal_connect(G_OBJECT(ca->window), "delete_event", |
8502 | 699 G_CALLBACK(away_mess_destroy_ca), ca); |
1185 | 700 |
7949 | 701 /* |
702 * This would be higgy... but I think it's pretty ugly --Mark | |
703 * If you want to use this, make sure you add the vbox to the hbox below | |
704 */ | |
705 /* | |
706 hbox = gtk_hbox_new(FALSE, 12); | |
707 gtk_container_set_border_width(GTK_CONTAINER(hbox), 12); | |
708 gtk_container_add(GTK_CONTAINER(ca->window), hbox); | |
709 */ | |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
710 |
7949 | 711 vbox = gtk_vbox_new(FALSE, 12); |
712 gtk_container_add(GTK_CONTAINER(ca->window), vbox); | |
1185 | 713 |
7949 | 714 /* Away message title */ |
715 hbox = gtk_hbox_new(FALSE, 0); | |
716 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
717 |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
718 label = gtk_label_new(_("Away title: ")); |
7949 | 719 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
1185 | 720 |
1 | 721 ca->entry = gtk_entry_new(); |
7949 | 722 gtk_box_pack_start(GTK_BOX(hbox), ca->entry, TRUE, TRUE, 0); |
8137 | 723 gaim_set_accessible_label (ca->entry, label); |
9079 | 724 focus_chain = g_list_append(focus_chain, hbox); |
1 | 725 |
8317 | 726 /* Toolbar */ |
727 ca->toolbar = gtk_imhtmltoolbar_new(); | |
728 gtk_box_pack_start(GTK_BOX(vbox), ca->toolbar, FALSE, FALSE, 0); | |
729 | |
7949 | 730 /* Away message text */ |
731 sw = gtk_scrolled_window_new(NULL, NULL); | |
732 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
733 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); | |
734 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); | |
735 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); | |
5024 | 736 |
8317 | 737 ca->text = gtk_imhtml_new(NULL, NULL); |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
738 gtk_imhtml_set_editable(GTK_IMHTML(ca->text), TRUE); |
8788 | 739 gtk_imhtml_set_format_functions(GTK_IMHTML(ca->text), GTK_IMHTML_ALL ^ GTK_IMHTML_IMAGE); |
5105 | 740 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(ca->text), GTK_WRAP_WORD_CHAR); |
5024 | 741 |
8481 | 742 gtk_imhtml_smiley_shortcuts(GTK_IMHTML(ca->text), |
743 gaim_prefs_get_bool("/gaim/gtk/conversations/smiley_shortcuts")); | |
744 gtk_imhtml_html_shortcuts(GTK_IMHTML(ca->text), | |
745 gaim_prefs_get_bool("/gaim/gtk/conversations/html_shortcuts")); | |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7431
diff
changeset
|
746 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) |
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7431
diff
changeset
|
747 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(ca->text)); |
8317 | 748 gtk_imhtmltoolbar_attach(GTK_IMHTMLTOOLBAR(ca->toolbar), ca->text); |
8804 | 749 gtk_imhtmltoolbar_associate_smileys(GTK_IMHTMLTOOLBAR(ca->toolbar), "default"); |
750 gaim_setup_imhtml(ca->text); | |
7002 | 751 |
7949 | 752 gtk_container_add(GTK_CONTAINER(sw), ca->text); |
9079 | 753 focus_chain = g_list_append(focus_chain, sw); |
5024 | 754 |
3374 | 755 if (dummy) { |
756 struct away_message *amt; | |
757 GtkTreeIter iter; | |
758 GtkListStore *ls = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(dummy))); | |
759 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(dummy)); | |
760 GValue val = { 0, }; | |
761 | |
3716
d7e83b4db191
[gaim-migrate @ 3849]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3671
diff
changeset
|
762 if (! gtk_tree_selection_get_selected (sel, (GtkTreeModel**)&ls, &iter)) |
3374 | 763 return; |
3716
d7e83b4db191
[gaim-migrate @ 3849]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3671
diff
changeset
|
764 gtk_tree_model_get_value (GTK_TREE_MODEL(ls), &iter, 1, &val); |
3374 | 765 amt = g_value_get_pointer (&val); |
766 gtk_entry_set_text(GTK_ENTRY(ca->entry), amt->name); | |
8317 | 767 gtk_imhtml_append_text_with_images(GTK_IMHTML(ca->text), amt->message, 0, NULL); |
3374 | 768 ca->mess = amt; |
769 } | |
832
0142b4c66394
[gaim-migrate @ 842]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
825
diff
changeset
|
770 |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
771 hbox = gtk_hbox_new(FALSE, 5); |
7949 | 772 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
5024 | 773 |
8973 | 774 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
|
775 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(save_away_mess), ca); |
4092 | 776 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); |
777 | |
8973 | 778 button = gaim_pixbuf_button_from_stock(_("Sa_ve & Use"), GTK_STOCK_OK, GAIM_BUTTON_HORIZONTAL); |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5294
diff
changeset
|
779 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
|
780 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
|
781 |
8973 | 782 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
|
783 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
|
784 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
|
785 |
8973 | 786 button = gaim_pixbuf_button_from_stock(_("_Cancel"), GTK_STOCK_CANCEL, GAIM_BUTTON_HORIZONTAL); |
8502 | 787 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(away_mess_destroy), ca); |
1213
1bdb08cc5d59
[gaim-migrate @ 1223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
788 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); |
9079 | 789 focus_chain = g_list_prepend(focus_chain, hbox); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
790 |
5024 | 791 gtk_widget_show_all(ca->window); |
9079 | 792 gtk_container_set_focus_chain(GTK_CONTAINER(vbox), focus_chain); |
1 | 793 } |
555 | 794 |
6329
418cc72136d1
[gaim-migrate @ 6828]
Christian Hammond <chipx86@chipx86.com>
parents:
6328
diff
changeset
|
795 static void |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
796 alias_chat_cb(GaimChat *chat, const char *new_alias) |
5234 | 797 { |
6329
418cc72136d1
[gaim-migrate @ 6828]
Christian Hammond <chipx86@chipx86.com>
parents:
6328
diff
changeset
|
798 gaim_blist_alias_chat(chat, new_alias); |
5234 | 799 } |
800 | |
6329
418cc72136d1
[gaim-migrate @ 6828]
Christian Hammond <chipx86@chipx86.com>
parents:
6328
diff
changeset
|
801 void |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
802 alias_dialog_blist_chat(GaimChat *chat) |
6329
418cc72136d1
[gaim-migrate @ 6828]
Christian Hammond <chipx86@chipx86.com>
parents:
6328
diff
changeset
|
803 { |
7843 | 804 gaim_request_input(NULL, _("Alias Chat"), NULL, |
805 _("Enter an alias for this chat."), | |
8697 | 806 chat->alias, FALSE, FALSE, NULL, |
8302
462ead6fc1a0
[gaim-migrate @ 9026]
Christian Hammond <chipx86@chipx86.com>
parents:
8301
diff
changeset
|
807 _("Alias"), G_CALLBACK(alias_chat_cb), |
6329
418cc72136d1
[gaim-migrate @ 6828]
Christian Hammond <chipx86@chipx86.com>
parents:
6328
diff
changeset
|
808 _("Cancel"), NULL, chat); |
5234 | 809 } |
810 | |
6327
493eed80869c
[gaim-migrate @ 6826]
Christian Hammond <chipx86@chipx86.com>
parents:
6322
diff
changeset
|
811 static void |
7245 | 812 alias_contact_cb(GaimContact *contact, const char *new_alias) |
813 { | |
814 gaim_contact_set_alias(contact, new_alias); | |
815 } | |
816 | |
817 void | |
818 alias_dialog_contact(GaimContact *contact) | |
819 { | |
7843 | 820 gaim_request_input(NULL, _("Alias Contact"), NULL, |
821 _("Enter an alias for this contact."), | |
8697 | 822 contact->alias, FALSE, FALSE, NULL, |
8302
462ead6fc1a0
[gaim-migrate @ 9026]
Christian Hammond <chipx86@chipx86.com>
parents:
8301
diff
changeset
|
823 _("Alias"), G_CALLBACK(alias_contact_cb), |
7843 | 824 _("Cancel"), NULL, contact); |
7245 | 825 } |
826 | |
827 static void | |
7843 | 828 alias_buddy_cb(GaimBuddy *buddy, const char *alias) |
6327
493eed80869c
[gaim-migrate @ 6826]
Christian Hammond <chipx86@chipx86.com>
parents:
6322
diff
changeset
|
829 { |
7843 | 830 gaim_blist_alias_buddy(buddy, (alias != NULL && *alias != '\0') ? alias : NULL); |
6327
493eed80869c
[gaim-migrate @ 6826]
Christian Hammond <chipx86@chipx86.com>
parents:
6322
diff
changeset
|
831 serv_alias_buddy(buddy); |
493eed80869c
[gaim-migrate @ 6826]
Christian Hammond <chipx86@chipx86.com>
parents:
6322
diff
changeset
|
832 } |
493eed80869c
[gaim-migrate @ 6826]
Christian Hammond <chipx86@chipx86.com>
parents:
6322
diff
changeset
|
833 |
5050
dfec167391a5
[gaim-migrate @ 5398]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
834 void |
6695 | 835 alias_dialog_bud(GaimBuddy *b) |
1397
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
836 { |
7843 | 837 char *secondary = g_strdup_printf(_("Enter an alias for %s."), b->name); |
6327
493eed80869c
[gaim-migrate @ 6826]
Christian Hammond <chipx86@chipx86.com>
parents:
6322
diff
changeset
|
838 |
7843 | 839 gaim_request_input(NULL, _("Alias Buddy"), NULL, |
8697 | 840 secondary, b->alias, FALSE, FALSE, NULL, |
8302
462ead6fc1a0
[gaim-migrate @ 9026]
Christian Hammond <chipx86@chipx86.com>
parents:
8301
diff
changeset
|
841 _("Alias"), G_CALLBACK(alias_buddy_cb), |
7843 | 842 _("Cancel"), NULL, b); |
6327
493eed80869c
[gaim-migrate @ 6826]
Christian Hammond <chipx86@chipx86.com>
parents:
6322
diff
changeset
|
843 |
7843 | 844 g_free(secondary); |
1397
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
845 } |