Mercurial > pidgin
annotate src/buddy_chat.c @ 8052:2df2fd4efa82
[gaim-migrate @ 8737]
Bye bye, Rachel.
committer: Tailor Script <tailor@pidgin.im>
| author | Sean Egan <seanegan@gmail.com> |
|---|---|
| date | Sat, 10 Jan 2004 04:45:05 +0000 |
| parents | fa6395637e2c |
| children | 4971193f761d |
| 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)); |
| 7798 | 126 } else { |
| 127 GtkWidget *entry = gtk_entry_new(); | |
|
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
128 |
| 7798 | 129 gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE); |
| 130 g_object_set_data(G_OBJECT(entry), "identifier", pce->identifier); | |
| 131 data->entries = g_list_append(data->entries, entry); | |
|
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
132 |
|
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2199
diff
changeset
|
133 if (pce->def) |
|
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2199
diff
changeset
|
134 gtk_entry_set_text(GTK_ENTRY(entry), pce->def); |
|
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
135 |
|
2289
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2268
diff
changeset
|
136 if (focus) { |
|
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2268
diff
changeset
|
137 gtk_widget_grab_focus(entry); |
|
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2268
diff
changeset
|
138 focus = FALSE; |
|
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2268
diff
changeset
|
139 } |
|
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
140 |
| 7798 | 141 if (pce->secret) |
| 142 gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); | |
|
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
143 |
| 7798 | 144 gtk_box_pack_end(GTK_BOX(rowbox), entry, TRUE, TRUE, 0); |
| 7841 | 145 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(entry)); |
|
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2199
diff
changeset
|
146 } |
|
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2199
diff
changeset
|
147 |
|
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2199
diff
changeset
|
148 g_free(pce); |
|
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2199
diff
changeset
|
149 } |
|
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
150 |
|
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
151 g_list_free(list); |
|
1806
c649b63382b7
[gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1793
diff
changeset
|
152 |
| 7798 | 153 gtk_widget_show_all(data->entries_box); |
|
964
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
154 } |
|
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
155 |
|
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
156 static void |
| 7798 | 157 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
|
158 { |
| 7798 | 159 if (gaim_account_get_protocol(data->account) == |
| 160 gaim_account_get_protocol(account)) { | |
| 161 data->account = account; | |
| 162 } else { | |
| 163 data->account = account; | |
| 164 rebuild_joinchat_entries(data); | |
| 165 } | |
| 166 } | |
|
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
167 |
| 7798 | 168 static gboolean |
| 169 join_chat_check_account_func(GaimAccount *account) | |
| 170 { | |
| 171 GaimConnection *gc = gaim_account_get_connection(account); | |
|
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
172 |
| 7798 | 173 return (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL); |
| 174 } | |
|
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
175 |
| 7798 | 176 static void do_joinchat(GtkWidget *dialog, int id, GaimGtkJoinChatData *info) |
| 177 { | |
| 178 switch(id) { | |
| 179 case GTK_RESPONSE_OK: | |
| 180 do_join_chat(info); | |
|
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
181 |
| 7798 | 182 break; |
|
964
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
183 } |
|
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
184 |
| 7798 | 185 gtk_widget_destroy(GTK_WIDGET(dialog)); |
| 186 g_list_free(info->entries); | |
| 187 g_free(info); | |
|
964
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
188 } |
| 1 | 189 |
|
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
190 |
|
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
191 void |
|
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
192 join_chat() |
| 1 | 193 { |
| 7816 | 194 GtkWidget *hbox, *vbox; |
| 1210 | 195 GtkWidget *rowbox; |
| 196 GtkWidget *label; | |
|
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5530
diff
changeset
|
197 GList *c; |
| 7798 | 198 GaimGtkBuddyList *gtkblist; |
| 7816 | 199 GtkWidget *img = NULL; |
|
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5530
diff
changeset
|
200 GaimConnection *gc = NULL; |
| 7798 | 201 GaimGtkJoinChatData *data = NULL; |
| 7816 | 202 int numaccounts = 0; |
|
1356
c22d04db51be
[gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1343
diff
changeset
|
203 |
| 7816 | 204 /* Count how many protocols support chat */ |
|
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5530
diff
changeset
|
205 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
|
206 gc = c->data; |
|
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
207 |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4859
diff
changeset
|
208 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->join_chat) |
| 7816 | 209 numaccounts++; |
|
1356
c22d04db51be
[gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1343
diff
changeset
|
210 } |
|
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
211 |
| 7816 | 212 if (numaccounts <= 0) { |
|
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
213 gaim_notify_error(NULL, NULL, |
|
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
214 _("You are not currently signed on with any " |
|
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
215 "protocols that have the ability to chat."), |
|
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
216 NULL); |
|
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
217 |
|
1356
c22d04db51be
[gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1343
diff
changeset
|
218 return; |
|
c22d04db51be
[gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1343
diff
changeset
|
219 } |
| 456 | 220 |
| 7798 | 221 gtkblist = GAIM_GTK_BLIST(gaim_get_blist()); |
| 222 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG); | |
| 223 data = g_new0(GaimGtkJoinChatData, 1); | |
| 456 | 224 |
| 7853 | 225 data->window = gtk_dialog_new_with_buttons(_("Join a Chat"), gtkblist->window ? GTK_WINDOW(gtkblist->window) : NULL, 0, |
| 7798 | 226 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, |
| 7841 | 227 _("_Join"), GTK_RESPONSE_OK, NULL); |
| 7798 | 228 gtk_dialog_set_default_response(GTK_DIALOG(data->window), GTK_RESPONSE_OK); |
| 229 gtk_container_set_border_width(GTK_CONTAINER(data->window), 6); | |
| 230 gtk_window_set_resizable(GTK_WINDOW(data->window), FALSE); | |
| 231 gtk_dialog_set_has_separator(GTK_DIALOG(data->window), FALSE); | |
| 232 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(data->window)->vbox), 12); | |
| 233 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
|
234 |
| 7798 | 235 hbox = gtk_hbox_new(FALSE, 12); |
| 7841 | 236 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(data->window)->vbox), hbox); |
| 237 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
| 238 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
|
964
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
239 |
| 7816 | 240 vbox = gtk_vbox_new(FALSE, 5); |
| 7841 | 241 gtk_container_set_border_width(GTK_CONTAINER(vbox), 0); |
| 7816 | 242 gtk_container_add(GTK_CONTAINER(hbox), vbox); |
| 243 | |
| 244 label = gtk_label_new(_("Please enter the appropriate information about the chat you would like to join.\n")); | |
| 245 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
| 246 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
| 247 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
|
248 |
| 7841 | 249 rowbox = gtk_hbox_new(FALSE, 12); |
| 7816 | 250 gtk_box_pack_start(GTK_BOX(vbox), rowbox, TRUE, TRUE, 0); |
| 251 | |
| 252 data->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
|
1806
c649b63382b7
[gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1793
diff
changeset
|
253 |
| 7816 | 254 if (numaccounts > 1) { |
| 7841 | 255 label = gtk_label_new_with_mnemonic(_("_Account:")); |
| 7816 | 256 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
| 257 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0); | |
| 258 gtk_size_group_add_widget(data->sg, label); | |
|
692
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
666
diff
changeset
|
259 |
| 7816 | 260 data->account_menu = gaim_gtk_account_option_menu_new(NULL, FALSE, |
| 261 G_CALLBACK(join_chat_select_account_cb), | |
| 262 join_chat_check_account_func, data); | |
| 263 gtk_box_pack_start(GTK_BOX(rowbox), data->account_menu, TRUE, TRUE, 0); | |
| 7841 | 264 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(data->account_menu)); |
| 7816 | 265 } |
|
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
266 |
| 7798 | 267 data->entries_box = gtk_vbox_new(FALSE, 5); |
| 7816 | 268 gtk_container_add(GTK_CONTAINER(vbox), data->entries_box); |
| 7798 | 269 gtk_container_set_border_width(GTK_CONTAINER(data->entries_box), 0); |
| 270 | |
| 1210 | 271 |
| 7816 | 272 data->account = gaim_connection_get_account(gaim_connections_get_all()->data); |
| 7798 | 273 rebuild_joinchat_entries(data); |
| 274 | |
|
2374
9e9385cddcc6
[gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
275 |
| 7798 | 276 g_signal_connect(G_OBJECT(data->window), "response", G_CALLBACK(do_joinchat), data); |
| 277 | |
| 278 g_object_unref(data->sg); | |
| 279 | |
| 280 gtk_widget_show_all(data->window); | |
| 1 | 281 } |
