annotate src/buddy_chat.c @ 6731:b4943b9cea2b

[gaim-migrate @ 7258] No more buddy list weird duplication when dragging the first contact in a group committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Wed, 03 Sep 2003 13:08:07 +0000
parents a4f2aba0848d
children 357eb1c39b72
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
4859
a9a831508b43 [gaim-migrate @ 5186]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4635
diff changeset
33 #ifdef _WIN32
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5717
diff changeset
34 # include "wspell.h"
4859
a9a831508b43 [gaim-migrate @ 5186]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4635
diff changeset
35 #endif
a9a831508b43 [gaim-migrate @ 5186]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4635
diff changeset
36
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
37 static GList *chatentries = NULL;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
38 static GtkWidget *joinchat = NULL;
1807
ba8f463744c0 [gaim-migrate @ 1817]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1806
diff changeset
39 static GtkWidget *jc_vbox = NULL;
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5530
diff changeset
40 static GaimConnection *joinchatgc;
3762
ac18a395eced [gaim-migrate @ 3901]
Rob Flynn <gaim@robflynn.com>
parents: 3716
diff changeset
41
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
42 static void
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
43 do_join_chat()
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
44 {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
45 if (joinchat) {
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5205
diff changeset
46 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
47 g_free, g_free);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
48 GList *tmp;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
49
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
50 for (tmp = chatentries; tmp != NULL; tmp = tmp->next) {
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4423
diff changeset
51 if (g_object_get_data(tmp->data, "is_spin")) {
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5205
diff changeset
52 g_hash_table_replace(components,
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5205
diff changeset
53 g_strdup(g_object_get_data(tmp->data, "identifier")),
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5205
diff changeset
54 g_strdup_printf("%d",
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5205
diff changeset
55 gtk_spin_button_get_value_as_int(tmp->data)));
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
56 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
57 else {
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5205
diff changeset
58 g_hash_table_replace(components,
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5205
diff changeset
59 g_strdup(g_object_get_data(tmp->data, "identifier")),
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5205
diff changeset
60 g_strdup(gtk_entry_get_text(tmp->data)));
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
61 }
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
62 }
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
63
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5205
diff changeset
64 serv_join_chat(joinchatgc, components);
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
65
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5205
diff changeset
66 g_hash_table_destroy(components);
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
67
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
68 gtk_widget_destroy(joinchat);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
69
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
70 if (chatentries)
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
71 g_list_free(chatentries);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
72
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
73 chatentries = NULL;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
74 joinchat = NULL;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
75 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
76 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
77
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
78 static void
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
79 rebuild_jc()
1806
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1793
diff changeset
80 {
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
1806
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1793
diff changeset
85 if (!joinchatgc)
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1793
diff changeset
86 return;
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1793
diff changeset
87
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
88 while (GTK_BOX(jc_vbox)->children)
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
89 gtk_container_remove(GTK_CONTAINER(jc_vbox),
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
90 ((GtkBoxChild *)GTK_BOX(jc_vbox)->children->data)->widget);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
91
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
92 if (chatentries)
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
93 g_list_free(chatentries);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
94
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
95 chatentries = NULL;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
96
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4859
diff changeset
97 list = GAIM_PLUGIN_PROTOCOL_INFO(joinchatgc->prpl)->chat_info(joinchatgc);
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 for (tmp = list; tmp != NULL; tmp = tmp->next) {
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
100 GtkWidget *label;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
101 GtkWidget *rowbox;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
102
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
103 pce = tmp->data;
2205
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 rowbox = gtk_hbox_new(FALSE, 5);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
106 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
107 gtk_widget_show(rowbox);
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 label = gtk_label_new(pce->label);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
110 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
111 gtk_widget_show(label);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
112
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
113 if (pce->is_int) {
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
114 GtkObject *adjust;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
115 GtkWidget *spin;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
116 adjust = gtk_adjustment_new(pce->min, pce->min,
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
117 pce->max, 1, 10, 10);
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
118 spin = gtk_spin_button_new(GTK_ADJUSTMENT(adjust), 1, 0);
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4423
diff changeset
119 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
120 g_object_set_data(G_OBJECT(spin), "identifier", pce->identifier);
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
121 chatentries = g_list_append(chatentries, spin);
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4423
diff changeset
122 gtk_widget_set_size_request(spin, 50, -1);
2346
b1c1e3401e10 [gaim-migrate @ 2359]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2345
diff changeset
123 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
124 gtk_widget_show(spin);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
125 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
126 else {
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
127 GtkWidget *entry;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
128
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
129 entry = gtk_entry_new();
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
130 gtk_box_pack_end(GTK_BOX(rowbox), entry, FALSE, FALSE, 0);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
131
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
132 chatentries = g_list_append(chatentries, 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
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
142 g_signal_connect(G_OBJECT(entry), "activate",
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
143 G_CALLBACK(do_join_chat), NULL);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5205
diff changeset
144 g_object_set_data(G_OBJECT(entry), "identifier", pce->identifier);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
145
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
146 gtk_widget_show(entry);
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
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
149 g_free(pce);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
150 }
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
151
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
152 g_list_free(list);
1806
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1793
diff changeset
153 }
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1793
diff changeset
154
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
155 static void
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5530
diff changeset
156 joinchat_choose(GtkWidget *w, GaimConnection *g)
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
157 {
1806
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1793
diff changeset
158 if (joinchatgc == g)
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1793
diff changeset
159 return;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
160
5943
a4f2aba0848d [gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents: 5914
diff changeset
161 if (gaim_account_get_protocol(joinchatgc->account) ==
a4f2aba0848d [gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents: 5914
diff changeset
162 gaim_account_get_protocol(g->account)) {
a4f2aba0848d [gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents: 5914
diff changeset
163
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5205
diff changeset
164 joinchatgc = g;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5205
diff changeset
165 } else {
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5205
diff changeset
166 joinchatgc = g;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5205
diff changeset
167 rebuild_jc();
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5205
diff changeset
168 }
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
169 }
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
170
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
171 static void
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
172 create_joinchat_menu(GtkWidget *box)
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
173 {
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5530
diff changeset
174 GaimAccount *account;
5881
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
175 GtkWidget *hbox;
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
176 GtkWidget *label;
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
177 GtkWidget *optmenu;
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
178 GtkWidget *menu;
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
179 GtkWidget *opt;
5881
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
180 GtkWidget *image;
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
181 GdkPixbuf *pixbuf;
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
182 GdkPixbuf *scale;
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
183 GtkSizeGroup *sg;
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5530
diff changeset
184 GList *c;
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5530
diff changeset
185 GaimConnection *g;
5881
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
186 const char *proto_name;
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
187 char *filename;
1235
a9cf2f61a7b1 [gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1228
diff changeset
188 char buf[2048];
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
189
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
190 optmenu = gtk_option_menu_new();
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
191 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
192
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
193 menu = gtk_menu_new();
1793
00c753b86710 [gaim-migrate @ 1803]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1780
diff changeset
194 joinchatgc = NULL;
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
195
5881
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
196 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
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 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
199 GaimPluginProtocolInfo *prpl_info = NULL;
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
200 GaimPlugin *plugin;
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
201
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5530
diff changeset
202 g = (GaimConnection *)c->data;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
203
5881
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
204 plugin = g->prpl;
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
205
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
206 if (plugin == NULL)
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
207 continue;
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
208
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
209 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(plugin);
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
210
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
211 if (prpl_info == NULL || prpl_info->join_chat == NULL)
1356
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
212 continue;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
213
1793
00c753b86710 [gaim-migrate @ 1803]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1780
diff changeset
214 if (!joinchatgc)
00c753b86710 [gaim-migrate @ 1803]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1780
diff changeset
215 joinchatgc = g;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
216
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5530
diff changeset
217 account = gaim_connection_get_account(g);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5530
diff changeset
218
5881
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
219 opt = gtk_menu_item_new();
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
220
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
221 /* Create the hbox. */
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
222 hbox = gtk_hbox_new(FALSE, 4);
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
223 gtk_container_add(GTK_CONTAINER(opt), hbox);
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
224 gtk_widget_show(hbox);
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
225
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
226 /* Load the image. */
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
227 if (prpl_info != NULL) {
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
228 proto_name = prpl_info->list_icon(NULL, NULL);
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
229 g_snprintf(buf, sizeof(buf), "%s.png", proto_name);
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
230
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
231 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status",
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
232 "default", buf, NULL);
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
233 pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
234 g_free(filename);
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
235
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
236 if (pixbuf != NULL) {
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
237 /* Scale and insert the image */
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
238 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16,
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
239 GDK_INTERP_BILINEAR);
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
240 image = gtk_image_new_from_pixbuf(scale);
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
241
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
242 g_object_unref(G_OBJECT(pixbuf));
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
243 g_object_unref(G_OBJECT(scale));
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
244 }
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
245 else
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
246 image = gtk_image_new();
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
247 }
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
248 else
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
249 image = gtk_image_new();
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
250
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
251 gtk_size_group_add_widget(sg, image);
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
252
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
253 gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0);
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
254 gtk_widget_show(image);
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
255
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
256 g_snprintf(buf, sizeof(buf), "%s (%s)",
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
257 gaim_account_get_username(account), plugin->info->name);
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
258
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
259 /* Create the label. */
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
260 label = gtk_label_new(buf);
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
261 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
262 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
263 gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0);
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
264 gtk_widget_show(label);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
265
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4423
diff changeset
266 g_object_set_data(G_OBJECT(opt), "gaim_connection", g);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
267
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
268 g_signal_connect(G_OBJECT(opt), "activate",
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
269 G_CALLBACK(joinchat_choose), g);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
270
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4423
diff changeset
271 gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt);
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
272 gtk_widget_show(opt);
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
273 }
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
274
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
275 gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), menu);
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
276 gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), 0);
5881
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
277
cc7870e1e3b3 [gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
278 g_object_unref(sg);
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
279 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
280
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
281 static void
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
282 destroy_join_chat()
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
283 {
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
284 if (joinchat)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
285 gtk_widget_destroy(joinchat);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
286
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
287 joinchat = NULL;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
288 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
289
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
290 void
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
291 join_chat()
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
292 {
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
293 GtkWidget *mainbox;
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
294 GtkWidget *frame;
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
295 GtkWidget *fbox;
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
296 GtkWidget *rowbox;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
297 GtkWidget *bbox;
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
298 GtkWidget *join;
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
299 GtkWidget *cancel;
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
300 GtkWidget *label;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
301 GtkWidget *sep;
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5530
diff changeset
302 GList *c;
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5530
diff changeset
303 GaimConnection *gc = NULL;
1356
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
304
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5530
diff changeset
305 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
306 gc = c->data;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
307
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4859
diff changeset
308 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->join_chat)
1356
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
309 break;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
310
1356
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
311 gc = NULL;
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
312 }
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
313
1356
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
314 if (gc == NULL) {
5436
ad445074d239 [gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
315 gaim_notify_error(NULL, NULL,
5498
cce2d7868c78 [gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents: 5436
diff changeset
316 _("You are not currently signed on with any "
5436
ad445074d239 [gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
317 "protocols that have the ability to chat."),
ad445074d239 [gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
318 NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
319
1356
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
320 return;
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
321 }
456
725ffb93aedc [gaim-migrate @ 466]
Rob Flynn <gaim@robflynn.com>
parents: 449
diff changeset
322
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
323 if (!joinchat) {
2725
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2699
diff changeset
324 GAIM_DIALOG(joinchat);
4074
3ccbdf8e7f8d [gaim-migrate @ 4289]
Sean Egan <seanegan@gmail.com>
parents: 3986
diff changeset
325 gtk_window_set_role(GTK_WINDOW(joinchat), "joinchat");
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4423
diff changeset
326 gtk_window_set_resizable(GTK_WINDOW(joinchat), TRUE);
834
bac7089491c1 [gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 823
diff changeset
327 gtk_widget_realize(joinchat);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
328 g_signal_connect(G_OBJECT(joinchat), "delete_event",
4162
d3c8d2b40494 [gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents: 4092
diff changeset
329 G_CALLBACK(destroy_join_chat), joinchat);
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
330 gtk_window_set_title(GTK_WINDOW(joinchat), _("Join Chat"));
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
331
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
332 mainbox = gtk_vbox_new(FALSE, 5);
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
333 gtk_container_set_border_width(GTK_CONTAINER(mainbox), 5);
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
334 gtk_container_add(GTK_CONTAINER(joinchat), mainbox);
456
725ffb93aedc [gaim-migrate @ 466]
Rob Flynn <gaim@robflynn.com>
parents: 449
diff changeset
335
5530
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
336 frame = gaim_gtk_make_frame(mainbox, _("Buddy Chat"));
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
337
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
338 fbox = gtk_vbox_new(FALSE, 5);
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
339 gtk_container_set_border_width(GTK_CONTAINER(fbox), 5);
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
340 gtk_container_add(GTK_CONTAINER(frame), fbox);
456
725ffb93aedc [gaim-migrate @ 466]
Rob Flynn <gaim@robflynn.com>
parents: 449
diff changeset
341
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1018
diff changeset
342 #ifndef NO_MULTI
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
343 rowbox = gtk_hbox_new(FALSE, 5);
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
344 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
345
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
346 label = gtk_label_new(_("Join Chat As:"));
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
347 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
348
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
349 create_joinchat_menu(rowbox);
1806
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1793
diff changeset
350
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
351 jc_vbox = gtk_vbox_new(FALSE, 5);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
352 gtk_container_add(GTK_CONTAINER(fbox), jc_vbox);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
353 gtk_container_set_border_width(GTK_CONTAINER(jc_vbox), 0);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
354
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1018
diff changeset
355 #else
5914
1344aeab6baa [gaim-migrate @ 6346]
Nathan Walp <nwalp@pidgin.im>
parents: 5882
diff changeset
356 joinchatgc = gaim_connections_get_all()->data;
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1018
diff changeset
357 #endif
1806
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1793
diff changeset
358 rebuild_jc();
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
359 /* buttons */
692
f4026275bc9f [gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 666
diff changeset
360
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
361 sep = gtk_hseparator_new();
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
362 gtk_widget_show(sep);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
363 gtk_box_pack_start(GTK_BOX(mainbox), sep, FALSE, FALSE, 0);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
364
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
365 bbox = gtk_hbox_new(FALSE, 5);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
366 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
367
4423
4bb433a7331c [gaim-migrate @ 4696]
Mark Doliner <mark@kingant.net>
parents: 4359
diff changeset
368 /* Join button. */
4bb433a7331c [gaim-migrate @ 4696]
Mark Doliner <mark@kingant.net>
parents: 4359
diff changeset
369 join = gaim_pixbuf_button_from_stock(_("Join"), GTK_STOCK_JUMP_TO,
4bb433a7331c [gaim-migrate @ 4696]
Mark Doliner <mark@kingant.net>
parents: 4359
diff changeset
370 GAIM_BUTTON_HORIZONTAL);
4bb433a7331c [gaim-migrate @ 4696]
Mark Doliner <mark@kingant.net>
parents: 4359
diff changeset
371 gtk_box_pack_end(GTK_BOX(bbox), join, FALSE, FALSE, 0);
4bb433a7331c [gaim-migrate @ 4696]
Mark Doliner <mark@kingant.net>
parents: 4359
diff changeset
372 g_signal_connect(G_OBJECT(join), "clicked",
4bb433a7331c [gaim-migrate @ 4696]
Mark Doliner <mark@kingant.net>
parents: 4359
diff changeset
373 G_CALLBACK(do_join_chat), NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
374 /* Cancel button. */
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
375 cancel = gaim_pixbuf_button_from_stock(_("Cancel"), GTK_STOCK_CANCEL,
4423
4bb433a7331c [gaim-migrate @ 4696]
Mark Doliner <mark@kingant.net>
parents: 4359
diff changeset
376 GAIM_BUTTON_HORIZONTAL);
2252
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
377 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
378 g_signal_connect(G_OBJECT(cancel), "clicked",
4423
4bb433a7331c [gaim-migrate @ 4696]
Mark Doliner <mark@kingant.net>
parents: 4359
diff changeset
379 G_CALLBACK(destroy_join_chat), joinchat);
2374
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
380
2630
5004f7eb3d4d [gaim-migrate @ 2643]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2625
diff changeset
381 }
1504
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
382
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
383 gtk_widget_show_all(joinchat);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
384 }