annotate src/buddy_chat.c @ 7606:08c9d0dcf906

[gaim-migrate @ 8229] " Some things allocated with g_malloc() were being free()'d instead of g_free()'d This patch fixes the ones I managed to find." --Stu Tomlinson (nosnilmot) committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Sun, 23 Nov 2003 15:32:25 +0000
parents 357eb1c39b72
children 565369d12874
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1 /*
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2 * gaim
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
5 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
9 * (at your option) any later version.
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
10 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
14 * GNU General Public License for more details.
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
15 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
19 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
20 */
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5717
diff changeset
21 #include "internal.h"
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
22
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5717
diff changeset
23 #include "debug.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5717
diff changeset
24 #include "multi.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5717
diff changeset
25 #include "notify.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5717
diff changeset
26 #include "prpl.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5717
diff changeset
27 #include "server.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5717
diff changeset
28
1428
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1398
diff changeset
29 #include "gtkimhtml.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5717
diff changeset
30 #include "gtkutils.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5717
diff changeset
31 #include "ui.h"
344
2434adbb8703 [gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 338
diff changeset
32
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
33 static GList *chatentries = NULL;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
34 static GtkWidget *joinchat = NULL;
1807
ba8f463744c0 [gaim-migrate @ 1817]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1806
diff changeset
35 static GtkWidget *jc_vbox = NULL;
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5530
diff changeset
36 static GaimConnection *joinchatgc;
3762
ac18a395eced [gaim-migrate @ 3901]
Rob Flynn <gaim@robflynn.com>
parents: 3716
diff changeset
37
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
38 static void
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
39 do_join_chat()
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
40 {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
41 if (joinchat) {
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5205
diff changeset
42 GHashTable *components = g_hash_table_new_full(g_str_hash, g_str_equal,
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5205
diff changeset
43 g_free, g_free);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
44 GList *tmp;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
45
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
46 for (tmp = chatentries; tmp != NULL; tmp = tmp->next) {
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4423
diff changeset
47 if (g_object_get_data(tmp->data, "is_spin")) {
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5205
diff changeset
48 g_hash_table_replace(components,
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5205
diff changeset
49 g_strdup(g_object_get_data(tmp->data, "identifier")),
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5205
diff changeset
50 g_strdup_printf("%d",
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5205
diff changeset
51 gtk_spin_button_get_value_as_int(tmp->data)));
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
52 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
53 else {
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5205
diff changeset
54 g_hash_table_replace(components,
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5205
diff changeset
55 g_strdup(g_object_get_data(tmp->data, "identifier")),
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5205
diff changeset
56 g_strdup(gtk_entry_get_text(tmp->data)));
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
57 }
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
58 }
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
59
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5205
diff changeset
60 serv_join_chat(joinchatgc, components);
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
61
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5205
diff changeset
62 g_hash_table_destroy(components);
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
63
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
64 gtk_widget_destroy(joinchat);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
65
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
66 if (chatentries)
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
67 g_list_free(chatentries);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
68
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
69 chatentries = NULL;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
70 joinchat = NULL;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
71 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
72 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
73
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
74 static void
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
75 rebuild_jc()
1806
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1793
diff changeset
76 {
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
77 GList *list, *tmp;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
78 struct proto_chat_entry *pce;
2289
38e156136896 [gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2268
diff changeset
79 gboolean focus = TRUE;
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
80
1806
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1793
diff changeset
81 if (!joinchatgc)
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1793
diff changeset
82 return;
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1793
diff changeset
83
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
84 while (GTK_BOX(jc_vbox)->children)
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
85 gtk_container_remove(GTK_CONTAINER(jc_vbox),
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
86 ((GtkBoxChild *)GTK_BOX(jc_vbox)->children->data)->widget);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
87
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
88 if (chatentries)
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
89 g_list_free(chatentries);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
90
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
91 chatentries = NULL;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
92
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4859
diff changeset
93 list = GAIM_PLUGIN_PROTOCOL_INFO(joinchatgc->prpl)->chat_info(joinchatgc);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
94
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
95 for (tmp = list; tmp != NULL; tmp = tmp->next) {
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
96 GtkWidget *label;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
97 GtkWidget *rowbox;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
98
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
99 pce = tmp->data;
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
100
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
101 rowbox = gtk_hbox_new(FALSE, 5);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
102 gtk_box_pack_start(GTK_BOX(jc_vbox), rowbox, TRUE, TRUE, 0);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
103 gtk_widget_show(rowbox);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
104
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
105 label = gtk_label_new(pce->label);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
106 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
107 gtk_widget_show(label);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
108
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
109 if (pce->is_int) {
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
110 GtkObject *adjust;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
111 GtkWidget *spin;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
112 adjust = gtk_adjustment_new(pce->min, pce->min,
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
113 pce->max, 1, 10, 10);
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
114 spin = gtk_spin_button_new(GTK_ADJUSTMENT(adjust), 1, 0);
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4423
diff changeset
115 g_object_set_data(G_OBJECT(spin), "is_spin", GINT_TO_POINTER(TRUE));
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5205
diff changeset
116 g_object_set_data(G_OBJECT(spin), "identifier", pce->identifier);
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
117 chatentries = g_list_append(chatentries, spin);
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4423
diff changeset
118 gtk_widget_set_size_request(spin, 50, -1);
2346
b1c1e3401e10 [gaim-migrate @ 2359]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2345
diff changeset
119 gtk_box_pack_end(GTK_BOX(rowbox), spin, FALSE, FALSE, 0);
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
120 gtk_widget_show(spin);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
121 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
122 else {
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
123 GtkWidget *entry;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
124
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
125 entry = gtk_entry_new();
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
126 gtk_box_pack_end(GTK_BOX(rowbox), entry, FALSE, FALSE, 0);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
127
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
128 chatentries = g_list_append(chatentries, entry);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
129
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
130 if (pce->def)
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
131 gtk_entry_set_text(GTK_ENTRY(entry), pce->def);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
132
2289
38e156136896 [gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2268
diff changeset
133 if (focus) {
38e156136896 [gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2268
diff changeset
134 gtk_widget_grab_focus(entry);
38e156136896 [gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2268
diff changeset
135 focus = FALSE;
38e156136896 [gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2268
diff changeset
136 }
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
137
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
138 g_signal_connect(G_OBJECT(entry), "activate",
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
139 G_CALLBACK(do_join_chat), NULL);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5205
diff changeset
140 g_object_set_data(G_OBJECT(entry), "identifier", pce->identifier);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
141
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
142 gtk_widget_show(entry);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
143 }
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
144
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
145 g_free(pce);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
146 }
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
147
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
148 g_list_free(list);
1806
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1793
diff changeset
149 }
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1793
diff changeset
150
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
151 static void
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5530
diff changeset
152 joinchat_choose(GtkWidget *w, GaimConnection *g)
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
153 {
1806
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1793
diff changeset
154 if (joinchatgc == g)
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1793
diff changeset
155 return;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
156
5943
a4f2aba0848d [gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents: 5914
diff changeset
157 if (gaim_account_get_protocol(joinchatgc->account) ==
a4f2aba0848d [gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents: 5914
diff changeset
158 gaim_account_get_protocol(g->account)) {
a4f2aba0848d [gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents: 5914
diff changeset
159
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5205
diff changeset
160 joinchatgc = g;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5205
diff changeset
161 } else {
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5205
diff changeset
162 joinchatgc = g;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5205
diff changeset
163 rebuild_jc();
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5205
diff changeset
164 }
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
165 }
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
166
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
167 static void
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
168 create_joinchat_menu(GtkWidget *box)
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
169 {
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5530
diff changeset
170 GaimAccount *account;
5881
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
171 GtkWidget *hbox;
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
172 GtkWidget *label;
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
173 GtkWidget *optmenu;
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
174 GtkWidget *menu;
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
175 GtkWidget *opt;
5881
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
176 GtkWidget *image;
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
177 GdkPixbuf *pixbuf;
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
178 GdkPixbuf *scale;
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
179 GtkSizeGroup *sg;
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5530
diff changeset
180 GList *c;
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5530
diff changeset
181 GaimConnection *g;
5881
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
182 const char *proto_name;
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
183 char *filename;
1235
a9cf2f61a7b1 [gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1228
diff changeset
184 char buf[2048];
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 optmenu = gtk_option_menu_new();
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
187 gtk_box_pack_start(GTK_BOX(box), optmenu, FALSE, FALSE, 0);
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
188
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
189 menu = gtk_menu_new();
1793
00c753b86710 [gaim-migrate @ 1803]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1780
diff changeset
190 joinchatgc = NULL;
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
191
5881
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
192 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
193
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5530
diff changeset
194 for (c = gaim_connections_get_all(); c != NULL; c = c->next) {
5881
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
195 GaimPluginProtocolInfo *prpl_info = NULL;
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
196 GaimPlugin *plugin;
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
197
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5530
diff changeset
198 g = (GaimConnection *)c->data;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
199
5881
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
200 plugin = g->prpl;
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
201
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
202 if (plugin == NULL)
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
203 continue;
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
204
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
205 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(plugin);
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
206
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
207 if (prpl_info == NULL || prpl_info->join_chat == NULL)
1356
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
208 continue;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
209
1793
00c753b86710 [gaim-migrate @ 1803]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1780
diff changeset
210 if (!joinchatgc)
00c753b86710 [gaim-migrate @ 1803]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1780
diff changeset
211 joinchatgc = g;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
212
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5530
diff changeset
213 account = gaim_connection_get_account(g);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5530
diff changeset
214
5881
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
215 opt = gtk_menu_item_new();
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
216
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
217 /* Create the hbox. */
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
218 hbox = gtk_hbox_new(FALSE, 4);
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
219 gtk_container_add(GTK_CONTAINER(opt), hbox);
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
220 gtk_widget_show(hbox);
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
221
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
222 /* Load the image. */
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
223 if (prpl_info != NULL) {
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
224 proto_name = prpl_info->list_icon(NULL, NULL);
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
225 g_snprintf(buf, sizeof(buf), "%s.png", proto_name);
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
226
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
227 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status",
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
228 "default", buf, NULL);
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
229 pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
230 g_free(filename);
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
231
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
232 if (pixbuf != NULL) {
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
233 /* Scale and insert the image */
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
234 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16,
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
235 GDK_INTERP_BILINEAR);
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
236 image = gtk_image_new_from_pixbuf(scale);
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
237
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
238 g_object_unref(G_OBJECT(pixbuf));
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
239 g_object_unref(G_OBJECT(scale));
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
240 }
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
241 else
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
242 image = gtk_image_new();
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
243 }
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
244 else
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
245 image = gtk_image_new();
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
246
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
247 gtk_size_group_add_widget(sg, image);
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
248
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
249 gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0);
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
250 gtk_widget_show(image);
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
251
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
252 g_snprintf(buf, sizeof(buf), "%s (%s)",
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
253 gaim_account_get_username(account), plugin->info->name);
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
254
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
255 /* Create the label. */
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
256 label = gtk_label_new(buf);
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
257 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
258 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
259 gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0);
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
260 gtk_widget_show(label);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
261
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4423
diff changeset
262 g_object_set_data(G_OBJECT(opt), "gaim_connection", g);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
263
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
264 g_signal_connect(G_OBJECT(opt), "activate",
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
265 G_CALLBACK(joinchat_choose), g);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
266
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4423
diff changeset
267 gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt);
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
268 gtk_widget_show(opt);
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
269 }
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
270
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
271 gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), menu);
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
272 gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), 0);
5881
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
273
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
274 g_object_unref(sg);
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
275 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
276
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
277 static void
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
278 destroy_join_chat()
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
279 {
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
280 if (joinchat)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
281 gtk_widget_destroy(joinchat);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
282
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
283 joinchat = NULL;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
284 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
285
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
286 void
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
287 join_chat()
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
288 {
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
289 GtkWidget *mainbox;
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
290 GtkWidget *frame;
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
291 GtkWidget *fbox;
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
292 GtkWidget *rowbox;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
293 GtkWidget *bbox;
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
294 GtkWidget *join;
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
295 GtkWidget *cancel;
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
296 GtkWidget *label;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
297 GtkWidget *sep;
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5530
diff changeset
298 GList *c;
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5530
diff changeset
299 GaimConnection *gc = NULL;
1356
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
300
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5530
diff changeset
301 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
302 gc = c->data;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
303
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4859
diff changeset
304 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->join_chat)
1356
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
305 break;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
306
1356
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
307 gc = NULL;
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
308 }
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
309
1356
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
310 if (gc == NULL) {
5436
ad445074d239 [gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
311 gaim_notify_error(NULL, NULL,
5498
cce2d7868c78 [gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents: 5436
diff changeset
312 _("You are not currently signed on with any "
5436
ad445074d239 [gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
313 "protocols that have the ability to chat."),
ad445074d239 [gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
314 NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
315
1356
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
316 return;
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
317 }
456
725ffb93aedc [gaim-migrate @ 466]
Rob Flynn <gaim@robflynn.com>
parents: 449
diff changeset
318
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
319 if (!joinchat) {
2725
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2699
diff changeset
320 GAIM_DIALOG(joinchat);
4074
3ccbdf8e7f8d [gaim-migrate @ 4289]
Sean Egan <seanegan@gmail.com>
parents: 3986
diff changeset
321 gtk_window_set_role(GTK_WINDOW(joinchat), "joinchat");
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4423
diff changeset
322 gtk_window_set_resizable(GTK_WINDOW(joinchat), TRUE);
834
bac7089491c1 [gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 823
diff changeset
323 gtk_widget_realize(joinchat);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
324 g_signal_connect(G_OBJECT(joinchat), "delete_event",
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4092
diff changeset
325 G_CALLBACK(destroy_join_chat), joinchat);
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
326 gtk_window_set_title(GTK_WINDOW(joinchat), _("Join Chat"));
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
327
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
328 mainbox = gtk_vbox_new(FALSE, 5);
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
329 gtk_container_set_border_width(GTK_CONTAINER(mainbox), 5);
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
330 gtk_container_add(GTK_CONTAINER(joinchat), mainbox);
456
725ffb93aedc [gaim-migrate @ 466]
Rob Flynn <gaim@robflynn.com>
parents: 449
diff changeset
331
5530
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
332 frame = gaim_gtk_make_frame(mainbox, _("Buddy Chat"));
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
333
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
334 fbox = gtk_vbox_new(FALSE, 5);
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
335 gtk_container_set_border_width(GTK_CONTAINER(fbox), 5);
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
336 gtk_container_add(GTK_CONTAINER(frame), fbox);
456
725ffb93aedc [gaim-migrate @ 466]
Rob Flynn <gaim@robflynn.com>
parents: 449
diff changeset
337
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1018
diff changeset
338 #ifndef NO_MULTI
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
339 rowbox = gtk_hbox_new(FALSE, 5);
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
340 gtk_box_pack_start(GTK_BOX(fbox), rowbox, TRUE, TRUE, 0);
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
341
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
342 label = gtk_label_new(_("Join Chat As:"));
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
343 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
344
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
345 create_joinchat_menu(rowbox);
1806
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1793
diff changeset
346
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
347 jc_vbox = gtk_vbox_new(FALSE, 5);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
348 gtk_container_add(GTK_CONTAINER(fbox), jc_vbox);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
349 gtk_container_set_border_width(GTK_CONTAINER(jc_vbox), 0);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
350
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1018
diff changeset
351 #else
5914
1344aeab6baa [gaim-migrate @ 6346]
Nathan Walp <nwalp@pidgin.im>
parents: 5882
diff changeset
352 joinchatgc = gaim_connections_get_all()->data;
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1018
diff changeset
353 #endif
1806
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1793
diff changeset
354 rebuild_jc();
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
355 /* buttons */
692
f4026275bc9f [gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 666
diff changeset
356
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
357 sep = gtk_hseparator_new();
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
358 gtk_widget_show(sep);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
359 gtk_box_pack_start(GTK_BOX(mainbox), sep, FALSE, FALSE, 0);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
360
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
361 bbox = gtk_hbox_new(FALSE, 5);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
362 gtk_box_pack_start(GTK_BOX(mainbox), bbox, FALSE, FALSE, 0);
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
363
4423
4bb433a7331c [gaim-migrate @ 4696]
Mark Doliner <mark@kingant.net>
parents: 4359
diff changeset
364 /* Join button. */
4bb433a7331c [gaim-migrate @ 4696]
Mark Doliner <mark@kingant.net>
parents: 4359
diff changeset
365 join = gaim_pixbuf_button_from_stock(_("Join"), GTK_STOCK_JUMP_TO,
4bb433a7331c [gaim-migrate @ 4696]
Mark Doliner <mark@kingant.net>
parents: 4359
diff changeset
366 GAIM_BUTTON_HORIZONTAL);
4bb433a7331c [gaim-migrate @ 4696]
Mark Doliner <mark@kingant.net>
parents: 4359
diff changeset
367 gtk_box_pack_end(GTK_BOX(bbox), join, FALSE, FALSE, 0);
4bb433a7331c [gaim-migrate @ 4696]
Mark Doliner <mark@kingant.net>
parents: 4359
diff changeset
368 g_signal_connect(G_OBJECT(join), "clicked",
4bb433a7331c [gaim-migrate @ 4696]
Mark Doliner <mark@kingant.net>
parents: 4359
diff changeset
369 G_CALLBACK(do_join_chat), NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
370 /* Cancel button. */
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
371 cancel = gaim_pixbuf_button_from_stock(_("Cancel"), GTK_STOCK_CANCEL,
4423
4bb433a7331c [gaim-migrate @ 4696]
Mark Doliner <mark@kingant.net>
parents: 4359
diff changeset
372 GAIM_BUTTON_HORIZONTAL);
2252
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
373 gtk_box_pack_end(GTK_BOX(bbox), cancel, FALSE, FALSE, 0);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
374 g_signal_connect(G_OBJECT(cancel), "clicked",
4423
4bb433a7331c [gaim-migrate @ 4696]
Mark Doliner <mark@kingant.net>
parents: 4359
diff changeset
375 G_CALLBACK(destroy_join_chat), joinchat);
2374
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
376
2630
5004f7eb3d4d [gaim-migrate @ 2643]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2625
diff changeset
377 }
1504
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
378
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
379 gtk_widget_show_all(joinchat);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
380 }