Mercurial > pidgin.yaz
annotate src/buddy_chat.c @ 8250:b248c1f4efbd
[gaim-migrate @ 8973]
1) Minor changes to the network listen code again. Tim, let me know
if you have any other suggestions.
2) Changed how charsets are handled in oscar a tad bit. I think this
should guarantee that Gaim doesn't crash when people send funky
messages, or have funky away messages or really anything that is
using a charset that isn't utf8, iso-8859-1, ucs-2be, or ascii.
Ethan, this should fix the problem with that person's away message.
Although, the message itself still looks kinda funky to me. The
encoding is Windows-31J, which is apparently a valid iconv encoding?
You would know more than I.
3) Fix the following crash:
1. IM yourself a message on AIM
2. Do NOT begin to type a second message, but instead hit CTRL+up
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 13 Feb 2004 05:37:12 +0000 |
parents | 4971193f761d |
children |
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. | |
1 | 7 * |
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 * | |
22 */ | |
7798 | 23 #include "gtkinternal.h" |
1 | 24 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
25 #include "debug.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
26 #include "multi.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
27 #include "notify.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
28 #include "prpl.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
29 #include "server.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
30 |
7798 | 31 #include "gtkblist.h" |
1428
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1398
diff
changeset
|
32 #include "gtkimhtml.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
33 #include "gtkutils.h" |
7798 | 34 #include "stock.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
35 #include "ui.h" |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
36 |
7798 | 37 typedef struct |
38 { | |
39 GaimAccount *account; | |
40 | |
41 GtkWidget *window; | |
42 GtkWidget *account_menu; | |
43 GtkWidget *entries_box; | |
44 GtkSizeGroup *sg; | |
45 | |
46 GList *entries; | |
47 } GaimGtkJoinChatData; | |
3762 | 48 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
49 static void |
7798 | 50 do_join_chat(GaimGtkJoinChatData *data) |
1 | 51 { |
7798 | 52 if (data) { |
5234 | 53 GHashTable *components = g_hash_table_new_full(g_str_hash, g_str_equal, |
54 g_free, g_free); | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
55 GList *tmp; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
56 |
7798 | 57 for (tmp = data->entries; tmp != NULL; tmp = tmp->next) { |
4635 | 58 if (g_object_get_data(tmp->data, "is_spin")) { |
5234 | 59 g_hash_table_replace(components, |
60 g_strdup(g_object_get_data(tmp->data, "identifier")), | |
61 g_strdup_printf("%d", | |
62 gtk_spin_button_get_value_as_int(tmp->data))); | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
63 } |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
64 else { |
5234 | 65 g_hash_table_replace(components, |
66 g_strdup(g_object_get_data(tmp->data, "identifier")), | |
67 g_strdup(gtk_entry_get_text(tmp->data))); | |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2199
diff
changeset
|
68 } |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2199
diff
changeset
|
69 } |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
70 |
7798 | 71 serv_join_chat(gaim_account_get_connection(data->account), components); |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2199
diff
changeset
|
72 |
5234 | 73 g_hash_table_destroy(components); |
1 | 74 } |
75 } | |
76 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
77 static void |
7798 | 78 rebuild_joinchat_entries(GaimGtkJoinChatData *data) |
1806
c649b63382b7
[gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1793
diff
changeset
|
79 { |
7798 | 80 GaimConnection *gc; |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2199
diff
changeset
|
81 GList *list, *tmp; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2199
diff
changeset
|
82 struct proto_chat_entry *pce; |
2289
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2268
diff
changeset
|
83 gboolean focus = TRUE; |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2199
diff
changeset
|
84 |
7798 | 85 gc = gaim_account_get_connection(data->account); |
1806
c649b63382b7
[gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1793
diff
changeset
|
86 |
7798 | 87 while (GTK_BOX(data->entries_box)->children) { |
88 gtk_container_remove(GTK_CONTAINER(data->entries_box), | |
89 ((GtkBoxChild *)GTK_BOX(data->entries_box)->children->data)->widget); | |
90 } | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
91 |
7798 | 92 if (data->entries != NULL) |
93 g_list_free(data->entries); | |
94 | |
95 data->entries = NULL; | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
96 |
7798 | 97 list = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info(gc); |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2199
diff
changeset
|
98 |
7798 | 99 for (tmp = list; tmp; tmp = tmp->next) |
100 { | |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2199
diff
changeset
|
101 GtkWidget *label; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2199
diff
changeset
|
102 GtkWidget *rowbox; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
103 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
104 pce = tmp->data; |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2199
diff
changeset
|
105 |
7841 | 106 rowbox = gtk_hbox_new(FALSE, 12); |
7798 | 107 gtk_box_pack_start(GTK_BOX(data->entries_box), rowbox, FALSE, FALSE, 0); |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2199
diff
changeset
|
108 |
7841 | 109 label = gtk_label_new_with_mnemonic(pce->label); |
7798 | 110 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
111 gtk_size_group_add_widget(data->sg, label); | |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2199
diff
changeset
|
112 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2199
diff
changeset
|
113 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2199
diff
changeset
|
114 if (pce->is_int) { |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2199
diff
changeset
|
115 GtkObject *adjust; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2199
diff
changeset
|
116 GtkWidget *spin; |
7798 | 117 adjust = gtk_adjustment_new(pce->min, pce->min, pce->max, |
118 1, 10, 10); | |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2199
diff
changeset
|
119 spin = gtk_spin_button_new(GTK_ADJUSTMENT(adjust), 1, 0); |
4635 | 120 g_object_set_data(G_OBJECT(spin), "is_spin", GINT_TO_POINTER(TRUE)); |
5234 | 121 g_object_set_data(G_OBJECT(spin), "identifier", pce->identifier); |
7798 | 122 data->entries = g_list_append(data->entries, spin); |
4635 | 123 gtk_widget_set_size_request(spin, 50, -1); |
2346
b1c1e3401e10
[gaim-migrate @ 2359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2345
diff
changeset
|
124 gtk_box_pack_end(GTK_BOX(rowbox), spin, FALSE, FALSE, 0); |
7841 | 125 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(spin)); |
8137 | 126 gaim_set_accessible_label (spin, label); |
7798 | 127 } else { |
128 GtkWidget *entry = gtk_entry_new(); | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
129 |
7798 | 130 gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE); |
131 g_object_set_data(G_OBJECT(entry), "identifier", pce->identifier); | |
132 data->entries = g_list_append(data->entries, entry); | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
133 |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2199
diff
changeset
|
134 if (pce->def) |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2199
diff
changeset
|
135 gtk_entry_set_text(GTK_ENTRY(entry), pce->def); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
136 |
2289
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2268
diff
changeset
|
137 if (focus) { |
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2268
diff
changeset
|
138 gtk_widget_grab_focus(entry); |
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2268
diff
changeset
|
139 focus = FALSE; |
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2268
diff
changeset
|
140 } |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
141 |
7798 | 142 if (pce->secret) |
143 gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
144 |
7798 | 145 gtk_box_pack_end(GTK_BOX(rowbox), entry, TRUE, TRUE, 0); |
7841 | 146 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(entry)); |
8137 | 147 gaim_set_accessible_label (entry, label); |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2199
diff
changeset
|
148 } |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2199
diff
changeset
|
149 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2199
diff
changeset
|
150 g_free(pce); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2199
diff
changeset
|
151 } |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
152 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
153 g_list_free(list); |
1806
c649b63382b7
[gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1793
diff
changeset
|
154 |
7798 | 155 gtk_widget_show_all(data->entries_box); |
964
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
156 } |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
157 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
158 static void |
7798 | 159 join_chat_select_account_cb(GObject *w, GaimAccount *account, GaimGtkJoinChatData *data) |
964
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
160 { |
7798 | 161 if (gaim_account_get_protocol(data->account) == |
162 gaim_account_get_protocol(account)) { | |
163 data->account = account; | |
164 } else { | |
165 data->account = account; | |
166 rebuild_joinchat_entries(data); | |
167 } | |
168 } | |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
169 |
7798 | 170 static gboolean |
171 join_chat_check_account_func(GaimAccount *account) | |
172 { | |
173 GaimConnection *gc = gaim_account_get_connection(account); | |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
174 |
7798 | 175 return (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL); |
176 } | |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
177 |
7798 | 178 static void do_joinchat(GtkWidget *dialog, int id, GaimGtkJoinChatData *info) |
179 { | |
180 switch(id) { | |
181 case GTK_RESPONSE_OK: | |
182 do_join_chat(info); | |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
183 |
7798 | 184 break; |
964
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
185 } |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
186 |
7798 | 187 gtk_widget_destroy(GTK_WIDGET(dialog)); |
188 g_list_free(info->entries); | |
189 g_free(info); | |
964
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
190 } |
1 | 191 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
192 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
193 void |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
194 join_chat() |
1 | 195 { |
7816 | 196 GtkWidget *hbox, *vbox; |
1210 | 197 GtkWidget *rowbox; |
198 GtkWidget *label; | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5530
diff
changeset
|
199 GList *c; |
7798 | 200 GaimGtkBuddyList *gtkblist; |
7816 | 201 GtkWidget *img = NULL; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5530
diff
changeset
|
202 GaimConnection *gc = NULL; |
7798 | 203 GaimGtkJoinChatData *data = NULL; |
7816 | 204 int numaccounts = 0; |
1356
c22d04db51be
[gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1343
diff
changeset
|
205 |
7816 | 206 /* Count how many protocols support chat */ |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5530
diff
changeset
|
207 for (c = gaim_connections_get_all(); c != NULL; c = c->next) { |
1356
c22d04db51be
[gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1343
diff
changeset
|
208 gc = c->data; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
209 |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4859
diff
changeset
|
210 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->join_chat) |
7816 | 211 numaccounts++; |
1356
c22d04db51be
[gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1343
diff
changeset
|
212 } |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
213 |
7816 | 214 if (numaccounts <= 0) { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
215 gaim_notify_error(NULL, NULL, |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
216 _("You are not currently signed on with any " |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
217 "protocols that have the ability to chat."), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
218 NULL); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
219 |
1356
c22d04db51be
[gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1343
diff
changeset
|
220 return; |
c22d04db51be
[gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1343
diff
changeset
|
221 } |
456 | 222 |
7798 | 223 gtkblist = GAIM_GTK_BLIST(gaim_get_blist()); |
224 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG); | |
225 data = g_new0(GaimGtkJoinChatData, 1); | |
456 | 226 |
7853 | 227 data->window = gtk_dialog_new_with_buttons(_("Join a Chat"), gtkblist->window ? GTK_WINDOW(gtkblist->window) : NULL, 0, |
7798 | 228 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, |
7841 | 229 _("_Join"), GTK_RESPONSE_OK, NULL); |
7798 | 230 gtk_dialog_set_default_response(GTK_DIALOG(data->window), GTK_RESPONSE_OK); |
231 gtk_container_set_border_width(GTK_CONTAINER(data->window), 6); | |
232 gtk_window_set_resizable(GTK_WINDOW(data->window), FALSE); | |
233 gtk_dialog_set_has_separator(GTK_DIALOG(data->window), FALSE); | |
234 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(data->window)->vbox), 12); | |
235 gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(data->window)->vbox), 6); | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
236 |
7798 | 237 hbox = gtk_hbox_new(FALSE, 12); |
7841 | 238 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(data->window)->vbox), hbox); |
239 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
240 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
964
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
241 |
7816 | 242 vbox = gtk_vbox_new(FALSE, 5); |
7841 | 243 gtk_container_set_border_width(GTK_CONTAINER(vbox), 0); |
7816 | 244 gtk_container_add(GTK_CONTAINER(hbox), vbox); |
245 | |
246 label = gtk_label_new(_("Please enter the appropriate information about the chat you would like to join.\n")); | |
247 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
248 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
249 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
964
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
250 |
7841 | 251 rowbox = gtk_hbox_new(FALSE, 12); |
7816 | 252 gtk_box_pack_start(GTK_BOX(vbox), rowbox, TRUE, TRUE, 0); |
253 | |
254 data->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
1806
c649b63382b7
[gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1793
diff
changeset
|
255 |
7816 | 256 if (numaccounts > 1) { |
7841 | 257 label = gtk_label_new_with_mnemonic(_("_Account:")); |
7816 | 258 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
259 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0); | |
260 gtk_size_group_add_widget(data->sg, label); | |
692
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
666
diff
changeset
|
261 |
7816 | 262 data->account_menu = gaim_gtk_account_option_menu_new(NULL, FALSE, |
263 G_CALLBACK(join_chat_select_account_cb), | |
264 join_chat_check_account_func, data); | |
265 gtk_box_pack_start(GTK_BOX(rowbox), data->account_menu, TRUE, TRUE, 0); | |
7841 | 266 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(data->account_menu)); |
8137 | 267 gaim_set_accessible_label (data->account_menu, label); |
7816 | 268 } |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
269 |
7798 | 270 data->entries_box = gtk_vbox_new(FALSE, 5); |
7816 | 271 gtk_container_add(GTK_CONTAINER(vbox), data->entries_box); |
7798 | 272 gtk_container_set_border_width(GTK_CONTAINER(data->entries_box), 0); |
273 | |
1210 | 274 |
7816 | 275 data->account = gaim_connection_get_account(gaim_connections_get_all()->data); |
7798 | 276 rebuild_joinchat_entries(data); |
277 | |
2374
9e9385cddcc6
[gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
278 |
7798 | 279 g_signal_connect(G_OBJECT(data->window), "response", G_CALLBACK(do_joinchat), data); |
280 | |
281 g_object_unref(data->sg); | |
282 | |
283 gtk_widget_show_all(data->window); | |
1 | 284 } |