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